source: trunk/admin.php @ 1578

Last change on this file since 1578 was 1578, checked in by rvelices, 18 years ago

plugins: first prototype version

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.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-2006 PhpWebGallery Team - http://phpwebgallery.net |
6// +-----------------------------------------------------------------------+
7// | branch        : BSF (Best So Far)
8// | file          : $RCSfile$
9// | last update   : $Date: 2006-10-26 03:35:20 +0000 (Thu, 26 Oct 2006) $
10// | last modifier : $Author: rvelices $
11// | revision      : $Revision: 1578 $
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' );
32
33include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
34
35// +-----------------------------------------------------------------------+
36// | Check Access and exit when user status is not ok                      |
37// +-----------------------------------------------------------------------+
38check_status(ACCESS_ADMINISTRATOR);
39
40// +-----------------------------------------------------------------------+
41// |                    synchronize user informations                      |
42// +-----------------------------------------------------------------------+
43
44sync_users();
45
46// +-----------------------------------------------------------------------+
47// |                            variables init                             |
48// +-----------------------------------------------------------------------+
49
50if (isset($_GET['page'])
51    and preg_match('/^[a-z_]*$/', $_GET['page'])
52    and is_file(PHPWG_ROOT_PATH.'admin/'.$_GET['page'].'.php'))
53{
54  $page['page'] = $_GET['page'];
55}
56else
57{
58  $page['page'] = 'intro';
59}
60
61$link_start = PHPWG_ROOT_PATH.'admin.php?page=';
62$conf_link = $link_start.'configuration&amp;section=';
63$opt_link = $link_start.'cat_options&amp;section=';
64//----------------------------------------------------- template initialization
65$title = l10n('PhpWebGallery Administration'); // for include/page_header.php
66$page['page_banner'] = '<h1>'.l10n('PhpWebGallery Administration').'</h1>';
67$page['body_id'] = 'theAdminPage';
68include(PHPWG_ROOT_PATH.'include/page_header.php');
69
70$template->set_filenames(array('admin' => 'admin.tpl'));
71
72$template->assign_vars(
73  array(
74    'U_SITE_MANAGER'=> $link_start.'site_manager',
75    'U_HISTORY'=> $link_start.'stats',
76    'U_FAQ'=> $link_start.'help',
77    'U_SITES'=> $link_start.'remote_site',
78    'U_MAINTENANCE'=> $link_start.'maintenance',
79    'U_NOTIFICATION_BY_MAIL'=> $link_start.'notification_by_mail',
80    'U_CONFIG_GENERAL'=> $conf_link.'general',
81    'U_CONFIG_COMMENTS'=> $conf_link.'comments',
82    'U_CONFIG_DISPLAY'=> $conf_link.'default',
83    'U_CATEGORIES'=> $link_start.'cat_list',
84    'U_MOVE'=> $link_start.'cat_move',
85    'U_CAT_UPLOAD'=> $opt_link.'upload',
86    'U_CAT_COMMENTS'=> $opt_link.'comments',
87    'U_CAT_VISIBLE'=> $opt_link.'visible',
88    'U_CAT_STATUS'=> $opt_link.'status',
89    'U_CAT_OPTIONS'=> $link_start.'cat_options',
90    'U_CAT_UPDATE'=> $link_start.'site_update&amp;site=1',
91    'U_WAITING'=> $link_start.'waiting',
92    'U_COMMENTS'=> $link_start.'comments',
93    'U_RATING'=> $link_start.'rating',
94    'U_CADDIE'=> $link_start.'element_set&amp;cat=caddie',
95    'U_PLUGINS'=> $link_start.'plugins',
96    'U_TAGS'=> $link_start.'tags',
97    'U_THUMBNAILS'=> $link_start.'thumbnail',
98    'U_USERS'=> $link_start.'user_list',
99    'U_GROUPS'=> $link_start.'group_list',
100    'U_RETURN'=> make_index_url(),
101    'U_ADMIN'=> PHPWG_ROOT_PATH.'admin.php',
102    'L_ADMIN' => $lang['admin'],
103    'L_ADMIN_HINT' => $lang['hint_admin']
104    )
105  );
106
107if ($conf['allow_random_representative'])
108{
109  $template->assign_block_vars(
110    'representative',
111    array(
112      'URL' => $opt_link.'representative'
113      )
114    );
115}
116
117//------------------------------------------------------------- content display
118$page['errors'] = array();
119$page['infos']  = array();
120
121include(PHPWG_ROOT_PATH.'admin/'.$page['page'].'.php');
122
123// +-----------------------------------------------------------------------+
124// |                            errors & infos                             |
125// +-----------------------------------------------------------------------+
126
127if (count($page['errors']) != 0)
128{
129  $template->assign_block_vars('errors',array());
130  foreach ($page['errors'] as $error)
131  {
132    $template->assign_block_vars('errors.error',array('ERROR'=>$error));
133  }
134}
135
136if (count($page['infos']) != 0)
137{
138  $template->assign_block_vars('infos',array());
139  foreach ($page['infos'] as $info)
140  {
141    $template->assign_block_vars('infos.info',array('INFO'=>$info));
142  }
143}
144
145$template->parse('admin');
146include(PHPWG_ROOT_PATH.'include/page_tail.php');
147
148// +-----------------------------------------------------------------------+
149// |                     order permission refreshment                      |
150// +-----------------------------------------------------------------------+
151
152$query = '
153UPDATE '.USER_CACHE_TABLE.'
154  SET need_update = \'true\'
155;';
156pwg_query($query);
157?>
Note: See TracBrowser for help on using the repository browser.