X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fbanana%2Fhooks.inc.php;h=987de1369c2ad4629402d65a138c17bfb15c7a67;hb=04334c61ffd1e63616503bf52e90174adaa3cc86;hp=f996497c17a5966df56195f8a8cf41bbc7832b84;hpb=bd4d80f0846bcc0dd943bd561c77680f18bae831;p=platal.git diff --git a/include/banana/hooks.inc.php b/include/banana/hooks.inc.php index f996497..987de13 100644 --- a/include/banana/hooks.inc.php +++ b/include/banana/hooks.inc.php @@ -1,6 +1,6 @@ name() == 'NNTP' && $xnet) { if ($feed) { - return 'http://www.polytechnique.org/banana' . hook_platalRSS(@$params['group']); + return $globals->baseurl . '/banana' . hook_platalRSS(@$params['group']); } $base = $globals->baseurl . '/' . $platal->ns . 'forum'; } else if (Banana::$protocole->name() == 'MLArchives') { @@ -194,7 +194,8 @@ function hook_getXFace($headers) return false; } } - pl_redirect('photo/' . $login); + global $globals; + http_redirect($global->baseurl . '/photo/' . $login); } function hook_makeJs($src) @@ -204,8 +205,43 @@ function hook_makeJs($src) return ' '; } +function make_Organization() +{ + global $globals; + $perms = S::v('perms'); + $group = $globals->asso('nom'); + if (S::has_perms()) { + return "Administrateur de Polytechnique.org"; + } else if ($group && $perms->hasFlag('groupadmin')) { + return "Animateur de $group"; + } else if ($group && $perms->hasFlag('groupmember')) { + return "Membre de $group"; + } + return "Utilisateur de Polytechnique.org"; +} + function get_banana_params(array &$get, $group = null, $action = null, $artid = null) { + if ($group == 'forums') { + $group = null; + } else if ($group == 'thread') { + $group = S::v('banana_group'); + } else if ($group == 'message') { + $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; + $get['action'] = 'subscribe'; + } else if ($group == 'profile') { + $group = null; + $action = null; + $get['action'] = 'profile'; + } if (!is_null($group)) { $get['group'] = $group; } @@ -237,6 +273,54 @@ 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); + foreach ($this->pages as $name=>&$mpage) { + $wiz->addPage($this->handler, $mpage['text'], $name); + } + $wiz->apply($page, $this->base, $this->page); + return $tpl; + } +} + +class BananaHandler +{ + public function __construct(PlWizard &$wiz) + { + } + + public function template() + { + return 'banana/index.tpl'; + } + + public function prepare(PlPage &$page, $id) + { + } + + public function process() + { + return PlWizard::CURRENT_PAGE; + } +} + function run_banana(&$page, $class, array $args) { $banana = new $class(S::v('forlife'), $args);