diff --git a/includes/config.example.php b/includes/config.example.php
index a24842a..4270d3f 100755
--- a/includes/config.example.php
+++ b/includes/config.example.php
@@ -46,20 +46,4 @@ $config['SQL_db'] = "postgres";
$config['admin_mail'] = "leo@lstronic.com";
$config['bot_mail'] = "robot@kabano.com";
-/*****
-** Locales configuration
-*****/
-
-$config['locales'] = array(
- "fr" => array("fr","fr_FR.UTF8","french","fr_FR","fr_FR.UTF-8", "Français")
- );
-$config['roles'] = array(
- 1000 => array(1000,"Administrateur", "red"),
- 800 => array(800,"Modérateur", "orangered"),
- 600 => array(600,"Membre premium", "orange"),
- 400 => array(400,"Utilisateur", "green"),
- 200 => array(200,"Membre archivé", "#aaa"),
- 0 => array(0,"Visiteur", "black")
- );
-
?>
\ No newline at end of file
diff --git a/models/d.users.php b/models/d.users.php
index ad52c02..8c78317 100755
--- a/models/d.users.php
+++ b/models/d.users.php
@@ -8,6 +8,15 @@
***********************************************************
**********************************************************/
+$ranks = array(
+ "administrator" => array(1000,"Administrateur", "red"),
+ "moderator" => array(800,"Modérateur", "orangered"),
+ "premium" => array(600,"Membre premium", "orange"),
+ "registered" => array(400,"Utilisateur", "green"),
+ "blocked" => array(200,"Membre archivé", "#aaa"),
+ "visitor" => array(0,"Visiteur", "black")
+);
+
class User
{
private $id = 0;
@@ -103,24 +112,9 @@ class User
return $this->id;
}
public function get_rank() {
- if( $this->rank == 'blocked' ) {
- return 'Membre bloqué';
- }
- else if( $this->rank == 'visitor' ) {
- return 'Visiteur';
- }
- else if( $this->rank == 'registered' ) {
- return 'Membre';
- }
- else if( $this->rank == 'premium' ) {
- return 'Membre premium';
- }
- else if( $this->rank == 'moderator' ) {
- return 'Modérateur';
- }
- else {
- return 'Administrateur';
- }
+ global $ranks;
+
+ return ''.$ranks[$this->rank][1].'';
}
public function get_avatar() {
if( $this->is_avatar_present == 't')
@@ -168,39 +162,9 @@ class User
** Returns true if user permissions are higher than $rank
*****/
public function rank_is_higher($rank) {
- if( $rank == 'blocked' ) {
- return true;
- }
- else if( $rank == 'visitor' ) {
- if( $this->rank == 'blocked' )
- return false;
- else
- return true;
- }
- else if( $rank == 'registered' ) {
- if( $this->rank == 'blocked' || $this->rank == 'visitor' )
- return false;
- else
- return true;
- }
- else if( $rank == 'premium' ) {
- if( $this->rank == 'premium' || $this->rank == 'moderator' || $this->rank == 'administrator' )
- return true;
- else
- return false;
- }
- else if( $rank == 'moderator' ) {
- if( $this->rank == 'moderator' || $this->rank == 'administrator' )
- return true;
- else
- return false;
- }
- else {
- if( $this->rank == 'administrator' )
- return true;
- else
- return false;
- }
+ global $ranks;
+
+ return $ranks[$this->rank][0] >= $ranks[$rank][0];
}
/*****