source: trunk/admin.php @ 393

Last change on this file since 393 was 393, checked in by gweltas, 20 years ago
  • Template migration
  • Admin Control Panel migration
  • Language migration
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.9 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// |                               admin.php                               |
4// +-----------------------------------------------------------------------+
5// | application   : PhpWebGallery <http://phpwebgallery.net>              |
6// | branch        : BSF (Best So Far)                                     |
7// +-----------------------------------------------------------------------+
8// | file          : $RCSfile$
9// | last update   : $Date: 2004-03-20 00:52:37 +0000 (Sat, 20 Mar 2004) $
10// | last modifier : $Author: gweltas $
11// | revision      : $Revision: 393 $
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
34//--------------------------------------- validating page and creation of title
35$page_valide = false;
36$title = '';
37if (isset( $_GET['page'] ))
38switch ( $_GET['page'] )
39{
40 case 'user_list':
41   $title = $lang['title_liste_users'];   $page_valide = true; break;
42 case 'user_modify':
43   $title = $lang['title_modify'];        $page_valide = true; break;
44 case 'user_search':
45  /* if ( !is_numeric( $_GET['user_id'] ) ) $_GET['user_id'] = -1;
46   $query = 'SELECT status,username';
47   $query.= ' FROM '.USERS_TABLE;
48   $query.= ' WHERE id = '.$_GET['user_id'];
49   $query.= ';';
50   $result = mysql_query( $query );
51   if ( mysql_num_rows( $result ) > 0 )
52   {
53     $row = mysql_fetch_array( $result );
54     $page['user_status']   = $row['status'];
55     if ( $row['username'] == 'guest' ) $row['username'] = $lang['guest'];
56     $page['user_username'] = $row['username'];
57     $page_valide = true;
58     $title = $lang['title_user_perm'].' "'.$page['user_username'].'"';
59   }
60   else
61   {
62     $page_valide = false;
63   }*/
64   $title = $lang['title_user_perm'];
65   //.' '.$_POST['username'];
66   $page_valide = true; 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 FROM '.GROUPS_TABLE;
72   $query.= ' WHERE id = '.$_GET['group_id'];
73   $query.= ';';
74   $result = mysql_query( $query );
75   if ( mysql_num_rows( $result ) > 0 )
76   {
77     $row = mysql_fetch_array( $result );
78     $title = $lang['title_group_perm'].' "'.$row['name'].'"';
79     $page_valide = true;
80   }
81   else
82   {
83     $page_valide = false;
84   }
85   break;
86 case 'stats':
87   $title = $lang['title_history'];       $page_valide = true; break;
88 case 'update':
89   $title = $lang['title_update'];        $page_valide = true; break;
90 case 'configuration':
91   $title = $lang['title_configuration']; $page_valide = true; break;
92 case 'help':
93   $title = $lang['title_instructions'];  $page_valide = true; break;
94 case 'cat_perm':
95   $title = $lang['title_cat_perm'];
96   if ( isset( $_GET['cat_id'] ) )
97   {
98     check_cat_id( $_GET['cat_id'] );
99     if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ) )
100     {
101       $result = get_cat_info( $page['cat'] );
102       $name = get_cat_display_name( $result['name'],' &gt; ', '' );
103       $title.= ' "'.$name.'"';
104     }
105   }
106   $page_valide = true;
107   break;
108 case 'cat_list':
109   $title = $lang['title_categories'];    $page_valide = true; break;
110 case 'cat_modify':
111   $title = $lang['title_edit_cat'];      $page_valide = true; break;
112 case 'infos_images':
113   $title = $lang['title_info_images'];   $page_valide = true; break;
114 case 'waiting':
115   $title = $lang['title_waiting'];       $page_valide = true; break;
116 case 'thumbnail':
117   $title = $lang['title_thumbnails'];
118   if ( isset( $_GET['dir'] ) )
119   {
120     $title.= ' '.$lang['title_thumbnails_2'].' <span class="titreImg">';
121     // $_GET['dir'] contains :
122     // ./galleries/vieux_lyon ou
123     // ./galleries/vieux_lyon/visite ou
124     // ./galleries/vieux_lyon/visite/truc ...
125     $dir = explode( "/", $_GET['dir'] );
126     $title.= $dir[2];
127     for ( $i = 2; $i < sizeof( $dir ) - 1; $i++ )
128     {
129       $title.= ' &gt; '.$dir[$i+1];
130     }
131     $title.= "</span>";
132   }
133   $page_valide = true;
134   break;
135 case 'comments' :
136   $title = $lang['title_comments'];
137   $page_valide = true;
138   break;
139 case 'picture_modify' :
140   $title = $lang['title_picmod'];
141   $page_valide = true;
142   break;
143 default:
144   $title = $lang['title_default']; break;
145}
146if ( $title == '' ) $title = $lang['title_default'];
147
148// waiting
149$query = 'SELECT id FROM '.WAITING_TABLE;
150$query.= " WHERE validated='false'";
151$query.= ';';
152$result = mysql_query( $query );
153$nb_waiting = '';
154if ( mysql_num_rows( $result ) > 0 )
155{
156  $nb_waiting =  ' [ '.mysql_num_rows( $result ).' ]';
157}
158// comments
159$query = 'SELECT id FROM '.COMMENTS_TABLE;
160$query.= " WHERE validated='false'";
161$query.= ';';
162$result = mysql_query( $query );
163$nb_comments = '';
164if ( mysql_num_rows( $result ) > 0 )
165{
166  $nb_comments =  ' [ '.mysql_num_rows( $result ).' ]';
167}
168
169$link_start = PHPWG_ROOT_PATH.'admin.php?page=';
170//----------------------------------------------------- template initialization
171include(PHPWG_ROOT_PATH.'include/page_header.php');
172$template->set_filenames( array('admin'=>'admin.tpl') );
173
174$template->assign_vars(array(
175  'L_CONFIG'=>$lang['menu_config'],
176  'L_USERS'=>$lang['menu_users'],
177  'L_GROUPS'=>$lang['menu_groups'],
178  'L_CATEGORIES'=>$lang['menu_categories'],
179  'L_WAITING'=>$lang['menu_waiting'].$nb_waiting,
180  'L_COMMENTS'=>$lang['menu_comments'].$nb_comments,
181  'L_UPDATE'=>$lang['menu_update'],
182  'L_THUMBNAILS'=>$lang['menu_thumbnails'],
183  'L_HISTORY'=>$lang['menu_history'],
184  'L_FAQ'=>$lang['menu_instructions'],
185  'L_RETURN'=>$lang['menu_back'],
186 
187  'U_CONFIG'=>add_session_id($link_start.'configuration' ),
188  'U_USERS'=>add_session_id($link_start.'user_search' ),
189  'U_GROUPS'=>add_session_id($link_start.'group_list' ),
190  'U_CATEGORIES'=>add_session_id($link_start.'cat_list' ),
191  'U_WAITING'=>add_session_id($link_start.'waiting' ),
192  'U_COMMENTS'=>add_session_id($link_start.'comments' ),
193  'U_UPDATE'=>add_session_id($link_start.'update' ),
194  'U_THUMBNAILS'=>add_session_id($link_start.'thumbnail' ),
195  'U_HISTORY'=>add_session_id($link_start.'stats' ),
196  'U_FAQ'=>add_session_id($link_start.'help' ),
197  'U_RETURN'=>add_session_id(PHPWG_ROOT_PATH.'category.php')
198  ));
199
200//--------------------------------------------------------------------- summary
201$link_start = PHPWG_ROOT_PATH.'admin.php?page=';
202//------------------------------------------------------------- content display
203if ( $page_valide )
204{
205  if ($_GET['page']=='comments') include ( PHPWG_ROOT_PATH.'comments.php');
206  else include ( PHPWG_ROOT_PATH.'admin/'.$_GET['page'].'.php' );
207}
208else
209{
210  $template->assign_vars(array ('ADMIN_CONTENT'=> '<div style="text-align:center">'.$lang['default_message'].'</div>') );
211}
212$template->pparse('admin');
213include(PHPWG_ROOT_PATH.'include/page_tail.php');
214?>
Note: See TracBrowser for help on using the repository browser.