[1] | 1 | <?php |
---|
| 2 | |
---|
[3] | 3 | /** |
---|
| 4 | * Copyright (C) 2008-2011 FluxBB |
---|
| 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
---|
| 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
---|
| 7 | */ |
---|
[1] | 8 | |
---|
| 9 | // Tell header.php to use the admin template |
---|
| 10 | define('PUN_ADMIN_CONSOLE', 1); |
---|
| 11 | |
---|
[3] | 12 | define('PUN_ROOT', dirname(__FILE__).'/'); |
---|
[1] | 13 | require PUN_ROOT.'include/common.php'; |
---|
| 14 | require PUN_ROOT.'include/common_admin.php'; |
---|
| 15 | |
---|
| 16 | |
---|
[3] | 17 | if (!$pun_user['is_admmod']) |
---|
[1] | 18 | message($lang_common['No permission']); |
---|
| 19 | |
---|
| 20 | // The plugin to load should be supplied via GET |
---|
| 21 | $plugin = isset($_GET['plugin']) ? $_GET['plugin'] : ''; |
---|
[3] | 22 | if (!preg_match('%^AM?P_(\w*?)\.php$%i', $plugin)) |
---|
[1] | 23 | message($lang_common['Bad request']); |
---|
| 24 | |
---|
| 25 | // AP_ == Admins only, AMP_ == admins and moderators |
---|
| 26 | $prefix = substr($plugin, 0, strpos($plugin, '_')); |
---|
[3] | 27 | if ($pun_user['g_moderator'] == '1' && $prefix == 'AP') |
---|
[1] | 28 | message($lang_common['No permission']); |
---|
| 29 | |
---|
| 30 | // Make sure the file actually exists |
---|
| 31 | if (!file_exists(PUN_ROOT.'plugins/'.$plugin)) |
---|
[3] | 32 | message(sprintf($lang_admin_common['No plugin message'], $plugin)); |
---|
[1] | 33 | |
---|
| 34 | // Construct REQUEST_URI if it isn't set |
---|
| 35 | if (!isset($_SERVER['REQUEST_URI'])) |
---|
| 36 | $_SERVER['REQUEST_URI'] = (isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : '').'?'.(isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : ''); |
---|
| 37 | |
---|
[3] | 38 | $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_common['Admin'], str_replace('_', ' ', substr($plugin, strpos($plugin, '_') + 1, -4))); |
---|
| 39 | define('PUN_ACTIVE_PAGE', 'admin'); |
---|
[1] | 40 | require PUN_ROOT.'header.php'; |
---|
| 41 | |
---|
| 42 | // Attempt to load the plugin. We don't use @ here to supress error messages, |
---|
| 43 | // because if we did and a parse error occurred in the plugin, we would only |
---|
[3] | 44 | // get the "blank page of death" |
---|
[1] | 45 | include PUN_ROOT.'plugins/'.$plugin; |
---|
| 46 | if (!defined('PUN_PLUGIN_LOADED')) |
---|
[3] | 47 | message(sprintf($lang_admin_common['Plugin failed message'], $plugin)); |
---|
[1] | 48 | |
---|
| 49 | // Output the clearer div |
---|
| 50 | ?> |
---|
| 51 | <div class="clearer"></div> |
---|
| 52 | </div> |
---|
| 53 | <?php |
---|
| 54 | |
---|
| 55 | require PUN_ROOT.'footer.php'; |
---|