6 |
kaklik |
1 |
<?php
|
|
|
2 |
// +-----------------------------------------------------------------------+
|
|
|
3 |
// | PhpWebGallery - a PHP based picture gallery |
|
|
|
4 |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
|
|
5 |
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
|
|
|
6 |
// +-----------------------------------------------------------------------+
|
|
|
7 |
// | branch : BSF (Best So Far)
|
|
|
8 |
// | file : $RCSfile: admin.php,v $
|
|
|
9 |
// | last update : $Date: 2005/01/19 23:34:42 $
|
|
|
10 |
// | last modifier : $Author: plg $
|
|
|
11 |
// | revision : $Revision: 1.32 $
|
|
|
12 |
// +-----------------------------------------------------------------------+
|
|
|
13 |
// | This program is free software; you can redistribute it and/or modify |
|
|
|
14 |
// | it under the terms of the GNU General Public License as published by |
|
|
|
15 |
// | the Free Software Foundation |
|
|
|
16 |
// | |
|
|
|
17 |
// | This program is distributed in the hope that it will be useful, but |
|
|
|
18 |
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
19 |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
|
|
20 |
// | General Public License for more details. |
|
|
|
21 |
// | |
|
|
|
22 |
// | You should have received a copy of the GNU General Public License |
|
|
|
23 |
// | along with this program; if not, write to the Free Software |
|
|
|
24 |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
|
|
25 |
// | USA. |
|
|
|
26 |
// +-----------------------------------------------------------------------+
|
|
|
27 |
|
|
|
28 |
//----------------------------------------------------------- include
|
|
|
29 |
define('PHPWG_ROOT_PATH','./');
|
|
|
30 |
define('IN_ADMIN', true);
|
|
|
31 |
include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
|
|
|
32 |
include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
|
|
|
33 |
//--------------------------------------- validating page and creation of title
|
|
|
34 |
$page_valide = false;
|
|
|
35 |
$title = '';
|
|
|
36 |
$username='';
|
|
|
37 |
if (isset($_POST['username']))
|
|
|
38 |
{
|
|
|
39 |
$username = $_POST['username'];
|
|
|
40 |
}
|
|
|
41 |
else if (isset($_POST['userid']))
|
|
|
42 |
{
|
|
|
43 |
$username = get_username($_POST['userid']);
|
|
|
44 |
}
|
|
|
45 |
else if (isset($_GET['user_id']))
|
|
|
46 |
{
|
|
|
47 |
$username = get_username($_GET['user_id']);
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
if (isset( $_GET['page'] ))
|
|
|
51 |
switch ( $_GET['page'] )
|
|
|
52 |
{
|
|
|
53 |
case 'user_list':
|
|
|
54 |
$title = $lang['title_liste_users']; $page_valide = true; break;
|
|
|
55 |
case 'profile':
|
|
|
56 |
$title = $lang['title_user_modify'];
|
|
|
57 |
$page_valide = true;
|
|
|
58 |
break;
|
|
|
59 |
case 'user_perm':
|
|
|
60 |
$title = $lang['title_user_perm'].' '.$username;
|
|
|
61 |
$page_valide = true; break;
|
|
|
62 |
case 'group_list' :
|
|
|
63 |
$title = $lang['title_groups']; $page_valide = true; break;
|
|
|
64 |
case 'group_perm' :
|
|
|
65 |
/*if ( !is_numeric( $_GET['group_id'] ) ) $_GET['group_id'] = -1;
|
|
|
66 |
$query = 'SELECT name FROM '.GROUPS_TABLE;
|
|
|
67 |
$query.= ' WHERE id = '.$_GET['group_id'];
|
|
|
68 |
$query.= ';';
|
|
|
69 |
$result = pwg_query( $query );
|
|
|
70 |
if ( mysql_num_rows( $result ) > 0 )
|
|
|
71 |
{
|
|
|
72 |
$row = mysql_fetch_array( $result );*/
|
|
|
73 |
$title = $lang['title_group_perm'];//.' "'.$row['name'].'"';
|
|
|
74 |
$page_valide = true;
|
|
|
75 |
/*}
|
|
|
76 |
else
|
|
|
77 |
{
|
|
|
78 |
$page_valide = false;
|
|
|
79 |
}*/
|
|
|
80 |
break;
|
|
|
81 |
case 'stats':
|
|
|
82 |
$title = $lang['title_history']; $page_valide = true; break;
|
|
|
83 |
case 'update':
|
|
|
84 |
$title = $lang['title_update']; $page_valide = true; break;
|
|
|
85 |
case 'configuration':
|
|
|
86 |
$title = $lang['title_configuration']; $page_valide = true; break;
|
|
|
87 |
case 'admin_phpinfo':
|
|
|
88 |
$title = $lang['phpinfos']; $page_valide = true; break;
|
|
|
89 |
case 'help':
|
|
|
90 |
$title = $lang['title_instructions']; $page_valide = true; break;
|
|
|
91 |
case 'cat_perm':
|
|
|
92 |
$title = $lang['title_cat_perm'];
|
|
|
93 |
if ( isset( $_GET['cat_id'] ) )
|
|
|
94 |
{
|
|
|
95 |
check_cat_id( $_GET['cat_id'] );
|
|
|
96 |
if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ) )
|
|
|
97 |
{
|
|
|
98 |
$result = get_cat_info( $page['cat'] );
|
|
|
99 |
$name = get_cat_display_name($result['name'], '');
|
|
|
100 |
$title.= ' "'.$name.'"';
|
|
|
101 |
}
|
|
|
102 |
}
|
|
|
103 |
$page_valide = true;
|
|
|
104 |
break;
|
|
|
105 |
case 'cat_list':
|
|
|
106 |
$title = $lang['title_categories']; $page_valide = true; break;
|
|
|
107 |
case 'cat_modify':
|
|
|
108 |
$title = $lang['title_edit_cat']; $page_valide = true; break;
|
|
|
109 |
case 'infos_images':
|
|
|
110 |
$title = $lang['title_info_images']; $page_valide = true; break;
|
|
|
111 |
case 'waiting':
|
|
|
112 |
$title = $lang['title_waiting']; $page_valide = true; break;
|
|
|
113 |
case 'thumbnail':
|
|
|
114 |
$title = $lang['title_thumbnails'];
|
|
|
115 |
if ( isset( $_GET['dir'] ) )
|
|
|
116 |
{
|
|
|
117 |
$title.= ' '.$lang['title_thumbnails_2'].' <span class="titreImg">';
|
|
|
118 |
// $_GET['dir'] contains :
|
|
|
119 |
// ./galleries/vieux_lyon ou
|
|
|
120 |
// ./galleries/vieux_lyon/visite ou
|
|
|
121 |
// ./galleries/vieux_lyon/visite/truc ...
|
|
|
122 |
$dir = explode( "/", $_GET['dir'] );
|
|
|
123 |
$title.= $dir[2];
|
|
|
124 |
for ( $i = 2; $i < sizeof( $dir ) - 1; $i++ )
|
|
|
125 |
{
|
|
|
126 |
$title.= ' > '.$dir[$i+1];
|
|
|
127 |
}
|
|
|
128 |
$title.= "</span>";
|
|
|
129 |
}
|
|
|
130 |
$page_valide = true;
|
|
|
131 |
break;
|
|
|
132 |
case 'comments' :
|
|
|
133 |
$title = $lang['title_comments'];
|
|
|
134 |
$page_valide = true;
|
|
|
135 |
break;
|
|
|
136 |
case 'picture_modify' :
|
|
|
137 |
$title = $lang['title_picmod'];
|
|
|
138 |
$page_valide = true;
|
|
|
139 |
break;
|
|
|
140 |
case 'remote_site' :
|
|
|
141 |
{
|
|
|
142 |
$title = $lang['remote_sites'];
|
|
|
143 |
$page_valide = true;
|
|
|
144 |
break;
|
|
|
145 |
}
|
|
|
146 |
case 'cat_options' :
|
|
|
147 |
{
|
|
|
148 |
$title = $lang['title_cat_options'];
|
|
|
149 |
$page_valide = true;
|
|
|
150 |
break;
|
|
|
151 |
}
|
|
|
152 |
default:
|
|
|
153 |
$title = $lang['title_default']; break;
|
|
|
154 |
}
|
|
|
155 |
if ( $title == '' ) $title = $lang['title_default'];
|
|
|
156 |
|
|
|
157 |
// waiting
|
|
|
158 |
$query = 'SELECT id FROM '.WAITING_TABLE;
|
|
|
159 |
$query.= " WHERE validated='false'";
|
|
|
160 |
$query.= ';';
|
|
|
161 |
$result = pwg_query( $query );
|
|
|
162 |
$nb_waiting = '';
|
|
|
163 |
if ( mysql_num_rows( $result ) > 0 )
|
|
|
164 |
{
|
|
|
165 |
$nb_waiting = ' [ '.mysql_num_rows( $result ).' ]';
|
|
|
166 |
}
|
|
|
167 |
// comments
|
|
|
168 |
$query = 'SELECT id FROM '.COMMENTS_TABLE;
|
|
|
169 |
$query.= " WHERE validated='false'";
|
|
|
170 |
$query.= ';';
|
|
|
171 |
$result = pwg_query( $query );
|
|
|
172 |
$nb_comments = '';
|
|
|
173 |
if ( mysql_num_rows( $result ) > 0 )
|
|
|
174 |
{
|
|
|
175 |
$nb_comments = ' [ '.mysql_num_rows( $result ).' ]';
|
|
|
176 |
}
|
|
|
177 |
|
|
|
178 |
$link_start = PHPWG_ROOT_PATH.'admin.php?page=';
|
|
|
179 |
$conf_link = $link_start.'configuration&section=';
|
|
|
180 |
$opt_link = $link_start.'cat_options&section=';
|
|
|
181 |
//----------------------------------------------------- template initialization
|
|
|
182 |
include(PHPWG_ROOT_PATH.'include/page_header.php');
|
|
|
183 |
$template->set_filenames( array('admin'=>'admin.tpl') );
|
|
|
184 |
|
|
|
185 |
$template->assign_vars(array(
|
|
|
186 |
'L_TITLE'=>$lang['admin_panel'],
|
|
|
187 |
'L_LINKS'=>$lang['links'],
|
|
|
188 |
'L_GALLERY_INDEX'=>$lang['home'],
|
|
|
189 |
'L_GENERAL'=>$lang['general'],
|
|
|
190 |
'L_DEFAULT'=>$lang['gallery_default'],
|
|
|
191 |
'L_PHPINFO'=>$lang['phpinfos'],
|
|
|
192 |
'L_HISTORY'=>$lang['history'],
|
|
|
193 |
'L_FAQ'=>$lang['instructions'],
|
|
|
194 |
'L_CONFIGURATION'=>$lang['config'],
|
|
|
195 |
'L_CONFIG_GENERAL'=>$lang['general'],
|
|
|
196 |
'L_CONFIG_COMMENTS'=>$lang['comments'],
|
|
|
197 |
'L_CONFIG_DISPLAY'=>$lang['conf_default'],
|
|
|
198 |
'L_CONFIG_UPLOAD'=>$lang['upload'],
|
|
|
199 |
'L_CONFIG_SESSION'=>$lang['conf_cookie'],
|
|
|
200 |
'L_CONFIG_METADATA'=>$lang['metadata'],
|
|
|
201 |
'L_SITES'=>$lang['remote_sites'],
|
|
|
202 |
'L_CATEGORIES'=>$lang['categories'],
|
|
|
203 |
'L_MANAGE'=>$lang['manage'],
|
|
|
204 |
'L_IMAGES'=>$lang['pictures'],
|
|
|
205 |
'L_WAITING'=>$lang['waiting'].$nb_waiting,
|
|
|
206 |
'L_COMMENTS'=>$lang['comments'].$nb_comments,
|
|
|
207 |
'L_THUMBNAILS'=>$lang['thumbnails'],
|
|
|
208 |
'L_IDENTIFY'=>$lang['identification'],
|
|
|
209 |
'L_USERS'=>$lang['users'],
|
|
|
210 |
'L_GROUPS'=>$lang['groups'],
|
|
|
211 |
'L_AUTH'=>$lang['permissions'],
|
|
|
212 |
'L_UPDATE'=>$lang['update'],
|
|
|
213 |
'L_CAT_UPLOAD'=>$lang['upload'],
|
|
|
214 |
'L_CAT_COMMENTS'=>$lang['comments'],
|
|
|
215 |
'L_CAT_VISIBLE'=>$lang['lock'],
|
|
|
216 |
'L_CAT_STATUS'=>$lang['cat_security'],
|
|
|
217 |
|
|
|
218 |
'U_HISTORY'=>add_session_id($link_start.'stats' ),
|
|
|
219 |
'U_FAQ'=>add_session_id($link_start.'help' ),
|
|
|
220 |
'U_SITES'=>add_session_id($link_start.'remote_site'),
|
|
|
221 |
'U_PHPINFO'=>add_session_id($link_start.'admin_phpinfo' ),
|
|
|
222 |
'U_CONFIG_GENERAL'=>add_session_id($conf_link.'general' ),
|
|
|
223 |
'U_CONFIG_COMMENTS'=>add_session_id($conf_link.'comments' ),
|
|
|
224 |
'U_CONFIG_DISPLAY'=>add_session_id($conf_link.'default' ),
|
|
|
225 |
'U_CONFIG_UPLOAD'=>add_session_id($conf_link.'upload' ),
|
|
|
226 |
'U_CONFIG_SESSION'=>add_session_id($conf_link.'session' ),
|
|
|
227 |
'U_CONFIG_METADATA'=>add_session_id($conf_link.'metadata' ),
|
|
|
228 |
'U_CATEGORIES'=>add_session_id($link_start.'cat_list' ),
|
|
|
229 |
'U_CAT_UPLOAD'=>add_session_id($opt_link.'upload'),
|
|
|
230 |
'U_CAT_COMMENTS'=>add_session_id($opt_link.'comments'),
|
|
|
231 |
'U_CAT_VISIBLE'=>add_session_id($opt_link.'visible'),
|
|
|
232 |
'U_CAT_STATUS'=>add_session_id($opt_link.'status'),
|
|
|
233 |
'U_CAT_OPTIONS'=>add_session_id($link_start.'cat_options'),
|
|
|
234 |
'U_CAT_UPDATE'=>add_session_id($link_start.'update'),
|
|
|
235 |
'U_WAITING'=>add_session_id($link_start.'waiting' ),
|
|
|
236 |
'U_COMMENTS'=>add_session_id($link_start.'comments' ),
|
|
|
237 |
'U_THUMBNAILS'=>add_session_id($link_start.'thumbnail' ),
|
|
|
238 |
'U_USERS'=>add_session_id($link_start.'profile' ),
|
|
|
239 |
'U_GROUPS'=>add_session_id($link_start.'group_list' ),
|
|
|
240 |
'U_USERS_AUTH'=>add_session_id($link_start.'user_perm' ),
|
|
|
241 |
'U_GROUPS_AUTH'=>add_session_id($link_start.'group_perm'),
|
|
|
242 |
'U_CAT_AUTH'=>add_session_id($link_start.'cat_perm' ),
|
|
|
243 |
'U_RETURN'=>add_session_id(PHPWG_ROOT_PATH.'category.php')
|
|
|
244 |
));
|
|
|
245 |
|
|
|
246 |
//--------------------------------------------------------------------- summary
|
|
|
247 |
$link_start = PHPWG_ROOT_PATH.'admin.php?page=';
|
|
|
248 |
//------------------------------------------------------------- content display
|
|
|
249 |
if ( $page_valide )
|
|
|
250 |
{
|
|
|
251 |
if ($_GET['page']=='comments') include ( PHPWG_ROOT_PATH.'comments.php');
|
|
|
252 |
elseif ($_GET['page']=='profile') include ( PHPWG_ROOT_PATH.'profile.php');
|
|
|
253 |
else include ( PHPWG_ROOT_PATH.'admin/'.$_GET['page'].'.php' );
|
|
|
254 |
}
|
|
|
255 |
else
|
|
|
256 |
{
|
|
|
257 |
$template->assign_vars(array ('ADMIN_CONTENT'=> '<div style="text-align:center">'.$lang['default_message'].'</div>') );
|
|
|
258 |
}
|
|
|
259 |
$template->parse('admin');
|
|
|
260 |
include(PHPWG_ROOT_PATH.'include/page_tail.php');
|
|
|
261 |
// +-----------------------------------------------------------------------+
|
|
|
262 |
// | order permission refreshment |
|
|
|
263 |
// +-----------------------------------------------------------------------+
|
|
|
264 |
$query = '
|
|
|
265 |
UPDATE '.USER_FORBIDDEN_TABLE.'
|
|
|
266 |
SET need_update = \'true\'
|
|
|
267 |
;';
|
|
|
268 |
pwg_query($query);
|
|
|
269 |
?>
|