Changeset 393 for trunk/admin


Ignore:
Timestamp:
Mar 20, 2004, 1:52:37 AM (20 years ago)
Author:
gweltas
Message:
  • Template migration
  • Admin Control Panel migration
  • Language migration
Location:
trunk/admin
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/configuration.php

    r383 r393  
    2626// +-----------------------------------------------------------------------+
    2727
    28 include_once( './admin/include/isadmin.inc.php' );
     28if( !defined("PHPWG_ROOT_PATH") )
     29{
     30        die ("Hacking attempt!");
     31}
     32
     33include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
    2934       
    3035$Caracs = array("¥" => "Y", "µ" => "u", "À" => "A", "Á" => "A",
     
    4550                "ý" => "y", "ÿ" => "y");
    4651//------------------------------ verification and registration of modifications
    47 $conf_infos = array();
    48 $query = 'SELECT param';
    49 $query.= ' FROM '.CONFIG_TABLE;
    50 $query.= ';';
    51 $result = mysql_query( $query );
    52 while ( $row = mysql_fetch_array( $result ) )
    53 {
    54   array_push( $conf_infos, $row['param'] );
    55 }
    56 
    57 $default_user_infos =
    58 array( 'nb_image_line','nb_line_page','language','maxwidth',
    59        'maxheight','expand','show_nb_comments','short_period','long_period',
    60        'template' );
    6152$error = array();
    6253if ( isset( $_POST['submit'] ) )
    6354{
    6455  $int_pattern = '/^\d+$/';
    65   // empty session table if asked
    66   if ( $_POST['empty_session_table'] == 1 )
    67   {
    68     $query = 'DELETE FROM '.PREFIX_TABLE.'sessions';
    69     $query.= ' WHERE expiration < '.time().';';
    70     mysql_query( $query );
    71   }
    7256  // deletion of site as asked
    7357  $site_deleted = false;
    7458  $query = 'SELECT id';
    75   $query.= ' FROM '.PREFIX_TABLE.'sites';
     59  $query.= ' FROM '.SITES_TABLE;
    7660  $query.= " WHERE galleries_url <> './galleries/';";
    7761  $result = mysql_query( $query );
     
    135119    array_push( $error, $lang['conf_err_sid_time'] );
    136120  }
    137   // max_user_listbox must be an integer between 0 and 255 included
    138   if ( !preg_match( $int_pattern, $_POST['max_user_listbox'] )
    139        or $_POST['max_user_listbox'] < 0
    140        or $_POST['max_user_listbox'] > 255 )
    141   {
    142     array_push( $error, $lang['conf_err_max_user_listbox'] );
    143   }
    144121  // the number of comments per page must be an integer between 5 and 50
    145122  // included
     
    186163  }
    187164
    188   if ( $_POST['maxwidth'] != ''
     165/*  if ( $_POST['maxwidth'] != ''
    189166       and ( !preg_match( $int_pattern, $_POST['maxwidth'] )
    190167             or $_POST['maxwidth'] < 50 ) )
     
    197174  {
    198175    array_push( $error, $lang['err_maxheight'] );
    199   }
     176  }*/
    200177  // updating configuraiton if no error found
    201178  if ( count( $error ) == 0 )
    202179  {
    203     foreach ( $conf_infos as $conf_info ) {
    204       if ( isset( $_POST[$conf_info] ) )
     180    $result = mysql_query( "SELECT * FROM ".CONFIG_TABLE );
     181    while ( $row = mysql_fetch_array( $result ) )
     182        {
     183          $config_name = $row['param'];
     184          $conf[$config_name] = ( isset($_POST[$config_name]) ) ? $_POST[$config_name] : $row['value'];
     185      if ( isset( $_POST[$config_name] ) )
    205186      {
    206187        $query = 'UPDATE '.CONFIG_TABLE;
    207         $query.= ' SET value = ';
    208         if ( $_POST[$conf_info] == '' )
    209         {
    210           $query.= 'NULL';
    211         }
    212         else
    213         {
    214           $query.= "'".$_POST[$conf_info]."'";
    215         }
    216         $query.= " WHERE param = '".$conf_info."'";
    217         $query.= ';';
     188        $query.= " SET value = '". str_replace("\'", "''", $conf[$config_name]) ;
     189        $query.= "' WHERE param = '$config_name'";
    218190        mysql_query( $query );
    219191      }
    220192    }
    221 
    222     $query = 'UPDATE '.USERS_TABLE;
    223     $query.= ' SET';
    224     foreach ( $default_user_infos as $i => $default_user_info ) {
    225       if ( $i > 0 ) $query.= ',';
    226       else          $query.= ' ';
    227       $query.= $default_user_info;
    228       $query.= ' = ';
    229       if ( $_POST[$default_user_info] == '' )
    230       {
    231         $query.= 'NULL';
    232       }
    233       else
    234       {
    235         $query.= "'".$_POST[$default_user_info]."'";
    236       }
    237     }
    238     $query.= " WHERE username = 'guest'";
    239     $query.= ';';
    240     mysql_query( $query );
    241   }
    242 //--------------------------------------------------------- data initialization
    243   foreach ( $conf_infos as $conf_info ) {
    244     $$conf_info = $_POST[$conf_info];
    245   }
    246   foreach ( $default_user_infos as $default_user_info ) {
    247     $$default_user_info = $_POST[$default_user_info];
    248   }
    249 }
    250 else
    251 {
    252 //--------------------------------------------------------- data initialization
    253   $query = 'SELECT param,value';
    254   $query.= ' FROM '.CONFIG_TABLE;
    255   $query.= ';';
    256   $result = mysql_query( $query );
    257   while ( $row =mysql_fetch_array( $result ) )
    258   {
    259     if ( isset( $row['value'] ) )
    260     {
    261       $$row['param'] = $row['value'];
    262     }
    263     else
    264     {
    265       $$row['param'] = '';
    266     }
    267   }
    268 
    269   $query  = 'SELECT '.implode( ',', $default_user_infos );
    270   $query.= ' FROM '.USERS_TABLE;
    271   $query.= " WHERE username = 'guest'";
    272   $query.= ';';
    273   $row = mysql_fetch_array( mysql_query( $query ) );
    274   foreach ( $default_user_infos as $info ) {
    275     if ( isset( $row[$info] ) ) $$info = $row[$info];
    276     else                        $$info = '';
    277   }
    278 }
     193  }
     194}
     195
     196$access = ($conf['access']=='free')?'ACCESS_FREE':'ACCESS_RESTRICTED';
     197$log = ($conf['log']=='true')?'HISTORY_YES':'HISTORY_NO';
     198$mail_notif = ($conf['mail_notification']=='true')?'MAIL_NOTIFICATION_YES':'MAIL_NOTIFICATION_NO';
     199$show_comments = ($conf['show_comments']=='true')?'SHOW_COMMENTS_YES':'SHOW_COMMENTS_NO';
     200$comments_all = ($conf['comments_forall']=='true')?'COMMENTS_ALL_YES':'COMMENTS_ALL_NO';
     201$comments_validation = ($conf['comments_validation']=='true')?'VALIDATE_COMMENTS_YES':'VALIDATE_COMMENTS_NO';
     202$expand = ($conf['auto_expand']=='true')?'EXPAND_TREE_YES':'EXPAND_TREE_NO';
     203$nb_comments = ($conf['show_nb_comments']=='true')?'NB_COMMENTS_YES':'NB_COMMENTS_NO';
     204$upload = ($conf['upload_available']=='true')?'UPLOAD_YES':'UPLOAD_NO';
     205$cookie = ($conf['authorize_cookies']=='true')?'COOKIE_YES':'COOKIE_NO';
     206
    279207//----------------------------------------------------- template initialization
    280 $sub = $vtp->Open(
    281   './template/'.$user['template'].'/admin/configuration.vtp' );
     208$template->set_filenames( array('config'=>'admin/configuration.tpl') );
     209
     210$template->assign_vars(array(
     211  'ADMIN_NAME'=>$conf['webmaster'],
     212  'ADMIN_MAIL'=>$conf['mail_webmaster'],
     213  'THUMBNAIL_PREFIX'=>$conf['prefix_thumbnail'],
     214  'NB_COMMENTS_PAGE'=>$conf['nb_comment_page'],
     215  'LANG_SELECT'=>language_select($conf['default_lang'], 'default_lang'),
     216  'NB_IMAGE_LINE'=>$conf['nb_image_line'],
     217  'NB_ROW_PAGE'=>$conf['nb_line_page'],
     218  'STYLE_SELECT'=>style_select($conf['default_style'], 'default_style'),
     219  'SHORT_PERIOD'=>$conf['short_period'],
     220  'LONG_PERIOD'=>$conf['long_period'],
     221  'UPLOAD_MAXSIZE'=>$conf['upload_maxfilesize'],
     222  'UPLOAD_MAXWIDTH'=>$conf['upload_maxwidth'],
     223  'UPLOAD_MAXHEIGHT'=>$conf['upload_maxheight'],
     224  'TN_UPLOAD_MAXWIDTH'=>$conf['upload_maxwidth_thumbnail'],
     225  'TN_UPLOAD_MAXHEIGHT'=>$conf['upload_maxheight_thumbnail'],
     226  'SESSION_LENGTH'=>$conf['session_time'],
     227  'SESSION_ID_SIZE'=>$conf['session_id_size'],
     228 
     229  $access=>'checked="checked"',
     230  $log=>'checked="checked"',
     231  $mail_notif=>'checked="checked"',
     232  $show_comments=>'checked="checked"',
     233  $comments_all=>'checked="checked"',
     234  $comments_validation=>'checked="checked"',
     235  $expand=>'checked="checked"',
     236  $nb_comments=>'checked="checked"',
     237  $upload=>'checked="checked"',
     238  $cookie=>'checked="checked"',
     239 
     240  'L_CONFIRM'=>$lang['conf_confirmation'],
     241  'L_CONF_GENERAL'=>$lang['conf_general_title'],
     242  'L_ADMIN_NAME'=>$lang['conf_general_webmaster'],
     243  'L_ADMIN_NAME_INFO'=>$lang['conf_general_webmaster_info'],
     244  'L_ADMIN_MAIL'=>$lang['conf_general_mail'],
     245  'L_ADMIN_MAIL_INFO'=>$lang['conf_general_mail_info'],
     246  'L_THUMBNAIL_PREFIX'=>$lang['conf_general_prefix'],
     247  'L_THUMBNAIL_PREFIX_INFO'=>$lang['conf_general_prefix_info'],
     248  'L_ACCESS'=>$lang['conf_general_access'],
     249  'L_ACCESS_INFO'=>$lang['conf_general_access_info'],
     250  'L_ACCESS_FREE'=>$lang['conf_general_access_1'],
     251  'L_ACCESS_RESTRICTED'=>$lang['conf_general_access_2'],
     252  'L_HISTORY'=>$lang['conf_general_log'],
     253  'L_HISTORY_INFO'=>$lang['conf_general_log_info'],
     254  'L_MAIL_NOTIFICATION'=>$lang['conf_general_mail_notification'],
     255  'L_MAIL_NOTIFICATION_INFO'=>$lang['conf_general_mail_notification_info'],
     256  'L_CONF_COMMENTS'=>$lang['conf_comments_title'],
     257  'L_SHOW_COMMENTS'=>$lang['conf_comments_show_comments'],
     258  'L_SHOW_COMMENTS_INFO'=>$lang['conf_comments_show_comments_info'],
     259  'L_COMMENTS_ALL'=>$lang['conf_comments_forall'],
     260  'L_COMMENTS_ALL_INFO'=>$lang['conf_comments_forall_info'],
     261  'L_NB_COMMENTS_PAGE'=>$lang['conf_comments_comments_number'],
     262  'L_NB_COMMENTS_PAGE_INFO'=>$lang['conf_comments_comments_number_info'],
     263  'L_VALIDATE_COMMENTS'=>$lang['conf_comments_validation'],
     264  'L_VALIDATE_COMMENTS_INFO'=>$lang['conf_comments_validation_info'],
     265  'L_ABILITIES_SETTINGS'=>$lang['conf_default_title'],
     266  'L_LANG_SELECT'=>$lang['customize_language'],
     267  'L_LANG_SELECT_INFO'=>$lang['conf_default_language_info'],
     268  'L_NB_IMAGE_LINE'=>$lang['customize_nb_image_per_row'],
     269  'L_NB_IMAGE_LINE_INFO'=>$lang['conf_default_nb_image_per_row_info'],
     270  'L_NB_ROW_PAGE'=>$lang['customize_nb_row_per_page'],
     271  'L_NB_ROW_PAGE_INFO'=>$lang['conf_default_nb_row_per_page_info'],
     272  'L_STYLE_SELECT'=>$lang['customize_theme'],
     273  'L_STYLE_SELECT_INFO'=>$lang['conf_default_theme_info'],
     274  'L_SHORT_PERIOD'=>$lang['customize_short_period'],
     275  'L_SHORT_PERIOD_INFO'=>$lang['conf_default_short_period_info'],
     276  'L_LONG_PERIOD'=>$lang['customize_long_period'],
     277  'L_LONG_PERIOD_INFO'=>$lang['conf_default_long_period_info'],
     278  'L_EXPAND_TREE'=>$lang['customize_expand'],
     279  'L_EXPAND_TREE_INFO'=>$lang['conf_default_expand_info'],
     280  'L_NB_COMMENTS'=>$lang['customize_show_nb_comments'],
     281  'L_NB_COMMENTS_INFO'=>$lang['conf_default_show_nb_comments_info'],
     282  'L_UPLOAD'=>$lang['conf_upload_available'],
     283  'L_UPLOAD_INFO'=>$lang['conf_upload_available_info'],
     284  'L_CONF_UPLOAD'=>$lang['conf_upload_title'],
     285  'L_UPLOAD_MAXSIZE'=>$lang['conf_upload_maxfilesize'],
     286  'L_UPLOAD_MAXSIZE_INFO'=>$lang['conf_upload_maxfilesize_info'],
     287  'L_UPLOAD_MAXWIDTH'=>$lang['conf_upload_maxwidth'],
     288  'L_UPLOAD_MAXWIDTH_INFO'=>$lang['conf_upload_maxwidth_info'],
     289  'L_UPLOAD_MAXHEIGHT'=>$lang['conf_upload_maxheight'],
     290  'L_UPLOAD_MAXHEIGHT_INFO'=>$lang['conf_upload_maxheight_info'],
     291  'L_TN_UPLOAD_MAXWIDTH'=>$lang['conf_upload_maxwidth_thumbnail'],
     292  'L_TN_UPLOAD_MAXWIDTH_INFO'=>$lang['conf_upload_maxwidth_thumbnail_info'],
     293  'L_TN_UPLOAD_MAXHEIGHT'=>$lang['conf_upload_maxheight_thumbnail'],
     294  'L_TN_UPLOAD_MAXHEIGHT_INFO'=>$lang['conf_upload_maxheight_thumbnail'],
     295  'L_CONF_SESSION'=>$lang['conf_session_title'],
     296  'L_COOKIE'=>$lang['conf_session_cookie'],
     297  'L_COOKIE_INFO'=>$lang['conf_session_cookie_info'],
     298  'L_SESSION_LENGTH'=>$lang['conf_session_time'],
     299  'L_SESSION_LENGTH_INFO'=>$lang['conf_session_time_info'],
     300  'L_SESSION_ID_SIZE'=>$lang['conf_session_size'],
     301  'L_SESSION_ID_SIZE_INFO'=>$lang['conf_session_size_info'],
     302  'L_YES'=>$lang['yes'],
     303  'L_NO'=>$lang['no'],
     304  'L_SUBMIT'=>$lang['submit'],
     305 
     306  'F_ACTION'=>add_session_id(PHPWG_ROOT_PATH.'admin.php?page=configuration')
     307  ));
    282308
    283309$tpl = array( 'conf_confirmation','remote_site','delete',
    284310              'conf_remote_site_delete_info','submit','errors_title' );
    285 templatize_array( $tpl, 'lang', $sub );
     311
    286312//-------------------------------------------------------------- errors display
    287313if ( sizeof( $error ) != 0 )
    288314{
    289   $vtp->addSession( $sub, 'errors' );
     315  $template->assign_block_vars('errors',array());
    290316  for ( $i = 0; $i < sizeof( $error ); $i++ )
    291317  {
    292     $vtp->addSession( $sub, 'li' );
    293     $vtp->setVar( $sub, 'li.li', $error[$i] );
    294     $vtp->closeSession( $sub, 'li' );
    295   }
    296   $vtp->closeSession( $sub, 'errors' );
    297 }
    298 //-------------------------------------------------------- confirmation display
    299 if ( count( $error ) == 0 and isset( $_POST['submit'] ) )
    300 {
    301   $vtp->addSession( $sub, 'confirmation' );
    302   $vtp->closeSession( $sub, 'confirmation' );
    303 }
    304 //----------------------------------------------------------------- form action
    305 $form_action = add_session_id( './admin.php?page=configuration' );
    306 $vtp->setVar( $sub, 'form_action', $form_action );
    307 //------------------------------------------------------- general configuration
    308 $vtp->addSession( $sub, 'line' );
    309 $vtp->addSession( $sub, 'title_line' );
    310 $vtp->setVar( $sub, 'title_line.title', $lang['conf_general_title'] );
    311 $vtp->closeSession( $sub, 'title_line' );
    312 $vtp->closeSession( $sub, 'line' );
    313 
    314 $vtp->addSession( $sub, 'line' );
    315 $vtp->addSession( $sub, 'space_line' );
    316 $vtp->closeSession( $sub, 'space_line' );
    317 $vtp->closeSession( $sub, 'line' );
    318 // webmaster name
    319 $vtp->addSession( $sub, 'line' );
    320 $vtp->addSession( $sub, 'param_line' );
    321 $vtp->setVar( $sub, 'param_line.name', $lang['conf_general_webmaster'] );
    322 $vtp->addSession( $sub, 'hidden' );
    323 $vtp->setVar( $sub, 'hidden.text', $webmaster );
    324 $vtp->setVar( $sub, 'hidden.name', 'webmaster' );
    325 $vtp->setVar( $sub, 'hidden.value', $webmaster );
    326 $vtp->closeSession( $sub, 'hidden' );
    327 $vtp->setVar( $sub, 'param_line.def', $lang['conf_general_webmaster_info'] );
    328 $vtp->closeSession( $sub, 'param_line' );
    329 $vtp->closeSession( $sub, 'line' );
    330 // webmaster mail address
    331 $vtp->addSession( $sub, 'line' );
    332 $vtp->addSession( $sub, 'param_line' );
    333 $vtp->setVar( $sub, 'param_line.name', $lang['conf_general_mail'] );
    334 $vtp->addSession( $sub, 'text' );
    335 $vtp->setVar( $sub, 'text.name', 'mail_webmaster' );
    336 $vtp->setVar( $sub, 'text.value', $mail_webmaster );
    337 $vtp->closeSession( $sub, 'text' );
    338 $vtp->setVar( $sub, 'param_line.def', $lang['conf_general_mail_info'] );
    339 $vtp->closeSession( $sub, 'param_line' );
    340 $vtp->closeSession( $sub, 'line' );
    341 // prefix for thumbnails
    342 $vtp->addSession( $sub, 'line' );
    343 $vtp->addSession( $sub, 'param_line' );
    344 $vtp->setVar( $sub, 'param_line.name', $lang['conf_general_prefix'] );
    345 $vtp->addSession( $sub, 'text' );
    346 $vtp->setVar( $sub, 'text.name', 'prefix_thumbnail' );
    347 $vtp->setVar( $sub, 'text.value', $prefix_thumbnail );
    348 $vtp->closeSession( $sub, 'text' );
    349 $vtp->setVar( $sub, 'param_line.def', $lang['conf_general_prefix_info'] );
    350 $vtp->closeSession( $sub, 'param_line' );
    351 $vtp->closeSession( $sub, 'line' );
    352 // access type
    353 $vtp->addSession( $sub, 'line' );
    354 $vtp->addSession( $sub, 'param_line' );
    355 $vtp->setVar( $sub, 'param_line.name', $lang['conf_general_access'] );
    356 $vtp->addSession( $sub, 'group' );
    357 $vtp->addSession( $sub, 'radio' );
    358 $vtp->setVar( $sub, 'radio.name', 'access' );
    359 $vtp->setVar( $sub, 'radio.value', 'free' );
    360 $vtp->setVar( $sub, 'radio.option', $lang['conf_general_access_1'] );
    361 $checked = '';
    362 if ( $access == 'free' )
    363 {
    364   $checked = ' checked="checked"';
    365 }
    366 $vtp->setVar( $sub, 'radio.checked', $checked );
    367 $vtp->closeSession( $sub, 'radio' );
    368 $vtp->addSession( $sub, 'radio' );
    369 $vtp->setVar( $sub, 'radio.name', 'access' );
    370 $vtp->setVar( $sub, 'radio.value', 'restricted' );
    371 $vtp->setVar( $sub, 'radio.option', $lang['conf_general_access_2'] );
    372 $checked = '';
    373 if ( $access == 'restricted' )
    374 {
    375   $checked = ' checked="checked"';
    376 }
    377 $vtp->setVar( $sub, 'radio.checked', $checked );
    378 $vtp->closeSession( $sub, 'radio' );
    379 $vtp->closeSession( $sub, 'group' );
    380 $vtp->setVar( $sub, 'param_line.def', $lang['conf_general_access_info'] );
    381 $vtp->closeSession( $sub, 'param_line' );
    382 $vtp->closeSession( $sub, 'line' );
    383 // maximum user number to display in the listbox of identification page
    384 $vtp->addSession( $sub, 'line' );
    385 $vtp->addSession( $sub, 'param_line' );
    386 $vtp->setVar( $sub, 'param_line.name',
    387               $lang['conf_general_max_user_listbox'] );
    388 $vtp->addSession( $sub, 'text' );
    389 $vtp->setVar( $sub, 'text.name', 'max_user_listbox' );
    390 $vtp->setVar( $sub, 'text.value', $max_user_listbox );
    391 $vtp->closeSession( $sub, 'text' );
    392 $vtp->setVar( $sub, 'param_line.def',
    393               $lang['conf_general_max_user_listbox_info'] );
    394 $vtp->closeSession( $sub, 'param_line' );
    395 $vtp->closeSession( $sub, 'line' );
    396 // activate log
    397 $vtp->addSession( $sub, 'line' );
    398 $vtp->addSession( $sub, 'param_line' );
    399 $vtp->setVar( $sub, 'param_line.name', $lang['conf_general_log'] );
    400 $vtp->addSession( $sub, 'group' );
    401 $vtp->addSession( $sub, 'radio' );
    402 $vtp->setVar( $sub, 'radio.name', 'log' );
    403 $vtp->setVar( $sub, 'radio.value', 'true' );
    404 $vtp->setVar( $sub, 'radio.option', $lang['yes'] );
    405 $checked = '';
    406 if ( $log == 'true' )
    407 {
    408   $checked = ' checked="checked"';
    409 }
    410 $vtp->setVar( $sub, 'radio.checked', $checked );
    411 $vtp->closeSession( $sub, 'radio' );
    412 $vtp->addSession( $sub, 'radio' );
    413 $vtp->setVar( $sub, 'radio.name', 'log' );
    414 $vtp->setVar( $sub, 'radio.value', 'false' );
    415 $vtp->setVar( $sub, 'radio.option', $lang['no'] );
    416 $checked = '';
    417 if ( $log == 'false' )
    418 {
    419   $checked = ' checked="checked"';
    420 }
    421 $vtp->setVar( $sub, 'radio.checked', $checked );
    422 $vtp->closeSession( $sub, 'radio' );
    423 $vtp->closeSession( $sub, 'group' );
    424 $vtp->setVar( $sub, 'param_line.def',
    425               $lang['conf_general_log_info'] );
    426 $vtp->closeSession( $sub, 'param_line' );
    427 $vtp->closeSession( $sub, 'line' );
    428 // mail notification for admins
    429 $vtp->addSession( $sub, 'line' );
    430 $vtp->addSession( $sub, 'param_line' );
    431 $vtp->setVar( $sub, 'param_line.name',
    432               $lang['conf_general_mail_notification'] );
    433 $vtp->addSession( $sub, 'group' );
    434 $vtp->addSession( $sub, 'radio' );
    435 $vtp->setVar( $sub, 'radio.name', 'mail_notification' );
    436 $vtp->setVar( $sub, 'radio.value', 'true' );
    437 $vtp->setVar( $sub, 'radio.option', $lang['yes'] );
    438 $checked = '';
    439 if ( $mail_notification == 'true' )
    440 {
    441   $checked = ' checked="checked"';
    442 }
    443 $vtp->setVar( $sub, 'radio.checked', $checked );
    444 $vtp->closeSession( $sub, 'radio' );
    445 $vtp->addSession( $sub, 'radio' );
    446 $vtp->setVar( $sub, 'radio.name', 'mail_notification' );
    447 $vtp->setVar( $sub, 'radio.value', 'false' );
    448 $vtp->setVar( $sub, 'radio.option', $lang['no'] );
    449 $checked = '';
    450 if ( $mail_notification == 'false' )
    451 {
    452   $checked = ' checked="checked"';
    453 }
    454 $vtp->setVar( $sub, 'radio.checked', $checked );
    455 $vtp->closeSession( $sub, 'radio' );
    456 $vtp->closeSession( $sub, 'group' );
    457 $vtp->setVar( $sub, 'param_line.def',
    458               $lang['conf_general_mail_notification_info'] );
    459 $vtp->closeSession( $sub, 'param_line' );
    460 $vtp->closeSession( $sub, 'line' );
    461 
    462 $vtp->addSession( $sub, 'line' );
    463 $vtp->addSession( $sub, 'space_line' );
    464 $vtp->closeSession( $sub, 'space_line' );
    465 $vtp->closeSession( $sub, 'line' );
    466 //------------------------------------------------------ comments configuration
    467 $vtp->addSession( $sub, 'line' );
    468 $vtp->addSession( $sub, 'title_line' );
    469 $vtp->setVar( $sub, 'title_line.title', $lang['conf_comments_title'] );
    470 $vtp->closeSession( $sub, 'title_line' );
    471 $vtp->closeSession( $sub, 'line' );
    472 
    473 $vtp->addSession( $sub, 'line' );
    474 $vtp->addSession( $sub, 'space_line' );
    475 $vtp->closeSession( $sub, 'space_line' );
    476 $vtp->closeSession( $sub, 'line' );
    477 // show comments ?
    478 $vtp->addSession( $sub, 'line' );
    479 $vtp->addSession( $sub, 'param_line' );
    480 $vtp->setVar( $sub, 'param_line.name', $lang['conf_comments_show_comments'] );
    481 $vtp->addSession( $sub, 'group' );
    482 $vtp->addSession( $sub, 'radio' );
    483 $vtp->setVar( $sub, 'radio.name', 'show_comments' );
    484 $vtp->setVar( $sub, 'radio.value', 'true' );
    485 $vtp->setVar( $sub, 'radio.option', $lang['yes'] );
    486 $checked = '';
    487 if ( $show_comments == 'true' )
    488 {
    489   $checked = ' checked="checked"';
    490 }
    491 $vtp->setVar( $sub, 'radio.checked', $checked );
    492 $vtp->closeSession( $sub, 'radio' );
    493 $vtp->addSession( $sub, 'radio' );
    494 $vtp->setVar( $sub, 'radio.name', 'show_comments' );
    495 $vtp->setVar( $sub, 'radio.value', 'false' );
    496 $vtp->setVar( $sub, 'radio.option', $lang['no'] );
    497 $checked = '';
    498 if ( $show_comments == 'false' )
    499 {
    500   $checked = ' checked="checked"';
    501 }
    502 $vtp->setVar( $sub, 'radio.checked', $checked );
    503 $vtp->closeSession( $sub, 'radio' );
    504 $vtp->closeSession( $sub, 'group' );
    505 $vtp->setVar( $sub, 'param_line.def',
    506               $lang['conf_comments_show_comments_info'] );
    507 $vtp->closeSession( $sub, 'param_line' );
    508 $vtp->closeSession( $sub, 'line' );
    509 // coments for all ? true -> guests can post messages
    510 $vtp->addSession( $sub, 'line' );
    511 $vtp->addSession( $sub, 'param_line' );
    512 $vtp->setVar( $sub, 'param_line.name', $lang['conf_comments_forall'] );
    513 $vtp->addSession( $sub, 'group' );
    514 $vtp->addSession( $sub, 'radio' );
    515 $vtp->setVar( $sub, 'radio.name', 'comments_forall' );
    516 $vtp->setVar( $sub, 'radio.value', 'true' );
    517 $vtp->setVar( $sub, 'radio.option', $lang['yes'] );
    518 $checked = '';
    519 if ( $comments_forall == 'true' )
    520 {
    521   $checked = ' checked="checked"';
    522 }
    523 $vtp->setVar( $sub, 'radio.checked', $checked );
    524 $vtp->closeSession( $sub, 'radio' );
    525 $vtp->addSession( $sub, 'radio' );
    526 $vtp->setVar( $sub, 'radio.name', 'comments_forall' );
    527 $vtp->setVar( $sub, 'radio.value', 'false' );
    528 $vtp->setVar( $sub, 'radio.option', $lang['no'] );
    529 $checked = '';
    530 if ( $comments_forall == 'false' )
    531 {
    532   $checked = ' checked="checked"';
    533 }
    534 $vtp->setVar( $sub, 'radio.checked', $checked );
    535 $vtp->closeSession( $sub, 'radio' );
    536 $vtp->closeSession( $sub, 'group' );
    537 $vtp->setVar( $sub, 'param_line.def',
    538               $lang['conf_comments_forall_info'] );
    539 $vtp->closeSession( $sub, 'param_line' );
    540 $vtp->closeSession( $sub, 'line' );
    541 // number of comments per page
    542 $vtp->addSession( $sub, 'line' );
    543 $vtp->addSession( $sub, 'param_line' );
    544 $vtp->setVar( $sub, 'param_line.name',
    545               $lang['conf_comments_comments_number'] );
    546 $vtp->addSession( $sub, 'text' );
    547 $vtp->setVar( $sub, 'text.name', 'nb_comment_page' );
    548 $vtp->setVar( $sub, 'text.value', $nb_comment_page );
    549 $vtp->closeSession( $sub, 'text' );
    550 $vtp->setVar( $sub, 'param_line.def',
    551               $lang['conf_comments_comments_number_info'] );
    552 $vtp->closeSession( $sub, 'param_line' );
    553 $vtp->closeSession( $sub, 'line' );
    554 // coments validation
    555 $vtp->addSession( $sub, 'line' );
    556 $vtp->addSession( $sub, 'param_line' );
    557 $vtp->setVar( $sub, 'param_line.name', $lang['conf_comments_validation'] );
    558 $vtp->addSession( $sub, 'group' );
    559 $vtp->addSession( $sub, 'radio' );
    560 $vtp->setVar( $sub, 'radio.name', 'comments_validation' );
    561 $vtp->setVar( $sub, 'radio.value', 'true' );
    562 $vtp->setVar( $sub, 'radio.option', $lang['yes'] );
    563 $checked = '';
    564 if ( $comments_validation == 'true' )
    565 {
    566   $checked = ' checked="checked"';
    567 }
    568 $vtp->setVar( $sub, 'radio.checked', $checked );
    569 $vtp->closeSession( $sub, 'radio' );
    570 $vtp->addSession( $sub, 'radio' );
    571 $vtp->setVar( $sub, 'radio.name', 'comments_validation' );
    572 $vtp->setVar( $sub, 'radio.value', 'false' );
    573 $vtp->setVar( $sub, 'radio.option', $lang['no'] );
    574 $checked = '';
    575 if ( $comments_validation == 'false' )
    576 {
    577   $checked = ' checked="checked"';
    578 }
    579 $vtp->setVar( $sub, 'radio.checked', $checked );
    580 $vtp->closeSession( $sub, 'radio' );
    581 $vtp->closeSession( $sub, 'group' );
    582 $vtp->setVar( $sub, 'param_line.def',
    583               $lang['conf_comments_validation_info'] );
    584 $vtp->closeSession( $sub, 'param_line' );
    585 $vtp->closeSession( $sub, 'line' );
    586 
    587 $vtp->addSession( $sub, 'line' );
    588 $vtp->addSession( $sub, 'space_line' );
    589 $vtp->closeSession( $sub, 'space_line' );
    590 $vtp->closeSession( $sub, 'line' );
    591 //-------------------------------------------------- default user configuration
    592 $vtp->addSession( $sub, 'line' );
    593 $vtp->addSession( $sub, 'title_line' );
    594 $vtp->setVar( $sub, 'title_line.title', $lang['conf_default_title'] );
    595 $vtp->closeSession( $sub, 'title_line' );
    596 $vtp->closeSession( $sub, 'line' );
    597 
    598 $vtp->addSession( $sub, 'line' );
    599 $vtp->addSession( $sub, 'space_line' );
    600 $vtp->closeSession( $sub, 'space_line' );
    601 $vtp->closeSession( $sub, 'line' );
    602 // default language
    603 $vtp->addSession( $sub, 'line' );
    604 $vtp->addSession( $sub, 'param_line' );
    605 $vtp->setVar( $sub, 'param_line.name', $lang['customize_language'] );
    606 $vtp->addSession( $sub, 'select' );
    607 $vtp->setVar( $sub, 'select.name', 'language' );
    608 $option = get_languages( './language/' );
    609 for ( $i = 0; $i < sizeof( $option ); $i++ )
    610 {
    611   $vtp->addSession( $sub, 'option' );
    612   $vtp->setVar( $sub, 'option.option', $option[$i] );
    613   if ( $option[$i] == $language )
    614   {
    615     $vtp->setVar( $sub, 'option.selected', ' selected="selected"' );
    616   }
    617   $vtp->closeSession( $sub, 'option' );
    618 }
    619 $vtp->closeSession( $sub, 'select' );
    620 $vtp->setVar( $sub, 'param_line.def', $lang['conf_default_language_info'] );
    621 $vtp->closeSession( $sub, 'param_line' );
    622 $vtp->closeSession( $sub, 'line' );
    623 // number of image per row
    624 $vtp->addSession( $sub, 'line' );
    625 $vtp->addSession( $sub, 'param_line' );
    626 $vtp->setVar( $sub, 'param_line.name', $lang['customize_nb_image_per_row'] );
    627 $vtp->addSession( $sub, 'select' );
    628 $vtp->setVar( $sub, 'select.name', 'nb_image_line' );
    629 for ( $i = 0; $i < sizeof( $conf['nb_image_row'] ); $i++ )
    630 {
    631   $vtp->addSession( $sub, 'option' );
    632   $vtp->setVar( $sub, 'option.option', $conf['nb_image_row'][$i] );
    633   if ( $conf['nb_image_row'][$i] == $nb_image_line )
    634   {
    635     $vtp->setVar( $sub, 'option.selected', ' selected="selected"' );
    636   }
    637   $vtp->closeSession( $sub, 'option' );
    638 }
    639 $vtp->closeSession( $sub, 'select' );
    640 $vtp->setVar( $sub, 'param_line.def',
    641               $lang['conf_default_nb_image_per_row_info'] );
    642 $vtp->closeSession( $sub, 'param_line' );
    643 $vtp->closeSession( $sub, 'line' );
    644 // number of row per page
    645 $vtp->addSession( $sub, 'line' );
    646 $vtp->addSession( $sub, 'param_line' );
    647 $vtp->setVar( $sub, 'param_line.name', $lang['customize_nb_row_per_page'] );
    648 $vtp->addSession( $sub, 'select' );
    649 $vtp->setVar( $sub, 'select.name', 'nb_line_page' );
    650 for ( $i = 0; $i < sizeof( $conf['nb_row_page'] ); $i++ )
    651 {
    652   $vtp->addSession( $sub, 'option' );
    653   $vtp->setVar( $sub, 'option.option', $conf['nb_row_page'][$i] );
    654   if ( $conf['nb_row_page'][$i] == $nb_line_page )
    655   {
    656     $vtp->setVar( $sub, 'option.selected', ' selected="selected"' );
    657   }
    658   $vtp->closeSession( $sub, 'option' );
    659 }
    660 $vtp->closeSession( $sub, 'select' );
    661 $vtp->setVar( $sub, 'param_line.def',
    662               $lang['conf_default_nb_row_per_page_info'] );
    663 $vtp->closeSession( $sub, 'param_line' );
    664 $vtp->closeSession( $sub, 'line' );
    665 // template
    666 $vtp->addSession( $sub, 'line' );
    667 $vtp->addSession( $sub, 'param_line' );
    668 $vtp->setVar( $sub, 'param_line.name', $lang['customize_theme'] );
    669 $vtp->addSession( $sub, 'select' );
    670 $vtp->setVar( $sub, 'select.name', 'template' );
    671 $option = get_dirs( './template/' );
    672 
    673 for ( $i = 0; $i < sizeof( $option ); $i++ )
    674 {
    675   $vtp->addSession( $sub, 'option' );
    676   $vtp->setVar( $sub, 'option.option', $option[$i] );
    677   if ( $option[$i] == $template )
    678   {
    679     $vtp->setVar( $sub, 'option.selected', ' selected="selected"' );
    680   }
    681   $vtp->closeSession( $sub, 'option' );
    682 }
    683 $vtp->closeSession( $sub, 'select' );
    684 $vtp->setVar( $sub, 'param_line.def', $lang['conf_default_theme_info'] );
    685 $vtp->closeSession( $sub, 'param_line' );
    686 $vtp->closeSession( $sub, 'line' );
    687 // short period time
    688 $vtp->addSession( $sub, 'line' );
    689 $vtp->addSession( $sub, 'param_line' );
    690 $vtp->setVar( $sub, 'param_line.name', $lang['customize_short_period'] );
    691 $vtp->addSession( $sub, 'text' );
    692 $vtp->setVar( $sub, 'text.name', 'short_period' );
    693 $vtp->setVar( $sub, 'text.value', $short_period );
    694 $vtp->closeSession( $sub, 'text' );
    695 $vtp->setVar( $sub, 'param_line.def', $lang['conf_default_short_period_info']);
    696 $vtp->closeSession( $sub, 'param_line' );
    697 $vtp->closeSession( $sub, 'line' );
    698 // long period time
    699 $vtp->addSession( $sub, 'line' );
    700 $vtp->addSession( $sub, 'param_line' );
    701 $vtp->setVar( $sub, 'param_line.name', $lang['customize_long_period'] );
    702 $vtp->addSession( $sub, 'text' );
    703 $vtp->setVar( $sub, 'text.name', 'long_period' );
    704 $vtp->setVar( $sub, 'text.value', $long_period );
    705 $vtp->closeSession( $sub, 'text' );
    706 $vtp->setVar( $sub, 'param_line.def', $lang['conf_default_long_period_info'] );
    707 $vtp->closeSession( $sub, 'param_line' );
    708 $vtp->closeSession( $sub, 'line' );
    709 // max displayed width
    710 $vtp->addSession( $sub, 'line' );
    711 $vtp->addSession( $sub, 'param_line' );
    712 $vtp->setVar( $sub, 'param_line.name', $lang['maxwidth'] );
    713 $vtp->addSession( $sub, 'text' );
    714 $vtp->setVar( $sub, 'text.name', 'maxwidth' );
    715 $vtp->setVar( $sub, 'text.value', $maxwidth );
    716 $vtp->closeSession( $sub, 'text' );
    717 $vtp->setVar( $sub, 'param_line.def', $lang['conf_default_maxwidth_info'] );
    718 $vtp->closeSession( $sub, 'param_line' );
    719 $vtp->closeSession( $sub, 'line' );
    720 // max displayed height
    721 $vtp->addSession( $sub, 'line' );
    722 $vtp->addSession( $sub, 'param_line' );
    723 $vtp->setVar( $sub, 'param_line.name', $lang['maxheight'] );
    724 $vtp->addSession( $sub, 'text' );
    725 $vtp->setVar( $sub, 'text.name', 'maxheight' );
    726 $vtp->setVar( $sub, 'text.value', $maxheight );
    727 $vtp->closeSession( $sub, 'text' );
    728 $vtp->setVar( $sub, 'param_line.def', $lang['conf_default_maxheight_info'] );
    729 $vtp->closeSession( $sub, 'param_line' );
    730 $vtp->closeSession( $sub, 'line' );
    731 // expand all categories ?
    732 $vtp->addSession( $sub, 'line' );
    733 $vtp->addSession( $sub, 'param_line' );
    734 $vtp->setVar( $sub, 'param_line.name', $lang['customize_expand'] );
    735 $vtp->addSession( $sub, 'group' );
    736 $vtp->addSession( $sub, 'radio' );
    737 $vtp->setVar( $sub, 'radio.name', 'expand' );
    738 
    739 $vtp->setVar( $sub, 'radio.value', 'true' );
    740 $checked = '';
    741 if ( $expand == 'true' )
    742 {
    743   $checked = ' checked="checked"';
    744 }
    745 $vtp->setVar( $sub, 'radio.checked', $checked );
    746 $vtp->setVar( $sub, 'radio.option', $lang['yes'] );
    747 $vtp->closeSession( $sub, 'radio' );
    748 $vtp->addSession( $sub, 'radio' );
    749 $vtp->setVar( $sub, 'radio.name', 'expand' );
    750 $vtp->setVar( $sub, 'radio.value', 'false' );
    751 $checked = '';
    752 if ( $expand == 'false' )
    753 {
    754   $checked = ' checked="checked"';
    755 }
    756 $vtp->setVar( $sub, 'radio.checked', $checked );
    757 $vtp->setVar( $sub, 'radio.option', $lang['no'] );
    758 $vtp->closeSession( $sub, 'radio' );
    759 $vtp->closeSession( $sub, 'group' );
    760 $vtp->setVar( $sub, 'param_line.def', $lang['conf_default_expand_info'] );
    761 $vtp->closeSession( $sub, 'param_line' );
    762 $vtp->closeSession( $sub, 'line' );
    763 // show number of comments on thumbnails page
    764 $vtp->addSession( $sub, 'line' );
    765 $vtp->addSession( $sub, 'param_line' );
    766 $vtp->setVar( $sub, 'param_line.name', $lang['customize_show_nb_comments'] );
    767 $vtp->addSession( $sub, 'group' );
    768 $vtp->addSession( $sub, 'radio' );
    769 $vtp->setVar( $sub, 'radio.name', 'show_nb_comments' );
    770 $vtp->setVar( $sub, 'radio.value', 'true' );
    771 $checked = '';
    772 if ( $show_nb_comments == 'true' )
    773 {
    774   $checked = ' checked="checked"';
    775 }
    776 $vtp->setVar( $sub, 'radio.checked', $checked );
    777 $vtp->setVar( $sub, 'radio.option', $lang['yes'] );
    778 $vtp->closeSession( $sub, 'radio' );
    779 $vtp->addSession( $sub, 'radio' );
    780 $vtp->setVar( $sub, 'radio.name', 'show_nb_comments' );
    781 $vtp->setVar( $sub, 'radio.value', 'false' );
    782 $checked = '';
    783 if ( $show_nb_comments == 'false' )
    784 {
    785   $checked = ' checked="checked"';
    786 }
    787 $vtp->setVar( $sub, 'radio.checked', $checked );
    788 $vtp->setVar( $sub, 'radio.option', $lang['no'] );
    789 $vtp->closeSession( $sub, 'radio' );
    790 $vtp->closeSession( $sub, 'group' );
    791 $vtp->setVar( $sub, 'param_line.def', $lang['conf_default_show_nb_comments_info'] );
    792 $vtp->closeSession( $sub, 'param_line' );
    793 $vtp->closeSession( $sub, 'line' );
    794 
    795 $vtp->addSession( $sub, 'line' );
    796 $vtp->addSession( $sub, 'space_line' );
    797 $vtp->closeSession( $sub, 'space_line' );
    798 $vtp->closeSession( $sub, 'line' );
    799 //-------------------------------------------------------- upload configuration
    800 $vtp->addSession( $sub, 'line' );
    801 $vtp->addSession( $sub, 'title_line' );
    802 $vtp->setVar( $sub, 'title_line.title', $lang['conf_upload_title'] );
    803 $vtp->closeSession( $sub, 'title_line' );
    804 $vtp->closeSession( $sub, 'line' );
    805 
    806 $vtp->addSession( $sub, 'line' );
    807 $vtp->addSession( $sub, 'space_line' );
    808 $vtp->closeSession( $sub, 'space_line' );
    809 $vtp->closeSession( $sub, 'line' );
    810 // is upload available ?
    811 $vtp->addSession( $sub, 'line' );
    812 $vtp->addSession( $sub, 'param_line' );
    813 $vtp->setVar( $sub, 'param_line.name', $lang['conf_upload_available'] );
    814 $vtp->addSession( $sub, 'group' );
    815 $vtp->addSession( $sub, 'radio' );
    816 $vtp->setVar( $sub, 'radio.name', 'upload_available' );
    817 $vtp->setVar( $sub, 'radio.value', 'true' );
    818 $checked = '';
    819 if ( $upload_available == 'true' )
    820 {
    821   $checked = ' checked="checked"';
    822 }
    823 $vtp->setVar( $sub, 'radio.checked', $checked );
    824 $vtp->setVar( $sub, 'radio.option', $lang['yes'] );
    825 $vtp->closeSession( $sub, 'radio' );
    826 $vtp->addSession( $sub, 'radio' );
    827 $vtp->setVar( $sub, 'radio.name', 'upload_available' );
    828 $vtp->setVar( $sub, 'radio.value', 'false' );
    829 $checked = '';
    830 if ( $upload_available == 'false' )
    831 {
    832   $checked = ' checked="checked"';
    833 }
    834 $vtp->setVar( $sub, 'radio.checked', $checked );
    835 $vtp->setVar( $sub, 'radio.option', $lang['no'] );
    836 $vtp->closeSession( $sub, 'radio' );
    837 $vtp->closeSession( $sub, 'group' );
    838 $vtp->setVar( $sub, 'param_line.def', $lang['conf_upload_available_info'] );
    839 $vtp->closeSession( $sub, 'param_line' );
    840 $vtp->closeSession( $sub, 'line' );
    841 // max filesize uploadable
    842 $vtp->addSession( $sub, 'line' );
    843 $vtp->addSession( $sub, 'param_line' );
    844 $vtp->setVar( $sub, 'param_line.name', $lang['conf_upload_maxfilesize'] );
    845 $vtp->addSession( $sub, 'text' );
    846 $vtp->setVar( $sub, 'text.name', 'upload_maxfilesize' );
    847 $vtp->setVar( $sub, 'text.value', $upload_maxfilesize );
    848 $vtp->closeSession( $sub, 'text' );
    849 $vtp->setVar( $sub, 'param_line.def', $lang['conf_upload_maxfilesize_info'] );
    850 $vtp->closeSession( $sub, 'param_line' );
    851 $vtp->closeSession( $sub, 'line' );
    852 // maxwidth uploadable
    853 $vtp->addSession( $sub, 'line' );
    854 $vtp->addSession( $sub, 'param_line' );
    855 $vtp->setVar( $sub, 'param_line.name', $lang['conf_upload_maxwidth'] );
    856 $vtp->addSession( $sub, 'text' );
    857 $vtp->setVar( $sub, 'text.name', 'upload_maxwidth' );
    858 $vtp->setVar( $sub, 'text.value', $upload_maxwidth );
    859 $vtp->closeSession( $sub, 'text' );
    860 $vtp->setVar( $sub, 'param_line.def', $lang['conf_upload_maxwidth_info'] );
    861 $vtp->closeSession( $sub, 'param_line' );
    862 $vtp->closeSession( $sub, 'line' );
    863 // maxheight uploadable
    864 $vtp->addSession( $sub, 'line' );
    865 $vtp->addSession( $sub, 'param_line' );
    866 $vtp->setVar( $sub, 'param_line.name', $lang['conf_upload_maxheight'] );
    867 $vtp->addSession( $sub, 'text' );
    868 $vtp->setVar( $sub, 'text.name', 'upload_maxheight' );
    869 $vtp->setVar( $sub, 'text.value', $upload_maxheight );
    870 $vtp->closeSession( $sub, 'text' );
    871 $vtp->setVar( $sub, 'param_line.def', $lang['conf_upload_maxheight_info'] );
    872 $vtp->closeSession( $sub, 'param_line' );
    873 $vtp->closeSession( $sub, 'line' );
    874 // maxwidth for thumbnail
    875 $vtp->addSession( $sub, 'line' );
    876 $vtp->addSession( $sub, 'param_line' );
    877 $vtp->setVar( $sub, 'param_line.name',$lang['conf_upload_maxwidth_thumbnail']);
    878 $vtp->addSession( $sub, 'text' );
    879 $vtp->setVar( $sub, 'text.name', 'upload_maxwidth_thumbnail' );
    880 $vtp->setVar( $sub, 'text.value', $upload_maxwidth_thumbnail );
    881 $vtp->closeSession( $sub, 'text' );
    882 $vtp->setVar($sub,'param_line.def',$lang['conf_upload_maxwidth_thumbnail_info']);
    883 $vtp->closeSession( $sub, 'param_line' );
    884 $vtp->closeSession( $sub, 'line' );
    885 // maxheight for thumbnail
    886 $vtp->addSession( $sub, 'line' );
    887 $vtp->addSession( $sub, 'param_line' );
    888 $vtp->setVar( $sub,'param_line.name',$lang['conf_upload_maxheight_thumbnail']);
    889 $vtp->addSession( $sub, 'text' );
    890 $vtp->setVar( $sub, 'text.name', 'upload_maxheight_thumbnail' );
    891 $vtp->setVar( $sub, 'text.value', $upload_maxheight_thumbnail );
    892 $vtp->closeSession( $sub, 'text' );
    893 $vtp->setVar( $sub, 'param_line.def', $lang['conf_upload_maxheight_thumbnail_info']);
    894 $vtp->closeSession( $sub, 'param_line' );
    895 $vtp->closeSession( $sub, 'line' );
    896 
    897 $vtp->addSession( $sub, 'line' );
    898 $vtp->addSession( $sub, 'space_line' );
    899 $vtp->closeSession( $sub, 'space_line' );
    900 $vtp->closeSession( $sub, 'line' );
    901 //------------------------------------------------------ sessions configuration
    902 $vtp->addSession( $sub, 'line' );
    903 $vtp->addSession( $sub, 'title_line' );
    904 $vtp->setVar( $sub, 'title_line.title', $lang['conf_session_title'] );
    905 $vtp->closeSession( $sub, 'title_line' );
    906 $vtp->closeSession( $sub, 'line' );
    907 
    908 $vtp->addSession( $sub, 'line' );
    909 $vtp->addSession( $sub, 'space_line' );
    910 $vtp->closeSession( $sub, 'space_line' );
    911 $vtp->closeSession( $sub, 'line' );
    912 // authorize cookies ?
    913 $vtp->addSession( $sub, 'line' );
    914 $vtp->addSession( $sub, 'param_line' );
    915 $vtp->setVar( $sub, 'param_line.name', $lang['conf_session_cookie'] );
    916 $vtp->addSession( $sub, 'group' );
    917 $vtp->addSession( $sub, 'radio' );
    918 $vtp->setVar( $sub, 'radio.name', 'authorize_cookies' );
    919 $vtp->setVar( $sub, 'radio.value', 'true' );
    920 $checked = '';
    921 if ( $authorize_cookies == 'true' )
    922 {
    923   $checked = ' checked="checked"';
    924 }
    925 $vtp->setVar( $sub, 'radio.checked', $checked );
    926 $vtp->setVar( $sub, 'radio.option', $lang['yes'] );
    927 $vtp->closeSession( $sub, 'radio' );
    928 $vtp->addSession( $sub, 'radio' );
    929 $vtp->setVar( $sub, 'radio.name', 'authorize_cookies' );
    930 $vtp->setVar( $sub, 'radio.value', 'false' );
    931 $checked = '';
    932 if ( $authorize_cookies == 'false' )
    933 {
    934   $checked = ' checked="checked"';
    935 }
    936 $vtp->setVar( $sub, 'radio.checked', $checked );
    937 $vtp->setVar( $sub, 'radio.option', $lang['no'] );
    938 $vtp->closeSession( $sub, 'radio' );
    939 $vtp->closeSession( $sub, 'group' );
    940 $vtp->setVar( $sub, 'param_line.def', $lang['conf_session_cookie_info'] );
    941 $vtp->closeSession( $sub, 'param_line' );
    942 $vtp->closeSession( $sub, 'line' );
    943 // session size
    944 $vtp->addSession( $sub, 'line' );
    945 $vtp->addSession( $sub, 'param_line' );
    946 $vtp->setVar( $sub, 'param_line.name', $lang['conf_session_size'] );
    947 $vtp->addSession( $sub, 'text' );
    948 $vtp->setVar( $sub, 'text.name', 'session_id_size' );
    949 $vtp->setVar( $sub, 'text.value', $session_id_size );
    950 $vtp->closeSession( $sub, 'text' );
    951 $vtp->setVar( $sub, 'param_line.def', $lang['conf_session_size_info']);
    952 $vtp->closeSession( $sub, 'param_line' );
    953 $vtp->closeSession( $sub, 'line' );
    954 // session length
    955 $vtp->addSession( $sub, 'line' );
    956 $vtp->addSession( $sub, 'param_line' );
    957 $vtp->setVar( $sub, 'param_line.name', $lang['conf_session_time'] );
    958 $vtp->addSession( $sub, 'text' );
    959 $vtp->setVar( $sub, 'text.name', 'session_time' );
    960 $vtp->setVar( $sub, 'text.value', $session_time );
    961 $vtp->closeSession( $sub, 'text' );
    962 $vtp->setVar( $sub, 'param_line.def', $lang['conf_session_time_info']);
    963 $vtp->closeSession( $sub, 'param_line' );
    964 $vtp->closeSession( $sub, 'line' );
    965 // session keyword
    966 $vtp->addSession( $sub, 'line' );
    967 $vtp->addSession( $sub, 'param_line' );
    968 $vtp->setVar( $sub, 'param_line.name', $lang['conf_session_key'] );
    969 $vtp->addSession( $sub, 'text' );
    970 $vtp->setVar( $sub, 'text.name', 'session_keyword' );
    971 $vtp->setVar( $sub, 'text.value', $session_keyword );
    972 $vtp->closeSession( $sub, 'text' );
    973 $vtp->setVar( $sub, 'param_line.def', $lang['conf_session_key_info']);
    974 $vtp->closeSession( $sub, 'param_line' );
    975 $vtp->closeSession( $sub, 'line' );
    976 // session deletion
    977 $vtp->addSession( $sub, 'line' );
    978 $vtp->addSession( $sub, 'param_line' );
    979 $vtp->setVar( $sub, 'param_line.name', $lang['conf_session_delete'] );
    980 $vtp->addSession( $sub, 'check' );
    981 $vtp->addSession( $sub, 'box' );
    982 $vtp->setVar( $sub, 'box.name', 'empty_session_table' );
    983 $vtp->setVar( $sub, 'box.value', '1' );
    984 $vtp->setVar( $sub, 'box.checked', ' checked="checked"' );
    985 $vtp->closeSession( $sub, 'box' );
    986 $vtp->closeSession( $sub, 'check' );
    987 $vtp->setVar( $sub, 'param_line.def', $lang['conf_session_delete_info'] );
    988 $vtp->closeSession( $sub, 'param_line' );
    989 $vtp->closeSession( $sub, 'line' );
    990 
    991 $vtp->addSession( $sub, 'line' );
    992 $vtp->addSession( $sub, 'space_line' );
    993 $vtp->closeSession( $sub, 'space_line' );
    994 $vtp->closeSession( $sub, 'line' );
     318    $template->assign_block_vars('errors.error',array('ERROR'=>$error[$i]));
     319  }
     320}
     321elseif ( isset( $_POST['submit'] ) )
     322{
     323  $template->assign_block_vars('confirmation' ,array());
     324}
    995325//------------------------------------------------ remote sites administration
    996326$query = 'select id,galleries_url';
    997 $query.= ' from '.PREFIX_TABLE.'sites';
     327$query.= ' from '.SITES_TABLE;
    998328$query.= " where galleries_url <> './galleries/';";
    999329$result = mysql_query( $query );
     
    1019349}
    1020350//----------------------------------------------------------- sending html code
    1021 $vtp->Parse( $handle , 'sub', $sub );
     351$template->assign_var_from_handle('ADMIN_CONTENT', 'config');
    1022352?>
  • trunk/admin/help.php

    r362 r393  
    2525// | USA.                                                                  |
    2626// +-----------------------------------------------------------------------+
    27 include_once( './admin/include/isadmin.inc.php' );
     27include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
    2828//----------------------------------------------------- template initialization
    29 $sub = $vtp->Open( './template/'.$user['template'].'/admin/help.vtp' );
    30 $tpl = array( );
    31 templatize_array( $tpl, 'lang', $sub );
     29$template->set_filenames( array('help'=>'admin/help.tpl') );
     30
    3231//----------------------------------------------------- help categories display
    3332$categories = array( 'images','thumbnails','database','remote','upload',
    3433                     'virtual','groups','access','infos' );
    3534foreach ( $categories as $category ) {
    36   $vtp->addSession( $sub, 'cat' );
     35  $template->assign_block_vars('cat', array('NAME'=>$lang['help_'.$category.'_title']));
    3736  if ( $category == 'images' )
    3837  {
    39     $vtp->addSession( $sub, 'illustration' );
    40     $vtp->setVar( $sub, 'illustration.pic_src', './admin/images/admin.png' );
    41     $vtp->setVar( $sub, 'illustration.pic_alt', '' );
    42     $vtp->setVar( $sub, 'illustration.caption', $lang['help_images_intro'] );
    43     $vtp->closeSession( $sub, 'illustration' );
     38    $template->assign_block_vars('cat.illustration', array(
     39          'SRC_IMG'=>PHPWG_ROOT_PATH.'admin/images/admin.png',
     40          'CAPTION'=>$lang['help_images_intro']
     41          ));
    4442  }
    45   $vtp->setVar( $sub, 'cat.name', $lang['help_'.$category.'_title'] );
    4643  foreach ( $lang['help_'.$category] as $item ) {
    47     $vtp->addSession( $sub, 'item' );
    48     $vtp->setVar( $sub, 'item.content', $item );
    49     $vtp->closeSession( $sub, 'item' );
     44    $template->assign_block_vars('cat.item', array('CONTENT'=>$item));
    5045  }
    51 
    52   $vtp->closeSession( $sub, 'cat' );
    5346}
    54 //----------------------------------------------------------- sending html code
    55 $vtp->Parse( $handle , 'sub', $sub );
     47$template->assign_var_from_handle('ADMIN_CONTENT', 'help');
    5648?>
  • trunk/admin/include/functions.php

    r364 r393  
    668668           
    669669      $query = 'SELECT MAX(date_last) AS last_date';
    670       $query.= ' FROM '.PREFIX_TABLE.'categories';
     670      $query.= ' FROM '.CATEGORIES_TABLE;
    671671      $query.= ' WHERE id IN ('.$category['id'];
    672672      if ( count( $user_all_subcats ) > 0 )
     
    736736{
    737737  // 1. retrieving ids of private categories
    738   $query = 'SELECT id';
    739   $query.= ' FROM '.PREFIX_TABLE.'categories';
     738  $query = 'SELECT id FROM '.CATEGORIES_TABLE;
    740739  $query.= " WHERE status = 'private'";
    741740  $query.= ';';
     
    750749  // 2.1. retrieving authorized categories thanks to personnal user
    751750  //      authorization
    752   $query = 'SELECT cat_id';
    753   $query.= ' FROM '.PREFIX_TABLE.'user_access';
     751  $query = 'SELECT cat_id FROM '.USER_ACCESS_TABLE;
    754752  $query.= ' WHERE user_id = '.$user_id;
    755753  $query.= ';';
     
    764762  {
    765763    $query = 'SELECT ga.cat_id';
    766     $query.= ' FROM '.PREFIX_TABLE.'user_group as ug';
    767     $query.= ', '.PREFIX_TABLE.'group_access as ga';
     764    $query.= ' FROM '.USER_GROUP_TABLE.' as ug';
     765    $query.= ', '.GROUP_ACCESS_TABLE.' as ga';
    768766    $query.= ' WHERE ug.group_id = ga.group_id';
    769767    $query.= ' AND ug.user_id = '.$user_id;
     
    790788    if ( $user_status != 'admin' )
    791789    {
    792       $query = 'SELECT id';
    793       $query.= ' FROM '.PREFIX_TABLE.'categories';
     790      $query = 'SELECT id FROM '.CATEGORIES_TABLE;
    794791      $query.= " WHERE visible = 'false';";
    795792      $result = mysql_query( $query );
     
    822819  foreach( $user_restrictions as $user_id => $restrictions ) {
    823820    $query = 'DELETE';
    824     $query.= ' FROM '.PREFIX_TABLE.'user_category';
     821    $query.= ' FROM '.USER_CATEGORY_TABLE;
    825822    $query.= ' WHERE user_id = '.$user_id;
    826823    $query.= ';';
     
    828825  }
    829826
    830   $query = 'INSERT INTO '.PREFIX_TABLE.'user_category';
     827  $query = 'INSERT INTO '.USER_CATEGORY_TABLE;
    831828  $query.= ' (user_id,category_id,date_last,nb_sub_categories) VALUES ';
    832829  $query.= $values;
     
    903900  $query = 'SELECT id';
    904901  $query.= ' FROM '.USERS_TABLE;
    905   $query.= ', '.PREFIX_TABLE.'user_group';
     902  $query.= ', '.USER_GROUP_TABLE;
    906903  $query.= ' WHERE group_id = '.$group_id;
    907904  $query.= ' AND id = user_id';
     
    980977
    981978  $query = 'SELECT uppercats';
    982   $query.= ' FROM '.PREFIX_TABLE.'categories';
     979  $query.= ' FROM '.CATEGORIES_TABLE;
    983980  $query.= ' WHERE id = '.$category_id;
    984981  $query.= ';';
  • trunk/admin/include/isadmin.inc.php

    r364 r393  
    2626// +-----------------------------------------------------------------------+
    2727
    28 include( './admin/include/functions.php' );
     28include( PHPWG_ROOT_PATH.'admin/include/functions.php' );
    2929
    3030$isadmin = true;
  • trunk/admin/thumbnail.php

    r362 r393  
    2525// | USA.                                                                  |
    2626// +-----------------------------------------------------------------------+
    27 include_once( './admin/include/isadmin.inc.php' );
     27include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
    2828//------------------------------------------------------------------- functions
    2929// get_subdirs returns an array containing all sub directory names,
     
    212212}
    213213
    214 // array_max returns the highest value of the given array
    215 function array_max( $array )
    216 {
    217   sort( $array, SORT_NUMERIC );
    218   return array_pop( $array );
    219 }
    220 
    221 // array_min returns the lowest value of the given array
    222 function array_min( $array )
    223 {
    224   sort( $array, SORT_NUMERIC );
    225   return array_shift( $array );
    226 }
    227 
    228 // array_avg returns the average value of the array
    229 function array_avg( $array )
    230 {
    231   return array_sum( $array ) / sizeof( $array );
    232 }
    233        
    234214// get_displayed_dirs builds the tree of dirs under "galleries". If a
    235215// directory contains pictures without thumbnails, the become linked to the
     
    237217function get_displayed_dirs( $dir, $indent )
    238218{
    239   global $conf,$lang,$vtp,$sub;
     219  global $lang;
    240220               
    241221  $sub_dirs = get_subdirs( $dir );
     222  $output = '';
     223  if (!empty($sub_dirs))
     224  {
     225  $output.='<ul class="menu">';
    242226  // write of the dirs
    243227  foreach ( $sub_dirs as $sub_dir ) {
     228    $output.='<li>';
    244229    $pictures = get_images_without_thumbnail( $dir.'/'.$sub_dir );
    245     $vtp->addSession( $sub, 'dir' );
    246     $vtp->setVar( $sub, 'dir.indent', $indent );
    247230    if ( count( $pictures ) > 0 )
    248231    {
    249       $vtp->addSession( $sub, 'linked' );
    250       $url = './admin.php?page=thumbnail&amp;dir='.$dir."/".$sub_dir;
    251       $vtp->setVar( $sub, 'linked.url', add_session_id( $url ) );
    252       $vtp->setVar( $sub, 'linked.name', $sub_dir );
    253       $vtp->setVar( $sub, 'linked.nb_pic', count( $pictures ) );
    254       $vtp->closeSession( $sub, 'linked' );
     232          $url = add_session_id(PHPWG_ROOT_PATH.'admin.php?page=thumbnail&amp;dir='.$dir.'/'.$sub_dir);
     233      $output.='<a class="adminMenu" href="'.$url.'">'.$sub_dir.'</a> [ '.count( $pictures ).' ';
     234          $output.=$lang['thumbnail'].' ]';
    255235    }
    256236    else
    257237    {
    258       $vtp->addSession( $sub, 'unlinked' );
    259       $vtp->setVar( $sub, 'unlinked.name', $sub_dir );
    260       $vtp->closeSession( $sub, 'unlinked' );
    261     }
    262     $vtp->closeSession( $sub, 'dir' );
     238      $output.=$sub_dir;
     239    }
    263240    // recursive call
    264     get_displayed_dirs( $dir.'/'.$sub_dir,
    265                                 $indent+30 );   
    266   }
    267 }
     241    $output.=get_displayed_dirs( $dir.'/'.$sub_dir,
     242                                $indent+30 );
     243        $output.='</li>';   
     244  }
     245  $output.='</ul>';
     246  }
     247  return $output;
     248}
     249
     250$errors = array();
     251$pictures = array();
     252$stats = array();
     253
     254if ( isset( $_GET['dir'] ) &&  isset( $_POST['submit'] ))
     255{
     256  $pictures = get_images_without_thumbnail( $_GET['dir'] );
     257  // checking criteria
     258  if ( !ereg( "^[0-9]{2,3}$", $_POST['width'] ) or $_POST['width'] < 10 )
     259  {
     260    array_push( $errors, $lang['tn_err_width'].' 10' );
     261  }
     262  if ( !ereg( "^[0-9]{2,3}$", $_POST['height'] ) or $_POST['height'] < 10 )
     263  {
     264    array_push( $errors, $lang['tn_err_height'].' 10' );
     265  }
     266 
     267  // picture miniaturization
     268  if ( count( $errors ) == 0 )
     269  {
     270    $stats = scandir( $_GET['dir'], $_POST['width'], $_POST['height'] );
     271  }
     272}
     273               
    268274//----------------------------------------------------- template initialization
    269 $sub = $vtp->Open( './template/'.$user['template'].'/admin/thumbnail.vtp' );
    270 $tpl = array(
    271   'tn_dirs_title','tn_dirs_alone','tn_params_title','tn_params_GD',
    272   'tn_params_GD_info','tn_width','tn_params_width_info','tn_height',
    273   'tn_params_height_info','tn_params_create','tn_params_create_info',
    274   'tn_params_format','tn_params_format_info','submit','tn_alone_title',
    275   'filesize','tn_picture','tn_results_title','thumbnail',
    276   'tn_results_gen_time','tn_stats','tn_stats_nb','tn_stats_total',
    277   'tn_stats_max','tn_stats_min','tn_stats_mean' );
    278 templatize_array( $tpl, 'lang', $sub );
    279 $vtp->setGlobalVar( $sub, 'user_template', $user['template'] );
     275$template->set_filenames( array('thumbnail'=>'admin/thumbnail.tpl') );
     276
     277$template->assign_vars(array(
     278  'L_THUMBNAIL_TITLE'=>$lang['tn_dirs_title'],
     279  'L_UNLINK'=>$lang['tn_dirs_alone'],
     280  'L_RESULTS'=>$lang['tn_results_title'],
     281  'L_TN_PICTURE'=>$lang['tn_picture'],
     282  'L_FILESIZE'=>$lang['filesize'],
     283  'L_WIDTH'=>$lang['tn_width'],
     284  'L_HEIGHT'=>$lang['tn_height'],
     285  'L_GENERATED'=>$lang['tn_results_gen_time'],
     286  'L_THUMBNAIL'=>$lang['thumbnail'],
     287  'L_PARAMS'=>$lang['tn_params_title'],
     288  'L_GD'=>$lang['tn_params_GD'],
     289  'L_GD_INFO'=>$lang['tn_params_GD_info'],
     290  'L_WIDTH_INFO'=>$lang['tn_params_width_info'],
     291  'L_HEIGHT_INFO'=>$lang['tn_params_height_info'],
     292  'L_CREATE'=>$lang['tn_params_create'],
     293  'L_CREATE_INFO'=>$lang['tn_params_create_info'],
     294  'L_FORMAT'=>$lang['tn_params_format'],
     295  'L_FORMAT_INFO'=>$lang['tn_params_format_info'],
     296  'L_SUBMIT'=>$lang['submit'],
     297  'L_REMAINING'=>$lang['tn_alone_title'],
     298  'L_TN_STATS'=>$lang['tn_stats'],
     299  'L_TN_NB_STATS'=>$lang['tn_stats_nb'],
     300  'L_TN_TOTAL'=>$lang['tn_stats_total'],
     301  'L_TN_MAX'=>$lang['tn_stats_max'],
     302  'L_TN_MIN'=>$lang['tn_stats_min'],
     303  'L_TN_AVERAGE'=>$lang['tn_stats_mean'],
     304 
     305  'T_STYLE'=>$user['template']
     306  ));
     307
    280308//----------------------------------------------------- miniaturization results
    281 if ( isset( $_GET['dir'] ) )
    282 {
     309if ( sizeof( $errors ) != 0 )
     310{
     311  $template->assign_block_vars('errors',array());
     312  for ( $i = 0; $i < sizeof( $errors ); $i++ )
     313  {
     314    $template->assign_block_vars('errors.error',array('ERROR'=>$errors[$i]));
     315  }
     316}
     317else if ( isset( $_GET['dir'] ) &&  isset( $_POST['submit'] ) && !empty($stats))
     318{
     319  $times = array();
     320  foreach ( $stats as $stat ) {
     321        array_push( $times, $stat['time'] );
     322  }
     323  $sum=array_sum( $times );
     324  $average = $sum/sizeof($times);
     325  sort( $times, SORT_NUMERIC );
     326  $max = array_pop($times);
     327  $min = array_shift( $times);
     328 
     329  $template->assign_block_vars('results',array(
     330    'TN_NB'=>count( $stats ),
     331        'TN_TOTAL'=>number_format( $sum, 2, '.', ' ').' ms',
     332        'TN_MAX'=>number_format( $max, 2, '.', ' ').' ms',
     333        'TN_MIN'=>number_format( $min, 2, '.', ' ').' ms',
     334        'TN_AVERAGE'=>number_format( $average, 2, '.', ' ').' ms'
     335        ));
     336  if ( !count( $pictures ) )
     337  {
     338    $template->assign_block_vars('warning',array());
     339  }
     340
     341  foreach ( $stats as $i => $stat )
     342  {
     343        $class = ($i % 2)? 'row1':'row2';
     344    $color='';
     345        if ($stat['time']==$max) $color = 'red';
     346        elseif ($stat['time']==$min) $color = '#33FF00';
     347        $template->assign_block_vars('results.picture',array(
     348          'NB_IMG'=>($i+1),
     349          'FILE_IMG'=>$stat['file'],
     350          'FILESIZE_IMG'=>$stat['size'],
     351          'WIDTH_IMG'=>$stat['width'],
     352          'HEIGHT_IMG'=>$stat['height'],
     353          'TN_FILE_IMG'=>$stat['tn_file'],
     354          'TN_FILESIZE_IMG'=>$stat['tn_size'],
     355          'TN_WIDTH_IMG'=>$stat['tn_width'],
     356          'TN_HEIGHT_IMG'=>$stat['tn_height'],
     357          'GEN_TIME'=>number_format( $stat['time'], 2, '.', ' ').' ms',
     358         
     359          'T_COLOR'=>$color,
     360          'T_CLASS'=>$class
     361          ));
     362    }
     363  }
     364//-------------------------------------------------- miniaturization parameters
     365if ( isset( $_GET['dir'] ) && !sizeof( $pictures ))
     366{
     367    $form_url = PHPWG_ROOT_PATH.'admin.php?page=thumbnail&amp;dir='.$_GET['dir'];
     368    $gd = !empty( $_POST['gd'] )?$_POST['gd']:2;
     369        $width = !empty( $_POST['width'] )?$_POST['width']:128;
     370        $height = !empty( $_POST['height'] )?$_POST['height']:96;
     371        $gdlabel = 'GD'.$gd.'_CHECKED';
     372
     373    $template->assign_block_vars('params',array(
     374          'F_ACTION'=>add_session_id($form_url),
     375          $gdlabel=>'checked="checked"',
     376          'WIDTH_TN'=>$width,
     377          'HEIGHT_TN'=>$height
     378          ));
     379
     380//---------------------------------------------------------- remaining pictures
    283381  $pictures = get_images_without_thumbnail( $_GET['dir'] );
    284   if ( count( $pictures ) == 0 )
    285   {
    286     $vtp->addSession( $sub, 'warning' );
    287     $vtp->closeSession( $sub, 'warning' );
    288   }
    289   elseif ( isset( $_POST['submit'] ) )
    290   {
    291     // checking criteria
    292     $errors = array();
    293     if ( !ereg( "^[0-9]{2,3}$", $_POST['width'] ) or $_POST['width'] < 10 )
    294     {
    295       array_push( $errors, $lang['tn_err_width'].' 10' );
    296     }
    297     if ( !ereg( "^[0-9]{2,3}$", $_POST['height'] ) or $_POST['height'] < 10 )
    298     {
    299       array_push( $errors, $lang['tn_err_height'].' 10' );
    300     }
    301     // picture miniaturization
    302     if ( count( $errors ) == 0 )
    303     {
    304       $vtp->addSession( $sub, 'results' );
    305       $stats = scandir( $_GET['dir'], $_POST['width'], $_POST['height'] );
    306       $times = array();
    307       foreach ( $stats as $stat ) {
    308         array_push( $times, $stat['time'] );
    309       }
    310       $max = array_max( $times );
    311       $min = array_min( $times );
    312       foreach ( $stats as $i => $stat ) {
    313         $vtp->addSession( $sub, 'picture' );
    314         if ( $i % 2 == 1 )
    315         {
    316           $vtp->setVar( $sub, 'picture.class', 'row2' );
    317         }
    318         $vtp->setVar( $sub, 'picture.num',            ($i+1) );
    319         $vtp->setVar( $sub, 'picture.file',           $stat['file'] );
    320         $vtp->setVar( $sub, 'picture.filesize',       $stat['size'] );
    321         $vtp->setVar( $sub, 'picture.width',          $stat['width'] );
    322         $vtp->setVar( $sub, 'picture.height',         $stat['height'] );
    323         $vtp->setVar( $sub, 'picture.thumb_file',     $stat['tn_file'] );
    324         $vtp->setVar( $sub, 'picture.thumb_filesize', $stat['tn_size'] );
    325         $vtp->setVar( $sub, 'picture.thumb_width',    $stat['tn_width'] );
    326         $vtp->setVar( $sub, 'picture.thumb_height',   $stat['tn_height'] );
    327         $vtp->setVar( $sub, 'picture.time',
    328                       number_format( $stat['time'], 2, '.', ' ').' ms' );
    329         if ( $stat['time'] == $max )
    330         {
    331           $vtp->setVar( $sub, 'picture.color', 'red' );
    332         }
    333         else if ( $stat['time'] == $min )
    334         {
    335           $vtp->setVar( $sub, 'picture.color', 'green' );
    336         }
    337         $vtp->closeSession( $sub, 'picture' );
    338       }
    339       // general statistics
    340       $vtp->setVar( $sub, 'results.stats_nb', count( $stats ) );
    341       $vtp->setVar( $sub, 'results.stats_total',
    342                     number_format( array_sum( $times ), 2, '.', ' ').' ms' );
    343       $vtp->setVar( $sub, 'results.stats_max',
    344                     number_format( $max, 2, '.', ' ').' ms' );
    345       $vtp->setVar( $sub, 'results.stats_min',
    346                     number_format( $min, 2, '.', ' ').' ms' );
    347       $vtp->setVar( $sub, 'results.stats_mean',
    348                     number_format( array_avg( $times ), 2, '.', ' ').' ms' );
    349       $vtp->closeSession( $sub, 'results' );
    350     }
    351     else
    352     {
    353       $vtp->addSession( $sub, 'errors' );
    354       foreach ( $errors as $error ) {
    355         $vtp->addSession( $sub, 'li' );
    356         $vtp->setVar( $sub, 'li.li', $error );
    357         $vtp->closeSession( $sub, 'li' );
    358       }
    359       $vtp->closeSession( $sub, 'errors' );
    360     }
    361   }
    362 //-------------------------------------------------- miniaturization parameters
    363   if ( sizeof( $pictures ) != 0 )
    364   {
    365     $vtp->addSession( $sub, 'params' );
    366     $url = './admin.php?page=thumbnail&amp;dir='.$_GET['dir'];
    367     $vtp->setVar( $sub, 'params.action', add_session_id( $url ) );
    368     // GD version selected...
    369     if ( isset( $_POST['gd'] ) and $_POST['gd'] == 1 )
    370     {
    371       $vtp->setVar( $sub, 'params.gd1_checked', ' checked="checked"' );
    372     }
    373     else
    374     {
    375       $vtp->setVar( $sub, 'params.gd2_checked', ' checked="checked"' );
    376     }
    377     // width values
    378     if ( isset( $_POST['width'] ) )
    379     {
    380       $vtp->setVar( $sub, 'params.width_value', $_POST['width'] );
    381     }
    382     else
    383     {
    384       $vtp->setVar( $sub, 'params.width_value', '128' );
    385     }
    386     // height value
    387     if ( isset( $_POST['height'] ) )
    388     {
    389       $vtp->setVar( $sub, 'params.height_value', $_POST['height'] );
    390     }
    391     else
    392     {
    393       $vtp->setVar( $sub, 'params.height_value', '96' );
    394     }
    395     // options for the number of picture to miniaturize : "n"
    396     $options = array( 5,10,20,40 );
    397     if ( isset( $_POST['n'] ) ) $n = $_POST['n'];
    398     else                        $n = 5;
    399     foreach ( $options as $option ) {
    400       $vtp->addSession( $sub, 'n_option' );
    401       $vtp->setVar( $sub, 'n_option.option', $option );
    402       if ( $option == $n )
    403       {
    404         $vtp->setVar( $sub, 'n_option.selected', ' selected="selected"' );
    405       }
    406       $vtp->closeSession( $sub, 'n_option' );
    407     }
    408     $vtp->closeSession( $sub, 'params' );
    409 //---------------------------------------------------------- remaining pictures
    410     $vtp->addSession( $sub, 'remainings' );
    411     $pictures = get_images_without_thumbnail( $_GET['dir'] );
    412     $vtp->setVar( $sub, 'remainings.total', count( $pictures ) );
    413     foreach ( $pictures as $i => $picture ) {
    414       $vtp->addSession( $sub, 'remaining' );
    415       if ( $i % 2 == 1 )
    416       {
    417         $vtp->setVar( $sub, 'remaining.class', 'row2' );
    418       }
    419       $vtp->setVar( $sub, 'remaining.num',      ($i+1) );
    420       $vtp->setVar( $sub, 'remaining.file',     $picture['name'] );
    421       $vtp->setVar( $sub, 'remaining.filesize', $picture['size'] );
    422       $vtp->setVar( $sub, 'remaining.width',    $picture['width'] );
    423       $vtp->setVar( $sub, 'remaining.height',   $picture['height'] );
    424       $vtp->closeSession( $sub, 'remaining' );
    425     }
    426     $vtp->closeSession( $sub, 'remainings' );
    427   }
     382  $template->assign_block_vars('remainings',array('TOTAL_IMG'=>count( $pictures )));
     383
     384  foreach ( $pictures as $i => $picture )
     385  {
     386    $class = ($i % 2)? 'row1':'row2';
     387    $template->assign_block_vars('remainings.remaining',array(
     388          'NB_IMG'=>($i+1),
     389          'FILE_TN'=>$picture['name'],
     390          'FILESIZE_IMG'=>$picture['size'],
     391          'WIDTH_IMG'=>$picture['width'],
     392          'HEIGHT_IMG'=>$picture['height'],
     393         
     394          'T_CLASS'=>$class
     395          ));
     396    }
    428397}
    429398//-------------------------------------------------------------- directory list
    430399else
    431400{
    432   $vtp->addSession( $sub, 'directory_list' );
    433   get_displayed_dirs( './galleries', 60 );
    434   $vtp->closeSession( $sub, 'directory_list' );
    435 }
    436 //----------------------------------------------------------- sending html code
    437 $vtp->Parse( $handle , 'sub', $sub );
     401  $categories = get_displayed_dirs( './galleries', 60 );
     402  $template->assign_block_vars('directory_list',array('CATEGORY_LIST'=>$categories));
     403}
     404
     405$template->assign_var_from_handle('ADMIN_CONTENT', 'thumbnail');
    438406?>
  • trunk/admin/update.php

    r362 r393  
    2626// +-----------------------------------------------------------------------+
    2727
    28 include_once( './admin/include/isadmin.inc.php' );
     28include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
    2929//------------------------------------------------------------------- functions
    3030function insert_local_category( $id_uppercat )
     
    3636
    3737  // 0. retrieving informations on the category to display
    38   $cat_directory = './galleries';
     38  $cat_directory = PHPWG_ROOT_PATH.'galleries';
    3939  if ( is_numeric( $id_uppercat ) )
    4040  {
    41     $query = 'SELECT name,uppercats,dir';
    42     $query.= ' FROM '.PREFIX_TABLE.'categories';
     41    $query = 'SELECT name,uppercats,dir FROM '.CATEGORIES_TABLE;
    4342    $query.= ' WHERE id = '.$id_uppercat;
    4443    $query.= ';';
     
    5352
    5453    $database_dirs = array();
    55     $query = 'SELECT id,dir';
    56     $query.= ' FROM '.PREFIX_TABLE.'categories';
     54    $query = 'SELECT id,dir FROM '.CATEGORIES_TABLE;
    5755    $query.= ' WHERE id IN ('.$uppercats.')';
    5856    $query.= ';';
     
    6967
    7068    // 1. display the category name to update
    71     $src = './template/'.$user['template'].'/admin/images/puce.gif';
    72     $output = '<img src="'.$src.'" alt="&gt;" />';
    73     $output.= '<span style="font-weight:bold;">'.$name.'</span>';
     69    $output = '<ul class="menu">';
     70    $output.= '<li><strong>'.$name.'</strong>';
    7471    $output.= ' [ '.$dir.' ]';
    75     $output.= '<div class="retrait">';
     72    $output.= '</li>';
    7673
    7774    // 2. we search pictures of the category only if the update is for all
     
    8683
    8784  $sub_category_dirs = array();
    88   $query = 'SELECT id,dir';
    89   $query.= ' FROM '.PREFIX_TABLE.'categories';
     85  $query = 'SELECT id,dir FROM '.CATEGORIES_TABLE;
    9086  $query.= ' WHERE site_id = 1';
    9187  if (!is_numeric($id_uppercat)) $query.= ' AND id_uppercat IS NULL';
     
    135131  if ( count( $inserts ) > 0 )
    136132  {
    137     $query = 'INSERT INTO '.PREFIX_TABLE.'categories';
     133    $query = 'INSERT INTO '.CATEGORIES_TABLE;
    138134    $query.= ' (dir,name,site_id,id_uppercat,uppercats) VALUES ';
    139135    $query.= implode( ',', $inserts );
     
    141137    mysql_query( $query );
    142138    // updating uppercats field
    143     $query = 'UPDATE '.PREFIX_TABLE.'categories';
     139    $query = 'UPDATE '.CATEGORIES_TABLE;
    144140    $query.= ' SET uppercats = ';
    145141    if ( $uppercats != '' ) $query.= "CONCAT('".$uppercats."',',',id)";
     
    154150  // Recursive call on the sub-categories (not virtual ones)
    155151  $query = 'SELECT id';
    156   $query.= ' FROM '.PREFIX_TABLE.'categories';
     152  $query.= ' FROM '.CATEGORIES_TABLE;
    157153  $query.= ' WHERE site_id = 1';
    158154  if (!is_numeric($id_uppercat)) $query.= ' AND id_uppercat IS NULL';
     
    168164  if ( is_numeric( $id_uppercat ) )
    169165  {
    170     $output.= '</div>';
     166    $output.= '</ul>';
    171167  }
    172168  return $output;
     
    188184  //     - don't have the associated thumbnail available anymore
    189185  $query = 'SELECT id,file,tn_ext';
    190   $query.= ' FROM '.PREFIX_TABLE.'images';
     186  $query.= ' FROM '.IMAGES_TABLE;
    191187  $query.= ' WHERE storage_category_id = '.$category_id;
    192188  $query.= ';';
     
    218214
    219215  $registered_pictures = array();
    220   $query = 'SELECT file';
    221   $query.= ' FROM '.PREFIX_TABLE.'images';
     216  $query = 'SELECT file FROM '.IMAGES_TABLE;
    222217  $query.= ' WHERE storage_category_id = '.$category_id;
    223218  $query.= ';';
     
    234229 
    235230  $query = 'SELECT file,infos,validated';
    236   $query.= ' FROM '.PREFIX_TABLE.'waiting';
     231  $query.= ' FROM '.WAITING_TABLE;
    237232  $query.= ' WHERE storage_category_id = '.$category_id;
    238233  $query.= ';';
     
    294289
    295290          // deleting the waiting element
    296           $query = 'DELETE FROM '.PREFIX_TABLE.'waiting';
     291          $query = 'DELETE FROM '.WAITING_TABLE;
    297292          $query.= " WHERE file = '".$unregistered_picture."'";
    298293          $query.= ' AND storage_category_id = '.$category_id;
     
    337332  {
    338333    // inserts all found pictures
    339     $query = 'INSERT INTO '.PREFIX_TABLE.'images';
     334    $query = 'INSERT INTO '.IMAGES_TABLE;
    340335    $query.= ' (file,storage_category_id,date_available,tn_ext';
    341336    $query.= ',filesize,width,height';
     
    350345
    351346    $query = 'SELECT id';
    352     $query.= ' FROM '.PREFIX_TABLE.'images';
     347    $query.= ' FROM '.IMAGES_TABLE;
    353348    $query.= ' WHERE storage_category_id = '.$category_id;
    354349    $query.= ';';
     
    361356    // recreation of the links between this storage category pictures and
    362357    // its storage category
    363     $query = 'DELETE FROM '.PREFIX_TABLE.'image_category';
     358    $query = 'DELETE FROM '.IMAGE_CATEGORY_TABLE;
    364359    $query.= ' WHERE category_id = '.$category_id;
    365360    $query.= ' AND image_id IN ('.implode( ',', $ids ).')';
     
    367362    mysql_query( $query );
    368363
    369     $query = 'INSERT INTO '.PREFIX_TABLE.'image_category';
     364    $query = 'INSERT INTO '.IMAGE_CATEGORY_TABLE;
    370365    $query.= '(category_id,image_id) VALUES ';
    371366    foreach ( $ids as $num => $image_id ) {
     
    396391
    397392  // 2. is the site already existing ?
    398   $query = 'SELECT id';
    399   $query.= ' FROM '.PREFIX_TABLE.'sites';
     393  $query = 'SELECT id FROM '.SITES_TABLE;
    400394  $query.= " WHERE galleries_url = '".$url."'";
    401395  $query.= ';';
     
    404398  {
    405399    // we have to register this site in the database
    406     $query = 'INSERT INTO '.PREFIX_TABLE.'sites';
     400    $query = 'INSERT INTO '.SITES_TABLE;
    407401    $query.= " (galleries_url) VALUES ('".$url."')";
    408402    $query.= ';';
     
    438432  {
    439433    $query = 'SELECT name,uppercats,dir';
    440     $query.= ' FROM '.PREFIX_TABLE.'categories';
     434    $query.= ' FROM '.CATEGORIES_TABLE;
    441435    $query.= ' WHERE id = '.$id_uppercat;
    442436    $query.= ';';
     
    468462  // id_uppercat and site_id
    469463  $database_dirs = array();
    470   $query = 'SELECT id,dir';
    471   $query.= ' FROM '.PREFIX_TABLE.'categories';
     464  $query = 'SELECT id,dir FROM '.CATEGORIES_TABLE;
    472465  $query.= ' WHERE site_id = '.$site_id;
    473466  if (!is_numeric($id_uppercat)) $query.= ' AND id_uppercat IS NULL';
     
    509502  if ( count( $inserts ) > 0 )
    510503  {
    511     $query = 'INSERT INTO '.PREFIX_TABLE.'categories';
     504    $query = 'INSERT INTO '.CATEGORIES_TABLE;
    512505    $query.= ' (dir,name,site_id,id_uppercat,uppercats) VALUES ';
    513506    $query.= implode( ',', $inserts );
     
    515508    mysql_query( $query );
    516509    // updating uppercats field
    517     $query = 'UPDATE '.PREFIX_TABLE.'categories';
     510    $query = 'UPDATE '.CATEGORIES_TABLE;
    518511    $query.= ' SET uppercats = ';
    519512    if ( $uppercats != '' ) $query.= "CONCAT('".$uppercats."',',',id)";
     
    528521  // Recursive call on the sub-categories (not virtual ones)
    529522  $query = 'SELECT id,dir';
    530   $query.= ' FROM '.PREFIX_TABLE.'categories';
     523  $query.= ' FROM '.CATEGORIES_TABLE;
    531524  $query.= ' WHERE site_id = '.$site_id;
    532525  if (!is_numeric($id_uppercat)) $query.= ' AND id_uppercat IS NULL';
     
    568561  // we have to delete all the images from the database that are not in the
    569562  // directory anymore (not in the XML anymore)
    570   $query = 'SELECT id,file';
    571   $query.= ' FROM '.PREFIX_TABLE.'images';
     563  $query = 'SELECT id,file FROM '.IMAGES_TABLE;
    572564  $query.= ' WHERE storage_category_id = '.$category_id;
    573565  $query.= ';';
     
    585577
    586578  $database_pictures = array();
    587   $query = 'SELECT file';
    588   $query.= ' FROM '.PREFIX_TABLE.'images';
     579  $query = 'SELECT file FROM '.IMAGES_TABLE;
    589580  $query.= ' WHERE storage_category_id = '.$category_id;
    590581  $query.= ';';
     
    631622  {
    632623    // inserts all found pictures
    633     $query = 'INSERT INTO '.PREFIX_TABLE.'images';
     624    $query = 'INSERT INTO '.IMAGES_TABLE;
    634625    $query.= ' (file,storage_category_id,date_available,tn_ext';
    635626    $query.= ',filesize,width,height)';
     
    642633    $ids = array();
    643634
    644     $query = 'SELECT id';
    645     $query.= ' FROM '.PREFIX_TABLE.'images';
     635    $query = 'SELECT id FROM '.IMAGES_TABLE;
    646636    $query.= ' WHERE storage_category_id = '.$category_id;
    647637    $query.= ';';
     
    654644    // recreation of the links between this storage category pictures and
    655645    // its storage category
    656     $query = 'DELETE FROM '.PREFIX_TABLE.'image_category';
     646    $query = 'DELETE FROM '.IMAGE_CATEGORY_TABLE;
    657647    $query.= ' WHERE category_id = '.$category_id;
    658648    $query.= ' AND image_id IN ('.implode( ',', $ids ).')';
     
    660650    mysql_query( $query );
    661651
    662     $query = 'INSERT INTO '.PREFIX_TABLE.'image_category';
     652    $query = 'INSERT INTO '.IMAGE_CATEGORY_TABLE;
    663653    $query.= '(category_id,image_id) VALUES ';
    664654    foreach ( $ids as $num => $image_id ) {
     
    672662  return $output;
    673663}
     664
    674665//----------------------------------------------------- template initialization
    675 $sub = $vtp->Open( './template/'.$user['template'].'/admin/update.vtp' );
    676 $tpl = array( 'update_default_title', 'update_only_cat', 'update_all',
    677               'update_research_conclusion', 'update_deletion_conclusion',
    678               'remote_site', 'update_part_research' );
    679 templatize_array( $tpl, 'lang', $sub );
    680 $vtp->setGlobalVar( $sub, 'user_template', $user['template'] );
     666$template->set_filenames( array('update'=>'admin/update.tpl') );
     667
     668$template->assign_vars(array(
     669  'L_UPDATE_TITLE'=>$lang['update_default_title'],
     670  'L_CAT_UPDATE'=>$lang['update_only_cat'],
     671  'L_ALL_UPDATE'=>$lang['update_all'],
     672  'L_RESULT_UPDATE'=>$lang['update_part_research'],
     673  'L_NEW_CATEGORY'=>$lang['update_research_conclusion'],
     674  'L_DEL_CATEGORY'=>$lang['update_deletion_conclusion'],
     675 
     676  'U_CAT_UPDATE'=>add_session_id( PHPWG_ROOT_PATH.'admin.php?page=update&amp;update=cats' ),
     677  'U_ALL_UPDATE'=>add_session_id( PHPWG_ROOT_PATH.'admin.php?page=update&amp;update=all' )
     678  ));
     679 
     680$tpl = array('remote_site');
    681681//-------------------------------------------- introduction : choices of update
    682682// Display choice if "update" var is not specified
    683683if (!isset( $_GET['update'] ))
    684684{
    685   $vtp->addSession( $sub, 'introduction' );
    686   // only update the categories, not the pictures.
    687   $url = add_session_id( './admin.php?page=update&amp;update=cats' );
    688   $vtp->setVar( $sub, 'introduction.only_cat:url', $url );
    689   // update the entire tree folder
    690   $url = add_session_id( './admin.php?page=update&amp;update=all' );
    691   $vtp->setVar( $sub, 'introduction.all:url', $url );
    692   $vtp->closeSession( $sub, 'introduction' );
     685 $template->assign_block_vars('introduction',array());
    693686}
    694687//-------------------------------------------------- local update : ./galleries
     
    699692  $count_new = 0;
    700693  $count_deleted = 0;
    701   $vtp->addSession( $sub, 'local_update' );
     694 
    702695  if ( isset( $page['cat'] ) )
    703696  {
     
    709702  }
    710703  $end = get_moment();
    711   echo get_elapsed_time( $start, $end ).' for update <br />';
    712   $vtp->setVar( $sub, 'local_update.categories', $categories );
    713   $vtp->setVar( $sub, 'local_update.count_new', $count_new );
    714   $vtp->setVar( $sub, 'local_update.count_deleted', $count_deleted );
    715   $vtp->closeSession( $sub, 'local_update' );
     704  //echo get_elapsed_time( $start, $end ).' for update <br />';
     705  $template->assign_block_vars('update',array(
     706    'CATEGORIES'=>$categories,
     707        'NEW_CAT'=>$count_new,
     708        'DEL_CAT'=>$count_deleted
     709    ));
    716710}
    717711//------------------------------------------------- remote update : listing.xml
     
    735729if ( isset( $_GET['update'] )
    736730     or isset( $page['cat'] )
    737      or @is_file( './listing.xml' ) )
     731     or @is_file( './listing.xml' ) && DEBUG)
    738732{
    739733  $start = get_moment();
     
    748742}
    749743//----------------------------------------------------------- sending html code
    750 $vtp->Parse( $handle , 'sub', $sub );
     744$template->assign_var_from_handle('ADMIN_CONTENT', 'update');
    751745?>
  • trunk/admin/user_list.php

    r364 r393  
    2525// | USA.                                                                  |
    2626// +-----------------------------------------------------------------------+
    27 include_once( './admin/include/isadmin.inc.php' );
     27include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
     28
     29
     30
    2831//----------------------------------------------------- template initialization
    2932$sub = $vtp->Open( './template/'.$user['template'].'/admin/user_list.vtp' );
  • trunk/admin/user_perm.php

    r362 r393  
    2525// | USA.                                                                  |
    2626// +-----------------------------------------------------------------------+
    27 include_once( './admin/include/isadmin.inc.php' );
     27
     28if( !defined("IN_ADMIN") )
     29{
     30  die ("Hacking attempt!");
     31}
     32
     33include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
     34
     35//
     36// Username search
     37//
     38function username_search($search_match)
     39{
     40  global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $phpbb_root_path;
     41  global $starttime, $gen_simple_header;
     42 
     43  $gen_simple_header = TRUE;
     44
     45  $username_list = '';
     46  if ( !empty($search_match) )
     47  {
     48    $username_search = preg_replace('/\*/', '%', trim(strip_tags($search_match)));
     49
     50    $sql = "SELECT username
     51      FROM " . USERS_TABLE . "
     52      WHERE username LIKE '" . str_replace("\'", "''", $username_search) . "'
     53      ORDER BY username";
     54    if ( !($result = $db->sql_query($sql)) )
     55    {
     56      message_die(GENERAL_ERROR, 'Could not obtain search results', '', __LINE__, __FILE__, $sql);
     57    }
     58
     59    if ( $row = $db->sql_fetchrow($result) )
     60    {
     61      do
     62      {
     63        $username_list .= '<option value="' . $row['username'] . '">' . $row['username'] . '</option>';
     64      }
     65      while ( $row = $db->sql_fetchrow($result) );
     66    }
     67    else
     68    {
     69      $username_list .= '<option>' . $lang['No_match']. '</option>';
     70    }
     71    $db->sql_freeresult($result);
     72  }
     73
     74  $page_title = $lang['Search'];
     75  include($phpbb_root_path . 'includes/page_header.'.$phpEx);
     76
     77  $template->set_filenames(array(
     78    'search_user_body' => 'search_username.tpl')
     79  );
     80
     81  $template->assign_vars(array(
     82    'USERNAME' => ( !empty($search_match) ) ? strip_tags($search_match) : '',
     83
     84    'L_CLOSE_WINDOW' => $lang['Close_window'],
     85    'L_SEARCH_USERNAME' => $lang['Find_username'],
     86    'L_UPDATE_USERNAME' => $lang['Select_username'],
     87    'L_SELECT' => $lang['Select'],
     88    'L_SEARCH' => $lang['Search'],
     89    'L_SEARCH_EXPLAIN' => $lang['Search_author_explain'],
     90    'L_CLOSE_WINDOW' => $lang['Close_window'],
     91
     92    'S_USERNAME_OPTIONS' => $username_list,
     93    'S_SEARCH_ACTION' => append_sid("search.$phpEx?mode=searchuser"))
     94  );
     95
     96  if ( $username_list != '' )
     97  {
     98    $template->assign_block_vars('switch_select_name', array());
     99  }
     100
     101  $template->pparse('search_user_body');
     102
     103  include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
     104
     105  return;
     106}
     107
     108if  (isset($HTTP_POST_VARS['username']) || isset( $_POST['submit'] ))
     109{
    28110//----------------------------------------------------- template initialization
    29 $sub = $vtp->Open( './template/'.$user['template'].'/admin/user_perm.vtp' );
     111$template->set_filenames( array('user'=>'admin/user_perm.tpl') );
     112
    30113$error = array();
    31114$tpl = array( 'permuser_authorized','permuser_forbidden','submit',
    32115              'permuser_parent_forbidden','permuser_info_message',
    33116              'adduser_info_back','permuser_only_private' );
    34 templatize_array( $tpl, 'lang', $sub );
    35 $vtp->setGlobalVar( $sub, 'user_template', $user['template'] );
    36117//--------------------------------------------------------------------- updates
    37118if ( isset( $_POST['submit'] ) )
     
    68149}
    69150//---------------------------------------------------------------- form display
     151
    70152$restrictions = get_user_restrictions( $_GET['user_id'], $page['user_status'],
    71153                                  false, false );
     
    184266  $vtp->closeSession( $sub, 'category' );
    185267}
     268//----------------------------------------------------------- default code
     269else
     270{
     271$sub = $vtp->Open( '../template/'.$user['template'].'/admin/user_select_body.vtp' );
     272$tpl = array( 'Look_up_user', 'Find_username', 'Select_username' );
     273templatize_array( $tpl, 'lang', $sub );
     274  $vtp->addSession( $sub, 'user' );
     275  $vtp->setVarTab( $sub, array(
     276      'user.S_USER_ACTION' => append_sid("./admin.php?page=user_search"),
     277    'user.U_SEARCH_USER' => append_sid("./search.php"))
     278    );
     279  $vtp->closeSession( $sub, 'user' );
     280}
    186281//----------------------------------------------------------- sending html code
    187282$vtp->Parse( $handle , 'sub', $sub );
Note: See TracChangeset for help on using the changeset viewer.