From 4128835db8d7b8e619951d4c31e23bd934758f09 Mon Sep 17 00:00:00 2001 From: gweltas Date: Sat, 20 Mar 2004 00:52:37 +0000 Subject: - Template migration - Admin Control Panel migration - Language migration git-svn-id: http://piwigo.org/svn/trunk@393 68402e56-0260-453c-a942-63ccdbb3a9ee --- about.php | 4 +- admin.php | 169 ++--- admin/configuration.php | 940 ++++------------------------ admin/help.php | 28 +- admin/include/functions.php | 23 +- admin/include/isadmin.inc.php | 2 +- admin/search.php | 107 ++++ admin/thumbnail.php | 348 +++++----- admin/update.php | 124 ++-- admin/user_list.php | 5 +- admin/user_perm.php | 103 ++- admin/user_search.php | 125 ++++ category.php | 24 +- comments.php | 120 +++- identification.php | 1 - include/common.inc.php | 2 - include/config.inc.php | 2 +- include/constants.php | 5 +- include/functions_user.inc.php | 58 +- include/page_header.php | 20 +- include/script.js | 28 + include/vtemplate.class.php | 601 ------------------ install.php | 24 +- language/en_UK.iso-8859-1/lang.lang.php | 41 -- language/infos.lang.php | 96 +++ picture.php | 184 +++--- profile.php | 86 +-- register.php | 10 +- search.php | 2 - template/default/about.tpl | 31 +- template/default/admin.tpl | 21 + template/default/admin.vtp | 66 -- template/default/admin/comments.vtp | 81 --- template/default/admin/configuration.tpl | 233 +++++++ template/default/admin/configuration.vtp | 88 --- template/default/admin/help.tpl | 26 + template/default/admin/help.vtp | 26 - template/default/admin/search_username.tpl | 22 + template/default/admin/thumbnail.tpl | 160 +++++ template/default/admin/thumbnail.vtp | 188 ------ template/default/admin/update.tpl | 31 + template/default/admin/update.vtp | 49 -- template/default/admin/user_list.tpl | 101 +++ template/default/admin/user_list.vtp | 101 --- template/default/admin/user_modify.tpl | 95 +++ template/default/admin/user_modify.vtp | 95 --- template/default/admin/user_perm.tpl | 26 + template/default/admin/user_perm.vtp | 34 - template/default/admin/user_select_body.tpl | 7 + template/default/category.tpl | 32 +- template/default/comments.tpl | 102 ++- template/default/default-admin.css | 93 --- template/default/default.css | 282 +++++---- template/default/header.tpl | 7 +- template/default/htmlfunctions.inc.php | 110 ++-- template/default/identification.tpl | 107 ++-- template/default/install.tpl | 61 +- template/default/picture.tpl | 100 ++- template/default/profile.tpl | 170 +++-- template/default/register.tpl | 123 ++-- template/default/search.tpl | 79 +-- template/default/theme/01.gif | Bin 715 -> 0 bytes template/default/theme/02.gif | Bin 872 -> 0 bytes template/default/theme/03.gif | Bin 733 -> 0 bytes template/default/theme/04.gif | Bin 870 -> 0 bytes template/default/theme/05.gif | Bin 916 -> 0 bytes template/default/theme/06.gif | Bin 965 -> 0 bytes template/default/theme/07.gif | Bin 721 -> 0 bytes template/default/theme/08.gif | Bin 865 -> 0 bytes template/default/theme/09.gif | Bin 721 -> 0 bytes template/default/theme/button_bg.gif | Bin 0 -> 500 bytes template/default/theme/left-arrow.jpg | Bin 1112 -> 1104 bytes template/default/theme/right-arrow.jpg | Bin 1108 -> 1086 bytes 73 files changed, 2491 insertions(+), 3538 deletions(-) create mode 100644 admin/search.php create mode 100644 admin/user_search.php create mode 100644 include/script.js delete mode 100644 include/vtemplate.class.php delete mode 100644 language/en_UK.iso-8859-1/lang.lang.php create mode 100644 language/infos.lang.php create mode 100644 template/default/admin.tpl delete mode 100644 template/default/admin.vtp delete mode 100644 template/default/admin/comments.vtp create mode 100644 template/default/admin/configuration.tpl delete mode 100644 template/default/admin/configuration.vtp create mode 100644 template/default/admin/help.tpl delete mode 100644 template/default/admin/help.vtp create mode 100644 template/default/admin/search_username.tpl create mode 100644 template/default/admin/thumbnail.tpl delete mode 100644 template/default/admin/thumbnail.vtp create mode 100644 template/default/admin/update.tpl delete mode 100644 template/default/admin/update.vtp create mode 100644 template/default/admin/user_list.tpl delete mode 100644 template/default/admin/user_list.vtp create mode 100644 template/default/admin/user_modify.tpl delete mode 100644 template/default/admin/user_modify.vtp create mode 100644 template/default/admin/user_perm.tpl delete mode 100644 template/default/admin/user_perm.vtp create mode 100644 template/default/admin/user_select_body.tpl delete mode 100644 template/default/default-admin.css delete mode 100644 template/default/theme/01.gif delete mode 100644 template/default/theme/02.gif delete mode 100644 template/default/theme/03.gif delete mode 100644 template/default/theme/04.gif delete mode 100644 template/default/theme/05.gif delete mode 100644 template/default/theme/06.gif delete mode 100644 template/default/theme/07.gif delete mode 100644 template/default/theme/08.gif delete mode 100644 template/default/theme/09.gif create mode 100644 template/default/theme/button_bg.gif diff --git a/about.php b/about.php index ed1bbef1e..7e13d604c 100644 --- a/about.php +++ b/about.php @@ -36,13 +36,11 @@ $title= $lang['about_page_title']; include(PHPWG_ROOT_PATH.'include/page_header.php'); $template->set_filenames(array('about'=>'about.tpl')); -initialize_template(); - $template->assign_vars(array( 'PAGE_TITLE' => $title, 'L_ABOUT' => $lang['about_message'], 'L_RETURN' => $lang['about_return'], - 'U_RETURN' => add_session_id('./category.php?'.$_SERVER['QUERY_STRING']) + 'U_RETURN' => add_session_id(PHPWG_ROOT_PATH.'category.php?'.$_SERVER['QUERY_STRING']) ) ); diff --git a/admin.php b/admin.php index d8b25ec64..7d32565c8 100644 --- a/admin.php +++ b/admin.php @@ -27,21 +27,10 @@ //----------------------------------------------------------- include define('PHPWG_ROOT_PATH','./'); +define('IN_ADMIN', true); include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); -include_once( './admin/include/isadmin.inc.php' ); -//----------------------------------------------------- template initialization -$vtp = new VTemplate; -$handle = $vtp->Open( './template/'.$user['template'].'/admin.vtp' ); -// language -$tpl = array( 'title_default','charset','install_warning' ); -templatize_array( $tpl, 'lang', $handle ); -$vtp->setGlobalVar( $handle, 'style', './template/'.$user['template'].'/'.$user['template'].'-admin.css'); -//-------------------------------------------------- install.php still exists ? -if ( is_file( './install.php' ) ) -{ - $vtp->addSession( $handle, 'install_warning' ); - $vtp->closeSession( $handle, 'install_warning' ); -} +include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' ); + //--------------------------------------- validating page and creation of title $page_valide = false; $title = ''; @@ -52,8 +41,8 @@ switch ( $_GET['page'] ) $title = $lang['title_liste_users']; $page_valide = true; break; case 'user_modify': $title = $lang['title_modify']; $page_valide = true; break; - case 'user_perm': - if ( !is_numeric( $_GET['user_id'] ) ) $_GET['user_id'] = -1; + case 'user_search': + /* if ( !is_numeric( $_GET['user_id'] ) ) $_GET['user_id'] = -1; $query = 'SELECT status,username'; $query.= ' FROM '.USERS_TABLE; $query.= ' WHERE id = '.$_GET['user_id']; @@ -71,14 +60,15 @@ switch ( $_GET['page'] ) else { $page_valide = false; - } - break; + }*/ + $title = $lang['title_user_perm']; + //.' '.$_POST['username']; + $page_valide = true; break; case 'group_list' : $title = $lang['title_groups']; $page_valide = true; break; case 'group_perm' : if ( !is_numeric( $_GET['group_id'] ) ) $_GET['group_id'] = -1; - $query = 'SELECT name'; - $query.= ' FROM '.PREFIX_TABLE.'groups'; + $query = 'SELECT name FROM '.GROUPS_TABLE; $query.= ' WHERE id = '.$_GET['group_id']; $query.= ';'; $result = mysql_query( $query ); @@ -127,16 +117,16 @@ switch ( $_GET['page'] ) $title = $lang['title_thumbnails']; if ( isset( $_GET['dir'] ) ) { - $title.= ' '.$lang['title_thumbnails_2'].' '; + $title.= ' '.$lang['title_thumbnails_2'].' '; // $_GET['dir'] contains : // ./galleries/vieux_lyon ou // ./galleries/vieux_lyon/visite ou // ./galleries/vieux_lyon/visite/truc ... $dir = explode( "/", $_GET['dir'] ); $title.= $dir[2]; - for ( $i = 3; $i < sizeof( $dir ) - 1; $i++ ) + for ( $i = 2; $i < sizeof( $dir ) - 1; $i++ ) { - $title.= ' > '.$dir[$i]; + $title.= ' > '.$dir[$i+1]; } $title.= ""; } @@ -154,43 +144,9 @@ switch ( $_GET['page'] ) $title = $lang['title_default']; break; } if ( $title == '' ) $title = $lang['title_default']; -$vtp->setGlobalVar( $handle, 'title', $title ); -//--------------------------------------------------------------------- summary -$link_start = './admin.php?page='; -// configuration -$vtp->addSession( $handle, 'summary' ); -$vtp->setVar( $handle, 'summary.indent', '' ); -$vtp->setVar( $handle, 'summary.link', - add_session_id( $link_start.'configuration' ) ); -$vtp->setVar( $handle, 'summary.name', $lang['menu_config'] ); -$vtp->closeSession( $handle, 'summary' ); -// users -$vtp->addSession( $handle, 'summary' ); -$vtp->setVar( $handle, 'summary.indent', '| ' ); -$vtp->setVar( $handle, 'summary.link', - add_session_id( $link_start.'user_list' ) ); -$vtp->setVar( $handle, 'summary.name', $lang['menu_users'] ); -$vtp->closeSession( $handle, 'summary' ); -// groups -$vtp->addSession( $handle, 'summary' ); -$vtp->setVar( $handle, 'summary.indent', '| ' ); -$vtp->setVar( $handle, 'summary.link', - add_session_id( $link_start.'group_list' ) ); -$vtp->setVar( $handle, 'summary.name', $lang['menu_groups'] ); -$vtp->closeSession( $handle, 'summary' ); -// categories -$vtp->addSession( $handle, 'summary' ); -$vtp->setVar( $handle, 'summary.indent', '| ' ); -$vtp->setVar( $handle, 'summary.link',add_session_id( $link_start.'cat_list')); -$vtp->setVar( $handle, 'summary.name', $lang['menu_categories'] ); -$vtp->closeSession( $handle, 'summary' ); + // waiting -$vtp->addSession( $handle, 'summary' ); -$vtp->setVar( $handle, 'summary.indent', '| ' ); -$vtp->setVar( $handle, 'summary.link', - add_session_id( $link_start.'waiting' ) ); -$query = 'SELECT id'; -$query.= ' FROM '.PREFIX_TABLE.'waiting'; +$query = 'SELECT id FROM '.WAITING_TABLE; $query.= " WHERE validated='false'"; $query.= ';'; $result = mysql_query( $query ); @@ -199,71 +155,60 @@ if ( mysql_num_rows( $result ) > 0 ) { $nb_waiting = ' [ '.mysql_num_rows( $result ).' ]'; } -$vtp->setVar( $handle, 'summary.name', $lang['menu_waiting'].$nb_waiting ); -$vtp->closeSession( $handle, 'summary' ); // comments -$vtp->addSession( $handle, 'summary' ); -$vtp->setVar( $handle, 'summary.indent', '| ' ); -$vtp->setVar( $handle, 'summary.link', - add_session_id( $link_start.'comments' ) ); -$query = 'SELECT id'; -$query.= ' FROM '.PREFIX_TABLE.'comments'; +$query = 'SELECT id FROM '.COMMENTS_TABLE; $query.= " WHERE validated='false'"; $query.= ';'; $result = mysql_query( $query ); -$nb_waiting = ''; +$nb_comments = ''; if ( mysql_num_rows( $result ) > 0 ) { - $nb_waiting = ' [ '.mysql_num_rows( $result ).' ]'; + $nb_comments = ' [ '.mysql_num_rows( $result ).' ]'; } -$vtp->setVar( $handle, 'summary.name', $lang['menu_comments'].$nb_waiting ); -$vtp->closeSession( $handle, 'summary' ); -// update -$vtp->addSession( $handle, 'summary' ); -$vtp->setVar( $handle, 'summary.indent', '| ' ); -$vtp->setVar( $handle, 'summary.link', - add_session_id( $link_start.'update' ) ); -$vtp->setVar( $handle, 'summary.name', $lang['menu_update'] ); -$vtp->closeSession( $handle, 'summary' ); -// thumbnails -$vtp->addSession( $handle, 'summary' ); -$vtp->setVar( $handle, 'summary.indent', '| ' ); -$vtp->setVar( $handle, 'summary.link', - add_session_id( $link_start.'thumbnail' ) ); -$vtp->setVar( $handle, 'summary.name', $lang['menu_thumbnails'] ); -$vtp->closeSession( $handle, 'summary' ); -// history -$vtp->addSession( $handle, 'summary' ); -$vtp->setVar( $handle, 'summary.indent', '| ' ); -$vtp->setVar( $handle, 'summary.link', - add_session_id( $link_start.'stats' ) ); -$vtp->setVar( $handle, 'summary.name', $lang['menu_history'] ); -$vtp->closeSession( $handle, 'summary' ); -// instructions -$vtp->addSession( $handle, 'summary' ); -$vtp->setVar( $handle, 'summary.indent', '| ' ); -$vtp->setVar( $handle, 'summary.link', - add_session_id( $link_start.'help' ) ); -$vtp->setVar( $handle, 'summary.name', $lang['menu_instructions'] ); -$vtp->closeSession( $handle, 'summary' ); -// back to thumbnails page -$vtp->addSession( $handle, 'summary' ); -$vtp->setVar( $handle, 'summary.indent', '| ' ); -$vtp->setVar( $handle, 'summary.link', add_session_id( './category.php' ) ); -$vtp->setVar( $handle, 'summary.name', $lang['menu_back'] ); -$vtp->closeSession( $handle, 'summary' ); + +$link_start = PHPWG_ROOT_PATH.'admin.php?page='; +//----------------------------------------------------- template initialization +include(PHPWG_ROOT_PATH.'include/page_header.php'); +$template->set_filenames( array('admin'=>'admin.tpl') ); + +$template->assign_vars(array( + 'L_CONFIG'=>$lang['menu_config'], + 'L_USERS'=>$lang['menu_users'], + 'L_GROUPS'=>$lang['menu_groups'], + 'L_CATEGORIES'=>$lang['menu_categories'], + 'L_WAITING'=>$lang['menu_waiting'].$nb_waiting, + 'L_COMMENTS'=>$lang['menu_comments'].$nb_comments, + 'L_UPDATE'=>$lang['menu_update'], + 'L_THUMBNAILS'=>$lang['menu_thumbnails'], + 'L_HISTORY'=>$lang['menu_history'], + 'L_FAQ'=>$lang['menu_instructions'], + 'L_RETURN'=>$lang['menu_back'], + + 'U_CONFIG'=>add_session_id($link_start.'configuration' ), + 'U_USERS'=>add_session_id($link_start.'user_search' ), + 'U_GROUPS'=>add_session_id($link_start.'group_list' ), + 'U_CATEGORIES'=>add_session_id($link_start.'cat_list' ), + 'U_WAITING'=>add_session_id($link_start.'waiting' ), + 'U_COMMENTS'=>add_session_id($link_start.'comments' ), + 'U_UPDATE'=>add_session_id($link_start.'update' ), + 'U_THUMBNAILS'=>add_session_id($link_start.'thumbnail' ), + 'U_HISTORY'=>add_session_id($link_start.'stats' ), + 'U_FAQ'=>add_session_id($link_start.'help' ), + 'U_RETURN'=>add_session_id(PHPWG_ROOT_PATH.'category.php') + )); + +//--------------------------------------------------------------------- summary +$link_start = PHPWG_ROOT_PATH.'admin.php?page='; //------------------------------------------------------------- content display if ( $page_valide ) { - include ( './admin/'.$_GET['page'].'.php' ); + if ($_GET['page']=='comments') include ( PHPWG_ROOT_PATH.'comments.php'); + else include ( PHPWG_ROOT_PATH.'admin/'.$_GET['page'].'.php' ); } else { - $vtp->setVar( - $handle, 'sub', - '
'.$lang['default_message'].'
' ); + $template->assign_vars(array ('ADMIN_CONTENT'=> '
'.$lang['default_message'].'
') ); } -//----------------------------------------------------------- html code display -$code = $vtp->Display( $handle, 0 ); -echo $code; +$template->pparse('admin'); +include(PHPWG_ROOT_PATH.'include/page_tail.php'); ?> 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(" "ù" => "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 @@ + | +// | 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 .= ''; + } + while ( $row = mysql_fetch_array($result) ); + } + else + { + $username_list .= ''; + } + 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.=''; } + 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&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&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 = '>'; - $output.= ''.$name.''; + $output = ''; } 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&update=cats' ), + 'U_ALL_UPDATE'=>add_session_id( PHPWG_ROOT_PATH.'admin.php?page=update&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&update=cats' ); - $vtp->setVar( $sub, 'introduction.only_cat:url', $url ); - // update the entire tree folder - $url = add_session_id( './admin.php?page=update&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
'; - $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
'; + $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
'; } //----------------------------------------------------------- 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 .= ''; + } + while ( $row = $db->sql_fetchrow($result) ); + } + else + { + $username_list .= ''; + } + $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&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 @@ + | +// | 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&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&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'],' > ', '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'); +?> diff --git a/category.php b/category.php index d837c7445..a4c749e42 100644 --- a/category.php +++ b/category.php @@ -54,7 +54,7 @@ function display_category( $category, $indent ) { global $user,$template,$page; - $url = './category.php?cat='.$category['id']; + $url = PHPWG_ROOT_PATH.'category.php?cat='.$category['id']; $style = ''; if ( isset( $page['cat'] ) @@ -65,7 +65,7 @@ function display_category( $category, $indent ) } $name = $category['name']; - if ( $name == '' ) $name = str_replace( '_', ' ', $category['dir'] ); + if (empty($name)) $name = str_replace( '_', ' ', $category['dir'] ); $template->assign_block_vars( 'category', @@ -89,7 +89,7 @@ function display_category( $category, $indent ) } else { - $url = './category.php'; + $url = PHPWG_ROOT_PATH.'category.php'; if (isset($page['cat'])) { $url .='?cat='.$page['cat']; @@ -115,9 +115,10 @@ function display_category( $category, $indent ) // recursive call if ( $category['expanded'] ) { - foreach ( $category['subcats'] as $subcat ) { + foreach ( $category['subcats'] as $subcat ) + { $template->assign_block_vars('category.subcat', array()); - display_category( $subcat, $indent.str_repeat( ' ', 2 )); + display_category( $subcat, $indent.str_repeat( ' ', 2 )); } } } @@ -243,7 +244,7 @@ $template->assign_vars(array( 'U_FAVORITE' => add_session_id( PHPWG_ROOT_PATH.'category.php?cat=fav' ), 'U_MOST_VISITED'=>add_session_id( PHPWG_ROOT_PATH.'category.php?cat=most_visited' ), 'U_RECENT'=>add_session_id( PHPWG_ROOT_PATH.'category.php?cat=recent' ), - 'U_LOGOUT' => add_session_id( PHPWG_ROOT_PATH.'category.php?act=logout' ), + 'U_LOGOUT' => PHPWG_ROOT_PATH.'category.php?act=logout', 'U_ADMIN'=>add_session_id( PHPWG_ROOT_PATH.'admin.php' ), 'U_PROFILE'=>add_session_id(PHPWG_ROOT_PATH.'profile.php?'.str_replace( '&', '&', $_SERVER['QUERY_STRING'] )) ) @@ -383,17 +384,16 @@ if ( isset( $page['cat'] ) && $page['cat_nb_images'] != 0 ) 'U_IMG_LINK'=>add_session_id( $url_link ) )); - + if ( $conf['show_comments'] && $user['show_nb_comments'] ) { - $vtp->addSession( $handle, 'nb_comments' ); $query = 'SELECT COUNT(*) AS nb_comments'; $query.= ' FROM '.COMMENTS_TABLE.' WHERE image_id = '.$row['id']; $query.= " AND validated = 'true'"; $query.= ';'; $row = mysql_fetch_array( mysql_query( $query ) ); - $vtp->setVar( $handle, 'nb_comments.nb', $row['nb_comments'] ); - $vtp->closeSession( $handle, 'nb_comments' ); + $template->assign_block_vars( 'thumbnails.line.thumbnail.nb_comments', + array('NB_COMMENTS'=>$row['nb_comments']) ); } } } @@ -446,7 +446,7 @@ else $thumbnail_title = $lang['hint_category']; - $url_link = './category.php?cat='.$subcat_id; + $url_link = PHPWG_ROOT_PATH.'category.php?cat='.$subcat_id; $date = $page['plain_structure'][$subcat_id]['date_last']; @@ -483,7 +483,7 @@ if ( isset ( $page['cat'] ) ) and $conf['upload_available'] and $page['cat_uploadable'] ) { - $url = './upload.php?cat='.$page['cat']; + $url = PHPWG_ROOT_PATH.'upload.php?cat='.$page['cat']; $template->assign_block_vars('upload',array('U_UPLOAD'=>add_session_id( $url ))); } } diff --git a/comments.php b/comments.php index 19503ccaa..1ae42749f 100644 --- a/comments.php +++ b/comments.php @@ -26,8 +26,11 @@ // +-----------------------------------------------------------------------+ //----------------------------------------------------------- include -define('PHPWG_ROOT_PATH','./'); -include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); +if (!defined('IN_ADMIN')) +{ + define('PHPWG_ROOT_PATH','./'); + include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); +} //--------------------------------------------------- number of days to display if ( isset( $_GET['last_days'] ) ) define( 'MAX_DAYS', $_GET['last_days'] ); @@ -36,28 +39,60 @@ else define( 'MAX_DAYS', 0 ); $array_cat_directories = array(); $array_cat_names = array(); $array_cat_site_id = array(); + +// comment deletion +if ( isset( $_POST['delete'] ) ) +{ + $mod_sql=''; + while( list($id, $row_id) = @each($_POST['comment_id']) ) + { + $mod_sql .= ( ( $mod_sql != '' ) ? ', ' : '' ) . $row_id; + } + $query = 'DELETE FROM '.COMMENTS_TABLE.' WHERE id IN ('.$mod_sql.');'; + mysql_query( $query ); +} + +//--------------------------------------------------------- comments validation +if ( isset( $_POST['validate'] ) ) +{ + $mod_sql=''; + while( list($id, $row_id) = @each($_POST['comment_id']) ) + { + $mod_sql .= ( ( $mod_sql != '' ) ? ', ' : '' ) . $row_id; + } + $query = 'UPDATE '.COMMENTS_TABLE; + $query.= " SET validated = 'true'"; + $query.=' WHERE id IN ('.$mod_sql.');'; + mysql_query( $query ); +} //------------------------------------------------------- last comments display // // Start output of page // -$title= $lang['title_comments']; -include(PHPWG_ROOT_PATH.'include/page_header.php'); +if (!defined('IN_ADMIN')) +{ + $title= $lang['title_comments']; + include(PHPWG_ROOT_PATH.'include/page_header.php'); +} $template->set_filenames( array('comments'=>'comments.tpl') ); -initialize_template(); - $template->assign_vars(array( - 'L_TITLE' => $lang['title_comments'], - 'L_STATS' => $lang['stats_last_days'], - 'L_RETURN' => $lang['search_return_main_page'], + 'L_COMMENT_TITLE' => $title, + 'L_COMMENT_STATS' => $lang['stats_last_days'], + 'L_COMMENT_RETURN' => $lang['search_return_main_page'], + 'L_DELETE' =>$lang['delete'], + 'L_VALIDATE'=>$lang['submit'], - 'U_HOME' => add_session_id( 'category.php' ) + 'T_DEL_IMG' =>PHPWG_ROOT_PATH.'template/'.$user['template'].'/theme/delete.gif', + + 'U_HOME' => add_session_id( PHPWG_ROOT_PATH.'category.php' ) ) ); foreach ( $conf['last_days'] as $option ) { - $url = './comments.php?last_days='.($option - 1); + $url = $PHP_SELF.'?last_days='.($option - 1); + if (defined('IN_ADMIN')) $url.= '&page=comments'; $template->assign_block_vars('last_day_option', array ( 'OPTION'=>$option, 'T_STYLE'=>(( $option == MAX_DAYS + 1 )?'text-decoration:underline;':''), @@ -70,22 +105,28 @@ $date = date( 'Y-m-d', time() - ( MAX_DAYS*24*60*60 ) ); list($year,$month,$day) = explode( '-', $date); $maxtime = mktime( 0,0,0,$month,$day,$year ); $query = 'SELECT DISTINCT(ic.image_id) as image_id,'; -$query .= '(ic.category_id) as category_id'; -$query.= ' FROM '.PREFIX_TABLE.'comments AS c'; -$query.= ', '.PREFIX_TABLE.'image_category AS ic'; +$query.= '(ic.category_id) as category_id'; +$query.= ' FROM '.COMMENTS_TABLE.' AS c'; +$query.= ', '.IMAGE_CATEGORY_TABLE.' AS ic'; $query.= ' WHERE c.image_id = ic.image_id'; $query.= ' AND date > '.$maxtime; -$query.= " AND validated = 'true'"; -// we must not show pictures of a forbidden category -if ( $user['forbidden_categories'] != '' ) +if ( $user['status'] != 'admin' ) { - $query.= ' AND category_id NOT IN '; - $query.= '('.$user['forbidden_categories'].')'; + $query.= " AND validated = 'true'"; + // we must not show pictures of a forbidden category + if ( $user['forbidden_categories'] != '' ) + { + $query.= ' AND category_id NOT IN '; + $query.= '('.$user['forbidden_categories'].')'; + } } $query.= ' ORDER BY ic.image_id DESC'; $query.= ';'; $result = mysql_query( $query ); - +if ( $user['status'] == 'admin' ) +{ + $template->assign_block_vars('validation', array()); +} while ( $row = mysql_fetch_array( $result ) ) { $category_id=$row['category_id']; @@ -112,7 +153,7 @@ while ( $row = mysql_fetch_array( $result ) ) $file = get_filename_wo_extension( $subrow['file'] ); // name of the picture $name = $array_cat_names[$category_id].' > '; - if ( $subrow['name'] != '' ) $name.= $subrow['name']; + if (!empty($subrow['name'])) $name.= $subrow['name']; else $name.= str_replace( '_', ' ', $file ); $name.= ' [ '.$subrow['file'].' ]'; // source of the thumbnail picture @@ -120,7 +161,7 @@ while ( $row = mysql_fetch_array( $result ) ) $src.= 'thumbnail/'.$conf['prefix_thumbnail']; $src.= $file.'.'.$subrow['tn_ext']; // link to the full size picture - $url = './picture.php?cat='.$category_id; + $url = PHPWG_ROOT_PATH.'picture.php?cat='.$category_id; $url.= '&image_id='.$row['image_id']; $template->assign_block_vars('picture',array( @@ -130,18 +171,20 @@ while ( $row = mysql_fetch_array( $result ) ) )); // for each picture, retrieving all comments - $query = 'SELECT id,date,author,content'; - $query.= ' FROM '.COMMENTS_TABLE; + $query = 'SELECT * FROM '.COMMENTS_TABLE; $query.= ' WHERE image_id = '.$row['image_id']; $query.= ' AND date > '.$maxtime; - $query.= " AND validated = 'true'"; + if ( $user['status'] != 'admin' ) + { + $query.= " AND validated = 'true'"; + } $query.= ' ORDER BY date DESC'; $query.= ';'; $handleresult = mysql_query( $query ); while ( $subrow = mysql_fetch_array( $handleresult ) ) { $author = $subrow['author']; - if ( $subrow['author'] == '' ) $author = $lang['guest']; + if ( empty($subrow['author'] )) $author = $lang['guest']; $content = nl2br( $subrow['content'] ); // replace _word_ by an underlined word @@ -159,13 +202,28 @@ while ( $row = mysql_fetch_array( $result ) ) $replacement = '\1'; $content = preg_replace( $pattern, $replacement, $content ); $template->assign_block_vars('picture.comment',array( - 'AUTHOR'=>$author, - 'DATE'=>format_date( $subrow['date'], 'unix', true ), - 'CONTENT'=>$content, + 'COMMENT_AUTHOR'=>$author, + 'COMMENT_DATE'=>format_date( $subrow['date'], 'unix', true ), + 'COMMENT'=>$content, )); + if ( $user['status'] == 'admin' ) + { + $template->assign_block_vars('picture.comment.validation', array( + 'ID'=> $subrow['id'], + 'CHECKED'=>($subrow['validated']=='false')?'checked="checked"': '' + )); + } } } //----------------------------------------------------------- html code display -$template->pparse('comments'); -include(PHPWG_ROOT_PATH.'include/page_tail.php'); +if (defined('IN_ADMIN')) +{ + $template->assign_var_from_handle('ADMIN_CONTENT', 'comments'); +} +else +{ + $template->assign_block_vars('title',array()); + $template->pparse('comments'); + include(PHPWG_ROOT_PATH.'include/page_tail.php'); +} ?> diff --git a/identification.php b/identification.php index ac2477d27..44cde32fd 100644 --- a/identification.php +++ b/identification.php @@ -60,7 +60,6 @@ $title = $lang['ident_page_title']; include(PHPWG_ROOT_PATH.'include/page_header.php'); $template->set_filenames( array('identification'=>'identification.tpl') ); -initialize_template(); $template->assign_vars(array( 'MAIL_ADMIN' => $conf['mail_webmaster'], diff --git a/include/common.inc.php b/include/common.inc.php index f3f6fa945..2478850a9 100644 --- a/include/common.inc.php +++ b/include/common.inc.php @@ -125,7 +125,6 @@ include(PHPWG_ROOT_PATH . 'include/constants.php'); include(PHPWG_ROOT_PATH . 'include/config.inc.php'); include(PHPWG_ROOT_PATH . 'include/functions.inc.php'); include(PHPWG_ROOT_PATH . 'include/template.php'); -include(PHPWG_ROOT_PATH . 'include/vtemplate.class.php'); // // Database connection @@ -202,6 +201,5 @@ include(PHPWG_ROOT_PATH . 'include/user.inc.php'); // displaying the username in the language of the connected user, instead of // "guest" as you can find in the database if ( $user['is_the_guest'] ) $user['username'] = $lang['guest']; -include_once( './template/'.$user['template'].'/htmlfunctions.inc.php' ); define('PREFIX_TABLE', $table_prefix); ?> diff --git a/include/config.inc.php b/include/config.inc.php index e4185dcb9..47175ec44 100644 --- a/include/config.inc.php +++ b/include/config.inc.php @@ -54,7 +54,7 @@ $conf['top_number'] = 10; $conf['anti-flood_time'] = 60; // seconds between 2 comments : 0 to disable $conf['max_LOV_categories'] = 50; -$conf['default_lang'] = 'fr_FR'; $conf['default_style'] = 'default'; ?> + diff --git a/include/constants.php b/include/constants.php index 473bacfdc..ddc6a639d 100644 --- a/include/constants.php +++ b/include/constants.php @@ -29,6 +29,9 @@ define('DEBUG', 1); // Debugging on //define('DEBUG', 0); // Debugging off +// User level +define('ANONYMOUS', 2); + // Error codes define('GENERAL_MESSAGE', 200); define('GENERAL_ERROR', 202); @@ -40,7 +43,7 @@ define('CATEGORIES_TABLE', $table_prefix.'categories'); define('COMMENTS_TABLE', $table_prefix.'comments'); define('CONFIG_TABLE', $table_prefix.'config'); define('FAVORITES_TABLE', $table_prefix.'favorites'); -define('GROUPS_ACCESS_TABLE', $table_prefix.'group_access'); +define('GROUP_ACCESS_TABLE', $table_prefix.'group_access'); define('GROUPS_TABLE', $table_prefix.'groups'); define('HISTORY_TABLE', $table_prefix.'history'); define('IMAGE_CATEGORY_TABLE', $table_prefix.'image_category'); diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php index 34697897f..0c6671974 100644 --- a/include/functions_user.inc.php +++ b/include/functions_user.inc.php @@ -229,42 +229,29 @@ function check_login_authorization() // Initialise user settings on page load function init_userprefs($userdata) { - global $conf, $template, $lang, $lang_mapping; - $style = $conf['default_style']; - if ( !$userdata['is_the_guest'] ) - { - if ( !empty($userdata['language'])) - { - $conf['default_lang'] = $userdata['language']; - } - if ( !empty($userdata['template'])) - { - $style = $userdata['template']; - } - } - - if ( !file_exists(@realpath(PHPWG_ROOT_PATH . 'language/' . $conf['default_lang'] . '/common.lang.php')) ) - { - $conf['default_lang'] = 'en_EN'; - } - include_once(PHPWG_ROOT_PATH . 'language/' . $conf['default_lang'] . '/common.lang.php'); + global $conf, $template, $lang, $lang_info; + include_once(PHPWG_ROOT_PATH . 'language/infos.lang.php'); - if ( !file_exists(@realpath(PHPWG_ROOT_PATH . 'language/' . $conf['default_lang'] . '/lang.lang.php')) ) + $language = (!empty($userdata['language']) && !$userdata['is_the_guest'] )?$userdata['language']:$conf['default_lang']; + $style = (!empty($userdata['template'])&& !$userdata['is_the_guest'] )?$userdata['template']:$conf['default_style']; + + if ( !file_exists(@realpath(PHPWG_ROOT_PATH . 'language/' . $language . '/common.lang.php')) ) { - $conf['default_lang'] = 'en_EN'; + $language = 'en_EN'; } - include_once(PHPWG_ROOT_PATH . 'language/' . $conf['default_lang'] . '/lang.lang.php'); + include_once(PHPWG_ROOT_PATH . 'language/' . $language . '/common.lang.php'); + if ($userdata['status'] == 'admin') { - $admin_lang = $userdata['language']; - if ( !file_exists(@realpath(PHPWG_ROOT_PATH . 'language/' . $conf['default_lang'] . '/admin.lang.php')) ) + if ( !file_exists(@realpath(PHPWG_ROOT_PATH . 'language/' . $language. '/admin.lang.php')) ) { - $admin_lang = 'en_EN'; + $language = 'en_EN'; } - include_once(PHPWG_ROOT_PATH . 'language/' . $admin_lang . '/admin.lang.php'); + include_once(PHPWG_ROOT_PATH . 'language/' . $language . '/admin.lang.php'); } - + + $lang_info['current_code']=$language; $template= setup_style($style); return; } @@ -280,13 +267,22 @@ function setup_style($style) function encode_ip($dotquad_ip) { - $ip_sep = explode('.', $dotquad_ip); - return sprintf('%02x%02x%02x%02x', $ip_sep[0], $ip_sep[1], $ip_sep[2], $ip_sep[3]); + $ip_sep = explode('.', $dotquad_ip); + return sprintf('%02x%02x%02x%02x', $ip_sep[0], $ip_sep[1], $ip_sep[2], $ip_sep[3]); } function decode_ip($int_ip) { - $hexipbang = explode('.', chunk_split($int_ip, 2, '.')); - return hexdec($hexipbang[0]). '.' . hexdec($hexipbang[1]) . '.' . hexdec($hexipbang[2]) . '.' . hexdec($hexipbang[3]); + $hexipbang = explode('.', chunk_split($int_ip, 2, '.')); + return hexdec($hexipbang[0]). '.' . hexdec($hexipbang[1]) . '.' . hexdec($hexipbang[2]) . '.' . hexdec($hexipbang[3]); +} + +function getuserdata($user) +{ + $sql = "SELECT * FROM " . USERS_TABLE; + $sql.= " WHERE "; + $sql .= ( ( is_integer($user) ) ? "id = $user" : "username = '" . str_replace("\'", "''", $user) . "'" ) . " AND id <> " . ANONYMOUS; + $result = mysql_query($sql); + return ( $row = mysql_fetch_array($result) ) ? $row : false; } ?> diff --git a/include/page_header.php b/include/page_header.php index af28eba0e..6067c65e8 100644 --- a/include/page_header.php +++ b/include/page_header.php @@ -30,20 +30,27 @@ // $template->set_filenames(array('header'=>'header.tpl')); -$css = './template/'.$user['template'].'/'.$user['template'].'.css'; +$charset = empty($lang_info['charset'][$lang_info['current_code']])? + $lang_info['default']['charset']:$lang_info['charset'][$lang_info['current_code']]; +$dir = empty($lang_info['direction'][$lang_info['current_code']])? + $lang_info['default']['direction']:$lang_info['direction'][$lang_info['current_code']]; +$css = PHPWG_ROOT_PATH.'template/'.$user['template'].'/'.$user['template'].'.css'; $template->assign_vars(array( - 'S_CONTENT_ENCODING' => $lang['charset'], - 'T_STYLE' => $css, - 'PAGE_TITLE' => $title - )); + 'CONTENT_ENCODING' => $charset, + 'PAGE_TITLE' => $title, + 'LANG'=>substr($lang_info['current_code'],0,2), + 'DIR'=>$dir, + + 'T_STYLE' => $css + )); // refresh if ( isset( $refresh ) && $refresh >0 && isset($url_link)) { $url = $url_link.'&slideshow='.$refresh; $template->assign_vars(array( - 'S_REFRESH_TIME' => $refresh, + 'REFRESH_TIME' => $refresh, 'U_REFRESH' => add_session_id( $url ) )); $template->assign_block_vars('refresh', array()); @@ -64,5 +71,4 @@ header( 'Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT' ); header( 'Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT' ); $template->pparse('header'); -$vtp=new VTemplate; ?> diff --git a/include/script.js b/include/script.js new file mode 100644 index 000000000..7821299c6 --- /dev/null +++ b/include/script.js @@ -0,0 +1,28 @@ +function SelectAll( formulaire ) +{ +len = formulaire.elements.length; +var i=0; +for( i = 0; i < len; i++) +{ + if ( formulaire.elements[i].type=='checkbox' + && formulaire.elements[i].name != 'copie') + { + formulaire.elements[i].checked = true; + } +} +} + +function Inverser( formulaire ) +{ +len = formulaire.elements.length; +var i=0; +for( i=0; i | -// | 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. | -// +-----------------------------------------------------------------------+ -// to make it work on nexen.net -set_magic_quotes_runtime(0); - -if ( !isset( $DEFINE_VTEMPLATE ) ) -{ - define("ALL",1); - // Tag d'ouverture des variables : vous pouvez changer ce paramètre. - define("VARTAG","{#"); - define("VTEMPLATE_VERSION","1.3.1"); - define("VTEMPLATE_TYPE","BA"); - define("VTEMPLATE_BUILD","6"); - - class Err { - var $msg; - var $titre; - - function error( $errno, $arg = "", $code = 0, $disp = 0 ) { - // Gestion des erreurs - switch ( $errno ) - { - case 1: - $this->titre="Erreur de session n° $code"; - $this->msg = "La zone $arg est déjà ouverte.Avant d'ajouter une session sur cette zone, vous devez la fermer à l'aide de la fonction closeSession().
" ; - break; - case 2: - $this->titre="Erreur de session n° $code"; - $this->msg = "Vous tentez de fermer une session de la zone $arg alors qu'aucune session pour cette zone n'existe.Pour ouvrir une session, utilisez la fonction addSession().
"; - break; - case 3: - $this->titre="Erreur de session n° $code"; - $var = $arg[1]; - $zone = $arg[0]; - $this->msg = "Vous essayez de valoriser la variable $var sans avoir créer de session de la zone $zone.Utilisez la fonction addSession() pour créer une session, puis setVar pour valoriser une variable.
"; - break; - case 4: - $this->titre="Erreur de session n° $code"; - $var = $arg[1]; - $zone = $arg[0]; - $this->msg = "La variable $var que vous souhaitez valoriser n'existe pas dans la zone $zone.
"; - break; - case 5: - $this->titre="Erreur de parsing n° $code"; - $this->msg = "Vous utilisez des caractère non autorisés pour déclarer vos zones.Vous pouvez utiliser tous les caractères à l'exception de \'{\' , \'#\' \'}\' et \'|\'.
"; - break; - case 6: - $this->titre="Erreur de parsing n° $code"; - $this->msg = "Vous ne pouvez pas utiliser le même nom ($arg)de zone plusieurs fois.
"; - break; - case 7: - $this->titre="Erreur de parsing n° $code"; - $this->msg = "Vous avez oublié de fermer la zone $arg.
"; - break; - case 8: - $this->titre="Erreur de traitement n° $code"; - $this->msg = "Le fichier template $arg est introuvable.
"; - break; - case 9: - $this->titre="Erreur de traitement n° $code"; - $this->msg = "Impossible d'ouvrir le fichier $arg.Vérifiez les droits de ce fichier.
"; - break; - case 10: - $this->titre="Erreur de traitement n° $code"; - $this->msg = "Impossible de lire le fichier template $arg.
"; - break; - case 11: - $this->titre="Erreur de traitement n° $code"; - $this->msg = "La zone $arg est introuvable.Vérifiez la syntaxe de cette zone.
"; - break; - case 12: - $this->titre="Erreur de traitement n° $code"; - $this->msg = "La variable $arg est introuvable .Vérifiez la syntaxe de la variable.
"; - break; - case 13: - $this->titre="Erreur de traitement n° $code"; - $this->msg = "L'identifiant de fichier spécifié n'existe pas.Vérifiez les fonctions Open() de votre script.
"; - break; - case 14: - $this->titre="Erreur de traitement n° $code"; - $var = $arg[1]; - $file = $arg[0]; - $this->msg = "La variable $var dans le fichier $file est introuvable.Vérifiez la syntaxe de la variable.
"; - break; - case 15: - $this->titre="Erreur de traitement n° $code"; - $var = $arg[2]; - $zone = $arg[1]; - $fichier = $arg[0]; - $this->msg = "La variable $var dans la zone $zone du fichier $fichier est introuvable.Vérifiez la syntaxe de la variable et du nom de la zone.
"; - break; - default: - $this->titre = "Erreur inconnue $code"; - $this->msg = "Veuillez le rapporter aux auteurs de la classe."; - } - $this->titre .= ":
"; - if ( $disp ) - { - $web = "Pour plus d'informations, consultez la doc en ligne"; - echo "$this->titre$this->msg$web

"; - } - return -1; - } - } // Fin classe - - class Session extends err { - var $name; // Name of the session - var $globalvar = array(); // List of global variable of the session - var $varlist = array(); // List of var in this session - var $subzone = array(); // list of sub-zone - var $temp; // Generated code for the current session - var $generated = NULL; // The final code - var $source; // Source code - var $used=0; // Indicates if the session contain used variable - var $stored; // Give the filename were is stored the session - - function Session( $name, $source, $stored ) { - $this->name = $name; - $this->source = $source; - $this->stored = $stored; - $this->parseVar(); - } - - function parseVar(){ - // Récupération des noms des variables - $regle = "|".VARTAG."(.*)}|sU"; - preg_match_all ($regle,$this->source,$var1); - // Création du tableau de variable à partir de la liste parsée. - $this->varlist=@array_merge($var[1],$var1[1]); - return 1; - } - - function init(){ - if ( $this->used ) - return $this->error(1,array($this->stored,$this->name),"SESSION1",1); - // Reset generated code - $this->temp = $this->source; - $this->used = 1; - } - - function closeSession(){ - // Check if the zone has been used. - if ( !$this->used ) - return $this->error(2,array($this->stored,$this->name),"SESSION2",1); - // Set Globals vars. - $this->generateCode(); - $this->used=0; - return 1; - } - - function reset(){ - $this->used = 0; - $this->generated = NULL; - return 1; - } - - function addSubZone( &$subzone ) { - $this->subzone[$subzone->name] = &$subzone; - return 1; - } - - function setVar($varname,$value){ - if ( !$this->used ) - return $this->error(3,array($this->stored,$this->name,$varname), - "SESSION3",1); - if (!in_array($varname,$this->varlist)) - return $this->error(4,array($this->name,$varname),"SESSION4",1); - $regle = "(\\".VARTAG."$varname\})"; - $this->temp = preg_replace($regle,$value,$this->temp); - return 1; - } - - function dispVar(){ - echo "Liste variables de $this->name:
"; - foreach ( $this->varlist as $vars ) echo "$vars
"; - } - - function setGlobalVar($varname,$value){ - $set = 0; - if (in_array($varname,$this->varlist ) ) - { - // Replace the var into this session - $this->globalvar[$varname]=$value; - $set = 1; - } - // Replace the var into sub zones - foreach(array_keys($this->subzone) as $subzone){ - $set = $this->subzone[$subzone]->setGlobalVar($varname,$value) || $set; - } - return $set; - } - - function replaceGlobalVar(){ - if ( count($this->globalvar) ) - { - foreach($this->globalvar as $varname => $value) { - $regle = "(\\".VARTAG."$varname\})"; - $this->temp = preg_replace($regle,$value,$this->temp); - } - } - } - - - function generateCode(){ - if ($this->used == 0) return $this->generated; - // Replace global var. - if ( count($this->globalvar) ) $this->replaceGlobalVar(); - // Replace all unused variable by "" - $regle = "|\\".VARTAG."([^}]*)\}|"; - $this->temp = preg_replace($regle,"",$this->temp); - // Generate the subzone(s) code - if(count($this->subzone)){ - foreach(array_keys($this->subzone) as $subzone){ - $text = ($this->subzone[$subzone]->used) ? $this->subzone[$subzone]->generateCode() : $this->subzone[$subzone]->generated; - $this->temp = preg_replace("(\|$subzone\|)",$text,$this->temp); - $this->subzone[$subzone]->reset(); - } - } - $this->generated .= $this->temp; - return $this->generated; - } - - function inVarList($varname){ - return in_array($varname,$this->varlist); - } - } // Fin classe - - class VTemplate_Private extends Err{ - /**************************************** - * Private Class. * - ****************************************/ - - var $sources=array(); // Sources des zones issues - // de la premiere partie du parsing. - var $sessions=array(); // Tableau de sessions - var $v_global=array(); // Globla var array. - -/**************************************************************** - Parsing Functions for Template files. ( PF 1.0 ) - ****************************************************************/ - - function getNom($code){ - // Retourne le premier nom de zone qu'il trouve dans le code - preg_match("()sU",$code,$reg); - // Tester la présence des caratère invalides dans le nom ( | et {}); - if ( @count( explode("|",$reg[1]))>1 - || @count(explode("{",$reg[1]))>1 - || @count(explode("}",$reg[1]))>1 ) - exit($this->error(5,$reg[1],"PARSE1",1)); - return @$reg[1]; - } - - function endTag($code,$nom){ - // Renvoie TRUE(1) si le tag de fermeture est présent. - preg_match("()sU",$code,$reg); - return ($reg[0]!="") ? 0 : 1; - } - - function getSource($code,$nom,$type=0){ - // Retourne le source de la zone de nom $nom - preg_match_all ("((.*))sU",$code,$reg); - return $reg[$type][0]; - } - - function parseZone($code_source,$nom_zone="|root|"){ - // Fonction récursive de parsing du fichier template - // Vérification que la zone n'existe pas - if (isset($this->sources[$nom_zone])) - exit($this->error(6,$nom_zone,"PARSE2",1)); - // Enregistrement du code source - $this->sources[$nom_zone]["source"]=$code_source; - // Rappel de la fonction pour chaque fils. - while ($nom_fils=$this->getNom($this->sources[$nom_zone]["source"]) ) { - // Vérification que le tag de fin est présent. - if (!$this->endTag($code_source,$nom_fils)) - exit($this->error(7,$nom_fils,"PARSE3",1)); - // Parse le fils - $this->parseZone($this->getSource($this->sources[$nom_zone]["source"],$nom_fils,1),$nom_fils); - // Enregistre le nom du fils dans la liste des fils - $this->sources[$nom_zone]["fils"][]=$nom_fils; - // Remplace le code du fils dans le source du père - $this->sources[$nom_zone]["source"]=str_replace( - $this->getSource($this->sources[$nom_zone]["source"],$nom_fils,0), - "|$nom_fils|", - $this->sources[$nom_zone]["source"]); - // Teste si la zone $nom_fils n'existe pas plusieurs fois - // dans la zone $nom_zone - if (count(explode("|$nom_fils|",$this->sources[$nom_zone]["source"]))>2) - exit($this->error(6,$nom_fils,"PARSE4",1)); - } // fin While - return 1; - } - -/**************************************************************** - Session Management functions ( SMF 1.0 ) - ****************************************************************/ - - function createSession($handle,$zone = "|root|"){ - // Create a new session of the zone - $this->sessions[$handle][$zone] = new Session($zone,$this->sources[$zone]["source"],$this->file_name[$handle]); - // Create sub-zone - if (@count($this->sources[$zone]["fils"])){ - foreach($this->sources[$zone]["fils"] as $subzone){ - $this->createSession($handle,$subzone); - $this->sessions[$handle][$zone]->addSubZone($this->sessions[$handle][$subzone]); - } - } - //end createSession - } - - -/**************************************************************** - Global Variable Management Functions ( GVMF 1.0 ) - ****************************************************************/ - - function setGZone($handle,$zone,$var,$value){ - // Define Global var for $zone and its sub-zone. - // Set global value to $zone vars. - return $this->sessions[$handle][$zone]->setGlobalVar($var,$value); - } - - function setGFile($handle,$var,$value) { - return $this->sessions[$handle]["|root|"]->setGlobalVar($var,$value); - } - - function setGAll($var,$value){ - $declare = 0; - $this->v_global[$var]=$value; - if (is_array($this->sessions)){ - foreach($this->sessions as $handle => $v){ - $declare = $this->setGFile($handle,$var,$value) || $declare; - } - } - return $declare; - } - - function setGOpened($handle){ -// Set Global var into the opened file - foreach($this->v_global as $name => $val){ - $this->setGFile($handle,$name,$val); - } - return 1; - } - -// Fin VTemplate_Private - } - - - class VTemplate extends VTemplate_Private{ -/**************************************** - * Public Class. * - * ***************************************/ - - -/**************************************************************** - Core Functions -*****************************************************************/ - - - function Open($nomfichier){ -// Ouverture d'un fichier source et retourne le handle de ce fichier -// Création du handle: - $handle = "{".count($this->sessions)."}" ; - - -// Récupération du source à parser - if (!@file_exists($nomfichier)) return $this->error(8,$nomfichier,"TTT1",1); - if (!$f_id=@fopen($nomfichier,"r")) return $this->error(9,$nomfichier,"TTT2",1); - if (!$source=@fread($f_id, filesize($nomfichier))) return $this->error(10,$nomfichier,"TTT3",1); - clearstatcache(); - fclose($f_id); - -// Store the filename - $this->file_name[$handle]=$nomfichier; - -// Parse les zones - $this->parseZone($source); - -// Création du tableau de session - $this->createSession($handle); - -//Nettoyage des variables temporaires - $this->sources=NULL; - -// Set global var. - $this->setGOpened($handle); - - $this->addSession($handle); - return $handle; - } - - function newSession($handle="{0}",$nom_zone = "|root|"){ - if ( $this->sessions[$handle][$nom_zone]->used ) $this->closeSession($handle,$nom_zone); - $this->addSession($handle,$nom_zone,$cache,$time,$num_session); - return 1; - } - - function addSession($handle="{0}",$nom_zone = "|root|"){ - // Does the zone exist ? - if(!isset($this->sessions[$handle][$nom_zone])) return $this->error(11,array($nom_zone,$this->file_name[$handle]),"TTT4",1); - $this->sessions[$handle][$nom_zone]->init(); - return 1; - } - - function closeSession($handle="{0}",$nom_zone = "|root|"){ -// Close the current session and all his sub-session - // Check if the zone exists. - if(!isset($this->sessions[$handle][$nom_zone])) return $this->error(11,array($nom_zone,$this->file_name[$handle]),"TTT5",1); - // Closing sub-zone - $this->sessions[$handle][$nom_zone]->closeSession(); - return 1; - } - - function setGlobalVar($arg1,$arg2,$arg3){ - if ($arg1 == 1){ - if (!$this->setGAll($arg2,$arg3)) return $this->error(12,$arg2,"TTT6",1); - return 1; - } - if (!isset($this->sessions[$arg1])) return $this->error(13,$arg1,"TTT7",1); - $tab=explode(".",$arg2); - if (count($tab)==1){ - if (!$this->setGFile($arg1,$arg2,$arg3)) return $this->error(14,array($this->file_name[$arg1],$arg2),"TTT8",1); - } - else if (count($tab==2)){ - if (!isset($this->sessions[$arg1][$tab[0]])) return $this->error(11,array($tab[0],$this->file_name[$arg1],"TTT9",1)); - if (!$this->setGZone($arg1,$tab[0],$tab[1],$arg3)) return $this->error(15,array($this->file_name[$arg1],$tab[0],$tab[1]),"TTT10",1); - } - return 1; - } - - function setVar($handle,$zone_var,$val){ - // Fill the variable - $tab=explode(".",$zone_var); - if(count($tab)==2){ - $zone=$tab[0]; - $var=$tab[1]; - } - else - { - $zone="|root|"; - $var=$tab[0]; - } - - // Teste l'existence de la zone dans la liste - if (!isset($this->sessions[$handle][$zone])) return $this->error(11,array($this->file_name[$handle],$zone),"TTT11",1); - - //Enregistre la variable - return $this->sessions[$handle][$zone]->setVar($var,$val); - } - - function Parse($handle_dest,$zone_var_dest,$handle_source,$zone_source="|root|"){ - if($this->sessions[$handle_source][$zone_source]->used == 1) $this->closeSession($handle_source,$zone_source); - $this->setVar($handle_dest,$zone_var_dest, $this->sessions[$handle_source][$zone_source]->generated); - } - - function setVarF($handle,$zone_var,$file){ -// Fonction qui ouvre le fichier file et copie ce qu'il y a dedans dans une variable. - $tab=explode(".",$zone_var); - -// Récupération nom de la zone et de la variable. - if(count($tab)==2){ - $zone=$tab[0]; - $var=$tab[1]; - } - else - { - $zone="|root|"; - $var=$tab[0]; - } -// Teste l'existence de la zone dans la liste - if (!is_object($this->sessions[$handle][$zone])) return $this->error(11,array($handle,$zone),"TTT12",1); - - // Récupération du source à lire - if (!@file_exists($file)) return $this->error(8,$file,"TTT13",1); - if (!$f_id=@fopen($file,"r")) return $this->error(9,$file,"TTT14",1); - if (!$val=@fread($f_id, filesize($file))) return $this->error(10,$file,"TTT15",1); - clearstatcache(); - fclose($f_id); - -//Enregistre la variable - return $this->sessions[$handle][$zone]->setVar($var,$val); - } - - - - - - function isZone($handle, $zone="|root|") - { - return isset($this->sessions[$handle][$zone]) ; - } - - function Display($handle="{0}",$display=1,$zone="|root|"){ - $this->closeSession($handle,$zone); - $c_genere = $this->sessions[$handle][$zone]->generated; - - if ($display) echo $c_genere; else return ($c_genere); - } -//fonction complementaire version BETA - -/* - * - On peut l'utiliser : -- SetVarTab($array): tout les couples clef/valeur sont valorisées -- SetVarTab($array,$index) seuls les couples clef/valeur dont la clef est dans le tableau index ou dont la valeur == $index (si pas tableau) -Si $index contient ou est une clef de type zone.clef, la clef sera extraite du texte est servira d'index pour $array - -Vincent -*/ - - function setVarTab($handle,$zones,$index = array()){ - if (is_array($index)) - { - if (count($index)>0) - { - reset($index); - while (list (, $key) = each ($index)) - { - $tab=explode(".",$key); - if(count($tab)==2){ - $var=$tab[1]; - } - else - { - $var=$tab[0]; - } - setVar($handle,$key,$zones[$var]); - } - } - else - { - reset($zones); - while (list ($key, $val) = each ($zones)) - { - setVar($handle,$key,$val); - } - } - } - else - { - setVar($handle,$index,$zones[$index]); - } - } - - function setGlobalVarTab($handle,$zones,$index = array()){ - if (is_array($index)) - { - if (count($index)>0) - { - reset($index); - while (list (, $key) = each ($index)) - { - $tab=explode(".",$key); - if ( count( $tab ) == 2 ) $var=$tab[1]; - else $var=$tab[0]; - setGlobalVar( $handle, $key, $zones[$var] ); - } - } - else - { - reset($zones); - while (list ($key, $val) = each ($zones)) - { - GlobalVar($handle,$key,$val); - } - } - } - else - { - setBlobalVar($handle,$index,$zones[$index]); - } - } - // End VTemplate - } - $DEFINE_VTEMPLATE = 1; -} -?> diff --git a/install.php b/install.php index 706fba2ea..3d520be99 100644 --- a/install.php +++ b/install.php @@ -152,12 +152,7 @@ if ( !file_exists(@realpath(PHPWG_ROOT_PATH . 'language/' . $language . '/instal } include( './language/'.$language.'/install.lang.php' ); include( './language/'.$language.'/admin.lang.php' ); -$mapping_lang = $language; -if ( !file_exists(@realpath(PHPWG_ROOT_PATH . 'language/' . $language . '/lang.lang.php')) ) -{ - $mapping_lang = 'en_EN'; -} -include_once(PHPWG_ROOT_PATH . 'language/' . $mapping_lang . '/lang.lang.php'); +include_once(PHPWG_ROOT_PATH . 'language/infos.lang.php'); // Obtain various vars $dbhost = (!empty($_POST['dbhost'])) ? $_POST['dbhost'] : 'localhost'; @@ -172,10 +167,6 @@ $admin_pass1 = (!empty($_POST['admin_pass1'])) ? $_POST['admin_pass1'] : ''; $admin_pass2 = (!empty($_POST['admin_pass2'])) ? $_POST['admin_pass2'] : ''; $admin_mail = (!empty($_POST['admin_mail'])) ? $_POST['admin_mail'] : ''; -$lang_options = $lang['lang']; -@asort($lang_options); -@reset($lang_options); - $infos = array(); $errors = array(); @@ -282,6 +273,12 @@ if ( isset( $_POST['install'] )) $query.= " SET value = '".$admin_mail."'"; $query.= " WHERE param = 'mail_webmaster'"; $query.= ';'; + mysql_query( $query ); + + $query = 'UPDATE '.CONFIG_TABLE; + $query.= " SET value = '".$language."'"; + $query.= " WHERE param = 'default_lang'"; + $query.= ';'; mysql_query( $query ); $query = 'INSERT INTO '.SITES_TABLE; @@ -343,11 +340,10 @@ $template->assign_vars(array( 'F_DB_PREFIX'=>$table_prefix, 'F_ADMIN'=>$admin_name, 'F_ADMIN_EMAIL'=>$admin_mail, - 'F_LANG_SELECT'=>make_jumpbox($lang_options, $language, true), + 'F_LANG_SELECT'=>language_select($language), - 'T_CONTENT_ENCODING' => $lang['charset'], - 'T_STYLE' => './template/'.$install_style.'/'.$install_style.'-admin.css') - ); + 'T_CONTENT_ENCODING' => $lang['default']['charset'] + )); //-------------------------------------------------------- errors & infos display if ( sizeof( $errors ) != 0 ) diff --git a/language/en_UK.iso-8859-1/lang.lang.php b/language/en_UK.iso-8859-1/lang.lang.php deleted file mode 100644 index b6e229b5e..000000000 --- a/language/en_UK.iso-8859-1/lang.lang.php +++ /dev/null @@ -1,41 +0,0 @@ - | -// | branch : 1.4 | -// +-----------------------------------------------------------------------+ -// | 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. | -// +-----------------------------------------------------------------------+ - -$lang['lang'] = array( - 'fr_FR'=>'French', - 'en_EN'=>'English', - 'es_ES'=>'Spanish', - 'de_DE'=>'German', - 'ca'=>'Catalan', - 'no'=>'Norsk', - 'hu'=>'Hungarian', - 'ja'=>'Japanese', - 'sv'=>'Swedish' - ); - -$lang['charset'] = 'iso-8859-1'; -?> \ No newline at end of file diff --git a/language/infos.lang.php b/language/infos.lang.php new file mode 100644 index 000000000..c34d7df2c --- /dev/null +++ b/language/infos.lang.php @@ -0,0 +1,96 @@ + | +// | branch : 1.4 | +// +-----------------------------------------------------------------------+ +// | 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. | +// +-----------------------------------------------------------------------+ + +$lang_info['language']['zh_CN'] = '简体中文'; // Simplified Chinese +$lang_info['language']['zh_TW'] = '繁體中文'; // Traditional Chinese +$lang_info['language']['zh_TW.utf8'] = '繁體中文 (UTF-'; // Traditional Chinese (UTF- +$lang_info['language']['bg_BG'] = 'Български'; // Bulgarian +$lang_info['language']['ca_ES'] = 'Català'; // Catalan +$lang_info['language']['cs_CZ'] = 'Česky'; // Czech +$lang_info['language']['cs_CZ.cp1250'] = 'Česky CP'; // Czech +$lang_info['language']['cs_CZ.iso'] = 'Česky ISO'; // Czech +$lang_info['language']['da_DK'] = 'Dansk'; // Danish +$lang_info['language']['de_DE'] = 'Deutsch'; // German +$lang_info['language']['en_EN'] = 'English'; +$lang_info['language']['en_GB'] = 'English (UK)'; +$lang_info['language']['en_US'] = 'English (US)'; +$lang_info['language']['es_ES'] = 'Español'; // Spanish +$lang_info['language']['fr_FR'] = 'Français'; // French +$lang_info['language']['it_IT'] = 'Italiano'; // Italian +$lang_info['language']['he_IL'] = 'עברית'; // Hebrew +$lang_info['language']['is_IS'] = 'Íslenska'; // Icelandic +$lang_info['language']['ja_JP'] = '日本語 (EUC-JP)'; // Japanese (EUC-JP) +$lang_info['language']['ko_KR'] = '한국어'; // Korean +$lang_info['language']['lt_LT'] = 'Lietuvių'; // Lithuanian +$lang_info['language']['hu_HU'] = 'Magyar'; // Hungarian +$lang_info['language']['nl_NL'] = 'Nederlands'; // Dutch +$lang_info['language']['no_NO'] = 'Norsk bokmål'; // Norwegian (Bokmal) +$lang_info['language']['pl_PL'] = 'Polski'; // Polish +$lang_info['language']['pt_PT'] = 'Português'; // Portuguese +$lang_info['language']['pt_BR'] = 'Português Brasileiro'; // Portuguese (Brazil) +$lang_info['language']['ru_RU'] = 'Русский (Windows)'; // Russian (Windows) +$lang_info['language']['ru_RU.koi8r'] = 'Русский (KOI8-R)'; // Russian (KOI8-R) +$lang_info['language']['sl_SI'] = 'Slovenščina'; // Slovenian +$lang_info['language']['fi_FI'] = 'Suomi'; // Finnish +$lang_info['language']['sv_SE'] = 'Svenska'; // Swedish +$lang_info['language']['tr_TR'] = 'Türkçe'; // Turkish +$lang_info['language']['uk_UA'] = 'Українська'; // Ukranian + +/** + ** Charsets + ** + ** Add your own charsets, if your system uses others than "normal" + ** + **/ + + $lang_info['default']['charset'] = 'ISO-8859-1'; + + $lang_info['charset']['bg_BG'] = 'windows-1251'; + $lang_info['charset']['cs_CZ'] = 'ISO-8859-2'; + $lang_info['charset']['he_IL'] = 'windows-1255'; + $lang_info['charset']['hu_HU'] = 'ISO-8859-2'; + $lang_info['charset']['ja_JP'] = 'EUC-JP'; + $lang_info['charset']['ko_KR'] = 'EUC-KR'; + $lang_info['charset']['lt_LT'] = 'windows-1257'; + $lang_info['charset']['pl_PL'] = 'ISO-8859-2'; + $lang_info['charset']['ru_RU'] = 'windows-1251'; + + $lang_info['charset']['sl_SI'] = 'ISO-8859-2'; + $lang_info['charset']['tr_TR'] = 'ISO-8859-9'; + $lang_info['charset']['uk_UA'] = 'KOI8-U'; + $lang_info['charset']['zh_CN'] = 'GB2312'; + $lang_info['charset']['zh_TW'] = 'BIG5'; + + +/** + ** Direction + **/ + + $lang_info['default']['direction'] = 'ltr'; + $lang_info['direction']['he_IL'] = 'rtl' ; + +?> \ No newline at end of file diff --git a/picture.php b/picture.php index 03d5300c3..d28dde037 100644 --- a/picture.php +++ b/picture.php @@ -47,7 +47,7 @@ initialize_category( 'picture' ); if ( 0 ) { echo '
'.$lang['access_forbiden'].'
'; - echo ''; + echo ''; echo $lang['thumbnails'].'
'; exit(); } @@ -130,18 +130,14 @@ for ($i=0; $i<$nb_row;$i++) $picture[$j]['url'] = PHPWG_ROOT_PATH.'picture.php?image_id='.$row['id']; $picture[$j]['url'].= '&cat='.$page['cat']; - if ( isset( $_GET['expand'] ) ) - $picture[$j]['url'].= '&expand='.$_GET['expand']; if ( $page['cat'] == 'search' ) { $picture[$j]['url'].= "&search=".$_GET['search'].'&mode='.$_GET['mode']; } } -$url_home = './category.php?cat='.$page['cat'].'&'; +$url_home = PHPWG_ROOT_PATH.'category.php?cat='.$page['cat'].'&'; $url_home.= 'num='.$page['num']; -if (isset($_GET['expand'])) - $url_home.='&expand='.$_GET['expand']; if ( $page['cat'] == 'search' ) { $url_home.= "&search=".$_GET['search'].'&mode='.$_GET['mode']; @@ -190,6 +186,80 @@ if ( isset( $_GET['add_fav'] ) ) } } +//--------------------------------------------------------- comment registeration + if ( isset( $_POST['content'] ) && !empty($_POST['content']) ) + { + $register_comment = true; + $author = !empty($_POST['author'])?$_POST['author']:$lang['guest']; + // if a guest try to use the name of an already existing user, he must + // be rejected + if ( $author != $user['username'] ) + { + $query = 'SELECT COUNT(*) AS user_exists'; + $query.= ' FROM '.USERS_TABLE; + $query.= " WHERE username = '".$author."'"; + $query.= ';'; + $row = mysql_fetch_array( mysql_query( $query ) ); + if ( $row['user_exists'] == 1 ) + { + $template->assign_block_vars('information', array('INFORMATION'=>$lang['comment_user_exists'])); + $register_comment = false; + } + } + + if ( $register_comment ) + { + // anti-flood system + $reference_date = time() - $conf['anti-flood_time']; + $query = 'SELECT id FROM '.COMMENTS_TABLE; + $query.= ' WHERE date > '.$reference_date; + $query.= " AND author = '".$author."'"; + $query.= ';'; + if ( mysql_num_rows( mysql_query( $query ) ) == 0 + || $conf['anti-flood_time'] == 0 ) + { + $query = 'INSERT INTO '.COMMENTS_TABLE; + $query.= ' (author,date,image_id,content,validated) VALUES ('; + $query.= "'".$author."'"; + $query.= ','.time().','.$_GET['image_id']; + $query.= ",'".htmlspecialchars( $_POST['content'], ENT_QUOTES)."'"; + if ( !$conf['comments_validation'] || $user['status'] == 'admin' ) + $query.= ",'true'"; + else + $query.= ",'false'"; + $query.= ');'; + mysql_query( $query ); + // information message + $message = $lang['comment_added']; + if ( $conf['comments_validation'] and $user['status'] != 'admin' ) + { + $message.= '
'.$lang['comment_to_validate']; + } + $template->assign_block_vars('information', array('INFORMATION'=>$message)); + // notification to the administrators + if ( $conf['mail_notification'] ) + { + $cat_name = get_cat_display_name( $page['cat_name'], ' > ', '' ); + $cat_name = strip_tags( $cat_name ); + notify( 'comment', $cat_name.' > '.$picture['current']['name']); + } + } + else + { + // information message + $template->assign_block_vars('information', array('INFORMATION'=>$lang['comment_anti-flood'])); + } + } + } + // comment deletion + if ( isset( $_GET['del'] ) + && is_numeric( $_GET['del'] ) + && $user['status'] == 'admin' ) + { + $query = 'DELETE FROM '.COMMENTS_TABLE.' WHERE id = '.$_GET['del'].';'; + mysql_query( $query ); + } + // // Start output of page // @@ -235,7 +305,6 @@ $picture_size = get_picture_size( $original_width, $original_height, include(PHPWG_ROOT_PATH.'include/page_header.php'); $template->set_filenames(array('picture'=>'picture.tpl')); -initialize_template(); $template->assign_vars(array( 'CATEGORY' => $title_img, @@ -263,8 +332,9 @@ $template->assign_vars(array( 'L_DELETE' =>$lang['delete'], 'L_SUBMIT' =>$lang['submit'], 'L_AUTHOR' =>$lang['author'], + 'L_COMMENT' =>$lang['comment'], - 'T_DEL_IMG' =>'./template/'.$user['template'].'/theme/delete.gif', + 'T_DEL_IMG' =>PHPWG_ROOT_PATH.'template/'.$user['template'].'/theme/delete.gif', 'U_PREV_IMG' => add_session_id($picture['prev']['url']), 'U_NEXT_IMG' => add_session_id($picture['next']['url']), @@ -299,6 +369,12 @@ if ($prev>=0) $template->assign_block_vars('previous', array()); if ($next) $template->assign_block_vars('next', array()); //--------------------------------------------------------- picture information +// legend +if ( !empty($picture['current']['comment']) ) +{ + $template->assign_block_vars('legend', array()); +} + // author if ( !empty($picture['current']['author']) ) { @@ -358,8 +434,7 @@ if ( !empty($picture['current']['keywords'])) { $keywords = explode( ',', $picture['current']['keywords'] ); $content = ''; - $url = './category.php?cat=search'; - if ( isset( $_GET['expand'] ) ) $url.= '&expand='.$_GET['expand']; + $url = PHPWG_ROOT_PATH.'category.php?cat=search'; $url.= '&mode=OR&search='; foreach ( $keywords as $i => $keyword ) { $local_url = add_session_id( $url.$keyword ); @@ -388,16 +463,14 @@ if ( !$user['is_the_guest'] ) $row = mysql_fetch_array( $result ); if (!$row['nb_fav']) { - $url = './picture.php?cat='.$page['cat'].'&image_id='.$_GET['image_id']; - if (isset($_GET['expand'])) - $url.= '&expand='.$_GET['expand']; + $url = PHPWG_ROOT_PATH.'picture.php?cat='.$page['cat'].'&image_id='.$_GET['image_id']; $url.='&add_fav=1'; if ( $page['cat'] == 'search' ) { $url.= '&search='.$_GET['search'].'&mode='.$_GET['mode']; } $template->assign_block_vars('favorite', array( - 'FAVORITE_IMG' => './template/'.$user['template'].'/theme/favorite.gif', + 'FAVORITE_IMG' => PHPWG_ROOT_PATH.'template/'.$user['template'].'/theme/favorite.gif', 'FAVORITE_HINT' =>$lang['add_favorites_hint'], 'FAVORITE_ALT' =>'[ '.$lang['add_favorites_alt'].' ]', 'U_FAVORITE'=> add_session_id( $url ) @@ -405,10 +478,10 @@ if ( !$user['is_the_guest'] ) } else { - $url = './picture.php?cat='.$page['cat'].'&image_id='.$_GET['image_id']; - $url.= '&expand='.$_GET['expand'].'&add_fav=0'; + $url = PHPWG_ROOT_PATH.'picture.php?cat='.$page['cat'].'&image_id='.$_GET['image_id']; + $url.= '&add_fav=0'; $template->assign_block_vars('favorite', array( - 'FAVORITE_IMG' => './template/'.$user['template'].'/theme/del_favorite.gif', + 'FAVORITE_IMG' => PHPWG_ROOT_PATH.'template/'.$user['template'].'/theme/del_favorite.gif', 'FAVORITE_HINT' =>$lang['del_favorites_hint'], 'FAVORITE_ALT' =>'[ '.$lang['del_favorites_alt'].' ]', 'U_FAVORITE'=> add_session_id( $url ) @@ -424,79 +497,6 @@ if ( $user['status'] == 'admin' ) //---------------------------------------------------- users's comments display if ( $conf['show_comments'] ) { - // comment registeration - if ( isset( $_POST['content'] ) && !empty($_POST['content']) ) - { - $register_comment = true; - $author = !empty($_POST['author'])?$_POST['author']:$lang['guest']; - // if a guest try to use the name of an already existing user, he must - // be rejected - if ( $author != $user['username'] ) - { - $query = 'SELECT COUNT(*) AS user_exists'; - $query.= ' FROM '.USERS_TABLE; - $query.= " WHERE username = '".$author."'"; - $query.= ';'; - $row = mysql_fetch_array( mysql_query( $query ) ); - if ( $row['user_exists'] == 1 ) - { - $template->assign_block_vars('information', array('INFORMATION'=>$lang['comment_user_exists'])); - $register_comment = false; - } - } - - if ( $register_comment ) - { - // anti-flood system - $reference_date = time() - $conf['anti-flood_time']; - $query = 'SELECT id FROM '.COMMENTS_TABLE; - $query.= ' WHERE date > '.$reference_date; - $query.= " AND author = '".$author."'"; - $query.= ';'; - if ( mysql_num_rows( mysql_query( $query ) ) == 0 - || $conf['anti-flood_time'] == 0 ) - { - $query = 'INSERT INTO '.COMMENTS_TABLE; - $query.= ' (author,date,image_id,content,validated) VALUES ('; - $query.= "'".$author."'"; - $query.= ','.time().','.$_GET['image_id']; - $query.= ",'".htmlspecialchars( $_POST['content'], ENT_QUOTES)."'"; - if ( !$conf['comments_validation'] || $user['status'] == 'admin' ) - $query.= ",'true'"; - else - $query.= ",'false'"; - $query.= ');'; - mysql_query( $query ); - // information message - $message = $lang['comment_added']; - if ( $conf['comments_validation'] and $user['status'] != 'admin' ) - { - $message.= '
'.$lang['comment_to_validate']; - } - $template->assign_block_vars('information', array('INFORMATION'=>$message)); - // notification to the administrators - if ( $conf['mail_notification'] ) - { - $cat_name = get_cat_display_name( $page['cat_name'], ' > ', '' ); - $cat_name = strip_tags( $cat_name ); - notify( 'comment', $cat_name.' > '.$picture['current']['name']); - } - } - else - { - // information message - $template->assign_block_vars('information', array('INFORMATION'=>$lang['comment_anti-flood'])); - } - } - } - // comment deletion - if ( isset( $_GET['del'] ) - && is_numeric( $_GET['del'] ) - && $user['status'] == 'admin' ) - { - $query = 'DELETE FROM '.COMMENTS_TABLE.' WHERE id = '.$_GET['del'].';'; - mysql_query( $query ); - } // number of comment for this picture $query = 'SELECT COUNT(*) AS nb_comments'; $query.= ' FROM '.COMMENTS_TABLE.' WHERE image_id = '.$_GET['image_id']; @@ -505,9 +505,7 @@ if ( $conf['show_comments'] ) $row = mysql_fetch_array( mysql_query( $query ) ); // navigation bar creation - $url = './picture.php?cat='.$page['cat'].'&image_id='.$_GET['image_id']; - if (isset($_GET['expand'])) - $url.= '&expand='.$_GET['expand']; + $url = PHPWG_ROOT_PATH.'picture.php?cat='.$page['cat'].'&image_id='.$_GET['image_id']; if ( $page['cat'] == 'search' ) { $url.= '&search='.$_GET['search'].'&mode='.$_GET['mode']; diff --git a/profile.php b/profile.php index 2fb1b9de3..064101732 100644 --- a/profile.php +++ b/profile.php @@ -127,26 +127,46 @@ if ( isset( $_POST['submit'] ) ) } } //----------------------------------------------------- template initialization -// -// Start output of page -// +$expand = ($user['expand']=='true')?'EXPAND_TREE_YES':'EXPAND_TREE_NO'; +$nb_comments = ($user['show_nb_comments']=='true')?'NB_COMMENTS_YES':'NB_COMMENTS_NO'; + $title = $lang['customize_page_title']; include(PHPWG_ROOT_PATH.'include/page_header.php'); $template->set_filenames(array('profile'=>'profile.tpl')); -initialize_template(); $template->assign_vars(array( - 'L_TITLE' => $lang['customize_title'], + 'LANG_SELECT'=>language_select($user['language'], 'language'), + 'NB_IMAGE_LINE'=>$user['nb_image_line'], + 'NB_ROW_PAGE'=>$user['nb_line_page'], + 'STYLE_SELECT'=>style_select($user['template'], 'template'), + 'SHORT_PERIOD'=>$user['short_period'], + 'LONG_PERIOD'=>$user['long_period'], + + $expand=>'checked="checked"', + $nb_comments=>'checked="checked"', + + 'L_TITLE' => $lang['customize_title'], 'L_PASSWORD' => $lang['password'], 'L_NEW' => $lang['new'], 'L_CONFIRM' => $lang['reg_confirm'], - 'L_SUBMIT' => $lang['submit'], 'L_COOKIE' => $lang['create_cookie'], - - 'F_ACTION' => add_session_id( './profile.php' ), - - 'U_RETURN' => add_session_id('./category.php?'.$_SERVER['QUERY_STRING']) + 'L_CONFIRM'=>$lang['conf_confirmation'], + 'L_LANG_SELECT'=>$lang['customize_language'], + 'L_NB_IMAGE_LINE'=>$lang['customize_nb_image_per_row'], + 'L_NB_ROW_PAGE'=>$lang['customize_nb_row_per_page'], + 'L_STYLE_SELECT'=>$lang['customize_theme'], + 'L_SHORT_PERIOD'=>$lang['customize_short_period'], + 'L_LONG_PERIOD'=>$lang['customize_long_period'], + 'L_EXPAND_TREE'=>$lang['customize_expand'], + 'L_NB_COMMENTS'=>$lang['customize_show_nb_comments'], + 'L_YES'=>$lang['yes'], + 'L_NO'=>$lang['no'], + 'L_SUBMIT'=>$lang['submit'], + + 'F_ACTION'=>add_session_id(PHPWG_ROOT_PATH.'profile.php'), + + 'U_RETURN' => add_session_id(PHPWG_ROOT_PATH.'category.php?'.$_SERVER['QUERY_STRING']) )); //-------------------------------------------------------------- errors display @@ -159,42 +179,6 @@ if ( sizeof( $errors ) != 0 ) } } -$template->assign_block_vars('select',array( - 'F_LABEL'=>$lang['customize_nb_image_per_row'], - 'F_NAME'=>'nb_image_line', - 'F_OPTIONS'=>make_jumpbox($conf['nb_image_row'], $user['nb_image_line']) - )); - -$template->assign_block_vars('select',array( - 'F_LABEL'=>$lang['customize_nb_row_per_page'], - 'F_NAME'=>'nb_line_page', - 'F_OPTIONS'=>make_jumpbox($conf['nb_row_page'], $user['nb_line_page']) - )); - -$template->assign_block_vars('select',array( - 'F_LABEL'=>$lang['customize_template'], - 'F_NAME'=>'template', - 'F_OPTIONS'=>make_jumpbox(get_dirs( './template' ), $user['template']) - )); - -$template->assign_block_vars('select',array( - 'F_LABEL'=>$lang['customize_language'], - 'F_NAME'=>'language', - 'F_OPTIONS'=>make_jumpbox($lang['lang'], $user['language'], true) - )); - -$template->assign_block_vars('text',array( - 'F_LABEL'=>$lang['customize_short_period'], - 'F_NAME'=>'short_period', - 'F_VALUE'=>$user['short_period'] - )); - -$template->assign_block_vars('text',array( - 'F_LABEL'=>$lang['customize_long_period'], - 'F_NAME'=>'long_period', - 'F_VALUE'=>$user['long_period'] - )); - $template->assign_block_vars('text',array( 'F_LABEL'=>$lang['maxwidth'], 'F_NAME'=>'maxwidth', @@ -213,16 +197,6 @@ $template->assign_block_vars('text',array( 'F_VALUE'=>$user['mail_address'] )); -$template->assign_block_vars('radio',array( - 'F_LABEL'=>$lang['customize_expand'], - 'F_OPTIONS'=>make_radio('expand', array(true=>$lang['yes'], false=>$lang['no']), $user['expand'], true) - )); - -$template->assign_block_vars('radio',array( - 'F_LABEL'=>$lang['customize_show_nb_comments'], - 'F_OPTIONS'=>make_radio('show_nb_comments', array(true=>$lang['yes'], false=>$lang['no']), $user['show_nb_comments'], true) - )); - //----------------------------------------------------------- html code display $template->pparse('profile'); include(PHPWG_ROOT_PATH.'include/page_tail.php'); diff --git a/register.php b/register.php index d32eb0d31..bfd2e5ef7 100644 --- a/register.php +++ b/register.php @@ -51,8 +51,8 @@ if ( isset( $_POST['submit'] ) ) } } -$login = empty($_POST['login'])?$_POST['login']:''; -$email = empty($_POST['login'])?$_POST['login']:''; +$login = !empty($_POST['login'])?$_POST['login']:''; +$email = !empty($_POST['login'])?$_POST['login']:''; //----------------------------------------------------- template initialization // @@ -62,8 +62,6 @@ $title= $lang['register_page_title']; include(PHPWG_ROOT_PATH.'include/page_header.php'); $template->set_filenames( array('register'=>'register.tpl') ); -initialize_template(); - $template->assign_vars(array( 'L_TITLE' => $lang['register_title'], 'L_GUEST' => $lang['ident_guest_visit'], @@ -79,10 +77,10 @@ $template->assign_vars(array( )); //-------------------------------------------------------------- errors display -if ( sizeof( $errors ) != 0 ) +if ( sizeof( $error ) != 0 ) { $template->assign_block_vars('errors',array()); - for ( $i = 0; $i < sizeof( $errors ); $i++ ) + for ( $i = 0; $i < sizeof( $error ); $i++ ) { $template->assign_block_vars('errors.error',array('ERROR'=>$errors[$i])); } diff --git a/search.php b/search.php index 48aa84f45..85df38202 100644 --- a/search.php +++ b/search.php @@ -69,8 +69,6 @@ $title= $lang['search_title']; include(PHPWG_ROOT_PATH.'include/page_header.php'); $template->set_filenames( array('search'=>'search.tpl') ); -initialize_template(); - $template->assign_vars(array( 'L_TITLE' => $lang['search_title'], 'L_COMMENTS' => $lang['search_comments'], diff --git a/template/default/about.tpl b/template/default/about.tpl index 41eddc785..34616f83c 100644 --- a/template/default/about.tpl +++ b/template/default/about.tpl @@ -1,21 +1,10 @@ - - - - -
- {T_START}1px{T_BEGIN} -
{PAGE_TITLE}
- {T_END} -
 
- {T_START}50%{T_BEGIN} - - {T_END} - -
- php logo -
-
\ No newline at end of file +
{PAGE_TITLE}
+ +
+{L_RETURN} +
+
+php logo +
\ No newline at end of file diff --git a/template/default/admin.tpl b/template/default/admin.tpl new file mode 100644 index 000000000..7b9dd9462 --- /dev/null +++ b/template/default/admin.tpl @@ -0,0 +1,21 @@ + +

{L_INSTALL_WARNING} + +

+ {L_CONFIG} |  + {L_USERS} |  + {L_GROUPS} |  + {L_CATEGORIES} |  + {L_WAITING} |  + {L_COMMENTS} |  + {L_UPDATE} |  + {L_THUMBNAILS} |  + {L_HISTORY} |  + {L_FAQ} |  + {L_RETURN} +
+
+
+
{PAGE_TITLE}
+ {ADMIN_CONTENT} +
diff --git a/template/default/admin.vtp b/template/default/admin.vtp deleted file mode 100644 index abe85807d..000000000 --- a/template/default/admin.vtp +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - {#title_default} - - - - - -
{#install_warning}
- - - - - - - -
- - {#indent}{#name} - -
-
{#title}
-
-
- - - - -
- {#sub} -
-
-
- - \ No newline at end of file diff --git a/template/default/admin/comments.vtp b/template/default/admin/comments.vtp deleted file mode 100644 index 051008156..000000000 --- a/template/default/admin/comments.vtp +++ /dev/null @@ -1,81 +0,0 @@ - - - - - -
- {#title} - - [ - - {#option}{#separation} - - {#stats_last_days} - ] - - - [ {#open} ] - - - [ {#close} ] - -
- -
- - -
- - - - - -
- - - {#thumb_alt} - - -
{#title}
- - - - - - - - -
- - - - - - - - -
-
{#author}
-
-
- {#date}[{#delete}] -
-
-
{#content}
-
-
- -
- -
-
- - -
- -
- - -
- - \ No newline at end of file diff --git a/template/default/admin/configuration.tpl b/template/default/admin/configuration.tpl new file mode 100644 index 000000000..845c87435 --- /dev/null +++ b/template/default/admin/configuration.tpl @@ -0,0 +1,233 @@ + +
+
    + +
  • {errors.error.ERROR}
  • + +
+
+ + +
{L_CONFIRM}
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{L_CONF_GENERAL}
 
{L_ADMIN_NAME}{L_ADMIN_NAME_INFO}
{L_ADMIN_MAIL}{L_ADMIN_MAIL_INFO}
{L_THUMBNAIL_PREFIX}{L_THUMBNAIL_PREFIX_INFO}
{L_ACCESS}{L_ACCESS_FREE}   + {L_ACCESS_RESTRICTED}{L_ACCESS_INFO}
{L_HISTORY}{L_YES}   + {L_NO}{L_HISTORY_INFO}
{L_MAIL_NOTIFICATION}{L_YES}   + {L_NO}{L_MAIL_NOTIFICATION_INFO}
 
{L_CONF_COMMENTS}
 
{L_SHOW_COMMENTS}{L_YES}   + {L_NO}{L_SHOW_COMMENTS_INFO}
{L_COMMENTS_ALL}{L_YES}   + {L_NO}{L_COMMENTS_ALL_INFO}
{L_NB_COMMENTS_PAGE}{L_NB_COMMENTS_PAGE_INFO}
{L_VALIDATE_COMMENTS}{L_YES}   + {L_NO}{L_VALIDATE_COMMENTS_INFO}
 
{L_ABILITIES_SETTINGS}
 
{L_LANG_SELECT}{LANG_SELECT}{L_LANG_SELECT_INFO}
{L_NB_IMAGE_LINE}{L_NB_IMAGE_LINE_INFO}
{L_NB_ROW_PAGE}{L_NB_ROW_PAGE_INFO}
{L_STYLE_SELECT}{STYLE_SELECT}{L_STYLE_SELECT_INFO}
{L_SHORT_PERIOD}{L_SHORT_PERIOD_INFO}
{L_LONG_PERIOD}{L_LONG_PERIOD_INFO}
{L_EXPAND_TREE}{L_YES}   + {L_NO}{L_EXPAND_TREE_INFO}
{L_NB_COMMENTS}{L_YES}   + {L_NO}{L_NB_COMMENTS_INFO}
 
{L_CONF_UPLOAD}
 
{L_UPLOAD}{L_YES}   + {L_NO}{L_UPLOAD_INFO}
{L_UPLOAD_MAXSIZE}{L_UPLOAD_MAXSIZE_INFO}
{L_UPLOAD_MAXWIDTH}{L_UPLOAD_MAXWIDTH_INFO}
{L_UPLOAD_MAXHEIGHT}{L_UPLOAD_MAXHEIGHT_INFO}
{L_TN_UPLOAD_MAXWIDTH}{L_TN_UPLOAD_MAXWIDTH_INFO}
{L_TN_UPLOAD_MAXHEIGHT}{L_TN_UPLOAD_MAXHEIGHT_INFO}
 
{L_CONF_SESSION}
 
{L_COOKIE}{L_YES}   + {L_NO}{L_COOKIE_INFO}
{L_SESSION_LENGTH}{L_SESSION_LENGTH_INFO}
{L_SESSION_ID_SIZE}{L_SESSION_ID_SIZE_INFO}
{#remote_site}
 
 {#delete} 
{#url}{#conf_remote_site_delete_info}
 
+ +
+
\ No newline at end of file diff --git a/template/default/admin/configuration.vtp b/template/default/admin/configuration.vtp deleted file mode 100644 index b3ec239ee..000000000 --- a/template/default/admin/configuration.vtp +++ /dev/null @@ -1,88 +0,0 @@ - -
-
{#errors_title}
-
    - -
  • {#li}
  • - -
-
- - -
{#conf_confirmation}
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{#name} - - - - - {#text} - - - - - - - {#option} - - - - - {#option} - - - {#def}
{#title}
 
{#remote_site}
 
 {#delete} 
{#url}{#conf_remote_site_delete_info}
 
- -
-
\ No newline at end of file diff --git a/template/default/admin/help.tpl b/template/default/admin/help.tpl new file mode 100644 index 000000000..f603fe5e5 --- /dev/null +++ b/template/default/admin/help.tpl @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + +
{cat.NAME}
 
+ +
+ {cat.illustration.CAPTION} + +
    + +
  • {cat.item.CONTENT}
  • + +
+
 
\ No newline at end of file diff --git a/template/default/admin/help.vtp b/template/default/admin/help.vtp deleted file mode 100644 index 4e7692acd..000000000 --- a/template/default/admin/help.vtp +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - -
{#name}
 
- -
{#pic_alt}
- {#caption} - -
    - -
  • {#content}
  • - -
-
 
\ No newline at end of file diff --git a/template/default/admin/search_username.tpl b/template/default/admin/search_username.tpl new file mode 100644 index 000000000..f3e676f8d --- /dev/null +++ b/template/default/admin/search_username.tpl @@ -0,0 +1,22 @@ + +
{L_SEARCH_USERNAME}
+
+   +
+ {L_SEARCH_EXPLAIN}
+ + {L_UPDATE_USERNAME}
+   +

+ +
{L_CLOSE_WINDOW} +
diff --git a/template/default/admin/thumbnail.tpl b/template/default/admin/thumbnail.tpl new file mode 100644 index 000000000..9c16d58bd --- /dev/null +++ b/template/default/admin/thumbnail.tpl @@ -0,0 +1,160 @@ + +
{L_THUMBNAIL_TITLE}
+ + + +
[ 0 {L_UNLINK} ]
+ + + +
+
    + +
  • {errors.error.ERROR}
  • + +
+
+ + + +
{L_RESULTS}
+ + + + + + + + + + + + + + + + + + + + + +
  + {L_TN_PICTURE} + {L_FILESIZE} + {L_WIDTH} + {L_HEIGHT} + {L_GENERATED}{L_THUMBNAIL} + {L_FILESIZE} + {L_WIDTH} + {L_HEIGHT} +
{results.picture.NB_IMG}{results.picture.FILE_IMG}{results.picture.FILESIZE_IMG}{results.picture.WIDTH_IMG}{results.picture.HEIGHT_IMG} +
{results.picture.GEN_TIME}
+
{results.picture.TN_FILE_IMG}{results.picture.TN_FILESIZE_IMG}{results.picture.TN_WIDTH_IMG}{results.picture.TN_HEIGHT_IMG}
 
+ + + + + + + + + + + + + + + + + + + + + + + +
{L_TN_STATS} +
{L_TN_NB_STATS}{results.TN_NB}
{L_TN_TOTAL}{results.TN_TOTAL}
{L_TN_MAX}{results.TN_MAX}
{L_TN_MIN}{results.TN_MIN}
{L_TN_AVERAGE}{results.TN_AVERAGE}
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{L_PARAMS}
 
{L_GD}
+ 2.x + 1.x + {L_GD_INFO}
{L_WIDTH}
+ + {L_WIDTH_INFO}
{L_HEIGHT}
+ + {L_HEIGHT_INFO}
{L_CREATE}
+ + {L_CREATE_INFO}
{L_FORMAT}
jpeg{L_FORMAT_INFO}
+ +
+
+ + + +
{remainings.TOTAL_IMG} {L_REMAINING}
+ + + + + + + + + + + + +
  + {L_TN_PICTURE} + {L_FILESIZE} + {L_WIDTH} + {L_HEIGHT} +
{remainings.remaining.NB_IMG}
{remainings.remaining.FILE_TN}
{remainings.remaining.FILESIZE_IMG}
{remainings.remaining.WIDTH_IMG}
{remainings.remaining.HEIGHT_IMG}
+ \ No newline at end of file diff --git a/template/default/admin/thumbnail.vtp b/template/default/admin/thumbnail.vtp deleted file mode 100644 index 42a792eb8..000000000 --- a/template/default/admin/thumbnail.vtp +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - - - -
{#tn_dirs_title}
-
- > - galleries -
- -
- > - - {#name} [ {#nb_pic} {#tn_dirs_alone} ] - - - {#name} - -
- -
- - - -
[ 0 {#tn_dirs_alone} ]
- - - -
-
    - -
  • {#li}
  • - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{#tn_results_title}
 {#tn_picture}{#filesize}{#tn_width}{#tn_height}{#tn_results_gen_time}{#thumbnail}{#filesize}{#tn_width}{#tn_height}
{#num}{#file}{#filesize}{#width}{#height} -
{#time}
-
{#thumb_file}{#thumb_filesize}{#thumb_width}{#thumb_height}
 
- - - - - - - - - - - - - - - - - - - - - - - - -
{#tn_stats}
{#tn_stats_nb}{#stats_nb}
{#tn_stats_total}{#stats_total}
{#tn_stats_max}{#stats_max}
{#tn_stats_min}{#stats_min}
{#tn_stats_mean}{#stats_mean}
- - - - -
 
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{#tn_params_title}
 
{#tn_params_GD}
- 2.x - 1.x - {#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}
jpeg{#tn_params_format_info}
 
- -
-
- - - - - - - - - - - - - - - - - - - - - - - -
{#total} {#tn_alone_title}
 {#tn_picture}{#filesize}{#tn_width}{#tn_height}
{#num}
{#file}
{#filesize}
{#width}
{#height}
- \ No newline at end of file diff --git a/template/default/admin/update.tpl b/template/default/admin/update.tpl new file mode 100644 index 000000000..97ba87963 --- /dev/null +++ b/template/default/admin/update.tpl @@ -0,0 +1,31 @@ + +
{L_UPDATE_TITLE}
+ + + +
{L_RESULT_UPDATE}
+ {update.CATEGORIES} +
{update.NEW_CAT} {L_NEW_CATEGORY} +
{update.DEL_CAT} {L_DEL_CATEGORY} + + + + + + + + + +
{#remote_site}
+
+ {#url}

+ + {#categories} +
{#count_new} {#update_research_conclusion} +
{#count_deleted} {#update_deletion_conclusion} +
+
+ diff --git a/template/default/admin/update.vtp b/template/default/admin/update.vtp deleted file mode 100644 index 72deed543..000000000 --- a/template/default/admin/update.vtp +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - -
{#update_default_title}
- -
{#update_part_research}
-
- {#url}

- - {#categories} -
{#count_new} {#update_research_conclusion} -
{#count_deleted} {#update_deletion_conclusion} -
-
{#remote_site}
-
- {#url}

- - {#categories} -
{#count_new} {#update_research_conclusion} -
{#count_deleted} {#update_deletion_conclusion} -
-
\ No newline at end of file diff --git a/template/default/admin/user_list.tpl b/template/default/admin/user_list.tpl new file mode 100644 index 000000000..562ef8c42 --- /dev/null +++ b/template/default/admin/user_list.tpl @@ -0,0 +1,101 @@ + + + + + + + + + +
{#listuser_confirm} "{#login}" ?
{#yes}{#no}
+ + + +
{#info}
+ + + +
+
{#errors_title}
+
    + +
  • {#li}
  • + +
+
+ + + +
+
+ {#title_add} -> + {#login} : + {#password} : + +
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + +
{#title}
+
+ + + +
+
+
{#login}
+
+ + {#listuser_modify} + + + {#listuser_modify} + + + + {#listuser_permission} + + + {#listuser_permission} + + + + {#listuser_delete} + + + {#listuser_delete} + +
 
+ < + + + + + mailto:{#mail_address_start}... + +
+
+ \ No newline at end of file diff --git a/template/default/admin/user_list.vtp b/template/default/admin/user_list.vtp deleted file mode 100644 index 562ef8c42..000000000 --- a/template/default/admin/user_list.vtp +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - -
{#listuser_confirm} "{#login}" ?
{#yes}{#no}
- - - -
{#info}
- - - -
-
{#errors_title}
-
    - -
  • {#li}
  • - -
-
- - - -
-
- {#title_add} -> - {#login} : - {#password} : - -
-
- - - -
- - - - - - - - - - - - - - - - - - - - - -
{#title}
-
- - - -
-
-
{#login}
-
- - {#listuser_modify} - - - {#listuser_modify} - - - - {#listuser_permission} - - - {#listuser_permission} - - - - {#listuser_delete} - - - {#listuser_delete} - -
 
- < - - - - - mailto:{#mail_address_start}... - -
-
- \ No newline at end of file diff --git a/template/default/admin/user_modify.tpl b/template/default/admin/user_modify.tpl new file mode 100644 index 000000000..475a0eff3 --- /dev/null +++ b/template/default/admin/user_modify.tpl @@ -0,0 +1,95 @@ + +
+
    + +
  • {#li}
  • + +
+
+ + +
+ {#adduser_info_message} "{#username}" + + {#adduser_info_password_updated} + + [ {#adduser_info_back} ] +
+ + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{#adduser_fill_form}
 
{#login}{#user:username}
{#new} {#password}
{#mail_address}
{#adduser_status} + +
{#menu_groups} + + + + + + + +
{#name} {#dissociate}
+
{#adduser_associate} + +
+ +
+
+
+ + \ No newline at end of file diff --git a/template/default/admin/user_modify.vtp b/template/default/admin/user_modify.vtp deleted file mode 100644 index 475a0eff3..000000000 --- a/template/default/admin/user_modify.vtp +++ /dev/null @@ -1,95 +0,0 @@ - -
-
    - -
  • {#li}
  • - -
-
- - -
- {#adduser_info_message} "{#username}" - - {#adduser_info_password_updated} - - [ {#adduser_info_back} ] -
- - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{#adduser_fill_form}
 
{#login}{#user:username}
{#new} {#password}
{#mail_address}
{#adduser_status} - -
{#menu_groups} - - - - - - - -
{#name} {#dissociate}
-
{#adduser_associate} - -
- -
-
-
- - \ No newline at end of file diff --git a/template/default/admin/user_perm.tpl b/template/default/admin/user_perm.tpl new file mode 100644 index 000000000..bd5bb43d2 --- /dev/null +++ b/template/default/admin/user_perm.tpl @@ -0,0 +1,26 @@ + +
{L_SELECT_USERNAME}
+
+ + {S_HIDDEN_FIELDS} + + +
+ + +
{L_AUTH_USER}
+
+ + +
+ \ No newline at end of file diff --git a/template/default/admin/user_perm.vtp b/template/default/admin/user_perm.vtp deleted file mode 100644 index bbe02ce84..000000000 --- a/template/default/admin/user_perm.vtp +++ /dev/null @@ -1,34 +0,0 @@ - -
{#permuser_info_message} [ {#adduser_info_back} ]
- - -
{#permuser_only_private}
- -
- - - - - - - - - - -
- > {#name} - - [ - - {#name}{#separation} - - ] - - - - {#permuser_parent_forbidden} - - {#permuser_authorized} - {#permuser_forbidden} -
-
\ No newline at end of file diff --git a/template/default/admin/user_select_body.tpl b/template/default/admin/user_select_body.tpl new file mode 100644 index 000000000..6790c2d00 --- /dev/null +++ b/template/default/admin/user_select_body.tpl @@ -0,0 +1,7 @@ +
{L_SELECT_USERNAME}
+
+ + {S_HIDDEN_FIELDS} + + +
\ No newline at end of file diff --git a/template/default/category.tpl b/template/default/category.tpl index 7815c5b0d..deb4e2229 100644 --- a/template/default/category.tpl +++ b/template/default/category.tpl @@ -20,23 +20,29 @@  [ {category.NB_SUBCATS} - {category.TOTAL_CAT} ]{category.CAT_ICON}
-
[ {NB_PICTURE} {L_TOTAL} ]
- -
  {L_FAVORITE} [ {favorites.NB_FAV} ] - -
  {L_STATS} -
      {TOP_VISITED} {L_MOST_VISITED} -
      {L_RECENT} {T_SHORT} +
+
{L_SUMMARY}
{L_IDENTIFY}
\ No newline at end of file diff --git a/template/default/install.tpl b/template/default/install.tpl index f6127bf7e..78b9e1836 100644 --- a/template/default/install.tpl +++ b/template/default/install.tpl @@ -5,7 +5,62 @@ PhpWebGallery {RELEASE} - + @@ -57,9 +112,7 @@ diff --git a/template/default/picture.tpl b/template/default/picture.tpl index 7f664fec1..86e25dae1 100644 --- a/template/default/picture.tpl +++ b/template/default/picture.tpl @@ -21,21 +21,22 @@
{CATEGORY}
{PHOTO}
- -
{TITLE}
+
{TITLE}
+
{COMMENT_IMG}
+
{L_LANG_TITLE} - + {F_LANG_SELECT}
@@ -74,60 +77,53 @@ - + + + +
- - - {PREV_TITLE_IMG} + + + {PREV_TITLE_IMG} + @@ -50,8 +51,10 @@ - {NEXT_TITLE_IMG} - + + {NEXT_TITLE_IMG} + +
- {T_START}100%{T_BEGIN} - - - + + + + + + -
{comments.NAV_BAR}
- - -
-
+
+
[{comments.NB_COMMENT}] {L_COMMENT_TITLE}
{comments.NAV_BAR}
+ -
- - - - - - - -
-
{comments.comment.COMMENT_AUTHOR}
-
-
{comments.comment.COMMENT_DATE} - - [{L_DELETE}] - -
-
-
{comments.comment.COMMENT}
-
+
+ {comments.comment.COMMENT_AUTHOR} + + {comments.comment.COMMENT_DATE} + + [{L_DELETE}] + +
{comments.comment.COMMENT}
-
- - - + + + + + + + - -
-
{L_ADD_COMMENT}
+
{L_ADD_COMMENT}
- + {L_AUTHOR} +
- + -
- -
-
+ {L_COMMENT}
+ + +
- {T_END} diff --git a/template/default/profile.tpl b/template/default/profile.tpl index 8b4e4ce4b..e34ffd0ee 100644 --- a/template/default/profile.tpl +++ b/template/default/profile.tpl @@ -1,95 +1,75 @@ - - - - -
- {T_START}1px{T_BEGIN} -
{L_TITLE}
- {T_END} -
- {T_START}50%{T_BEGIN} -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
    - -
  • {errors.error.ERROR}
  • - -
-
-
 
 
 
- -
-
-
- {T_END} -
\ No newline at end of file +
{L_TITLE}
+
+ +
+
    + +
  • {errors.error.ERROR}
  • + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{L_NB_IMAGE_LINE}
{L_NB_ROW_PAGE}
{L_STYLE_SELECT}{STYLE_SELECT}
{L_LANG_SELECT}{LANG_SELECT}
{L_SHORT_PERIOD}
{L_LONG_PERIOD}
{L_EXPAND_TREE}{L_YES}   + {L_NO}
{L_NB_COMMENTS}{L_YES}   + {L_NO}
 
 
+ +
+
\ No newline at end of file diff --git a/template/default/register.tpl b/template/default/register.tpl index 72e604383..22011103f 100644 --- a/template/default/register.tpl +++ b/template/default/register.tpl @@ -1,67 +1,56 @@ - - - - -
- {T_START}1px{T_BEGIN} -
{L_TITLE}
- {T_END} -
- {T_START}50%{T_BEGIN} -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
    - -
  • {errors.error.ERROR}
  • - -
-
-
 
- -
- [ {L_GUEST} ] -
-
- {T_END} -
\ No newline at end of file +
{L_TITLE}
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
    + +
  • {errors.error.ERROR}
  • + +
+
+
{L_USERNAME} + +
{L_PASSWORD} + +
{L_CONFIRM_PASSWORD} + +
{L_EMAIL} + +
 
+ +
+ [ {L_GUEST} ] +
+
\ No newline at end of file diff --git a/template/default/search.tpl b/template/default/search.tpl index d5fbdb6b9..1046e433b 100644 --- a/template/default/search.tpl +++ b/template/default/search.tpl @@ -1,59 +1,20 @@ - - - - -
- {T_START}1px{T_BEGIN} -
{L_TITLE}
- {T_END} -
 
- {T_START}50%{T_BEGIN} -
-
- - - - - - - - - - - - - - - - - - - - - - -
-
-
    - -
  • {errors.error.ERROR}
  • - -
-
-
-
 
-
- -
- [ {L_RETURN} ] -
-
* : {L_COMMENTS}
-
-
-
- {T_END} -
\ No newline at end of file +
{L_TITLE}
+
+
+ +
+
    + +
  • {errors.error.ERROR}
  • + +
+
+ +{L_SEARCH} +
+ {L_SEARCH_OR} + {L_SEARCH_AND}
+
+[ {L_RETURN} ]
+
* : {L_COMMENTS}
+
\ No newline at end of file diff --git a/template/default/theme/01.gif b/template/default/theme/01.gif deleted file mode 100644 index ba3068d7d..000000000 Binary files a/template/default/theme/01.gif and /dev/null differ diff --git a/template/default/theme/02.gif b/template/default/theme/02.gif deleted file mode 100644 index 21bb8602a..000000000 Binary files a/template/default/theme/02.gif and /dev/null differ diff --git a/template/default/theme/03.gif b/template/default/theme/03.gif deleted file mode 100644 index d0b5f766a..000000000 Binary files a/template/default/theme/03.gif and /dev/null differ diff --git a/template/default/theme/04.gif b/template/default/theme/04.gif deleted file mode 100644 index cd4fe8fc7..000000000 Binary files a/template/default/theme/04.gif and /dev/null differ diff --git a/template/default/theme/05.gif b/template/default/theme/05.gif deleted file mode 100644 index a42ae0cd6..000000000 Binary files a/template/default/theme/05.gif and /dev/null differ diff --git a/template/default/theme/06.gif b/template/default/theme/06.gif deleted file mode 100644 index 763fa6a4f..000000000 Binary files a/template/default/theme/06.gif and /dev/null differ diff --git a/template/default/theme/07.gif b/template/default/theme/07.gif deleted file mode 100644 index 36e1dbd86..000000000 Binary files a/template/default/theme/07.gif and /dev/null differ diff --git a/template/default/theme/08.gif b/template/default/theme/08.gif deleted file mode 100644 index 39d112d33..000000000 Binary files a/template/default/theme/08.gif and /dev/null differ diff --git a/template/default/theme/09.gif b/template/default/theme/09.gif deleted file mode 100644 index 828302134..000000000 Binary files a/template/default/theme/09.gif and /dev/null differ diff --git a/template/default/theme/button_bg.gif b/template/default/theme/button_bg.gif new file mode 100644 index 000000000..442f2469c Binary files /dev/null and b/template/default/theme/button_bg.gif differ diff --git a/template/default/theme/left-arrow.jpg b/template/default/theme/left-arrow.jpg index c867edec1..44a06bccc 100644 Binary files a/template/default/theme/left-arrow.jpg and b/template/default/theme/left-arrow.jpg differ diff --git a/template/default/theme/right-arrow.jpg b/template/default/theme/right-arrow.jpg index 359ddfc2a..64e02a51f 100644 Binary files a/template/default/theme/right-arrow.jpg and b/template/default/theme/right-arrow.jpg differ -- cgit v1.2.3