prepare banana to be a library
authorx2000habouzit <x2000habouzit>
Tue, 4 Jan 2005 16:43:49 +0000 (16:43 +0000)
committerx2000habouzit <x2000habouzit>
Tue, 4 Jan 2005 16:43:49 +0000 (16:43 +0000)
article.php
css/style.css
include/NetNNTP.inc.php
include/groups.inc.php
include/misc.inc.php
include/post.inc.php
include/spool.inc.php
index.php
thread.php

index ff4c8dd..ed10a48 100644 (file)
@@ -17,21 +17,8 @@ if (isset($_REQUEST['id'])) {
     $id = htmlentities(strtolower($_REQUEST['id']));
 }
 
-$banana->newSpool($group, $banana->profile['display'], $banana->profile['lastnews']);
-$banana->newPost($id);
-if (!$banana->post) {
-    if ($banana->nntp->lasterrorcode == "423") {
-        $banana->spool->delid($id);
-    }
-    error("nntpart");
-}
-
-$ndx = $banana->spool->getndx($id);
-
-?>
-<h1><?php echo _b_('Message'); ?></h1>
+echo $banana->action_showArticle($group, $id);
 
-<?php
 if (isset($_GET['type']) && $_GET['type']=='cancel' && $banana->post->checkcancel()) {
 ?>
 <p class="<?php echo $css['error']?>">
@@ -46,54 +33,5 @@ if (isset($_GET['type']) && $_GET['type']=='cancel' && $banana->post->checkcance
 <?
 }
 
-displayshortcuts();
-?>
-
-<table class="<?php echo $css['bicol']?>" cellpadding="0" cellspacing="0" 
-summary="<?php echo _b_('Contenu du message'); ?>">
-  <tr>
-    <th colspan="2">
-      <?php echo _b_('En-têtes'); ?>
-    </th>
-  </tr>
-<?php
-    foreach ($banana->show_hdr as $hdr) {
-        if (isset($banana->post->headers[$hdr])) {
-            $res = formatdisplayheader($hdr, $banana->post->headers[$hdr]);
-            if ($res)
-                echo "<tr><td class=\"{$css['bicoltitre']}\">".header_translate($hdr)."</td>"
-                    ."<td>$res</td></tr>\n";
-        }
-    }
-?>
-  <tr>
-    <th colspan="2">
-      <?php echo _b_('Corps'); ?>
-    </th>
-  </tr> 
-  <tr>
-    <td colspan="2">
-      <pre><?php echo formatbody($banana->post->body); ?></pre>
-    </td>
-  </tr>
-  <tr>
-    <th colspan="2">
-      <?php echo _b_('Aperçu'); ?>
-    </th>
-  </tr> 
-  <tr>
-    <td class="<?php echo $css['nopadd']?>" colspan="2">
-      <table class="<?php echo $css['overview']?>" cellpadding="0" 
-      cellspacing="0" summary="overview">
-<?php
-$banana->spool->disp($ndx-$banana->tbefore,$ndx+$banana->tafter,$ndx);
-?>
-      </table>
-    </td>
-  </tr>
-</table>
-<?php
-displayshortcuts();
-
 require_once("include/footer.inc.php");
 ?>
index 19caebe..0b698c9 100644 (file)
 * Copyright: See COPYING files that comes with this distribution
 ********************************************************************************/
 
-body {
-    color: black;
-    background-color: white;
-    width: 800px;
-    margin-left: auto;
-    margin-right: auto;
-}
+div.banana_scuts { text-align: left; padding: 0.5em 0em; }
 
-a:link    { color: blue; background: inherit; }
-a:visited { color: blue; background: inherit; }
-a:hover   { color: blue; background: inherit; text-decoration: underline; }
+/** GROUP LIST **/
 
-h1 {
-  font-size: 200%;
-  text-align: center;
-  padding-bottom: 1em;
-}
+table.banana_group td.new { text-align: center; }
+table.banana_group td.all { text-align: center; }
+table.banana_group td.grp { text-align: left; }
+table.banana_group td.dsc { text-align: left; }
 
-div.bloc {
-  width: 100%;
-}
+/** THREAD VIEW **/
 
-p.footer {
-  border-top: 1px #DDDDDD solid;
-}
+table.banana_thread td { white-space: nowrap; height: 100%; vertical-align: middle; }
 
-div.shortcuts {
-  text-align: left;
-  padding-bottom: 1em;
-  padding-top: 1em;
-}
+table.banana_thread tr.new { font-weight: bold; }
 
-div.tree {
-  float: left;
-  padding-right: 0.3em;
-}
+table.banana_thread td.date { text-align: center; }
+table.banana_thread td.subj { text-align: left; overflow: hidden; }
+table.banana_thread td.from { text-align: left; }
 
-span.isref {
-  font-style: italic;
-}
+table.banana_thread div.tree { float: left; padding-right: 0.3em; }
+table.banana_thread span.cur { font-style: italic; font-size: 90%; }
 
-table.bicol {
-  background-color: #eeeeee;
-  color: inherit;
-  border: 1px solid #336699;
-  border-collapse: collapse;
-  width: 100%;
-}
+/** MESSAGE VIEW **/
 
-table.bicol tr.impair {}
-
-table.bicol tr.pair {
-  background-color: #eeeed0;
-  color: inherit;
-}
-
-table.bicol th {
-  background-color: #336699;
-  color: #FFFFFF;
-  font-weight: bold;
-  text-align: center;
-  vertical-align: middle;
-}
-
-table.bicol td {
-  color: #000000;
-  background-color: inherit;
-  padding-left: 0.4em;
-  padding-right: 0.4em;
-}
-
-table.bicol td.nopadd {
-  padding-left: 0em;
-  padding-right: 0em;
-}
-
-table.bicol td.total,td.unread,td.date {
-  text-align: center;
-  padding-left: 0.1em;
-  padding-right: 0.1em;
-}
-
-table.bicol td.subject,td.group,td.from,td.description {
-  text-align: left;
-}
-
-table.bicol td.bicoltitre,span.bicoltitre {
-  color: #000000;
-  background-color: inherit;
-  font-weight: bold;
-}
-
-table.bicol td.bouton {
-  text-align: right;
-}
-
-table.overview {
-  background-color: #eeeeee;
-  color: inherit;
-  width: 100%;
-}
-
-table.overview tr.impair {}
-
-table.overview tr.pair {
-  background-color: #eeeed0;
-  color: inherit;
-}
-
-table.overview th {
-  background-color: #336699;
-  color: #FFFFFF;
-  font-weight: bold;
-  text-align: center;
-  vertical-align: middle;
-}
-
-table.overview td {
-  color: #000000;
-  background-color: inherit;
-  padding-left: 0.4em;
-  padding-right: 0.4em;
-}
-
-table.overview td.subject,td.group,td.from,td.description {
-  text-align: left;
-}
-
-table.overview .new { font-weight: bold; }
+table.banana_msg td.thrd { padding: 0px; }
+table.banana_msg table { border: 0px; padding: 0px; margin: 0px; width: 100%; }
 
index 2e8cf0f..c5c62de 100644 (file)
@@ -58,7 +58,7 @@ class nntp
 
     function gline()
     {
-        return trim(fgets($this->ns, 1200));
+        return rtrim(fgets($this->ns, 1200));
     }
 
     /** puts a line on server
@@ -316,6 +316,7 @@ class nntp
         $this->pline("LIST\r\n");
         if (substr($this->gline(), 0, 1)!="2") return false;
         $result = $this->gline();
+        $array = Array();
         while ($result != ".") {
             preg_match("/([^ ]+) (\d+) (\d+) (.)/", $result, $regs);
             $array[$regs[1]] = array(intval($regs[2]), intval($regs[3]), intval($regs[4]));
@@ -367,10 +368,8 @@ class nntp
         if (substr($this->gline(), 0, 1)!="2") {
             return false;
         }
-        $result = $this->gline();
-        while ($result != ".") {
-            $array[] =  $result;
-            $result  = $this->gline();
+        while (($result = $this->gline()) != ".") {
+            $array[] = $result;
         }
         return $array;
     }
index f7ab98f..b86e9f0 100644 (file)
 /** class for group lists
  */
 
+define ( 'BANANA_GROUP_ALL', 0 );
+define ( 'BANANA_GROUP_SUB', 1 );
+define ( 'BANANA_GROUP_NEW', 2 );
 class BananaGroups {
     /** group list */
-    var $overview;
+    var $overview = Array();
     /** last update */
     var $date;
 
+    var $type;
+
     /** constructor
      */
 
-    function BananaGroups($_type=0) {
+    function BananaGroups($_type = BANANA_GROUP_SUB) {
         global $banana;
-        $desc = $banana->nntp->xgtitle();
-        if ($_type==1) {
+
+        $this->type = $_type;
+        $desc       = $banana->nntp->xgtitle();
+        
+        if ($_type == BANANA_GROUP_NEW) {
             $list = $banana->nntp->newgroups($banana->profile['lastnews']);
         } else {
             $list = $banana->nntp->liste();
-            if ($_type == 0) {
-                $Mylist = Array();
+            if ($_type == BANANA_GROUP_SUB) {
+                $mylist = Array();
                 foreach ($banana->profile['subscribe'] as $g) {
                     if (isset($list[$g])) {
                         $mylist[$g] = $list[$g];
@@ -36,15 +45,16 @@ class BananaGroups {
                 $list = $mylist;
             }
         }
-        if (empty($list)) {
-            $this->overview=array();
-            return false;
-        }
 
         foreach ($list as $g=>$l) {
             $this->overview[$g][0] = isset($desc[$g]) ? $desc[$g] : '-';
             $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 
@@ -65,6 +75,39 @@ class BananaGroups {
         }
         return true;
     }
+
+    function to_html()
+    {
+        global $banana;
+        if (empty($this->overview)) {
+            return;
+        }
+
+        $html  = '<table class="bicol banana_group" cellspacing="0" cellpadding="2">'."\n";
+        $html .= '<tr><th>'._b_('Total').'</th><th>';
+        if ($this->type == BANANA_GROUP_SUB) {
+            $html .= _b_('Nouveaux').'</th><th>';
+        }
+        $html .= _b_('Nom').'</th><th>'._b_('Description').'</th></tr>'."\n";
+
+        $b = true;
+        foreach ($this->overview as $g => $d) {
+            $b     = !$b;
+            $ginfo = $banana->nntp->group($g);
+            $new   = count($banana->nntp->newnews($banana->profile['lastnews'],$g));
+
+            $html .= '<tr class="'.($b ? 'pair' : 'impair').'">'."\n";
+            $html .= "<td class='all'>{$ginfo[0]}</td>";
+            if ($this->type == BANANA_GROUP_SUB) {
+                $html .= '<td class="new">'.($new ? $new : '-').'</td>';
+            }
+            $html .= "<td class='grp'><a href='thread.php?group=$g'>$g</a></td><td class='dsc'>{$d[0]}</td></tr>";
+        }
+        
+        $html .= '</table>';
+
+        return $html;
+    }
 }
 
 ?>
index 88bb39e..b20fce5 100644 (file)
  *  MISC
  */
 
+function mtime() 
+{ 
+    global $time;
+    list($usec, $sec) = explode(" ", microtime()); 
+    $time[] = ((float)$usec + (float)$sec); 
+} 
+
+mtime();
+
 function _b_($str) { return utf8_decode(dgettext('banana', utf8_encode($str))); }
 
 /********************************************************************************
@@ -141,24 +150,24 @@ function displayshortcuts($first = -1) {
     global $banana, $css;
     $sname = basename($_SERVER['SCRIPT_NAME']);
 
-    echo "<div class=\"{$css['bananashortcuts']}\">";
+    $res = '<div class="banana_scuts">';
 
     if (function_exists('hook_displayshortcuts')) {
-        hook_displayshortcuts($sname, $first);
+        $res .= hook_displayshortcuts($sname, $first);
     } else {
-        echo '[<a href="disconnect.php">'._b_('Déconnexion').'</a>] ';
+        $res .= '[<a href="disconnect.php">'._b_('Déconnexion').'</a>] ';
     }
 
     switch ($sname) {
         case 'thread.php' :
-            echo '[<a href="index.php">'._b_('Liste des forums').'</a>] ';
-            echo "[<a href=\"post.php?group={$banana->spool->group}\">"._b_('Nouveau message')."</a>] ";
+            $res .= '[<a href="index.php">'._b_('Liste des forums').'</a>] ';
+            $res .= "[<a href=\"post.php?group={$banana->spool->group}\">"._b_('Nouveau message')."</a>] ";
             if (sizeof($banana->spool->overview)>$banana->tmax) {
                 for ($ndx=1; $ndx<=sizeof($banana->spool->overview); $ndx += $banana->tmax) {
                     if ($first==$ndx) {
-                        echo "[$ndx-".min($ndx+$banana->tmax-1,sizeof($banana->spool->overview))."] ";
+                        $res .= "[$ndx-".min($ndx+$banana->tmax-1,sizeof($banana->spool->overview))."] ";
                     } else {
-                        echo "[<a href=\"?group={$banana->spool->group}&amp;first="
+                        $res .= "[<a href=\"?group={$banana->spool->group}&amp;first="
                             ."$ndx\">$ndx-".min($ndx+$banana->tmax-1,sizeof($banana->spool->overview))
                             ."</a>] ";
                     }
@@ -166,21 +175,23 @@ function displayshortcuts($first = -1) {
             }
             break;
         case 'article.php' :
-            echo '[<a href="index.php">'._b_('Liste des forums').'</a>] ';
-            echo "[<a href=\"thread.php?group={$banana->spool->group}\">{$banana->spool->group}</a>] ";
-            echo "[<a href=\"post.php?group={$banana->spool->group}&amp;id={$banana->post->id}&amp;type=followup\">"
+            $res .= '[<a href="index.php">'._b_('Liste des forums').'</a>] ';
+            $res .= "[<a href=\"thread.php?group={$banana->spool->group}\">{$banana->spool->group}</a>] ";
+            $res .= "[<a href=\"post.php?group={$banana->spool->group}&amp;id={$banana->post->id}&amp;type=followup\">"
                 ._b_('Répondre')."</a>] ";
             if ($banana->post->checkcancel()) {
-                echo "[<a href=\"article.php?group={$banana->spool->group}&amp;id={$banana->post->id}&amp;type=cancel\">"
+                $res .= "[<a href=\"article.php?group={$banana->spool->group}&amp;id={$banana->post->id}&amp;type=cancel\">"
                     ._b_('Annuler ce message')."</a>] ";
             }
             break;
         case 'post.php' :
-            echo '[<a href="index.php">'._b_('Liste des forums').'</a>] ';
-            echo "[<a href=\"thread.php?group={$banana->spool->group}\">{$banana->spool->group}</a>]";
+            $res .= '[<a href="index.php">'._b_('Liste des forums').'</a>] ';
+            $res .= "[<a href=\"thread.php?group={$banana->spool->group}\">{$banana->spool->group}</a>]";
             break;
     }
-    echo '</div>';
+    $res .= '</div>';
+
+    return $res;
 }
 
 /********************************************************************************
index cfe5ef3..b855a3b 100644 (file)
@@ -80,13 +80,39 @@ class BananaPost
         $this->name = trim($this->name);
     }
 
-    function checkcancel() {
+    function checkcancel()
+    {
         if (function_exists('hook_checkcancel')) {
             return hook_checkcancel($this->headers);
         }
         return ($this->headers['from'] == $_SESSION['name']." <".$_SESSION['mail'].">");
     }
 
+    function to_html()
+    {
+        global $banana;
+
+        $res  = '<table class="bicol banana_msg" cellpadding="0" cellspacing="0">';
+        $res .= '<tr><th colspan="2">'._b_('En-têtes').'</th></tr>';
+
+        foreach ($banana->show_hdr as $hdr) {
+            if (isset($this->headers[$hdr])) {
+                $res2 = formatdisplayheader($hdr, $this->headers[$hdr]);
+                if ($res2) {
+                    $res .= '<tr><td class="hdr">'.header_translate($hdr)."</td><td class='val'>$res2</td></tr>\n";
+                }
+            }
+        }
+
+        $res .= '<tr><th colspan="2">'._b_('Corps').'</th></tr>';
+        $res .= '<tr><td colspan="2"><pre>'.formatbody($this->body).'</pre></td></tr>';
+        
+        $res .= '<tr><th colspan="2">'._b_('apercu').'</th></tr>';
+        $ndx  = $banana->spool->getndx($this->id);
+        $res .= '<tr><td class="thrd" colspan="2">'.$banana->spool->to_html($ndx-$banana->tbefore, $ndx+$banana->tafter, $ndx).'</td></tr>';
+
+        return $res.'</table>';
+    }
 }
 
 ?>
index fdea6bf..f8e6788 100644 (file)
@@ -286,9 +286,8 @@ class BananaSpool
      * @param $_head BOOLEAN true if first post in thread
      */
 
-    function _disp_desc($_id, $_index, $_first=0, $_last=0, $_ref="", $_pfx_node="", $_pfx_end="", $_head=true)
+    function _to_html($_id, $_index, $_first=0, $_last=0, $_ref="", $_pfx_node="", $_pfx_end="", $_head=true)
     {
-        global $css;
         $spfx_f   = '<img src="img/k1.gif" height="21" width="9" alt="o" />'; 
         $spfx_n   = '<img src="img/k2.gif" height="21" width="9" alt="*" />'; 
         $spfx_Tnd = '<img src="img/T-direct.gif" height="21" width="12" alt="+" />';
@@ -304,43 +303,46 @@ class BananaSpool
             return;
         }
 
+        $res = '';
+
         if ($_index>=$_first) {
-            $us = ($_index == $_ref);
             $hc = empty($this->overview[$_id]->children);
 
-            echo '<tr class="'.($_index%2?$css["pair"]:$css["impair"]).($this->overview[$_id]->isread?'':' new')."\">\n";
-            echo "<td class=\"{$css['date']}\">".fancyDate($this->overview[$_id]->date)." </td>\n";
-            echo "<td class=\"{$css['subject']}\">"
-                ."<div class=\"{$css['tree']}\">$_pfx_node".($hc?($_head?$spfx_f:($this->overview[$_id]->parent_direct?$spfx_s:$spfx_snd)):$spfx_n)
+            $res .= '<tr class="'.($_index%2?'pair':'impair').($this->overview[$_id]->isread?'':' new')."\">\n";
+            $res .= "<td class='date'>".fancyDate($this->overview[$_id]->date)." </td>\n";
+            $res .= "<td class='subj'>"
+                ."<div class='tree'>$_pfx_node".($hc?($_head?$spfx_f:($this->overview[$_id]->parent_direct?$spfx_s:$spfx_snd)):$spfx_n)
                 ."</div>";
             if ($_index == $_ref) {
-                echo '<span class="isref">'.htmlentities($this->overview[$_id]->subject).'</span>';
+                $res .= '<span class="cur">'.htmlentities($this->overview[$_id]->subject).'</span>';
             } else {
-                echo "<a href='article.php?group={$this->group}&amp;id=$_id'>".htmlentities($this->overview[$_id]->subject).'</a>';
+                $res .= "<a href='article.php?group={$this->group}&amp;id=$_id'>".htmlentities($this->overview[$_id]->subject).'</a>';
             }
-            echo "</td>\n<td class=\"{$css['author']}\">".formatFrom($this->overview[$_id]->from)."</td>\n</tr>";
+            $res .= "</td>\n<td class='from'>".formatFrom($this->overview[$_id]->from)."</td>\n</tr>";
 
-            if ($hc) { return; }
+            if ($hc) { return $res; }
         } 
 
         $_index ++;
 
         $children = $this->overview[$_id]->children;
         while ($child = array_shift($children)) {
-            if ($_index > $_last) { return; }
+            if ($_index > $_last) { return $res; }
             if ($_index+$this->overview[$child]->desc >= $_first) {
                 if (sizeof($children)) {
-                    $this->_disp_desc($child, $_index, $_first, $_last, $_ref,
+                    $res .= $this->_to_html($child, $_index, $_first, $_last, $_ref,
                             $_pfx_end.($this->overview[$child]->parent_direct?$spfx_T:$spfx_Tnd),
                             $_pfx_end.$spfx_I, false);
                 } else {
-                    $this->_disp_desc($child, $_index, $_first, $_last, $_ref,
+                    $res .= $this->_to_html($child, $_index, $_first, $_last, $_ref,
                             $_pfx_end.($this->overview[$child]->parent_direct?$spfx_L:$spfx_Lnd),
                             $_pfx_end.$spfx_e, false);
                 }
             }
             $_index += $this->overview[$child]->desc;
         }
+
+        return $res;
     }
 
     /** Displays overview
@@ -349,23 +351,28 @@ class BananaSpool
      * @param $_ref STRING MSGNUM of current/selectionned post
      */
 
-    function disp($_first=0, $_last=0, $_ref="")
+    function to_html($_first=0, $_last=0, $_ref = null)
     {
-        global $css;
+        $res  = '<table class="bicol banana_thread" cellpadding="0" cellspacing="0">';
+       
+        if (is_null($_ref)) {
+            $res .= '<tr><th>'._b_('Date').'</th>';
+            $res .= '<th>'._b_('Sujet').'</th>';
+            $res .= '<th>'._b_('Auteur').'</th></tr>';
+        }
+
         $index = 1;
         if (sizeof($this->overview)) {
             foreach ($this->roots as $id) {
-                $this->_disp_desc($id, $index, $_first, $_last, $_ref);
+                $res   .= $this->_to_html($id, $index, $_first, $_last, $_ref);
                 $index += $this->overview[$id]->desc ;
                 if ($index > $_last) { break; }
             }
         } else {
-            echo "<tr class=\"{$css['pair']}\">\n";
-            echo "\t<td colspan=\"3\">\n";
-            echo "\t\tNo post in this newsgroup\n";
-            echo "\t</td>\n";
-            echo "</tr>\n";
+            $res .= '<tr><td colspan="3">'._b_('Aucun message dans ce forum').'</td></tr>';
         }
+
+        return $res .= '</table>';
     }
 
     /** computes linear post index
index 973e4db..0864b0a 100644 (file)
--- a/index.php
+++ b/index.php
 require_once("include/banana.inc.php");
 require_once("include/header.inc.php");
 
-$groups = new BananaGroups(0);
-if (!count($groups->overview)) {
-    $groups = new BananaGroups(2);
-} else {
-    $newgroups = new BananaGroups(1);
-}
+echo $banana->action_listGroups();
 
-?>
-
-<h1>
-  <?php echo _b_('Les forums de Banana'); ?>
-</h1>
-
-<?php
-if (!sizeof($groups->overview)) error("nntpgroups");
-
-displayshortcuts();
-?>
-
-<table class="<?php echo $css["bicol"];?>" cellspacing="0" cellpadding="2">
-  <tr>
-    <th>
-      <?php echo _b_('Total'); ?>
-    </th>
-    <th>
-      <?php echo _b_('Nouveaux'); ?>
-    </th>
-    <th>
-      <?php echo _b_('Nom'); ?>
-    </th>
-    <th>
-      <?php echo _b_('Description'); ?>
-    </th>
-  </tr>
-<?php
-$pair = true;
-foreach ($groups->overview as $g => $d) {
-    $pair = !$pair;
-    $groupinfo = $banana->nntp->group($g);
-    $newarts = $banana->nntp->newnews($banana->profile['lastnews'],$g);
-?>
-  <tr class="<?php echo ($pair?$css["pair"]:$css["impair"]);?>" >
-    <td class="<?php echo $css["total"]; ?>">
-      <?php echo $groupinfo[0]; ?>
-    </td>
-    <td class="<?php echo $css["unread"]; ?>">
-      <?php echo sizeof($newarts); ?>
-    </td>
-    <td class="<?php echo $css["group"]; ?>">
-      <?php echo "<a href=\"thread.php?group=$g\">$g</a>";?>
-    </td>
-    <td class="<?php echo $css["description"]; ?>">
-      <?php echo $d[0];?>
-    </td>
-  </tr>
-<?php
-}
-?>
-</table>
-<?php
-if (count($newgroups->overview) and count($banana->profile['subscribe'])) {
-?>
-<p class="normal">
-<?php echo _b_('Les forums suivants ont été créés depuis ton dernier passage :'); ?>
-</p>
-<table class="<?php echo $css["bicol"];?>" cellspacing="0" cellpadding="2">
-  <tr>
-    <th>
-      <?php echo _b_('Total'); ?>
-    </th>
-    <th>
-      <?php echo _b_('Nom'); ?>
-    </th>
-    <th>
-      <?php echo _b_('Description'); ?>
-    </th>
-  </tr>
-<?php
-    $pair = true;
-    foreach ($newgroups->overview as $g => $d) {
-        $pair = !$pair;
-        $groupinfo = $banana->nntp->group($g);
-?>
-  <tr class="<?php echo ($pair?$css["pair"]:$css["impair"]);?>" >
-    <td class="<?php echo $css["total"]; ?>">
-      <?php echo $groupinfo[0]; ?>
-    </td>
-    <td class="<?php echo $css["group"]; ?>">
-      <?php echo "<a href=\"thread.php?group=$g\">$g</a>";?>
-    </td>
-    <td class="<?php echo $css["description"]; ?>">
-      <?php echo $d[0];?>
-    </td>
-  </tr>
-<?php
-    } //foreach
-?>
-</table>
-<?php
-} // new newsgroups ?
-
-displayshortcuts();
-
-$banana->nntp->quit();
 require_once("include/footer.inc.php");
 ?>
index dbae2ef..488e047 100644 (file)
@@ -20,13 +20,7 @@ if (isset($_REQUEST['id'])) {
     $id=htmlentities(strtolower($_REQUEST['id']));
 }
 
-$banana->newSpool($group, $banana->profile['display'], $banana->profile['lastnews']);
-$max = $banana->tmax;
-if (isset($_REQUEST['first']) && ($_REQUEST['first']>sizeof($banana->spool->overview))) {
-    $_REQUEST['first'] = sizeof($banana->spool->overview);
-}
-$first = (isset($_REQUEST['first']) ? (floor($_REQUEST['first']/$max)*$max+1) : 1);
-$last  = (isset($_REQUEST['first']) ? (floor($_REQUEST['first']/$max+1)*$max) : $max);
+echo $banana->action_showThread($group, $_REQUEST['first'] ? $_REQUEST['first'] : 1);
 
 if (isset($_REQUEST['action']) && (isset($_REQUEST['type']))
         && (isset($_SESSION['bananapostok'])) && ($_SESSION['bananapostok']))
@@ -101,32 +95,5 @@ if (isset($_REQUEST['action']) && (isset($_REQUEST['type']))
     $banana->newSpool($group, $banana->profile['display'], $banana->profile['lastnews']);
 }
 
-?>
-<h1><?php echo $group; ?></h1>
-<?php
-if (isset($text)) { echo $text; }
-displayshortcuts($first);
-
-?>
-
-<table class="<?php echo $css['bicol']?>" cellpadding="0" cellspacing="0" border="0">
-  <tr>
-    <th class="<?php echo $css['date']?>">
-      <?php echo _b_('Date'); ?>
-    </th>
-    <th class="<?php echo $css['subject']?>">
-      <?php echo _b_('Sujet'); ?>
-    </th>
-    <th class="<?php echo $css['from']?>">
-      <?php echo _b_('Auteur'); ?>
-    </th>
-  </tr>
-<?php
-$banana->spool->disp($first, $last);
-$banana->nntp->quit();
-echo "</table>";
-
-displayshortcuts($first);
-
 require_once("include/footer.inc.php");
 ?>