Fix warnings
authorx2003bruneau <x2003bruneau@9869982d-c50d-0410-be91-f2a2ec7c7c7b>
Tue, 30 Oct 2007 22:20:05 +0000 (22:20 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 4 Jan 2008 23:35:55 +0000 (00:35 +0100)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@294 9869982d-c50d-0410-be91-f2a2ec7c7c7b

banana/spool.inc.php
banana/tree.inc.php

index b6355b8..04c6f7c 100644 (file)
@@ -344,7 +344,7 @@ class BananaSpool
      */
     public function &getTree($id)
     {
-        return BananaTree::build($id)->data;
+        return BananaTree::build($id)->show();
     }
 
     /** Mark the given id as read
@@ -352,12 +352,13 @@ class BananaSpool
      */
     public function markAsRead($id)
     {
-        if (!$this->overview[$id]->isread) {
-            $this->overview[$id]->isread = true;
+        $overview =& $this->overview[$id];
+        if (!$overview->isread) {
+            $overview->isread = true;
             $this->unreadnb--;
-            while (isset($id)) {
-                $this->overview[$id]->descunread--;
-                $id = $this->overview[$id]->parent;
+            while (!is_null($overview)) {
+                $overview->descunread--;
+                $overview =& $overview->parent;
             }
         }
     }
index f780bcd..6db3c44 100644 (file)
@@ -102,6 +102,13 @@ class BananaTree
         file_put_contents(BananaTree::filename($id), serialize($this));
     }
 
+    /** Return html to display the tree
+     */
+    public function &show()
+    {
+        return $this->data;
+    }
+
     /** Get filename
      */
     static private function filename($id)