typos
[platal.git] / include / notifs.inc.php
index 3e691c1..b77bd34 100644 (file)
@@ -64,11 +64,11 @@ function _select_notifs_base($table, $mail, $where)
         ),
         'watch_promo'  => Array('wfield' => 'promo',   'ufield' => 'promo',   'need_contact' => true,
             'freq_sql' => ' AND ( wc.type = "basic" OR wc.type="near" AND (u.promo <= v.promo_sortie-2 AND u.promo_sortie >= v.promo+2) )',
-            'contact_sql' => 'NOT (c.contact IS NULL)'
+            'contact_sql' => 'IF(c.contact IS NULL, 0, 1)'
         ),
-        'watch_nonins' => Array('wfield' => 'ni_id',   'ufield' => 'user_id', 'need_contact' => false,
+        'watch_nonins' => Array('wfield' => 'ni_id',   'ufield' => 'user_id', 'need_contact' => true,
             'freq_sql' => '',
-            'contact_sql' => '0'
+            'contact_sql' => 'IF(c.contact IS NULL, 0, 1)'
         )
     );
 
@@ -132,7 +132,7 @@ function select_notifs($mail, $uid=null, $last=null, $iterator=true)
 // }}}
 // {{{ function getNbNotifs
 
-function getNbNotifs() 
+function getNbNotifs()
 {
     if (!S::has('uid')) {
         return 0;
@@ -155,7 +155,7 @@ function getNbNotifs()
 // }}}
 // {{{ class AllNotifs
 
-class AllNotifs 
+class AllNotifs
 {
     public $_cats = Array();
     public $_data = Array();
@@ -187,7 +187,7 @@ class AllNotifs
 // }}}
 // {{{ class Notifs
 
-class Notifs 
+class Notifs
 {
     public $_uid;
     public $_cats = Array();
@@ -220,7 +220,7 @@ class Notifs
 // }}}
 // {{{ class Watch
 
-class Watch 
+class Watch
 {
     public $_uid;
     public $_promos;
@@ -237,8 +237,8 @@ class Watch
         $this->_nonins = new NoninsNotifs($uid);
         $this->_subs = new WatchSub($uid);
         $res = XDB::query("SELECT  FIND_IN_SET('contacts',watch_flags),FIND_IN_SET('mail',watch_flags)
-            FROM  auth_user_quick
-            WHERE  user_id={?}", $uid);
+                             FROM  auth_user_quick
+                            WHERE  user_id={?}", $uid);
         list($this->watch_contacts,$this->watch_mail) = $res->fetchOneRow();
 
         $res = XDB::iterator("SELECT * FROM watch_cat");
@@ -411,12 +411,12 @@ class NoninsNotifs
     public function del($p)
     {
         unset($this->_data["$p"]);
-        XDB::execute('DELETE FROM watch_nonins WHERE uid={?} AND ni_id={?}', $this->_uid, $p);
+        XDB::execute('DELETE FROM  watch_nonins WHERE uid={?} AND ni_id={?}', $this->_uid, $p);
     }
 
     public function add($p)
     {
-        XDB::execute('INSERT INTO watch_nonins (uid,ni_id) VALUES({?},{?})', $this->_uid, $p);
+        XDB::execute('INSERT INTO  watch_nonins (uid,ni_id) VALUES({?},{?})', $this->_uid, $p);
         $res = XDB::query('SELECT  prenom,IF(nom_usage="",nom,nom_usage) AS nom,promo,user_id
                              FROM  auth_user_md5
                             WHERE  user_id={?}', $p);