[6] | 1 | <?php |
---|
| 2 | |
---|
| 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 | */ |
---|
| 8 | |
---|
| 9 | // Tell header.php to use the admin template |
---|
| 10 | define('PUN_ADMIN_CONSOLE', 1); |
---|
| 11 | |
---|
| 12 | define('PUN_ROOT', dirname(__FILE__).'/'); |
---|
| 13 | require PUN_ROOT.'include/common.php'; |
---|
| 14 | require PUN_ROOT.'include/common_admin.php'; |
---|
| 15 | |
---|
| 16 | |
---|
| 17 | if (!$pun_user['is_admmod']) |
---|
| 18 | message($lang_common['No permission']); |
---|
| 19 | |
---|
| 20 | // The plugin to load should be supplied via GET |
---|
| 21 | $plugin = isset($_GET['plugin']) ? $_GET['plugin'] : ''; |
---|
| 22 | if (!preg_match('%^AM?P_(\w*?)\.php$%i', $plugin)) |
---|
| 23 | message($lang_common['Bad request']); |
---|
| 24 | |
---|
| 25 | // AP_ == Admins only, AMP_ == admins and moderators |
---|
| 26 | $prefix = substr($plugin, 0, strpos($plugin, '_')); |
---|
| 27 | if ($pun_user['g_moderator'] == '1' && $prefix == 'AP') |
---|
| 28 | message($lang_common['No permission']); |
---|
| 29 | |
---|
| 30 | // Make sure the file actually exists |
---|
| 31 | if (!file_exists(PUN_ROOT.'plugins/'.$plugin)) |
---|
| 32 | message(sprintf($lang_admin_common['No plugin message'], $plugin)); |
---|
| 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 | |
---|
| 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'); |
---|
| 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 |
---|
| 44 | // get the "blank page of death" |
---|
| 45 | include PUN_ROOT.'plugins/'.$plugin; |
---|
| 46 | if (!defined('PUN_PLUGIN_LOADED')) |
---|
| 47 | message(sprintf($lang_admin_common['Plugin failed message'], $plugin)); |
---|
| 48 | |
---|
| 49 | // Output the clearer div |
---|
| 50 | ?> |
---|
| 51 | <div class="clearer"></div> |
---|
| 52 | </div> |
---|
| 53 | <?php |
---|
| 54 | |
---|
| 55 | require PUN_ROOT.'footer.php'; |
---|