source: trunk/admin.php @ 351

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

Template modification
Split of the french language file

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