Add a default identity when using banana to send a message on a ML
[platal.git] / include / validations.inc.php
index aeb8b4b..b00fef3 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2006 Polytechnique.org                              *
+ *  Copyright (C) 2003-2007 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -178,6 +178,9 @@ class Validate
                     return true;
                 }
             }
+            if (!strlen(trim(Env::v('comm')))) {
+                return true;
+            }
             $this->comments[] = Array(S::v('bestalias'), Env::v('comm'), $formid);
 
             // envoi d'un mail à hotliners
@@ -282,6 +285,21 @@ class Validate
     }
 
     // }}}
+    // {{{ function get_typed_requests()
+
+    /** same as get_typed_request() but return an array of objects
+     */
+    static function get_typed_requests($uid, $type)
+    {
+        $res = XDB::iterRow('SELECT data FROM requests WHERE user_id={?} and type={?}', $uid, $type);
+        $array = array();
+        while (list($data) = $res->next()) {
+            $array[] = unserialize($data);
+        }
+        return $array;
+    }
+
+    // }}}
     // {{{ function _mail_body
 
     function _mail_body($isok)