X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fvalidations.inc.php;h=aeb8b4b36be5d29f56c738f24b3ff0ef798ed615;hb=1e33266a2f91e1af7a5cb3e8fbbc1c49ff9341f3;hp=858ea991cc08599dd0c705d87b42554a9769e0df;hpb=20d7932b9db32f4dbf96312efc1981a5bebd9b7d;p=platal.git diff --git a/include/validations.inc.php b/include/validations.inc.php index 858ea99..aeb8b4b 100644 --- a/include/validations.inc.php +++ b/include/validations.inc.php @@ -21,7 +21,7 @@ define('SIZE_MAX', 32768); -__autoload('XDB'); +require_once dirname(__FILE__) . '/../classes/xdb.php'; /** * Iterator class, that lists objects through the database @@ -62,6 +62,7 @@ class Validate var $prenom; var $nom; var $promo; + var $sexe; var $bestalias; var $forlife; @@ -90,12 +91,12 @@ class Validate $this->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(); } // }}} @@ -181,8 +182,7 @@ class Validate // 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 +232,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"; @@ -267,7 +266,7 @@ class Validate * XXX fonction "statique" XXX * à utiliser uniquement pour récupérer un objet dans la BD avec Validate::get_typed_request(...) */ - function get_typed_request($uid, $type, $stamp = -1) + static function get_typed_request($uid, $type, $stamp = -1) { if ($stamp == -1) { $res = XDB::query('SELECT data FROM requests WHERE user_id={?} and type={?}', $uid, $type);