use updateKeys() for updating the user
darcs-hash:20080622151611-34904-1d952df08b5247ab391bb76fd50d7b90498f0c96.gz
This commit is contained in:
parent
2b258b1a9a
commit
acf562b3dd
|
@ -51,11 +51,13 @@ class ConfirmemailAction extends Action {
|
||||||
$cur->query('BEGIN');
|
$cur->query('BEGIN');
|
||||||
|
|
||||||
$orig_user = clone($cur);
|
$orig_user = clone($cur);
|
||||||
|
|
||||||
$cur->email = $confirm_email->email;
|
$cur->email = $confirm_email->email;
|
||||||
$result = $cur->update($orig_user);
|
$result = $cur->updateKeys($orig_user);
|
||||||
|
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
common_log_db_error($cur, 'UPDATE', __FILE__);
|
common_log_db_error($cur, 'UPDATE', __FILE__);
|
||||||
|
$this->server_error(_t('Couldn\'t update user.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,6 +65,7 @@ class ConfirmemailAction extends Action {
|
||||||
|
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
common_log_db_error($confirm_email, 'DELETE', __FILE__);
|
common_log_db_error($confirm_email, 'DELETE', __FILE__);
|
||||||
|
$this->server_error(_t('Couldn\'t delete email confirmation.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,19 +114,22 @@ class ProfilesettingsAction extends SettingsAction {
|
||||||
|
|
||||||
$user->query('BEGIN');
|
$user->query('BEGIN');
|
||||||
|
|
||||||
$original = clone($user);
|
if ($user->nickname != $nickname) {
|
||||||
|
|
||||||
$user->nickname = $nickname;
|
$original = clone($user);
|
||||||
|
|
||||||
$result = $user->update($original);
|
$user->nickname = $nickname;
|
||||||
|
|
||||||
if (!$result) {
|
$result = $user->updateKeys($original);
|
||||||
common_log_db_error($user, 'UPDATE', __FILE__);
|
|
||||||
common_server_error(_t('Couldnt update user.'));
|
if (!$result) {
|
||||||
return;
|
common_log_db_error($user, 'UPDATE', __FILE__);
|
||||||
|
common_server_error(_t('Couldnt update user.'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($email != $original->email) {
|
if ($email != $user->email) {
|
||||||
|
|
||||||
$confirm = new Confirm_email();
|
$confirm = new Confirm_email();
|
||||||
$confirm->code = common_good_rand(16);
|
$confirm->code = common_good_rand(16);
|
||||||
|
@ -134,6 +137,7 @@ class ProfilesettingsAction extends SettingsAction {
|
||||||
$confirm->email = $email;
|
$confirm->email = $email;
|
||||||
|
|
||||||
$result = $confirm->insert();
|
$result = $confirm->insert();
|
||||||
|
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
common_log_db_error($confirm, 'INSERT', __FILE__);
|
common_log_db_error($confirm, 'INSERT', __FILE__);
|
||||||
common_server_error(_t('Couldnt confirm email.'));
|
common_server_error(_t('Couldnt confirm email.'));
|
||||||
|
|
|
@ -68,12 +68,12 @@ class User extends DB_DataObject
|
||||||
$parts = array();
|
$parts = array();
|
||||||
foreach (array('nickname', 'email') as $k) {
|
foreach (array('nickname', 'email') as $k) {
|
||||||
if ($this->$k != $orig->$k) {
|
if ($this->$k != $orig->$k) {
|
||||||
$parts[] = $k . '=' . $this->_quote($this->$k);
|
$parts[] = $k . ' = ' . $this->_quote($this->$k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count($parts) == 0) {
|
if (count($parts) == 0) {
|
||||||
# No changes
|
# No changes
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
$toupdate = implode(', ', $parts);
|
$toupdate = implode(', ', $parts);
|
||||||
$qry = 'UPDATE ' . $this->tableName() . ' SET ' . $toupdate .
|
$qry = 'UPDATE ' . $this->tableName() . ' SET ' . $toupdate .
|
||||||
|
|
Loading…
Reference in New Issue
Block a user