function Banana()
{
require_once('include/NetNNTP.inc.php');
- $this->_setupProfile();
+ setlocale(LC_ALL, $this->profile['locale']);
$this->nntp = new nntp($this->host);
-
-$this->profile['subscribe'][] = 'xorg.general';
-$this->profile['subscribe'][] = 'xorg.test';
-$this->profile['subscribe'][] = 'xorg.promo.x1970';
-$this->profile['lastnews'] = time() - 24*3600*7;
-
}
- function run()
+ function run($class = 'Banana')
{
- require_once("include/misc.inc.php");
global $banana;
+ require_once("include/misc.inc.php");
+ $banana = new $class();
+
+ if (!$banana->nntp) {
+ return '<p class="error">'._b_('Impossible de contacter le serveur').'</p>';
+ }
- $banana = new Banana();
$group = empty($_GET['group']) ? null : strtolower($_GET['group']);
$artid = empty($_GET['artid']) ? null : strtolower($_GET['artid']);
$banana->state = Array ('group' => $group, 'artid' => $artid);
$this->newgroups = new BananaGroups(BANANA_GROUP_NEW);
}
}
-
- function _setupProfile()
- {
- if (function_exists('hook_getprofile')) {
- $this->profile = hook_getprofile();
- }
-
- setlocale(LC_ALL, $this->profile['locale']);
- }
}
?>
case 'references': return _b_('Références');
case 'x-face': return _b_('Image');
default:
- if (function_exists('hook_header_translate')) {
- return hook_header_translate($hdr);
+ if (function_exists('hook_headerTranslate')
+ && $res = hook_headerTranslate($hdr)) {
+ return $res;
}
return $hdr;
}
return '<img src="xface.php?face='.base64_encode($_text).'" alt="x-face" />';
default:
- if (function_exists('hook_formatDisplayHeader')) {
- return hook_formatDisplayHeader($_header, $_text);
+ if (function_exists('hook_formatDisplayHeader')
+ && $res = hook_formatDisplayHeader($_header, $_text))
+ {
+ return $res;
}
return htmlentities($_text);
}
function displayshortcuts($first = -1) {
global $banana;
-
- $res = '<div class="banana_scuts">';
-
- if (function_exists('hook_displayshortcuts')) {
- $res .= hook_displayshortcuts($sname, $first);
- }
-
extract($banana->state);
+ $res = '<div class="banana_scuts">';
$res .= '[<a href="?">'._b_('Liste des forums').'</a>] ';
if (is_null($group)) {
return $res.'</div>';