X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=examples%2Findex.php;h=4419ee3d9eb632994c725b27d9ac3c0192914b2a;hb=6f5d05aef05cc1e107a50b8a62e4432dea70bc60;hp=5ce833e9d4eedf81b84dafaaf169c40b76d2dbf9;hpb=05114a3e055d9c5997e7f1c03568ac24a78ae4d8;p=banana.git diff --git a/examples/index.php b/examples/index.php index 5ce833e..4419ee3 100644 --- a/examples/index.php +++ b/examples/index.php @@ -30,6 +30,31 @@ class MyBanana extends Banana } } +// Implements storage of a list of read messages +// (this is only an example of what is possible) +function hook_listReadMessages($group) +{ + if (!isset($_COOKIE['banana_read'])) { + return null; + } + $msgs = unserialize(gzinflate(base64_decode($_COOKIE['banana_read']))); + return array_keys($msgs); +} + +function hook_markAsRead($group, $artid, $msg) +{ + $msgs = array(); + if (isset($_COOKIE['banana_read'])) { + $msgs = unserialize(gzinflate(base64_decode($_COOKIE['banana_read']))); + } + $id = $msg->getHeader('message-id'); + $msgs[$id] = true; + $msgs = base64_encode(gzdeflate(serialize($msgs))); + setcookie('banana_read', $msgs, 0); + $_COOKIE['banana_read'] = $msgs; +} + + // Minimalist login if ((@$_GET['action'] == 'rss2') || (!isset($_SESSION['banana_email']) || isset($_POST['change_login']) || isset($_POST['valid_change']))) {