source: trunk/web/punbb/admin_loader.php

Last change on this file was 6, checked in by dj3c1t, 13 years ago

mise a jour du trunk

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