X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=modules%2Fbanana%2Fbanana.inc.php;h=ed09290978ad1a40cfe55236872204691a90eeb9;hb=949741c3913f01ebd532d2cb801a4bc15df65436;hp=5fcc67a5c873befb6e4e33877a98f5b98dafab0e;hpb=1f8bb12ed1315b4f00122a301bef1c7011c4f9ac;p=platal.git diff --git a/modules/banana/banana.inc.php b/modules/banana/banana.inc.php index 5fcc67a..ed09290 100644 --- a/modules/banana/banana.inc.php +++ b/modules/banana/banana.inc.php @@ -41,10 +41,25 @@ function hook_shortcuts() 'Préférences')); } +function hook_browsingAction() +{ + global $platal, $banana; + $page = $banana->state['page']; + if ((@$page != 'message' && @$page != 'group' && @$page != 'forums') + || $banana->profile['autoup']) { + return null; + } + return '
' + . 'path . '", "updateall", ' . time() . ')\'>' + . 'Marquer tous les messages comme lus' + . '' + . '
'; +} + 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'])) { @@ -60,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'; @@ -70,7 +85,7 @@ function hook_makeLink($params) { return $base . '/' . $params['artid']; } - if ($params['action'] == 'new') { + if (@$params['action'] == 'new') { return $base . '/new'; } return $base; @@ -136,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(" @@ -160,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); }