X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fname.func.inc.php;h=7fd7623e5149faec334f5a4c7587ac042bc12e0e;hb=3ec8ae8ea229f68d2ec8ba9f3ada0a1e05d17f1a;hp=269865038d80094b811ca2f7db2e5e1415934c69;hpb=f4b047042ba94654e9098ad9039b92fc106fff09;p=platal.git diff --git a/include/name.func.inc.php b/include/name.func.inc.php index 2698650..7fd7623 100644 --- a/include/name.func.inc.php +++ b/include/name.func.inc.php @@ -202,9 +202,9 @@ function set_profile_display(&$display_names, Profile $profile) $owner = $profile->owner(); if ($owner) { XDB::execute('UPDATE accounts - SET full_name = {?} + SET full_name = {?}, directory_name = {?} WHERE uid = {?}', - $display_names['public_name'], $owner->id()); + $display_names['public_name'], $display_names['directory_name'], $owner->id()); } } @@ -252,18 +252,12 @@ function set_alias_names(&$sn_new, $sn_old, $pid, $uid, $update_new = false, $ne $has_new = false; foreach ($sn_new as $typeid => $sn) { if (isset($sn['pub'])) { - if (isset($sn_old[$typeid]) && ($sn_old[$typeid]['fullname'] == $sn['fullname'] && $update_new)) { + if (isset($sn_old[$typeid]) && $update_new) { XDB::execute("UPDATE profile_name SET particle = {?}, name = {?}, typeid = {?} WHERE id = {?} AND pid = {?}", $sn['particle'], $sn['name'], $typeid, $sn_old[$typeid]['id'], $pid); unset($sn_old[$typeid]); - } elseif ($update_new - || (isset($sn_old[$typeid]) && compare_basename($sn_old[$typeid]['fullname'], $sn['fullname']))) { - XDB::execute("INSERT INTO profile_name (particle, name, typeid, pid) - VALUES ({?}, {?}, {?}, {?})", - $sn['particle'], $sn['name'], $typeid, $pid); - unset($sn_old[$typeid]); } else { $has_new = true; } @@ -308,7 +302,7 @@ function set_alias_names(&$sn_new, $sn_old, $pid, $uid, $update_new = false, $ne VALUES ({?}, 'alias', 'usage', {?})", $new_alias, $uid); } - Profile::rebuildSearchTokens($pid); + Profile::rebuildSearchTokens($pid, false); return $has_new; }