diff --git a/onyx/include/common/Team.class.php b/onyx/include/common/Team.class.php index 18e615c6..d9b3a966 100644 --- a/onyx/include/common/Team.class.php +++ b/onyx/include/common/Team.class.php @@ -35,6 +35,7 @@ class Team var $slogan; var $members = array(); var $points = null; + var $revoked = 0; // Constructor function Team ($id=null) @@ -42,7 +43,8 @@ class Team if (!empty($id)) { $db = new BDD(); - $res = $db->unique_query("SELECT `id`, `team_name`, `key_hash`, `slogan`, `auth_level` + $res = $db->unique_query("SELECT `id`, `team_name`, `key_hash`, `slogan`, + `auth_level`, `revoked` FROM teams WHERE id = ".intval($id)) or die($db->erreur()); if (!empty($res)) @@ -52,6 +54,7 @@ class Team $this->key_hash = $res['key_hash']; $this->slogan = $res['slogan']; $this->auth_level = $res['auth_level']; + $this->revoked = $res['revoked']; } $db->deconnexion(); } @@ -64,6 +67,7 @@ class Team $auth_level = intval($this->auth_level); $slogan = $this->slogan; $team_name = $this->team_name; + $revoked = $this->revoked; $db = new BDD(); $db->escape($key_hash); @@ -73,14 +77,17 @@ class Team if (empty($this->id)) { $db->query("INSERT INTO teams - VALUES (NULL, '".$team_name."', '".$key_hash."', ".$auth_level.", '".$slogan."')"); + VALUES (NULL, '".$team_name."', '".$key_hash."', ".$auth_level.", '". + $slogan."', ".$revoked.")"); $this->id = $db->insert_id(); $aff = ($this->id > 0); } else { $db->query("UPDATE teams - SET team_name = '".$team_name."', auth_level = ".$auth_level.", key_hash = '".$key_hash."', slogan = '".$slogan."' + SET team_name = '".$team_name."', auth_level = ".$auth_level. + ", key_hash = '".$key_hash."', slogan = '". + $slogan."', ".intval($revoked)." WHERE id = ".intval($this->id)); $aff = $db->affected(); } @@ -118,6 +125,10 @@ class Team return $this->auth_level; } + function get_revoked() { + return $this->revoked; + } + function get_members() { if(count($this->members) == 0) @@ -225,6 +236,16 @@ class Team } // Static methods + public static function set_revoked($bool, $name) + { + $db = new BDD(); + $db->query("UPDATE teams SET revoked = ".intval($bool)." WHERE team_name = '".$name."'"); + $aff = $db->affected(); + $db->deconnexion(); + + return ($aff == 1); + } + public static function get_teams() { $db = new BDD();