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/admin/user_list.php

    r25005 r25018  
    120120    $user['groups'] = array();
    121121
    122     array_push($users, $user);
     122    $users[] = $user;
    123123  }
    124124
     
    141141    while ($row = pwg_db_fetch_assoc($result))
    142142    {
    143       array_push(
    144         $users[$user_nums[$row['user_id']]]['groups'],
    145         $row['group_id']
    146         );
     143      $users[ $user_nums[ $row['user_id'] ] ]['groups'][] = $row['group_id'];
    147144    }
    148145  }
     
    192189    if(empty($_POST['password']))
    193190    {
    194       array_push($page['errors'], l10n('Password is missing. Please enter the password.'));
     191      $page['errors'][] = l10n('Password is missing. Please enter the password.');
    195192    }
    196193    else if(empty($_POST['password_conf']))
    197194    {
    198       array_push($page['errors'], l10n('Password confirmation is missing. Please confirm the chosen password.'));
     195      $page['errors'][] = l10n('Password confirmation is missing. Please confirm the chosen password.');
    199196    }
    200197    else if(empty($_POST['email']))
    201198    {
    202       array_push($page['errors'], l10n('Email address is missing. Please specify an email address.'));
     199      $page['errors'][] = l10n('Email address is missing. Please specify an email address.');
    203200    }
    204201    else if ($_POST['password'] != $_POST['password_conf'])
    205202    {
    206       array_push($page['errors'], l10n('The passwords do not match'));
     203      $page['errors'][] = l10n('The passwords do not match');
    207204    }
    208205    else
     
    213210      if (count($page['errors']) == 0)
    214211      {
    215         array_push(
    216           $page['infos'],
    217           l10n(
    218             'user "%s" added',
    219             $_POST['login']
    220           )
    221         );
     212        $page['infos'][] = l10n('user "%s" added', $_POST['login']);
    222213      }
    223214    }
     
    233224    if (count($page['errors']) == 0)
    234225    {
    235       array_push(
    236         $page['infos'],
    237         l10n(
    238           'user "%s" added',
    239           stripslashes($_POST['login'])
    240           )
    241         );
     226      $page['infos'][] = l10n('user "%s" added', stripslashes($_POST['login']));
    242227    }
    243228  }
     
    296281      foreach($page['filtered_users'] as $local_user)
    297282      {
    298         array_push($collection, $local_user['id']);
     283        $collection[] = $local_user['id'];
    299284      }
    300285      break;
     
    312297  if (count($collection) == 0)
    313298  {
    314     array_push($page['errors'], l10n('Select at least one user'));
     299    $page['errors'][] = l10n('Select at least one user');
    315300  }
    316301}
     
    323308  if (in_array($conf['guest_id'], $collection))
    324309  {
    325     array_push($page['errors'], l10n('Guest cannot be deleted'));
     310    $page['errors'][] = l10n('Guest cannot be deleted');
    326311  }
    327312  if (($conf['guest_id'] != $conf['default_user_id']) and
    328313      in_array($conf['default_user_id'], $collection))
    329314  {
    330     array_push($page['errors'], l10n('Default user cannot be deleted'));
     315    $page['errors'][] = l10n('Default user cannot be deleted');
    331316  }
    332317  if (in_array($conf['webmaster_id'], $collection))
    333318  {
    334     array_push($page['errors'], l10n('Webmaster cannot be deleted'));
     319    $page['errors'][] = l10n('Webmaster cannot be deleted');
    335320  }
    336321  if (in_array($user['id'], $collection))
    337322  {
    338     array_push($page['errors'], l10n('You cannot delete your account'));
     323    $page['errors'][] = l10n('You cannot delete your account');
    339324  }
    340325
     
    347332        delete_user($user_id);
    348333      }
    349       array_push(
    350         $page['infos'],
    351         l10n_dec(
    352           '%d user deleted', '%d users deleted',
    353           count($collection)
    354           )
     334     
     335      $page['infos'][] = l10n_dec(
     336        '%d user deleted', '%d users deleted',
     337        count($collection)
    355338        );
     339     
    356340      foreach ($page['filtered_users'] as $filter_key => $filter_user)
    357341      {
     
    364348    else
    365349    {
    366       array_push($page['errors'], l10n('You need to confirm deletion'));
     350      $page['errors'][] = l10n('You need to confirm deletion');
    367351    }
    368352  }
     
    392376      foreach ($associable as $item)
    393377      {
    394         array_push($datas,
    395                    array('group_id'=>$_POST['associate'],
    396                          'user_id'=>$item));
     378        $datas[] = array(
     379          'group_id' => $_POST['associate'],
     380          'user_id' => $item
     381          );
    397382      }
    398383
     
    427412  if ($conf['activate_comments'])
    428413  {
    429     array_push($formfields, 'show_nb_comments');
    430     array_push($true_false_fields, 'show_nb_comments');
     414    $formfields[] = 'show_nb_comments';
     415    $true_false_fields[] = 'show_nb_comments';
    431416  }
    432417
     
    445430    if ($_POST[$test] != 'leave')
    446431    {
    447       array_push($dbfields['update'], $formfield);
     432      $dbfields['update'][] = $formfield;
    448433    }
    449434  }
     
    481466          if (!in_array('level', $dbfields['update']))
    482467          {
    483             array_push($dbfields['update'], 'level');
     468            $dbfields['update'][] = 'level';
    484469          }
    485470        }
     
    508493      }
    509494
    510       array_push($datas, $data);
     495      $datas[] = $data;
    511496    }
    512497
Note: See TracChangeset for help on using the changeset viewer.