2006 => 2007 Happy New Year\!
[platal.git] / include / validations.inc.php
index bc88ddf..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,12 +178,14 @@ 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
             global $globals;
-            require_once('diogenes/diogenes.hermes.inc.php');
-            $mailer = new HermesMailer;
+            $mailer = new PlMailer;
             $mailer->setSubject("Commentaires de validation {$this->type}");
             $mailer->setFrom("validation+{$this->type}@{$globals->mail->domain}");
             $mailer->addTo("hotliners@staff.polytechnique.org");
@@ -233,8 +235,7 @@ class Validate
     function sendmail($isok)
     {
         global $globals;
-        require_once('diogenes/diogenes.hermes.inc.php');
-        $mailer = new HermesMailer;
+        $mailer = new PlMailer();
         $mailer->setSubject($this->_mail_subj());
         $mailer->setFrom("validation+{$this->type}@{$globals->mail->domain}");
         $mailer->addTo("\"{$this->prenom} {$this->nom}\" <{$this->bestalias}@{$globals->mail->domain}>");
@@ -284,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)