#503: signature encoding in replies
[banana.git] / banana / banana.inc.php.in
index af969b2..86df250 100644 (file)
@@ -53,7 +53,7 @@ class Banana
      *   $matches[2] = "http://www.polytechnique.org"
      *   $matches[3] = "]"
      */
-    var $url_regexp  = '(["\[])?((?:https?|ftp|news)://(?:&|,*[a-z@0-9.~%$£µ&i#\-+=_/\?])*)(["\]])?';
+    var $url_regexp  = '(["\[])?((?:https?|ftp|news)://(?:&|\.*,*[a-z@0-9~%$£µ&i#\-+=_/\?])*)(["\]])?';
 
     
     /** Boundary for multipart messages
@@ -316,10 +316,14 @@ class Banana
              . "\n"
              . "Message canceled with Banana";
         if ($this->nntp->post($msg)) {
+            $ndx = $this->spool->getndx($artid) - 1;
+            if ($ndx > 50) {
+                $ndx = 0;
+            }
             $this->spool->delid($id);
             $this->nntp->quit();
             redirectInBanana(Array('group' => $group,
-                           'first' => $id));
+                                   'first' => $ndx));
         } else {
             return '<p class="error">'._b_('Impossible d\'annuler le message').'</p>';
         }
@@ -345,16 +349,17 @@ class Banana
             $this->nntp->group($group);
             if ($this->_newPost($id)) {
                 $subject  = 'Re: ' . preg_replace("/^re\s*:\s*/i", '', $this->post->headers['subject']);
-                $body     = utf8_encode($this->post->name." "._b_("a écrit"))." :\n"
-                                        . wrap($this->post->get_body(), "> ")
-                          . $this->profile['sig'] ? "\n\n-- \n". $this->profile['sig'] : '';
+                $body     = to_entities(utf8_encode($this->post->name." "._b_("a écrit"))." :\n"
+                                        . wrap($this->post->get_body(), "> "))
+                          . ($this->profile['sig'] ? "\n\n-- \n". $this->profile['sig'] : '');
                 $target   = isset($this->post->headers['followup-to']) ?
                                 $this->post->headers['followup-to'] : $this->post->headers['newsgroups'];
                 $followup = null;
             }
         } else {
-            $subject = $target = $followup = null;
-            $body = $this->profile['sig'] ? "\n\n-- \n". $this->profile['sig'] : '';
+            $targe   = $group;
+            $subject = $followup = null;
+            $body    = $this->profile['sig'] ? "\n\n-- \n". $this->profile['sig'] : '';
         }
 
         $this->nntp->quit();
@@ -474,7 +479,7 @@ class Banana
         if ($this->nntp->post($msg)) {
             $dir = Array('group' => $group);
             if ($artid != -1) {
-                $dir['first'] = $artid;
+                $dir['artid'] = $artid;
             }
             redirectInBanana($dir);
         } else {