Changeset 25018 for trunk/password.php


Ignore:
Timestamp:
Oct 19, 2013, 7:43:04 PM (11 years ago)
Author:
mistic100
Message:

remove all array_push (50% slower than []) + some changes missing for feature:2978

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/password.php

    r25005 r25018  
    5454  if (empty($_POST['username_or_email']))
    5555  {
    56     array_push($page['errors'], l10n('Invalid username or email'));
     56    $page['errors'][] = l10n('Invalid username or email');
    5757    return false;
    5858  }
     
    6767  if (!is_numeric($user_id))
    6868  {
    69     array_push($page['errors'], l10n('Invalid username or email'));
     69    $page['errors'][] = l10n('Invalid username or email');
    7070    return false;
    7171  }
     
    7777  if (is_a_guest($status) or is_generic($status))
    7878  {
    79     array_push($page['errors'], l10n('Password reset is not allowed for this user'));
     79    $page['errors'][] = l10n('Password reset is not allowed for this user');
    8080    return false;
    8181  }
     
    8383  if (empty($userdata['email']))
    8484  {
    85     array_push(
    86       $page['errors'],
    87       l10n(
    88         'User "%s" has no email address, password reset is not possible',
    89         $userdata['username']
    90         )
     85    $page['errors'][] = l10n(
     86      'User "%s" has no email address, password reset is not possible',
     87      $userdata['username']
    9188      );
    9289    return false;
     
    131128  if (pwg_mail($userdata['email'], $email_params))
    132129  {
    133     array_push($page['infos'], l10n('Check your email for the confirmation link'));
     130    $page['infos'][] = l10n('Check your email for the confirmation link');
    134131    return true;
    135132  }
    136133  else
    137134  {
    138     array_push($page['errors'], l10n('Error sending email'));
     135    $page['errors'][] = l10n('Error sending email');
    139136    return false;
    140137  }
     
    153150  if (!preg_match('/^[a-z0-9]{20}$/i', $key))
    154151  {
    155     array_push($page['errors'], l10n('Invalid key'));
     152    $page['errors'][] = l10n('Invalid key');
    156153    return false;
    157154  }
     
    168165  if (pwg_db_num_rows($result) == 0)
    169166  {
    170     array_push($page['errors'], l10n('Invalid key'));
     167    $page['errors'][] = l10n('Invalid key');
    171168    return false;
    172169  }
     
    176173  if (is_a_guest($userdata['status']) or is_generic($userdata['status']))
    177174  {
    178     array_push($page['errors'], l10n('Password reset is not allowed for this user'));
     175    $page['errors'][] = l10n('Password reset is not allowed for this user');
    179176    return false;
    180177  }
     
    195192  if ($_POST['use_new_pwd'] != $_POST['passwordConf'])
    196193  {
    197     array_push($page['errors'], l10n('The passwords do not match'));
     194    $page['errors'][] = l10n('The passwords do not match');
    198195    return false;
    199196  }
     
    204201    if (!is_numeric($user_id))
    205202    {
    206       array_push($page['errors'], l10n('Invalid key'));
     203      $page['errors'][] = l10n('Invalid key');
    207204      return false;
    208205    }
     
    213210    if (is_a_guest() or is_generic())
    214211    {
    215       array_push($page['errors'], l10n('Password reset is not allowed for this user'));
     212      $page['errors'][] = l10n('Password reset is not allowed for this user');
    216213      return false;
    217214    }
     
    226223    );
    227224
    228   array_push($page['infos'], l10n('Your password has been reset'));
     225  $page['infos'][] = l10n('Your password has been reset');
    229226
    230227  if (isset($_GET['key']))
    231228  {
    232     array_push($page['infos'], '<a href="'.get_root_url().'identification.php">'.l10n('Login').'</a>');
     229    $page['infos'][] = '<a href="'.get_root_url().'identification.php">'.l10n('Login').'</a>';
    233230  }
    234231  else
    235232  {
    236     array_push($page['infos'], '<a href="'.get_gallery_home_url().'">'.l10n('Return to home page').'</a>');
     233    $page['infos'][] = '<a href="'.get_gallery_home_url().'">'.l10n('Return to home page').'</a>';
    237234  }
    238235
Note: See TracChangeset for help on using the changeset viewer.