Ignore:
Timestamp:
Jul 1, 2003, 11:27:20 AM (21 years ago)
Author:
z0rglub
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/configuration.php

    r20 r21  
    1616 *                                                                         *
    1717 ***************************************************************************/
    18  
     18
    1919include_once( './include/isadmin.inc.php' );
    2020       
     
    4949if ( isset( $_POST['submit'] ) )
    5050{
    51   //purge de la table des session si demandé
     51  $int_pattern = '/^\d+$/';
     52  // empty session table if asked
    5253  if ( $_POST['empty_session_table'] == 1 )
    5354  {
     
    8081  }
    8182  // periods must be integer values, they represents number of days
    82   if ( !is_int( $_POST['short_period'] )
    83        or !is_int( $_POST['long_period'] ) )
     83  if ( !preg_match( $int_pattern, $_POST['short_period'] )
     84       or !preg_match( $int_pattern, $_POST['long_period'] ) )
    8485  {
    8586    array_push( $error, $lang['err_periods'] );
     
    9596  }
    9697  // session_id size must be an integer between 4 and 50
    97   if ( !is_int( $_POST['session_id_size'] )
     98  if ( !preg_match( $int_pattern, $_POST['session_id_size'] )
    9899       or $_POST['session_id_size'] < 4
    99100       or $_POST['session_id_size'] > 50 )
     
    102103  }
    103104  // session_time must be an integer between 5 and 60, in minutes
    104   if ( !is_int( $_POST['session_time'] )
     105  if ( !preg_match( $int_pattern, $_POST['session_time'] )
    105106       or $_POST['session_time'] < 5
    106107       or $_POST['session_time'] > 60 )
     
    109110  }
    110111  // max_user_listbox must be an integer between 0 and 255 included
    111   if ( !is_int( $_POST['max_user_listbox'] )
     112  if ( !preg_match( $int_pattern, $_POST['max_user_listbox'] )
    112113       or $_POST['max_user_listbox'] < 0
    113114       or $_POST['max_user_listbox'] > 255 )
     
    117118  // the number of comments per page must be an integer between 5 and 50
    118119  // included
    119   if ( !is_int( $_POST['nb_comment_page'] )
     120  if ( !preg_match( $int_pattern, $_POST['nb_comment_page'] )
    120121       or $_POST['nb_comment_page'] < 5
    121122       or $_POST['nb_comment_page'] > 50 )
     
    124125  }
    125126  // the maximum upload filesize must be an integer between 10 and 1000
    126   if ( !is_int( $_POST['upload_maxfilesize'] )
     127  if ( !preg_match( $int_pattern, $_POST['upload_maxfilesize'] )
    127128       or $_POST['upload_maxfilesize'] < 10
    128129       or $_POST['upload_maxfilesize'] > 1000 )
     
    132133  // the maximum width of uploaded pictures must be an integer superior to
    133134  // 10
    134   if ( !is_int( $_POST['upload_maxwidth'] )
     135  if ( !preg_match( $int_pattern, $_POST['upload_maxwidth'] )
    135136       or $_POST['upload_maxwidth'] < 10 )
    136137  {
     
    139140  // the maximum height  of uploaded pictures must be an integer superior to
    140141  // 10
    141   if ( !is_int( $_POST['upload_maxheight'] )
     142  if ( !preg_match( $int_pattern, $_POST['upload_maxheight'] )
    142143       or $_POST['upload_maxheight'] < 10 )
    143144  {
     
    146147  // the maximum width of uploaded thumbnails must be an integer superior to
    147148  // 10
    148   if ( !is_int( $_POST['upload_maxwidth_thumbnail'] )
     149  if ( !preg_match( $int_pattern, $_POST['upload_maxwidth_thumbnail'] )
    149150       or $_POST['upload_maxwidth_thumbnail'] < 10 )
    150151  {
     
    153154  // the maximum width of uploaded thumbnails must be an integer superior to
    154155  // 10
    155   if ( !is_int( $_POST['upload_maxheight_thumbnail'] )
     156  if ( !preg_match( $int_pattern, $_POST['upload_maxheight_thumbnail'] )
    156157       or $_POST['upload_maxheight_thumbnail'] < 10 )
    157158  {
    158159    array_push( $error, $lang['conf_err_upload_maxheight_thumbnail'] );
    159160  }
    160   $test = '';
    161   if ( is_int( $test ) ) echo 'salut'; exit();
    162   if ( $_POST['maxwidth'] != '' )
    163   {
    164     if ( !ereg( "^[0-9]{2,}$", $_POST['maxwidth'] )
    165          or $_POST['maxwidth'] < 50 )
    166     {
    167       $error[$i++] = $lang['err_maxwidth'];
    168     }
    169   }
    170   if ( $_POST['maxheight'] != '' )
    171   {
    172     if ( !ereg( "^[0-9]{2,}$", $_POST['maxheight'] )
    173          or $_POST['maxheight'] < 50 )
    174     {
    175       $error[$i++] = $lang['err_maxheight'];
    176     }
    177   }
    178   // on met à jour les paramètres de l'application
    179   // dans le cas où il n'y aucune erreurs
    180   if ( sizeof( $error ) == 0 )
    181   {
    182     mysql_query( 'delete from '.PREFIX_TABLE.'config;' );
    183     $query = 'insert into '.PREFIX_TABLE.'config';
     161
     162  if ( $_POST['maxwidth'] != ''
     163       and ( !preg_match( $int_pattern, $_POST['maxwidth'] )
     164             or $_POST['maxwidth'] < 50 ) )
     165  {
     166    array_push( $error, $lang['err_maxwidth'] );
     167  }
     168  if ( $_POST['maxheight']
     169       and ( !preg_match( $int_pattern, $_POST['maxheight'] )
     170             or $_POST['maxheight'] < 50 ) )
     171  {
     172    array_push( $error, $lang['err_maxheight'] );
     173  }
     174  // updating configuraiton if no error found
     175  if ( count( $error ) == 0 )
     176  {
     177    mysql_query( 'DELETE FROM '.PREFIX_TABLE.'config;' );
     178    $query = 'INSERT INTO '.PREFIX_TABLE.'config';
    184179    $query.= ' (';
    185180    foreach ( $conf_infos as $i => $conf_info ) {
     
    188183    }
    189184    $query.= ')';
    190     $query.= ' values';
     185    $query.= ' VALUES';
    191186    $query.= ' (';
    192187    foreach ( $conf_infos as $i => $conf_info ) {
     
    261256}
    262257//----------------------------------------------------- template initialization
    263 $sub = $vtp->Open( '../template/'.$user['template'].
    264                    '/admin/configuration.vtp' );
    265 // language
    266 $vtp->setGlobalVar( $sub, 'conf_confirmation',  $lang['conf_confirmation'] );
    267 $vtp->setGlobalVar( $sub, 'remote_site',        $lang['remote_site'] );
    268 $vtp->setGlobalVar( $sub, 'delete',             $lang['delete'] );
    269 $vtp->setGlobalVar( $sub, 'conf_remote_site_delete_info',
    270                     $lang['conf_remote_site_delete_info'] );
    271 $vtp->setGlobalVar( $sub, 'submit',             $lang['submit'] );
     258$sub = $vtp->Open(
     259  '../template/'.$user['template'].'/admin/configuration.vtp' );
     260
     261$tpl = array( 'conf_confirmation','remote_site','delete',
     262              'conf_remote_site_delete_info','submit' );
     263templatize_array( $tpl, 'lang', $sub );
    272264//-------------------------------------------------------------- errors display
    273265if ( sizeof( $error ) != 0 )
     
    346338$vtp->setVar( $sub, 'radio.option', $lang['conf_general_access_1'] );
    347339$checked = '';
    348 echo $access.'<br />';
    349340if ( $access == 'free' )
    350341{
Note: See TracChangeset for help on using the changeset viewer.