Updates language table for better compatibility with iso codes.
[platal.git] / bin / cron / notifs.send.php
index e49ab56..a68cc90 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/php5 -q
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2010 Polytechnique.org                              *
+ *  Copyright (C) 2003-2011 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -31,16 +31,17 @@ $uids = XDB::query('SELECT  uid
                   ORDER BY  uid');
 $iterator = User::iterOverUIDs($uids->fetchColumn());
 
-$mailer = new PlMailer('carnet/notif.mail.tpl');
 while($user = $iterator->next()) {
     $watch = new Watch($user);
     if ($watch->count() > 0) {
         $notifs = $watch->events();
+        $mailer = new PlMailer('carnet/notif.mail.tpl');
         $mailer->assign('sex', $user->isFemale());
         $mailer->assign('yourself', $user->display_name);
         $mailer->assign('week', date('W - Y'));
         $mailer->assign('notifs', $notifs);
         $mailer->sendTo($user);
+        unset($mailer);
         unset($notifs);
     }
     unset($watch);