X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fvalidations.inc.php;h=b00fef36175a05380524b14dcd72592ef915a2ab;hb=5ddeb07cc787dd1dc3630a31f1528f5cc7c4d9b9;hp=6d42bc2162ca985d0fd9dbb124d73fd5dd6f5bb6;hpb=ae2b4eac2485973bf43ed8c131b87b0b81779656;p=platal.git diff --git a/include/validations.inc.php b/include/validations.inc.php index 6d42bc2..b00fef3 100644 --- a/include/validations.inc.php +++ b/include/validations.inc.php @@ -1,6 +1,6 @@ unique = $_unique; $this->type = $_type; $res = XDB::query( - "SELECT u.prenom, u.nom, u.promo, a.alias, b.alias + "SELECT u.prenom, u.nom, u.promo, FIND_IN_SET('femme', u.flags) AS sexe, a.alias, b.alias FROM auth_user_md5 AS u INNER JOIN aliases AS a ON ( u.user_id=a.id AND a.type='a_vie' ) INNER JOIN aliases AS b ON ( u.user_id=b.id AND b.type!='homonyme' AND FIND_IN_SET('bestalias', b.flags) ) WHERE u.user_id={?}", $_uid); - list($this->prenom, $this->nom, $this->promo, $this->forlife, $this->bestalias) = $res->fetchOneRow(); + list($this->prenom, $this->nom, $this->promo, $this->sexe, $this->forlife, $this->bestalias) = $res->fetchOneRow(); } // }}} @@ -177,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"); @@ -232,14 +235,13 @@ 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}>"); $mailer->addCc("validation+{$this->type}@{$globals->mail->domain}"); - $body = "Cher(e) camarade,\n\n" + $body = ($this->sexe ? "Chère camarade,\n\n" : "Cher camarade,\n\n") . $this->_mail_body($isok) . (Env::has('comm') ? "\n\n".Env::v('comm') : '') . "\n\nCordialement,\nL'équipe Polytechnique.org\n"; @@ -283,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)