From f4b047042ba94654e9098ad9039b92fc106fff09 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Sat, 17 Jul 2010 18:04:24 +0200 Subject: [PATCH] Directly passes profile to set_profile_display. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- include/name.func.inc.php | 6 ++---- include/validations/names.inc.php | 2 +- modules/profile/general.inc.php | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/include/name.func.inc.php b/include/name.func.inc.php index 272f1e4..2698650 100644 --- a/include/name.func.inc.php +++ b/include/name.func.inc.php @@ -189,7 +189,7 @@ function build_sort_name(&$search_names, &$sn_types) return $name; } -function set_profile_display(&$display_names, $pid) +function set_profile_display(&$display_names, Profile $profile) { XDB::execute("UPDATE profile_display SET public_name = {?}, private_name = {?}, @@ -197,10 +197,8 @@ function set_profile_display(&$display_names, $pid) WHERE pid = {?}", $display_names['public_name'], $display_names['private_name'], $display_names['directory_name'], $display_names['short_name'], - $display_names['sort_name'], $pid); + $display_names['sort_name'], $profile->id()); - /* XXX: Inefficient, should directly take the profile as parameter */ - $profile = Profile::get($pid); $owner = $profile->owner(); if ($owner) { XDB::execute('UPDATE accounts diff --git a/include/validations/names.inc.php b/include/validations/names.inc.php index 712f4e1..2893d65 100644 --- a/include/validations/names.inc.php +++ b/include/validations/names.inc.php @@ -130,7 +130,7 @@ class NamesReq extends ProfileValidate { require_once 'name.func.inc.php'; - set_profile_display($this->display_names, $this->profile->id()); + set_profile_display($this->display_names, $this->profile); if (!is_null($this->profileOwner)) { set_alias_names($this->sn_new, $this->sn_old, $this->profile->id(), diff --git a/modules/profile/general.inc.php b/modules/profile/general.inc.php index 362c5eb..c89c11c 100644 --- a/modules/profile/general.inc.php +++ b/modules/profile/general.inc.php @@ -231,7 +231,7 @@ class ProfileSettingSearchNames implements ProfileSetting $display_names = array(); build_display_names($display_names, $this->search_names, $page->profile->isFemale(), $this->private_name_end); - set_profile_display($display_names, $page->pid()); + set_profile_display($display_names, $page->profile); } } -- 2.1.4