Ignore:
Timestamp:
Jun 11, 2005, 4:10:04 PM (19 years ago)
Author:
plg
Message:
  • errors and informations boxes : management centralized in admin.php, $errors and $infos arrays replaced by $pageerrors and $pageinfos, special management for admin/update.php (more complex management)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/configuration.php

    r700 r792  
    5454}                                         
    5555//------------------------------ verification and registration of modifications
    56 $errors = array();
    5756if (isset($_POST['submit']))
    5857{
     
    6564      if (!preg_match('/^[\w-]*$/', $_POST['prefix_thumbnail']))
    6665      {
    67         array_push($errors, $lang['conf_prefix_thumbnail_error']);
     66        array_push($page['errors'], $lang['conf_prefix_thumbnail_error']);
    6867      }
    6968      // mail must be formatted as follows : name@server.com
     
    7170      if (!preg_match($pattern, $_POST['mail_webmaster']))
    7271      {
    73         array_push($errors, $lang['conf_mail_webmaster_error']);
     72        array_push($page['errors'], $lang['conf_mail_webmaster_error']);
    7473      }
    7574      break;
     
    8382           or $_POST['nb_comment_page'] > 50)
    8483      {
    85         array_push($errors, $lang['conf_nb_comment_page_error']);
     84        array_push($page['errors'], $lang['conf_nb_comment_page_error']);
    8685      }
    8786      break;
     
    9392          or $_POST['recent_period'] <= 0)
    9493      {
    95         array_push($errors, $lang['periods_error']);
     94        array_push($page['errors'], $lang['periods_error']);
    9695      }
    9796      break;
     
    104103          or $_POST['upload_maxfilesize'] > 1000)
    105104      {
    106         array_push($errors, $lang['conf_upload_maxfilesize_error']);
     105        array_push($page['errors'], $lang['conf_upload_maxfilesize_error']);
    107106      }
    108107     
     
    114113      {
    115114        if (!preg_match($int_pattern, $_POST[$field])
    116           or $_POST[$field] < 10)
     115            or $_POST[$field] < 10)
    117116        {
    118           array_push($errors, $lang['conf_'.$field.'_error']);
     117          array_push($page['errors'], $lang['conf_'.$field.'_error']);
    119118        }
    120119      }
     
    124123 
    125124  // updating configuration if no error found
    126   if (count($errors) == 0)
    127   {
     125  if (count($page['errors']) == 0)
     126  {
     127    echo '<pre>'; print_r($_POST); echo '</pre>';
    128128    $result = pwg_query('SELECT * FROM '.CONFIG_TABLE);
    129129    while ($row = mysql_fetch_array($result))
     
    139139      }
    140140    }
     141    array_push($page['infos'], $lang['conf_confirmation']);
    141142  }
    142143}
     
    150151$template->assign_vars(
    151152  array(
    152     'L_CONFIRM'=>$lang['conf_confirmation'],
    153153    'L_YES'=>$lang['yes'],
    154154    'L_NO'=>$lang['no'],
     
    344344  }
    345345}
    346 //-------------------------------------------------------------- errors display
    347 if ( sizeof( $errors ) != 0 )
    348 {
    349   $template->assign_block_vars('errors',array());
    350   for ( $i = 0; $i < sizeof( $errors ); $i++ )
    351   {
    352     $template->assign_block_vars('errors.error',array('ERROR'=>$errors[$i]));
    353   }
    354 }
    355 elseif ( isset( $_POST['submit'] ) )
    356 {
    357   $template->assign_block_vars('confirmation' ,array());
    358 }
    359346//----------------------------------------------------------- sending html code
    360347$template->assign_var_from_handle('ADMIN_CONTENT', 'config');
Note: See TracChangeset for help on using the changeset viewer.