adopted md5sum
[archlinuxdevstack.git] / fluxbb / admin_loader.php
blobbc1d6219898db46fbf20d5d55567fbb03fa884a5
1 <?php
2 /***********************************************************************
4 Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org)
6 This file is part of PunBB.
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.
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.
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
23 ************************************************************************/
26 // Tell header.php to use the admin template
27 define('PUN_ADMIN_CONSOLE', 1);
29 define('PUN_ROOT', './');
30 require PUN_ROOT.'include/common.php';
31 require PUN_ROOT.'include/common_admin.php';
34 if ($pun_user['g_id'] > PUN_MOD)
35 message($lang_common['No permission']);
38 // The plugin to load should be supplied via GET
39 $plugin = isset($_GET['plugin']) ? $_GET['plugin'] : '';
40 if (!@preg_match('/^AM?P_(\w*?)\.php$/i', $plugin))
41 message($lang_common['Bad request']);
43 // AP_ == Admins only, AMP_ == admins and moderators
44 $prefix = substr($plugin, 0, strpos($plugin, '_'));
45 if ($pun_user['g_id'] == PUN_MOD && $prefix == 'AP')
46 message($lang_common['No permission']);
48 // Make sure the file actually exists
49 if (!file_exists(PUN_ROOT.'plugins/'.$plugin))
50 message('There is no plugin called \''.$plugin.'\' in the plugin directory.');
52 // Construct REQUEST_URI if it isn't set
53 if (!isset($_SERVER['REQUEST_URI']))
54 $_SERVER['REQUEST_URI'] = (isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : '').'?'.(isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '');
56 $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / '.$plugin;
57 require PUN_ROOT.'header.php';
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".
62 include PUN_ROOT.'plugins/'.$plugin;
63 if (!defined('PUN_PLUGIN_LOADED'))
64 message('Loading of the plugin \''.$plugin.'\' failed.');
66 // Output the clearer div
68 <div class="clearer"></div>
69 </div>
70 <?php
72 require PUN_ROOT.'footer.php';