Changeset 21 for trunk/admin/configuration.php
- Timestamp:
- Jul 1, 2003, 11:27:20 AM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/configuration.php
r20 r21 16 16 * * 17 17 ***************************************************************************/ 18 18 19 19 include_once( './include/isadmin.inc.php' ); 20 20 … … 49 49 if ( isset( $_POST['submit'] ) ) 50 50 { 51 //purge de la table des session si demandé 51 $int_pattern = '/^\d+$/'; 52 // empty session table if asked 52 53 if ( $_POST['empty_session_table'] == 1 ) 53 54 { … … 80 81 } 81 82 // 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'] ) ) 84 85 { 85 86 array_push( $error, $lang['err_periods'] ); … … 95 96 } 96 97 // 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'] ) 98 99 or $_POST['session_id_size'] < 4 99 100 or $_POST['session_id_size'] > 50 ) … … 102 103 } 103 104 // 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'] ) 105 106 or $_POST['session_time'] < 5 106 107 or $_POST['session_time'] > 60 ) … … 109 110 } 110 111 // 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'] ) 112 113 or $_POST['max_user_listbox'] < 0 113 114 or $_POST['max_user_listbox'] > 255 ) … … 117 118 // the number of comments per page must be an integer between 5 and 50 118 119 // included 119 if ( ! is_int($_POST['nb_comment_page'] )120 if ( !preg_match( $int_pattern, $_POST['nb_comment_page'] ) 120 121 or $_POST['nb_comment_page'] < 5 121 122 or $_POST['nb_comment_page'] > 50 ) … … 124 125 } 125 126 // 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'] ) 127 128 or $_POST['upload_maxfilesize'] < 10 128 129 or $_POST['upload_maxfilesize'] > 1000 ) … … 132 133 // the maximum width of uploaded pictures must be an integer superior to 133 134 // 10 134 if ( ! is_int($_POST['upload_maxwidth'] )135 if ( !preg_match( $int_pattern, $_POST['upload_maxwidth'] ) 135 136 or $_POST['upload_maxwidth'] < 10 ) 136 137 { … … 139 140 // the maximum height of uploaded pictures must be an integer superior to 140 141 // 10 141 if ( ! is_int($_POST['upload_maxheight'] )142 if ( !preg_match( $int_pattern, $_POST['upload_maxheight'] ) 142 143 or $_POST['upload_maxheight'] < 10 ) 143 144 { … … 146 147 // the maximum width of uploaded thumbnails must be an integer superior to 147 148 // 10 148 if ( ! is_int($_POST['upload_maxwidth_thumbnail'] )149 if ( !preg_match( $int_pattern, $_POST['upload_maxwidth_thumbnail'] ) 149 150 or $_POST['upload_maxwidth_thumbnail'] < 10 ) 150 151 { … … 153 154 // the maximum width of uploaded thumbnails must be an integer superior to 154 155 // 10 155 if ( ! is_int($_POST['upload_maxheight_thumbnail'] )156 if ( !preg_match( $int_pattern, $_POST['upload_maxheight_thumbnail'] ) 156 157 or $_POST['upload_maxheight_thumbnail'] < 10 ) 157 158 { 158 159 array_push( $error, $lang['conf_err_upload_maxheight_thumbnail'] ); 159 160 } 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'; 184 179 $query.= ' ('; 185 180 foreach ( $conf_infos as $i => $conf_info ) { … … 188 183 } 189 184 $query.= ')'; 190 $query.= ' values';185 $query.= ' VALUES'; 191 186 $query.= ' ('; 192 187 foreach ( $conf_infos as $i => $conf_info ) { … … 261 256 } 262 257 //----------------------------------------------------- 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' ); 263 templatize_array( $tpl, 'lang', $sub ); 272 264 //-------------------------------------------------------------- errors display 273 265 if ( sizeof( $error ) != 0 ) … … 346 338 $vtp->setVar( $sub, 'radio.option', $lang['conf_general_access_1'] ); 347 339 $checked = ''; 348 echo $access.'<br />';349 340 if ( $access == 'free' ) 350 341 {
Note: See TracChangeset
for help on using the changeset viewer.