From b8458bd177844d3723acfd334dd30396c3845700 Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Fri, 2 Nov 2007 14:03:26 +0100 Subject: [PATCH] First fast port of banana to PlWizard Signed-off-by: Florent Bruneau --- include/banana/forum.inc.php | 2 +- include/banana/hooks.inc.php | 44 ++++++++++++++++++++++++++++++++++++++++- include/banana/moderate.inc.php | 5 ----- modules/banana.php | 15 +++++++++++++- 4 files changed, 58 insertions(+), 8 deletions(-) diff --git a/include/banana/forum.inc.php b/include/banana/forum.inc.php index 7195d1e..961c6ab 100644 --- a/include/banana/forum.inc.php +++ b/include/banana/forum.inc.php @@ -49,7 +49,7 @@ class ForumsBanana extends Banana if (!S::v('core_rss_hash')) { Banana::$feed_active = false; } - parent::__construct($params); + parent::__construct($params, 'NNTP', 'PlatalBananaPage'); } public function run() diff --git a/include/banana/hooks.inc.php b/include/banana/hooks.inc.php index ed55ec0..05d43cc 100644 --- a/include/banana/hooks.inc.php +++ b/include/banana/hooks.inc.php @@ -141,7 +141,7 @@ function hook_makeLink($params) return $base . '/' . $params['page']; } if (@$params['action'] == 'subscribe') { - return $base . '/subscription'; + return $base . '/subscribe'; } if (!isset($params['group'])) { @@ -253,6 +253,48 @@ function get_banana_params(array &$get, $group = null, $action = null, $artid = } } +class PlatalBananaPage extends BananaPage +{ + public function __construct() + { + Banana::$withtabs = false; + parent::__construct(); + } + + protected function prepare() + { + $tpl = parent::prepare(); + global $wiz, $page; + $wiz = new PlWizard('Banana', 'core/plwizard.tpl', true, false); + foreach ($this->pages as $name=>&$mpage) { + $wiz->addPage('BananaHandler', $mpage['text'], $name); + } + $wiz->apply($page, 'banana', $this->page); + return $tpl; + } +} + +class BananaHandler +{ + public function __construct(PlWizard &$wiz) + { + } + + public function template() + { + return 'banana/index.tpl'; + } + + public function prepare(PlatalPage &$page, $id) + { + } + + public function process() + { + return PlWizard::CURRENT_PAGE; + } +} + function run_banana(&$page, $class, array $args) { $banana = new $class(S::v('forlife'), $args); diff --git a/include/banana/moderate.inc.php b/include/banana/moderate.inc.php index 4931902..83b0fd9 100644 --- a/include/banana/moderate.inc.php +++ b/include/banana/moderate.inc.php @@ -76,8 +76,6 @@ class ModerationBanana extends Banana } } -require_once('banana/page.inc.php'); - class ModerationPage extends BananaPage { protected function prepare() @@ -98,9 +96,6 @@ class ModerationPage extends BananaPage } } -require_once('banana/protocoleinterface.inc.php'); -require_once('banana/message.inc.php'); - class BananaMLInterface implements BananaProtocoleInterface { private $infos; //(list, addr, host, desc, info, diff, ins, priv, sub, own, nbsub) diff --git a/modules/banana.php b/modules/banana.php index 63ce688..7a7548f 100644 --- a/modules/banana.php +++ b/modules/banana.php @@ -25,8 +25,11 @@ class BananaModule extends PLModule { return array( 'banana' => $this->make_hook('banana', AUTH_COOKIE), + 'banana/forums' => $this->make_hook('banana', AUTH_COOKIE), + 'banana/message' => $this->make_hook('message', AUTH_COOKIE), + 'banana/thread' => $this->make_hook('thread', AUTH_COOKIE), 'banana/profile' => $this->make_hook('profile', AUTH_MDP), - 'banana/subscription' => $this->make_hook('subscription', AUTH_COOKIE), + 'banana/subscribe' => $this->make_hook('subscription', AUTH_COOKIE), 'banana/rss' => $this->make_hook('rss', AUTH_PUBLIC, 'user', NO_HTTPS), ); } @@ -71,6 +74,16 @@ class BananaModule extends PLModule run_banana($page, 'ForumsBanana', $get); } + function handler_message(&$page) + { + pl_redirect('banana/' . S::v('banana_group') . '/read/' . S::i('banana_artid')); + } + + function handler_thread(&$page) + { + pl_redirect('banana/' . S::v('banana_group')); + } + function handler_profile(&$page, $action = null) { global $globals; -- 2.1.4