X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=inline;f=modules%2Fbanana%2Fbanana.inc.php;h=14422202dcd887189433339e58bd67cfbbdec25d;hb=1d10d3fd659fa8eb7c663d6bb599bc8bbc0feeb3;hp=722da8f99910b18eda976f6733eab373be853da2;hpb=cbc1b9c058fa1abe290822d613359fb07f1b1655;p=platal.git diff --git a/modules/banana/banana.inc.php b/modules/banana/banana.inc.php index 722da8f..1442220 100644 --- a/modules/banana/banana.inc.php +++ b/modules/banana/banana.inc.php @@ -50,7 +50,7 @@ function hook_browsingAction() return null; } return '
' - . 'path . '", "updateall", 1)\'>' + . 'path . '", "updateall", ' . time() . ')\'>' . 'Marquer tous les messages comme lus' . '' . '
'; @@ -59,7 +59,7 @@ function hook_browsingAction() function hook_makeLink($params) { global $globals; $base = $globals->baseurl . '/banana'; - if ($params['subscribe'] == 1) { + if (@$params['subscribe'] == 1) { return $base . '/subscription'; } if (isset($params['xface'])) { @@ -75,9 +75,9 @@ function hook_makeLink($params) { return $base . '/from/' . $params['first']; } if (isset($params['artid'])) { - if ($params['action'] == 'new') { + if (@$params['action'] == 'new') { $base .= '/reply'; - } elseif ($params['action'] == 'cancel') { + } elseif (@$params['action'] == 'cancel') { $base .= '/cancel'; } else { $base .= '/read'; @@ -85,7 +85,7 @@ function hook_makeLink($params) { return $base . '/' . $params['artid']; } - if ($params['action'] == 'new') { + if (@$params['action'] == 'new') { return $base . '/new'; } return $base; @@ -151,8 +151,8 @@ class PlatalBanana extends Banana $this->profile['lastnews'] = S::v('banana_last'); if ($maj) { - XDB::execute("UPDATE auth_user_quick SET banana_last={?} WHERE user_id={?}", - gmdate("YmdHis"), $uid); + XDB::execute("UPDATE auth_user_quick SET banana_last=FROM_UNIXTIME({?}) WHERE user_id={?}", + time(), $uid); } $req = XDB::query(" @@ -175,11 +175,14 @@ class PlatalBanana extends Banana { global $banana; - if (Get::v('banana') == 'updateall' - || (!is_null($params) && isset($params['banana']) && $params['banana'] == 'updateall')) { - XDB::execute('UPDATE auth_user_quick SET banana_last={?} WHERE user_id={?}', - gmdate('YmdHis'), S::v('uid')); - $_SESSION['banana_last'] = time(); + $time = null; + if (!is_null($params) && isset($params['updateall'])) { + $time = (int)$params['updateall']; + } + if (!is_null($time)) { + XDB::execute('UPDATE auth_user_quick SET banana_last=FROM_UNIXTIME({?}) WHERE user_id={?}', + $time, S::v('uid')); + $_SESSION['banana_last'] = $time; } return Banana::run('PlatalBanana', $params); } @@ -204,7 +207,7 @@ class PlatalBanana extends Banana $diff = array_diff($_POST['subscribe'], array_keys($fids)); foreach ($diff as $g) { XDB::execute("INSERT INTO {$globals->banana->table_prefix}list (nom) VALUES ({?})", $g); - $fids[$g] = mysql_insert_id(); + $fids[$g] = XDB::insertId(); } foreach ($_POST['subscribe'] as $g) {