add link towards aexplaintations
[platal.git] / include / notifs.inc.php
index 4240139..41ed1c6 100644 (file)
@@ -133,22 +133,22 @@ function select_notifs($mail, $uid=null, $last=null, $iterator=true)
 // {{{ function getNbNotifs
 
 function getNbNotifs() {
-    global $globals;
-    if (!Session::has('uid')) {
+    if (!S::has('uid')) {
         return 0;
     }
-    $uid       = Session::getInt('uid', -1);
-    $watchlast = Session::get('watch_last');
+    $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();
-    $url = $globals->baseurl."/carnet/panel";
-    if($n==0) { return; }
-    if($n==1) { return "<a href='$url'>1 évènement !</a>"; }
-    return "<a href='$url'>$n évènements !</a>";
+    if ($n == 0) {
+        return;
+    }
+
+    return "<a href='carnet/panel'>$n événement".($n > 1 ? 's' : '')." !</a>";
 }
 
 // }}}
@@ -197,7 +197,7 @@ class Notifs {
             $this->_cats[$tmp['id']] = $tmp;
         }
 
-        $lastweek = date('YmdHis',mktime() - 7*24*60*60);
+        $lastweek = date('YmdHis', time() - 7*24*60*60);
 
         // recupere les notifs du watcher $uid, sans detail sur le watcher,
         // depuis la semaine dernière, meme ceux sans surveillance, ordonnés
@@ -285,7 +285,7 @@ class WatchSub {
     function update($ind) {
         $this->_data = Array();
         XDB::execute('DELETE FROM watch_sub WHERE uid={?}', $this->_uid);
-        foreach(Env::getMixed($ind) as $key=>$val) {
+        foreach (Env::v($ind) as $key=>$val) {
             XDB::query('INSERT INTO watch_sub SELECT {?},id FROM watch_cat WHERE id={?}', $this->_uid, $key);
             if(mysql_affected_rows()) {
                 $this->_data[$key] = $key;