source: trunk/admin/admin.php @ 10

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

* empty log message *

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.3 KB
Line 
1<?php
2/***************************************************************************
3 *                                 admin.php                               *
4 *                            -------------------                          *
5 *   application          : PhpWebGallery 1.3                              *
6 *   author               : Pierrick LE GALL <pierrick@z0rglub.com>        *
7 *                                                                         *
8 ***************************************************************************/
9
10/***************************************************************************
11 *                                                                         *
12 *   This program is free software; you can redistribute it and/or modify  *
13 *   it under the terms of the GNU General Public License as published by  *
14 *   the Free Software Foundation;                                         *
15 *                                                                         *
16 ***************************************************************************/
17
18//----------------------------------------------------------- personnal include
19include_once( './include/isadmin.inc.php' );
20//----------------------------------------------------- template initialization
21$vtp = new VTemplate;
22$handle = $vtp->Open( '../template/'.$user['template'].'/admin/admin.vtp' );
23// language
24$vtp->setGlobalVar( $handle, 'page_title',  $lang['title_default'] );
25$vtp->setGlobalVar( $handle, 'menu_title',  $lang['menu_title'] );
26//--------------------------------------- validating page and creation of title
27$page_valide = false;
28switch ( $_GET['page'] )
29{
30 case 'user_add':
31   $titre = $lang['title_add'];           $page_valide = true; break;
32 case 'user_list':
33   $titre = $lang['title_liste_users'];   $page_valide = true; break;
34 case 'user_modify':
35   $titre = $lang['title_modify'];        $page_valide = true; break;
36 case 'historique':
37   $titre = $lang['title_history'];       $page_valide = true; break;
38 case 'update':
39   $titre = $lang['title_update'];        $page_valide = true; break;
40 case 'configuration':
41   $titre = $lang['title_configuration']; $page_valide = true; break;
42 case 'manuel':
43   $titre = $lang['title_instructions'];  $page_valide = true; break;
44 case 'perm':
45   $titre = $lang['title_permissions'];   $page_valide = true; break;
46 case 'cat':
47   $titre = $lang['title_categories'];    $page_valide = true; break;
48 case 'edit_cat':
49   $titre = $lang['title_edit_cat'];      $page_valide = true; break;
50 case 'infos_images':
51   $titre = $lang['title_info_images'];   $page_valide = true; break;
52 case 'waiting':
53   $titre = $lang['title_waiting'];       $page_valide = true; break;
54 case 'thumbnail':
55   $titre = $lang['title_thumbnails'];
56   if ( isset( $_GET['dir'] ) )
57   {
58     $titre.= ' '.$lang['title_thumbnails_2'].' <span style="color:#006699;">';
59     // $_GET['dir'] contient :
60     // ../galleries/vieux_lyon ou
61     // ../galleries/vieux_lyon/visite ou
62     // ../galleries/vieux_lyon/visite/truc ...
63     $dir = explode( "/", $_GET['dir'] );
64     $titre.= $dir[2];
65     for ( $i = 3; $i < sizeof( $dir ) - 1; $i++ )
66     {
67       $titre.= ' &gt; '.$dir[$i];
68     }
69     $titre.= "</span>";
70   }
71   $page_valide = true;
72   break;
73 default:
74   $titre = $lang['title_default']; break;
75}
76$vtp->setGlobalVar( $handle, 'title', $titre );
77//--------------------------------------------------------------------- summary
78$link_start = './admin.php?page=';
79// configuration
80$vtp->addSession( $handle, 'summary' );
81$vtp->setVar( $handle, 'summary.indent', '' );
82$vtp->setVar( $handle, 'summary.link',
83              add_session_id( $link_start.'configuration' ) );
84$vtp->setVar( $handle, 'summary.name', $lang['menu_config'] );
85$vtp->closeSession( $handle, 'summary' );
86// users
87$vtp->addSession( $handle, 'summary' );
88$vtp->setVar( $handle, 'summary.indent', '' );
89$vtp->setVar( $handle, 'summary.link',
90              add_session_id( $link_start.'liste_users' ) );
91$vtp->setVar( $handle, 'summary.name', $lang['menu_users'] );
92$vtp->closeSession( $handle, 'summary' );
93// user list
94$vtp->addSession( $handle, 'summary' );
95$vtp->setVar( $handle, 'summary.indent', '&nbsp;&nbsp;' );
96$vtp->setVar( $handle, 'summary.link',
97              add_session_id( $link_start.'user_list' ) );
98$vtp->setVar( $handle, 'summary.name', $lang['menu_list_user'] );
99$vtp->closeSession( $handle, 'summary' );
100// user add
101$vtp->addSession( $handle, 'summary' );
102$vtp->setVar( $handle, 'summary.indent', '&nbsp;&nbsp;' );
103$vtp->setVar(
104  $handle, 'summary.link', add_session_id( $link_start.'user_add' ) );
105$vtp->setVar( $handle, 'summary.name', $lang['menu_add_user'] );
106$vtp->closeSession( $handle, 'summary' );
107// categories
108$vtp->addSession( $handle, 'summary' );
109$vtp->setVar( $handle, 'summary.indent', '' );
110$vtp->setVar( $handle, 'summary.link', add_session_id( $link_start.'cat' ) );
111$vtp->setVar( $handle, 'summary.name', $lang['menu_categories'] );
112$vtp->closeSession( $handle, 'summary' );
113// waiting
114$vtp->addSession( $handle, 'summary' );
115$vtp->setVar( $handle, 'summary.indent', '' );
116$vtp->setVar( $handle, 'summary.link',
117              add_session_id( $link_start.'waiting' ) );
118$query = 'select id from '.PREFIX_TABLE.'waiting;';
119$result = mysql_query( $query );
120$nb_waiting = '';
121if ( mysql_num_rows( $result ) > 0 )
122{
123  $nb_waiting =  ' [ '.mysql_num_rows( $result ).' ]';
124}
125$vtp->setVar( $handle, 'summary.name', $lang['menu_waiting'].$nb_waiting );
126$vtp->closeSession( $handle, 'summary' );
127// update
128$vtp->addSession( $handle, 'summary' );
129$vtp->setVar( $handle, 'summary.indent', '' );
130$vtp->setVar( $handle, 'summary.link',
131              add_session_id( $link_start.'update' ) );
132$vtp->setVar( $handle, 'summary.name', $lang['menu_update'] );
133$vtp->closeSession( $handle, 'summary' );
134// thumbnails
135$vtp->addSession( $handle, 'summary' );
136$vtp->setVar( $handle, 'summary.indent', '' );
137$vtp->setVar( $handle, 'summary.link',
138              add_session_id( $link_start.'thumbnail' ) );
139$vtp->setVar( $handle, 'summary.name', $lang['menu_thumbnails'] );
140$vtp->closeSession( $handle, 'summary' );
141// history
142$vtp->addSession( $handle, 'summary' );
143$vtp->setVar( $handle, 'summary.indent', '' );
144$vtp->setVar( $handle, 'summary.link',
145              add_session_id( $link_start.'historique' ) );
146$vtp->setVar( $handle, 'summary.name', $lang['menu_history'] );
147$vtp->closeSession( $handle, 'summary' );
148// instructions
149$vtp->addSession( $handle, 'summary' );
150$vtp->setVar( $handle, 'summary.indent', '' );
151$vtp->setVar( $handle, 'summary.link',
152              add_session_id( $link_start.'manuel' ) );
153$vtp->setVar( $handle, 'summary.name', $lang['menu_instructions'] );
154$vtp->closeSession( $handle, 'summary' );
155// back to thumbnails page
156$vtp->addSession( $handle, 'summary' );
157$vtp->setVar( $handle, 'summary.indent', '' );
158$vtp->setVar( $handle, 'summary.link', add_session_id( '../category.php' ) );
159$vtp->setVar( $handle, 'summary.name', $lang['menu_back'] );
160$vtp->closeSession( $handle, 'summary' );
161//------------------------------------------------------------- content display
162if ( $page_valide )
163{
164  include ( $_GET['page'].'.php' );
165}
166else
167{
168  $vtp->setVar(
169    $handle, 'sub',
170    '<div style="text-align:center">'.$lang['default_message'].'</div>' );
171}
172//----------------------------------------------------------- html code display
173$code = $vtp->Display( $handle, 0 );
174echo $code;
175?>
Note: See TracBrowser for help on using the repository browser.