X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fbanana%2Fhooks.inc.php;h=6c4f19d82fca3e6ac916b55cc068dea032bd50ae;hb=be638e733bce413df4324d985297d9a4d94dcbca;hp=ef22186586fcb51240709ed9f322122b3b9e3aac;hpb=b5163f5283aabcf6a68cb12c6ad81334e4a52b59;p=platal.git diff --git a/include/banana/hooks.inc.php b/include/banana/hooks.inc.php index ef22186..6c4f19d 100644 --- a/include/banana/hooks.inc.php +++ b/include/banana/hooks.inc.php @@ -1,6 +1,6 @@ id()); if ($res->numRows()) { + // User wants his xface to be showed, fallback to default handler return false; } } @@ -200,8 +205,7 @@ function hook_getXFace($headers) function hook_makeJs($src) { - global $page; - $page->addJsLink("$src.js"); + Platal::page()->addJsLink("$src.js"); return ' '; } @@ -230,6 +234,9 @@ function get_banana_params(array &$get, $group = null, $action = null, $artid = $action = 'read'; $group = S::v('banana_group'); $artid = S::i('banana_artid'); + } else if ($action == 'message') { + $action = 'read'; + $artid = S::i('banana_artid'); } else if ($group == 'subscribe' || $group == 'subscription') { $group = null; $action = null; @@ -272,25 +279,27 @@ function get_banana_params(array &$get, $group = null, $action = null, $artid = class PlatalBananaPage extends BananaPage { + protected $handler; + protected $base; + public function __construct() { + global $platal; Banana::$withtabs = false; + $this->handler = 'BananaHandler'; + $this->base = $platal->pl_self(0); parent::__construct(); } protected function prepare() { $tpl = parent::prepare(); - global $wiz, $page; - $wiz = new PlWizard('Banana', 'core/plwizard.tpl', true, false); + global $wiz; + $wiz = new PlWizard('Banana', PlPage::getCoreTpl('plwizard.tpl'), true, false); foreach ($this->pages as $name=>&$mpage) { - if ($text == 'profile') { - $wiz->addPage('BananaProfile', $mpage['text'], $name); - } else { - $wiz->addPage('BananaHandler', $mpage['text'], $name); - } + $wiz->addPage($this->handler, $mpage['text'], $name); } - $wiz->apply($page, 'banana', $this->page); + $wiz->apply(Platal::page(), $this->base, $this->page); return $tpl; } } @@ -306,7 +315,7 @@ class BananaHandler return 'banana/index.tpl'; } - public function prepare(PlatalPage &$page, $id) + public function prepare(PlPage &$page, $id) { } @@ -318,7 +327,8 @@ class BananaHandler function run_banana(&$page, $class, array $args) { - $banana = new $class(S::v('forlife'), $args); + $user =& S::user(); + $banana = new $class($user, $args); $page->assign('banana', $banana->run()); $page->addCssInline($banana->css()); $page->addCssLink('banana.css');