2 /***************************************************************************
3 * Copyright (C) 2003-2008 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
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. *
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. *
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 *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
22 class EmailModule
extends PLModule
27 'emails' => $this->make_hook('emails', AUTH_COOKIE
),
28 'emails/alias' => $this->make_hook('alias', AUTH_MDP
),
29 'emails/antispam' => $this->make_hook('antispam', AUTH_MDP
),
30 'emails/broken' => $this->make_hook('broken', AUTH_COOKIE
),
31 'emails/redirect' => $this->make_hook('redirect', AUTH_MDP
),
32 'emails/send' => $this->make_hook('send', AUTH_MDP
),
33 'emails/antispam/submit' => $this->make_hook('submit', AUTH_COOKIE
),
34 'emails/test' => $this->make_hook('test', AUTH_COOKIE
, 'user', NO_AUTH
),
36 'emails/imap/in' => $this->make_hook('imap_in', AUTH_PUBLIC
),
38 'admin/emails/duplicated' => $this->make_hook('duplicated', AUTH_MDP
, 'admin'),
39 'admin/emails/watch' => $this->make_hook('duplicated', AUTH_MDP
, 'admin'),
40 'admin/emails/lost' => $this->make_hook('lost', AUTH_MDP
, 'admin'),
44 function handler_emails(&$page, $action = null
, $email = null
)
47 require_once 'emails.inc.php';
49 $page->changeTpl('emails/index.tpl');
50 $page->assign('xorg_title','Polytechnique.org - Mes emails');
54 if ($action == 'best' && $email) {
55 if (!S
::has_xsrf_token()) {
59 // bestalias is the first bit : 1
60 // there will be maximum 8 bits in flags : 255
61 XDB
::execute("UPDATE aliases SET flags=flags & (255 - 1) WHERE id={?}", $uid);
62 XDB
::execute("UPDATE aliases SET flags=flags | 1 WHERE id={?} AND alias={?}",
66 // on regarde si on a affaire à un homonyme
67 $sql = "SELECT alias, (type='a_vie') AS a_vie,
68 (alias REGEXP '\\\\.[0-9]{2}$') AS cent_ans,
69 FIND_IN_SET('bestalias',flags) AS best, expire
71 WHERE id = {?} AND type!='homonyme'
72 ORDER BY LENGTH(alias)";
73 $page->assign('aliases', XDB
::iterator($sql, $uid));
75 $homonyme = XDB
::query("SELECT alias FROM aliases INNER JOIN homonymes ON (id = homonyme_id) WHERE user_id = {?} AND type = 'homonyme'", $uid);
76 $page->assign('homonyme', $homonyme->fetchOneCell());
78 // Affichage des redirections de l'utilisateur.
79 $redirect = new Redirect($uid);
80 $page->assign('mails', $redirect->active_emails());
82 // on regarde si l'utilisateur a un alias et si oui on l'affiche !
83 $forlife = S
::v('forlife');
87 INNER JOIN virtual_redirect AS vr USING(vid)
88 WHERE (redirect={?} OR redirect={?})
89 AND alias LIKE '%@{$globals->mail->alias_dom}'",
90 $forlife.'@'.$globals->mail
->domain
, $forlife.'@'.$globals->mail
->domain2
);
91 $page->assign('melix', $res->fetchOneCell());
94 function handler_alias(&$page, $action = null
, $value = null
)
96 require_once 'validations.inc.php';
100 $page->changeTpl('emails/alias.tpl');
101 $page->assign('xorg_title','Polytechnique.org - Alias melix.net');
104 $forlife = S
::v('forlife');
106 $page->assign('demande', AliasReq
::get_request($uid));
108 if ($action == 'delete' && $value) {
109 S
::assert_xsrf_token();
111 //Suppression d'un alias
113 'DELETE virtual, virtual_redirect
115 INNER JOIN virtual_redirect USING (vid)
116 WHERE alias = {?} AND (redirect = {?} OR redirect = {?})', $value,
117 $forlife.'@'.$globals->mail
->domain
, $forlife.'@'.$globals->mail
->domain2
);
120 //Récupération des alias éventuellement existants
122 "SELECT alias, emails_alias_pub
123 FROM auth_user_quick, virtual
124 INNER JOIN virtual_redirect USING(vid)
125 WHERE ( redirect={?} OR redirect= {?} )
126 AND alias LIKE '%@{$globals->mail->alias_dom}' AND user_id = {?}",
127 $forlife.'@'.$globals->mail
->domain
,
128 $forlife.'@'.$globals->mail
->domain2
, S
::v('uid'));
129 list($alias, $visibility) = $res->fetchOneRow();
130 $page->assign('actuel', $alias);
132 if ($action == 'ask' && Env
::has('alias') && Env
::has('raison')) {
133 S
::assert_xsrf_token();
135 //Si l'utilisateur vient de faire une damande
136 $alias = Env
::v('alias');
137 $raison = Env
::v('raison');
138 $public = (Env
::v('public', 'off') == 'on')?
"public":"private";
140 $page->assign('r_alias', $alias);
141 $page->assign('r_raison', $raison);
142 if ($public == 'public') {
143 $page->assign('r_public', true
);
146 //Quelques vérifications sur l'alias (caractères spéciaux)
147 if (!preg_match( "/^[a-zA-Z0-9\-.]{3,20}$/", $alias)) {
148 $page->trigError("L'adresse demandée n'est pas valide."
149 . " Vérifie qu'elle comporte entre 3 et 20 caractères"
150 . " et qu'elle ne contient que des lettres non accentuées,"
151 . " des chiffres ou les caractères - et .");
154 //vérifier que l'alias n'est pas déja pris
155 $res = XDB
::query('SELECT COUNT(*) FROM virtual WHERE alias={?}',
156 $alias.'@'.$globals->mail
->alias_dom
);
157 if ($res->fetchOneCell() > 0) {
158 $page->trigError("L'alias $alias@{$globals->mail->alias_dom} a déja été attribué.
159 Tu ne peux donc pas l'obtenir.");
163 //vérifier que l'alias n'est pas déja en demande
164 $it = new ValidateIterator ();
165 while($req = $it->next()) {
166 if ($req->type
== "alias" and $req->alias
== $alias . '@' . $globals->mail
->alias_dom
) {
167 $page->trigError("L'alias $alias@{$globals->mail->alias_dom} a déja été demandé.
168 Tu ne peux donc pas l'obtenir pour l'instant.");
173 //Insertion de la demande dans la base, écrase les requêtes précédente
174 $myalias = new AliasReq($uid, $alias, $raison, $public);
176 $page->assign('success',$alias);
179 } elseif ($action == 'set' && ($value == 'public' ||
$value == 'private')) {
180 if (!S
::has_xsrf_token()) {
184 if ($value == 'public') {
185 XDB
::execute("UPDATE auth_user_quick SET emails_alias_pub = 'public'
186 WHERE user_id = {?}", S
::v('uid'));
188 XDB
::execute("UPDATE auth_user_quick SET emails_alias_pub = 'private'
189 WHERE user_id = {?}", S
::v('uid'));
192 $visibility = $value;
195 $page->assign('mail_public', ($visibility == 'public'));
198 function handler_redirect(&$page, $action = null
, $email = null
)
202 require_once 'emails.inc.php';
204 $page->changeTpl('emails/redirect.tpl');
207 $forlife = S
::v('forlife');
209 $page->assign('eleve', S
::i('promo') >= date("Y") - 5);
211 $redirect = new Redirect(S
::v('uid'));
213 // FS#703 : $_GET is urldecoded twice, hence
214 // + (the data) => %2B (in the url) => + (first decoding) => ' ' (second decoding)
215 // Since there can be no spaces in emails, we can fix this with :
216 $email = str_replace(' ', '+', $email);
218 if ($action == 'remove' && $email) {
219 $retour = $redirect->delete_email($email);
220 $page->assign('retour', $retour);
223 if ($action == 'active' && $email) {
224 $redirect->modify_one_email($email, true
);
227 if ($action == 'inactive' && $email) {
228 $redirect->modify_one_email($email, false
);
231 if ($action == 'rewrite' && $email) {
232 $rewrite = @func_get_arg
(3);
233 $redirect->modify_one_email_redirect($email, $rewrite);
236 if (Env
::has('emailop')) {
237 S
::assert_xsrf_token();
239 $actifs = Env
::v('emails_actifs', Array());
240 print_r(Env
::v('emails_rewrite'));
241 if (Env
::v('emailop') == "ajouter" && Env
::has('email')) {
242 $new_email = Env
::v('email');
243 if ($new_email == "new@new.new") {
244 $new_email = Env
::v('email_new');
246 $retour = $redirect->add_email($new_email);
247 if ($retour == ERROR_INVALID_EMAIL
) {
248 $page->assign('email', $new_email);
250 $page->assign('retour', $retour);
251 } elseif (empty($actifs)) {
252 $page->assign('retour', ERROR_INACTIVE_REDIRECTION
);
253 } elseif (is_array($actifs)) {
254 $page->assign('retour', $redirect->modify_email($actifs,
255 Env
::v('emails_rewrite',Array())));
262 INNER JOIN virtual_redirect USING(vid)
263 WHERE (redirect={?} OR redirect={?})
264 AND alias LIKE '%@{$globals->mail->alias_dom}'",
265 $forlife.'@'.$globals->mail
->domain
, $forlife.'@'.$globals->mail
->domain2
);
266 $melix = $res->fetchOneCell();
268 list($melix) = explode('@', $melix);
269 $page->assign('melix',$melix);
275 WHERE id={?} AND (type='a_vie' OR type='alias')
276 ORDER BY !FIND_IN_SET('usage',flags), LENGTH(alias)", $uid);
278 $page->assign('alias', $res->fetchAllAssoc());
279 $page->assign('emails',$redirect->emails
);
281 require_once 'googleapps.inc.php';
282 $page->assign('googleapps', GoogleAppsAccount
::account_status($uid));
284 require_once 'emails.combobox.inc.php';
285 fill_email_combobox($page);
288 function handler_antispam(&$page, $statut_filtre = null
)
290 require_once 'emails.inc.php';
291 require_once('wiki.inc.php');
292 wiki_require_page('Xorg.Antispam');
294 $page->changeTpl('emails/antispam.tpl');
296 $bogo = new Bogo(S
::v('uid'));
297 if (isset($statut_filtre)) {
298 $bogo->change($statut_filtre +
0);
300 $page->assign('filtre',$bogo->level());
303 function handler_submit(&$page)
305 require_once('wiki.inc.php');
306 wiki_require_page('Xorg.Mails');
307 $page->changeTpl('emails/submit_spam.tpl');
309 if (Post
::has('send_email')) {
310 S
::assert_xsrf_token();
312 $upload = PlUpload
::get($_FILES['mail'], S
::v('forlife'), 'spam.submit', true
);
314 $page->trigError('Une erreur a été rencontrée lors du transfert du fichier');
317 $mime = $upload->contentType();
318 if ($mime != 'text/x-mail' && $mime != 'message/rfc822') {
320 $page->trigError('Le fichier ne contient pas un mail complet');
324 $box = Post
::v('type') . '@' . $globals->mail
->domain
;
325 $mailer = new PlMailer();
326 $mailer->addTo($box);
327 $mailer->setFrom('"' . S
::v('prenom') . ' ' . S
::v('nom') . '" <web@' . $globals->mail
->domain
. '>');
328 $mailer->setTxtBody(Post
::v('type') . ' soumis par ' . S
::v('forlife') . ' via le web');
329 $mailer->addUploadAttachment($upload, Post
::v('type') . '.mail');
331 $page->trigSuccess('Le message a été transmis à ' . $box);
336 function handler_send(&$page)
339 $page->changeTpl('emails/send.tpl');
340 $page->addJsLink('ajax.js');
342 $page->assign('xorg_title','Polytechnique.org - Envoyer un email');
344 // action si on recoit un formulaire
345 if (Post
::has('save')) {
346 if (!S
::has_xsrf_token()) {
350 unset($_POST['save']);
351 if (trim(preg_replace('/-- .*/', '', Post
::v('contenu'))) != "") {
352 $_POST['to_contacts'] = explode(';', @$_POST['to_contacts']);
353 $_POST['cc_contacts'] = explode(';', @$_POST['cc_contacts']);
354 $data = serialize($_POST);
355 XDB
::execute("REPLACE INTO email_send_save
356 VALUES ({?}, {?})", S
::i('uid'), $data);
359 } else if (Env
::v('submit') == 'Envoyer') {
360 S
::assert_xsrf_token();
362 function getEmails($aliases)
364 if (!is_array($aliases)) {
367 $rel = Env
::v('contacts');
369 foreach ($aliases as $alias) {
370 $ret[$alias] = $rel[$alias];
372 return join(', ', $ret);
376 foreach ($_FILES as &$file) {
377 if ($file['name'] && !PlUpload
::get($file, S
::v('forlife'), 'emails.send', false
)) {
378 $page->trigError(PlUpload
::$lastError);
385 XDB
::execute("DELETE FROM email_send_save
386 WHERE uid = {?}", S
::i('uid'));
388 $to2 = getEmails(Env
::v('to_contacts'));
389 $cc2 = getEmails(Env
::v('cc_contacts'));
390 $txt = str_replace('^M', '', Env
::v('contenu'));
392 $subj = Env
::v('sujet');
393 $from = Env
::v('from');
394 $cc = trim(Env
::v('cc'));
395 $bcc = trim(Env
::v('bcc'));
397 if (empty($to) && empty($cc) && empty($to2) && empty($bcc) && empty($cc2)) {
398 $page->trigError("Indique au moins un destinataire.");
399 $page->assign('uploaded_f', PlUpload
::listFilenames(S
::v('forlife'), 'emails.send'));
401 $mymail = new PlMailer();
402 $mymail->setFrom($from);
403 $mymail->setSubject($subj);
404 if (!empty($to)) { $mymail->addTo($to); }
405 if (!empty($cc)) { $mymail->addCc($cc); }
406 if (!empty($bcc)) { $mymail->addBcc($bcc); }
407 if (!empty($to2)) { $mymail->addTo($to2); }
408 if (!empty($cc2)) { $mymail->addCc($cc2); }
409 $files =& PlUpload
::listFiles(S
::v('forlife'), 'emails.send');
410 foreach ($files as $name=>&$upload) {
411 $mymail->addUploadAttachment($upload, $name);
413 if (Env
::v('nowiki')) {
414 $mymail->setTxtBody(wordwrap($txt, 78, "\n"));
416 $mymail->setWikiBody($txt);
418 if ($mymail->send()) {
419 $page->trigSuccess("Ton mail a bien été envoyé.");
420 $_REQUEST = array('bcc' => S
::v('bestalias').'@'.$globals->mail
->domain
);
421 PlUpload
::clear(S
::v('forlife'), 'emails.send');
423 $page->trigError("Erreur lors de l'envoi du courriel, réessaye.");
424 $page->assign('uploaded_f', PlUpload
::listFilenames(S
::v('forlife'), 'emails.send'));
429 $res = XDB
::query("SELECT data
431 WHERE uid = {?}", S
::i('uid'));
432 if ($res->numRows() == 0) {
433 PlUpload
::clear(S
::v('forlife'), 'emails.send');
434 $_REQUEST['bcc'] = S
::v('bestalias').'@'.$globals->mail
->domain
;
436 $data = unserialize($res->fetchOneCell());
437 $_REQUEST = array_merge($_REQUEST, $data);
442 "SELECT u.prenom, u.nom, u.promo, a.alias as forlife
443 FROM auth_user_md5 AS u
444 INNER JOIN contacts AS c ON (u.user_id = c.contact)
445 INNER JOIN aliases AS a ON (u.user_id=a.id AND FIND_IN_SET('bestalias',a.flags))
447 ORDER BY u.nom, u.prenom", S
::v('uid'));
448 $page->assign('contacts', $res->fetchAllAssoc());
449 $page->assign('maxsize', ini_get('upload_max_filesize') . 'o');
452 function handler_test(&$page, $forlife = null
)
455 require_once 'emails.inc.php';
457 if (!S
::has_xsrf_token()) {
460 if (!S
::has_perms() ||
!$forlife) {
461 $forlife = S
::v('bestalias');
464 $res = XDB
::query("SELECT FIND_IN_SET('femme', u.flags), prenom, user_id
465 FROM auth_user_md5 AS u
466 INNER JOIN aliases AS a ON (a.id = u.user_id)
467 WHERE a.alias = {?}", $forlife);
468 list($sexe, $prenom, $uid) = $res->fetchOneRow();
469 $redirect = new Redirect($uid);
471 $mailer = new PlMailer('emails/test.mail.tpl');
472 $mailer->assign('email', $forlife . '@' . $globals->mail
->domain
);
473 $mailer->assign('redirects', $redirect->active_emails());
474 $mailer->assign('sexe', $sexe);
475 $mailer->assign('prenom', $prenom);
480 function handler_imap_in(&$page, $hash = null
, $login = null
)
482 $page->changeTpl('emails/imap_register.tpl');
484 if (!empty($hash) ||
!empty($login)) {
485 $req = XDB
::query("SELECT u.prenom, FIND_IN_SET('femme', u.flags) AS sexe, a.id
487 INNER JOIN newsletter_ins AS ni ON (a.id = ni.user_id)
488 INNER JOIN auth_user_md5 AS u ON (u.user_id = a.id)
489 WHERE a.alias = {?} AND ni.hash = {?}", $login, $hash);
490 list($prenom, $sexe, $id) = $req->fetchOneRow();
493 require_once('emails.inc.php');
494 $page->assign('ok', false
);
495 if (S
::logged() && (is_null($id) ||
$id == S
::i('uid'))) {
496 $storage = new EmailStorage(S
::i('uid'), 'imap');
497 $storage->activate();
498 $page->assign('ok', true
);
499 $page->assign('prenom', S
::v('prenom'));
500 $page->assign('sexe', S
::v('femme'));
501 } else if (!S
::logged() && $id) {
502 $storage = new EmailStorage($id, 'imap');
503 $storage->activate();
504 $page->assign('ok', true
);
505 $page->assign('prenom', $prenom);
506 $page->assign('sexe', $sexe);
510 function handler_broken(&$page, $warn = null
, $email = null
)
512 require_once 'emails.inc.php';
513 require_once('wiki.inc.php');
514 wiki_require_page('Xorg.PatteCassée');
518 $page->changeTpl('emails/broken.tpl');
520 if ($warn == 'warn' && $email) {
521 S
::assert_xsrf_token();
523 $email = valide_email($email);
524 // vérifications d'usage
526 "SELECT e.uid, a.alias
528 INNER JOIN aliases AS a ON (e.uid = a.id AND type!='homonyme'
529 AND FIND_IN_SET('bestalias',a.flags))
530 WHERE e.email={?}", $email);
532 if (list($uid, $dest) = $sel->fetchOneRow()) {
534 $message = "Bonjour !
536 Ce mail a été généré automatiquement par le service de patte cassée de
537 Polytechnique.org car un autre utilisateur, ".S
::v('prenom').' '.S
::v('nom').",
538 nous a signalé qu'en t'envoyant un mail, il avait reçu un message d'erreur
539 indiquant que ton adresse de redirection $email
540 ne fonctionnait plus !
542 Nous te suggérons de vérifier cette adresse, et le cas échéant de mettre
543 à jour sur le site <{$globals->baseurl}/emails> tes adresses
546 Pour plus de renseignements sur le service de patte cassée, n'hésite pas à
547 consulter la page <{$globals->baseurl}/emails/broken>.
550 À bientôt sur Polytechnique.org !
551 L'équipe d'administration <support@" . $globals->mail
->domain
. '>';
553 $mail = new PlMailer();
554 $mail->setFrom('"Polytechnique.org" <support@' . $globals->mail
->domain
. '>');
555 $mail->addTo("$dest@" . $globals->mail
->domain
);
556 $mail->setSubject("Une de tes adresse de redirection Polytechnique.org ne marche plus !!");
557 $mail->setTxtBody($message);
559 $page->trigSuccess("Mail envoyé !");
561 } elseif (Post
::has('email')) {
562 S
::assert_xsrf_token();
564 $email = valide_email(Post
::v('email'));
566 list(,$fqdn) = explode('@', $email);
567 $fqdn = strtolower($fqdn);
568 if ($fqdn == 'polytechnique.org' ||
$fqdn == 'melix.org' ||
$fqdn == 'm4x.org' ||
$fqdn == 'melix.net') {
569 $page->assign('neuneu', true
);
571 $page->assign('email',$email);
573 "SELECT e1.uid, e1.panne != 0 AS panne,
574 (count(e2.uid) + IF(FIND_IN_SET('googleapps', u.mail_storage), 1, 0)) AS nb_mails,
575 u.nom, u.prenom, u.promo, a.alias AS forlife
577 LEFT JOIN emails as e2 ON(e1.uid = e2.uid
578 AND FIND_IN_SET('active', e2.flags)
579 AND e1.email != e2.email)
580 INNER JOIN auth_user_md5 as u ON(e1.uid = u.user_id)
581 INNER JOIN aliases AS a ON (a.id = e1.uid AND a.type = 'a_vie')
583 GROUP BY e1.uid", $email);
584 if ($x = $sel->fetchOneAssoc()) {
585 // on écrit dans la base que l'adresse est cassée
587 XDB
::execute("UPDATE emails
591 WHERE email = {?}", $email);
593 XDB
::execute("UPDATE emails
595 WHERE email = {?} AND panne_level = 0", $email);
597 $page->assign_by_ref('x', $x);
603 function handler_duplicated(&$page, $action = 'list', $email = null
)
605 $page->changeTpl('emails/duplicated.tpl');
607 $states = array('pending' => 'En attente...',
608 'safe' => 'Pas d\'inquiétude',
609 'unsafe' => 'Recherches en cours',
610 'dangerous' => 'Usurpations par cette adresse');
611 $page->assign('states', $states);
613 if (Post
::has('action')) {
614 S
::assert_xsrf_token();
616 switch (Post
::v('action')) {
618 if (trim(Post
::v('emailN')) != '') {
619 Xdb
::execute('INSERT IGNORE INTO emails_watch (email, state, detection, last, uid, description)
620 VALUES ({?}, {?}, CURDATE(), NOW(), {?}, {?})',
621 trim(Post
::v('emailN')), Post
::v('stateN'), S
::i('uid'), Post
::v('descriptionN'));
626 Xdb
::execute('UPDATE emails_watch
627 SET state = {?}, last = NOW(), uid = {?}, description = {?}
628 WHERE email = {?}', Post
::v('stateN'), S
::i('uid'), Post
::v('descriptionN'), Post
::v('emailN'));
632 if ($action == 'delete' && !is_null($email)) {
633 Xdb
::execute('DELETE FROM emails_watch WHERE email = {?}', $email);
636 if ($action != 'create' && $action != 'edit') {
639 $page->assign('action', $action);
641 if ($action == 'list') {
642 $sql = "SELECT w.email, w.detection, w.state, a.alias AS forlife
643 FROM emails_watch AS w
644 LEFT JOIN emails AS e USING(email)
645 LEFT JOIN aliases AS a ON (a.id = e.uid AND a.type = 'a_vie')
646 ORDER BY w.state, w.email, a.alias";
647 $it = Xdb
::iterRow($sql);
651 while (list($email, $date, $state, $forlife) = $it->next()) {
652 if (count($props) == 0 ||
$props['mail'] != $email) {
653 if (count($props) > 0) {
656 $props = array('mail' => $email,
657 'detection' => $date,
659 'users' => array($forlife));
661 $props['users'][] = $forlife;
664 if (count($props) > 0) {
667 $page->assign('table', $table);
668 } elseif ($action == 'edit') {
669 $sql = "SELECT w.detection, w.state, w.last, w.description,
670 a1.alias AS edit, a2.alias AS forlife
671 FROM emails_watch AS w
672 LEFT JOIN aliases AS a1 ON (a1.id = w.uid AND a1.type = 'a_vie')
673 LEFT JOIN emails AS e ON (w.email = e.email)
674 LEFT JOIN aliases AS a2 ON (a2.id = e.uid AND a2.type = 'a_vie')
677 $it = Xdb
::iterRow($sql, $email);
680 while (list($detection, $state, $last, $description, $edit, $forlife) = $it->next()) {
681 if (count($props) == 0) {
682 $props = array('mail' => $email,
683 'detection' => $detection,
686 'description' => $description,
688 'users' => array($forlife));
690 $props['users'][] = $forlife;
693 $page->assign('doublon', $props);
696 function handler_lost(&$page, $action = 'list', $email = null
)
698 $page->changeTpl('emails/lost.tpl');
700 $page->assign('lost_emails', XDB
::iterator('
701 SELECT u.user_id, a.alias
702 FROM auth_user_md5 AS u
703 INNER JOIN aliases AS a ON (a.id = u.user_id AND a.type = "a_vie")
704 LEFT JOIN emails AS e ON (u.user_id=e.uid AND FIND_IN_SET("active",e.flags))
705 WHERE e.uid IS NULL AND
706 FIND_IN_SET("googleapps", u.mail_storage) = 0 AND
708 ORDER BY u.promo DESC, u.nom, u.prenom'));
712 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: