post is now in the lib too. have to work on the actions now.
[banana.git] / article.php
index a62311c..d30e4c4 100644 (file)
 * Copyright: See COPYING files that comes with this distribution
 ********************************************************************************/
 
-require_once("include/session.inc.php");
-require_once("include/misc.inc.php");
-require_once("include/format.inc.php");
-require_once("include/config.inc.php");
-require_once("include/NetNNTP.inc.php");
-require_once("include/spool.inc.php");
-require_once("include/post.inc.php");
-require_once("include/profile.inc.php");
-require_once("include/password.inc.php");
-require_once("include/error.inc.php");
-
-$profile = getprofile();
+require_once("include/banana.inc.php");
 require_once("include/header.inc.php");
 
 if (isset($_REQUEST['group'])) {
-  $group=htmlentities(strtolower($_REQUEST['group']));
+    $group = htmlentities(strtolower($_REQUEST['group']));
 }
 if (isset($_REQUEST['id'])) {
-  $id=htmlentities(strtolower($_REQUEST['id']));
-}
-
-$nntp = new nntp($news['server']);
-if (!$nntp) error("nntpsock");
-if ($news['user']!="anonymous") {
-  $result = $nntp->authinfo($news["user"],$news["pass"]);
-  if (!$result) error("nntpauth");
-}
-$spool = new BananaSpool($nntp,$group,$profile['display'],$profile['lastnews']);
-if (!$spool) error("nntpspool");
-$nntp->group($group);
-
-$post = new BananaPost($nntp,$id);
-if (!$post) {
-  if ($nntp->lasterrorcode == "423") {
-    $spool->delid($id);
-  }
-  error("nntpart");
+    $id = htmlentities(strtolower($_REQUEST['id']));
 }
 
-$ndx = $spool->getndx($id);
-
-?>
-<h1>
-  <?php echo _b_('Message'); ?>
-</h1>
+echo $banana->action_showArticle($group, $id);
 
-<?php
-if (isset($_GET['type']) && ($_GET['type']=='cancel') && (checkcancel($post->headers))) {
+if (isset($_GET['type']) && $_GET['type']=='cancel' && $banana->post->checkcancel()) {
 ?>
-<p class="<?php echo $css['error']?>">
+<p class="error">
   <?php echo _b_('Voulez-vous vraiment annuler ce message ?'); ?>
 </p>
 <form action="thread.php" method="post">
-  <input type="hidden" name="group" value="<?php echo $group;?>" />
-  <input type="hidden" name="id" value="<?php 
-    echo $id;?>" />
+  <input type="hidden" name="group" value="<?php echo $group; ?>" />
+  <input type="hidden" name="id" value="<?php  echo $id; ?>" />
   <input type="hidden" name="type" value="cancel" />
   <input type="submit" name="action" value="<?php echo _b_('OK'); ?>" />
 </form>
 <?
 }
 
-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 ($news['headdisp'] as $nick) {
-        if (isset($post->headers[$nick])) {
-            $res = formatdisplayheader($nick,$post->headers[$nick],$spool);
-            if ($res)
-                echo "<tr><td class=\"{$css['bicoltitre']}\">".header_translate($nick)."</td>"
-                    ."<td>$res</td></tr>\n";
-        }
-    }
-?>
-  <tr>
-    <th colspan="2">
-      <?php echo _b_('Corps'); ?>
-    </th>
-  </tr> 
-  <tr>
-    <td colspan="2">
-      <pre><?php echo formatbody($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
-$spool->disp($ndx-$news['threadtop'],$ndx+$news['threadbottom'],$ndx);
-?>
-      </table>
-    </td>
-  </tr>
-</table>
-<?php
-displayshortcuts();
-
 require_once("include/footer.inc.php");
 ?>