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 $page->assign('retour', $redirect->add_email(Env
::v('email')));
243 } elseif (empty($actifs)) {
244 $page->assign('retour', ERROR_INACTIVE_REDIRECTION
);
245 } elseif (is_array($actifs)) {
246 $page->assign('retour', $redirect->modify_email($actifs,
247 Env
::v('emails_rewrite',Array())));
254 INNER JOIN virtual_redirect USING(vid)
255 WHERE (redirect={?} OR redirect={?})
256 AND alias LIKE '%@{$globals->mail->alias_dom}'",
257 $forlife.'@'.$globals->mail
->domain
, $forlife.'@'.$globals->mail
->domain2
);
258 $melix = $res->fetchOneCell();
260 list($melix) = explode('@', $melix);
261 $page->assign('melix',$melix);
267 WHERE id={?} AND (type='a_vie' OR type='alias')
268 ORDER BY !FIND_IN_SET('usage',flags), LENGTH(alias)", $uid);
270 $page->assign('alias', $res->fetchAllAssoc());
271 $page->assign('emails',$redirect->emails
);
273 require_once 'googleapps.inc.php';
274 $page->assign('googleapps', GoogleAppsAccount
::account_status($uid));
277 function handler_antispam(&$page, $statut_filtre = null
)
279 require_once 'emails.inc.php';
280 require_once('wiki.inc.php');
281 wiki_require_page('Xorg.Antispam');
283 $page->changeTpl('emails/antispam.tpl');
285 $bogo = new Bogo(S
::v('uid'));
286 if (isset($statut_filtre)) {
287 $bogo->change($statut_filtre +
0);
289 $page->assign('filtre',$bogo->level());
292 function handler_submit(&$page)
294 require_once('wiki.inc.php');
295 wiki_require_page('Xorg.Mails');
296 $page->changeTpl('emails/submit_spam.tpl');
298 if (Post
::has('send_email')) {
299 S
::assert_xsrf_token();
301 $upload = PlUpload
::get($_FILES['mail'], S
::v('forlife'), 'spam.submit', true
);
303 $page->trigError('Une erreur a été rencontrée lors du transfert du fichier');
306 $mime = $upload->contentType();
307 if ($mime != 'text/x-mail' && $mime != 'message/rfc822') {
309 $page->trigError('Le fichier ne contient pas un mail complet');
313 $box = Post
::v('type') . '@' . $globals->mail
->domain
;
314 $mailer = new PlMailer();
315 $mailer->addTo($box);
316 $mailer->setFrom('"' . S
::v('prenom') . ' ' . S
::v('nom') . '" <web@' . $globals->mail
->domain
. '>');
317 $mailer->setTxtBody(Post
::v('type') . ' soumis par ' . S
::v('forlife') . ' via le web');
318 $mailer->addUploadAttachment($upload, Post
::v('type') . '.mail');
320 $page->trigSuccess('Le message a été transmis à ' . $box);
325 function handler_send(&$page)
328 $page->changeTpl('emails/send.tpl');
329 $page->addJsLink('ajax.js');
331 $page->assign('xorg_title','Polytechnique.org - Envoyer un email');
333 // action si on recoit un formulaire
334 if (Post
::has('save')) {
335 if (!S
::has_xsrf_token()) {
339 unset($_POST['save']);
340 if (trim(preg_replace('/-- .*/', '', Post
::v('contenu'))) != "") {
341 $_POST['to_contacts'] = explode(';', @$_POST['to_contacts']);
342 $_POST['cc_contacts'] = explode(';', @$_POST['cc_contacts']);
343 $data = serialize($_POST);
344 XDB
::execute("REPLACE INTO email_send_save
345 VALUES ({?}, {?})", S
::i('uid'), $data);
348 } else if (Env
::v('submit') == 'Envoyer') {
349 S
::assert_xsrf_token();
351 function getEmails($aliases)
353 if (!is_array($aliases)) {
356 $rel = Env
::v('contacts');
358 foreach ($aliases as $alias) {
359 $ret[$alias] = $rel[$alias];
361 return join(', ', $ret);
365 foreach ($_FILES as &$file) {
366 if ($file['name'] && !PlUpload
::get($file, S
::v('forlife'), 'emails.send', false
)) {
367 $page->trigError(PlUpload
::$lastError);
374 XDB
::execute("DELETE FROM email_send_save
375 WHERE uid = {?}", S
::i('uid'));
377 $to2 = getEmails(Env
::v('to_contacts'));
378 $cc2 = getEmails(Env
::v('cc_contacts'));
379 $txt = str_replace('^M', '', Env
::v('contenu'));
381 $subj = Env
::v('sujet');
382 $from = Env
::v('from');
383 $cc = trim(Env
::v('cc'));
384 $bcc = trim(Env
::v('bcc'));
386 if (empty($to) && empty($cc) && empty($to2) && empty($bcc) && empty($cc2)) {
387 $page->trigError("Indique au moins un destinataire.");
388 $page->assign('uploaded_f', PlUpload
::listFilenames(S
::v('forlife'), 'emails.send'));
390 $mymail = new PlMailer();
391 $mymail->setFrom($from);
392 $mymail->setSubject($subj);
393 if (!empty($to)) { $mymail->addTo($to); }
394 if (!empty($cc)) { $mymail->addCc($cc); }
395 if (!empty($bcc)) { $mymail->addBcc($bcc); }
396 if (!empty($to2)) { $mymail->addTo($to2); }
397 if (!empty($cc2)) { $mymail->addCc($cc2); }
398 $files =& PlUpload
::listFiles(S
::v('forlife'), 'emails.send');
399 foreach ($files as $name=>&$upload) {
400 $mymail->addUploadAttachment($upload, $name);
402 if (Env
::v('nowiki')) {
403 $mymail->setTxtBody(wordwrap($txt, 78, "\n"));
405 $mymail->setWikiBody($txt);
407 if ($mymail->send()) {
408 $page->trigSuccess("Ton mail a bien été envoyé.");
409 $_REQUEST = array('bcc' => S
::v('bestalias').'@'.$globals->mail
->domain
);
410 PlUpload
::clear(S
::v('forlife'), 'emails.send');
412 $page->trigError("Erreur lors de l'envoi du courriel, réessaye.");
413 $page->assign('uploaded_f', PlUpload
::listFilenames(S
::v('forlife'), 'emails.send'));
418 $res = XDB
::query("SELECT data
420 WHERE uid = {?}", S
::i('uid'));
421 if ($res->numRows() == 0) {
422 PlUpload
::clear(S
::v('forlife'), 'emails.send');
423 $_REQUEST['bcc'] = S
::v('bestalias').'@'.$globals->mail
->domain
;
425 $data = unserialize($res->fetchOneCell());
426 $_REQUEST = array_merge($_REQUEST, $data);
431 "SELECT u.prenom, u.nom, u.promo, a.alias as forlife
432 FROM auth_user_md5 AS u
433 INNER JOIN contacts AS c ON (u.user_id = c.contact)
434 INNER JOIN aliases AS a ON (u.user_id=a.id AND FIND_IN_SET('bestalias',a.flags))
436 ORDER BY u.nom, u.prenom", S
::v('uid'));
437 $page->assign('contacts', $res->fetchAllAssoc());
438 $page->assign('maxsize', ini_get('upload_max_filesize') . 'o');
441 function handler_test(&$page, $forlife = null
)
444 require_once 'emails.inc.php';
446 if (!S
::has_xsrf_token()) {
449 if (!S
::has_perms() ||
!$forlife) {
450 $forlife = S
::v('bestalias');
453 $res = XDB
::query("SELECT FIND_IN_SET('femme', u.flags), prenom, user_id
454 FROM auth_user_md5 AS u
455 INNER JOIN aliases AS a ON (a.id = u.user_id)
456 WHERE a.alias = {?}", $forlife);
457 list($sexe, $prenom, $uid) = $res->fetchOneRow();
458 $redirect = new Redirect($uid);
460 $mailer = new PlMailer('emails/test.mail.tpl');
461 $mailer->assign('email', $forlife . '@' . $globals->mail
->domain
);
462 $mailer->assign('redirects', $redirect->active_emails());
463 $mailer->assign('sexe', $sexe);
464 $mailer->assign('prenom', $prenom);
469 function handler_imap_in(&$page, $hash = null
, $login = null
)
471 $page->changeTpl('emails/imap_register.tpl');
473 if (!empty($hash) ||
!empty($login)) {
474 $req = XDB
::query("SELECT u.prenom, FIND_IN_SET('femme', u.flags) AS sexe, a.id
476 INNER JOIN newsletter_ins AS ni ON (a.id = ni.user_id)
477 INNER JOIN auth_user_md5 AS u ON (u.user_id = a.id)
478 WHERE a.alias = {?} AND ni.hash = {?}", $login, $hash);
479 list($prenom, $sexe, $id) = $req->fetchOneRow();
482 require_once('emails.inc.php');
483 $page->assign('ok', false
);
484 if (S
::logged() && (is_null($id) ||
$id == S
::i('uid'))) {
485 $storage = new EmailStorage(S
::i('uid'), 'imap');
486 $storage->activate();
487 $page->assign('ok', true
);
488 $page->assign('prenom', S
::v('prenom'));
489 $page->assign('sexe', S
::v('femme'));
490 } else if (!S
::logged() && $id) {
491 $storage = new EmailStorage($id, 'imap');
492 $storage->activate();
493 $page->assign('ok', true
);
494 $page->assign('prenom', $prenom);
495 $page->assign('sexe', $sexe);
499 function handler_broken(&$page, $warn = null
, $email = null
)
501 require_once 'emails.inc.php';
502 require_once('wiki.inc.php');
503 wiki_require_page('Xorg.PatteCassée');
507 $page->changeTpl('emails/broken.tpl');
509 if ($warn == 'warn' && $email) {
510 S
::assert_xsrf_token();
512 $email = valide_email($email);
513 // vérifications d'usage
515 "SELECT e.uid, a.alias
517 INNER JOIN aliases AS a ON (e.uid = a.id AND type!='homonyme'
518 AND FIND_IN_SET('bestalias',a.flags))
519 WHERE e.email={?}", $email);
521 if (list($uid, $dest) = $sel->fetchOneRow()) {
523 $message = "Bonjour !
525 Ce mail a été généré automatiquement par le service de patte cassée de
526 Polytechnique.org car un autre utilisateur, ".S
::v('prenom').' '.S
::v('nom').",
527 nous a signalé qu'en t'envoyant un mail, il avait reçu un message d'erreur
528 indiquant que ton adresse de redirection $email
529 ne fonctionnait plus !
531 Nous te suggérons de vérifier cette adresse, et le cas échéant de mettre
532 à jour sur le site <{$globals->baseurl}/emails> tes adresses
535 Pour plus de renseignements sur le service de patte cassée, n'hésite pas à
536 consulter la page <{$globals->baseurl}/emails/broken>.
539 À bientôt sur Polytechnique.org !
540 L'équipe d'administration <support@" . $globals->mail
->domain
. '>';
542 $mail = new PlMailer();
543 $mail->setFrom('"Polytechnique.org" <support@' . $globals->mail
->domain
. '>');
544 $mail->addTo("$dest@" . $globals->mail
->domain
);
545 $mail->setSubject("Une de tes adresse de redirection Polytechnique.org ne marche plus !!");
546 $mail->setTxtBody($message);
548 $page->trigSuccess("Mail envoyé !");
550 } elseif (Post
::has('email')) {
551 S
::assert_xsrf_token();
553 $email = valide_email(Post
::v('email'));
555 list(,$fqdn) = explode('@', $email);
556 $fqdn = strtolower($fqdn);
557 if ($fqdn == 'polytechnique.org' ||
$fqdn == 'melix.org' ||
$fqdn == 'm4x.org' ||
$fqdn == 'melix.net') {
558 $page->assign('neuneu', true
);
560 $page->assign('email',$email);
562 "SELECT e1.uid, e1.panne != 0 AS panne,
563 (count(e2.uid) + IF(FIND_IN_SET('googleapps', u.mail_storage), 1, 0)) AS nb_mails,
564 u.nom, u.prenom, u.promo, a.alias AS forlife
566 LEFT JOIN emails as e2 ON(e1.uid = e2.uid
567 AND FIND_IN_SET('active', e2.flags)
568 AND e1.email != e2.email)
569 INNER JOIN auth_user_md5 as u ON(e1.uid = u.user_id)
570 INNER JOIN aliases AS a ON (a.id = e1.uid AND a.type = 'a_vie')
572 GROUP BY e1.uid", $email);
573 if ($x = $sel->fetchOneAssoc()) {
574 // on écrit dans la base que l'adresse est cassée
576 XDB
::execute("UPDATE emails
580 WHERE email = {?}", $email);
582 XDB
::execute("UPDATE emails
584 WHERE email = {?} AND panne_level = 0", $email);
586 $page->assign_by_ref('x', $x);
592 function handler_duplicated(&$page, $action = 'list', $email = null
)
594 $page->changeTpl('emails/duplicated.tpl');
596 $states = array('pending' => 'En attente...',
597 'safe' => 'Pas d\'inquiétude',
598 'unsafe' => 'Recherches en cours',
599 'dangerous' => 'Usurpations par cette adresse');
600 $page->assign('states', $states);
602 if (Post
::has('action')) {
603 S
::assert_xsrf_token();
605 switch (Post
::v('action')) {
607 if (trim(Post
::v('emailN')) != '') {
608 Xdb
::execute('INSERT IGNORE INTO emails_watch (email, state, detection, last, uid, description)
609 VALUES ({?}, {?}, CURDATE(), NOW(), {?}, {?})',
610 trim(Post
::v('emailN')), Post
::v('stateN'), S
::i('uid'), Post
::v('descriptionN'));
615 Xdb
::execute('UPDATE emails_watch
616 SET state = {?}, last = NOW(), uid = {?}, description = {?}
617 WHERE email = {?}', Post
::v('stateN'), S
::i('uid'), Post
::v('descriptionN'), Post
::v('emailN'));
621 if ($action == 'delete' && !is_null($email)) {
622 Xdb
::execute('DELETE FROM emails_watch WHERE email = {?}', $email);
625 if ($action != 'create' && $action != 'edit') {
628 $page->assign('action', $action);
630 if ($action == 'list') {
631 $sql = "SELECT w.email, w.detection, w.state, a.alias AS forlife
632 FROM emails_watch AS w
633 LEFT JOIN emails AS e USING(email)
634 LEFT JOIN aliases AS a ON (a.id = e.uid AND a.type = 'a_vie')
635 ORDER BY w.state, w.email, a.alias";
636 $it = Xdb
::iterRow($sql);
640 while (list($email, $date, $state, $forlife) = $it->next()) {
641 if (count($props) == 0 ||
$props['mail'] != $email) {
642 if (count($props) > 0) {
645 $props = array('mail' => $email,
646 'detection' => $date,
648 'users' => array($forlife));
650 $props['users'][] = $forlife;
653 if (count($props) > 0) {
656 $page->assign('table', $table);
657 } elseif ($action == 'edit') {
658 $sql = "SELECT w.detection, w.state, w.last, w.description,
659 a1.alias AS edit, a2.alias AS forlife
660 FROM emails_watch AS w
661 LEFT JOIN aliases AS a1 ON (a1.id = w.uid AND a1.type = 'a_vie')
662 LEFT JOIN emails AS e ON (w.email = e.email)
663 LEFT JOIN aliases AS a2 ON (a2.id = e.uid AND a2.type = 'a_vie')
666 $it = Xdb
::iterRow($sql, $email);
669 while (list($detection, $state, $last, $description, $edit, $forlife) = $it->next()) {
670 if (count($props) == 0) {
671 $props = array('mail' => $email,
672 'detection' => $detection,
675 'description' => $description,
677 'users' => array($forlife));
679 $props['users'][] = $forlife;
682 $page->assign('doublon', $props);
685 function handler_lost(&$page, $action = 'list', $email = null
)
687 $page->changeTpl('emails/lost.tpl');
689 $page->assign('lost_emails', XDB
::iterator('
690 SELECT u.user_id, a.alias
691 FROM auth_user_md5 AS u
692 INNER JOIN aliases AS a ON (a.id = u.user_id AND a.type = "a_vie")
693 LEFT JOIN emails AS e ON (u.user_id=e.uid AND FIND_IN_SET("active",e.flags))
694 WHERE e.uid IS NULL AND
695 FIND_IN_SET("googleapps", u.mail_storage) = 0 AND
697 ORDER BY u.promo DESC, u.nom, u.prenom'));
701 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: