X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fbanana.php;h=8193a4375014f57540d72ed586825d91f3ffb9b9;hb=f3da6d81799c3ee012f1ca5f86aac9fc01d5818e;hp=9a1ebca24bed389ed5f66b16da70bc337bffd072;hpb=24cec3d821a65b3b4a116d41bf393bae35dcb7e4;p=platal.git diff --git a/modules/banana.php b/modules/banana.php index 9a1ebca..8193a43 100644 --- a/modules/banana.php +++ b/modules/banana.php @@ -27,7 +27,7 @@ class BananaModule extends PLModule 'banana' => $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), ); } @@ -36,11 +36,11 @@ class BananaModule extends PLModule $cible = array('xorg.general', 'xorg.pa.divers', 'xorg.pa.logements'); $p_for = "xorg.promo.x$promo"; - // récupération de l'id du forum promo + // récupération de l'id du forum promo $res = XDB::query("SELECT fid FROM forums.list WHERE nom={?}", $p_for); if ($res->numRows()) { $cible[] = $p_for; - } else { // pas de forum promo, il faut le créer + } else { // pas de forum promo, il faut le créer $res = XDB::query("SELECT SUM(perms IN ('admin','user') AND deces=0),COUNT(*) FROM auth_user_md5 WHERE promo={?}", $promo); list($effau, $effid) = $res->fetchOneRow(); @@ -59,36 +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; - $get['part'] = @$_GET['part']; - } elseif ($action == 'source' && !is_null($artid)) { - $get['artid'] = $artid; - $get['part'] = 'source'; - } elseif ($action == 'xface' && !is_null($artid)) { - $get['artid'] = $artid; - $get['part'] = 'xface'; - } - } - 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) @@ -132,30 +112,47 @@ class BananaModule extends PLModule function handler_subscription(&$page) { - return $this->run_banana($page, Array('action' => 'subscribe')); + $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; } 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 'banana/forum.inc.php'; - - $banana = new PlatalForums($params); - $res = $banana->run(); - $page->assign_by_ref('banana', $banana); - $page->assign('banana_res', $res); + run_banana($page, 'ForumsBanana', $params); } } +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?>