From d81ff9886830f92030d8fba054eba5ddf77c2d7b Mon Sep 17 00:00:00 2001 From: x2003bruneau Date: Fri, 7 Apr 2006 08:26:37 +0000 Subject: [PATCH] =?utf8?q?=3D=3Futf-8=3Fq=3FCompatibilit=3DC3=3D83=3DC2=3D?= =?utf8?q?A9=3D20php5?= =20A=20l'heure=20actuelle=20seuls=20les=20x-faces=20semblent=20ne=20pas=20passer=20correctement...?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@46 9869982d-c50d-0410-be91-f2a2ec7c7c7b --- banana/NetNNTP.inc.php | 3 +-- banana/groups.inc.php | 22 ++++++++++++++++------ banana/post.inc.php | 9 ++++++--- banana/spool.inc.php | 9 ++++++--- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/banana/NetNNTP.inc.php b/banana/NetNNTP.inc.php index 42bb2a7..3cebaed 100644 --- a/banana/NetNNTP.inc.php +++ b/banana/NetNNTP.inc.php @@ -33,8 +33,7 @@ class nntp $url = parse_url($_url); $this->ns = fsockopen($url['host'], $url['port'], $errno, $errstr, $_timeout); if (!$this->ns) { - $this = false; - return false; + return null; } $result = $this->gline(); diff --git a/banana/groups.inc.php b/banana/groups.inc.php index 964682f..909783e 100644 --- a/banana/groups.inc.php +++ b/banana/groups.inc.php @@ -30,12 +30,26 @@ class BananaGroups { $this->type = $_type; $desc = $banana->nntp->xgtitle(); + + $this->load(); - if ($_type == BANANA_GROUP_NEW) { + if (empty($this->overview) && $_type == BANANA_GROUP_SUB) { + $this->type = BANANA_GROUP_ALL; + $this->load(); + } + } + + /** Load overviews + */ + function load() + { + global $banana; + + if ($this->type == BANANA_GROUP_NEW) { $list = $banana->nntp->newgroups($banana->profile['lastnews']); } else { $list = $banana->nntp->liste(); - if ($_type == BANANA_GROUP_SUB) { + if ($this->type == BANANA_GROUP_SUB) { $mylist = Array(); foreach ($banana->profile['subscribe'] as $g) { if (isset($list[$g])) { @@ -51,10 +65,6 @@ class BananaGroups { $this->overview[$g][1] = $l[0]; } ksort($this->overview); - - if (empty($this->overview) && $_type == BANANA_GROUP_SUB) { - $this = new BananaGroups(BANANA_GROUP_ALL); - } } /** updates overview diff --git a/banana/post.inc.php b/banana/post.inc.php index c94b1fd..daea089 100644 --- a/banana/post.inc.php +++ b/banana/post.inc.php @@ -33,12 +33,15 @@ class BananaPost $this->id = $_id; $this->pj = array(); $this->messages = array(); - $this->_header(); + if (!$this->_header()) { + return null; + } + if ($body = $banana->nntp->body($_id)) { $this->body = join("\n", $body); } else { - return ($this = null); + return null; } if (isset($this->headers['content-transfer-encoding'])) { @@ -263,7 +266,6 @@ class BananaPost global $banana; $hdrs = $banana->nntp->head($this->id); if (!$hdrs) { - $this = null; return false; } @@ -292,6 +294,7 @@ class BananaPost $this->name = $this->headers['from']; $this->name = preg_replace('/<[^ ]*>/', '', $this->name); $this->name = trim($this->name); + return true; } function checkcancel() diff --git a/banana/spool.inc.php b/banana/spool.inc.php index 00f787c..afe1a5a 100644 --- a/banana/spool.inc.php +++ b/banana/spool.inc.php @@ -7,7 +7,7 @@ * Copyright: See COPYING files that comes with this distribution ********************************************************************************/ -if(!function_exists('_file_put_contents')) { +if(!function_exists('file_put_contents')) { function file_put_contents($filename, $data) { $fp = fopen($filename, 'w'); @@ -94,7 +94,7 @@ class BananaSpool global $banana; $this->group = $_group; $groupinfo = $banana->nntp->group($_group); - if (!$groupinfo) { return ($this = null); } + if (!$groupinfo) { return null; } $this->_readFromFile(); @@ -130,7 +130,10 @@ class BananaSpool { $file = $this->_spoolfile(); if (file_exists($file)) { - $this = unserialize(file_get_contents($file)); + $temp = unserialize(file_get_contents($file)); + foreach (get_object_vars($temp) as $key=>$val) { + $this->$key = $val; + } } } -- 2.1.4