Ignore:
Timestamp:
Nov 14, 2011, 11:17:15 PM (12 years ago)
Author:
dj3c1t
Message:

passage a Fluxbb 1.4.7

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/rsr.v5.1.dev/web/punbb/admin_loader.php

    r1 r3  
    11<?php
    2 /***********************************************************************
    32
    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 */
    258
    269// Tell header.php to use the admin template
    2710define('PUN_ADMIN_CONSOLE', 1);
    2811
    29 define('PUN_ROOT', './');
     12define('PUN_ROOT', dirname(__FILE__).'/');
    3013require PUN_ROOT.'include/common.php';
    3114require PUN_ROOT.'include/common_admin.php';
    3215
    3316
    34 if ($pun_user['g_id'] > PUN_MOD)
     17if (!$pun_user['is_admmod'])
    3518        message($lang_common['No permission']);
    36 
    3719
    3820// The plugin to load should be supplied via GET
    3921$plugin = isset($_GET['plugin']) ? $_GET['plugin'] : '';
    40 if (!preg_match('/^AM?P_(\w*?)\.php$/i', $plugin))
     22if (!preg_match('%^AM?P_(\w*?)\.php$%i', $plugin))
    4123        message($lang_common['Bad request']);
    4224
    4325// AP_ == Admins only, AMP_ == admins and moderators
    4426$prefix = substr($plugin, 0, strpos($plugin, '_'));
    45 if ($pun_user['g_id'] == PUN_MOD && $prefix == 'AP')
     27if ($pun_user['g_moderator'] == '1' && $prefix == 'AP')
    4628        message($lang_common['No permission']);
    4729
    4830// Make sure the file actually exists
    4931if (!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));
    5133
    5234// Construct REQUEST_URI if it isn't set
     
    5436        $_SERVER['REQUEST_URI'] = (isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : '').'?'.(isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '');
    5537
    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)));
     39define('PUN_ACTIVE_PAGE', 'admin');
    5740require PUN_ROOT.'header.php';
    5841
    5942// Attempt to load the plugin. We don't use @ here to supress error messages,
    6043// 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"
    6245include PUN_ROOT.'plugins/'.$plugin;
    6346if (!defined('PUN_PLUGIN_LOADED'))
    64         message('Le chargement du plugin \''.$plugin.'\' a échoué.');
     47        message(sprintf($lang_admin_common['Plugin failed message'], $plugin));
    6548
    6649// Output the clearer div
Note: See TracChangeset for help on using the changeset viewer.