Commit | Line | Data |
---|---|---|
0337d704 | 1 | <?php |
2 | /*************************************************************************** | |
12262f13 | 3 | * Copyright (C) 2003-2011 Polytechnique.org * |
0337d704 | 4 | * http://opensource.polytechnique.org/ * |
5 | * * | |
6 | * This program is free software; you can redistribute it and/or modify * | |
7 | * it under the terms of the GNU General Public License as published by * | |
8 | * the Free Software Foundation; either version 2 of the License, or * | |
9 | * (at your option) any later version. * | |
10 | * * | |
11 | * This program is distributed in the hope that it will be useful, * | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | |
14 | * GNU General Public License for more details. * | |
15 | * * | |
16 | * You should have received a copy of the GNU General Public License * | |
17 | * along with this program; if not, write to the Free Software * | |
18 | * Foundation, Inc., * | |
19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * | |
20 | ***************************************************************************/ | |
21 | ||
0337d704 | 22 | // {{{ class HomonymeReq |
23 | ||
24 | class HomonymeReq extends Validate | |
25 | { | |
26 | // {{{ properties | |
eaf30d86 | 27 | |
da2fff38 | 28 | public $email; |
d69d66e0 | 29 | public $homonymes_hruid; |
612a2d8a | 30 | public $warning = true; |
6e828e47 | 31 | public $rules = "Accepter, sauf cas particulier d'utilisateur dont l'homonymie est traité plus … manuellement."; |
0337d704 | 32 | |
33 | // }}} | |
34 | // {{{ constructor | |
eaf30d86 | 35 | |
da2fff38 | 36 | public function __construct(User $_user, $_email, $_homonymes_hruid, $warning = true) |
0337d704 | 37 | { |
0337d704 | 38 | $this->warning = $warning; |
39 | ||
5daf68f6 | 40 | parent::__construct($_user, true, $this->title()); |
0337d704 | 41 | |
42 | $this->refuse = false; | |
da2fff38 | 43 | $this->email = $_email; |
d69d66e0 | 44 | $this->homonymes_hruid = $_homonymes_hruid; |
0337d704 | 45 | } |
eaf30d86 | 46 | |
0337d704 | 47 | // }}} |
48 | // {{{ title() | |
eaf30d86 | 49 | |
612a2d8a | 50 | private function title() |
51 | { | |
5daf68f6 | 52 | return ($this->warning ? 'alerte alias' : 'robot répondeur'); |
0337d704 | 53 | } |
54 | ||
55 | // }}} | |
0337d704 | 56 | // {{{ function formu() |
57 | ||
612a2d8a | 58 | public function formu() |
59 | { | |
60 | return 'include/form.valid.homonymes.tpl'; | |
61 | } | |
0337d704 | 62 | |
63 | // }}} | |
64 | // {{{ function _mail_subj | |
65 | ||
612a2d8a | 66 | protected function _mail_subj() |
0337d704 | 67 | { |
5daf68f6 VZ |
68 | return "[Polytechnique.org/Support] " |
69 | . ($this->warning ? "Dans une semaine : suppression de l'alias " : "Mise en place du robot") | |
da2fff38 | 70 | . " $email@" . $this->user->mainEmailDomain(); |
0337d704 | 71 | } |
72 | ||
73 | // }}} | |
74 | // {{{ function _mail_body | |
eaf30d86 | 75 | |
612a2d8a | 76 | protected function _mail_body($isok) |
0337d704 | 77 | { |
0337d704 | 78 | return |
79 | " | |
faefdbb7 SJ |
80 | Comme nous t'en avons informé par email il y a quelques temps, |
81 | pour respecter nos engagements en terme d'adresses email devinables, | |
da2fff38 | 82 | tu te verras bientôt retirer l'alias " . $this->email . "@" . $this->user->mainEmailDomain() . " pour |
5daf68f6 | 83 | ne garder que " . $this->user->forlifeEmail() . ". |
0337d704 | 84 | |
da2fff38 SJ |
85 | Toute personne qui écrira à " . $this->email . "@" . $this->user->mainEmailDomain() . " recevra la |
86 | réponse d'un robot qui l'informera que " . $this->email . "@" . $this->user->mainEmailDomain() . " | |
0337d704 | 87 | est ambigu pour des raisons d'homonymie et signalera ton email exact."; |
88 | } | |
89 | ||
90 | // }}} | |
91 | // {{{ function sendmail() | |
92 | ||
612a2d8a | 93 | protected function sendmail($isok) |
0337d704 | 94 | { |
da2fff38 SJ |
95 | if (!$isok) { |
96 | return false; | |
97 | } | |
98 | ||
99 | Platal::load('admin', 'homonyms.inc.php'); | |
100 | if ($this->warning) { | |
101 | send_warning_homonym($this->user, $this->email); | |
102 | } else { | |
103 | send_robot_homonym($this->user, $this->email); | |
104 | } | |
0337d704 | 105 | } |
106 | // }}} | |
107 | // {{{ function commit() | |
eaf30d86 | 108 | |
612a2d8a | 109 | public function commit() |
0337d704 | 110 | { |
0337d704 | 111 | if (!$this->warning) { |
da2fff38 SJ |
112 | Platal::load('admin', 'homonyms.inc.php'); |
113 | fix_homonym($this->user, $this->email); | |
0337d704 | 114 | } |
eaf30d86 | 115 | |
0337d704 | 116 | return true; |
117 | } | |
118 | ||
119 | // }}} | |
120 | } | |
121 | ||
122 | // }}} | |
123 | ||
a7de4ef7 | 124 | // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: |
0337d704 | 125 | ?> |