MOD #134
[cl7.git] / php / controller.php
index f3fd468..41381ac 100644 (file)
@@ -48,7 +48,7 @@ class Controller
                array(
                   $id,
                   $_POST['pseudo'],
-                  $_POST['pass1'],
+                  sha1($_POST['pass1']),
                   $_POST['clan_nom'],
                   $_POST['clan_tag'],
                   $_POST['nom'],
@@ -78,7 +78,7 @@ class Controller
          {
             pg_query("BEGIN");
             pg_query_params("UPDATE participants SET pseudo = $1 WHERE id = $2", array($_POST['pseudo'], $this->participant->info->id));
-            pg_query_params("UPDATE participants SET password = $1 WHERE id = $2", array($_POST['pass1'], $this->participant->info->id));
+            pg_query_params("UPDATE participants SET password = $1 WHERE id = $2", array(sha1($_POST['pass1']), $this->participant->info->id));
             pg_query_params("UPDATE participants SET clan_nom = $1 WHERE id = $2", array($_POST['clan_nom'], $this->participant->info->id));
             pg_query_params("UPDATE participants SET clan_tag = $1 WHERE id = $2", array($_POST['clan_tag'], $this->participant->info->id));
             pg_query_params("UPDATE participants SET nom = $1 WHERE id = $2", array($_POST['nom'], $this->participant->info->id));
@@ -96,7 +96,7 @@ class Controller
          }
       }
       # vote pour des jeux (autorisé même lorsque les inscriptions sont terminées)
-      else if (isset($_POST['set_jeux_joues']) && $this->participant->existe())
+      else if (isset($_POST['set_jeux_joues']) && $this->participant->existe() && !$config->get("inscription_terminees"))
       {
          $votes = $_POST['votes'];
          if (!$votes)
@@ -121,7 +121,8 @@ class Controller
                pg_query("BEGIN");
                $res = pg_query_params("SELECT id FROM jeux WHERE nom = $1", array($jeu));
                if ($id = pg_fetch_object($res))
-                  array_unshift($votes, $id->id);
+                  if (!in_array($id->id, $votes))
+                     array_unshift($votes, $id->id);  
             }
          }