Changeset 25018 for trunk/install.php


Ignore:
Timestamp:
Oct 19, 2013, 7:43:04 PM (10 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/install.php

    r25005 r25018  
    253253include(PHPWG_ROOT_PATH . 'admin/include/functions_upgrade.php');
    254254
    255 if ( isset( $_POST['install'] ))
     255if (isset($_POST['install']))
    256256{
    257257  install_db_connect($infos, $errors);
    258258  pwg_db_check_charset();
    259259
    260   $webmaster = trim(preg_replace( '/\s{2,}/', ' ', $admin_name ));
    261   if ( empty($webmaster))
    262     array_push( $errors, l10n('enter a login for webmaster') );
    263   else if ( preg_match( '/[\'"]/', $webmaster ) )
    264     array_push( $errors, l10n('webmaster login can\'t contain characters \' or "') );
    265   if ( $admin_pass1 != $admin_pass2 || empty($admin_pass1) )
    266     array_push( $errors, l10n('please enter your password again') );
    267   if ( empty($admin_mail))
    268     array_push( $errors, l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)') );
     260  $webmaster = trim(preg_replace('/\s{2,}/', ' ', $admin_name));
     261  if (empty($webmaster))
     262  {
     263    $errors[] = l10n('enter a login for webmaster');
     264  }
     265  else if (preg_match( '/[\'"]/', $webmaster))
     266  {
     267    $errors[] = l10n('webmaster login can\'t contain characters \' or "');
     268  }
     269  if ($admin_pass1 != $admin_pass2 || empty($admin_pass1))
     270  {
     271    $errors[] = l10n('please enter your password again');
     272  }
     273  if (empty($admin_mail))
     274  {
     275    $errors[] = l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)');
     276  }
    269277  else
    270278  {
    271279    $error_mail_address = validate_mail_address(null, $admin_mail);
    272280    if (!empty($error_mail_address))
    273       array_push( $errors, $error_mail_address );
     281    {
     282      $errors[] = $error_mail_address;
     283    }
    274284  }
    275285
     
    389399    foreach (get_available_upgrade_ids() as $upgrade_id)
    390400    {
    391       array_push(
    392         $datas,
    393         array(
    394           'id'          => $upgrade_id,
    395           'applied'     => CURRENT_DATE,
    396           'description' => 'upgrade included in installation',
    397           )
     401      $datas[] = array(
     402        'id'          => $upgrade_id,
     403        'applied'     => CURRENT_DATE,
     404        'description' => 'upgrade included in installation',
    398405        );
    399406    }
     
    450457else
    451458{
    452   array_push(
    453     $infos,
    454     l10n('Congratulations, Piwigo installation is completed')
    455     );
     459  $infos[] = l10n('Congratulations, Piwigo installation is completed');
    456460
    457461  if (isset($error_copy))
    458462  {
    459     array_push($errors, $error_copy);
     463    $errors[] = $error_copy;
    460464  }
    461465  else
Note: See TracChangeset for help on using the changeset viewer.