diff options
author | mistic100 <mistic@piwigo.org> | 2013-10-19 17:43:04 +0000 |
---|---|---|
committer | mistic100 <mistic@piwigo.org> | 2013-10-19 17:43:04 +0000 |
commit | ae707279a1945e383c312cd648d288606a79e341 (patch) | |
tree | 917bdc6e0609ed0eefed5f3693de3a017685acc4 /password.php | |
parent | 35ff1b7c1f933799397a0ce0a6723cf82f416ff3 (diff) |
remove all array_push (50% slower than []) + some changes missing for feature:2978
git-svn-id: http://piwigo.org/svn/trunk@25018 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'password.php')
-rw-r--r-- | password.php | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/password.php b/password.php index 6b0221fac..f1b446832 100644 --- a/password.php +++ b/password.php @@ -53,7 +53,7 @@ function process_password_request() if (empty($_POST['username_or_email'])) { - array_push($page['errors'], l10n('Invalid username or email')); + $page['errors'][] = l10n('Invalid username or email'); return false; } @@ -66,7 +66,7 @@ function process_password_request() if (!is_numeric($user_id)) { - array_push($page['errors'], l10n('Invalid username or email')); + $page['errors'][] = l10n('Invalid username or email'); return false; } @@ -76,18 +76,15 @@ function process_password_request() $status = $userdata['status']; if (is_a_guest($status) or is_generic($status)) { - array_push($page['errors'], l10n('Password reset is not allowed for this user')); + $page['errors'][] = l10n('Password reset is not allowed for this user'); return false; } if (empty($userdata['email'])) { - array_push( - $page['errors'], - l10n( - 'User "%s" has no email address, password reset is not possible', - $userdata['username'] - ) + $page['errors'][] = l10n( + 'User "%s" has no email address, password reset is not possible', + $userdata['username'] ); return false; } @@ -130,12 +127,12 @@ function process_password_request() if (pwg_mail($userdata['email'], $email_params)) { - array_push($page['infos'], l10n('Check your email for the confirmation link')); + $page['infos'][] = l10n('Check your email for the confirmation link'); return true; } else { - array_push($page['errors'], l10n('Error sending email')); + $page['errors'][] = l10n('Error sending email'); return false; } } @@ -152,7 +149,7 @@ function check_password_reset_key($key) if (!preg_match('/^[a-z0-9]{20}$/i', $key)) { - array_push($page['errors'], l10n('Invalid key')); + $page['errors'][] = l10n('Invalid key'); return false; } @@ -167,7 +164,7 @@ SELECT if (pwg_db_num_rows($result) == 0) { - array_push($page['errors'], l10n('Invalid key')); + $page['errors'][] = l10n('Invalid key'); return false; } @@ -175,7 +172,7 @@ SELECT if (is_a_guest($userdata['status']) or is_generic($userdata['status'])) { - array_push($page['errors'], l10n('Password reset is not allowed for this user')); + $page['errors'][] = l10n('Password reset is not allowed for this user'); return false; } @@ -194,7 +191,7 @@ function reset_password() if ($_POST['use_new_pwd'] != $_POST['passwordConf']) { - array_push($page['errors'], l10n('The passwords do not match')); + $page['errors'][] = l10n('The passwords do not match'); return false; } @@ -203,7 +200,7 @@ function reset_password() $user_id = check_password_reset_key($_GET['key']); if (!is_numeric($user_id)) { - array_push($page['errors'], l10n('Invalid key')); + $page['errors'][] = l10n('Invalid key'); return false; } } @@ -212,7 +209,7 @@ function reset_password() // we check the currently logged in user if (is_a_guest() or is_generic()) { - array_push($page['errors'], l10n('Password reset is not allowed for this user')); + $page['errors'][] = l10n('Password reset is not allowed for this user'); return false; } @@ -225,15 +222,15 @@ function reset_password() array($conf['user_fields']['id'] => $user_id) ); - array_push($page['infos'], l10n('Your password has been reset')); + $page['infos'][] = l10n('Your password has been reset'); if (isset($_GET['key'])) { - array_push($page['infos'], '<a href="'.get_root_url().'identification.php">'.l10n('Login').'</a>'); + $page['infos'][] = '<a href="'.get_root_url().'identification.php">'.l10n('Login').'</a>'; } else { - array_push($page['infos'], '<a href="'.get_gallery_home_url().'">'.l10n('Return to home page').'</a>'); + $page['infos'][] = '<a href="'.get_gallery_home_url().'">'.l10n('Return to home page').'</a>'; } return true; |