source: trunk/admin.php @ 1656

Last change on this file since 1656 was 1656, checked in by rub, 17 years ago

Feature Issue ID 0000460:

Add advanced features on administration menu

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