aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorgweltas <gweltas@piwigo.org>2004-03-20 00:52:37 +0000
committergweltas <gweltas@piwigo.org>2004-03-20 00:52:37 +0000
commit4128835db8d7b8e619951d4c31e23bd934758f09 (patch)
tree4fddd9ea03f3ebeeaba73c3a42f7130e29a54b58 /admin
parent8850aabc34e524e1a7816c363657e3176502a708 (diff)
- Template migration
- Admin Control Panel migration - Language migration git-svn-id: http://piwigo.org/svn/trunk@393 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin')
-rw-r--r--admin/configuration.php940
-rw-r--r--admin/help.php28
-rw-r--r--admin/include/functions.php23
-rw-r--r--admin/include/isadmin.inc.php2
-rw-r--r--admin/search.php107
-rw-r--r--admin/thumbnail.php348
-rw-r--r--admin/update.php124
-rw-r--r--admin/user_list.php5
-rw-r--r--admin/user_perm.php103
-rw-r--r--admin/user_search.php125
10 files changed, 708 insertions, 1097 deletions
diff --git a/admin/configuration.php b/admin/configuration.php
index e7392f741..ba77a72f7 100644
--- a/admin/configuration.php
+++ b/admin/configuration.php
@@ -25,7 +25,12 @@
// | USA. |
// +-----------------------------------------------------------------------+
-include_once( './admin/include/isadmin.inc.php' );
+if( !defined("PHPWG_ROOT_PATH") )
+{
+ die ("Hacking attempt!");
+}
+
+include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
$Caracs = array("¥" => "Y", "µ" => "u", "À" => "A", "Á" => "A",
"Â" => "A", "Ã" => "A", "Ä" => "A", "Å" => "A",
@@ -44,35 +49,14 @@ $Caracs = array("¥" => "Y", "µ" => "u", "À" => "A", "Á" => "A",
"ù" => "u", "ú" => "u", "û" => "u", "ü" => "u",
"ý" => "y", "ÿ" => "y");
//------------------------------ verification and registration of modifications
-$conf_infos = array();
-$query = 'SELECT param';
-$query.= ' FROM '.CONFIG_TABLE;
-$query.= ';';
-$result = mysql_query( $query );
-while ( $row = mysql_fetch_array( $result ) )
-{
- array_push( $conf_infos, $row['param'] );
-}
-
-$default_user_infos =
-array( 'nb_image_line','nb_line_page','language','maxwidth',
- 'maxheight','expand','show_nb_comments','short_period','long_period',
- 'template' );
$error = array();
if ( isset( $_POST['submit'] ) )
{
$int_pattern = '/^\d+$/';
- // empty session table if asked
- if ( $_POST['empty_session_table'] == 1 )
- {
- $query = 'DELETE FROM '.PREFIX_TABLE.'sessions';
- $query.= ' WHERE expiration < '.time().';';
- mysql_query( $query );
- }
// deletion of site as asked
$site_deleted = false;
$query = 'SELECT id';
- $query.= ' FROM '.PREFIX_TABLE.'sites';
+ $query.= ' FROM '.SITES_TABLE;
$query.= " WHERE galleries_url <> './galleries/';";
$result = mysql_query( $query );
while ( $row = mysql_fetch_array( $result ) )
@@ -134,13 +118,6 @@ if ( isset( $_POST['submit'] ) )
{
array_push( $error, $lang['conf_err_sid_time'] );
}
- // max_user_listbox must be an integer between 0 and 255 included
- if ( !preg_match( $int_pattern, $_POST['max_user_listbox'] )
- or $_POST['max_user_listbox'] < 0
- or $_POST['max_user_listbox'] > 255 )
- {
- array_push( $error, $lang['conf_err_max_user_listbox'] );
- }
// the number of comments per page must be an integer between 5 and 50
// included
if ( !preg_match( $int_pattern, $_POST['nb_comment_page'] )
@@ -185,7 +162,7 @@ if ( isset( $_POST['submit'] ) )
array_push( $error, $lang['conf_err_upload_maxheight_thumbnail'] );
}
- if ( $_POST['maxwidth'] != ''
+/* if ( $_POST['maxwidth'] != ''
and ( !preg_match( $int_pattern, $_POST['maxwidth'] )
or $_POST['maxwidth'] < 50 ) )
{
@@ -196,805 +173,158 @@ if ( isset( $_POST['submit'] ) )
or $_POST['maxheight'] < 50 ) )
{
array_push( $error, $lang['err_maxheight'] );
- }
+ }*/
// updating configuraiton if no error found
if ( count( $error ) == 0 )
{
- foreach ( $conf_infos as $conf_info ) {
- if ( isset( $_POST[$conf_info] ) )
+ $result = mysql_query( "SELECT * FROM ".CONFIG_TABLE );
+ while ( $row = mysql_fetch_array( $result ) )
+ {
+ $config_name = $row['param'];
+ $conf[$config_name] = ( isset($_POST[$config_name]) ) ? $_POST[$config_name] : $row['value'];
+ if ( isset( $_POST[$config_name] ) )
{
$query = 'UPDATE '.CONFIG_TABLE;
- $query.= ' SET value = ';
- if ( $_POST[$conf_info] == '' )
- {
- $query.= 'NULL';
- }
- else
- {
- $query.= "'".$_POST[$conf_info]."'";
- }
- $query.= " WHERE param = '".$conf_info."'";
- $query.= ';';
+ $query.= " SET value = '". str_replace("\'", "''", $conf[$config_name]) ;
+ $query.= "' WHERE param = '$config_name'";
mysql_query( $query );
}
}
-
- $query = 'UPDATE '.USERS_TABLE;
- $query.= ' SET';
- foreach ( $default_user_infos as $i => $default_user_info ) {
- if ( $i > 0 ) $query.= ',';
- else $query.= ' ';
- $query.= $default_user_info;
- $query.= ' = ';
- if ( $_POST[$default_user_info] == '' )
- {
- $query.= 'NULL';
- }
- else
- {
- $query.= "'".$_POST[$default_user_info]."'";
- }
- }
- $query.= " WHERE username = 'guest'";
- $query.= ';';
- mysql_query( $query );
- }
-//--------------------------------------------------------- data initialization
- foreach ( $conf_infos as $conf_info ) {
- $$conf_info = $_POST[$conf_info];
- }
- foreach ( $default_user_infos as $default_user_info ) {
- $$default_user_info = $_POST[$default_user_info];
}
}
-else
-{
-//--------------------------------------------------------- data initialization
- $query = 'SELECT param,value';
- $query.= ' FROM '.CONFIG_TABLE;
- $query.= ';';
- $result = mysql_query( $query );
- while ( $row =mysql_fetch_array( $result ) )
- {
- if ( isset( $row['value'] ) )
- {
- $$row['param'] = $row['value'];
- }
- else
- {
- $$row['param'] = '';
- }
- }
- $query = 'SELECT '.implode( ',', $default_user_infos );
- $query.= ' FROM '.USERS_TABLE;
- $query.= " WHERE username = 'guest'";
- $query.= ';';
- $row = mysql_fetch_array( mysql_query( $query ) );
- foreach ( $default_user_infos as $info ) {
- if ( isset( $row[$info] ) ) $$info = $row[$info];
- else $$info = '';
- }
-}
+$access = ($conf['access']=='free')?'ACCESS_FREE':'ACCESS_RESTRICTED';
+$log = ($conf['log']=='true')?'HISTORY_YES':'HISTORY_NO';
+$mail_notif = ($conf['mail_notification']=='true')?'MAIL_NOTIFICATION_YES':'MAIL_NOTIFICATION_NO';
+$show_comments = ($conf['show_comments']=='true')?'SHOW_COMMENTS_YES':'SHOW_COMMENTS_NO';
+$comments_all = ($conf['comments_forall']=='true')?'COMMENTS_ALL_YES':'COMMENTS_ALL_NO';
+$comments_validation = ($conf['comments_validation']=='true')?'VALIDATE_COMMENTS_YES':'VALIDATE_COMMENTS_NO';
+$expand = ($conf['auto_expand']=='true')?'EXPAND_TREE_YES':'EXPAND_TREE_NO';
+$nb_comments = ($conf['show_nb_comments']=='true')?'NB_COMMENTS_YES':'NB_COMMENTS_NO';
+$upload = ($conf['upload_available']=='true')?'UPLOAD_YES':'UPLOAD_NO';
+$cookie = ($conf['authorize_cookies']=='true')?'COOKIE_YES':'COOKIE_NO';
+
//----------------------------------------------------- template initialization
-$sub = $vtp->Open(
- './template/'.$user['template'].'/admin/configuration.vtp' );
+$template->set_filenames( array('config'=>'admin/configuration.tpl') );
+
+$template->assign_vars(array(
+ 'ADMIN_NAME'=>$conf['webmaster'],
+ 'ADMIN_MAIL'=>$conf['mail_webmaster'],
+ 'THUMBNAIL_PREFIX'=>$conf['prefix_thumbnail'],
+ 'NB_COMMENTS_PAGE'=>$conf['nb_comment_page'],
+ 'LANG_SELECT'=>language_select($conf['default_lang'], 'default_lang'),
+ 'NB_IMAGE_LINE'=>$conf['nb_image_line'],
+ 'NB_ROW_PAGE'=>$conf['nb_line_page'],
+ 'STYLE_SELECT'=>style_select($conf['default_style'], 'default_style'),
+ 'SHORT_PERIOD'=>$conf['short_period'],
+ 'LONG_PERIOD'=>$conf['long_period'],
+ 'UPLOAD_MAXSIZE'=>$conf['upload_maxfilesize'],
+ 'UPLOAD_MAXWIDTH'=>$conf['upload_maxwidth'],
+ 'UPLOAD_MAXHEIGHT'=>$conf['upload_maxheight'],
+ 'TN_UPLOAD_MAXWIDTH'=>$conf['upload_maxwidth_thumbnail'],
+ 'TN_UPLOAD_MAXHEIGHT'=>$conf['upload_maxheight_thumbnail'],
+ 'SESSION_LENGTH'=>$conf['session_time'],
+ 'SESSION_ID_SIZE'=>$conf['session_id_size'],
+
+ $access=>'checked="checked"',
+ $log=>'checked="checked"',
+ $mail_notif=>'checked="checked"',
+ $show_comments=>'checked="checked"',
+ $comments_all=>'checked="checked"',
+ $comments_validation=>'checked="checked"',
+ $expand=>'checked="checked"',
+ $nb_comments=>'checked="checked"',
+ $upload=>'checked="checked"',
+ $cookie=>'checked="checked"',
+
+ 'L_CONFIRM'=>$lang['conf_confirmation'],
+ 'L_CONF_GENERAL'=>$lang['conf_general_title'],
+ 'L_ADMIN_NAME'=>$lang['conf_general_webmaster'],
+ 'L_ADMIN_NAME_INFO'=>$lang['conf_general_webmaster_info'],
+ 'L_ADMIN_MAIL'=>$lang['conf_general_mail'],
+ 'L_ADMIN_MAIL_INFO'=>$lang['conf_general_mail_info'],
+ 'L_THUMBNAIL_PREFIX'=>$lang['conf_general_prefix'],
+ 'L_THUMBNAIL_PREFIX_INFO'=>$lang['conf_general_prefix_info'],
+ 'L_ACCESS'=>$lang['conf_general_access'],
+ 'L_ACCESS_INFO'=>$lang['conf_general_access_info'],
+ 'L_ACCESS_FREE'=>$lang['conf_general_access_1'],
+ 'L_ACCESS_RESTRICTED'=>$lang['conf_general_access_2'],
+ 'L_HISTORY'=>$lang['conf_general_log'],
+ 'L_HISTORY_INFO'=>$lang['conf_general_log_info'],
+ 'L_MAIL_NOTIFICATION'=>$lang['conf_general_mail_notification'],
+ 'L_MAIL_NOTIFICATION_INFO'=>$lang['conf_general_mail_notification_info'],
+ 'L_CONF_COMMENTS'=>$lang['conf_comments_title'],
+ 'L_SHOW_COMMENTS'=>$lang['conf_comments_show_comments'],
+ 'L_SHOW_COMMENTS_INFO'=>$lang['conf_comments_show_comments_info'],
+ 'L_COMMENTS_ALL'=>$lang['conf_comments_forall'],
+ 'L_COMMENTS_ALL_INFO'=>$lang['conf_comments_forall_info'],
+ 'L_NB_COMMENTS_PAGE'=>$lang['conf_comments_comments_number'],
+ 'L_NB_COMMENTS_PAGE_INFO'=>$lang['conf_comments_comments_number_info'],
+ 'L_VALIDATE_COMMENTS'=>$lang['conf_comments_validation'],
+ 'L_VALIDATE_COMMENTS_INFO'=>$lang['conf_comments_validation_info'],
+ 'L_ABILITIES_SETTINGS'=>$lang['conf_default_title'],
+ 'L_LANG_SELECT'=>$lang['customize_language'],
+ 'L_LANG_SELECT_INFO'=>$lang['conf_default_language_info'],
+ 'L_NB_IMAGE_LINE'=>$lang['customize_nb_image_per_row'],
+ 'L_NB_IMAGE_LINE_INFO'=>$lang['conf_default_nb_image_per_row_info'],
+ 'L_NB_ROW_PAGE'=>$lang['customize_nb_row_per_page'],
+ 'L_NB_ROW_PAGE_INFO'=>$lang['conf_default_nb_row_per_page_info'],
+ 'L_STYLE_SELECT'=>$lang['customize_theme'],
+ 'L_STYLE_SELECT_INFO'=>$lang['conf_default_theme_info'],
+ 'L_SHORT_PERIOD'=>$lang['customize_short_period'],
+ 'L_SHORT_PERIOD_INFO'=>$lang['conf_default_short_period_info'],
+ 'L_LONG_PERIOD'=>$lang['customize_long_period'],
+ 'L_LONG_PERIOD_INFO'=>$lang['conf_default_long_period_info'],
+ 'L_EXPAND_TREE'=>$lang['customize_expand'],
+ 'L_EXPAND_TREE_INFO'=>$lang['conf_default_expand_info'],
+ 'L_NB_COMMENTS'=>$lang['customize_show_nb_comments'],
+ 'L_NB_COMMENTS_INFO'=>$lang['conf_default_show_nb_comments_info'],
+ 'L_UPLOAD'=>$lang['conf_upload_available'],
+ 'L_UPLOAD_INFO'=>$lang['conf_upload_available_info'],
+ 'L_CONF_UPLOAD'=>$lang['conf_upload_title'],
+ 'L_UPLOAD_MAXSIZE'=>$lang['conf_upload_maxfilesize'],
+ 'L_UPLOAD_MAXSIZE_INFO'=>$lang['conf_upload_maxfilesize_info'],
+ 'L_UPLOAD_MAXWIDTH'=>$lang['conf_upload_maxwidth'],
+ 'L_UPLOAD_MAXWIDTH_INFO'=>$lang['conf_upload_maxwidth_info'],
+ 'L_UPLOAD_MAXHEIGHT'=>$lang['conf_upload_maxheight'],
+ 'L_UPLOAD_MAXHEIGHT_INFO'=>$lang['conf_upload_maxheight_info'],
+ 'L_TN_UPLOAD_MAXWIDTH'=>$lang['conf_upload_maxwidth_thumbnail'],
+ 'L_TN_UPLOAD_MAXWIDTH_INFO'=>$lang['conf_upload_maxwidth_thumbnail_info'],
+ 'L_TN_UPLOAD_MAXHEIGHT'=>$lang['conf_upload_maxheight_thumbnail'],
+ 'L_TN_UPLOAD_MAXHEIGHT_INFO'=>$lang['conf_upload_maxheight_thumbnail'],
+ 'L_CONF_SESSION'=>$lang['conf_session_title'],
+ 'L_COOKIE'=>$lang['conf_session_cookie'],
+ 'L_COOKIE_INFO'=>$lang['conf_session_cookie_info'],
+ 'L_SESSION_LENGTH'=>$lang['conf_session_time'],
+ 'L_SESSION_LENGTH_INFO'=>$lang['conf_session_time_info'],
+ 'L_SESSION_ID_SIZE'=>$lang['conf_session_size'],
+ 'L_SESSION_ID_SIZE_INFO'=>$lang['conf_session_size_info'],
+ 'L_YES'=>$lang['yes'],
+ 'L_NO'=>$lang['no'],
+ 'L_SUBMIT'=>$lang['submit'],
+
+ 'F_ACTION'=>add_session_id(PHPWG_ROOT_PATH.'admin.php?page=configuration')
+ ));
$tpl = array( 'conf_confirmation','remote_site','delete',
'conf_remote_site_delete_info','submit','errors_title' );
-templatize_array( $tpl, 'lang', $sub );
+
//-------------------------------------------------------------- errors display
if ( sizeof( $error ) != 0 )
{
- $vtp->addSession( $sub, 'errors' );
+ $template->assign_block_vars('errors',array());
for ( $i = 0; $i < sizeof( $error ); $i++ )
{
- $vtp->addSession( $sub, 'li' );
- $vtp->setVar( $sub, 'li.li', $error[$i] );
- $vtp->closeSession( $sub, 'li' );
+ $template->assign_block_vars('errors.error',array('ERROR'=>$error[$i]));
}
- $vtp->closeSession( $sub, 'errors' );
}
-//-------------------------------------------------------- confirmation display
-if ( count( $error ) == 0 and isset( $_POST['submit'] ) )
+elseif ( isset( $_POST['submit'] ) )
{
- $vtp->addSession( $sub, 'confirmation' );
- $vtp->closeSession( $sub, 'confirmation' );
+ $template->assign_block_vars('confirmation' ,array());
}
-//----------------------------------------------------------------- form action
-$form_action = add_session_id( './admin.php?page=configuration' );
-$vtp->setVar( $sub, 'form_action', $form_action );
-//------------------------------------------------------- general configuration
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'title_line' );
-$vtp->setVar( $sub, 'title_line.title', $lang['conf_general_title'] );
-$vtp->closeSession( $sub, 'title_line' );
-$vtp->closeSession( $sub, 'line' );
-
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'space_line' );
-$vtp->closeSession( $sub, 'space_line' );
-$vtp->closeSession( $sub, 'line' );
-// webmaster name
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name', $lang['conf_general_webmaster'] );
-$vtp->addSession( $sub, 'hidden' );
-$vtp->setVar( $sub, 'hidden.text', $webmaster );
-$vtp->setVar( $sub, 'hidden.name', 'webmaster' );
-$vtp->setVar( $sub, 'hidden.value', $webmaster );
-$vtp->closeSession( $sub, 'hidden' );
-$vtp->setVar( $sub, 'param_line.def', $lang['conf_general_webmaster_info'] );
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-// webmaster mail address
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name', $lang['conf_general_mail'] );
-$vtp->addSession( $sub, 'text' );
-$vtp->setVar( $sub, 'text.name', 'mail_webmaster' );
-$vtp->setVar( $sub, 'text.value', $mail_webmaster );
-$vtp->closeSession( $sub, 'text' );
-$vtp->setVar( $sub, 'param_line.def', $lang['conf_general_mail_info'] );
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-// prefix for thumbnails
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name', $lang['conf_general_prefix'] );
-$vtp->addSession( $sub, 'text' );
-$vtp->setVar( $sub, 'text.name', 'prefix_thumbnail' );
-$vtp->setVar( $sub, 'text.value', $prefix_thumbnail );
-$vtp->closeSession( $sub, 'text' );
-$vtp->setVar( $sub, 'param_line.def', $lang['conf_general_prefix_info'] );
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-// access type
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name', $lang['conf_general_access'] );
-$vtp->addSession( $sub, 'group' );
-$vtp->addSession( $sub, 'radio' );
-$vtp->setVar( $sub, 'radio.name', 'access' );
-$vtp->setVar( $sub, 'radio.value', 'free' );
-$vtp->setVar( $sub, 'radio.option', $lang['conf_general_access_1'] );
-$checked = '';
-if ( $access == 'free' )
-{
- $checked = ' checked="checked"';
-}
-$vtp->setVar( $sub, 'radio.checked', $checked );
-$vtp->closeSession( $sub, 'radio' );
-$vtp->addSession( $sub, 'radio' );
-$vtp->setVar( $sub, 'radio.name', 'access' );
-$vtp->setVar( $sub, 'radio.value', 'restricted' );
-$vtp->setVar( $sub, 'radio.option', $lang['conf_general_access_2'] );
-$checked = '';
-if ( $access == 'restricted' )
-{
- $checked = ' checked="checked"';
-}
-$vtp->setVar( $sub, 'radio.checked', $checked );
-$vtp->closeSession( $sub, 'radio' );
-$vtp->closeSession( $sub, 'group' );
-$vtp->setVar( $sub, 'param_line.def', $lang['conf_general_access_info'] );
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-// maximum user number to display in the listbox of identification page
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name',
- $lang['conf_general_max_user_listbox'] );
-$vtp->addSession( $sub, 'text' );
-$vtp->setVar( $sub, 'text.name', 'max_user_listbox' );
-$vtp->setVar( $sub, 'text.value', $max_user_listbox );
-$vtp->closeSession( $sub, 'text' );
-$vtp->setVar( $sub, 'param_line.def',
- $lang['conf_general_max_user_listbox_info'] );
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-// activate log
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name', $lang['conf_general_log'] );
-$vtp->addSession( $sub, 'group' );
-$vtp->addSession( $sub, 'radio' );
-$vtp->setVar( $sub, 'radio.name', 'log' );
-$vtp->setVar( $sub, 'radio.value', 'true' );
-$vtp->setVar( $sub, 'radio.option', $lang['yes'] );
-$checked = '';
-if ( $log == 'true' )
-{
- $checked = ' checked="checked"';
-}
-$vtp->setVar( $sub, 'radio.checked', $checked );
-$vtp->closeSession( $sub, 'radio' );
-$vtp->addSession( $sub, 'radio' );
-$vtp->setVar( $sub, 'radio.name', 'log' );
-$vtp->setVar( $sub, 'radio.value', 'false' );
-$vtp->setVar( $sub, 'radio.option', $lang['no'] );
-$checked = '';
-if ( $log == 'false' )
-{
- $checked = ' checked="checked"';
-}
-$vtp->setVar( $sub, 'radio.checked', $checked );
-$vtp->closeSession( $sub, 'radio' );
-$vtp->closeSession( $sub, 'group' );
-$vtp->setVar( $sub, 'param_line.def',
- $lang['conf_general_log_info'] );
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-// mail notification for admins
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name',
- $lang['conf_general_mail_notification'] );
-$vtp->addSession( $sub, 'group' );
-$vtp->addSession( $sub, 'radio' );
-$vtp->setVar( $sub, 'radio.name', 'mail_notification' );
-$vtp->setVar( $sub, 'radio.value', 'true' );
-$vtp->setVar( $sub, 'radio.option', $lang['yes'] );
-$checked = '';
-if ( $mail_notification == 'true' )
-{
- $checked = ' checked="checked"';
-}
-$vtp->setVar( $sub, 'radio.checked', $checked );
-$vtp->closeSession( $sub, 'radio' );
-$vtp->addSession( $sub, 'radio' );
-$vtp->setVar( $sub, 'radio.name', 'mail_notification' );
-$vtp->setVar( $sub, 'radio.value', 'false' );
-$vtp->setVar( $sub, 'radio.option', $lang['no'] );
-$checked = '';
-if ( $mail_notification == 'false' )
-{
- $checked = ' checked="checked"';
-}
-$vtp->setVar( $sub, 'radio.checked', $checked );
-$vtp->closeSession( $sub, 'radio' );
-$vtp->closeSession( $sub, 'group' );
-$vtp->setVar( $sub, 'param_line.def',
- $lang['conf_general_mail_notification_info'] );
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'space_line' );
-$vtp->closeSession( $sub, 'space_line' );
-$vtp->closeSession( $sub, 'line' );
-//------------------------------------------------------ comments configuration
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'title_line' );
-$vtp->setVar( $sub, 'title_line.title', $lang['conf_comments_title'] );
-$vtp->closeSession( $sub, 'title_line' );
-$vtp->closeSession( $sub, 'line' );
-
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'space_line' );
-$vtp->closeSession( $sub, 'space_line' );
-$vtp->closeSession( $sub, 'line' );
-// show comments ?
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name', $lang['conf_comments_show_comments'] );
-$vtp->addSession( $sub, 'group' );
-$vtp->addSession( $sub, 'radio' );
-$vtp->setVar( $sub, 'radio.name', 'show_comments' );
-$vtp->setVar( $sub, 'radio.value', 'true' );
-$vtp->setVar( $sub, 'radio.option', $lang['yes'] );
-$checked = '';
-if ( $show_comments == 'true' )
-{
- $checked = ' checked="checked"';
-}
-$vtp->setVar( $sub, 'radio.checked', $checked );
-$vtp->closeSession( $sub, 'radio' );
-$vtp->addSession( $sub, 'radio' );
-$vtp->setVar( $sub, 'radio.name', 'show_comments' );
-$vtp->setVar( $sub, 'radio.value', 'false' );
-$vtp->setVar( $sub, 'radio.option', $lang['no'] );
-$checked = '';
-if ( $show_comments == 'false' )
-{
- $checked = ' checked="checked"';
-}
-$vtp->setVar( $sub, 'radio.checked', $checked );
-$vtp->closeSession( $sub, 'radio' );
-$vtp->closeSession( $sub, 'group' );
-$vtp->setVar( $sub, 'param_line.def',
- $lang['conf_comments_show_comments_info'] );
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-// coments for all ? true -> guests can post messages
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name', $lang['conf_comments_forall'] );
-$vtp->addSession( $sub, 'group' );
-$vtp->addSession( $sub, 'radio' );
-$vtp->setVar( $sub, 'radio.name', 'comments_forall' );
-$vtp->setVar( $sub, 'radio.value', 'true' );
-$vtp->setVar( $sub, 'radio.option', $lang['yes'] );
-$checked = '';
-if ( $comments_forall == 'true' )
-{
- $checked = ' checked="checked"';
-}
-$vtp->setVar( $sub, 'radio.checked', $checked );
-$vtp->closeSession( $sub, 'radio' );
-$vtp->addSession( $sub, 'radio' );
-$vtp->setVar( $sub, 'radio.name', 'comments_forall' );
-$vtp->setVar( $sub, 'radio.value', 'false' );
-$vtp->setVar( $sub, 'radio.option', $lang['no'] );
-$checked = '';
-if ( $comments_forall == 'false' )
-{
- $checked = ' checked="checked"';
-}
-$vtp->setVar( $sub, 'radio.checked', $checked );
-$vtp->closeSession( $sub, 'radio' );
-$vtp->closeSession( $sub, 'group' );
-$vtp->setVar( $sub, 'param_line.def',
- $lang['conf_comments_forall_info'] );
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-// number of comments per page
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name',
- $lang['conf_comments_comments_number'] );
-$vtp->addSession( $sub, 'text' );
-$vtp->setVar( $sub, 'text.name', 'nb_comment_page' );
-$vtp->setVar( $sub, 'text.value', $nb_comment_page );
-$vtp->closeSession( $sub, 'text' );
-$vtp->setVar( $sub, 'param_line.def',
- $lang['conf_comments_comments_number_info'] );
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-// coments validation
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name', $lang['conf_comments_validation'] );
-$vtp->addSession( $sub, 'group' );
-$vtp->addSession( $sub, 'radio' );
-$vtp->setVar( $sub, 'radio.name', 'comments_validation' );
-$vtp->setVar( $sub, 'radio.value', 'true' );
-$vtp->setVar( $sub, 'radio.option', $lang['yes'] );
-$checked = '';
-if ( $comments_validation == 'true' )
-{
- $checked = ' checked="checked"';
-}
-$vtp->setVar( $sub, 'radio.checked', $checked );
-$vtp->closeSession( $sub, 'radio' );
-$vtp->addSession( $sub, 'radio' );
-$vtp->setVar( $sub, 'radio.name', 'comments_validation' );
-$vtp->setVar( $sub, 'radio.value', 'false' );
-$vtp->setVar( $sub, 'radio.option', $lang['no'] );
-$checked = '';
-if ( $comments_validation == 'false' )
-{
- $checked = ' checked="checked"';
-}
-$vtp->setVar( $sub, 'radio.checked', $checked );
-$vtp->closeSession( $sub, 'radio' );
-$vtp->closeSession( $sub, 'group' );
-$vtp->setVar( $sub, 'param_line.def',
- $lang['conf_comments_validation_info'] );
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'space_line' );
-$vtp->closeSession( $sub, 'space_line' );
-$vtp->closeSession( $sub, 'line' );
-//-------------------------------------------------- default user configuration
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'title_line' );
-$vtp->setVar( $sub, 'title_line.title', $lang['conf_default_title'] );
-$vtp->closeSession( $sub, 'title_line' );
-$vtp->closeSession( $sub, 'line' );
-
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'space_line' );
-$vtp->closeSession( $sub, 'space_line' );
-$vtp->closeSession( $sub, 'line' );
-// default language
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name', $lang['customize_language'] );
-$vtp->addSession( $sub, 'select' );
-$vtp->setVar( $sub, 'select.name', 'language' );
-$option = get_languages( './language/' );
-for ( $i = 0; $i < sizeof( $option ); $i++ )
-{
- $vtp->addSession( $sub, 'option' );
- $vtp->setVar( $sub, 'option.option', $option[$i] );
- if ( $option[$i] == $language )
- {
- $vtp->setVar( $sub, 'option.selected', ' selected="selected"' );
- }
- $vtp->closeSession( $sub, 'option' );
-}
-$vtp->closeSession( $sub, 'select' );
-$vtp->setVar( $sub, 'param_line.def', $lang['conf_default_language_info'] );
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-// number of image per row
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name', $lang['customize_nb_image_per_row'] );
-$vtp->addSession( $sub, 'select' );
-$vtp->setVar( $sub, 'select.name', 'nb_image_line' );
-for ( $i = 0; $i < sizeof( $conf['nb_image_row'] ); $i++ )
-{
- $vtp->addSession( $sub, 'option' );
- $vtp->setVar( $sub, 'option.option', $conf['nb_image_row'][$i] );
- if ( $conf['nb_image_row'][$i] == $nb_image_line )
- {
- $vtp->setVar( $sub, 'option.selected', ' selected="selected"' );
- }
- $vtp->closeSession( $sub, 'option' );
-}
-$vtp->closeSession( $sub, 'select' );
-$vtp->setVar( $sub, 'param_line.def',
- $lang['conf_default_nb_image_per_row_info'] );
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-// number of row per page
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name', $lang['customize_nb_row_per_page'] );
-$vtp->addSession( $sub, 'select' );
-$vtp->setVar( $sub, 'select.name', 'nb_line_page' );
-for ( $i = 0; $i < sizeof( $conf['nb_row_page'] ); $i++ )
-{
- $vtp->addSession( $sub, 'option' );
- $vtp->setVar( $sub, 'option.option', $conf['nb_row_page'][$i] );
- if ( $conf['nb_row_page'][$i] == $nb_line_page )
- {
- $vtp->setVar( $sub, 'option.selected', ' selected="selected"' );
- }
- $vtp->closeSession( $sub, 'option' );
-}
-$vtp->closeSession( $sub, 'select' );
-$vtp->setVar( $sub, 'param_line.def',
- $lang['conf_default_nb_row_per_page_info'] );
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-// template
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name', $lang['customize_theme'] );
-$vtp->addSession( $sub, 'select' );
-$vtp->setVar( $sub, 'select.name', 'template' );
-$option = get_dirs( './template/' );
-
-for ( $i = 0; $i < sizeof( $option ); $i++ )
-{
- $vtp->addSession( $sub, 'option' );
- $vtp->setVar( $sub, 'option.option', $option[$i] );
- if ( $option[$i] == $template )
- {
- $vtp->setVar( $sub, 'option.selected', ' selected="selected"' );
- }
- $vtp->closeSession( $sub, 'option' );
-}
-$vtp->closeSession( $sub, 'select' );
-$vtp->setVar( $sub, 'param_line.def', $lang['conf_default_theme_info'] );
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-// short period time
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name', $lang['customize_short_period'] );
-$vtp->addSession( $sub, 'text' );
-$vtp->setVar( $sub, 'text.name', 'short_period' );
-$vtp->setVar( $sub, 'text.value', $short_period );
-$vtp->closeSession( $sub, 'text' );
-$vtp->setVar( $sub, 'param_line.def', $lang['conf_default_short_period_info']);
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-// long period time
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name', $lang['customize_long_period'] );
-$vtp->addSession( $sub, 'text' );
-$vtp->setVar( $sub, 'text.name', 'long_period' );
-$vtp->setVar( $sub, 'text.value', $long_period );
-$vtp->closeSession( $sub, 'text' );
-$vtp->setVar( $sub, 'param_line.def', $lang['conf_default_long_period_info'] );
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-// max displayed width
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name', $lang['maxwidth'] );
-$vtp->addSession( $sub, 'text' );
-$vtp->setVar( $sub, 'text.name', 'maxwidth' );
-$vtp->setVar( $sub, 'text.value', $maxwidth );
-$vtp->closeSession( $sub, 'text' );
-$vtp->setVar( $sub, 'param_line.def', $lang['conf_default_maxwidth_info'] );
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-// max displayed height
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name', $lang['maxheight'] );
-$vtp->addSession( $sub, 'text' );
-$vtp->setVar( $sub, 'text.name', 'maxheight' );
-$vtp->setVar( $sub, 'text.value', $maxheight );
-$vtp->closeSession( $sub, 'text' );
-$vtp->setVar( $sub, 'param_line.def', $lang['conf_default_maxheight_info'] );
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-// expand all categories ?
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name', $lang['customize_expand'] );
-$vtp->addSession( $sub, 'group' );
-$vtp->addSession( $sub, 'radio' );
-$vtp->setVar( $sub, 'radio.name', 'expand' );
-
-$vtp->setVar( $sub, 'radio.value', 'true' );
-$checked = '';
-if ( $expand == 'true' )
-{
- $checked = ' checked="checked"';
-}
-$vtp->setVar( $sub, 'radio.checked', $checked );
-$vtp->setVar( $sub, 'radio.option', $lang['yes'] );
-$vtp->closeSession( $sub, 'radio' );
-$vtp->addSession( $sub, 'radio' );
-$vtp->setVar( $sub, 'radio.name', 'expand' );
-$vtp->setVar( $sub, 'radio.value', 'false' );
-$checked = '';
-if ( $expand == 'false' )
-{
- $checked = ' checked="checked"';
-}
-$vtp->setVar( $sub, 'radio.checked', $checked );
-$vtp->setVar( $sub, 'radio.option', $lang['no'] );
-$vtp->closeSession( $sub, 'radio' );
-$vtp->closeSession( $sub, 'group' );
-$vtp->setVar( $sub, 'param_line.def', $lang['conf_default_expand_info'] );
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-// show number of comments on thumbnails page
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name', $lang['customize_show_nb_comments'] );
-$vtp->addSession( $sub, 'group' );
-$vtp->addSession( $sub, 'radio' );
-$vtp->setVar( $sub, 'radio.name', 'show_nb_comments' );
-$vtp->setVar( $sub, 'radio.value', 'true' );
-$checked = '';
-if ( $show_nb_comments == 'true' )
-{
- $checked = ' checked="checked"';
-}
-$vtp->setVar( $sub, 'radio.checked', $checked );
-$vtp->setVar( $sub, 'radio.option', $lang['yes'] );
-$vtp->closeSession( $sub, 'radio' );
-$vtp->addSession( $sub, 'radio' );
-$vtp->setVar( $sub, 'radio.name', 'show_nb_comments' );
-$vtp->setVar( $sub, 'radio.value', 'false' );
-$checked = '';
-if ( $show_nb_comments == 'false' )
-{
- $checked = ' checked="checked"';
-}
-$vtp->setVar( $sub, 'radio.checked', $checked );
-$vtp->setVar( $sub, 'radio.option', $lang['no'] );
-$vtp->closeSession( $sub, 'radio' );
-$vtp->closeSession( $sub, 'group' );
-$vtp->setVar( $sub, 'param_line.def', $lang['conf_default_show_nb_comments_info'] );
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'space_line' );
-$vtp->closeSession( $sub, 'space_line' );
-$vtp->closeSession( $sub, 'line' );
-//-------------------------------------------------------- upload configuration
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'title_line' );
-$vtp->setVar( $sub, 'title_line.title', $lang['conf_upload_title'] );
-$vtp->closeSession( $sub, 'title_line' );
-$vtp->closeSession( $sub, 'line' );
-
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'space_line' );
-$vtp->closeSession( $sub, 'space_line' );
-$vtp->closeSession( $sub, 'line' );
-// is upload available ?
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name', $lang['conf_upload_available'] );
-$vtp->addSession( $sub, 'group' );
-$vtp->addSession( $sub, 'radio' );
-$vtp->setVar( $sub, 'radio.name', 'upload_available' );
-$vtp->setVar( $sub, 'radio.value', 'true' );
-$checked = '';
-if ( $upload_available == 'true' )
-{
- $checked = ' checked="checked"';
-}
-$vtp->setVar( $sub, 'radio.checked', $checked );
-$vtp->setVar( $sub, 'radio.option', $lang['yes'] );
-$vtp->closeSession( $sub, 'radio' );
-$vtp->addSession( $sub, 'radio' );
-$vtp->setVar( $sub, 'radio.name', 'upload_available' );
-$vtp->setVar( $sub, 'radio.value', 'false' );
-$checked = '';
-if ( $upload_available == 'false' )
-{
- $checked = ' checked="checked"';
-}
-$vtp->setVar( $sub, 'radio.checked', $checked );
-$vtp->setVar( $sub, 'radio.option', $lang['no'] );
-$vtp->closeSession( $sub, 'radio' );
-$vtp->closeSession( $sub, 'group' );
-$vtp->setVar( $sub, 'param_line.def', $lang['conf_upload_available_info'] );
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-// max filesize uploadable
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name', $lang['conf_upload_maxfilesize'] );
-$vtp->addSession( $sub, 'text' );
-$vtp->setVar( $sub, 'text.name', 'upload_maxfilesize' );
-$vtp->setVar( $sub, 'text.value', $upload_maxfilesize );
-$vtp->closeSession( $sub, 'text' );
-$vtp->setVar( $sub, 'param_line.def', $lang['conf_upload_maxfilesize_info'] );
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-// maxwidth uploadable
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name', $lang['conf_upload_maxwidth'] );
-$vtp->addSession( $sub, 'text' );
-$vtp->setVar( $sub, 'text.name', 'upload_maxwidth' );
-$vtp->setVar( $sub, 'text.value', $upload_maxwidth );
-$vtp->closeSession( $sub, 'text' );
-$vtp->setVar( $sub, 'param_line.def', $lang['conf_upload_maxwidth_info'] );
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-// maxheight uploadable
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name', $lang['conf_upload_maxheight'] );
-$vtp->addSession( $sub, 'text' );
-$vtp->setVar( $sub, 'text.name', 'upload_maxheight' );
-$vtp->setVar( $sub, 'text.value', $upload_maxheight );
-$vtp->closeSession( $sub, 'text' );
-$vtp->setVar( $sub, 'param_line.def', $lang['conf_upload_maxheight_info'] );
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-// maxwidth for thumbnail
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name',$lang['conf_upload_maxwidth_thumbnail']);
-$vtp->addSession( $sub, 'text' );
-$vtp->setVar( $sub, 'text.name', 'upload_maxwidth_thumbnail' );
-$vtp->setVar( $sub, 'text.value', $upload_maxwidth_thumbnail );
-$vtp->closeSession( $sub, 'text' );
-$vtp->setVar($sub,'param_line.def',$lang['conf_upload_maxwidth_thumbnail_info']);
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-// maxheight for thumbnail
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub,'param_line.name',$lang['conf_upload_maxheight_thumbnail']);
-$vtp->addSession( $sub, 'text' );
-$vtp->setVar( $sub, 'text.name', 'upload_maxheight_thumbnail' );
-$vtp->setVar( $sub, 'text.value', $upload_maxheight_thumbnail );
-$vtp->closeSession( $sub, 'text' );
-$vtp->setVar( $sub, 'param_line.def', $lang['conf_upload_maxheight_thumbnail_info']);
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'space_line' );
-$vtp->closeSession( $sub, 'space_line' );
-$vtp->closeSession( $sub, 'line' );
-//------------------------------------------------------ sessions configuration
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'title_line' );
-$vtp->setVar( $sub, 'title_line.title', $lang['conf_session_title'] );
-$vtp->closeSession( $sub, 'title_line' );
-$vtp->closeSession( $sub, 'line' );
-
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'space_line' );
-$vtp->closeSession( $sub, 'space_line' );
-$vtp->closeSession( $sub, 'line' );
-// authorize cookies ?
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name', $lang['conf_session_cookie'] );
-$vtp->addSession( $sub, 'group' );
-$vtp->addSession( $sub, 'radio' );
-$vtp->setVar( $sub, 'radio.name', 'authorize_cookies' );
-$vtp->setVar( $sub, 'radio.value', 'true' );
-$checked = '';
-if ( $authorize_cookies == 'true' )
-{
- $checked = ' checked="checked"';
-}
-$vtp->setVar( $sub, 'radio.checked', $checked );
-$vtp->setVar( $sub, 'radio.option', $lang['yes'] );
-$vtp->closeSession( $sub, 'radio' );
-$vtp->addSession( $sub, 'radio' );
-$vtp->setVar( $sub, 'radio.name', 'authorize_cookies' );
-$vtp->setVar( $sub, 'radio.value', 'false' );
-$checked = '';
-if ( $authorize_cookies == 'false' )
-{
- $checked = ' checked="checked"';
-}
-$vtp->setVar( $sub, 'radio.checked', $checked );
-$vtp->setVar( $sub, 'radio.option', $lang['no'] );
-$vtp->closeSession( $sub, 'radio' );
-$vtp->closeSession( $sub, 'group' );
-$vtp->setVar( $sub, 'param_line.def', $lang['conf_session_cookie_info'] );
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-// session size
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name', $lang['conf_session_size'] );
-$vtp->addSession( $sub, 'text' );
-$vtp->setVar( $sub, 'text.name', 'session_id_size' );
-$vtp->setVar( $sub, 'text.value', $session_id_size );
-$vtp->closeSession( $sub, 'text' );
-$vtp->setVar( $sub, 'param_line.def', $lang['conf_session_size_info']);
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-// session length
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name', $lang['conf_session_time'] );
-$vtp->addSession( $sub, 'text' );
-$vtp->setVar( $sub, 'text.name', 'session_time' );
-$vtp->setVar( $sub, 'text.value', $session_time );
-$vtp->closeSession( $sub, 'text' );
-$vtp->setVar( $sub, 'param_line.def', $lang['conf_session_time_info']);
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-// session keyword
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name', $lang['conf_session_key'] );
-$vtp->addSession( $sub, 'text' );
-$vtp->setVar( $sub, 'text.name', 'session_keyword' );
-$vtp->setVar( $sub, 'text.value', $session_keyword );
-$vtp->closeSession( $sub, 'text' );
-$vtp->setVar( $sub, 'param_line.def', $lang['conf_session_key_info']);
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-// session deletion
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'param_line' );
-$vtp->setVar( $sub, 'param_line.name', $lang['conf_session_delete'] );
-$vtp->addSession( $sub, 'check' );
-$vtp->addSession( $sub, 'box' );
-$vtp->setVar( $sub, 'box.name', 'empty_session_table' );
-$vtp->setVar( $sub, 'box.value', '1' );
-$vtp->setVar( $sub, 'box.checked', ' checked="checked"' );
-$vtp->closeSession( $sub, 'box' );
-$vtp->closeSession( $sub, 'check' );
-$vtp->setVar( $sub, 'param_line.def', $lang['conf_session_delete_info'] );
-$vtp->closeSession( $sub, 'param_line' );
-$vtp->closeSession( $sub, 'line' );
-
-$vtp->addSession( $sub, 'line' );
-$vtp->addSession( $sub, 'space_line' );
-$vtp->closeSession( $sub, 'space_line' );
-$vtp->closeSession( $sub, 'line' );
//------------------------------------------------ remote sites administration
$query = 'select id,galleries_url';
-$query.= ' from '.PREFIX_TABLE.'sites';
+$query.= ' from '.SITES_TABLE;
$query.= " where galleries_url <> './galleries/';";
$result = mysql_query( $query );
if ( mysql_num_rows( $result ) > 0 )
@@ -1018,5 +348,5 @@ if ( mysql_num_rows( $result ) > 0 )
$vtp->closeSession( $sub, 'remote_sites' );
}
//----------------------------------------------------------- sending html code
-$vtp->Parse( $handle , 'sub', $sub );
+$template->assign_var_from_handle('ADMIN_CONTENT', 'config');
?>
diff --git a/admin/help.php b/admin/help.php
index 22669ce13..770d6d187 100644
--- a/admin/help.php
+++ b/admin/help.php
@@ -24,33 +24,25 @@
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
-include_once( './admin/include/isadmin.inc.php' );
+include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
//----------------------------------------------------- template initialization
-$sub = $vtp->Open( './template/'.$user['template'].'/admin/help.vtp' );
-$tpl = array( );
-templatize_array( $tpl, 'lang', $sub );
+$template->set_filenames( array('help'=>'admin/help.tpl') );
+
//----------------------------------------------------- help categories display
$categories = array( 'images','thumbnails','database','remote','upload',
'virtual','groups','access','infos' );
foreach ( $categories as $category ) {
- $vtp->addSession( $sub, 'cat' );
+ $template->assign_block_vars('cat', array('NAME'=>$lang['help_'.$category.'_title']));
if ( $category == 'images' )
{
- $vtp->addSession( $sub, 'illustration' );
- $vtp->setVar( $sub, 'illustration.pic_src', './admin/images/admin.png' );
- $vtp->setVar( $sub, 'illustration.pic_alt', '' );
- $vtp->setVar( $sub, 'illustration.caption', $lang['help_images_intro'] );
- $vtp->closeSession( $sub, 'illustration' );
+ $template->assign_block_vars('cat.illustration', array(
+ 'SRC_IMG'=>PHPWG_ROOT_PATH.'admin/images/admin.png',
+ 'CAPTION'=>$lang['help_images_intro']
+ ));
}
- $vtp->setVar( $sub, 'cat.name', $lang['help_'.$category.'_title'] );
foreach ( $lang['help_'.$category] as $item ) {
- $vtp->addSession( $sub, 'item' );
- $vtp->setVar( $sub, 'item.content', $item );
- $vtp->closeSession( $sub, 'item' );
+ $template->assign_block_vars('cat.item', array('CONTENT'=>$item));
}
-
- $vtp->closeSession( $sub, 'cat' );
}
-//----------------------------------------------------------- sending html code
-$vtp->Parse( $handle , 'sub', $sub );
+$template->assign_var_from_handle('ADMIN_CONTENT', 'help');
?>
diff --git a/admin/include/functions.php b/admin/include/functions.php
index bb22b50ac..6a690ae4f 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -667,7 +667,7 @@ function update_user_category( $categories )
$restrictions ) );
$query = 'SELECT MAX(date_last) AS last_date';
- $query.= ' FROM '.PREFIX_TABLE.'categories';
+ $query.= ' FROM '.CATEGORIES_TABLE;
$query.= ' WHERE id IN ('.$category['id'];
if ( count( $user_all_subcats ) > 0 )
$query.= ','.implode( ',', $user_all_subcats );
@@ -735,8 +735,7 @@ function get_user_restrictions( $user_id, $user_status,
$check_invisible, $use_groups = true )
{
// 1. retrieving ids of private categories
- $query = 'SELECT id';
- $query.= ' FROM '.PREFIX_TABLE.'categories';
+ $query = 'SELECT id FROM '.CATEGORIES_TABLE;
$query.= " WHERE status = 'private'";
$query.= ';';
$result = mysql_query( $query );
@@ -749,8 +748,7 @@ function get_user_restrictions( $user_id, $user_status,
$authorized = array();
// 2.1. retrieving authorized categories thanks to personnal user
// authorization
- $query = 'SELECT cat_id';
- $query.= ' FROM '.PREFIX_TABLE.'user_access';
+ $query = 'SELECT cat_id FROM '.USER_ACCESS_TABLE;
$query.= ' WHERE user_id = '.$user_id;
$query.= ';';
$result = mysql_query( $query );
@@ -763,8 +761,8 @@ function get_user_restrictions( $user_id, $user_status,
if ( $use_groups )
{
$query = 'SELECT ga.cat_id';
- $query.= ' FROM '.PREFIX_TABLE.'user_group as ug';
- $query.= ', '.PREFIX_TABLE.'group_access as ga';
+ $query.= ' FROM '.USER_GROUP_TABLE.' as ug';
+ $query.= ', '.GROUP_ACCESS_TABLE.' as ga';
$query.= ' WHERE ug.group_id = ga.group_id';
$query.= ' AND ug.user_id = '.$user_id;
$query.= ';';
@@ -789,8 +787,7 @@ function get_user_restrictions( $user_id, $user_status,
// 3. adding to the restricted categories, the invisible ones
if ( $user_status != 'admin' )
{
- $query = 'SELECT id';
- $query.= ' FROM '.PREFIX_TABLE.'categories';
+ $query = 'SELECT id FROM '.CATEGORIES_TABLE;
$query.= " WHERE visible = 'false';";
$result = mysql_query( $query );
while ( $row = mysql_fetch_array( $result ) )
@@ -821,13 +818,13 @@ function synchronize()
// cleaning user_category table for users to update
foreach( $user_restrictions as $user_id => $restrictions ) {
$query = 'DELETE';
- $query.= ' FROM '.PREFIX_TABLE.'user_category';
+ $query.= ' FROM '.USER_CATEGORY_TABLE;
$query.= ' WHERE user_id = '.$user_id;
$query.= ';';
mysql_query( $query );
}
- $query = 'INSERT INTO '.PREFIX_TABLE.'user_category';
+ $query = 'INSERT INTO '.USER_CATEGORY_TABLE;
$query.= ' (user_id,category_id,date_last,nb_sub_categories) VALUES ';
$query.= $values;
$query.= ';';
@@ -902,7 +899,7 @@ function synchronize_group( $group_id )
$query = 'SELECT id';
$query.= ' FROM '.USERS_TABLE;
- $query.= ', '.PREFIX_TABLE.'user_group';
+ $query.= ', '.USER_GROUP_TABLE;
$query.= ' WHERE group_id = '.$group_id;
$query.= ' AND id = user_id';
$query.= ';';
@@ -979,7 +976,7 @@ function is_user_allowed( $category_id, $restrictions )
if ( in_array( $category_id, $restrictions ) ) return 1;
$query = 'SELECT uppercats';
- $query.= ' FROM '.PREFIX_TABLE.'categories';
+ $query.= ' FROM '.CATEGORIES_TABLE;
$query.= ' WHERE id = '.$category_id;
$query.= ';';
$row = mysql_fetch_array( mysql_query( $query ) );
diff --git a/admin/include/isadmin.inc.php b/admin/include/isadmin.inc.php
index 2b053d7b1..be3b9e10f 100644
--- a/admin/include/isadmin.inc.php
+++ b/admin/include/isadmin.inc.php
@@ -25,7 +25,7 @@
// | USA. |
// +-----------------------------------------------------------------------+
-include( './admin/include/functions.php' );
+include( PHPWG_ROOT_PATH.'admin/include/functions.php' );
$isadmin = true;
if ( $user['status'] != 'admin' )
diff --git a/admin/search.php b/admin/search.php
new file mode 100644
index 000000000..4bfae3039
--- /dev/null
+++ b/admin/search.php
@@ -0,0 +1,107 @@
+<?
+// +-----------------------------------------------------------------------+
+// | search.php |
+// +-----------------------------------------------------------------------+
+// | application : PhpWebGallery <http://phpwebgallery.net> |
+// | branch : BSF (Best So Far) |
+// +-----------------------------------------------------------------------+
+// | file : $RCSfile$
+// | last update : $Date$
+// | last modifier : $Author$
+// | revision : $Revision$
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+define('PHPWG_ROOT_PATH','../');
+include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
+include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
+
+//----------------------------------------------------- template initialization
+$title = $lang['Find_username'];
+include(PHPWG_ROOT_PATH.'include/page_header.php');
+
+$template->set_filenames( array('search'=>'admin/search_username.tpl') );
+$template->assign_vars(array(
+ 'USERNAME'=>( !empty($search_match) ) ? strip_tags($search_match) : '',
+
+ 'L_SEARCH_USERNAME'=>$lang['Find_username'],
+ 'L_SEARCH'=>$lang['search'],
+ 'L_SEARCH_EXPLAIN'=>$lang['Search_author_explain'],
+ 'L_SELECT'=>$lang['Select'],
+ 'L_UPDATE_USERNAME'=>$lang['Look_up_user'],
+ 'L_CLOSE_WINDOW'=>$lang['Close'],
+
+ 'F_SEARCH_ACTION' => add_session_id($PHP_SELF),
+ ));
+
+//----------------------------------------------------------------- form action
+//
+// Define initial vars
+//
+if ( isset($_POST['mode']) || isset($_GET['mode']) )
+{
+ $mode = ( isset($_POST['mode']) ) ? $_POST['mode'] : $_GET['mode'];
+}
+else
+{
+ $mode = '';
+}
+$search_match = '';
+if ( isset($_POST['search_username']) )
+{
+ $search_match = $_POST['search_username'];
+}
+
+$username_list = '';
+if ( !empty($search_match) )
+{
+ $username_search = preg_replace('/\*/', '%', trim(strip_tags($search_match)));
+
+ $sql = "SELECT username
+ FROM " . USERS_TABLE . "
+ WHERE username LIKE '" . str_replace("\'", "''", $username_search) . "'
+ ORDER BY username";
+ if ( !($result = mysql_query($sql)) )
+ {
+ die('Could not obtain search results');
+ }
+
+ if ( $row = mysql_fetch_array($result) )
+ {
+ do
+ {
+ $username_list .= '<option value="' . $row['username'] . '">' . $row['username'] . '</option>';
+ }
+ while ( $row = mysql_fetch_array($result) );
+ }
+ else
+ {
+ $username_list .= '<option>' . $lang['No_match']. '</option>';
+ }
+ mysql_free_result($result);
+}
+
+//------------------------------------------------------------------ users list
+if ( !empty($username_list))
+{
+ $template->assign_block_vars('switch_select_name', array(
+ 'F_USERNAME_OPTIONS'=>$username_list
+ ));
+}
+
+$template->pparse('search');
+include(PHPWG_ROOT_PATH.'include/page_tail.php');
+?> \ No newline at end of file
diff --git a/admin/thumbnail.php b/admin/thumbnail.php
index e77420ea3..21e549396 100644
--- a/admin/thumbnail.php
+++ b/admin/thumbnail.php
@@ -24,7 +24,7 @@
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
-include_once( './admin/include/isadmin.inc.php' );
+include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
//------------------------------------------------------------------- functions
// get_subdirs returns an array containing all sub directory names,
// excepting : '.', '..' and 'thumbnail'.
@@ -211,228 +211,196 @@ function RatioResizeImg( $filename, $newWidth, $newHeight, $path, $tn_ext )
}
}
-// array_max returns the highest value of the given array
-function array_max( $array )
-{
- sort( $array, SORT_NUMERIC );
- return array_pop( $array );
-}
-
-// array_min returns the lowest value of the given array
-function array_min( $array )
-{
- sort( $array, SORT_NUMERIC );
- return array_shift( $array );
-}
-
-// array_avg returns the average value of the array
-function array_avg( $array )
-{
- return array_sum( $array ) / sizeof( $array );
-}
-
// get_displayed_dirs builds the tree of dirs under "galleries". If a
// directory contains pictures without thumbnails, the become linked to the
// page of thumbnails creation.
function get_displayed_dirs( $dir, $indent )
{
- global $conf,$lang,$vtp,$sub;
+ global $lang;
$sub_dirs = get_subdirs( $dir );
+ $output = '';
+ if (!empty($sub_dirs))
+ {
+ $output.='<ul class="menu">';
// write of the dirs
foreach ( $sub_dirs as $sub_dir ) {
+ $output.='<li>';
$pictures = get_images_without_thumbnail( $dir.'/'.$sub_dir );
- $vtp->addSession( $sub, 'dir' );
- $vtp->setVar( $sub, 'dir.indent', $indent );
if ( count( $pictures ) > 0 )
{
- $vtp->addSession( $sub, 'linked' );
- $url = './admin.php?page=thumbnail&amp;dir='.$dir."/".$sub_dir;
- $vtp->setVar( $sub, 'linked.url', add_session_id( $url ) );
- $vtp->setVar( $sub, 'linked.name', $sub_dir );
- $vtp->setVar( $sub, 'linked.nb_pic', count( $pictures ) );
- $vtp->closeSession( $sub, 'linked' );
+ $url = add_session_id(PHPWG_ROOT_PATH.'admin.php?page=thumbnail&amp;dir='.$dir.'/'.$sub_dir);
+ $output.='<a class="adminMenu" href="'.$url.'">'.$sub_dir.'</a> [ '.count( $pictures ).' ';
+ $output.=$lang['thumbnail'].' ]';
}
else
{
- $vtp->addSession( $sub, 'unlinked' );
- $vtp->setVar( $sub, 'unlinked.name', $sub_dir );
- $vtp->closeSession( $sub, 'unlinked' );
+ $output.=$sub_dir;
}
- $vtp->closeSession( $sub, 'dir' );
// recursive call
- get_displayed_dirs( $dir.'/'.$sub_dir,
- $indent+30 );
+ $output.=get_displayed_dirs( $dir.'/'.$sub_dir,
+ $indent+30 );
+ $output.='</li>';
+ }
+ $output.='</ul>';
}
+ return $output;
}
+
+$errors = array();
+$pictures = array();
+$stats = array();
+
+if ( isset( $_GET['dir'] ) && isset( $_POST['submit'] ))
+{
+ $pictures = get_images_without_thumbnail( $_GET['dir'] );
+ // checking criteria
+ if ( !ereg( "^[0-9]{2,3}$", $_POST['width'] ) or $_POST['width'] < 10 )
+ {
+ array_push( $errors, $lang['tn_err_width'].' 10' );
+ }
+ if ( !ereg( "^[0-9]{2,3}$", $_POST['height'] ) or $_POST['height'] < 10 )
+ {
+ array_push( $errors, $lang['tn_err_height'].' 10' );
+ }
+
+ // picture miniaturization
+ if ( count( $errors ) == 0 )
+ {
+ $stats = scandir( $_GET['dir'], $_POST['width'], $_POST['height'] );
+ }
+}
+
//----------------------------------------------------- template initialization
-$sub = $vtp->Open( './template/'.$user['template'].'/admin/thumbnail.vtp' );
-$tpl = array(
- 'tn_dirs_title','tn_dirs_alone','tn_params_title','tn_params_GD',
- 'tn_params_GD_info','tn_width','tn_params_width_info','tn_height',
- 'tn_params_height_info','tn_params_create','tn_params_create_info',
- 'tn_params_format','tn_params_format_info','submit','tn_alone_title',
- 'filesize','tn_picture','tn_results_title','thumbnail',
- 'tn_results_gen_time','tn_stats','tn_stats_nb','tn_stats_total',
- 'tn_stats_max','tn_stats_min','tn_stats_mean' );
-templatize_array( $tpl, 'lang', $sub );
-$vtp->setGlobalVar( $sub, 'user_template', $user['template'] );
+$template->set_filenames( array('thumbnail'=>'admin/thumbnail.tpl') );
+
+$template->assign_vars(array(
+ 'L_THUMBNAIL_TITLE'=>$lang['tn_dirs_title'],
+ 'L_UNLINK'=>$lang['tn_dirs_alone'],
+ 'L_RESULTS'=>$lang['tn_results_title'],
+ 'L_TN_PICTURE'=>$lang['tn_picture'],
+ 'L_FILESIZE'=>$lang['filesize'],
+ 'L_WIDTH'=>$lang['tn_width'],
+ 'L_HEIGHT'=>$lang['tn_height'],
+ 'L_GENERATED'=>$lang['tn_results_gen_time'],
+ 'L_THUMBNAIL'=>$lang['thumbnail'],
+ 'L_PARAMS'=>$lang['tn_params_title'],
+ 'L_GD'=>$lang['tn_params_GD'],
+ 'L_GD_INFO'=>$lang['tn_params_GD_info'],
+ 'L_WIDTH_INFO'=>$lang['tn_params_width_info'],
+ 'L_HEIGHT_INFO'=>$lang['tn_params_height_info'],
+ 'L_CREATE'=>$lang['tn_params_create'],
+ 'L_CREATE_INFO'=>$lang['tn_params_create_info'],
+ 'L_FORMAT'=>$lang['tn_params_format'],
+ 'L_FORMAT_INFO'=>$lang['tn_params_format_info'],
+ 'L_SUBMIT'=>$lang['submit'],
+ 'L_REMAINING'=>$lang['tn_alone_title'],
+ 'L_TN_STATS'=>$lang['tn_stats'],
+ 'L_TN_NB_STATS'=>$lang['tn_stats_nb'],
+ 'L_TN_TOTAL'=>$lang['tn_stats_total'],
+ 'L_TN_MAX'=>$lang['tn_stats_max'],
+ 'L_TN_MIN'=>$lang['tn_stats_min'],
+ 'L_TN_AVERAGE'=>$lang['tn_stats_mean'],
+
+ 'T_STYLE'=>$user['template']
+ ));
+
//----------------------------------------------------- miniaturization results
-if ( isset( $_GET['dir'] ) )
+if ( sizeof( $errors ) != 0 )
{
- $pictures = get_images_without_thumbnail( $_GET['dir'] );
- if ( count( $pictures ) == 0 )
+ $template->assign_block_vars('errors',array());
+ for ( $i = 0; $i < sizeof( $errors ); $i++ )
{
- $vtp->addSession( $sub, 'warning' );
- $vtp->closeSession( $sub, 'warning' );
+ $template->assign_block_vars('errors.error',array('ERROR'=>$errors[$i]));
}
- elseif ( isset( $_POST['submit'] ) )
+}
+else if ( isset( $_GET['dir'] ) && isset( $_POST['submit'] ) && !empty($stats))
+{
+ $times = array();
+ foreach ( $stats as $stat ) {
+ array_push( $times, $stat['time'] );
+ }
+ $sum=array_sum( $times );
+ $average = $sum/sizeof($times);
+ sort( $times, SORT_NUMERIC );
+ $max = array_pop($times);
+ $min = array_shift( $times);
+
+ $template->assign_block_vars('results',array(
+ 'TN_NB'=>count( $stats ),
+ 'TN_TOTAL'=>number_format( $sum, 2, '.', ' ').' ms',
+ 'TN_MAX'=>number_format( $max, 2, '.', ' ').' ms',
+ 'TN_MIN'=>number_format( $min, 2, '.', ' ').' ms',
+ 'TN_AVERAGE'=>number_format( $average, 2, '.', ' ').' ms'
+ ));
+ if ( !count( $pictures ) )
{
- // checking criteria
- $errors = array();
- if ( !ereg( "^[0-9]{2,3}$", $_POST['width'] ) or $_POST['width'] < 10 )
- {
- array_push( $errors, $lang['tn_err_width'].' 10' );
- }
- if ( !ereg( "^[0-9]{2,3}$", $_POST['height'] ) or $_POST['height'] < 10 )
- {
- array_push( $errors, $lang['tn_err_height'].' 10' );
- }
- // picture miniaturization
- if ( count( $errors ) == 0 )
- {
- $vtp->addSession( $sub, 'results' );
- $stats = scandir( $_GET['dir'], $_POST['width'], $_POST['height'] );
- $times = array();
- foreach ( $stats as $stat ) {
- array_push( $times, $stat['time'] );
- }
- $max = array_max( $times );
- $min = array_min( $times );
- foreach ( $stats as $i => $stat ) {
- $vtp->addSession( $sub, 'picture' );
- if ( $i % 2 == 1 )
- {
- $vtp->setVar( $sub, 'picture.class', 'row2' );
- }
- $vtp->setVar( $sub, 'picture.num', ($i+1) );
- $vtp->setVar( $sub, 'picture.file', $stat['file'] );
- $vtp->setVar( $sub, 'picture.filesize', $stat['size'] );
- $vtp->setVar( $sub, 'picture.width', $stat['width'] );
- $vtp->setVar( $sub, 'picture.height', $stat['height'] );
- $vtp->setVar( $sub, 'picture.thumb_file', $stat['tn_file'] );
- $vtp->setVar( $sub, 'picture.thumb_filesize', $stat['tn_size'] );
- $vtp->setVar( $sub, 'picture.thumb_width', $stat['tn_width'] );
- $vtp->setVar( $sub, 'picture.thumb_height', $stat['tn_height'] );
- $vtp->setVar( $sub, 'picture.time',
- number_format( $stat['time'], 2, '.', ' ').' ms' );
- if ( $stat['time'] == $max )
- {
- $vtp->setVar( $sub, 'picture.color', 'red' );
- }
- else if ( $stat['time'] == $min )
- {
- $vtp->setVar( $sub, 'picture.color', 'green' );
- }
- $vtp->closeSession( $sub, 'picture' );
- }
- // general statistics
- $vtp->setVar( $sub, 'results.stats_nb', count( $stats ) );
- $vtp->setVar( $sub, 'results.stats_total',
- number_format( array_sum( $times ), 2, '.', ' ').' ms' );
- $vtp->setVar( $sub, 'results.stats_max',
- number_format( $max, 2, '.', ' ').' ms' );
- $vtp->setVar( $sub, 'results.stats_min',
- number_format( $min, 2, '.', ' ').' ms' );
- $vtp->setVar( $sub, 'results.stats_mean',
- number_format( array_avg( $times ), 2, '.', ' ').' ms' );
- $vtp->closeSession( $sub, 'results' );
- }
- else
- {
- $vtp->addSession( $sub, 'errors' );
- foreach ( $errors as $error ) {
- $vtp->addSession( $sub, 'li' );
- $vtp->setVar( $sub, 'li.li', $error );
- $vtp->closeSession( $sub, 'li' );
- }
- $vtp->closeSession( $sub, 'errors' );
- }
+ $template->assign_block_vars('warning',array());
}
-//-------------------------------------------------- miniaturization parameters
- if ( sizeof( $pictures ) != 0 )
+
+ foreach ( $stats as $i => $stat )
{
- $vtp->addSession( $sub, 'params' );
- $url = './admin.php?page=thumbnail&amp;dir='.$_GET['dir'];
- $vtp->setVar( $sub, 'params.action', add_session_id( $url ) );
- // GD version selected...
- if ( isset( $_POST['gd'] ) and $_POST['gd'] == 1 )
- {
- $vtp->setVar( $sub, 'params.gd1_checked', ' checked="checked"' );
- }
- else
- {
- $vtp->setVar( $sub, 'params.gd2_checked', ' checked="checked"' );
- }
- // width values
- if ( isset( $_POST['width'] ) )
- {
- $vtp->setVar( $sub, 'params.width_value', $_POST['width'] );
- }
- else
- {
- $vtp->setVar( $sub, 'params.width_value', '128' );
- }
- // height value
- if ( isset( $_POST['height'] ) )
- {
- $vtp->setVar( $sub, 'params.height_value', $_POST['height'] );
- }
- else
- {
- $vtp->setVar( $sub, 'params.height_value', '96' );
- }
- // options for the number of picture to miniaturize : "n"
- $options = array( 5,10,20,40 );
- if ( isset( $_POST['n'] ) ) $n = $_POST['n'];
- else $n = 5;
- foreach ( $options as $option ) {
- $vtp->addSession( $sub, 'n_option' );
- $vtp->setVar( $sub, 'n_option.option', $option );
- if ( $option == $n )
- {
- $vtp->setVar( $sub, 'n_option.selected', ' selected="selected"' );
- }
- $vtp->closeSession( $sub, 'n_option' );
+ $class = ($i % 2)? 'row1':'row2';
+ $color='';
+ if ($stat['time']==$max) $color = 'red';
+ elseif ($stat['time']==$min) $color = '#33FF00';
+ $template->assign_block_vars('results.picture',array(
+ 'NB_IMG'=>($i+1),
+ 'FILE_IMG'=>$stat['file'],
+ 'FILESIZE_IMG'=>$stat['size'],
+ 'WIDTH_IMG'=>$stat['width'],
+ 'HEIGHT_IMG'=>$stat['height'],
+ 'TN_FILE_IMG'=>$stat['tn_file'],
+ 'TN_FILESIZE_IMG'=>$stat['tn_size'],
+ 'TN_WIDTH_IMG'=>$stat['tn_width'],
+ 'TN_HEIGHT_IMG'=>$stat['tn_height'],
+ 'GEN_TIME'=>number_format( $stat['time'], 2, '.', ' ').' ms',
+
+ 'T_COLOR'=>$color,
+ 'T_CLASS'=>$class
+ ));
}
- $vtp->closeSession( $sub, 'params' );
+ }
+//-------------------------------------------------- miniaturization parameters
+if ( isset( $_GET['dir'] ) && !sizeof( $pictures ))
+{
+ $form_url = PHPWG_ROOT_PATH.'admin.php?page=thumbnail&amp;dir='.$_GET['dir'];
+ $gd = !empty( $_POST['gd'] )?$_POST['gd']:2;
+ $width = !empty( $_POST['width'] )?$_POST['width']:128;
+ $height = !empty( $_POST['height'] )?$_POST['height']:96;
+ $gdlabel = 'GD'.$gd.'_CHECKED';
+
+ $template->assign_block_vars('params',array(
+ 'F_ACTION'=>add_session_id($form_url),
+ $gdlabel=>'checked="checked"',
+ 'WIDTH_TN'=>$width,
+ 'HEIGHT_TN'=>$height
+ ));
+
//---------------------------------------------------------- remaining pictures
- $vtp->addSession( $sub, 'remainings' );
- $pictures = get_images_without_thumbnail( $_GET['dir'] );
- $vtp->setVar( $sub, 'remainings.total', count( $pictures ) );
- foreach ( $pictures as $i => $picture ) {
- $vtp->addSession( $sub, 'remaining' );
- if ( $i % 2 == 1 )
- {
- $vtp->setVar( $sub, 'remaining.class', 'row2' );
- }
- $vtp->setVar( $sub, 'remaining.num', ($i+1) );
- $vtp->setVar( $sub, 'remaining.file', $picture['name'] );
- $vtp->setVar( $sub, 'remaining.filesize', $picture['size'] );
- $vtp->setVar( $sub, 'remaining.width', $picture['width'] );
- $vtp->setVar( $sub, 'remaining.height', $picture['height'] );
- $vtp->closeSession( $sub, 'remaining' );
+ $pictures = get_images_without_thumbnail( $_GET['dir'] );
+ $template->assign_block_vars('remainings',array('TOTAL_IMG'=>count( $pictures )));
+
+ foreach ( $pictures as $i => $picture )
+ {
+ $class = ($i % 2)? 'row1':'row2';
+ $template->assign_block_vars('remainings.remaining',array(
+ 'NB_IMG'=>($i+1),
+ 'FILE_TN'=>$picture['name'],
+ 'FILESIZE_IMG'=>$picture['size'],
+ 'WIDTH_IMG'=>$picture['width'],
+ 'HEIGHT_IMG'=>$picture['height'],
+
+ 'T_CLASS'=>$class
+ ));
}
- $vtp->closeSession( $sub, 'remainings' );
- }
}
//-------------------------------------------------------------- directory list
else
{
- $vtp->addSession( $sub, 'directory_list' );
- get_displayed_dirs( './galleries', 60 );
- $vtp->closeSession( $sub, 'directory_list' );
+ $categories = get_displayed_dirs( './galleries', 60 );
+ $template->assign_block_vars('directory_list',array('CATEGORY_LIST'=>$categories));
}
-//----------------------------------------------------------- sending html code
-$vtp->Parse( $handle , 'sub', $sub );
+
+$template->assign_var_from_handle('ADMIN_CONTENT', 'thumbnail');
?>
diff --git a/admin/update.php b/admin/update.php
index a894193ac..1803d5468 100644
--- a/admin/update.php
+++ b/admin/update.php
@@ -25,7 +25,7 @@
// | USA. |
// +-----------------------------------------------------------------------+
-include_once( './admin/include/isadmin.inc.php' );
+include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
//------------------------------------------------------------------- functions
function insert_local_category( $id_uppercat )
{
@@ -35,11 +35,10 @@ function insert_local_category( $id_uppercat )
$output = '';
// 0. retrieving informations on the category to display
- $cat_directory = './galleries';
+ $cat_directory = PHPWG_ROOT_PATH.'galleries';
if ( is_numeric( $id_uppercat ) )
{
- $query = 'SELECT name,uppercats,dir';
- $query.= ' FROM '.PREFIX_TABLE.'categories';
+ $query = 'SELECT name,uppercats,dir FROM '.CATEGORIES_TABLE;
$query.= ' WHERE id = '.$id_uppercat;
$query.= ';';
$row = mysql_fetch_array( mysql_query( $query ) );
@@ -52,8 +51,7 @@ function insert_local_category( $id_uppercat )
$local_dir = '';
$database_dirs = array();
- $query = 'SELECT id,dir';
- $query.= ' FROM '.PREFIX_TABLE.'categories';
+ $query = 'SELECT id,dir FROM '.CATEGORIES_TABLE;
$query.= ' WHERE id IN ('.$uppercats.')';
$query.= ';';
$result = mysql_query( $query );
@@ -68,11 +66,10 @@ function insert_local_category( $id_uppercat )
$cat_directory.= '/'.$local_dir;
// 1. display the category name to update
- $src = './template/'.$user['template'].'/admin/images/puce.gif';
- $output = '<img src="'.$src.'" alt="&gt;" />';
- $output.= '<span style="font-weight:bold;">'.$name.'</span>';
+ $output = '<ul class="menu">';
+ $output.= '<li><strong>'.$name.'</strong>';
$output.= ' [ '.$dir.' ]';
- $output.= '<div class="retrait">';
+ $output.= '</li>';
// 2. we search pictures of the category only if the update is for all
// or a cat_id is specified
@@ -85,8 +82,7 @@ function insert_local_category( $id_uppercat )
$sub_dirs = get_category_directories( $cat_directory );
$sub_category_dirs = array();
- $query = 'SELECT id,dir';
- $query.= ' FROM '.PREFIX_TABLE.'categories';
+ $query = 'SELECT id,dir FROM '.CATEGORIES_TABLE;
$query.= ' WHERE site_id = 1';
if (!is_numeric($id_uppercat)) $query.= ' AND id_uppercat IS NULL';
else $query.= ' AND id_uppercat = '.$id_uppercat;
@@ -134,13 +130,13 @@ function insert_local_category( $id_uppercat )
// we have to create the category
if ( count( $inserts ) > 0 )
{
- $query = 'INSERT INTO '.PREFIX_TABLE.'categories';
+ $query = 'INSERT INTO '.CATEGORIES_TABLE;
$query.= ' (dir,name,site_id,id_uppercat,uppercats) VALUES ';
$query.= implode( ',', $inserts );
$query.= ';';
mysql_query( $query );
// updating uppercats field
- $query = 'UPDATE '.PREFIX_TABLE.'categories';
+ $query = 'UPDATE '.CATEGORIES_TABLE;
$query.= ' SET uppercats = ';
if ( $uppercats != '' ) $query.= "CONCAT('".$uppercats."',',',id)";
else $query.= 'id';
@@ -153,7 +149,7 @@ function insert_local_category( $id_uppercat )
// Recursive call on the sub-categories (not virtual ones)
$query = 'SELECT id';
- $query.= ' FROM '.PREFIX_TABLE.'categories';
+ $query.= ' FROM '.CATEGORIES_TABLE;
$query.= ' WHERE site_id = 1';
if (!is_numeric($id_uppercat)) $query.= ' AND id_uppercat IS NULL';
else $query.= ' AND id_uppercat = '.$id_uppercat;
@@ -167,7 +163,7 @@ function insert_local_category( $id_uppercat )
if ( is_numeric( $id_uppercat ) )
{
- $output.= '</div>';
+ $output.= '</ul>';
}
return $output;
}
@@ -187,7 +183,7 @@ function insert_local_image( $dir, $category_id )
// - are not in the directory anymore
// - don't have the associated thumbnail available anymore
$query = 'SELECT id,file,tn_ext';
- $query.= ' FROM '.PREFIX_TABLE.'images';
+ $query.= ' FROM '.IMAGES_TABLE;
$query.= ' WHERE storage_category_id = '.$category_id;
$query.= ';';
$result = mysql_query( $query );
@@ -217,8 +213,7 @@ function insert_local_image( $dir, $category_id )
}
$registered_pictures = array();
- $query = 'SELECT file';
- $query.= ' FROM '.PREFIX_TABLE.'images';
+ $query = 'SELECT file FROM '.IMAGES_TABLE;
$query.= ' WHERE storage_category_id = '.$category_id;
$query.= ';';
$result = mysql_query( $query );
@@ -233,7 +228,7 @@ function insert_local_image( $dir, $category_id )
$unvalidated_pictures = array();
$query = 'SELECT file,infos,validated';
- $query.= ' FROM '.PREFIX_TABLE.'waiting';
+ $query.= ' FROM '.WAITING_TABLE;
$query.= ' WHERE storage_category_id = '.$category_id;
$query.= ';';
$result = mysql_query( $query );
@@ -293,7 +288,7 @@ function insert_local_image( $dir, $category_id )
$value.= ','.$date_creation;
// deleting the waiting element
- $query = 'DELETE FROM '.PREFIX_TABLE.'waiting';
+ $query = 'DELETE FROM '.WAITING_TABLE;
$query.= " WHERE file = '".$unregistered_picture."'";
$query.= ' AND storage_category_id = '.$category_id;
$query.= ';';
@@ -336,7 +331,7 @@ function insert_local_image( $dir, $category_id )
if ( count( $inserts ) > 0 )
{
// inserts all found pictures
- $query = 'INSERT INTO '.PREFIX_TABLE.'images';
+ $query = 'INSERT INTO '.IMAGES_TABLE;
$query.= ' (file,storage_category_id,date_available,tn_ext';
$query.= ',filesize,width,height';
$query.= ',name,author,comment,date_creation)';
@@ -349,7 +344,7 @@ function insert_local_image( $dir, $category_id )
$ids = array();
$query = 'SELECT id';
- $query.= ' FROM '.PREFIX_TABLE.'images';
+ $query.= ' FROM '.IMAGES_TABLE;
$query.= ' WHERE storage_category_id = '.$category_id;
$query.= ';';
$result = mysql_query( $query );
@@ -360,13 +355,13 @@ function insert_local_image( $dir, $category_id )
// recreation of the links between this storage category pictures and
// its storage category
- $query = 'DELETE FROM '.PREFIX_TABLE.'image_category';
+ $query = 'DELETE FROM '.IMAGE_CATEGORY_TABLE;
$query.= ' WHERE category_id = '.$category_id;
$query.= ' AND image_id IN ('.implode( ',', $ids ).')';
$query.= ';';
mysql_query( $query );
- $query = 'INSERT INTO '.PREFIX_TABLE.'image_category';
+ $query = 'INSERT INTO '.IMAGE_CATEGORY_TABLE;
$query.= '(category_id,image_id) VALUES ';
foreach ( $ids as $num => $image_id ) {
if ( $num > 0 ) $query.= ',';
@@ -395,15 +390,14 @@ function remote_images()
$vtp->setVar( $sub, 'remote_update.url', $url );
// 2. is the site already existing ?
- $query = 'SELECT id';
- $query.= ' FROM '.PREFIX_TABLE.'sites';
+ $query = 'SELECT id FROM '.SITES_TABLE;
$query.= " WHERE galleries_url = '".$url."'";
$query.= ';';
$result = mysql_query( $query );
if ( mysql_num_rows($result ) == 0 )
{
// we have to register this site in the database
- $query = 'INSERT INTO '.PREFIX_TABLE.'sites';
+ $query = 'INSERT INTO '.SITES_TABLE;
$query.= " (galleries_url) VALUES ('".$url."')";
$query.= ';';
mysql_query( $query );
@@ -437,7 +431,7 @@ function insert_remote_category( $xml_content, $site_id, $id_uppercat, $level )
if ( is_numeric( $id_uppercat ) )
{
$query = 'SELECT name,uppercats,dir';
- $query.= ' FROM '.PREFIX_TABLE.'categories';
+ $query.= ' FROM '.CATEGORIES_TABLE;
$query.= ' WHERE id = '.$id_uppercat;
$query.= ';';
$row = mysql_fetch_array( mysql_query( $query ) );
@@ -467,8 +461,7 @@ function insert_remote_category( $xml_content, $site_id, $id_uppercat, $level )
// $database_dirs contains dir names contained in the database for this
// id_uppercat and site_id
$database_dirs = array();
- $query = 'SELECT id,dir';
- $query.= ' FROM '.PREFIX_TABLE.'categories';
+ $query = 'SELECT id,dir FROM '.CATEGORIES_TABLE;
$query.= ' WHERE site_id = '.$site_id;
if (!is_numeric($id_uppercat)) $query.= ' AND id_uppercat IS NULL';
else $query.= ' AND id_uppercat = '.$id_uppercat;
@@ -508,13 +501,13 @@ function insert_remote_category( $xml_content, $site_id, $id_uppercat, $level )
// we have to create the category
if ( count( $inserts ) > 0 )
{
- $query = 'INSERT INTO '.PREFIX_TABLE.'categories';
+ $query = 'INSERT INTO '.CATEGORIES_TABLE;
$query.= ' (dir,name,site_id,id_uppercat,uppercats) VALUES ';
$query.= implode( ',', $inserts );
$query.= ';';
mysql_query( $query );
// updating uppercats field
- $query = 'UPDATE '.PREFIX_TABLE.'categories';
+ $query = 'UPDATE '.CATEGORIES_TABLE;
$query.= ' SET uppercats = ';
if ( $uppercats != '' ) $query.= "CONCAT('".$uppercats."',',',id)";
else $query.= 'id';
@@ -527,7 +520,7 @@ function insert_remote_category( $xml_content, $site_id, $id_uppercat, $level )
// Recursive call on the sub-categories (not virtual ones)
$query = 'SELECT id,dir';
- $query.= ' FROM '.PREFIX_TABLE.'categories';
+ $query.= ' FROM '.CATEGORIES_TABLE;
$query.= ' WHERE site_id = '.$site_id;
if (!is_numeric($id_uppercat)) $query.= ' AND id_uppercat IS NULL';
else $query.= ' AND id_uppercat = '.$id_uppercat;
@@ -567,8 +560,7 @@ function insert_remote_image( $xml_dir, $category_id )
// we have to delete all the images from the database that are not in the
// directory anymore (not in the XML anymore)
- $query = 'SELECT id,file';
- $query.= ' FROM '.PREFIX_TABLE.'images';
+ $query = 'SELECT id,file FROM '.IMAGES_TABLE;
$query.= ' WHERE storage_category_id = '.$category_id;
$query.= ';';
$result = mysql_query( $query );
@@ -584,8 +576,7 @@ function insert_remote_image( $xml_dir, $category_id )
}
$database_pictures = array();
- $query = 'SELECT file';
- $query.= ' FROM '.PREFIX_TABLE.'images';
+ $query = 'SELECT file FROM '.IMAGES_TABLE;
$query.= ' WHERE storage_category_id = '.$category_id;
$query.= ';';
$result = mysql_query( $query );
@@ -630,7 +621,7 @@ function insert_remote_image( $xml_dir, $category_id )
if ( count( $inserts ) > 0 )
{
// inserts all found pictures
- $query = 'INSERT INTO '.PREFIX_TABLE.'images';
+ $query = 'INSERT INTO '.IMAGES_TABLE;
$query.= ' (file,storage_category_id,date_available,tn_ext';
$query.= ',filesize,width,height)';
$query.= ' VALUES ';
@@ -641,8 +632,7 @@ function insert_remote_image( $xml_dir, $category_id )
// what are the ids of the pictures in the $category_id ?
$ids = array();
- $query = 'SELECT id';
- $query.= ' FROM '.PREFIX_TABLE.'images';
+ $query = 'SELECT id FROM '.IMAGES_TABLE;
$query.= ' WHERE storage_category_id = '.$category_id;
$query.= ';';
$result = mysql_query( $query );
@@ -653,13 +643,13 @@ function insert_remote_image( $xml_dir, $category_id )
// recreation of the links between this storage category pictures and
// its storage category
- $query = 'DELETE FROM '.PREFIX_TABLE.'image_category';
+ $query = 'DELETE FROM '.IMAGE_CATEGORY_TABLE;
$query.= ' WHERE category_id = '.$category_id;
$query.= ' AND image_id IN ('.implode( ',', $ids ).')';
$query.= ';';
mysql_query( $query );
- $query = 'INSERT INTO '.PREFIX_TABLE.'image_category';
+ $query = 'INSERT INTO '.IMAGE_CATEGORY_TABLE;
$query.= '(category_id,image_id) VALUES ';
foreach ( $ids as $num => $image_id ) {
if ( $num > 0 ) $query.= ',';
@@ -671,25 +661,28 @@ function insert_remote_image( $xml_dir, $category_id )
return $output;
}
+
//----------------------------------------------------- template initialization
-$sub = $vtp->Open( './template/'.$user['template'].'/admin/update.vtp' );
-$tpl = array( 'update_default_title', 'update_only_cat', 'update_all',
- 'update_research_conclusion', 'update_deletion_conclusion',
- 'remote_site', 'update_part_research' );
-templatize_array( $tpl, 'lang', $sub );
-$vtp->setGlobalVar( $sub, 'user_template', $user['template'] );
+$template->set_filenames( array('update'=>'admin/update.tpl') );
+
+$template->assign_vars(array(
+ 'L_UPDATE_TITLE'=>$lang['update_default_title'],
+ 'L_CAT_UPDATE'=>$lang['update_only_cat'],
+ 'L_ALL_UPDATE'=>$lang['update_all'],
+ 'L_RESULT_UPDATE'=>$lang['update_part_research'],
+ 'L_NEW_CATEGORY'=>$lang['update_research_conclusion'],
+ 'L_DEL_CATEGORY'=>$lang['update_deletion_conclusion'],
+
+ 'U_CAT_UPDATE'=>add_session_id( PHPWG_ROOT_PATH.'admin.php?page=update&amp;update=cats' ),
+ 'U_ALL_UPDATE'=>add_session_id( PHPWG_ROOT_PATH.'admin.php?page=update&amp;update=all' )
+ ));
+
+$tpl = array('remote_site');
//-------------------------------------------- introduction : choices of update
// Display choice if "update" var is not specified
if (!isset( $_GET['update'] ))
{
- $vtp->addSession( $sub, 'introduction' );
- // only update the categories, not the pictures.
- $url = add_session_id( './admin.php?page=update&amp;update=cats' );
- $vtp->setVar( $sub, 'introduction.only_cat:url', $url );
- // update the entire tree folder
- $url = add_session_id( './admin.php?page=update&amp;update=all' );
- $vtp->setVar( $sub, 'introduction.all:url', $url );
- $vtp->closeSession( $sub, 'introduction' );
+ $template->assign_block_vars('introduction',array());
}
//-------------------------------------------------- local update : ./galleries
else
@@ -698,7 +691,7 @@ else
$start = get_moment();
$count_new = 0;
$count_deleted = 0;
- $vtp->addSession( $sub, 'local_update' );
+
if ( isset( $page['cat'] ) )
{
$categories = insert_local_category( $page['cat'] );
@@ -708,11 +701,12 @@ else
$categories = insert_local_category( 'NULL' );
}
$end = get_moment();
- echo get_elapsed_time( $start, $end ).' for update <br />';
- $vtp->setVar( $sub, 'local_update.categories', $categories );
- $vtp->setVar( $sub, 'local_update.count_new', $count_new );
- $vtp->setVar( $sub, 'local_update.count_deleted', $count_deleted );
- $vtp->closeSession( $sub, 'local_update' );
+ //echo get_elapsed_time( $start, $end ).' for update <br />';
+ $template->assign_block_vars('update',array(
+ 'CATEGORIES'=>$categories,
+ 'NEW_CAT'=>$count_new,
+ 'DEL_CAT'=>$count_deleted
+ ));
}
//------------------------------------------------- remote update : listing.xml
if ( @is_file( './admin/listing.xml' ) )
@@ -734,7 +728,7 @@ if ( @is_file( './admin/listing.xml' ) )
//---------------------------------------- update informations about categories
if ( isset( $_GET['update'] )
or isset( $page['cat'] )
- or @is_file( './listing.xml' ) )
+ or @is_file( './listing.xml' ) && DEBUG)
{
$start = get_moment();
update_category( 'all' );
@@ -747,5 +741,5 @@ if ( isset( $_GET['update'] )
echo get_elapsed_time( $start, $end ).' for synchronize_all_users<br />';
}
//----------------------------------------------------------- sending html code
-$vtp->Parse( $handle , 'sub', $sub );
+$template->assign_var_from_handle('ADMIN_CONTENT', 'update');
?>
diff --git a/admin/user_list.php b/admin/user_list.php
index 82bbeb86c..09ec07d3c 100644
--- a/admin/user_list.php
+++ b/admin/user_list.php
@@ -24,7 +24,10 @@
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
-include_once( './admin/include/isadmin.inc.php' );
+include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
+
+
+
//----------------------------------------------------- template initialization
$sub = $vtp->Open( './template/'.$user['template'].'/admin/user_list.vtp' );
$tpl = array( 'listuser_confirm','listuser_modify_hint','listuser_modify',
diff --git a/admin/user_perm.php b/admin/user_perm.php
index f3a6e4c06..424f85021 100644
--- a/admin/user_perm.php
+++ b/admin/user_perm.php
@@ -24,15 +24,96 @@
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
-include_once( './admin/include/isadmin.inc.php' );
+
+if( !defined("IN_ADMIN") )
+{
+ die ("Hacking attempt!");
+}
+
+include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
+
+//
+// Username search
+//
+function username_search($search_match)
+{
+ global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $phpbb_root_path;
+ global $starttime, $gen_simple_header;
+
+ $gen_simple_header = TRUE;
+
+ $username_list = '';
+ if ( !empty($search_match) )
+ {
+ $username_search = preg_replace('/\*/', '%', trim(strip_tags($search_match)));
+
+ $sql = "SELECT username
+ FROM " . USERS_TABLE . "
+ WHERE username LIKE '" . str_replace("\'", "''", $username_search) . "'
+ ORDER BY username";
+ if ( !($result = $db->sql_query($sql)) )
+ {
+ message_die(GENERAL_ERROR, 'Could not obtain search results', '', __LINE__, __FILE__, $sql);
+ }
+
+ if ( $row = $db->sql_fetchrow($result) )
+ {
+ do
+ {
+ $username_list .= '<option value="' . $row['username'] . '">' . $row['username'] . '</option>';
+ }
+ while ( $row = $db->sql_fetchrow($result) );
+ }
+ else
+ {
+ $username_list .= '<option>' . $lang['No_match']. '</option>';
+ }
+ $db->sql_freeresult($result);
+ }
+
+ $page_title = $lang['Search'];
+ include($phpbb_root_path . 'includes/page_header.'.$phpEx);
+
+ $template->set_filenames(array(
+ 'search_user_body' => 'search_username.tpl')
+ );
+
+ $template->assign_vars(array(
+ 'USERNAME' => ( !empty($search_match) ) ? strip_tags($search_match) : '',
+
+ 'L_CLOSE_WINDOW' => $lang['Close_window'],
+ 'L_SEARCH_USERNAME' => $lang['Find_username'],
+ 'L_UPDATE_USERNAME' => $lang['Select_username'],
+ 'L_SELECT' => $lang['Select'],
+ 'L_SEARCH' => $lang['Search'],
+ 'L_SEARCH_EXPLAIN' => $lang['Search_author_explain'],
+ 'L_CLOSE_WINDOW' => $lang['Close_window'],
+
+ 'S_USERNAME_OPTIONS' => $username_list,
+ 'S_SEARCH_ACTION' => append_sid("search.$phpEx?mode=searchuser"))
+ );
+
+ if ( $username_list != '' )
+ {
+ $template->assign_block_vars('switch_select_name', array());
+ }
+
+ $template->pparse('search_user_body');
+
+ include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
+
+ return;
+}
+
+if (isset($HTTP_POST_VARS['username']) || isset( $_POST['submit'] ))
+{
//----------------------------------------------------- template initialization
-$sub = $vtp->Open( './template/'.$user['template'].'/admin/user_perm.vtp' );
+$template->set_filenames( array('user'=>'admin/user_perm.tpl') );
+
$error = array();
$tpl = array( 'permuser_authorized','permuser_forbidden','submit',
'permuser_parent_forbidden','permuser_info_message',
'adduser_info_back','permuser_only_private' );
-templatize_array( $tpl, 'lang', $sub );
-$vtp->setGlobalVar( $sub, 'user_template', $user['template'] );
//--------------------------------------------------------------------- updates
if ( isset( $_POST['submit'] ) )
{
@@ -67,6 +148,7 @@ if ( isset( $_POST['submit'] ) )
$vtp->closeSession( $sub, 'confirmation' );
}
//---------------------------------------------------------------- form display
+
$restrictions = get_user_restrictions( $_GET['user_id'], $page['user_status'],
false, false );
$action = './admin.php?page=user_perm&amp;user_id='.$_GET['user_id'];
@@ -183,6 +265,19 @@ while ( $row = mysql_fetch_array( $result ) )
}
$vtp->closeSession( $sub, 'category' );
}
+//----------------------------------------------------------- default code
+else
+{
+$sub = $vtp->Open( '../template/'.$user['template'].'/admin/user_select_body.vtp' );
+$tpl = array( 'Look_up_user', 'Find_username', 'Select_username' );
+templatize_array( $tpl, 'lang', $sub );
+ $vtp->addSession( $sub, 'user' );
+ $vtp->setVarTab( $sub, array(
+ 'user.S_USER_ACTION' => append_sid("./admin.php?page=user_search"),
+ 'user.U_SEARCH_USER' => append_sid("./search.php"))
+ );
+ $vtp->closeSession( $sub, 'user' );
+}
//----------------------------------------------------------- sending html code
$vtp->Parse( $handle , 'sub', $sub );
?>
diff --git a/admin/user_search.php b/admin/user_search.php
new file mode 100644
index 000000000..2fd21d9c4
--- /dev/null
+++ b/admin/user_search.php
@@ -0,0 +1,125 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | user_search.php |
+// +-----------------------------------------------------------------------+
+// | application : PhpWebGallery <http://phpwebgallery.net> |
+// | branch : BSF (Best So Far) |
+// +-----------------------------------------------------------------------+
+// | file : $RCSfile$
+// | last update : $Date$
+// | last modifier : $Author$
+// | revision : $Revision$
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if( !defined("IN_ADMIN") )
+{
+ die ("Hacking attempt!");
+}
+
+include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
+
+$userdata = array();
+if ( isset( $_POST['submituser'] ) )
+{
+ $userdata = getuserdata($_POST['username']);
+ if (!$userdata) echo "Utilisateur inexistant";
+}
+
+if ( isset( $_POST['submit'] ) )
+{
+ // cleaning the user_access table for this user
+ $query = 'DELETE FROM '.USER_ACCESS_TABLE;
+ $query.= ' WHERE user_id = '.$_GET['user_id'];
+ $query.= ';';
+ mysql_query( $query );
+ // selecting all private categories
+ $query = 'SELECT id FROM '.CATEGORIES_TABLE;
+ $query.= " WHERE status = 'private'";
+ $query.= ';';
+ $result = mysql_query( $query );
+ while ( $row = mysql_fetch_array( $result ) )
+ {
+ $radioname = $row['id'];
+ if ( $_POST[$radioname] == 0 )
+ {
+ $query = 'INSERT INTO '.USER_ACCESS_TABLE;
+ $query.= ' (user_id,cat_id) VALUES';
+ $query.= ' ('.$_GET['user_id'].','.$row['id'].')';
+ $query.= ';';
+ mysql_query ( $query );
+ }
+ }
+ check_favorites( $_GET['user_id'] );
+ synchronize_user( $_GET['user_id'] );
+}
+
+$user_id = (!empty($userdata['id']))?$userdata['id']:'';
+
+$template->set_filenames( array('user'=>'admin/user_perm.tpl') );
+$template->assign_vars(array(
+ 'L_SELECT_USERNAME'=>$lang['Select_username'],
+ 'L_LOOKUP_USER'=>$lang['Look_up_user'],
+ 'L_FIND_USERNAME'=>$lang['Find_username'],
+ 'L_AUTH_USER'=>$lang['permuser_only_private'],
+ 'L_SUBMIT'=>$lang['submit'],
+ 'L_AUTHORIZED'=>$lang['permuser_authorized'],
+ 'L_FORBIDDEN'=>$lang['permuser_forbidden'],
+ 'L_PARENT_FORBIDDEN'=>$lang['permuser_parent_forbidden'],
+
+ 'F_SEARCH_USER_ACTION' => add_session_id(PHPWG_ROOT_PATH.'admin.php?page=user_search'),
+ 'F_AUTH_ACTION' => add_session_id(PHPWG_ROOT_PATH.'admin.php?page=user_search&amp;user_id='.$user_id),
+ 'U_SEARCH_USER' => add_session_id(PHPWG_ROOT_PATH.'admin/search.php')
+ ));
+
+if (!$userdata)
+{
+ $template->assign_block_vars('search',array());
+}
+else
+{
+ $template->assign_block_vars('permission',array());
+ $restrictions = get_user_restrictions( $userdata['id'], $userdata['status'],
+ false, false );
+
+ // only private categories are listed
+ $query = 'SELECT id FROM '.CATEGORIES_TABLE;
+ $query.= " WHERE status = 'private';";
+ $result = mysql_query( $query );
+ while ( $row = mysql_fetch_array( $result ) )
+ {
+ $is_user_allowed = is_user_allowed( $row['id'], $restrictions );
+ $url = PHPWG_ROOT_PATH.'admin.php?page=cat_perm&amp;cat_id='.$row['id'];
+ $cat_infos = get_cat_info( $row['id'] );
+ $template->assign_block_vars('permission.category',array(
+ 'CAT_NAME'=> get_cat_display_name($cat_infos['name'],' &gt; ', 'font-weight:bold;' ),
+ 'CAT_ID'=>$row['id'],
+ 'AUTH_YES'=>!$is_user_allowed?'checked="checked"':'',
+ 'AUTH_NO' =>$is_user_allowed?'checked="checked"':'',
+ 'CAT_URL'=>add_session_id($url)
+ ));
+
+ // any subcat forbidden for this user ?
+ if ( $is_user_allowed == 2 )
+ {
+ $template->assign_block_vars('permission.category.parent_forbidden',array());
+ }
+ }
+}
+
+//----------------------------------------------------------- sending html code
+$template->assign_var_from_handle('ADMIN_CONTENT', 'user');
+?>