source: trunk/admin/admin.php @ 97

Last change on this file since 97 was 97, checked in by z0rglub, 21 years ago

Removing link to user_add.php, this file is removed and replaced by a small
form in user_list.php

  • 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 1.3 <http://phpwebgallery.net>          *
6 *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
7 *                                                                         *
8 *   $Id: admin.php 97 2003-09-14 15:02:13Z z0rglub $
9 *                                                                         *
10 ***************************************************************************/
11
12/***************************************************************************
13 *                                                                         *
14 *   This program is free software; you can redistribute it and/or modify  *
15 *   it under the terms of the GNU General Public License as published by  *
16 *   the Free Software Foundation;                                         *
17 *                                                                         *
18 ***************************************************************************/
19
20//----------------------------------------------------------- personnal include
21include_once( './include/isadmin.inc.php' );
22//----------------------------------------------------- template initialization
23$vtp = new VTemplate;
24$handle = $vtp->Open( '../template/'.$user['template'].'/admin/admin.vtp' );
25// language
26$tpl = array( 'menu_title', 'title_default', 'charset' );
27templatize_array( $tpl, 'lang', $handle );
28$vtp->setGlobalVar( $handle, 'user_template', $user['template'] );
29//--------------------------------------- validating page and creation of title
30$page_valide = false;
31$title = '';
32switch ( $_GET['page'] )
33{
34 case 'user_list':
35   $title = $lang['title_liste_users'];   $page_valide = true; break;
36 case 'user_modify':
37   $title = $lang['title_modify'];        $page_valide = true; break;
38 case 'user_perm':
39   if ( !is_numeric( $_GET['user_id'] ) ) $_GET['user_id'] = -1;
40   $query = 'SELECT status,username';
41   $query.= ' FROM '.PREFIX_TABLE.'users';
42   $query.= ' WHERE id = '.$_GET['user_id'];
43   $query.= ';';
44   $result = mysql_query( $query );
45   if ( mysql_num_rows( $result ) > 0 )
46   {
47     $row = mysql_fetch_array( $result );
48     $page['user_status']   = $row['status'];
49     if ( $row['username'] == 'guest' ) $row['username'] = $lang['guest'];
50     $page['user_username'] = $row['username'];
51     $page_valide = true;
52     $title = $lang['title_user_perm'].' "'.$page['user_username'].'"';
53   }
54   else
55   {
56     $page_valide = false;
57   }
58   break;
59 case 'group_list' :
60   $title = $lang['title_groups'];        $page_valide = true; break;
61 case 'group_perm' :
62   if ( !is_numeric( $_GET['group_id'] ) ) $_GET['group_id'] = -1;
63   $query = 'SELECT name';
64   $query.= ' FROM '.PREFIX_TABLE.'groups';
65   $query.= ' WHERE id = '.$_GET['group_id'];
66   $query.= ';';
67   $result = mysql_query( $query );
68   if ( mysql_num_rows( $result ) > 0 )
69   {
70     $row = mysql_fetch_array( $result );
71     $title = $lang['title_group_perm'].' "'.$row['name'].'"';
72     $page_valide = true;
73   }
74   else
75   {
76     $page_valide = false;
77   }
78   break;
79 case 'stats':
80   $title = $lang['title_history'];       $page_valide = true; break;
81 case 'update':
82   $title = $lang['title_update'];        $page_valide = true; break;
83 case 'configuration':
84   $title = $lang['title_configuration']; $page_valide = true; break;
85 case 'help':
86   $title = $lang['title_instructions'];  $page_valide = true; break;
87 case 'cat_perm':
88   $title = $lang['title_cat_perm'];
89   if ( isset( $_GET['cat_id'] ) )
90   {
91     check_cat_id( $_GET['cat_id'] );
92     if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ) )
93     {
94       $result = get_cat_info( $page['cat'] );
95       $name = get_cat_display_name( $result['name'],' &gt; ', '' );
96       $title.= ' "'.$name.'"';
97     }
98   }
99   $page_valide = true;
100   break;
101 case 'cat_list':
102   $title = $lang['title_categories'];    $page_valide = true; break;
103 case 'cat_modify':
104   $title = $lang['title_edit_cat'];      $page_valide = true; break;
105 case 'infos_images':
106   $title = $lang['title_info_images'];   $page_valide = true; break;
107 case 'waiting':
108   $title = $lang['title_waiting'];       $page_valide = true; break;
109 case 'thumbnail':
110   $title = $lang['title_thumbnails'];
111   if ( isset( $_GET['dir'] ) )
112   {
113     $title.= ' '.$lang['title_thumbnails_2'].' <span style="color:#006699;">';
114     // $_GET['dir'] contains :
115     // ../galleries/vieux_lyon ou
116     // ../galleries/vieux_lyon/visite ou
117     // ../galleries/vieux_lyon/visite/truc ...
118     $dir = explode( "/", $_GET['dir'] );
119     $title.= $dir[2];
120     for ( $i = 3; $i < sizeof( $dir ) - 1; $i++ )
121     {
122       $title.= ' &gt; '.$dir[$i];
123     }
124     $title.= "</span>";
125   }
126   $page_valide = true;
127   break;
128 case 'comments' :
129   $title = $lang['title_comments'];
130   $page_valide = true;
131   break;
132 case 'picture_modify' :
133   $title = $lang['title_picmod'];
134   $page_valide = true;
135   break;
136 default:
137   $title = $lang['title_default']; break;
138}
139if ( $title == '' ) $title = $lang['title_default'];
140$vtp->setGlobalVar( $handle, 'title', $title );
141//--------------------------------------------------------------------- summary
142$link_start = './admin.php?page=';
143// configuration
144$vtp->addSession( $handle, 'summary' );
145$vtp->setVar( $handle, 'summary.indent', '' );
146$vtp->setVar( $handle, 'summary.link',
147              add_session_id( $link_start.'configuration' ) );
148$vtp->setVar( $handle, 'summary.name', $lang['menu_config'] );
149$vtp->closeSession( $handle, 'summary' );
150// users
151$vtp->addSession( $handle, 'summary' );
152$vtp->setVar( $handle, 'summary.indent', '' );
153$vtp->setVar( $handle, 'summary.link',
154              add_session_id( $link_start.'user_list' ) );
155$vtp->setVar( $handle, 'summary.name', $lang['menu_users'] );
156$vtp->closeSession( $handle, 'summary' );
157// groups
158$vtp->addSession( $handle, 'summary' );
159$vtp->setVar( $handle, 'summary.indent', '' );
160$vtp->setVar( $handle, 'summary.link',
161              add_session_id( $link_start.'group_list' ) );
162$vtp->setVar( $handle, 'summary.name', $lang['menu_groups'] );
163$vtp->closeSession( $handle, 'summary' );
164// categories
165$vtp->addSession( $handle, 'summary' );
166$vtp->setVar( $handle, 'summary.indent', '' );
167$vtp->setVar( $handle, 'summary.link',add_session_id( $link_start.'cat_list'));
168$vtp->setVar( $handle, 'summary.name', $lang['menu_categories'] );
169$vtp->closeSession( $handle, 'summary' );
170// waiting
171$vtp->addSession( $handle, 'summary' );
172$vtp->setVar( $handle, 'summary.indent', '' );
173$vtp->setVar( $handle, 'summary.link',
174              add_session_id( $link_start.'waiting' ) );
175$query = 'SELECT id';
176$query.= ' FROM '.PREFIX_TABLE.'waiting';
177$query.= " WHERE validated='false'";
178$query.= ';';
179$result = mysql_query( $query );
180$nb_waiting = '';
181if ( mysql_num_rows( $result ) > 0 )
182{
183  $nb_waiting =  ' [ '.mysql_num_rows( $result ).' ]';
184}
185$vtp->setVar( $handle, 'summary.name', $lang['menu_waiting'].$nb_waiting );
186$vtp->closeSession( $handle, 'summary' );
187// comments
188$vtp->addSession( $handle, 'summary' );
189$vtp->setVar( $handle, 'summary.indent', '' );
190$vtp->setVar( $handle, 'summary.link',
191              add_session_id( $link_start.'comments' ) );
192$query = 'SELECT id';
193$query.= ' FROM '.PREFIX_TABLE.'comments';
194$query.= " WHERE validated='false'";
195$query.= ';';
196$result = mysql_query( $query );
197$nb_waiting = '';
198if ( mysql_num_rows( $result ) > 0 )
199{
200  $nb_waiting =  ' [ '.mysql_num_rows( $result ).' ]';
201}
202$vtp->setVar( $handle, 'summary.name', $lang['menu_comments'].$nb_waiting );
203$vtp->closeSession( $handle, 'summary' );
204// update
205$vtp->addSession( $handle, 'summary' );
206$vtp->setVar( $handle, 'summary.indent', '' );
207$vtp->setVar( $handle, 'summary.link',
208              add_session_id( $link_start.'update' ) );
209$vtp->setVar( $handle, 'summary.name', $lang['menu_update'] );
210$vtp->closeSession( $handle, 'summary' );
211// thumbnails
212$vtp->addSession( $handle, 'summary' );
213$vtp->setVar( $handle, 'summary.indent', '' );
214$vtp->setVar( $handle, 'summary.link',
215              add_session_id( $link_start.'thumbnail' ) );
216$vtp->setVar( $handle, 'summary.name', $lang['menu_thumbnails'] );
217$vtp->closeSession( $handle, 'summary' );
218// history
219$vtp->addSession( $handle, 'summary' );
220$vtp->setVar( $handle, 'summary.indent', '' );
221$vtp->setVar( $handle, 'summary.link',
222              add_session_id( $link_start.'stats' ) );
223$vtp->setVar( $handle, 'summary.name', $lang['menu_history'] );
224$vtp->closeSession( $handle, 'summary' );
225// instructions
226$vtp->addSession( $handle, 'summary' );
227$vtp->setVar( $handle, 'summary.indent', '' );
228$vtp->setVar( $handle, 'summary.link',
229              add_session_id( $link_start.'help' ) );
230$vtp->setVar( $handle, 'summary.name', $lang['menu_instructions'] );
231$vtp->closeSession( $handle, 'summary' );
232// back to thumbnails page
233$vtp->addSession( $handle, 'summary' );
234$vtp->setVar( $handle, 'summary.indent', '' );
235$vtp->setVar( $handle, 'summary.link', add_session_id( '../category.php' ) );
236$vtp->setVar( $handle, 'summary.name', $lang['menu_back'] );
237$vtp->closeSession( $handle, 'summary' );
238//------------------------------------------------------------- content display
239if ( $page_valide )
240{
241  include ( $_GET['page'].'.php' );
242}
243else
244{
245  $vtp->setVar(
246    $handle, 'sub',
247    '<div style="text-align:center">'.$lang['default_message'].'</div>' );
248}
249//----------------------------------------------------------- html code display
250$code = $vtp->Display( $handle, 0 );
251echo $code;
252?>
Note: See TracBrowser for help on using the repository browser.