From: Stéphane Jacob Date: Sun, 6 Feb 2011 20:46:27 +0000 (+0100) Subject: Do not store profile modification of null fields. X-Git-Tag: xorg/1.1.0~1^2~41 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=39cb9bf31c55a6015b7a6442fe65d4e92760b218;p=platal.git Do not store profile modification of null fields. Signed-off-by: Stéphane Jacob --- diff --git a/modules/profile/page.inc.php b/modules/profile/page.inc.php index 9501b58..1323e86 100644 --- a/modules/profile/page.inc.php +++ b/modules/profile/page.inc.php @@ -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 (!is_null($field)) { + 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;