1 | <?php |
---|
2 | /*************************************************************************** |
---|
3 | * admin.php is a part of PhpWebGallery * |
---|
4 | * ------------------- * |
---|
5 | * last update : Tuesday, July 16, 2002 * |
---|
6 | * email : 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 |
---|
19 | include_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; |
---|
28 | switch ( $_GET['page'] ) |
---|
29 | { |
---|
30 | case 'ajout': |
---|
31 | { |
---|
32 | $titre = $lang['title_add']; |
---|
33 | $page_valide = true; |
---|
34 | break; |
---|
35 | } |
---|
36 | case 'user_list': |
---|
37 | { |
---|
38 | $titre = $lang['title_liste_users']; |
---|
39 | $page_valide = true; |
---|
40 | break; |
---|
41 | } |
---|
42 | case 'historique': |
---|
43 | { |
---|
44 | $titre = $lang['title_history']; |
---|
45 | $page_valide = true; |
---|
46 | break; |
---|
47 | } |
---|
48 | case 'miseajour': |
---|
49 | { |
---|
50 | $titre = $lang['title_update']; |
---|
51 | $page_valide = true; |
---|
52 | break; |
---|
53 | } |
---|
54 | case 'configuration': |
---|
55 | { |
---|
56 | $titre = $lang['title_configuration']; |
---|
57 | $page_valide = true; |
---|
58 | break; |
---|
59 | } |
---|
60 | case 'manuel': |
---|
61 | { |
---|
62 | $titre = $lang['title_instructions']; |
---|
63 | $page_valide = true; |
---|
64 | break; |
---|
65 | } |
---|
66 | case 'perm': |
---|
67 | { |
---|
68 | $titre = $lang['title_permissions']; |
---|
69 | $page_valide = true; |
---|
70 | break; |
---|
71 | } |
---|
72 | case 'cat': |
---|
73 | { |
---|
74 | $titre = $lang['title_categories']; |
---|
75 | $page_valide = true; |
---|
76 | break; |
---|
77 | } |
---|
78 | case 'edit_cat': |
---|
79 | { |
---|
80 | $titre = $lang['title_edit_cat']; |
---|
81 | $page_valide = true; |
---|
82 | break; |
---|
83 | } |
---|
84 | case 'infos_images': |
---|
85 | { |
---|
86 | $titre = $lang['title_info_images']; |
---|
87 | $page_valide = true; |
---|
88 | break; |
---|
89 | } |
---|
90 | case 'thumbnail': |
---|
91 | { |
---|
92 | $titre = $lang['title_thumbnails']; |
---|
93 | if ( isset( $_GET['dir'] ) ) |
---|
94 | { |
---|
95 | $titre.= ' '.$lang['title_thumbnails_2'].' <span style="color:#006699;">'; |
---|
96 | // $_GET['dir'] contient : |
---|
97 | // ../galleries/vieux_lyon ou |
---|
98 | // ../galleries/vieux_lyon/visite ou |
---|
99 | // ../galleries/vieux_lyon/visite/truc ... |
---|
100 | $dir = explode( "/", $_GET['dir'] ); |
---|
101 | $titre.= $dir[2]; |
---|
102 | for ( $i = 3; $i < sizeof( $dir ) - 1; $i++ ) |
---|
103 | { |
---|
104 | $titre.= ' > '.$dir[$i]; |
---|
105 | } |
---|
106 | $titre.= "</span>"; |
---|
107 | } |
---|
108 | $page_valide = true; |
---|
109 | break; |
---|
110 | } |
---|
111 | case 'waiting': |
---|
112 | { |
---|
113 | $titre = $lang['title_waiting']; |
---|
114 | $page_valide = true; |
---|
115 | break; |
---|
116 | } |
---|
117 | default: |
---|
118 | { |
---|
119 | $titre = $lang['title_default']; |
---|
120 | break; |
---|
121 | } |
---|
122 | } |
---|
123 | $vtp->setGlobalVar( $handle, 'title', $titre ); |
---|
124 | //--------------------------------------------------------------------- summary |
---|
125 | $link_start = './admin.php?page='; |
---|
126 | // configuration |
---|
127 | $vtp->addSession( $handle, 'summary' ); |
---|
128 | $vtp->setVar( $handle, 'summary.indent', '' ); |
---|
129 | $vtp->setVar( $handle, 'summary.link', |
---|
130 | add_session_id( $link_start.'configuration' ) ); |
---|
131 | $vtp->setVar( $handle, 'summary.name', $lang['menu_config'] ); |
---|
132 | $vtp->closeSession( $handle, 'summary' ); |
---|
133 | // users |
---|
134 | $vtp->addSession( $handle, 'summary' ); |
---|
135 | $vtp->setVar( $handle, 'summary.indent', '' ); |
---|
136 | $vtp->setVar( $handle, 'summary.link', |
---|
137 | add_session_id( $link_start.'liste_users' ) ); |
---|
138 | $vtp->setVar( $handle, 'summary.name', $lang['menu_users'] ); |
---|
139 | $vtp->closeSession( $handle, 'summary' ); |
---|
140 | // user list |
---|
141 | $vtp->addSession( $handle, 'summary' ); |
---|
142 | $vtp->setVar( $handle, 'summary.indent', ' ' ); |
---|
143 | $vtp->setVar( $handle, 'summary.link', |
---|
144 | add_session_id( $link_start.'user_list' ) ); |
---|
145 | $vtp->setVar( $handle, 'summary.name', $lang['menu_list_user'] ); |
---|
146 | $vtp->closeSession( $handle, 'summary' ); |
---|
147 | // user add |
---|
148 | $vtp->addSession( $handle, 'summary' ); |
---|
149 | $vtp->setVar( $handle, 'summary.indent', ' ' ); |
---|
150 | $vtp->setVar( $handle, 'summary.link', add_session_id( $link_start.'ajout' ) ); |
---|
151 | $vtp->setVar( $handle, 'summary.name', $lang['menu_add_user'] ); |
---|
152 | $vtp->closeSession( $handle, 'summary' ); |
---|
153 | // categories |
---|
154 | $vtp->addSession( $handle, 'summary' ); |
---|
155 | $vtp->setVar( $handle, 'summary.indent', '' ); |
---|
156 | $vtp->setVar( $handle, 'summary.link', add_session_id( $link_start.'cat' ) ); |
---|
157 | $vtp->setVar( $handle, 'summary.name', $lang['menu_categories'] ); |
---|
158 | $vtp->closeSession( $handle, 'summary' ); |
---|
159 | // waiting |
---|
160 | $vtp->addSession( $handle, 'summary' ); |
---|
161 | $vtp->setVar( $handle, 'summary.indent', '' ); |
---|
162 | $vtp->setVar( $handle, 'summary.link', |
---|
163 | add_session_id( $link_start.'waiting' ) ); |
---|
164 | $query = 'select id from '.$prefixeTable.'waiting;'; |
---|
165 | $result = mysql_query( $query ); |
---|
166 | $nb_waiting = ''; |
---|
167 | if ( mysql_num_rows( $result ) > 0 ) |
---|
168 | { |
---|
169 | $nb_waiting = ' [ '.mysql_num_rows( $result ).' ]'; |
---|
170 | } |
---|
171 | $vtp->setVar( $handle, 'summary.name', $lang['menu_waiting'].$nb_waiting ); |
---|
172 | $vtp->closeSession( $handle, 'summary' ); |
---|
173 | // update |
---|
174 | $vtp->addSession( $handle, 'summary' ); |
---|
175 | $vtp->setVar( $handle, 'summary.indent', '' ); |
---|
176 | $vtp->setVar( $handle, 'summary.link', |
---|
177 | add_session_id( $link_start.'miseajour' ) ); |
---|
178 | $vtp->setVar( $handle, 'summary.name', $lang['menu_update'] ); |
---|
179 | $vtp->closeSession( $handle, 'summary' ); |
---|
180 | // thumbnails |
---|
181 | $vtp->addSession( $handle, 'summary' ); |
---|
182 | $vtp->setVar( $handle, 'summary.indent', '' ); |
---|
183 | $vtp->setVar( $handle, 'summary.link', |
---|
184 | add_session_id( $link_start.'thumbnail' ) ); |
---|
185 | $vtp->setVar( $handle, 'summary.name', $lang['menu_thumbnails'] ); |
---|
186 | $vtp->closeSession( $handle, 'summary' ); |
---|
187 | // history |
---|
188 | $vtp->addSession( $handle, 'summary' ); |
---|
189 | $vtp->setVar( $handle, 'summary.indent', '' ); |
---|
190 | $vtp->setVar( $handle, 'summary.link', |
---|
191 | add_session_id( $link_start.'historique' ) ); |
---|
192 | $vtp->setVar( $handle, 'summary.name', $lang['menu_history'] ); |
---|
193 | $vtp->closeSession( $handle, 'summary' ); |
---|
194 | // instructions |
---|
195 | $vtp->addSession( $handle, 'summary' ); |
---|
196 | $vtp->setVar( $handle, 'summary.indent', '' ); |
---|
197 | $vtp->setVar( $handle, 'summary.link', |
---|
198 | add_session_id( $link_start.'manuel' ) ); |
---|
199 | $vtp->setVar( $handle, 'summary.name', $lang['menu_instructions'] ); |
---|
200 | $vtp->closeSession( $handle, 'summary' ); |
---|
201 | // back to thumbnails page |
---|
202 | $vtp->addSession( $handle, 'summary' ); |
---|
203 | $vtp->setVar( $handle, 'summary.indent', '' ); |
---|
204 | $vtp->setVar( $handle, 'summary.link', add_session_id( '../category.php' ) ); |
---|
205 | $vtp->setVar( $handle, 'summary.name', $lang['menu_back'] ); |
---|
206 | $vtp->closeSession( $handle, 'summary' ); |
---|
207 | //------------------------------------------------------------- content display |
---|
208 | if ( $page_valide ) |
---|
209 | { |
---|
210 | include ( $_GET['page'].'.php' ); |
---|
211 | } |
---|
212 | else |
---|
213 | { |
---|
214 | $vtp->setVar( $handle, 'sub', |
---|
215 | '<div style="text-align:center">'. |
---|
216 | $lang['default_message']. |
---|
217 | '</div>' ); |
---|
218 | } |
---|
219 | //----------------------------------------------------------- html code display |
---|
220 | $code = $vtp->Display( $handle, 0 ); |
---|
221 | echo $code; |
---|
222 | ?> |
---|