X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fprofile%2Fpage.inc.php;h=76be815572f48b18284d7385509ba434c51ec35d;hb=5ca0a2863c4d7e72fe00d7c8ff98475864216ab8;hp=f23919f09cc739d9f8e67fbd0c96f857bf6ff7f7;hpb=c52be69950d31821a8a091f08ad9170e1042eaf8;p=platal.git diff --git a/modules/profile/page.inc.php b/modules/profile/page.inc.php index f23919f..76be815 100644 --- a/modules/profile/page.inc.php +++ b/modules/profile/page.inc.php @@ -1,6 +1,6 @@ values[$field]) ? $page->values[$field] : S::v($field); @@ -70,7 +70,7 @@ class ProfileSettingWeb extends ProfileNoSave class ProfileSettingEmail extends ProfileNoSave { - public function value(ProfilePage &$page, $field, $value, &$success) + public function value(ProfilePage $page, $field, $value, &$success) { if (is_null($value)) { return isset($page->values[$field]) ? $page->values[$field] : S::v($field); @@ -86,7 +86,7 @@ class ProfileSettingEmail extends ProfileNoSave class ProfileSettingNumber extends ProfileNoSave { - public function value(ProfilePage &$page, $field, $value, &$success) + public function value(ProfilePage $page, $field, $value, &$success) { if (is_null($value)) { return isset($page->values[$field]) ? $page->values[$field] : S::v($field); @@ -102,13 +102,13 @@ class ProfileSettingNumber extends ProfileNoSave class ProfileSettingPhones implements ProfileSetting { - public function value(ProfilePage &$page, $field, $value, &$success) + public function value(ProfilePage $page, $field, $value, &$success) { $success = true; $phones = array(); if (is_null($value)) { - $it = Phone::iterate(array($page->pid()), array(Phone::LINK_PROFILE), array(0)); + $it = Phone::iterate(array($page->pid()), array(Phone::LINK_PROFILE), array(0), Visibility::get(Visibility::VIEW_PRIVATE)); while ($phone = $it->next()) { $success = ($phone->format() && $success); $phones[] = $phone->toFormArray(); @@ -127,7 +127,7 @@ class ProfileSettingPhones implements ProfileSetting } } - public function save(ProfilePage &$page, $field, $value) + public function save(ProfilePage $page, $field, $value) { Phone::deletePhones($page->pid(), Phone::LINK_PROFILE, null, S::user()->isMe($page->owner) || S::admin()); Phone::savePhones($value, $page->pid(), Phone::LINK_PROFILE); @@ -141,7 +141,7 @@ class ProfileSettingPhones implements ProfileSetting class ProfileSettingPub extends ProfileNoSave { - public function value(ProfilePage &$page, $field, $value, &$success) + public function value(ProfilePage $page, $field, $value, &$success) { $success = true; if (is_null($value)) { @@ -163,7 +163,7 @@ class ProfileSettingPub extends ProfileNoSave class ProfileSettingBool extends ProfileNoSave { - public function value(ProfilePage &$page, $field, $value, &$success) + public function value(ProfilePage $page, $field, $value, &$success) { $success = true; if (is_null($value)) { @@ -182,7 +182,7 @@ class ProfileSettingDate extends ProfileNoSave $this->allowEmpty = $allowEmpty; } - public function value(ProfilePage &$page, $field, $value, &$success) + public function value(ProfilePage $page, $field, $value, &$success) { $success = true; if (is_null($value)) { @@ -228,7 +228,7 @@ abstract class ProfilePage implements PlWizardPage public $profile = null; public $owner = null; - public function __construct(PlWizard &$wiz) + public function __construct(PlWizard $wiz) { $this->wizard =& $wiz; $this->profile = $this->wizard->getUserData('profile'); @@ -306,12 +306,14 @@ abstract class ProfilePage implements PlWizardPage $user = S::user(); if ($owner->isActive()) { foreach ($changedFields as $field => $values) { - XDB::execute('INSERT INTO profile_modifications (pid, uid, field, oldText, newText, type, timestamp) - VALUES ({?}, {?}, {?}, {?}, {?}, {?}, NOW()) - ON DUPLICATE KEY UPDATE uid = VALUES(uid), oldText = IF(VALUES(type) != type, VALUES(oldText), oldText), - newText = VALUES(newText), type = VALUES(type), timestamp = NOW()', - $this->pid(), $user->id(), Profile::$descriptions[$field], $values[0], $values[1], - ($owner->id() == $user->id()) ? 'self' : 'third_party'); + if (in_array($field, Profile::$descriptions)) { + XDB::execute('INSERT INTO profile_modifications (pid, uid, field, oldText, newText, type, timestamp) + VALUES ({?}, {?}, {?}, {?}, {?}, {?}, NOW()) + ON DUPLICATE KEY UPDATE uid = VALUES(uid), oldText = IF(VALUES(type) != type, VALUES(oldText), oldText), + newText = VALUES(newText), type = VALUES(type), timestamp = NOW()', + $this->pid(), $user->id(), Profile::$descriptions[$field], $values[0], $values[1], + ($owner->id() == $user->id()) ? 'self' : 'third_party'); + } } } return true; @@ -354,11 +356,11 @@ abstract class ProfilePage implements PlWizardPage return $this->profile->hrpid(); } - protected function _prepare(PlPage &$page, $id) + protected function _prepare(PlPage $page, $id) { } - public function prepare(PlPage &$page, $id) + public function prepare(PlPage $page, $id) { if (count($this->values) == 0) { $this->fetchData(); @@ -433,8 +435,8 @@ require_once dirname(__FILE__) . '/addresses.inc.php'; require_once dirname(__FILE__) . '/groups.inc.php'; require_once dirname(__FILE__) . '/decos.inc.php'; require_once dirname(__FILE__) . '/jobs.inc.php'; -require_once dirname(__FILE__) . '/skills.inc.php'; require_once dirname(__FILE__) . '/mentor.inc.php'; +require_once dirname(__FILE__) . '/deltaten.inc.php'; // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?>