X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fnotifs.inc.php;h=58d214cd1f0c42c4ac51e95ad998b3ad529d3ebe;hb=f3a7456dbe1cbe78dfe0ccc2e99c299ad97203c5;hp=4daeaf63d32f59d6f9ab87b8fabde947940992db;hpb=a2a1c2f29234ccc08ec5bce5987c521354a0da7a;p=platal.git diff --git a/include/notifs.inc.php b/include/notifs.inc.php index 4daeaf6..58d214c 100644 --- a/include/notifs.inc.php +++ b/include/notifs.inc.php @@ -1,6 +1,6 @@ updateNbNotifs(); } // }}} @@ -80,7 +89,7 @@ function _select_notifs_base($table, $mail, $where) $sql = " ( SELECT u.promo, u.prenom, IF(u.nom_usage='',u.nom,u.nom_usage) AS nom, - u.deces != 0 AS dcd, + u.deces != 0 AS dcd, (u.flags = 'femme') AS sexe, a.alias AS bestalias, wo.*, {$our['contact_sql']} AS contact, @@ -88,7 +97,7 @@ function _select_notifs_base($table, $mail, $where) if ($mail) { $sql.=", w.uid AS aid, v.prenom AS aprenom, IF(v.nom_usage='',v.nom,v.nom_usage) AS anom, - b.alias AS abestalias, (v.flags='femme') AS sexe, q.core_mail_fmt AS mail_fmt"; + b.alias AS abestalias, (v.flags='femme') AS asexe, q.core_mail_fmt AS mail_fmt"; } $sql .= " @@ -134,29 +143,6 @@ function select_notifs($mail, $uid=null, $last=null, $iterator=true) } // }}} -// {{{ function getNbNotifs - -function getNbNotifs() -{ - if (!S::has('uid')) { - return 0; - } - $uid = S::v('uid', -1); - $watchlast = S::v('watch_last'); - - // selectionne les notifs de uid, sans detail sur le watcher, depuis - // $watchlast, meme ceux sans surveillance, non ordonnés - $res = select_notifs(false, $uid, $watchlast, false); - $n = $res->numRows(); - $res->free(); - if ($n == 0) { - return; - } - - return "$n événement".($n > 1 ? 's' : '')." !"; -} - -// }}} // {{{ global $prf_desc; @@ -224,10 +210,10 @@ class AllNotifs $aid = $tmp['aid']; if (empty($this->_data[$aid])) { $this->_data[$aid] = Array("prenom" => $tmp['aprenom'], 'nom' => $tmp['anom'], - 'bestalias'=>$tmp['abestalias'], 'sexe' => $tmp['sexe'], 'mail_fmt' => $tmp['mail_fmt'], + 'bestalias'=>$tmp['abestalias'], 'sexe' => $tmp['asexe'], 'mail_fmt' => $tmp['mail_fmt'], 'dcd'=>$tmp['dcd']); } - unset($tmp['aprenom'], $tmp['anom'], $tmp['abestalias'], $tmp['aid'], $tmp['sexe'], $tmp['mail_fmt'], $tmp['dcd']); + unset($tmp['aprenom'], $tmp['anom'], $tmp['abestalias'], $tmp['aid'], $tmp['asexe'], $tmp['mail_fmt'], $tmp['dcd']); $this->_data[$aid]['data'][$tmp['cid']][] = $tmp; } } @@ -468,7 +454,7 @@ class NoninsNotifs public function add($p) { - XDB::execute('INSERT INTO watch_nonins (uid,ni_id) VALUES({?},{?})', $this->_uid, $p); + XDB::execute('INSERT IGNORE 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);