source: trunk/admin.php @ 527

Last change on this file since 527 was 527, checked in by gweltas, 20 years ago
  • dispatch of configuration
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.4 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// |                               admin.php                               |
4// +-----------------------------------------------------------------------+
5// | application   : PhpWebGallery <http://phpwebgallery.net>              |
6// | branch        : BSF (Best So Far)                                     |
7// +-----------------------------------------------------------------------+
8// | file          : $RCSfile$
9// | last update   : $Date: 2004-09-19 22:26:41 +0000 (Sun, 19 Sep 2004) $
10// | last modifier : $Author: gweltas $
11// | revision      : $Revision: 527 $
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  /* if ( !is_numeric( $_GET['user_id'] ) ) $_GET['user_id'] = -1;
46   $query = 'SELECT status,username';
47   $query.= ' FROM '.USERS_TABLE;
48   $query.= ' WHERE id = '.$_GET['user_id'];
49   $query.= ';';
50   $result = mysql_query( $query );
51   if ( mysql_num_rows( $result ) > 0 )
52   {
53     $row = mysql_fetch_array( $result );
54     $page['user_status']   = $row['status'];
55     if ( $row['username'] == 'guest' ) $row['username'] = $lang['guest'];
56     $page['user_username'] = $row['username'];
57     $page_valide = true;
58     $title = $lang['title_user_perm'].' "'.$page['user_username'].'"';
59   }
60   else
61   {
62     $page_valide = false;
63   }*/
64   $title = $lang['title_user_perm'];
65   //.' '.$_POST['username'];
66   $page_valide = true; break;
67 case 'group_list' :
68   $title = $lang['title_groups'];        $page_valide = true; break;
69 case 'group_perm' :
70   if ( !is_numeric( $_GET['group_id'] ) ) $_GET['group_id'] = -1;
71   $query = 'SELECT name FROM '.GROUPS_TABLE;
72   $query.= ' WHERE id = '.$_GET['group_id'];
73   $query.= ';';
74   $result = mysql_query( $query );
75   if ( mysql_num_rows( $result ) > 0 )
76   {
77     $row = mysql_fetch_array( $result );
78     $title = $lang['title_group_perm'].' "'.$row['name'].'"';
79     $page_valide = true;
80   }
81   else
82   {
83     $page_valide = false;
84   }
85   break;
86 case 'stats':
87   $title = $lang['title_history'];       $page_valide = true; break;
88 case 'update':
89   $title = $lang['title_update'];        $page_valide = true; break;
90 case 'configuration':
91   $title = $lang['title_configuration']; $page_valide = true; break;
92 case 'admin_phpinfo':
93   $title = $lang['phpinfos']; $page_valide = true; break;
94 case 'help':
95   $title = $lang['title_instructions'];  $page_valide = true; break;
96 case 'cat_perm':
97   $title = $lang['title_cat_perm'];
98   if ( isset( $_GET['cat_id'] ) )
99   {
100     check_cat_id( $_GET['cat_id'] );
101     if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ) )
102     {
103       $result = get_cat_info( $page['cat'] );
104       $name = get_cat_display_name( $result['name'],' &gt; ', '' );
105       $title.= ' "'.$name.'"';
106     }
107   }
108   $page_valide = true;
109   break;
110 case 'cat_list':
111   $title = $lang['title_categories'];    $page_valide = true; break;
112 case 'cat_modify':
113   $title = $lang['title_edit_cat'];      $page_valide = true; break;
114 case 'admin_upload':
115   $title = $lang['upload'];      $page_valide = true; break;
116 case 'infos_images':
117   $title = $lang['title_info_images'];   $page_valide = true; break;
118 case 'waiting':
119   $title = $lang['title_waiting'];       $page_valide = true; break;
120 case 'thumbnail':
121   $title = $lang['title_thumbnails'];
122   if ( isset( $_GET['dir'] ) )
123   {
124     $title.= ' '.$lang['title_thumbnails_2'].' <span class="titreImg">';
125     // $_GET['dir'] contains :
126     // ./galleries/vieux_lyon ou
127     // ./galleries/vieux_lyon/visite ou
128     // ./galleries/vieux_lyon/visite/truc ...
129     $dir = explode( "/", $_GET['dir'] );
130     $title.= $dir[2];
131     for ( $i = 2; $i < sizeof( $dir ) - 1; $i++ )
132     {
133       $title.= ' &gt; '.$dir[$i+1];
134     }
135     $title.= "</span>";
136   }
137   $page_valide = true;
138   break;
139 case 'comments' :
140   $title = $lang['title_comments'];
141   $page_valide = true;
142   break;
143 case 'picture_modify' :
144   $title = $lang['title_picmod'];
145   $page_valide = true;
146   break;
147 case 'remote_site' :
148 {
149   $title = $lang['remote_sites'];
150   $page_valide = true;
151   break;
152 }
153 default:
154   $title = $lang['title_default']; break;
155}
156if ( $title == '' ) $title = $lang['title_default'];
157
158// waiting
159$query = 'SELECT id FROM '.WAITING_TABLE;
160$query.= " WHERE validated='false'";
161$query.= ';';
162$result = mysql_query( $query );
163$nb_waiting = '';
164if ( mysql_num_rows( $result ) > 0 )
165{
166  $nb_waiting =  ' [ '.mysql_num_rows( $result ).' ]';
167}
168// comments
169$query = 'SELECT id FROM '.COMMENTS_TABLE;
170$query.= " WHERE validated='false'";
171$query.= ';';
172$result = mysql_query( $query );
173$nb_comments = '';
174if ( mysql_num_rows( $result ) > 0 )
175{
176  $nb_comments =  ' [ '.mysql_num_rows( $result ).' ]';
177}
178
179$link_start = PHPWG_ROOT_PATH.'admin.php?page=';
180//----------------------------------------------------- template initialization
181include(PHPWG_ROOT_PATH.'include/page_header.php');
182$template->set_filenames( array('admin'=>'admin.tpl') );
183
184$template->assign_vars(array(
185  'L_TITLE'=>$lang['admin_panel'],
186  'L_LINKS'=>$lang['links'],
187  'L_GALLERY_INDEX'=>$lang['gallery_index'],
188  'L_GENERAL'=>$lang['general'],
189  'L_DEFAULT'=>$lang['gallery_default'],
190  'L_PHPINFO'=>$lang['phpinfos'],
191  'L_HISTORY'=>$lang['history'],
192  'L_FAQ'=>$lang['instructions'],
193  'L_CONFIGURATION'=>$lang['config'],
194  'L_CONFIG_GENERAL'=>$lang['general'],
195  'L_CONFIG_COMMENTS'=>$lang['comments'],
196  'L_CONFIG_DISPLAY'=>$lang['conf_default'],
197  'L_CONFIG_UPLOAD'=>$lang['upload'],
198  'L_CONFIG_SESSION'=>$lang['conf_cookie'],
199  'L_CONFIG_METADATA'=>$lang['metadata'],
200  'L_CONFIG_SITES'=>$lang['remote_sites'],
201  'L_CATEGORIES'=>$lang['categories'],
202  'L_MANAGE'=>$lang['manage'],
203  'L_UPLOAD'=>$lang['upload'],
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   
214  'U_CONFIG_GENERAL'=>add_session_id($link_start.'configuration&amp;section=general' ),
215  'U_CONFIG_COMMENTS'=>add_session_id($link_start.'configuration&amp;section=comments' ),
216  'U_CONFIG_DISPLAY'=>add_session_id($link_start.'configuration&amp;section=default' ),
217  'U_CONFIG_UPLOAD'=>add_session_id($link_start.'configuration&amp;section=upload' ),
218  'U_CONFIG_SESSION'=>add_session_id($link_start.'configuration&amp;section=session' ),
219  'U_CONFIG_METADATA'=>add_session_id($link_start.'configuration&amp;section=metadata' ),
220  'U_CONFIG_SITES'=>add_session_id($link_start.'remote_site'),
221  'U_PHPINFO'=>add_session_id($link_start.'admin_phpinfo' ),
222  'U_USERS'=>add_session_id($link_start.'user_search' ),
223  'U_GROUPS'=>add_session_id($link_start.'group_list' ),
224  'U_CATEGORIES'=>add_session_id($link_start.'cat_list' ),
225  'U_UPLOAD'=>add_session_id($link_start.'admin_upload' ),
226  'U_WAITING'=>add_session_id($link_start.'waiting' ),
227  'U_COMMENTS'=>add_session_id($link_start.'comments' ),
228  'U_CAT_UPDATE'=>add_session_id($link_start.'update&amp;update=cats' ),
229  'U_IMG_UPDATE'=>add_session_id($link_start.'update&amp;update=all' ),
230  'U_THUMBNAILS'=>add_session_id($link_start.'thumbnail' ),
231  'U_HISTORY'=>add_session_id($link_start.'stats' ),
232  'U_FAQ'=>add_session_id($link_start.'help' ),
233  'U_RETURN'=>add_session_id(PHPWG_ROOT_PATH.'category.php')
234  ));
235
236//--------------------------------------------------------------------- summary
237$link_start = PHPWG_ROOT_PATH.'admin.php?page=';
238//------------------------------------------------------------- content display
239if ( $page_valide )
240{
241  if ($_GET['page']=='comments') include ( PHPWG_ROOT_PATH.'comments.php');
242  else include ( PHPWG_ROOT_PATH.'admin/'.$_GET['page'].'.php' );
243}
244else
245{
246  $template->assign_vars(array ('ADMIN_CONTENT'=> '<div style="text-align:center">'.$lang['default_message'].'</div>') );
247}
248$template->pparse('admin');
249include(PHPWG_ROOT_PATH.'include/page_tail.php');
250?>
Note: See TracBrowser for help on using the repository browser.