source: tags/release-1_3_1beta/admin/admin.php @ 27629

Last change on this file since 27629 was 329, checked in by gweltas, 20 years ago

CSS Admin creation

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.7 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 329 2004-01-29 22:31:43Z gweltas $
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','install_warning' );
27templatize_array( $tpl, 'lang', $handle );
28$vtp->setGlobalVar( $handle, 'user_template',$user['template']);
29$vtp->setGlobalVar( $handle, 'style', '../template/'.$user['template'].'/'.$user['template'].'-admin.css');
30
31//-------------------------------------------------- install.php still exists ?
32if ( is_file( './install.php' ) )
33{
34  $vtp->addSession( $handle, 'install_warning' );
35  $vtp->closeSession( $handle, 'install_warning' );
36}
37//--------------------------------------- validating page and creation of title
38$page_valide = false;
39$title = '';
40if (isset( $_GET['page'] ))
41switch ( $_GET['page'] )
42{
43 case 'user_list':
44   $title = $lang['title_liste_users'];   $page_valide = true; break;
45 case 'user_modify':
46   $title = $lang['title_modify'];        $page_valide = true; break;
47 case 'user_perm':
48   if ( !is_numeric( $_GET['user_id'] ) ) $_GET['user_id'] = -1;
49   $query = 'SELECT status,username';
50   $query.= ' FROM '.PREFIX_TABLE.'users';
51   $query.= ' WHERE id = '.$_GET['user_id'];
52   $query.= ';';
53   $result = mysql_query( $query );
54   if ( mysql_num_rows( $result ) > 0 )
55   {
56     $row = mysql_fetch_array( $result );
57     $page['user_status']   = $row['status'];
58     if ( $row['username'] == 'guest' ) $row['username'] = $lang['guest'];
59     $page['user_username'] = $row['username'];
60     $page_valide = true;
61     $title = $lang['title_user_perm'].' "'.$page['user_username'].'"';
62   }
63   else
64   {
65     $page_valide = false;
66   }
67   break;
68 case 'group_list' :
69   $title = $lang['title_groups'];        $page_valide = true; break;
70 case 'group_perm' :
71   if ( !is_numeric( $_GET['group_id'] ) ) $_GET['group_id'] = -1;
72   $query = 'SELECT name';
73   $query.= ' FROM '.PREFIX_TABLE.'groups';
74   $query.= ' WHERE id = '.$_GET['group_id'];
75   $query.= ';';
76   $result = mysql_query( $query );
77   if ( mysql_num_rows( $result ) > 0 )
78   {
79     $row = mysql_fetch_array( $result );
80     $title = $lang['title_group_perm'].' "'.$row['name'].'"';
81     $page_valide = true;
82   }
83   else
84   {
85     $page_valide = false;
86   }
87   break;
88 case 'stats':
89   $title = $lang['title_history'];       $page_valide = true; break;
90 case 'update':
91   $title = $lang['title_update'];        $page_valide = true; break;
92 case 'configuration':
93   $title = $lang['title_configuration']; $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 'infos_images':
115   $title = $lang['title_info_images'];   $page_valide = true; break;
116 case 'waiting':
117   $title = $lang['title_waiting'];       $page_valide = true; break;
118 case 'thumbnail':
119   $title = $lang['title_thumbnails'];
120   if ( isset( $_GET['dir'] ) )
121   {
122     $title.= ' '.$lang['title_thumbnails_2'].' <span style="color:#006699;">';
123     // $_GET['dir'] contains :
124     // ../galleries/vieux_lyon ou
125     // ../galleries/vieux_lyon/visite ou
126     // ../galleries/vieux_lyon/visite/truc ...
127     $dir = explode( "/", $_GET['dir'] );
128     $title.= $dir[2];
129     for ( $i = 3; $i < sizeof( $dir ) - 1; $i++ )
130     {
131       $title.= ' &gt; '.$dir[$i];
132     }
133     $title.= "</span>";
134   }
135   $page_valide = true;
136   break;
137 case 'comments' :
138   $title = $lang['title_comments'];
139   $page_valide = true;
140   break;
141 case 'picture_modify' :
142   $title = $lang['title_picmod'];
143   $page_valide = true;
144   break;
145 default:
146   $title = $lang['title_default']; break;
147}
148if ( $title == '' ) $title = $lang['title_default'];
149$vtp->setGlobalVar( $handle, 'title', $title );
150//--------------------------------------------------------------------- summary
151$link_start = './admin.php?page=';
152// configuration
153$vtp->addSession( $handle, 'summary' );
154$vtp->setVar( $handle, 'summary.indent', '' );
155$vtp->setVar( $handle, 'summary.link',
156              add_session_id( $link_start.'configuration' ) );
157$vtp->setVar( $handle, 'summary.name', $lang['menu_config'] );
158$vtp->closeSession( $handle, 'summary' );
159// users
160$vtp->addSession( $handle, 'summary' );
161$vtp->setVar( $handle, 'summary.indent', '' );
162$vtp->setVar( $handle, 'summary.link',
163              add_session_id( $link_start.'user_list' ) );
164$vtp->setVar( $handle, 'summary.name', $lang['menu_users'] );
165$vtp->closeSession( $handle, 'summary' );
166// groups
167$vtp->addSession( $handle, 'summary' );
168$vtp->setVar( $handle, 'summary.indent', '' );
169$vtp->setVar( $handle, 'summary.link',
170              add_session_id( $link_start.'group_list' ) );
171$vtp->setVar( $handle, 'summary.name', $lang['menu_groups'] );
172$vtp->closeSession( $handle, 'summary' );
173// categories
174$vtp->addSession( $handle, 'summary' );
175$vtp->setVar( $handle, 'summary.indent', '' );
176$vtp->setVar( $handle, 'summary.link',add_session_id( $link_start.'cat_list'));
177$vtp->setVar( $handle, 'summary.name', $lang['menu_categories'] );
178$vtp->closeSession( $handle, 'summary' );
179// waiting
180$vtp->addSession( $handle, 'summary' );
181$vtp->setVar( $handle, 'summary.indent', '' );
182$vtp->setVar( $handle, 'summary.link',
183              add_session_id( $link_start.'waiting' ) );
184$query = 'SELECT id';
185$query.= ' FROM '.PREFIX_TABLE.'waiting';
186$query.= " WHERE validated='false'";
187$query.= ';';
188$result = mysql_query( $query );
189$nb_waiting = '';
190if ( mysql_num_rows( $result ) > 0 )
191{
192  $nb_waiting =  ' [ '.mysql_num_rows( $result ).' ]';
193}
194$vtp->setVar( $handle, 'summary.name', $lang['menu_waiting'].$nb_waiting );
195$vtp->closeSession( $handle, 'summary' );
196// comments
197$vtp->addSession( $handle, 'summary' );
198$vtp->setVar( $handle, 'summary.indent', '' );
199$vtp->setVar( $handle, 'summary.link',
200              add_session_id( $link_start.'comments' ) );
201$query = 'SELECT id';
202$query.= ' FROM '.PREFIX_TABLE.'comments';
203$query.= " WHERE validated='false'";
204$query.= ';';
205$result = mysql_query( $query );
206$nb_waiting = '';
207if ( mysql_num_rows( $result ) > 0 )
208{
209  $nb_waiting =  ' [ '.mysql_num_rows( $result ).' ]';
210}
211$vtp->setVar( $handle, 'summary.name', $lang['menu_comments'].$nb_waiting );
212$vtp->closeSession( $handle, 'summary' );
213// update
214$vtp->addSession( $handle, 'summary' );
215$vtp->setVar( $handle, 'summary.indent', '' );
216$vtp->setVar( $handle, 'summary.link',
217              add_session_id( $link_start.'update' ) );
218$vtp->setVar( $handle, 'summary.name', $lang['menu_update'] );
219$vtp->closeSession( $handle, 'summary' );
220// thumbnails
221$vtp->addSession( $handle, 'summary' );
222$vtp->setVar( $handle, 'summary.indent', '' );
223$vtp->setVar( $handle, 'summary.link',
224              add_session_id( $link_start.'thumbnail' ) );
225$vtp->setVar( $handle, 'summary.name', $lang['menu_thumbnails'] );
226$vtp->closeSession( $handle, 'summary' );
227// history
228$vtp->addSession( $handle, 'summary' );
229$vtp->setVar( $handle, 'summary.indent', '' );
230$vtp->setVar( $handle, 'summary.link',
231              add_session_id( $link_start.'stats' ) );
232$vtp->setVar( $handle, 'summary.name', $lang['menu_history'] );
233$vtp->closeSession( $handle, 'summary' );
234// instructions
235$vtp->addSession( $handle, 'summary' );
236$vtp->setVar( $handle, 'summary.indent', '' );
237$vtp->setVar( $handle, 'summary.link',
238              add_session_id( $link_start.'help' ) );
239$vtp->setVar( $handle, 'summary.name', $lang['menu_instructions'] );
240$vtp->closeSession( $handle, 'summary' );
241// back to thumbnails page
242$vtp->addSession( $handle, 'summary' );
243$vtp->setVar( $handle, 'summary.indent', '' );
244$vtp->setVar( $handle, 'summary.link', add_session_id( '../category.php' ) );
245$vtp->setVar( $handle, 'summary.name', $lang['menu_back'] );
246$vtp->closeSession( $handle, 'summary' );
247//------------------------------------------------------------- content display
248if ( $page_valide )
249{
250  include ( $_GET['page'].'.php' );
251}
252else
253{
254  $vtp->setVar(
255    $handle, 'sub',
256    '<div style="text-align:center">'.$lang['default_message'].'</div>' );
257}
258//----------------------------------------------------------- html code display
259$code = $vtp->Display( $handle, 0 );
260echo $code;
261?>
Note: See TracBrowser for help on using the repository browser.