Change redirect function name because it conflicts with platal
[banana.git] / banana / groups.inc.php
index 964682f..9a008e2 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 
@@ -109,14 +119,14 @@ class BananaGroups {
             } elseif ($this->type == BANANA_GROUP_SUB) {
                 $html .= '<td class="new">'.($new ? $new : '-').'</td>';
             }
-            $html .= "<td class='grp'><a href='?group=$g'>$g</a></td><td class='dsc'>{$d[0]}</td></tr>";
+            $html .= '<td class="grp">' . makeHREF(Array('group' => $g), $g) . '</td><td class="dsc">' . $d[0] . '</td></tr>';
         }
 
         $html .= '</table>';
 
         if ($show_form) {
-            return '<form method="post" action="?"><div class="center"><input type="submit" /></div>'
-                .$html.'<div class="center"><input type="submit" /></div></form>';
+            return '<form method="post" action="?"><div class="center"><input type="submit" value="Valider" /></div>'
+                .$html.'<div class="center"><input type="submit" value="Valider" /></div></form>';
         }
         
         return $html;