Changeset 3 for branches/rsr.v5.1.dev/web/punbb/admin_loader.php
- Timestamp:
- Nov 14, 2011, 11:17:15 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/rsr.v5.1.dev/web/punbb/admin_loader.php
r1 r3 1 1 <?php 2 /***********************************************************************3 2 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 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 */ 25 8 26 9 // Tell header.php to use the admin template 27 10 define('PUN_ADMIN_CONSOLE', 1); 28 11 29 define('PUN_ROOT', './');12 define('PUN_ROOT', dirname(__FILE__).'/'); 30 13 require PUN_ROOT.'include/common.php'; 31 14 require PUN_ROOT.'include/common_admin.php'; 32 15 33 16 34 if ( $pun_user['g_id'] > PUN_MOD)17 if (!$pun_user['is_admmod']) 35 18 message($lang_common['No permission']); 36 37 19 38 20 // The plugin to load should be supplied via GET 39 21 $plugin = isset($_GET['plugin']) ? $_GET['plugin'] : ''; 40 if (!preg_match(' /^AM?P_(\w*?)\.php$/i', $plugin))22 if (!preg_match('%^AM?P_(\w*?)\.php$%i', $plugin)) 41 23 message($lang_common['Bad request']); 42 24 43 25 // AP_ == Admins only, AMP_ == admins and moderators 44 26 $prefix = substr($plugin, 0, strpos($plugin, '_')); 45 if ($pun_user['g_ id'] == PUN_MOD&& $prefix == 'AP')27 if ($pun_user['g_moderator'] == '1' && $prefix == 'AP') 46 28 message($lang_common['No permission']); 47 29 48 30 // Make sure the file actually exists 49 31 if (!file_exists(PUN_ROOT.'plugins/'.$plugin)) 50 message( 'Il n\'y a pas de plugin nommé \''.$plugin.'\' dans le répertoire de plugin.');32 message(sprintf($lang_admin_common['No plugin message'], $plugin)); 51 33 52 34 // Construct REQUEST_URI if it isn't set … … 54 36 $_SERVER['REQUEST_URI'] = (isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : '').'?'.(isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : ''); 55 37 56 $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / '.$plugin; 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'); 57 40 require PUN_ROOT.'header.php'; 58 41 59 42 // Attempt to load the plugin. We don't use @ here to supress error messages, 60 43 // because if we did and a parse error occurred in the plugin, we would only 61 // get the "blank page of death" .44 // get the "blank page of death" 62 45 include PUN_ROOT.'plugins/'.$plugin; 63 46 if (!defined('PUN_PLUGIN_LOADED')) 64 message( 'Le chargement du plugin \''.$plugin.'\' a échoué.');47 message(sprintf($lang_admin_common['Plugin failed message'], $plugin)); 65 48 66 49 // Output the clearer div
Note: See TracChangeset
for help on using the changeset viewer.