aboutsummaryrefslogtreecommitdiffstats
path: root/admin/admin.php
blob: 5730356fe63c6d31d5eef4cccefe37c26a0c09d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<?php
/***************************************************************************
 *                                 admin.php                               *
 *                            -------------------                          *
 *   application          : PhpWebGallery 1.3                              *
 *   author               : Pierrick LE GALL <pierrick@z0rglub.com>        *
 *                                                                         *
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation;                                         *
 *                                                                         *
 ***************************************************************************/

//----------------------------------------------------------- personnal include
include_once( './include/isadmin.inc.php' );
//----------------------------------------------------- template initialization
$vtp = new VTemplate;
$handle = $vtp->Open( '../template/'.$user['template'].'/admin/admin.vtp' );
// language
$vtp->setGlobalVar( $handle, 'page_title',  $lang['title_default'] );
$vtp->setGlobalVar( $handle, 'menu_title',  $lang['menu_title'] );
//--------------------------------------- validating page and creation of title
$page_valide = false;
switch ( $_GET['page'] )
{
 case 'user_add':
   $titre = $lang['title_add'];           $page_valide = true; break;
 case 'user_list':
   $titre = $lang['title_liste_users'];   $page_valide = true; break;
 case 'user_modify':
   $titre = $lang['title_modify'];        $page_valide = true; break;
 case 'historique':
   $titre = $lang['title_history'];       $page_valide = true; break;
 case 'update':
   $titre = $lang['title_update'];        $page_valide = true; break;
 case 'configuration':
   $titre = $lang['title_configuration']; $page_valide = true; break;
 case 'manuel':
   $titre = $lang['title_instructions'];  $page_valide = true; break;
 case 'perm':
   $titre = $lang['title_permissions'];   $page_valide = true; break;
 case 'cat':
   $titre = $lang['title_categories'];    $page_valide = true; break;
 case 'edit_cat':
   $titre = $lang['title_edit_cat'];      $page_valide = true; break;
 case 'infos_images':
   $titre = $lang['title_info_images'];   $page_valide = true; break;
 case 'waiting':
   $titre = $lang['title_waiting'];       $page_valide = true; break;
 case 'thumbnail':
   $titre = $lang['title_thumbnails'];
   if ( isset( $_GET['dir'] ) )
   {
     $titre.= ' '.$lang['title_thumbnails_2'].' <span style="color:#006699;">';
     // $_GET['dir'] contient :
     // ../galleries/vieux_lyon ou
     // ../galleries/vieux_lyon/visite ou
     // ../galleries/vieux_lyon/visite/truc ...
     $dir = explode( "/", $_GET['dir'] );
     $titre.= $dir[2];
     for ( $i = 3; $i < sizeof( $dir ) - 1; $i++ )
     {
       $titre.= ' &gt; '.$dir[$i];
     }
     $titre.= "</span>";
   }
   $page_valide = true;
   break;
 default:
   $titre = $lang['title_default']; break;
}
$vtp->setGlobalVar( $handle, 'title', $titre );
//--------------------------------------------------------------------- summary
$link_start = './admin.php?page=';
// configuration
$vtp->addSession( $handle, 'summary' );
$vtp->setVar( $handle, 'summary.indent', '' );
$vtp->setVar( $handle, 'summary.link',
              add_session_id( $link_start.'configuration' ) );
$vtp->setVar( $handle, 'summary.name', $lang['menu_config'] );
$vtp->closeSession( $handle, 'summary' );
// users
$vtp->addSession( $handle, 'summary' );
$vtp->setVar( $handle, 'summary.indent', '' );
$vtp->setVar( $handle, 'summary.link',
              add_session_id( $link_start.'liste_users' ) );
$vtp->setVar( $handle, 'summary.name', $lang['menu_users'] );
$vtp->closeSession( $handle, 'summary' );
// user list
$vtp->addSession( $handle, 'summary' );
$vtp->setVar( $handle, 'summary.indent', '&nbsp;&nbsp;' );
$vtp->setVar( $handle, 'summary.link',
              add_session_id( $link_start.'user_list' ) );
$vtp->setVar( $handle, 'summary.name', $lang['menu_list_user'] );
$vtp->closeSession( $handle, 'summary' );
// user add
$vtp->addSession( $handle, 'summary' );
$vtp->setVar( $handle, 'summary.indent', '&nbsp;&nbsp;' );
$vtp->setVar(
  $handle, 'summary.link', add_session_id( $link_start.'user_add' ) );
$vtp->setVar( $handle, 'summary.name', $lang['menu_add_user'] );
$vtp->closeSession( $handle, 'summary' );
// categories
$vtp->addSession( $handle, 'summary' );
$vtp->setVar( $handle, 'summary.indent', '' );
$vtp->setVar( $handle, 'summary.link', add_session_id( $link_start.'cat' ) );
$vtp->setVar( $handle, 'summary.name', $lang['menu_categories'] );
$vtp->closeSession( $handle, 'summary' );
// waiting
$vtp->addSession( $handle, 'summary' );
$vtp->setVar( $handle, 'summary.indent', '' );
$vtp->setVar( $handle, 'summary.link',
              add_session_id( $link_start.'waiting' ) );
$query = 'select id from '.PREFIX_TABLE.'waiting;';
$result = mysql_query( $query );
$nb_waiting = '';
if ( mysql_num_rows( $result ) > 0 )
{
  $nb_waiting =  ' [ '.mysql_num_rows( $result ).' ]';
}
$vtp->setVar( $handle, 'summary.name', $lang['menu_waiting'].$nb_waiting );
$vtp->closeSession( $handle, 'summary' );
// update
$vtp->addSession( $handle, 'summary' );
$vtp->setVar( $handle, 'summary.indent', '' );
$vtp->setVar( $handle, 'summary.link',
              add_session_id( $link_start.'update' ) );
$vtp->setVar( $handle, 'summary.name', $lang['menu_update'] );
$vtp->closeSession( $handle, 'summary' );
// thumbnails
$vtp->addSession( $handle, 'summary' );
$vtp->setVar( $handle, 'summary.indent', '' );
$vtp->setVar( $handle, 'summary.link',
              add_session_id( $link_start.'thumbnail' ) );
$vtp->setVar( $handle, 'summary.name', $lang['menu_thumbnails'] );
$vtp->closeSession( $handle, 'summary' );
// history
$vtp->addSession( $handle, 'summary' );
$vtp->setVar( $handle, 'summary.indent', '' );
$vtp->setVar( $handle, 'summary.link',
              add_session_id( $link_start.'historique' ) );
$vtp->setVar( $handle, 'summary.name', $lang['menu_history'] );
$vtp->closeSession( $handle, 'summary' );
// instructions
$vtp->addSession( $handle, 'summary' );
$vtp->setVar( $handle, 'summary.indent', '' );
$vtp->setVar( $handle, 'summary.link',
              add_session_id( $link_start.'manuel' ) );
$vtp->setVar( $handle, 'summary.name', $lang['menu_instructions'] );
$vtp->closeSession( $handle, 'summary' );
// back to thumbnails page
$vtp->addSession( $handle, 'summary' );
$vtp->setVar( $handle, 'summary.indent', '' );
$vtp->setVar( $handle, 'summary.link', add_session_id( '../category.php' ) );
$vtp->setVar( $handle, 'summary.name', $lang['menu_back'] );
$vtp->closeSession( $handle, 'summary' );
//------------------------------------------------------------- content display
if ( $page_valide )
{
  include ( $_GET['page'].'.php' );
}
else
{
  $vtp->setVar(
    $handle, 'sub',
    '<div style="text-align:center">'.$lang['default_message'].'</div>' );
}
//----------------------------------------------------------- html code display
$code = $vtp->Display( $handle, 0 );
echo $code;
?>