source: branches/rsr.v5.1.dev/web/punbb/admin_loader.php @ 2

Last change on this file since 2 was 1, checked in by dj3c1t, 13 years ago

import initial

File size: 2.5 KB
Line 
1<?php
2/***********************************************************************
3
4  Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)
5
6  This file is part of PunBB.
7
8  PunBB is free software; you can redistribute it and/or modify it
9  under the terms of the GNU General Public License as published
10  by the Free Software Foundation; either version 2 of the License,
11  or (at your option) any later version.
12
13  PunBB is distributed in the hope that it will be useful, but
14  WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  GNU General Public License for more details.
17
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21  MA  02111-1307  USA
22
23************************************************************************/
24
25
26// Tell header.php to use the admin template
27define('PUN_ADMIN_CONSOLE', 1);
28
29define('PUN_ROOT', './');
30require PUN_ROOT.'include/common.php';
31require PUN_ROOT.'include/common_admin.php';
32
33
34if ($pun_user['g_id'] > PUN_MOD)
35        message($lang_common['No permission']);
36
37
38// The plugin to load should be supplied via GET
39$plugin = isset($_GET['plugin']) ? $_GET['plugin'] : '';
40if (!preg_match('/^AM?P_(\w*?)\.php$/i', $plugin))
41        message($lang_common['Bad request']);
42
43// AP_ == Admins only, AMP_ == admins and moderators
44$prefix = substr($plugin, 0, strpos($plugin, '_'));
45if ($pun_user['g_id'] == PUN_MOD && $prefix == 'AP')
46        message($lang_common['No permission']);
47
48// Make sure the file actually exists
49if (!file_exists(PUN_ROOT.'plugins/'.$plugin))
50        message('Il n\'y a pas de plugin nommé \''.$plugin.'\' dans le répertoire de plugin.');
51
52// Construct REQUEST_URI if it isn't set
53if (!isset($_SERVER['REQUEST_URI']))
54        $_SERVER['REQUEST_URI'] = (isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : '').'?'.(isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '');
55
56$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / '.$plugin;
57require PUN_ROOT.'header.php';
58
59// Attempt to load the plugin. We don't use @ here to supress error messages,
60// because if we did and a parse error occurred in the plugin, we would only
61// get the "blank page of death".
62include PUN_ROOT.'plugins/'.$plugin;
63if (!defined('PUN_PLUGIN_LOADED'))
64        message('Le chargement du plugin \''.$plugin.'\' a échoué.');
65
66// Output the clearer div
67?>
68        <div class="clearer"></div>
69</div>
70<?php
71
72require PUN_ROOT.'footer.php';
Note: See TracBrowser for help on using the repository browser.