X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=bin%2Fcron%2Fnotifs.send.php;h=1d5ceca942d24036ef9c3678fbd101d9462f0658;hb=c3c43c0ebe734e2b43b5d5fdb6010d08358bc34b;hp=12253c5911327bdb20e53da9720eb925cd931abd;hpb=eaf30d86cc99df2414cf4f171a9b0f11b0561e3b;p=platal.git diff --git a/bin/cron/notifs.send.php b/bin/cron/notifs.send.php index 12253c5..1d5ceca 100755 --- a/bin/cron/notifs.send.php +++ b/bin/cron/notifs.send.php @@ -1,7 +1,7 @@ #!/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" - . " https://www.polytechnique.org/carnet/panel\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" - . " https://www.polytechnique.org/carnet/notifs"; - $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 PlMailer(); - $mailer->setFrom('Carnet Polytechnicien mail->domain . '>'); - $mailer->addTo("\"$u['prenom']} {$u['nom']}\" <{$u['bestalias']}@" . $globals->mail->domain . '>'); - $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: ?>