From 559be3d6eeba8a70915da7659dde038c90e83428 Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Fri, 7 Jan 2005 15:01:26 +0000 Subject: [PATCH] we are near 1.0 --- include/banana.inc.php.in | 27 ++++++++------------------- include/misc.inc.php | 19 ++++++++----------- include/post.inc.php | 1 - 3 files changed, 16 insertions(+), 31 deletions(-) diff --git a/include/banana.inc.php.in b/include/banana.inc.php.in index ba24a05..f98aad3 100644 --- a/include/banana.inc.php.in +++ b/include/banana.inc.php.in @@ -40,22 +40,20 @@ class Banana 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 '

'._b_('Impossible de contacter le serveur').'

'; + } - $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); @@ -293,15 +291,6 @@ $this->profile['lastnews'] = time() - 24*3600*7; $this->newgroups = new BananaGroups(BANANA_GROUP_NEW); } } - - function _setupProfile() - { - if (function_exists('hook_getprofile')) { - $this->profile = hook_getprofile(); - } - - setlocale(LC_ALL, $this->profile['locale']); - } } ?> diff --git a/include/misc.inc.php b/include/misc.inc.php index aaad5b0..bdac4fa 100644 --- a/include/misc.inc.php +++ b/include/misc.inc.php @@ -39,8 +39,9 @@ function header_translate($hdr) { 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; } @@ -87,8 +88,10 @@ function formatDisplayHeader($_header,$_text) { return '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); } @@ -139,15 +142,9 @@ function formatFrom($text) { function displayshortcuts($first = -1) { global $banana; - - $res = '
'; - - if (function_exists('hook_displayshortcuts')) { - $res .= hook_displayshortcuts($sname, $first); - } - extract($banana->state); + $res = '
'; $res .= '['._b_('Liste des forums').'] '; if (is_null($group)) { return $res.'
'; diff --git a/include/post.inc.php b/include/post.inc.php index 4df89da..499d56b 100644 --- a/include/post.inc.php +++ b/include/post.inc.php @@ -86,7 +86,6 @@ class BananaPost function checkcancel() { - return true; if (function_exists('hook_checkcancel')) { return hook_checkcancel($this->headers); } -- 2.1.4