- XDB::execute('UPDATE auth_user_md5 SET DATE=NOW() WHERE user_id={?}', $uid);
- } elseif($cid == WATCH_INSCR) {
- XDB::execute('REPLACE INTO contacts (uid,contact)
- SELECT uid,ni_id
- FROM watch_nonins
- WHERE ni_id={?}', $uid);
- XDB::execute('DELETE FROM watch_nonins WHERE ni_id={?}', $uid);
- }
- require_once 'xorg.misc.inc.php';
- update_NbNotifs();
-}
-
-// }}}
-// {{{ function _select_notifs_base
-
-function _select_notifs_base($table, $mail, $where)
-{
- $cases = Array(
- 'contacts' => Array('wfield' => 'contact', 'ufield' => 'user_id', 'need_contact' => false,
- 'freq_sql' => '',
- 'contact_sql' => '1'
- ),
- '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' => 'IF(c.contact IS NULL, 0, 1)'
- ),
- 'watch_nonins' => Array('wfield' => 'ni_id', 'ufield' => 'user_id', 'need_contact' => true,
- 'freq_sql' => '',
- 'contact_sql' => 'IF(c.contact IS NULL, 0, 1)'
- )
- );
-
- $our = $cases[$table];
- $sql = "
- (
- SELECT u.promo, u.prenom, IF(u.nom_usage='',u.nom,u.nom_usage) AS nom,
- u.deces != 0 AS dcd,
- a.alias AS bestalias,
- wo.*,
- {$our['contact_sql']} AS contact,
- (u.perms IN('admin','user')) AS inscrit";
- 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";