source: trunk/admin.php @ 620

Last change on this file since 620 was 620, checked in by plg, 19 years ago

distinction between categories' admin menus and others (comments for
categories is not the same as users comments)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.2 KB
Line 
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-2004 PhpWebGallery Team - http://phpwebgallery.net |
6// +-----------------------------------------------------------------------+
7// | branch        : BSF (Best So Far)
8// | file          : $RCSfile$
9// | last update   : $Date: 2004-11-24 21:57:22 +0000 (Wed, 24 Nov 2004) $
10// | last modifier : $Author: plg $
11// | revision      : $Revision: 620 $
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
29define('PHPWG_ROOT_PATH','./');
30define('IN_ADMIN', true);
31include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
32include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
33
34//--------------------------------------- validating page and creation of title
35$page_valide = false;
36$title = '';
37if (isset( $_GET['page'] ))
38switch ( $_GET['page'] )
39{
40 case 'user_list':
41   $title = $lang['title_liste_users'];   $page_valide = true; break;
42 case 'user_modify':
43   $title = $lang['title_modify'];        $page_valide = true; break;
44 case 'user_search':
45   $username='';
46   if (isset($_POST['username'])) $username=$_POST['username'];
47   $title = $lang['title_user_perm'].' '.$username;
48   $page_valide = true; break;
49 case 'group_list' :
50   $title = $lang['title_groups'];        $page_valide = true; break;
51 case 'group_perm' :
52   if ( !is_numeric( $_GET['group_id'] ) ) $_GET['group_id'] = -1;
53   $query = 'SELECT name FROM '.GROUPS_TABLE;
54   $query.= ' WHERE id = '.$_GET['group_id'];
55   $query.= ';';
56   $result = pwg_query( $query );
57   if ( mysql_num_rows( $result ) > 0 )
58   {
59     $row = mysql_fetch_array( $result );
60     $title = $lang['title_group_perm'].' "'.$row['name'].'"';
61     $page_valide = true;
62   }
63   else
64   {
65     $page_valide = false;
66   }
67   break;
68 case 'stats':
69   $title = $lang['title_history'];       $page_valide = true; break;
70 case 'update':
71   $title = $lang['title_update'];        $page_valide = true; break;
72 case 'configuration':
73   $title = $lang['title_configuration']; $page_valide = true; break;
74 case 'admin_phpinfo':
75   $title = $lang['phpinfos']; $page_valide = true; break;
76 case 'help':
77   $title = $lang['title_instructions'];  $page_valide = true; break;
78 case 'cat_perm':
79   $title = $lang['title_cat_perm'];
80   if ( isset( $_GET['cat_id'] ) )
81   {
82     check_cat_id( $_GET['cat_id'] );
83     if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ) )
84     {
85       $result = get_cat_info( $page['cat'] );
86       $name = get_cat_display_name( $result['name'],' &gt; ', '' );
87       $title.= ' "'.$name.'"';
88     }
89   }
90   $page_valide = true;
91   break;
92 case 'cat_list':
93   $title = $lang['title_categories'];    $page_valide = true; break;
94 case 'cat_modify':
95   $title = $lang['title_edit_cat'];      $page_valide = true; break;
96 case 'admin_upload':
97   $title = $lang['upload'];      $page_valide = true; break;
98 case 'infos_images':
99   $title = $lang['title_info_images'];   $page_valide = true; break;
100 case 'waiting':
101   $title = $lang['title_waiting'];       $page_valide = true; break;
102 case 'thumbnail':
103   $title = $lang['title_thumbnails'];
104   if ( isset( $_GET['dir'] ) )
105   {
106     $title.= ' '.$lang['title_thumbnails_2'].' <span class="titreImg">';
107     // $_GET['dir'] contains :
108     // ./galleries/vieux_lyon ou
109     // ./galleries/vieux_lyon/visite ou
110     // ./galleries/vieux_lyon/visite/truc ...
111     $dir = explode( "/", $_GET['dir'] );
112     $title.= $dir[2];
113     for ( $i = 2; $i < sizeof( $dir ) - 1; $i++ )
114     {
115       $title.= ' &gt; '.$dir[$i+1];
116     }
117     $title.= "</span>";
118   }
119   $page_valide = true;
120   break;
121 case 'comments' :
122   $title = $lang['title_comments'];
123   $page_valide = true;
124   break;
125 case 'picture_modify' :
126   $title = $lang['title_picmod'];
127   $page_valide = true;
128   break;
129 case 'remote_site' :
130 {
131   $title = $lang['remote_sites'];
132   $page_valide = true;
133   break;
134 }
135 case 'cat_options' :
136 {
137   $title = $lang['title_cat_options'];
138   $page_valide = true;
139   break;
140 }
141 default:
142   $title = $lang['title_default']; break;
143}
144if ( $title == '' ) $title = $lang['title_default'];
145
146// waiting
147$query = 'SELECT id FROM '.WAITING_TABLE;
148$query.= " WHERE validated='false'";
149$query.= ';';
150$result = pwg_query( $query );
151$nb_waiting = '';
152if ( mysql_num_rows( $result ) > 0 )
153{
154  $nb_waiting =  ' [ '.mysql_num_rows( $result ).' ]';
155}
156// comments
157$query = 'SELECT id FROM '.COMMENTS_TABLE;
158$query.= " WHERE validated='false'";
159$query.= ';';
160$result = pwg_query( $query );
161$nb_comments = '';
162if ( mysql_num_rows( $result ) > 0 )
163{
164  $nb_comments =  ' [ '.mysql_num_rows( $result ).' ]';
165}
166
167$link_start = PHPWG_ROOT_PATH.'admin.php?page=';
168$conf_link = $link_start.'configuration&amp;section=';
169$opt_link = $link_start.'cat_options&amp;section=';
170//----------------------------------------------------- template initialization
171include(PHPWG_ROOT_PATH.'include/page_header.php');
172$template->set_filenames( array('admin'=>'admin.tpl') );
173
174$template->assign_vars(array(
175  'L_TITLE'=>$lang['admin_panel'],
176  'L_LINKS'=>$lang['links'],
177  'L_GALLERY_INDEX'=>$lang['home'],
178  'L_GENERAL'=>$lang['general'],
179  'L_DEFAULT'=>$lang['gallery_default'],
180  'L_PHPINFO'=>$lang['phpinfos'],
181  'L_HISTORY'=>$lang['history'],
182  'L_FAQ'=>$lang['instructions'],
183  'L_CONFIGURATION'=>$lang['config'],
184  'L_CONFIG_GENERAL'=>$lang['general'],
185  'L_CONFIG_COMMENTS'=>$lang['comments'],
186  'L_CONFIG_DISPLAY'=>$lang['conf_default'],
187  'L_CONFIG_UPLOAD'=>$lang['upload'],
188  'L_CONFIG_SESSION'=>$lang['conf_cookie'],
189  'L_CONFIG_METADATA'=>$lang['metadata'],
190  'L_SITES'=>$lang['remote_sites'],
191  'L_CATEGORIES'=>$lang['categories'],
192  'L_MANAGE'=>$lang['manage'],
193  'L_IMAGES'=>$lang['pictures'],
194  'L_WAITING'=>$lang['waiting'].$nb_waiting,
195  'L_COMMENTS'=>$lang['comments'].$nb_comments,
196  'L_THUMBNAILS'=>$lang['thumbnails'],
197  'L_IDENTIFY'=>$lang['identification'],
198  'L_USERS'=>$lang['users'],
199  'L_GROUPS'=>$lang['groups'],
200  'L_AUTH'=>$lang['permissions'],
201  'L_UPDATE'=>$lang['update'],
202  'L_CAT_UPLOAD'=>$lang['cat_options_upload_menu'],
203  'L_CAT_COMMENTS'=>$lang['cat_options_comments_menu'],
204  'L_CAT_VISIBLE'=>$lang['cat_options_visible_menu'],
205  'L_CAT_STATUS'=>$lang['cat_options_status_menu'],
206
207  'U_CONFIG_GENERAL'=>add_session_id($conf_link.'general' ),
208  'U_CONFIG_COMMENTS'=>add_session_id($conf_link.'comments' ),
209  'U_CONFIG_DISPLAY'=>add_session_id($conf_link.'default' ),
210  'U_CONFIG_UPLOAD'=>add_session_id($conf_link.'upload' ),
211  'U_CONFIG_SESSION'=>add_session_id($conf_link.'session' ),
212  'U_CONFIG_METADATA'=>add_session_id($conf_link.'metadata' ),
213  'U_SITES'=>add_session_id($link_start.'remote_site'),
214  'U_PHPINFO'=>add_session_id($link_start.'admin_phpinfo' ),
215  'U_USERS'=>add_session_id($link_start.'user_search' ),
216  'U_GROUPS'=>add_session_id($link_start.'group_list' ),
217  'U_CATEGORIES'=>add_session_id($link_start.'cat_list' ),
218  'U_CAT_UPLOAD'=>add_session_id($opt_link.'upload'),
219  'U_CAT_COMMENTS'=>add_session_id($opt_link.'comments'),
220  'U_CAT_VISIBLE'=>add_session_id($opt_link.'visible'),
221  'U_CAT_STATUS'=>add_session_id($opt_link.'status'),
222  'U_WAITING'=>add_session_id($link_start.'waiting' ),
223  'U_COMMENTS'=>add_session_id($link_start.'comments' ),
224  'U_CAT_UPDATE'=>add_session_id($link_start.'update'),
225  'U_THUMBNAILS'=>add_session_id($link_start.'thumbnail' ),
226  'U_HISTORY'=>add_session_id($link_start.'stats' ),
227  'U_FAQ'=>add_session_id($link_start.'help' ),
228  'U_CAT_OPTIONS'=>add_session_id($link_start.'cat_options'),
229  'U_RETURN'=>add_session_id(PHPWG_ROOT_PATH.'category.php')
230  ));
231
232//--------------------------------------------------------------------- summary
233$link_start = PHPWG_ROOT_PATH.'admin.php?page=';
234//------------------------------------------------------------- content display
235if ( $page_valide )
236{
237  if ($_GET['page']=='comments') include ( PHPWG_ROOT_PATH.'comments.php');
238  else include ( PHPWG_ROOT_PATH.'admin/'.$_GET['page'].'.php' );
239}
240else
241{
242  $template->assign_vars(array ('ADMIN_CONTENT'=> '<div style="text-align:center">'.$lang['default_message'].'</div>') );
243}
244$template->pparse('admin');
245include(PHPWG_ROOT_PATH.'include/page_tail.php');
246?>
Note: See TracBrowser for help on using the repository browser.