we are more and more standalone !
authorx2000habouzit <x2000habouzit>
Fri, 7 Jan 2005 14:21:00 +0000 (14:21 +0000)
committerx2000habouzit <x2000habouzit>
Fri, 7 Jan 2005 14:21:00 +0000 (14:21 +0000)
12 files changed:
article.php [deleted file]
include/.cvsignore
include/banana.inc.php.in
include/groups.inc.php
include/misc.inc.php
include/post.inc.php
include/spool.inc.php
index.php
install.d/footer.inc.php [deleted file]
install.d/header.inc.php [deleted file]
post.php [deleted file]
thread.php [deleted file]

diff --git a/article.php b/article.php
deleted file mode 100644 (file)
index d30e4c4..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-/********************************************************************************
-* article.php : article page
-* -------------
-*
-* This file is part of the banana distribution
-* Copyright: See COPYING files that comes with this distribution
-********************************************************************************/
-
-require_once("include/banana.inc.php");
-require_once("include/header.inc.php");
-
-if (isset($_REQUEST['group'])) {
-    $group = htmlentities(strtolower($_REQUEST['group']));
-}
-if (isset($_REQUEST['id'])) {
-    $id = htmlentities(strtolower($_REQUEST['id']));
-}
-
-echo $banana->action_showArticle($group, $id);
-
-if (isset($_GET['type']) && $_GET['type']=='cancel' && $banana->post->checkcancel()) {
-?>
-<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="type" value="cancel" />
-  <input type="submit" name="action" value="<?php echo _b_('OK'); ?>" />
-</form>
-<?
-}
-
-require_once("include/footer.inc.php");
-?>
index 84cd208..76fc7d1 100644 (file)
@@ -1,7 +1,5 @@
 banana.inc.php
-error.inc.php
 footer.inc.php
-format.inc.php
 header.inc.php
 profile_form.inc.php
 profile.inc.php
index 3758c20..ba24a05 100644 (file)
@@ -7,9 +7,6 @@
 * Copyright: See COPYING files that comes with this distribution
 ********************************************************************************/
 
-require_once("include/misc.inc.php");
-require_once("include/error.inc.php");
-
 class Banana
 {
     var $maxspool  = 3000;
@@ -33,6 +30,7 @@ class Banana
     var $profile   = Array( 'name' => 'Anonymous <anonymouse@example.com>', 'sig'  => '', 'org'  => '',
             'customhdr' =>'', 'display' => 0, 'lastnews' => 0, 'locale'  => 'fr_FR', 'subscribe' => array());
     
+    var $state = Array('group' => null, 'artid' => null);
     var $nntp;
     var $groups;
     var $newgroups;
@@ -41,12 +39,69 @@ class Banana
 
     function Banana()
     {
-        if (function_exists('hook_banana')) {
-            hook_banana($this);
-        }
-        $this->_setupProfile();
         require_once('include/NetNNTP.inc.php');
+        $this->_setupProfile();
         $this->nntp = new nntp($this->host);
+
+$this->profile['subscribe'][] = 'xorg.general';
+$this->profile['subscribe'][] = 'xorg.test';
+$this->profile['subscribe'][] = 'xorg.promo.x1970';
+$this->profile['lastnews'] = time() - 24*3600*7;
+
+    }
+
+    function run()
+    {
+        require_once("include/misc.inc.php");
+        global $banana;
+
+        $banana = new Banana();
+        $group  = empty($_GET['group']) ? null : strtolower($_GET['group']);
+        $artid  = empty($_GET['artid']) ? null : strtolower($_GET['artid']);
+        $banana->state = Array ('group' => $group, 'artid' => $artid);
+
+        if (is_null($group)) {
+
+            return $banana->action_listGroups();
+
+        } elseif (is_null($artid)) {
+            
+            if (isset($_POST['action']) && $_POST['action'] == 'new') {
+                return $banana->action_doFup($group, isset($_POST['artid']) ? intval($_POST['artid']) : -1);
+            } elseif (isset($_GET['action']) && $_GET['action'] == 'new') {
+                return $banana->action_newFup($group);
+            } else {
+                return $banana->action_showThread($group, isset($_GET['first']) ? intval($_GET['first']) : 1);
+            }
+
+        } else {
+
+            if (isset($_POST['action']) && $_POST['action']=='cancel') {
+                $res = $banana->action_cancelArticle($group, $artid);
+            } else {
+                $res = '';
+            }
+
+            if (isset($_GET['action'])) {
+                switch ($_GET['action']) {
+                    case 'cancel':
+                        $res .= $banana->action_showArticle($group, $artid);
+                        if ($banana->post->checkcancel()) {
+                            $form = '<p class="error">'._b_('Voulez-vous vraiment annuler ce message ?').'</p>'
+                                  . "<form action=\"?group=$group&amp;artid=$artid\" method='post'><p>"
+                                  . '<input type="hidden" name="action" value="cancel" />'
+                                  . '<input type="submit" value="Annuler !" />'
+                                  . '</p></form>';
+                            return $form.$res;
+                        }
+                        return $res;
+
+                    case 'new':
+                        return $banana->action_newFup($group, $artid);
+                }
+            }
+            return $res . $banana->action_showArticle($group, $artid);
+        }
     }
 
     /**************************************************************************/
@@ -55,7 +110,7 @@ class Banana
 
     function action_listGroups()
     {
-        $this->newGroup();
+        $this->_newGroup();
         
         $cuts = displayshortcuts();
         $res  = '<h1>'._b_('Les forums de Banana').'</h1>'.$cuts.$this->groups->to_html();
@@ -82,7 +137,7 @@ class Banana
 
     function action_showThread($group, $first)
     {
-        $this->newSpool($group, $this->profile['display'], $this->profile['lastnews']);
+        $this->_newSpool($group, $this->profile['display'], $this->profile['lastnews']);
 
         if ($first > count($this->spool->overview)) {
             $first = count($this->spool->overview);
@@ -102,8 +157,8 @@ class Banana
 
     function action_showArticle($group, $id)
     {
-        $this->newSpool($group, $this->profile['display'], $this->profile['lastnews']);
-        $this->newPost($id);
+        $this->_newSpool($group, $this->profile['display'], $this->profile['lastnews']);
+        $this->_newPost($id);
         if (!$this->post) {
             if ($this->nntp->lasterrorcode == "423") {
                 $this->spool->delid($id);
@@ -121,6 +176,31 @@ class Banana
         return $res.$cuts;
     }
 
+    function action_cancelArticle($group, $id)
+    {
+        $this->_newSpool($group, $this->profile['display'], $this->profile['lastnews']);
+        $this->_newPost($id);
+        $mid  = array_search($id, $this->spool->ids);
+
+        if (!$this->post->checkcancel()) {
+            return '<p class="error">'._b_('Vous n\'avez pas les permissions pour annuler ce message').'</p>'; 
+        }
+        $msg = 'From: '.$this->profile['name']."\n"
+             . "Newsgroups: $group\n"
+             . "Subject: cmsg $mid\n"
+             . $this->custom
+             . "Control: cancel $mid\n"
+             . "\n"
+             . "Message canceled with Banana";
+        if ($this->nntp->post($msg)) {
+            $this->spool->delid($id);
+            $this->nntp->quit();
+            header("Location: ?group=$group&amp;first=$id");
+        } else {
+            return '<p class="error">'._b_('Impossible d\'annuler le message').'</p>';
+        }
+    }
+
     function action_newFup($group, $id = -1)
     {
         $subject = $body = '';
@@ -128,7 +208,7 @@ class Banana
         
         if ($id > 0) {
             $this->nntp->group($group);
-            $this->newPost($id);
+            $this->_newPost($id);
             if ($this->post) {
                 $subject = preg_replace("/^re\s*:\s*/i", 'Re: ', $this->post->headers['subject']);
                 $body    = $this->post->name." "._b_("a écrit")." :\n".wrap($this->post->body, "> ");
@@ -140,43 +220,72 @@ class Banana
 
         $cuts  = displayshortcuts();
         $html  = '<h1>'._b_('Nouveau message').'</h1>'.$cuts;
-        $html .= '<form action="?" method="post">';
+        $html .= '<form action="?group='.$group.'" method="post">';
         $html .= '<table class="bicol" cellpadding="0" cellspacing="0">';
         $html .= '<tr><th colspan="2">'._b_('En-têtes').'</th></tr>';
         $html .= '<tr><td>'._b_('Nom').'</td><td>'.htmlentities($this->profile['name']).'</td></tr>';
         $html .= '<tr><td>'._b_('Sujet').'</td><td><input type="text" name="subject" value="'.htmlentities($subject).'" size="60" /></td></tr>';
         $html .= '<tr><td>'._b_('Forums').'</td><td><input type="text" name="newsgroups" value="'.htmlentities($target).'" size="60" /></td></tr>';
-        $html .= '<tr><td>'._b_('Suivi à').'</td><td><input type="text" name="newsgroups" value="" size="60" /></td></tr>';
+        $html .= '<tr><td>'._b_('Suivi à').'</td><td><input type="text" name="followup" value="" size="60" /></td></tr>';
         $html .= '<tr><td>'._b_('Organisation').'</td><td>'.$this->profile['org'].'</td></tr>';
         $html .= '<tr><th colspan="2">'._b_('Corps').'</th></tr>';
         $html .= '<tr><td colspan="2"><textarea name="body" cols="74" rows="16">'
             .htmlentities($body).($this->profile['sig'] ? "\n\n-- \n".htmlentities($this->profile['sig']) : '').'</textarea></td></th>';
-        $html .= '<tr><td colspan="2"><input type="hidden" name="group" value="'.$group.'" />';
+        $html .= '<tr><td colspan="2">';
         if ($id > 0) {
-            $html .= '<input type="hidden" name="id" value="'.$id.'" />';
+            $html .= '<input type="hidden" name="artid" value="'.$id.'" />';
         }
+        $html .= '<input type="hidden" name="action" value="new" />';
         $html .= '<input type="submit" /></td></tr>';
         $html .= '</table></form>';
 
         return $html.$cuts;
     }
 
+    function action_doFup($group, $artid = -1)
+    {
+        $this->_newSpool($group, $this->profile['display'], $this->profile['lastnews']);
+        $body = preg_replace("/\n\.[ \t\r]*\n/m", "\n..\n", $_POST['body']);
+        $msg  = 'From: '.$this->profile['name']."\n"
+              . "Newsgroups: ".$_POST['newsgroups']."\n"
+              . "Subject: ".$_POST['subject']."\n"
+              . (empty($this->profile['org']) ? '' : "Organization: {$this->profile['org']}\n")
+              . (empty($_POST['followup'])    ? '' : 'Followup-To: '.$_POST['followup']."\n");
+
+        if ($artid != -1) {
+            require_once("include/post.inc.php");
+            $post = new BananaPost($artid);
+            $refs = ( isset($post->headers['references']) ? $post->headers['references']." " : "" );
+            $msg .= "References: $refs{$post->headers['message-id']}\n";
+        }
+
+        $msg .= $this->custom.$this->profile['customhdr']."\n".wrap($body, "", $this->wrap);
+
+        if ($this->nntp->post($msg)) {
+            header("Location: ?group=$group".($artid==-1 ? '' : "&first=$artid"));
+        } else {
+            return "<p class=\"error\">"._b_('Impossible de poster le message')."</p>".$this->action_showThread($group, $artid);
+        }
+    }
+
     /**************************************************************************/
-    /*                                                                        */
+    /* Private functions                                                      */
     /**************************************************************************/
 
-    function newSpool($group, $disp=0, $since='') {
+    function _newSpool($group, $disp=0, $since='') {
         require_once('include/spool.inc.php');
-        $this->spool = new BananaSpool($group, $disp, $since);
+        if (!$this->spool || $this->spool->group != $group) {
+            $this->spool = new BananaSpool($group, $disp, $since);
+        }
     }
 
-    function newPost($id)
+    function _newPost($id)
     {
         require_once("include/post.inc.php");
         $this->post = new BananaPost($id);
     }
 
-    function newGroup()
+    function _newGroup()
     {
         require_once("include/groups.inc.php");
         $this->groups = new BananaGroups(BANANA_GROUP_SUB);
@@ -185,10 +294,6 @@ class Banana
         }
     }
 
-    /**************************************************************************/
-    /*                                                                        */
-    /**************************************************************************/
-
     function _setupProfile()
     {
         if (function_exists('hook_getprofile')) {
@@ -199,6 +304,4 @@ class Banana
     }
 }
 
-$banana = new Banana;
-
 ?>
index 1ca719d..5f762da 100644 (file)
@@ -109,7 +109,7 @@ class BananaGroups {
             } elseif ($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 .= "<td class='grp'><a href='?group=$g'>$g</a></td><td class='dsc'>{$d[0]}</td></tr>";
         }
 
         $html .= '</table>';
index 1d85354..aaad5b0 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))); }
 
 /********************************************************************************
@@ -66,7 +57,7 @@ function formatDisplayHeader($_header,$_text) {
             $res = "";
             $groups = preg_split("/[\t ]*,[\t ]*/",$_text);
             foreach ($groups as $g) {
-                $res.="<a href='thread.php?group=$g'>$g</a>, ";
+                $res.="<a href='?group=$g'>$g</a>, ";
             }
             return substr($res,0, -2);
 
@@ -87,7 +78,7 @@ function formatDisplayHeader($_header,$_text) {
                 $p = $banana->spool->overview[$p]->parent;
             }
             foreach (array_reverse($par_ok) as $p) {
-                $rsl .= "<a href=\"article.php?group={$banana->spool->group}&amp;id=$p\">$ndx</a> ";
+                $rsl .= "<a href=\"?group={$banana->spool->group}&amp;artid=$p\">$ndx</a> ";
                 $ndx++;
             }
             return $rsl;
@@ -148,7 +139,6 @@ function formatFrom($text) {
 
 function displayshortcuts($first = -1) {
     global $banana;
-    $sname = basename($_SERVER['SCRIPT_NAME']);
 
     $res = '<div class="banana_scuts">';
 
@@ -156,40 +146,38 @@ function displayshortcuts($first = -1) {
         $res .= hook_displayshortcuts($sname, $first);
     }
 
-    switch ($sname) {
-        case 'thread.php' :
-            $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) {
-                        $res .= "[$ndx-".min($ndx+$banana->tmax-1,sizeof($banana->spool->overview))."] ";
-                    } else {
-                        $res .= "[<a href=\"?group={$banana->spool->group}&amp;first="
-                            ."$ndx\">$ndx-".min($ndx+$banana->tmax-1,sizeof($banana->spool->overview))
-                            ."</a>] ";
-                    }
+    extract($banana->state);
+
+    $res .= '[<a href="?">'._b_('Liste des forums').'</a>] ';
+    if (is_null($group)) {
+        return $res.'</div>';
+    }
+   
+    $res .= "[<a href=\"?group=$group\">$group</a>] ";
+
+    if (is_null($artid)) {
+        $res .= "[<a href=\"?group=$group&amp;action=new\">"._b_('Nouveau message')."</a>] ";
+        if (sizeof($banana->spool->overview)>$banana->tmax) {
+            $res .= '<br />';
+            $n = intval(log(count($banana->spool->overview), 10))+1;
+            for ($ndx=1; $ndx <= sizeof($banana->spool->overview); $ndx += $banana->tmax) {
+                if ($first==$ndx) {
+                    $fmt = "[%0{$n}u-%0{$n}u] ";
+                } else {
+                    $fmt = "[<a href=\"?group=$group&amp;first=$ndx\">%0{$n}u-%0{$n}u</a>] ";
                 }
+                $res .= sprintf($fmt, $ndx, min($ndx+$banana->tmax-1,sizeof($banana->spool->overview)));
             }
-            break;
-        case 'article.php' :
-            $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()) {
-                $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' :
-            $res .= '[<a href="index.php">'._b_('Liste des forums').'</a>] ';
-            $res .= "[<a href=\"thread.php?group={$banana->spool->group}\">{$banana->spool->group}</a>]";
-            break;
+        }
+    } else {
+        $res .= "[<a href=\"?group=$group&amp;artid=$artid&amp;action=new\">"
+            ._b_('Répondre')."</a>] ";
+        if ($banana->post->checkcancel()) {
+            $res .= "[<a href=\"?group=$group&amp;artid=$artid&amp;action=cancel\">"
+                ._b_('Annuler ce message')."</a>] ";
+        }
     }
-    $res .= '</div>';
-
-    return $res;
+    return $res.'</div>';
 }
 
 /********************************************************************************
index b892b1e..4df89da 100644 (file)
@@ -29,7 +29,11 @@ class BananaPost
         $this->id = $_id;
         $this->_header();
 
-        $this->body = join("\n", $banana->nntp->body($_id));
+        if ($body = $banana->nntp->body($_id)) {
+            $this->body = join("\n", $body);
+        } else {
+            return ($this = null);
+        }
         
         if (isset($this->headers['content-transfer-encoding'])) {
             if (preg_match("/base64/", $this->headers['content-transfer-encoding'])) {
@@ -82,6 +86,7 @@ class BananaPost
 
     function checkcancel()
     {
+        return true;
         if (function_exists('hook_checkcancel')) {
             return hook_checkcancel($this->headers);
         }
index f8e6788..f657d55 100644 (file)
@@ -316,7 +316,7 @@ class BananaSpool
             if ($_index == $_ref) {
                 $res .= '<span class="cur">'.htmlentities($this->overview[$_id]->subject).'</span>';
             } else {
-                $res .= "<a href='article.php?group={$this->group}&amp;id=$_id'>".htmlentities($this->overview[$_id]->subject).'</a>';
+                $res .= "<a href='?group={$this->group}&amp;artid=$_id'>".htmlentities($this->overview[$_id]->subject).'</a>';
             }
             $res .= "</td>\n<td class='from'>".formatFrom($this->overview[$_id]->from)."</td>\n</tr>";
 
index 0864b0a..536ad30 100644 (file)
--- a/index.php
+++ b/index.php
@@ -8,9 +8,28 @@
 ********************************************************************************/
 
 require_once("include/banana.inc.php");
-require_once("include/header.inc.php");
+$res = Banana::run();
 
-echo $banana->action_listGroups();
-
-require_once("include/footer.inc.php");
 ?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; 
+    charset=iso-8859-1">
+    <meta name="description" content="WebForum2/Banana">
+    <link href="css/style.css" type="text/css" rel="stylesheet" media="screen">
+    <link href="css/banana.css" type="text/css" rel="stylesheet" media="screen">
+    <title>
+      Banana, a NNTP<->Web Gateway 
+    </title>
+  </head>
+  <body>
+    <div class="bloc">
+<?php echo $res; ?>
+      <div class="foot">
+        <em>Banana</em>, a Web interface for a NNTP Server<br />
+        Developed under GPL License for <a href="http://www.polytechnique.org">Polytechnique.org</a>
+      </div>
+    </div>
+  </body>
+</html>
diff --git a/install.d/footer.inc.php b/install.d/footer.inc.php
deleted file mode 100644 (file)
index d8dbd16..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-/********************************************************************************
-* install.d/footer.inc.php : HTML default footer
-* --------------------------
-*
-* This file is part of the banana distribution
-* Copyright: See COPYING files that comes with this distribution
-********************************************************************************/
-?>
-    </div>
-    <p class="footer">
-      <i>Banana</i>, a Web interface for a NNTP Server<br />
-      Developed under GPL License for <a href="http://www.polytechnique.org">Polytechnique.org</a>
-    </p>
-  </body>
-</html>
diff --git a/install.d/header.inc.php b/install.d/header.inc.php
deleted file mode 100644 (file)
index b053b8b..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-/********************************************************************************
-* install.d/header.inc.php : HTML default header
-* --------------------------
-*
-* This file is part of the banana distribution
-* Copyright: See COPYING files that comes with this distribution
-********************************************************************************/
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; 
-    charset=iso-8859-1">
-    <meta name="description" content="WebForum2/Banana">
-    <link href="css/style.css" type="text/css" rel="stylesheet"
-    media="screen">
-    <title>
-      Banana, a NNTP<->Web Gateway 
-    </title>
-  </head>
-  <body>
-    <div class="bloc">
diff --git a/post.php b/post.php
deleted file mode 100644 (file)
index ab792cb..0000000
--- a/post.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-/********************************************************************************
-* post.php : posting page
-* ----------
-*
-* This file is part of the banana distribution
-* Copyright: See COPYING files that comes with this distribution
-********************************************************************************/
-
-require_once("include/banana.inc.php");
-require_once("include/header.inc.php");
-
-if (isset($_REQUEST['group'])) {
-    $group = htmlentities(strtolower($_REQUEST['group']));
-}
-
-$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : -1;
-
-echo $banana->action_newFup($group, $id);
-
-require_once("include/footer.inc.php");
-?>
diff --git a/thread.php b/thread.php
deleted file mode 100644 (file)
index 488e047..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-<?php
-/********************************************************************************
-* thread.php : group overview
-* ------------
-*
-* This file is part of the banana distribution
-* Copyright: See COPYING files that comes with this distribution
-********************************************************************************/
-
-require_once("include/banana.inc.php");
-require_once("include/header.inc.php");
-
-if (isset($_REQUEST['group'])) {
-    $group = htmlentities(strtolower($_REQUEST['group']));
-} else {
-    $group = htmlentities(strtolower(strtok(str_replace(" ","",$_REQUEST['newsgroups']),",")));
-}
-
-if (isset($_REQUEST['id'])) {
-    $id=htmlentities(strtolower($_REQUEST['id']));
-}
-
-echo $banana->action_showThread($group, $_REQUEST['first'] ? $_REQUEST['first'] : 1);
-
-if (isset($_REQUEST['action']) && (isset($_REQUEST['type']))
-        && (isset($_SESSION['bananapostok'])) && ($_SESSION['bananapostok']))
-{
-    switch ($_REQUEST['type']) {  
-        case 'cancel':
-            $mid  = array_search($id, $banana->spool->ids);
-            $banana->newPost($id);
-
-            if ($banana->post && $banana->post->checkcancel()) {
-                $message = 'From: '.$banana->profile['name']."\n"
-                    ."Newsgroups: $group\n"
-                    ."Subject: cmsg $mid\n"
-                    .$banana->custom
-                    ."Control: cancel $mid\n"
-                    ."\n"
-                    ."Message canceled with Banana";
-                if ($banana->nntp->post($message)) {
-                    $banana->spool->delid($id);
-                    $text = "<p class=\"normal\">"._b_('Message annulé')."</p>";
-                } else {
-                    $text = "<p class=\"error\">"._b_('Impossible d\'annuler le message')."</p>";
-                }
-            } else {
-                $text = "<p class=\"error\">\n\t"._b_('Vous n\'avez pas les permissions pour annuler ce message')."\n</p>";
-            }
-            break;
-
-        case 'new':
-            $body = preg_replace("/\n\.[ \t\r]*\n/m","\n..\n",$_REQUEST['body']);
-            $message = 'From: '.$banana->profile['name']."\n"
-                ."Newsgroups: ".str_replace(" ","", $_REQUEST['newsgroups'])."\n"
-                ."Subject: ".$_REQUEST['subject']."\n"
-                .(isset($banana->profile['org'])?"Organization: ".$banana->profile['org']."\n":"")
-                .($_REQUEST['followup']!=''?'Followup-To: '.$_REQUEST['followup']."\n":"")
-                .$banana->custom
-                ."\n"
-                .wrap($body, "", $banana->wrap);
-            if ($banana->nntp->post($message)) {
-                $text = "<p class=\"normal\">"._b_('Message posté')."</p>";
-            } else {
-                $text = "<p class=\"error\">"._b_('Impossible de poster le message')."</p>";
-            }
-            break;
-
-        case 'followupok':
-            $banana->newPost($id);
-            if ($banana->post) {
-                $refs = (isset($banana->post->headers['references'])?
-                $banana->post->headers['references']." ":"").$banana->post->headers['message-id'];
-            }
-
-            $body = preg_replace("/\n\.[ \t\r]*\n/m","\n..\n",$_REQUEST['body']);
-            $message = 'From: '.$banana->profile['name']."\n"
-                ."Newsgroups: ".$_REQUEST['newsgroups']."\n"
-                ."Subject: ".$_REQUEST['subject']."\n"
-                .(isset($banana->profile['org'])?"Organization: ".$banana->profile['org']."\n":"")
-                .($_REQUEST['followup']!=''?'Followup-To: '.$_REQUEST['followup']."\n":"")
-                ."References: $refs\n"
-                .$banana->custom
-                .$banana->profile['customhdr']
-                ."\n"
-                .wrap($body, "", $banana->wrap);
-            if ($banana->nntp->post($message)) {
-                $text = "<p class=\"normal\">"._b_('Message posté')."</p>";
-            } else {
-                $text = "<p class=\"error\">"._b_('Impossible de poster le message')."</p>";
-            }
-            break;
-    }
-    $_SESSION['bananapostok']=false;
-    $banana->newSpool($group, $banana->profile['display'], $banana->profile['lastnews']);
-}
-
-require_once("include/footer.inc.php");
-?>