From ae707279a1945e383c312cd648d288606a79e341 Mon Sep 17 00:00:00 2001 From: mistic100 Date: Sat, 19 Oct 2013 17:43:04 +0000 Subject: 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 --- password.php | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) (limited to 'password.php') 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'], ''.l10n('Login').''); + $page['infos'][] = ''.l10n('Login').''; } else { - array_push($page['infos'], ''.l10n('Return to home page').''); + $page['infos'][] = ''.l10n('Return to home page').''; } return true; -- cgit v1.2.3