X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=modules%2Fprofile%2Fgeneral.inc.php;h=470d7ec0b61055700ddaaa3db2277b54ef335415;hb=7996ae8cd41fbb3ccd748eaed71a50f866269c6e;hp=4359cacbaacf5e60345e17710df56f28b2578546;hpb=e8a7cf31258ca08662a91f7db64f17d056d8a6a4;p=platal.git diff --git a/modules/profile/general.inc.php b/modules/profile/general.inc.php index 4359cac..470d7ec 100644 --- a/modules/profile/general.inc.php +++ b/modules/profile/general.inc.php @@ -19,6 +19,8 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ +require_once 'name.func.inc.php'; + class ProfileSettingSearchNames implements ProfileSetting { private $private_name_end; @@ -38,8 +40,7 @@ class ProfileSettingSearchNames implements ProfileSetting private function prepareField($value) { - $value = mb_strtoupper($value); - return preg_replace('/[^A-Z]/', ' ', $value); + return name_to_basename($value); } private function prepare(ProfilePage &$page, $field, $value, $init, &$success) @@ -153,11 +154,18 @@ class ProfileSettingSearchNames implements ProfileSetting } if ($sn['pub']) { if (isset($sn['particle']) && ($sn['particle'] != '')) { + // particle is before first blank list($particle, $name) = explode(' ', $sn['name'], 2); $particle = trim($particle) . ' '; if (!$name) { + // particle is before first quote list($particle, $name) = explode('\'', $sn['name'], 2); $particle = trim($particle); + if (!$name) { + // actually there is no particle + $particle = ''; + $name = $sn['name']; + } } } else { $particle = ''; @@ -555,7 +563,8 @@ class ProfileSettingGeneral extends ProfilePage if ($this->changed['yourself']) { XDB::execute('UPDATE accounts SET display_name = {?} - WHERE pid = {?}', $this->pid()); + WHERE uid = {?}', + $this->values['yourself'], $this->owner->id()); } if ($this->changed['promo_display']) { if ($this->values['promo_display']{0} == $this->profile->mainEducation()