Index: branches/rsr.v5.1.dev/web/punbb/admin_index.php
===================================================================
--- branches/rsr.v5.1.dev/web/punbb/admin_index.php	(revision 1)
+++ branches/rsr.v5.1.dev/web/punbb/admin_index.php	(revision 3)
@@ -1,38 +1,23 @@
 <?php
-/***********************************************************************
 
-  Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)
-
-  This file is part of PunBB.
-
-  PunBB is free software; you can redistribute it and/or modify it
-  under the terms of the GNU General Public License as published
-  by the Free Software Foundation; either version 2 of the License,
-  or (at your option) any later version.
-
-  PunBB is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-  MA  02111-1307  USA
-
-************************************************************************/
-
+/**
+ * Copyright (C) 2008-2011 FluxBB
+ * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
+ * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
+ */
 
 // Tell header.php to use the admin template
 define('PUN_ADMIN_CONSOLE', 1);
 
-define('PUN_ROOT', './');
+define('PUN_ROOT', dirname(__FILE__).'/');
 require PUN_ROOT.'include/common.php';
 require PUN_ROOT.'include/common_admin.php';
 
 
-if ($pun_user['g_id'] > PUN_MOD)
+if (!$pun_user['is_admmod'])
 	message($lang_common['No permission']);
 
+// Load the admin_index.php language file
+require PUN_ROOT.'lang/'.$admin_language.'/admin_index.php';
 
 $action = isset($_GET['action']) ? $_GET['action'] : null;
@@ -42,48 +27,14 @@
 {
 	if (!ini_get('allow_url_fopen'))
-		message('Impossible de vÃ©rifier les mises Ã  jour tant que \'allow_url_fopen\' est dÃ©sactivÃ© sur ce systÃšme.');
+		message($lang_admin_index['fopen disabled message']);
 
-	$fp = @fopen('http://www.punbb.org/latest_version', 'r');
-	$latest_version = trim(@fread($fp, 16));
-	@fclose($fp);
+	$latest_version = trim(@file_get_contents('http://fluxbb.org/latest_version'));
+	if (empty($latest_version))
+		message($lang_admin_index['Upgrade check failed message']);
 
-	if ($latest_version == '')
-		message('La vÃ©rification de mise Ã  jour a Ã©chouÃ©e pour une raison inconnue.');
-
-	$cur_version = str_replace(array('.', 'dev', 'beta', ' '), '', strtolower($pun_config['o_cur_version']));
-	$cur_version = (strlen($cur_version) == 2) ? intval($cur_version) * 10 : intval($cur_version);
-
-	$latest_version = str_replace('.', '', strtolower($latest_version));
-	$latest_version = (strlen($latest_version) == 2) ? intval($latest_version) * 10 : intval($latest_version);
-
-	if ($cur_version >= $latest_version)
-		message('Vous utilisez la derniÃšre version de PunBB.');
+	if (version_compare($pun_config['o_cur_version'], $latest_version, '>='))
+		message($lang_admin_index['Running latest version message']);
 	else
-		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>.');
-}
-
-// Check for french upgrade
-if ($action == 'check_upgrade_fr')
-{
-	if (!ini_get('allow_url_fopen'))
-		message('Impossible de vÃ©rifier les mises Ã  jour tant que \'allow_url_fopen\' est dÃ©sactivÃ© sur ce systÃšme.');
-
-	$fp = @fopen('http://www.punbb.fr/latest_version', 'r');
-	$latest_version = trim(@fread($fp, 16));
-	@fclose($fp);
-
-	if ($latest_version == '')
-		message('La vÃ©rification de mise Ã  jour a Ã©chouÃ©e pour une raison inconnue.');
-
-	$cur_version = str_replace(array('.', 'dev', 'beta', ' '), '', strtolower($pun_config['o_cur_version_fr']));
-	$cur_version = (strlen($cur_version) == 2) ? intval($cur_version) * 10 : intval($cur_version);
-
-	$latest_version = str_replace('.', '', strtolower($latest_version));
-	$latest_version = (strlen($latest_version) == 2) ? intval($latest_version) * 10 : intval($latest_version);
-
-	if ($cur_version >= $latest_version)
-		message('Vous utilisez la derniÃšre version de PunBB en franÃ§ais.');
-	else
-		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>.');
+		message(sprintf($lang_admin_index['New version available message'], '<a href="http://fluxbb.org/">FluxBB.org</a>'));
 }
 
@@ -93,6 +44,6 @@
 {
 	// Is phpinfo() a disabled function?
-	if (strpos(strtolower((string)@ini_get('disable_functions')), 'phpinfo') !== false)
-		message('La fonction phpinfo() de PHP est dÃ©sactivÃ©e sur ce serveur.');
+	if (strpos(strtolower((string) ini_get('disable_functions')), 'phpinfo') !== false)
+		message($lang_admin_index['PHPinfo disabled message']);
 
 	phpinfo();
@@ -109,39 +60,31 @@
 	@fclose($fh);
 
+	if (($fh = @fopen('/proc/loadavg', 'r')))
+	{
+		$load_averages = fread($fh, 64);
+		fclose($fh);
+	}
+	else
+		$load_averages = '';
+
 	$load_averages = @explode(' ', $load_averages);
-	$server_load = isset($load_averages[2]) ? $load_averages[0].' '.$load_averages[1].' '.$load_averages[2] : 'Indisponible';
+	$server_load = isset($load_averages[2]) ? $load_averages[0].' '.$load_averages[1].' '.$load_averages[2] : $lang_admin_index['Not available'];
 }
-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))
+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))
 	$server_load = $load_averages[1].' '.$load_averages[2].' '.$load_averages[3];
 else
-	$server_load = 'Indisponible';
+	$server_load = $lang_admin_index['Not available'];
 
 
 // Get number of current visitors
-$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());
+$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());
 $num_online = $db->result($result);
 
 
-// Get the database system version
-switch ($db_type)
+// Collect some additional info about MySQL
+if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb')
 {
-	case 'sqlite':
-		$db_version = 'SQLite '.sqlite_libversion();
-		break;
-
-	default:
-		$result = $db->query('SELECT VERSION()') or error('Impossible de retrouver les informations utilisateurs', __FILE__, __LINE__, $db->error());
-		$db_version = $db->result($result);
-		break;
-}
-
-
-// Collect some additional info about MySQL
-if ($db_type == 'mysql' || $db_type == 'mysqli')
-{
-	$db_version = 'MySQL '.$db_version;
-
 	// Calculate total db size/row count
-	$result = $db->query('SHOW TABLE STATUS FROM `'.$db_name.'`') or error('Impossible de retrouver le statut des tables', __FILE__, __LINE__, $db->error());
+	$result = $db->query('SHOW TABLE STATUS LIKE \''.$db->prefix.'%\'') or error('Unable to fetch table status', __FILE__, __LINE__, $db->error());
 
 	$total_records = $total_size = 0;
@@ -152,23 +95,27 @@
 	}
 
-	$total_size = $total_size / 1024;
-
-	if ($total_size > 1024)
-		$total_size = round($total_size / 1024, 2).' MB';
-	else
-		$total_size = round($total_size, 2).' KB';
+	$total_size = file_size($total_size);
 }
 
 
-// See if MMCache or PHPA is loaded
+// Check for the existence of various PHP opcode caches/optimizers
 if (function_exists('mmcache'))
-	$php_accelerator = '<a href="http://turck-mmcache.sourceforge.net/">Turck MMCache</a>';
+	$php_accelerator = '<a href="http://'.$lang_admin_index['Turck MMCache link'].'">'.$lang_admin_index['Turck MMCache'].'</a>';
 else if (isset($_PHPA))
-	$php_accelerator = '<a href="http://www.php-accelerator.co.uk/">ionCube PHP Accelerator</a>';
+	$php_accelerator = '<a href="http://'.$lang_admin_index['ionCube PHP Accelerator link'].'">'.$lang_admin_index['ionCube PHP Accelerator'].'</a>';
+else if (ini_get('apc.enabled'))
+	$php_accelerator ='<a href="http://'.$lang_admin_index['Alternative PHP Cache (APC) link'].'">'.$lang_admin_index['Alternative PHP Cache (APC)'].'</a>';
+else if (ini_get('zend_optimizer.optimization_level'))
+	$php_accelerator = '<a href="http://'.$lang_admin_index['Zend Optimizer link'].'">'.$lang_admin_index['Zend Optimizer'].'</a>';
+else if (ini_get('eaccelerator.enable'))
+	$php_accelerator = '<a href="http://'.$lang_admin_index['eAccelerator link'].'">'.$lang_admin_index['eAccelerator'].'</a>';
+else if (ini_get('xcache.cacher'))
+	$php_accelerator = '<a href="http://'.$lang_admin_index['XCache link'].'">'.$lang_admin_index['XCache'].'</a>';
 else
-	$php_accelerator = 'N/A';
+	$php_accelerator = $lang_admin_index['NA'];
 
 
-$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin';
+$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Index']);
+define('PUN_ACTIVE_PAGE', 'admin');
 require PUN_ROOT.'header.php';
 
@@ -177,47 +124,47 @@
 ?>
 	<div class="block">
-		<h2>Administration Forum</h2>
+		<h2><span><?php echo $lang_admin_index['Forum admin head'] ?></span></h2>
 		<div id="adintro" class="box">
 			<div class="inbox">
-				<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 />
-					&#160;- organiser les catÃ©gories et les forums.<br />
-					&#160;- rÃ©gler les principales options et prÃ©fÃ©rences.<br />
-					&#160;- contrÃŽler les permissions pour les utilisateurs et les visiteurs.<br />
-					&#160;- voir les statistiques des IP pour les utilisateurs.<br />
-					&#160;- bannir des utilisateurs.<br />
-					&#160;- censurer des mots.<br />
-					&#160;- rÃ©gler les rangs des utilisateurs.<br />
-					&#160;- Ã©laguer les anciens messages.<br />
-					&#160;- traiter les messages signalÃ©s.
-				</p>
+				<p><?php echo $lang_admin_index['Welcome to admin'] ?></p>
+				<ul>
+					<li><span><?php echo $lang_admin_index['Welcome 1'] ?></span></li>
+					<li><span><?php echo $lang_admin_index['Welcome 2'] ?></span></li>
+					<li><span><?php echo $lang_admin_index['Welcome 3'] ?></span></li>
+					<li><span><?php echo $lang_admin_index['Welcome 4'] ?></span></li>
+					<li><span><?php echo $lang_admin_index['Welcome 5'] ?></span></li>
+					<li><span><?php echo $lang_admin_index['Welcome 6'] ?></span></li>
+					<li><span><?php echo $lang_admin_index['Welcome 7'] ?></span></li>
+					<li><span><?php echo $lang_admin_index['Welcome 8'] ?></span></li>
+					<li><span><?php echo $lang_admin_index['Welcome 9'] ?></span></li>
+				</ul>
 			</div>
 		</div>
 
-		<h2 class="block2"><span>Statistiques</span></h2>
+		<h2 class="block2"><span><?php echo $lang_admin_index['Statistics head'] ?></span></h2>
 		<div id="adstats" class="box">
 			<div class="inbox">
 				<dl>
-					<dt>PunBB version</dt>
+					<dt><?php echo $lang_admin_index['FluxBB version label'] ?></dt>
 					<dd>
-						PunBB version franÃ§aise <?php echo $pun_config['o_cur_version_fr'] ?> basÃ©e sur PunBB <?php echo $pun_config['o_cur_version'] ?><br />
-						<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 />
-						&copy; Copyright 2002, 2003, 2004, 2005 Rickard Andersson
+						<?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>') ?>
 					</dd>
-					<dt>ExÃ©cution serveur</dt>
+					<dt><?php echo $lang_admin_index['Server load label'] ?></dt>
 					<dd>
-						<?php echo $server_load ?> (<?php echo $num_online ?> utilisateurs en ligne)
+						<?php printf($lang_admin_index['Server load data']."\n", $server_load, $num_online) ?>
 					</dd>
-<?php if ($pun_user['g_id'] == PUN_ADMIN): ?>					<dt>Environnement</dt>
+<?php if ($pun_user['g_id'] == PUN_ADMIN): ?>					<dt><?php echo $lang_admin_index['Environment label'] ?></dt>
 					<dd>
-						SystÃšme d'exploitation&#160;: <?php echo PHP_OS ?><br />
-						PHP&#160;: <?php echo phpversion() ?> - <a href="admin_index.php?action=phpinfo">Afficher infos</a><br />
-						AccÃ©lÃ©rateur PHP&#160;: <?php echo $php_accelerator."\n" ?>
+						<?php printf($lang_admin_index['Environment data OS'], PHP_OS) ?><br />
+						<?php printf($lang_admin_index['Environment data version'], phpversion(), '<a href="admin_index.php?action=phpinfo">'.$lang_admin_index['Show info'].'</a>') ?><br />
+						<?php printf($lang_admin_index['Environment data acc']."\n", $php_accelerator) ?>
 					</dd>
-					<dt>Base de donnÃ©es</dt>
+					<dt><?php echo $lang_admin_index['Database label'] ?></dt>
 					<dd>
-						<?php echo $db_version."\n" ?>
-<?php if (isset($total_records) && isset($total_size)): ?>						<br />Lignes&#160;: <?php echo $total_records."\n" ?>
-						<br />Taille&#160;: <?php echo $total_size."\n" ?>
-<?php endif; endif; ?>					</dd>
+						<?php echo implode(' ', $db->get_version())."\n" ?>
+<?php if (isset($total_records) && isset($total_size)): ?>						<br /><?php printf($lang_admin_index['Database data rows']."\n", forum_number_format($total_records)) ?>
+						<br /><?php printf($lang_admin_index['Database data size']."\n", $total_size) ?>
+<?php endif; ?>					</dd>
+<?php endif; ?>
 				</dl>
 			</div>
