X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=bin%2Fcron%2Fnotifs.send.php;h=ac67dc7b95e57a48b578ffe9aaf37c5e9015c769;hb=734e15dc6a0039706148c833168713dec4789260;hp=efa5d08393926491d3cf4c907f6779f6c65aa280;hpb=0337d704b62718d7c77106c0e4c4e26fb02beacf;p=platal.git diff --git a/bin/cron/notifs.send.php b/bin/cron/notifs.send.php index efa5d08..ac67dc7 100755 --- a/bin/cron/notifs.send.php +++ b/bin/cron/notifs.send.php @@ -1,7 +1,7 @@ -#!/usr/bin/php4 -q +#!/usr/bin/php5 -q _data as $u) { - $week = date("W - Y"); - - $text = " ".($u['sexe'] ? 'Chère' : 'Cher')." {$u['prenom']},\n\n" - . " Voici les évènements survenus dans la semaine écoulée,\n" - . "et depuis ta dernière visite sur le site.\n\n" - . "Tu trouveras les mêmes informations sur la page :\n" - . " {$globals->baseurl}/carnet/panel.php\n\n" - . "------------------------------------------------------------------------\n\n"; - - $html = << - - Notifications de la semaine $week - - -

Voici les évènements survenus dans la semaine écoulée, et depuis ta dernière visite sur le site.

-

Tu trouveras les mêmes informations sur cette page

-EOF; - - foreach($u['data'] as $cid=>$d) { - $text .= " {$all->_cats[$cid][(count($d)==1)?'mail_sg':'mail']} :\n\n"; - $html .= "

{$all->_cats[$cid][(count($d)==1)?'mail_sg':'mail']} :

\n\n"; - } - - $text .= "-- \n" - . "L'équipe de Polytechnique.org\n\n" - . "------------------------------------------------------------------------\n\n" - . "Tu recois ce mail car tu as activé la notification automatique \n" - . "par mail des évènements que tu surveilles.\n\n" - . "Tu peux changer cette option sur :\n" - . " {$globals->baseurl}/carnet/notifs.php"; - $html .= << -

L'équipe de Polytechnique.org

-
-

- Tu recois ce mail car tu as activé la notification automatique par mail des évènements que tu surveilles. -

-

Tu peux changer cette option sur la page - de configuration des notifications -

- - -EOF; - - $mailer = new HermesMailer(); - $mailer->setFrom("Carnet Polytechnicien "); - $mailer->addTo("\"{$u['prenom']} {$u['nom']}\" <{$u['bestalias']}@polytechnique.org>"); - $mailer->setSubject("Notifications de la semaine $week"); - $mailer->setTxtBody($text); - if ($u['mail_fmt'] == 'html') { $mailer->setHtmlBody($html); } - $mailer->send(); +$mailer = new PlMailer('carnet/notif.mail.tpl'); +foreach ($all->_data as $u) { + $mailer = new PlMailer('carnet/notif.mail.tpl'); + $mailer->assign('u', $u); + $mailer->assign('week', date("W - Y")); + $mailer->assign('cats', $all->_cats); + $mailer->addTo('"' . $u['prenom'] . ' ' . $u['nom'] . '" <' . $u['bestalias'] . '@polytechnique.org>'); + $mailer->send($u['mail_fmt'] == 'html'); } +XDB::execute("DELETE FROM watch_profile + WHERE ts < DATE_SUB(CURRENT_DATE, INTERVAL 15 DAY)"); + +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?>