X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fbanana.php;h=891b5058ff28462a55ebda6b07a898297e764dbc;hb=295d4c48a12e49274135d9f781862a45e5b8c5dc;hp=7a88b9ca5677b29bd486522b5162e499c940b0dd;hpb=1e33266a2f91e1af7a5cb3e8fbbc1c49ff9341f3;p=platal.git diff --git a/modules/banana.php b/modules/banana.php index 7a88b9c..891b505 100644 --- a/modules/banana.php +++ b/modules/banana.php @@ -1,6 +1,6 @@ $this->make_hook('banana', AUTH_COOKIE), 'banana/profile' => $this->make_hook('profile', AUTH_MDP), 'banana/subscription' => $this->make_hook('subscription', AUTH_COOKIE), - 'banana/xface' => $this->make_hook('xface', AUTH_COOKIE), + 'banana/rss' => $this->make_hook('rss', AUTH_PUBLIC, 'user', NO_HTTPS), ); } @@ -59,29 +59,16 @@ class BananaModule extends PLModule function handler_banana(&$page, $group = null, $action = null, $artid = null) { + $page->changeTpl('banana/index.tpl'); + $page->assign('xorg_title','Polytechnique.org - Forums & PA'); + $get = Array(); - if (!is_null($group)) { - $get['group'] = $group; - } if (Post::has('updateall')) { $get['updateall'] = Post::v('updateall'); } - if (!is_null($action)) { - if ($action == 'new') { - $get['action'] = 'new'; - } elseif ($action == 'reply' && !is_null($artid)) { - $get['action'] = 'new'; - $get['artid'] = $artid; - } elseif ($action == 'cancel' && !is_null($artid)) { - $get['action'] = $action; - $get['artid'] = $artid; - } elseif ($action == 'from' && !is_null($artid)) { - $get['first'] = $artid; - } elseif ($action == 'read' && !is_null($artid)) { - $get['artid'] = $artid; - } - } - return BananaModule::run_banana($page, $get); + require_once 'banana/forum.inc.php'; + get_banana_params($get, $group, $action, $artid); + run_banana($page, 'ForumsBanana', $get); } function handler_profile(&$page, $action = null) @@ -96,7 +83,7 @@ class BananaModule extends PLModule { $req = XDB::query(" SELECT nom,mail,sig,if(FIND_IN_SET('threads',flags),'1','0'), - IF(FIND_IN_SET('automaj',flags),'1','0') + IF(FIND_IN_SET('automaj',flags),'1','0') FROM forums.profils WHERE uid = {?}", S::v('uid')); if (!(list($nom,$mail,$sig,$disp,$maj) = $req->fetchOneRow())) { @@ -125,29 +112,47 @@ class BananaModule extends PLModule function handler_subscription(&$page) { - return $this->run_banana($page, Array('subscribe' => 1)); + $page->changeTpl('banana/index.tpl'); + $page->assign('xorg_title','Polytechnique.org - Forums & PA'); + + require_once 'banana/forum.inc.php'; + run_banana($page, 'ForumsBanana', Array('action' => 'subscribe')); } - function handler_xface(&$page, $face = null) + function handler_rss(&$page, $group, $alias, $hash, $file = null) { - header('Content-Type: image/gif'); - passthru('echo ' . escapeshellarg(base64_decode(strtr($face, '.:', '+/'))) - . '| uncompface -X ' - . '| convert -transparent white xbm:- gif:-'); + if (is_null($file)) { + if (is_null($hash)) { + exit; + } + $this->handler_rss($page, null, $group, $alias, $hash); + } + require_once('rss.inc.php'); + $uid = init_rss(null, $alias, $hash); + if (!$uid) { + exit; + } + $res = XDB::query("SELECT id AS uid, alias AS forlife + FROM aliases + WHERE type = 'a_vie' AND id = {?}", $uid); + $row = $res->fetchOneAssoc(); + $_SESSION = array_merge($row, $_SESSION); + + require_once 'banana/forum.inc.php'; + $banana = new ForumsBanana(S::v('forlife'), array('group' => $group, 'action' => 'rss2')); + $banana->run(); + exit; } - function run_banana(&$page, $params = null) + static function run_banana(&$page, $params = null) { $page->changeTpl('banana/index.tpl'); - $page->addCssLink('banana.css'); $page->assign('xorg_title','Polytechnique.org - Forums & PA'); - require_once dirname(__FILE__).'/banana/banana.inc.php'; - - $res = PlatalBanana::run($params); - $page->assign_by_ref('banana', $banana); - $page->assign('banana_res', $res); + require_once 'banana/forum.inc.php'; + run_banana($page, 'ForumsBanana', $params); } } +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?>