Avoid comment duplication when reloading the page
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Mon, 31 Jul 2006 14:27:59 +0000 (14:27 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Mon, 31 Jul 2006 14:27:59 +0000 (14:27 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@747 839d8a87-29fc-0310-9880-83ba4fa771e5

include/validations.inc.php
templates/admin/valider.tpl

index 9de580f..514776e 100644 (file)
@@ -158,7 +158,13 @@ class Validate
 
         // ajout d'un commentaire
         if (Env::has('hold') && Env::has('comm')) {
-            $this->comments[] = Array(S::v('bestalias'), Env::v('comm'));
+            $formid = Env::i('formid');
+            foreach ($this->comments as $comment) {
+                if ($comment[2] === $formid) {
+                    return true;
+                }
+            }
+            $this->comments[] = Array(S::v('bestalias'), Env::v('comm'), $formid);
 
             // envoi d'un mail à hotliners
             global $globals;
index 3e748f1..7dbd1eb 100644 (file)
@@ -66,6 +66,7 @@
           <input type="hidden" name="uid"    value="{$valid->uid}" />
           <input type="hidden" name="type"   value="{$valid->type}" />
           <input type="hidden" name="stamp"  value="{$valid->stamp}" />
+          <input type="hidden" name="formid" value="{0|rand:65535}" />
           <textarea rows="3" cols="50" name="comm"></textarea>
           <br />
           <input type="submit" name="hold"   value="Commenter" />