Accept ";", "," and " " as newsgroup separators
authorx2003bruneau <x2003bruneau@9869982d-c50d-0410-be91-f2a2ec7c7c7b>
Sat, 23 Jun 2007 09:33:18 +0000 (09:33 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 4 Jan 2008 23:35:47 +0000 (00:35 +0100)
git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@267 9869982d-c50d-0410-be91-f2a2ec7c7c7b

Changelog
banana/banana.inc.php.in
banana/nntpcore.inc.php
banana/page.inc.php

index c2c85ff..b57ade2 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,7 @@
+Sat, 23 Jun 2007                                       Florent Bruneau <florent.bruneau@m4x.org>
+
+       * Bugfix: To/Newsgroups formatting
+
 Tue, 12 Jun 2007                                       Florent Bruneau <florent.bruneau@m4x.org>
 
        * PGP signature check
index 386e4c1..2e5c633 100644 (file)
@@ -504,10 +504,9 @@ class Banana
                 if (!is_utf8($hdr_values[$header])) {
                     $hdr_values[$header] = utf8_encode($hdr_values[$header]);
                 }
-                if ($headers != 'Subject') {
-                    $hdr_values[$header] = str_replace(', ', ',', $hdr_values[$header]);
-                }
             }
+            $values = split('[,; ]', $hdr_values[$hdrs['dest']]);
+            $hdr_values[$hdrs['dest']] = preg_replace('/,+/', ',', implode(',', $values));
             if (!is_null($artid)) {
                 $old =& $this->loadMessage($group, $artid);
                 $hdr_values['References'] = $old->getHeaderValue('references') . ' ' . $old->getHeaderValue('message-id');
@@ -536,6 +535,7 @@ class Banana
                 } else {
                     Banana::$page->trig(_b_('Une erreur est survenue lors de l\'envoi du message :') . '<br />'
                                    . Banana::$protocole->lastError());
+                    $body = $_POST['body'];
                 }
             }
         } else {
@@ -556,8 +556,8 @@ class Banana
             if (Banana::$profile['signature']) {
                 $body .=  "\n\n-- \n" . Banana::$profile['signature'];
             }
-            Banana::$page->assign('body', $body);
         }
+        Banana::$page->assign('body', $body);
 
         Banana::$page->assign('maxfilesize', Banana::$msgedit_maxfilesize);
         Banana::$page->assign('can_attach', Banana::$msgedit_canattach);
index 5d8bc63..7579c2a 100644 (file)
@@ -79,7 +79,11 @@ class BananaNNTPCore
 
     public function lastError()
     {
-        return $this->lasterrortext;
+        if (!is_utf8($this->lasterrortext)) {
+            return utf8_encode($this->lasterrortext);
+        } else {
+            return $this->lasterrortext;
+        }
     }
 
     public function backtrace()
index fef0196..fe6a808 100644 (file)
@@ -386,6 +386,7 @@ class BananaPage extends Smarty
     public function redirect(array $params = array())
     {
         header('Location: ' . $this->makeUrl($params));
+        exit;
     }
 }