source: trunk/admin.php @ 646

Last change on this file since 646 was 646, checked in by gweltas, 19 years ago
  • French translation for many new entries
  • minor template update for cat_modify
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.1 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | PhpWebGallery - a PHP based picture gallery                           |
4// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
5// | Copyright (C) 2003-2004 PhpWebGallery Team - http://phpwebgallery.net |
6// +-----------------------------------------------------------------------+
7// | branch        : BSF (Best So Far)
8// | file          : $RCSfile$
9// | last update   : $Date: 2004-12-16 14:49:47 +0000 (Thu, 16 Dec 2004) $
10// | last modifier : $Author: gweltas $
11// | revision      : $Revision: 646 $
12// +-----------------------------------------------------------------------+
13// | This program is free software; you can redistribute it and/or modify  |
14// | it under the terms of the GNU General Public License as published by  |
15// | the Free Software Foundation                                          |
16// |                                                                       |
17// | This program is distributed in the hope that it will be useful, but   |
18// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
19// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
20// | General Public License for more details.                              |
21// |                                                                       |
22// | You should have received a copy of the GNU General Public License     |
23// | along with this program; if not, write to the Free Software           |
24// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
25// | USA.                                                                  |
26// +-----------------------------------------------------------------------+
27
28//----------------------------------------------------------- include
29define('PHPWG_ROOT_PATH','./');
30define('IN_ADMIN', true);
31include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
32include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
33//--------------------------------------- validating page and creation of title
34$page_valide = false;
35$title = '';
36$username='';
37if (isset($_POST['username'])) $username=$_POST['username'];
38if (isset( $_GET['page'] ))
39switch ( $_GET['page'] )
40{
41 case 'user_list':
42   $title = $lang['title_liste_users'];   $page_valide = true; break;
43 case 'profile':
44   $title = $lang['title_modify'];
45         $page_valide = true; 
46         break;
47 case 'user_search':
48   $title = $lang['title_user_perm'].' '.$username;
49   $page_valide = true; break;
50 case 'group_list' :
51   $title = $lang['title_groups'];        $page_valide = true; break;
52 case 'group_perm' :
53   if ( !is_numeric( $_GET['group_id'] ) ) $_GET['group_id'] = -1;
54   $query = 'SELECT name FROM '.GROUPS_TABLE;
55   $query.= ' WHERE id = '.$_GET['group_id'];
56   $query.= ';';
57   $result = pwg_query( $query );
58   if ( mysql_num_rows( $result ) > 0 )
59   {
60     $row = mysql_fetch_array( $result );
61     $title = $lang['title_group_perm'].' "'.$row['name'].'"';
62     $page_valide = true;
63   }
64   else
65   {
66     $page_valide = false;
67   }
68   break;
69 case 'stats':
70   $title = $lang['title_history'];       $page_valide = true; break;
71 case 'update':
72   $title = $lang['title_update'];        $page_valide = true; break;
73 case 'configuration':
74   $title = $lang['title_configuration']; $page_valide = true; break;
75 case 'admin_phpinfo':
76   $title = $lang['phpinfos']; $page_valide = true; break;
77 case 'help':
78   $title = $lang['title_instructions'];  $page_valide = true; break;
79 case 'cat_perm':
80   $title = $lang['title_cat_perm'];
81   if ( isset( $_GET['cat_id'] ) )
82   {
83     check_cat_id( $_GET['cat_id'] );
84     if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ) )
85     {
86       $result = get_cat_info( $page['cat'] );
87       $name = get_cat_display_name($result['name'], '');
88       $title.= ' "'.$name.'"';
89     }
90   }
91   $page_valide = true;
92   break;
93 case 'cat_list':
94   $title = $lang['title_categories'];    $page_valide = true; break;
95 case 'cat_modify':
96   $title = $lang['title_edit_cat'];      $page_valide = true; break;
97 case 'infos_images':
98   $title = $lang['title_info_images'];   $page_valide = true; break;
99 case 'waiting':
100   $title = $lang['title_waiting'];       $page_valide = true; break;
101 case 'thumbnail':
102   $title = $lang['title_thumbnails'];
103   if ( isset( $_GET['dir'] ) )
104   {
105     $title.= ' '.$lang['title_thumbnails_2'].' <span class="titreImg">';
106     // $_GET['dir'] contains :
107     // ./galleries/vieux_lyon ou
108     // ./galleries/vieux_lyon/visite ou
109     // ./galleries/vieux_lyon/visite/truc ...
110     $dir = explode( "/", $_GET['dir'] );
111     $title.= $dir[2];
112     for ( $i = 2; $i < sizeof( $dir ) - 1; $i++ )
113     {
114       $title.= ' &gt; '.$dir[$i+1];
115     }
116     $title.= "</span>";
117   }
118   $page_valide = true;
119   break;
120 case 'comments' :
121   $title = $lang['title_comments'];
122   $page_valide = true;
123   break;
124 case 'picture_modify' :
125   $title = $lang['title_picmod'];
126   $page_valide = true;
127   break;
128 case 'remote_site' :
129 {
130   $title = $lang['remote_sites'];
131   $page_valide = true;
132   break;
133 }
134 case 'cat_options' :
135 {
136   $title = $lang['title_cat_options'];
137   $page_valide = true;
138   break;
139 }
140 default:
141   $title = $lang['title_default']; break;
142}
143if ( $title == '' ) $title = $lang['title_default'];
144
145// waiting
146$query = 'SELECT id FROM '.WAITING_TABLE;
147$query.= " WHERE validated='false'";
148$query.= ';';
149$result = pwg_query( $query );
150$nb_waiting = '';
151if ( mysql_num_rows( $result ) > 0 )
152{
153  $nb_waiting =  ' [ '.mysql_num_rows( $result ).' ]';
154}
155// comments
156$query = 'SELECT id FROM '.COMMENTS_TABLE;
157$query.= " WHERE validated='false'";
158$query.= ';';
159$result = pwg_query( $query );
160$nb_comments = '';
161if ( mysql_num_rows( $result ) > 0 )
162{
163  $nb_comments =  ' [ '.mysql_num_rows( $result ).' ]';
164}
165
166$link_start = PHPWG_ROOT_PATH.'admin.php?page=';
167$conf_link = $link_start.'configuration&amp;section=';
168$opt_link = $link_start.'cat_options&amp;section=';
169//----------------------------------------------------- template initialization
170include(PHPWG_ROOT_PATH.'include/page_header.php');
171$template->set_filenames( array('admin'=>'admin.tpl') );
172
173$template->assign_vars(array(
174  'L_TITLE'=>$lang['admin_panel'],
175  'L_LINKS'=>$lang['links'],
176  'L_GALLERY_INDEX'=>$lang['home'],
177  'L_GENERAL'=>$lang['general'],
178  'L_DEFAULT'=>$lang['gallery_default'],
179  'L_PHPINFO'=>$lang['phpinfos'],
180  'L_HISTORY'=>$lang['history'],
181  'L_FAQ'=>$lang['instructions'],
182  'L_CONFIGURATION'=>$lang['config'],
183  'L_CONFIG_GENERAL'=>$lang['general'],
184  'L_CONFIG_COMMENTS'=>$lang['comments'],
185  'L_CONFIG_DISPLAY'=>$lang['conf_default'],
186  'L_CONFIG_UPLOAD'=>$lang['upload'],
187  'L_CONFIG_SESSION'=>$lang['conf_cookie'],
188  'L_CONFIG_METADATA'=>$lang['metadata'],
189  'L_SITES'=>$lang['remote_sites'],
190  'L_CATEGORIES'=>$lang['categories'],
191  'L_MANAGE'=>$lang['manage'],
192  'L_IMAGES'=>$lang['pictures'],
193  'L_WAITING'=>$lang['waiting'].$nb_waiting,
194  'L_COMMENTS'=>$lang['comments'].$nb_comments,
195  'L_THUMBNAILS'=>$lang['thumbnails'],
196  'L_IDENTIFY'=>$lang['identification'],
197  'L_USERS'=>$lang['users'],
198  'L_GROUPS'=>$lang['groups'],
199  'L_AUTH'=>$lang['permissions'],
200  'L_UPDATE'=>$lang['update'],
201  'L_CAT_UPLOAD'=>$lang['upload'],
202  'L_CAT_COMMENTS'=>$lang['comments'],
203  'L_CAT_VISIBLE'=>$lang['lock'],
204  'L_CAT_STATUS'=>$lang['cat_security'],
205
206  'U_CONFIG_GENERAL'=>add_session_id($conf_link.'general' ),
207  'U_CONFIG_COMMENTS'=>add_session_id($conf_link.'comments' ),
208  'U_CONFIG_DISPLAY'=>add_session_id($conf_link.'default' ),
209  'U_CONFIG_UPLOAD'=>add_session_id($conf_link.'upload' ),
210  'U_CONFIG_SESSION'=>add_session_id($conf_link.'session' ),
211  'U_CONFIG_METADATA'=>add_session_id($conf_link.'metadata' ),
212  'U_SITES'=>add_session_id($link_start.'remote_site'),
213  'U_PHPINFO'=>add_session_id($link_start.'admin_phpinfo' ),
214  'U_USERS'=>add_session_id($link_start.'profile' ),
215  'U_GROUPS'=>add_session_id($link_start.'group_list' ),
216  'U_CATEGORIES'=>add_session_id($link_start.'cat_list' ),
217  'U_CAT_UPLOAD'=>add_session_id($opt_link.'upload'),
218  'U_CAT_COMMENTS'=>add_session_id($opt_link.'comments'),
219  'U_CAT_VISIBLE'=>add_session_id($opt_link.'visible'),
220  'U_CAT_STATUS'=>add_session_id($opt_link.'status'),
221  'U_WAITING'=>add_session_id($link_start.'waiting' ),
222  'U_COMMENTS'=>add_session_id($link_start.'comments' ),
223  'U_CAT_UPDATE'=>add_session_id($link_start.'update'),
224  'U_THUMBNAILS'=>add_session_id($link_start.'thumbnail' ),
225  'U_HISTORY'=>add_session_id($link_start.'stats' ),
226  'U_FAQ'=>add_session_id($link_start.'help' ),
227  'U_CAT_OPTIONS'=>add_session_id($link_start.'cat_options'),
228  'U_RETURN'=>add_session_id(PHPWG_ROOT_PATH.'category.php')
229  ));
230
231//--------------------------------------------------------------------- summary
232$link_start = PHPWG_ROOT_PATH.'admin.php?page=';
233//------------------------------------------------------------- content display
234if ( $page_valide )
235{
236  if ($_GET['page']=='comments') include ( PHPWG_ROOT_PATH.'comments.php');
237        elseif ($_GET['page']=='profile') include ( PHPWG_ROOT_PATH.'profile.php');
238  else include ( PHPWG_ROOT_PATH.'admin/'.$_GET['page'].'.php' );
239}
240else
241{
242  $template->assign_vars(array ('ADMIN_CONTENT'=> '<div style="text-align:center">'.$lang['default_message'].'</div>') );
243}
244$template->pparse('admin');
245include(PHPWG_ROOT_PATH.'include/page_tail.php');
246?>
Note: See TracBrowser for help on using the repository browser.