source: branches/rsr.v5.1.1/web/punbb/admin_loader.php @ 8

Last change on this file since 8 was 4, checked in by dj3c1t, 13 years ago

passage en v5.1.1

File size: 1.9 KB
RevLine 
[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
10define('PUN_ADMIN_CONSOLE', 1);
11
[3]12define('PUN_ROOT', dirname(__FILE__).'/');
[1]13require PUN_ROOT.'include/common.php';
14require PUN_ROOT.'include/common_admin.php';
15
16
[3]17if (!$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]22if (!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]27if ($pun_user['g_moderator'] == '1' && $prefix == 'AP')
[1]28        message($lang_common['No permission']);
29
30// Make sure the file actually exists
31if (!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
35if (!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)));
39define('PUN_ACTIVE_PAGE', 'admin');
[1]40require 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]45include PUN_ROOT.'plugins/'.$plugin;
46if (!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
55require PUN_ROOT.'footer.php';
Note: See TracBrowser for help on using the repository browser.