2003-11-02 11:22:14 +01:00
|
|
|
<?php
|
2004-02-07 20:36:44 +01:00
|
|
|
// +-----------------------------------------------------------------------+
|
2004-02-12 00:20:38 +01:00
|
|
|
// | admin.php |
|
2004-02-07 20:36:44 +01:00
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | application : PhpWebGallery <http://phpwebgallery.net> |
|
2004-02-12 00:20:38 +01:00
|
|
|
// | branch : BSF (Best So Far) |
|
2004-02-07 20:36:44 +01:00
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | 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. |
|
|
|
|
// +-----------------------------------------------------------------------+
|
2003-11-02 11:22:14 +01:00
|
|
|
|
2004-02-02 01:55:18 +01:00
|
|
|
//----------------------------------------------------------- include
|
2004-02-19 01:31:09 +01:00
|
|
|
define('PHPWG_ROOT_PATH','./');
|
2004-03-20 01:52:37 +01:00
|
|
|
define('IN_ADMIN', true);
|
2004-02-19 01:31:09 +01:00
|
|
|
include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
|
2004-03-20 01:52:37 +01:00
|
|
|
include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
|
|
|
|
|
2003-11-02 11:22:14 +01:00
|
|
|
//--------------------------------------- validating page and creation of title
|
|
|
|
$page_valide = false;
|
|
|
|
$title = '';
|
2004-02-02 01:55:18 +01:00
|
|
|
if (isset( $_GET['page'] ))
|
2003-11-02 11:22:14 +01:00
|
|
|
switch ( $_GET['page'] )
|
|
|
|
{
|
|
|
|
case 'user_list':
|
|
|
|
$title = $lang['title_liste_users']; $page_valide = true; break;
|
|
|
|
case 'user_modify':
|
|
|
|
$title = $lang['title_modify']; $page_valide = true; break;
|
2004-03-20 01:52:37 +01:00
|
|
|
case 'user_search':
|
|
|
|
/* if ( !is_numeric( $_GET['user_id'] ) ) $_GET['user_id'] = -1;
|
2003-11-02 11:22:14 +01:00
|
|
|
$query = 'SELECT status,username';
|
2004-02-19 01:31:09 +01:00
|
|
|
$query.= ' FROM '.USERS_TABLE;
|
2003-11-02 11:22:14 +01:00
|
|
|
$query.= ' WHERE id = '.$_GET['user_id'];
|
|
|
|
$query.= ';';
|
|
|
|
$result = mysql_query( $query );
|
|
|
|
if ( mysql_num_rows( $result ) > 0 )
|
|
|
|
{
|
|
|
|
$row = mysql_fetch_array( $result );
|
|
|
|
$page['user_status'] = $row['status'];
|
|
|
|
if ( $row['username'] == 'guest' ) $row['username'] = $lang['guest'];
|
|
|
|
$page['user_username'] = $row['username'];
|
|
|
|
$page_valide = true;
|
|
|
|
$title = $lang['title_user_perm'].' "'.$page['user_username'].'"';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$page_valide = false;
|
2004-03-20 01:52:37 +01:00
|
|
|
}*/
|
|
|
|
$title = $lang['title_user_perm'];
|
|
|
|
//.' '.$_POST['username'];
|
|
|
|
$page_valide = true; break;
|
2003-11-02 11:22:14 +01:00
|
|
|
case 'group_list' :
|
|
|
|
$title = $lang['title_groups']; $page_valide = true; break;
|
|
|
|
case 'group_perm' :
|
|
|
|
if ( !is_numeric( $_GET['group_id'] ) ) $_GET['group_id'] = -1;
|
2004-03-20 01:52:37 +01:00
|
|
|
$query = 'SELECT name FROM '.GROUPS_TABLE;
|
2003-11-02 11:22:14 +01:00
|
|
|
$query.= ' WHERE id = '.$_GET['group_id'];
|
|
|
|
$query.= ';';
|
|
|
|
$result = mysql_query( $query );
|
|
|
|
if ( mysql_num_rows( $result ) > 0 )
|
|
|
|
{
|
|
|
|
$row = mysql_fetch_array( $result );
|
|
|
|
$title = $lang['title_group_perm'].' "'.$row['name'].'"';
|
|
|
|
$page_valide = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$page_valide = false;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'stats':
|
|
|
|
$title = $lang['title_history']; $page_valide = true; break;
|
|
|
|
case 'update':
|
|
|
|
$title = $lang['title_update']; $page_valide = true; break;
|
|
|
|
case 'configuration':
|
|
|
|
$title = $lang['title_configuration']; $page_valide = true; break;
|
2004-03-26 18:08:09 +01:00
|
|
|
case 'admin_phpinfo':
|
|
|
|
$title = $lang['phpinfos']; $page_valide = true; break;
|
2003-11-02 11:22:14 +01:00
|
|
|
case 'help':
|
|
|
|
$title = $lang['title_instructions']; $page_valide = true; break;
|
|
|
|
case 'cat_perm':
|
|
|
|
$title = $lang['title_cat_perm'];
|
|
|
|
if ( isset( $_GET['cat_id'] ) )
|
|
|
|
{
|
|
|
|
check_cat_id( $_GET['cat_id'] );
|
|
|
|
if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ) )
|
|
|
|
{
|
|
|
|
$result = get_cat_info( $page['cat'] );
|
|
|
|
$name = get_cat_display_name( $result['name'],' > ', '' );
|
|
|
|
$title.= ' "'.$name.'"';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$page_valide = true;
|
|
|
|
break;
|
|
|
|
case 'cat_list':
|
|
|
|
$title = $lang['title_categories']; $page_valide = true; break;
|
|
|
|
case 'cat_modify':
|
|
|
|
$title = $lang['title_edit_cat']; $page_valide = true; break;
|
2004-03-31 19:26:31 +02:00
|
|
|
case 'admin_upload':
|
|
|
|
$title = $lang['upload']; $page_valide = true; break;
|
2003-11-02 11:22:14 +01:00
|
|
|
case 'infos_images':
|
|
|
|
$title = $lang['title_info_images']; $page_valide = true; break;
|
|
|
|
case 'waiting':
|
|
|
|
$title = $lang['title_waiting']; $page_valide = true; break;
|
|
|
|
case 'thumbnail':
|
|
|
|
$title = $lang['title_thumbnails'];
|
|
|
|
if ( isset( $_GET['dir'] ) )
|
|
|
|
{
|
2004-03-20 01:52:37 +01:00
|
|
|
$title.= ' '.$lang['title_thumbnails_2'].' <span class="titreImg">';
|
2003-11-02 11:22:14 +01:00
|
|
|
// $_GET['dir'] contains :
|
2003-11-03 22:35:24 +01:00
|
|
|
// ./galleries/vieux_lyon ou
|
|
|
|
// ./galleries/vieux_lyon/visite ou
|
|
|
|
// ./galleries/vieux_lyon/visite/truc ...
|
2003-11-02 11:22:14 +01:00
|
|
|
$dir = explode( "/", $_GET['dir'] );
|
|
|
|
$title.= $dir[2];
|
2004-03-20 01:52:37 +01:00
|
|
|
for ( $i = 2; $i < sizeof( $dir ) - 1; $i++ )
|
2003-11-02 11:22:14 +01:00
|
|
|
{
|
2004-03-20 01:52:37 +01:00
|
|
|
$title.= ' > '.$dir[$i+1];
|
2003-11-02 11:22:14 +01:00
|
|
|
}
|
|
|
|
$title.= "</span>";
|
|
|
|
}
|
|
|
|
$page_valide = true;
|
|
|
|
break;
|
|
|
|
case 'comments' :
|
|
|
|
$title = $lang['title_comments'];
|
|
|
|
$page_valide = true;
|
|
|
|
break;
|
|
|
|
case 'picture_modify' :
|
|
|
|
$title = $lang['title_picmod'];
|
|
|
|
$page_valide = true;
|
|
|
|
break;
|
2004-09-18 18:09:47 +02:00
|
|
|
case 'remote_site' :
|
|
|
|
{
|
|
|
|
$title = $lang['remote_sites'];
|
|
|
|
$page_valide = true;
|
|
|
|
break;
|
|
|
|
}
|
2003-11-02 11:22:14 +01:00
|
|
|
default:
|
|
|
|
$title = $lang['title_default']; break;
|
|
|
|
}
|
|
|
|
if ( $title == '' ) $title = $lang['title_default'];
|
2004-03-20 01:52:37 +01:00
|
|
|
|
2003-11-02 11:22:14 +01:00
|
|
|
// waiting
|
2004-03-20 01:52:37 +01:00
|
|
|
$query = 'SELECT id FROM '.WAITING_TABLE;
|
2003-11-02 11:22:14 +01:00
|
|
|
$query.= " WHERE validated='false'";
|
|
|
|
$query.= ';';
|
|
|
|
$result = mysql_query( $query );
|
|
|
|
$nb_waiting = '';
|
|
|
|
if ( mysql_num_rows( $result ) > 0 )
|
|
|
|
{
|
|
|
|
$nb_waiting = ' [ '.mysql_num_rows( $result ).' ]';
|
|
|
|
}
|
|
|
|
// comments
|
2004-03-20 01:52:37 +01:00
|
|
|
$query = 'SELECT id FROM '.COMMENTS_TABLE;
|
2003-11-02 11:22:14 +01:00
|
|
|
$query.= " WHERE validated='false'";
|
|
|
|
$query.= ';';
|
|
|
|
$result = mysql_query( $query );
|
2004-03-20 01:52:37 +01:00
|
|
|
$nb_comments = '';
|
2003-11-02 11:22:14 +01:00
|
|
|
if ( mysql_num_rows( $result ) > 0 )
|
|
|
|
{
|
2004-03-20 01:52:37 +01:00
|
|
|
$nb_comments = ' [ '.mysql_num_rows( $result ).' ]';
|
2003-11-02 11:22:14 +01:00
|
|
|
}
|
2004-03-20 01:52:37 +01:00
|
|
|
|
|
|
|
$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(
|
2004-03-26 18:08:09 +01:00
|
|
|
'L_TITLE'=>$lang['admin_panel'],
|
|
|
|
'L_LINKS'=>$lang['links'],
|
|
|
|
'L_GALLERY_INDEX'=>$lang['gallery_index'],
|
|
|
|
'L_GENERAL'=>$lang['general'],
|
|
|
|
'L_DEFAULT'=>$lang['gallery_default'],
|
|
|
|
'L_PHPINFO'=>$lang['phpinfos'],
|
|
|
|
'L_HISTORY'=>$lang['history'],
|
|
|
|
'L_FAQ'=>$lang['instructions'],
|
2004-09-20 00:26:41 +02:00
|
|
|
'L_CONFIGURATION'=>$lang['config'],
|
|
|
|
'L_CONFIG_GENERAL'=>$lang['general'],
|
|
|
|
'L_CONFIG_COMMENTS'=>$lang['comments'],
|
|
|
|
'L_CONFIG_DISPLAY'=>$lang['conf_default'],
|
|
|
|
'L_CONFIG_UPLOAD'=>$lang['upload'],
|
|
|
|
'L_CONFIG_SESSION'=>$lang['conf_cookie'],
|
|
|
|
'L_CONFIG_METADATA'=>$lang['metadata'],
|
2004-09-20 22:08:15 +02:00
|
|
|
'L_SITES'=>$lang['remote_sites'],
|
2004-03-26 18:08:09 +01:00
|
|
|
'L_CATEGORIES'=>$lang['categories'],
|
|
|
|
'L_MANAGE'=>$lang['manage'],
|
|
|
|
'L_UPLOAD'=>$lang['upload'],
|
|
|
|
'L_IMAGES'=>$lang['pictures'],
|
|
|
|
'L_WAITING'=>$lang['waiting'].$nb_waiting,
|
|
|
|
'L_COMMENTS'=>$lang['comments'].$nb_comments,
|
|
|
|
'L_THUMBNAILS'=>$lang['thumbnails'],
|
|
|
|
'L_IDENTIFY'=>$lang['identification'],
|
|
|
|
'L_USERS'=>$lang['users'],
|
|
|
|
'L_GROUPS'=>$lang['groups'],
|
|
|
|
'L_AUTH'=>$lang['permissions'],
|
|
|
|
'L_UPDATE'=>$lang['update'],
|
|
|
|
|
2004-09-20 00:26:41 +02:00
|
|
|
'U_CONFIG_GENERAL'=>add_session_id($link_start.'configuration&section=general' ),
|
|
|
|
'U_CONFIG_COMMENTS'=>add_session_id($link_start.'configuration&section=comments' ),
|
|
|
|
'U_CONFIG_DISPLAY'=>add_session_id($link_start.'configuration&section=default' ),
|
|
|
|
'U_CONFIG_UPLOAD'=>add_session_id($link_start.'configuration&section=upload' ),
|
|
|
|
'U_CONFIG_SESSION'=>add_session_id($link_start.'configuration&section=session' ),
|
|
|
|
'U_CONFIG_METADATA'=>add_session_id($link_start.'configuration&section=metadata' ),
|
2004-09-20 22:08:15 +02:00
|
|
|
'U_SITES'=>add_session_id($link_start.'remote_site'),
|
2004-03-26 18:08:09 +01:00
|
|
|
'U_PHPINFO'=>add_session_id($link_start.'admin_phpinfo' ),
|
2004-03-20 01:52:37 +01:00
|
|
|
'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' ),
|
2004-03-31 19:26:31 +02:00
|
|
|
'U_UPLOAD'=>add_session_id($link_start.'admin_upload' ),
|
2004-03-20 01:52:37 +01:00
|
|
|
'U_WAITING'=>add_session_id($link_start.'waiting' ),
|
|
|
|
'U_COMMENTS'=>add_session_id($link_start.'comments' ),
|
2004-03-26 18:08:09 +01:00
|
|
|
'U_CAT_UPDATE'=>add_session_id($link_start.'update&update=cats' ),
|
|
|
|
'U_IMG_UPDATE'=>add_session_id($link_start.'update&update=all' ),
|
2004-03-20 01:52:37 +01:00
|
|
|
'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=';
|
2003-11-02 11:22:14 +01:00
|
|
|
//------------------------------------------------------------- content display
|
|
|
|
if ( $page_valide )
|
|
|
|
{
|
2004-03-20 01:52:37 +01:00
|
|
|
if ($_GET['page']=='comments') include ( PHPWG_ROOT_PATH.'comments.php');
|
|
|
|
else include ( PHPWG_ROOT_PATH.'admin/'.$_GET['page'].'.php' );
|
2003-11-02 11:22:14 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-03-20 01:52:37 +01:00
|
|
|
$template->assign_vars(array ('ADMIN_CONTENT'=> '<div style="text-align:center">'.$lang['default_message'].'</div>') );
|
2003-11-02 11:22:14 +01:00
|
|
|
}
|
2004-03-20 01:52:37 +01:00
|
|
|
$template->pparse('admin');
|
|
|
|
include(PHPWG_ROOT_PATH.'include/page_tail.php');
|
2004-02-12 00:20:38 +01:00
|
|
|
?>
|