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_index.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']);
    3619
     20// Load the admin_index.php language file
     21require PUN_ROOT.'lang/'.$admin_language.'/admin_index.php';
    3722
    3823$action = isset($_GET['action']) ? $_GET['action'] : null;
     
    4227{
    4328        if (!ini_get('allow_url_fopen'))
    44                 message('Impossible de vérifier les mises à jour tant que \'allow_url_fopen\' est désactivé sur ce systÚme.');
     29                message($lang_admin_index['fopen disabled message']);
    4530
    46         $fp = @fopen('http://www.punbb.org/latest_version', 'r');
    47         $latest_version = trim(@fread($fp, 16));
    48         @fclose($fp);
     31        $latest_version = trim(@file_get_contents('http://fluxbb.org/latest_version'));
     32        if (empty($latest_version))
     33                message($lang_admin_index['Upgrade check failed message']);
    4934
    50         if ($latest_version == '')
    51                 message('La vérification de mise à jour a échouée pour une raison inconnue.');
    52 
    53         $cur_version = str_replace(array('.', 'dev', 'beta', ' '), '', strtolower($pun_config['o_cur_version']));
    54         $cur_version = (strlen($cur_version) == 2) ? intval($cur_version) * 10 : intval($cur_version);
    55 
    56         $latest_version = str_replace('.', '', strtolower($latest_version));
    57         $latest_version = (strlen($latest_version) == 2) ? intval($latest_version) * 10 : intval($latest_version);
    58 
    59         if ($cur_version >= $latest_version)
    60                 message('Vous utilisez la derniÚre version de PunBB.');
     35        if (version_compare($pun_config['o_cur_version'], $latest_version, '>='))
     36                message($lang_admin_index['Running latest version message']);
    6137        else
    62                 message('Une nouvelle version de PunBB est sortie ! Vous pouvez télécharger cette derniÚre version sur <a href="http://www.punbb.org/">PunBB.org</a>.');
    63 }
    64 
    65 // Check for french upgrade
    66 if ($action == 'check_upgrade_fr')
    67 {
    68         if (!ini_get('allow_url_fopen'))
    69                 message('Impossible de vérifier les mises à jour tant que \'allow_url_fopen\' est désactivé sur ce systÚme.');
    70 
    71         $fp = @fopen('http://www.punbb.fr/latest_version', 'r');
    72         $latest_version = trim(@fread($fp, 16));
    73         @fclose($fp);
    74 
    75         if ($latest_version == '')
    76                 message('La vérification de mise à jour a échouée pour une raison inconnue.');
    77 
    78         $cur_version = str_replace(array('.', 'dev', 'beta', ' '), '', strtolower($pun_config['o_cur_version_fr']));
    79         $cur_version = (strlen($cur_version) == 2) ? intval($cur_version) * 10 : intval($cur_version);
    80 
    81         $latest_version = str_replace('.', '', strtolower($latest_version));
    82         $latest_version = (strlen($latest_version) == 2) ? intval($latest_version) * 10 : intval($latest_version);
    83 
    84         if ($cur_version >= $latest_version)
    85                 message('Vous utilisez la derniÚre version de PunBB en français.');
    86         else
    87                 message('Une nouvelle version de PunBB en français est sortie ! Vous pouvez télécharger cette derniÚre version sur <a href="http://www.punbb.fr/">PunBB.fr</a>.');
     38                message(sprintf($lang_admin_index['New version available message'], '<a href="http://fluxbb.org/">FluxBB.org</a>'));
    8839}
    8940
     
    9344{
    9445        // Is phpinfo() a disabled function?
    95         if (strpos(strtolower((string)@ini_get('disable_functions')), 'phpinfo') !== false)
    96                 message('La fonction phpinfo() de PHP est désactivée sur ce serveur.');
     46        if (strpos(strtolower((string) ini_get('disable_functions')), 'phpinfo') !== false)
     47                message($lang_admin_index['PHPinfo disabled message']);
    9748
    9849        phpinfo();
     
    10960        @fclose($fh);
    11061
     62        if (($fh = @fopen('/proc/loadavg', 'r')))
     63        {
     64                $load_averages = fread($fh, 64);
     65                fclose($fh);
     66        }
     67        else
     68                $load_averages = '';
     69
    11170        $load_averages = @explode(' ', $load_averages);
    112         $server_load = isset($load_averages[2]) ? $load_averages[0].' '.$load_averages[1].' '.$load_averages[2] : 'Indisponible';
     71        $server_load = isset($load_averages[2]) ? $load_averages[0].' '.$load_averages[1].' '.$load_averages[2] : $lang_admin_index['Not available'];
    11372}
    114 else if (!in_array(PHP_OS, array('WINNT', 'WIN32')) && preg_match('/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/i', @exec('uptime'), $load_averages))
     73else if (!in_array(PHP_OS, array('WINNT', 'WIN32')) && preg_match('%averages?: ([0-9\.]+),?\s+([0-9\.]+),?\s+([0-9\.]+)%i', @exec('uptime'), $load_averages))
    11574        $server_load = $load_averages[1].' '.$load_averages[2].' '.$load_averages[3];
    11675else
    117         $server_load = 'Indisponible';
     76        $server_load = $lang_admin_index['Not available'];
    11877
    11978
    12079// Get number of current visitors
    121 $result = $db->query('SELECT COUNT(user_id) FROM '.$db->prefix.'online WHERE idle=0') or error('Impossible de retrouver le total d\'utilisateurs en ligne', __FILE__, __LINE__, $db->error());
     80$result = $db->query('SELECT COUNT(user_id) FROM '.$db->prefix.'online WHERE idle=0') or error('Unable to fetch online count', __FILE__, __LINE__, $db->error());
    12281$num_online = $db->result($result);
    12382
    12483
    125 // Get the database system version
    126 switch ($db_type)
     84// Collect some additional info about MySQL
     85if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb')
    12786{
    128         case 'sqlite':
    129                 $db_version = 'SQLite '.sqlite_libversion();
    130                 break;
    131 
    132         default:
    133                 $result = $db->query('SELECT VERSION()') or error('Impossible de retrouver les informations utilisateurs', __FILE__, __LINE__, $db->error());
    134                 $db_version = $db->result($result);
    135                 break;
    136 }
    137 
    138 
    139 // Collect some additional info about MySQL
    140 if ($db_type == 'mysql' || $db_type == 'mysqli')
    141 {
    142         $db_version = 'MySQL '.$db_version;
    143 
    14487        // Calculate total db size/row count
    145         $result = $db->query('SHOW TABLE STATUS FROM `'.$db_name.'`') or error('Impossible de retrouver le statut des tables', __FILE__, __LINE__, $db->error());
     88        $result = $db->query('SHOW TABLE STATUS LIKE \''.$db->prefix.'%\'') or error('Unable to fetch table status', __FILE__, __LINE__, $db->error());
    14689
    14790        $total_records = $total_size = 0;
     
    15295        }
    15396
    154         $total_size = $total_size / 1024;
    155 
    156         if ($total_size > 1024)
    157                 $total_size = round($total_size / 1024, 2).' MB';
    158         else
    159                 $total_size = round($total_size, 2).' KB';
     97        $total_size = file_size($total_size);
    16098}
    16199
    162100
    163 // See if MMCache or PHPA is loaded
     101// Check for the existence of various PHP opcode caches/optimizers
    164102if (function_exists('mmcache'))
    165         $php_accelerator = '<a href="http://turck-mmcache.sourceforge.net/">Turck MMCache</a>';
     103        $php_accelerator = '<a href="http://'.$lang_admin_index['Turck MMCache link'].'">'.$lang_admin_index['Turck MMCache'].'</a>';
    166104else if (isset($_PHPA))
    167         $php_accelerator = '<a href="http://www.php-accelerator.co.uk/">ionCube PHP Accelerator</a>';
     105        $php_accelerator = '<a href="http://'.$lang_admin_index['ionCube PHP Accelerator link'].'">'.$lang_admin_index['ionCube PHP Accelerator'].'</a>';
     106else if (ini_get('apc.enabled'))
     107        $php_accelerator ='<a href="http://'.$lang_admin_index['Alternative PHP Cache (APC) link'].'">'.$lang_admin_index['Alternative PHP Cache (APC)'].'</a>';
     108else if (ini_get('zend_optimizer.optimization_level'))
     109        $php_accelerator = '<a href="http://'.$lang_admin_index['Zend Optimizer link'].'">'.$lang_admin_index['Zend Optimizer'].'</a>';
     110else if (ini_get('eaccelerator.enable'))
     111        $php_accelerator = '<a href="http://'.$lang_admin_index['eAccelerator link'].'">'.$lang_admin_index['eAccelerator'].'</a>';
     112else if (ini_get('xcache.cacher'))
     113        $php_accelerator = '<a href="http://'.$lang_admin_index['XCache link'].'">'.$lang_admin_index['XCache'].'</a>';
    168114else
    169         $php_accelerator = 'N/A';
     115        $php_accelerator = $lang_admin_index['NA'];
    170116
    171117
    172 $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin';
     118$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Index']);
     119define('PUN_ACTIVE_PAGE', 'admin');
    173120require PUN_ROOT.'header.php';
    174121
     
    177124?>
    178125        <div class="block">
    179                 <h2>Administration Forum</h2>
     126                <h2><span><?php echo $lang_admin_index['Forum admin head'] ?></span></h2>
    180127                <div id="adintro" class="box">
    181128                        <div class="inbox">
    182                                 <p>Bienvenue sur le panneau de contrÃŽles de  PunBB. Depuis cet espace vous pouvez contrÃŽler les points essentiels de votre forum. Selon que vous êtes un administrateur ou un modérateur vous pouvez&#160;:<br /><br />
    183                                         &#160;- organiser les catégories et les forums.<br />
    184                                         &#160;- régler les principales options et préférences.<br />
    185                                         &#160;- contrÃŽler les permissions pour les utilisateurs et les visiteurs.<br />
    186                                         &#160;- voir les statistiques des IP pour les utilisateurs.<br />
    187                                         &#160;- bannir des utilisateurs.<br />
    188                                         &#160;- censurer des mots.<br />
    189                                         &#160;- régler les rangs des utilisateurs.<br />
    190                                         &#160;- élaguer les anciens messages.<br />
    191                                         &#160;- traiter les messages signalés.
    192                                 </p>
     129                                <p><?php echo $lang_admin_index['Welcome to admin'] ?></p>
     130                                <ul>
     131                                        <li><span><?php echo $lang_admin_index['Welcome 1'] ?></span></li>
     132                                        <li><span><?php echo $lang_admin_index['Welcome 2'] ?></span></li>
     133                                        <li><span><?php echo $lang_admin_index['Welcome 3'] ?></span></li>
     134                                        <li><span><?php echo $lang_admin_index['Welcome 4'] ?></span></li>
     135                                        <li><span><?php echo $lang_admin_index['Welcome 5'] ?></span></li>
     136                                        <li><span><?php echo $lang_admin_index['Welcome 6'] ?></span></li>
     137                                        <li><span><?php echo $lang_admin_index['Welcome 7'] ?></span></li>
     138                                        <li><span><?php echo $lang_admin_index['Welcome 8'] ?></span></li>
     139                                        <li><span><?php echo $lang_admin_index['Welcome 9'] ?></span></li>
     140                                </ul>
    193141                        </div>
    194142                </div>
    195143
    196                 <h2 class="block2"><span>Statistiques</span></h2>
     144                <h2 class="block2"><span><?php echo $lang_admin_index['Statistics head'] ?></span></h2>
    197145                <div id="adstats" class="box">
    198146                        <div class="inbox">
    199147                                <dl>
    200                                         <dt>PunBB version</dt>
     148                                        <dt><?php echo $lang_admin_index['FluxBB version label'] ?></dt>
    201149                                        <dd>
    202                                                 PunBB version française <?php echo $pun_config['o_cur_version_fr'] ?> basée sur PunBB <?php echo $pun_config['o_cur_version'] ?><br />
    203                                                 <a href="admin_index.php?action=check_upgrade">Vérifier la version officielle</a> - <a href="admin_index.php?action=check_upgrade_fr">Vérifier la version française</a> <br />
    204                                                 &copy; Copyright 2002, 2003, 2004, 2005 Rickard Andersson
     150                                                <?php printf($lang_admin_index['FluxBB version data']."\n", $pun_config['o_cur_version'], '<a href="admin_index.php?action=check_upgrade">'.$lang_admin_index['Check for upgrade'].'</a>') ?>
    205151                                        </dd>
    206                                         <dt>Exécution serveur</dt>
     152                                        <dt><?php echo $lang_admin_index['Server load label'] ?></dt>
    207153                                        <dd>
    208                                                 <?php echo $server_load ?> (<?php echo $num_online ?> utilisateurs en ligne)
     154                                                <?php printf($lang_admin_index['Server load data']."\n", $server_load, $num_online) ?>
    209155                                        </dd>
    210 <?php if ($pun_user['g_id'] == PUN_ADMIN): ?>                                   <dt>Environnement</dt>
     156<?php if ($pun_user['g_id'] == PUN_ADMIN): ?>                                   <dt><?php echo $lang_admin_index['Environment label'] ?></dt>
    211157                                        <dd>
    212                                                 SystÚme d'exploitation&#160;: <?php echo PHP_OS ?><br />
    213                                                 PHP&#160;: <?php echo phpversion() ?> - <a href="admin_index.php?action=phpinfo">Afficher infos</a><br />
    214                                                 Accélérateur PHP&#160;: <?php echo $php_accelerator."\n" ?>
     158                                                <?php printf($lang_admin_index['Environment data OS'], PHP_OS) ?><br />
     159                                                <?php printf($lang_admin_index['Environment data version'], phpversion(), '<a href="admin_index.php?action=phpinfo">'.$lang_admin_index['Show info'].'</a>') ?><br />
     160                                                <?php printf($lang_admin_index['Environment data acc']."\n", $php_accelerator) ?>
    215161                                        </dd>
    216                                         <dt>Base de données</dt>
     162                                        <dt><?php echo $lang_admin_index['Database label'] ?></dt>
    217163                                        <dd>
    218                                                 <?php echo $db_version."\n" ?>
    219 <?php if (isset($total_records) && isset($total_size)): ?>                                              <br />Lignes&#160;: <?php echo $total_records."\n" ?>
    220                                                 <br />Taille&#160;: <?php echo $total_size."\n" ?>
    221 <?php endif; endif; ?>                                  </dd>
     164                                                <?php echo implode(' ', $db->get_version())."\n" ?>
     165<?php if (isset($total_records) && isset($total_size)): ?>                                              <br /><?php printf($lang_admin_index['Database data rows']."\n", forum_number_format($total_records)) ?>
     166                                                <br /><?php printf($lang_admin_index['Database data size']."\n", $total_size) ?>
     167<?php endif; ?>                                 </dd>
     168<?php endif; ?>
    222169                                </dl>
    223170                        </div>
Note: See TracChangeset for help on using the changeset viewer.