X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fnotifs.inc.php;h=5e835dbfe7b6b711012cd78860b7a7076cab1ee0;hb=7c7d62fce3e3973b576ffbc4051ba443d6a6b849;hp=fe8a86de51d242b6565eeeb33fdd1a020beb04b4;hpb=8d84c630f353ef0534e02325507ed35cc2f0d28f;p=platal.git diff --git a/include/notifs.inc.php b/include/notifs.inc.php index fe8a86d..5e835db 100644 --- a/include/notifs.inc.php +++ b/include/notifs.inc.php @@ -34,25 +34,33 @@ function inscription_notifs_base($uid) // }}} // {{{ function register_watch_op -function register_watch_op($uid, $cid, $date='', $info='') +function register_watch_op($uid, $cid, $date = '', $info = '') { if (empty($date)) { $date = date('Y-m-d'); - }; - XDB::execute('REPLACE INTO watch_ops (uid,cid,known,date,info) + } + XDB::execute('REPLACE INTO watch_ops (uid, cid, known, date, info) VALUES ({?}, {?}, NOW(), {?}, {?})', $uid, $cid, $date, $info); - if($cid == WATCH_FICHE) { + if ($cid == WATCH_FICHE) { if ($info) { register_profile_update($uid, $info); } - 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 + 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); + WHERE ni_id = {?}', $uid); + XDB::execute('DELETE FROM watch_nonins + WHERE ni_id = {?}', $uid); + } elseif ($cid == WATCH_DEATH) { + // We delete nonins watches both for the dead (if non registered), and + // for people watched by the dead. + XDB::execute('DELETE FROM watch_nonins + WHERE ni_id = {?} OR uid = {?}', $uid); } Platal::session()->updateNbNotifs(); } @@ -138,21 +146,22 @@ function select_notifs($mail, $uid=null, $last=null, $iterator=true) // {{{ global $prf_desc; -$prf_desc = array('nom' => 'Son patronyme', - 'freetext' => 'Le texte libre', - 'mobile' => 'Son numéro de téléphone portable', +$prf_desc = array('nom' => 'Son patronyme', + 'freetext' => 'Le texte libre', + 'mobile' => 'Son numéro de téléphone portable', 'nationalite' => 'Sa nationalité', - 'nick' => 'Son surnom', - 'web' => 'L\'adresse de son site web', - 'appli1' => 'Son école d\'application', - 'appli2' => 'Son école de post-application', - 'addresses' => 'Ses adresses', - 'section' => 'Sa section sportive', - 'binets' => 'La liste de ses binets', - 'medals' => 'Ses décorations', - 'cv' => 'Son Curriculum Vitae', - 'jobs' => 'Ses informations professionnelles', - 'photo' => 'Sa photographie'); + 'nick' => 'Son surnom', + 'web' => "L'adresse de son site web", + 'appli1' => "Son école d'application", + 'appli2' => 'Son école de post-application', + 'addresses' => 'Ses adresses', + 'section' => 'Sa section sportive', + 'binets' => 'La liste de ses binets', + 'medals' => 'Ses décorations', + 'cv' => 'Son curriculum vitae', + 'jobs' => 'Ses informations professionnelles', + 'photo' => 'Sa photographie', + 'broken' => "Il n'a plus d'adresse de redirection valide"); function get_profile_change_details($event, $limit) { global $prf_desc; @@ -446,7 +455,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);