warning = $warning; parent::__construct($_user, true, $this->title()); $this->refuse = false; $this->loginbis = $_loginbis; } // }}} // {{{ title() private function title() { return ($this->warning ? 'alerte alias' : 'robot répondeur'); } // }}} // {{{ function formu() public function formu() { return 'include/form.valid.homonymes.tpl'; } // }}} // {{{ function _mail_subj protected function _mail_subj() { return "[Polytechnique.org/Support] " . ($this->warning ? "Dans une semaine : suppression de l'alias " : "Mise en place du robot") . " $loginbis@" . $this->user->mainEmailDomain(); } // }}} // {{{ function _mail_body protected function _mail_body($isok) { return " Comme nous t'en avons informé par email il y a quelques temps, pour respecter nos engagements en terme d'adresses email devinables, tu te verras bientôt retirer l'alias " . $this->loginbis . "@" . $this->user->mainEmailDomain() . " pour ne garder que " . $this->user->forlifeEmail() . ". Toute personne qui écrira à " . $this->loginbis . "@" . $this->user->mainEmailDomain() . " recevra la réponse d'un robot qui l'informera que " . $this->loginbis . "@" . $this->user->mainEmailDomain() . " est ambigu pour des raisons d'homonymie et signalera ton email exact."; } // }}} // {{{ function sendmail() protected function sendmail($isok) { if (!$isok) return false; global $globals; $mailer = new PlMailer; $cc = "support+homonyme@" . $globals->mail->domain; $from = "\"Support Polytechnique.org\" <$cc>"; $mailer->setSubject($this->_mail_subj()); $mailer->setFrom($from); $mailer->addTo("\"{$this->user->fullName()}\" <{$this->user->bestEmail()}>"); $mailer->addCc($cc); $body = $this->user->displayName() . ",\n\n" . $this->_mail_body($isok) . (Env::has('comm') ? "\n\n".Env::v('comm') : '') . "\n\nCordialement,\n\n-- \nL'équipe de Polytechnique.org\n"; $mailer->setTxtBody(wordwrap($body)); $mailer->send(); } // }}} // {{{ function commit() public function commit() { Platal::load('admin', 'homonyms.inc.php'); if (!$this->warning) { require_once 'emails.inc.php'; XDB::execute('DELETE FROM email_source_account WHERE email = {?} AND type = \'alias\'', $this->loginbis); XDB::execute('INSERT INTO email_source_other (hrmid, email, domain, type, expire) SELECT {?}, {?}, id, \'homonym\', NOW() FROM email_virtual_domains WHERE name = {?}', User::makeHomonymHrmid($this->loginbis), $this->loginbis, $this->user->mainEmailDomain()); fix_bestalias($this->user); } return true; } // }}} } // }}} // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?>