Merge branch 'platal-0.9.15'
[platal.git] / bin / cron / emails.check.php
index b07281e..c9690c9 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/php5 -q
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2007 Polytechnique.org                              *
+ *  Copyright (C) 2003-2008 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -26,19 +26,19 @@ $panne_level = 3;
 
 require('./connect.db.inc.php');
 
-/* 
+/*
  * Check duplicated addresses
  */
 $sql = "SELECT a1.alias, a2.alias, e1.email
           FROM emails        AS e1
-    INNER JOIN emails        AS e2 ON (e1.email = e2.email AND e1.uid != e2.uid 
-                                       AND (e1.uid < e2.uid OR NOT FIND_IN_SET(e2.flags, 'active')))
+    INNER JOIN emails        AS e2 ON (e1.email = e2.email AND e1.uid != e2.uid
+                                       AND (e1.uid < e2.uid OR NOT FIND_IN_SET('active', e2.flags)))
      LEFT JOIN emails_watch  AS w  ON (e1.email = w.email)
     INNER JOIN aliases       AS a1 ON (a1.id = e1.uid AND a1.type = 'a_vie')
     INNER JOIN aliases       AS a2 ON (a2.id = e2.uid AND a2.type = 'a_vie')
     INNER JOIN auth_user_md5 AS u1 ON (a1.id = u1.user_id)
     INNER JOIN auth_user_md5 AS u2 ON (a2.id = u2.user_id)
-         WHERE FIND_IN_SET(e1.flags, 'active') AND u1.nom != u2.nom_usage AND u2.nom != u1.nom_usage AND w.email IS NULL
+         WHERE FIND_IN_SET('active', e1.flags) AND u1.nom != u2.nom_usage AND u2.nom != u1.nom_usage AND w.email IS NULL
       ORDER BY a1.alias";
 
 $it = Xdb::iterRow($sql);
@@ -58,9 +58,9 @@ if (count($conflits) > 0) {
     echo "\n\n";
     $sql = "INSERT IGNORE INTO emails_watch (email, state, detection, last)
                         VALUES " . join(", ", $insert);
-    Xdb::execute($sql);
-    if (mysql_errno() != 0) {
-        echo 'Error : ' . mysql_error() . "\n$sql";
+    XDB::execute($sql);
+    if (XDB::errno() != 0) {
+        echo 'Error : ' . XDB::error() . "\n$sql";
     }
 }
 
@@ -93,4 +93,5 @@ if ($panne_level > 0) {
                    WHERE  panne_level > $panne_level");
 }
 
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
 ?>