Index: trunk/web/punbb/admin_ranks.php
===================================================================
--- trunk/web/punbb/admin_ranks.php	(revision 10)
+++ trunk/web/punbb/admin_ranks.php	(revision 1)
@@ -1,23 +1,38 @@
 <?php
+/***********************************************************************
 
-/**
- * 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
- */
+  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
+
+************************************************************************/
+
 
 // Tell header.php to use the admin template
 define('PUN_ADMIN_CONSOLE', 1);
 
-define('PUN_ROOT', dirname(__FILE__).'/');
+define('PUN_ROOT', './');
 require PUN_ROOT.'include/common.php';
 require PUN_ROOT.'include/common_admin.php';
 
 
-if ($pun_user['g_id'] != PUN_ADMIN)
+if ($pun_user['g_id'] > PUN_ADMIN)
 	message($lang_common['No permission']);
 
-// Load the admin_ranks.php language file
-require PUN_ROOT.'lang/'.$admin_language.'/admin_ranks.php';
 
 // Add a rank
@@ -26,27 +41,25 @@
 	confirm_referrer('admin_ranks.php');
 
-	$rank = pun_trim($_POST['new_rank']);
-	$min_posts = trim($_POST['new_min_posts']);
+	$rank = trim($_POST['new_rank']);
+	$min_posts = $_POST['new_min_posts'];
 
 	if ($rank == '')
-		message($lang_admin_ranks['Must enter title message']);
+		message('Vous devez saisir un titre au rang.');
 
-	if ($min_posts == '' || preg_match('%[^0-9]%', $min_posts))
-		message($lang_admin_ranks['Must be integer message']);
+	if (!preg_match('#^\d+$#', $min_posts))
+		message('Le nombre minimum de messages doit Ãªtre un entier positif.');
 
 	// Make sure there isn't already a rank with the same min_posts value
 	$result = $db->query('SELECT 1 FROM '.$db->prefix.'ranks WHERE min_posts='.$min_posts) or error('Unable to fetch rank info', __FILE__, __LINE__, $db->error());
 	if ($db->num_rows($result))
-		message(sprintf($lang_admin_ranks['Dupe min posts message'], $min_posts));
+		message('Il y a dÃ©jÃ  un rang avec un nombre minimum de '.$min_posts.'messages.');
 
-	$db->query('INSERT INTO '.$db->prefix.'ranks (rank, min_posts) VALUES(\''.$db->escape($rank).'\', '.$min_posts.')') or error('Unable to add rank', __FILE__, __LINE__, $db->error());
+	$db->query('INSERT INTO '.$db->prefix.'ranks (rank, min_posts) VALUES(\''.$db->escape($rank).'\', '.$min_posts.')') or error('Impossible d\'ajouter le rang', __FILE__, __LINE__, $db->error());
 
 	// Regenerate the ranks cache
-	if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
-		require PUN_ROOT.'include/cache.php';
-
+	require_once PUN_ROOT.'include/cache.php';
 	generate_ranks_cache();
 
-	redirect('admin_ranks.php', $lang_admin_ranks['Rank added redirect']);
+	redirect('admin_ranks.php', 'Rang ajoutÃ©. Redirection ...');
 }
 
@@ -59,27 +72,25 @@
 	$id = intval(key($_POST['update']));
 
-	$rank = pun_trim($_POST['rank'][$id]);
+	$rank = trim($_POST['rank'][$id]);
 	$min_posts = trim($_POST['min_posts'][$id]);
 
 	if ($rank == '')
-		message($lang_admin_ranks['Must enter title message']);
+		message('You must enter a rank title.');
 
-	if ($min_posts == '' || preg_match('%[^0-9]%', $min_posts))
-		message($lang_admin_ranks['Must be integer message']);
+	if (!preg_match('#^\d+$#', $min_posts))
+		message('Le nombre minimum de messages doit Ãªtre un entier positif.');
 
 	// Make sure there isn't already a rank with the same min_posts value
-	$result = $db->query('SELECT 1 FROM '.$db->prefix.'ranks WHERE id!='.$id.' AND min_posts='.$min_posts) or error('Unable to fetch rank info', __FILE__, __LINE__, $db->error());
+	$result = $db->query('SELECT 1 FROM '.$db->prefix.'ranks WHERE id!='.$id.' && min_posts='.$min_posts) or error('Impossible de retrouver les informations des rangs', __FILE__, __LINE__, $db->error());
 	if ($db->num_rows($result))
-		message(sprintf($lang_admin_ranks['Dupe min posts message'], $min_posts));
+		message('Il y a dÃ©jÃ  un rang avec un nombre minimum de '.$min_posts.' messages.');
 
-	$db->query('UPDATE '.$db->prefix.'ranks SET rank=\''.$db->escape($rank).'\', min_posts='.$min_posts.' WHERE id='.$id) or error('Unable to update rank', __FILE__, __LINE__, $db->error());
+	$db->query('UPDATE '.$db->prefix.'ranks SET rank=\''.$db->escape($rank).'\', min_posts='.$min_posts.' WHERE id='.$id) or error('Impossible de modifier les rangs', __FILE__, __LINE__, $db->error());
 
 	// Regenerate the ranks cache
-	if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
-		require PUN_ROOT.'include/cache.php';
-
+	require_once PUN_ROOT.'include/cache.php';
 	generate_ranks_cache();
 
-	redirect('admin_ranks.php', $lang_admin_ranks['Rank updated redirect']);
+	redirect('admin_ranks.php', 'Rangs modifiÃ©s. Redirection ...');
 }
 
@@ -92,18 +103,16 @@
 	$id = intval(key($_POST['remove']));
 
-	$db->query('DELETE FROM '.$db->prefix.'ranks WHERE id='.$id) or error('Unable to delete rank', __FILE__, __LINE__, $db->error());
+	$db->query('DELETE FROM '.$db->prefix.'ranks WHERE id='.$id) or error('Impossible de supprimer le rang', __FILE__, __LINE__, $db->error());
 
 	// Regenerate the ranks cache
-	if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
-		require PUN_ROOT.'include/cache.php';
-
+	require_once PUN_ROOT.'include/cache.php';
 	generate_ranks_cache();
 
-	redirect('admin_ranks.php', $lang_admin_ranks['Rank removed redirect']);
+	redirect('admin_ranks.php', 'Rang supprimÃ©. Redirection ...');
 }
 
-$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Ranks']);
+
+$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Rangs';
 $focus_element = array('ranks', 'new_rank');
-define('PUN_ACTIVE_PAGE', 'admin');
 require PUN_ROOT.'header.php';
 
@@ -112,25 +121,25 @@
 ?>
 	<div class="blockform">
-		<h2><span><?php echo $lang_admin_ranks['Ranks head'] ?></span></h2>
+		<h2><span>Rangs</span></h2>
 		<div class="box">
-			<form id="ranks" method="post" action="admin_ranks.php">
+			<form id="ranks" method="post" action="admin_ranks.php?action=foo">
 				<div class="inform">
 					<fieldset>
-						<legend><?php echo $lang_admin_ranks['Add rank subhead'] ?></legend>
+						<legend>Ajouter un rang</legend>
 						<div class="infldset">
-							<p><?php echo $lang_admin_ranks['Add rank info'].' '.($pun_config['o_ranks'] == '1' ? sprintf($lang_admin_ranks['Ranks enabled'], '<a href="admin_options.php#ranks">'.$lang_admin_common['Options'].'</a>') : sprintf($lang_admin_ranks['Ranks disabled'], '<a href="admin_options.php#ranks">'.$lang_admin_common['Options'].'</a>')) ?></p>
-							<table cellspacing="0">
+							<p>Saisissez un titre de rang et un nombre minimum de messages que l'utilisateur devra atteindre afin d'obtenir ce rang. Plusieurs rangs ne peuvent avoir le mÃªme nombre minimum de messages. Si un titre est donnÃ© Ã  un utilisateur, le titre sera affichÃ© Ã  la place du rang. <strong>Les rangs utilisateurs doivent Ãªtres activÃ©s Ã  la page <a href="admin_options.php#ranks">Options</a> pour qu'ils aient un quelconque effet.</strong></p>
+							<table  cellspacing="0">
 							<thead>
 								<tr>
-									<th class="tcl" scope="col"><?php echo $lang_admin_ranks['Rank title label'] ?></th>
-									<th class="tc2" scope="col"><?php echo $lang_admin_ranks['Minimum posts label'] ?></th>
-									<th class="hidehead" scope="col"><?php echo $lang_admin_ranks['Actions label'] ?></th>
+									<th class="tcl" scope="col">Titre du rang</th>
+									<th class="tc2" scope="col">Nombre minimum de messages</th>
+									<th class="hidehead" scope="col">Action</th>
 								</tr>
 							</thead>
 							<tbody>
 								<tr>
-									<td class="tcl"><input type="text" name="new_rank" size="24" maxlength="50" tabindex="1" /></td>
-									<td class="tc2"><input type="text" name="new_min_posts" size="7" maxlength="7" tabindex="2" /></td>
-									<td><input type="submit" name="add_rank" value="<?php echo $lang_admin_common['Add'] ?>" tabindex="3" /></td>
+									<td><input type="text" name="new_rank" size="24" maxlength="50" tabindex="1" /></td>
+									<td><input type="text" name="new_min_posts" size="7" maxlength="7" tabindex="2" /></td>
+									<td><input type="submit" name="add_rank" value=" Ajouter " tabindex="3" /></td>
 								</tr>
 							</tbody>
@@ -141,19 +150,19 @@
 				<div class="inform">
 					<fieldset>
-						<legend><?php echo $lang_admin_ranks['Edit remove subhead'] ?></legend>
+						<legend>Modifier/supprimer les rangs</legend>
 						<div class="infldset">
 <?php
 
-$result = $db->query('SELECT id, rank, min_posts FROM '.$db->prefix.'ranks ORDER BY min_posts') or error('Unable to fetch rank list', __FILE__, __LINE__, $db->error());
+$result = $db->query('SELECT id, rank, min_posts FROM '.$db->prefix.'ranks ORDER BY min_posts') or error('Impossible de retrouver la liste des rangs', __FILE__, __LINE__, $db->error());
 if ($db->num_rows($result))
 {
 
 ?>
-							<table cellspacing="0">
+							<table  cellspacing="0">
 							<thead>
 								<tr>
-									<th class="tcl" scope="col"><?php echo $lang_admin_ranks['Rank title label'] ?></th>
-									<th class="tc2" scope="col"><?php echo $lang_admin_ranks['Minimum posts label'] ?></th>
-									<th class="hidehead" scope="col"><?php echo $lang_admin_ranks['Actions label'] ?></th>
+									<th class="tcl" scope="col"><strong>Titre du rang</strong></th>
+									<th class="tc2" scope="col"><strong>Nombre minimum de messages</strong></th>
+									<th class="hidehead" scope="col">Actions</th>
 								</tr>
 							</thead>
@@ -162,5 +171,5 @@
 
 	while ($cur_rank = $db->fetch_assoc($result))
-		echo "\t\t\t\t\t\t\t\t".'<tr><td class="tcl"><input type="text" name="rank['.$cur_rank['id'].']" value="'.pun_htmlspecialchars($cur_rank['rank']).'" size="24" maxlength="50" /></td><td class="tc2"><input type="text" name="min_posts['.$cur_rank['id'].']" value="'.$cur_rank['min_posts'].'" size="7" maxlength="7" /></td><td><input type="submit" name="update['.$cur_rank['id'].']" value="'.$lang_admin_common['Update'].'" />&#160;<input type="submit" name="remove['.$cur_rank['id'].']" value="'.$lang_admin_common['Remove'].'" /></td></tr>'."\n";
+		echo "\t\t\t\t\t\t\t\t".'<tr><td><input type="text" name="rank['.$cur_rank['id'].']" value="'.pun_htmlspecialchars($cur_rank['rank']).'" size="24" maxlength="50" /></td><td><input type="text" name="min_posts['.$cur_rank['id'].']" value="'.$cur_rank['min_posts'].'" size="7" maxlength="7" /></td><td><input type="submit" name="update['.$cur_rank['id'].']" value="Modifier" />&#160;<input type="submit" name="remove['.$cur_rank['id'].']" value="Supprimer" /></td></tr>'."\n";
 
 ?>
@@ -171,5 +180,5 @@
 }
 else
-	echo "\t\t\t\t\t\t\t".'<p>'.$lang_admin_ranks['No ranks in list'].'</p>'."\n";
+	echo "\t\t\t\t\t\t\t".'<p>Aucun rang dans la liste.</p>'."\n";
 
 ?>
