<?php
/***************************************************************************
- * Copyright (C) 2003-2008 Polytechnique.org *
+ * Copyright (C) 2003-2009 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
} else {
$group = '';
}
- return '/rss/' . $group . S::v('hruid') . '/' . S::v('core_rss_hash') . '/rss.xml';
+ return '/rss/' . $group . S::v('hruid') . '/' . S::s('token') . '/rss.xml';
}
function hook_platalMessageLink($params)
function hook_getXFace($headers)
{
- $login = @$headers['x-org-id'];
- if (!$login) {
- @list($login, ) = explode('@', $headers['x-org-mail']);
+ $login = null;
+ foreach (array('x-org-id', 'x-org-mail') as $key) {
+ if (isset($headers[$key])) {
+ $login = $headers[$key];
+ break;
+ }
}
- if (!$login) {
+ if (is_null($login)) {
+ // No login, fallback to default handler
return false;
}
if (isset($headers['x-face'])) {
- $res = XDB::query("SELECT p.uid
- FROM forums.profils AS p
- INNER JOIN aliases AS a ON (p.uid = a.id)
- WHERE FIND_IN_SET('xface', p.flags) AND a.alias = {?}",
- $login);
+ $user = User::getSilent($login);
+ $res = XDB::query('SELECT pf.uid
+ FROM forum_profiles AS pf
+ WHERE pf.uid = {?} AND FIND_IN_SET(\'xface\', pf.flags)',
+ $user->id());
if ($res->numRows()) {
+ // User wants his xface to be showed, fallback to default handler
return false;
}
}
function hook_makeJs($src)
{
- global $page;
- $page->addJsLink("$src.js");
+ Platal::page()->addJsLink("$src.js");
return ' ';
}
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) {
$wiz->addPage($this->handler, $mpage['text'], $name);
}
- $wiz->apply($page, $this->base, $this->page);
+ $wiz->apply(Platal::page(), $this->base, $this->page);
return $tpl;
}
}
return 'banana/index.tpl';
}
- public function prepare(PlatalPage &$page, $id)
+ public function prepare(PlPage &$page, $id)
{
}
function run_banana(&$page, $class, array $args)
{
- $banana = new $class(S::user(), $args);
+ $user =& S::user();
+ $banana = new $class($user, $args);
$page->assign('banana', $banana->run());
$page->addCssInline($banana->css());
$page->addCssLink('banana.css');