=?utf-8?q?Compatibilit=C3=83=C2=A9=20php5
authorx2003bruneau <x2003bruneau@9869982d-c50d-0410-be91-f2a2ec7c7c7b>
Fri, 7 Apr 2006 08:26:37 +0000 (08:26 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 4 Jan 2008 23:34:42 +0000 (00:34 +0100)
=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
banana/groups.inc.php
banana/post.inc.php
banana/spool.inc.php

index 42bb2a7..3cebaed 100644 (file)
@@ -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(); 
index 964682f..909783e 100644 (file)
@@ -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 
index c94b1fd..daea089 100644 (file)
@@ -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()
index 00f787c..afe1a5a 100644 (file)
@@ -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;
+            }
         }
     }