Automatically add fup if newsgroups contains multiple destinations
authorx2003bruneau <x2003bruneau@9869982d-c50d-0410-be91-f2a2ec7c7c7b>
Sat, 8 Jul 2006 15:56:14 +0000 (15:56 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 4 Jan 2008 23:34:45 +0000 (00:34 +0100)
git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@57 9869982d-c50d-0410-be91-f2a2ec7c7c7b

Changelog
banana/banana.inc.php.in

index 91120db..79f5e0b 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,7 @@
+Sat, 08 Jul 2006                    Florent Bruneau <florent.bruneau@m4x.org>
+
+       * Automatically set fup for crossposts
+
 ================================================================================
 VERSION 1.3
 
index acf9317..7ff9f5e 100644 (file)
@@ -355,17 +355,25 @@ class Banana
             }
         }
        
-               $to   = preg_replace('/\s*(,|;)\s*/', ',', $_POST['newsgroups']);
+               $forums = preg_split('/\s*(,|;)\s*/', $_POST['newsgroups']);
+               $fup    = $_POST['followup'];
+               if (sizeof($forums) > 1) {
+                       if (empty($fup)) {
+                               $fup = $forums[0];
+                       }
+               }
+               $to     = implode(',', $forums);
+               
         if (!$this->_newSpool($group, $this->profile['display'], $this->profile['lastnews'])) {
             return '<p class="error">'._b_('Impossible charger la liste des messages').'</p>';
         }
                
         $body = preg_replace("/\n\.[ \t\r]*\n/m", "\n..\n", $_POST['body']);
-        $msg  = 'From: '.$this->profile['name']."\n"
+        $msg  = 'From: ' . $this->profile['name'] . "\n"
               . "Newsgroups: ". $to . "\n"
-              . "Subject: ".headerEncode($_POST['subject'], 128)."\n"
+              . "Subject: " . headerEncode($_POST['subject'], 128) . "\n"
               . (empty($this->profile['org']) ? '' : "Organization: {$this->profile['org']}\n")
-              . (empty($_POST['followup'])    ? '' : 'Followup-To: '.$_POST['followup']."\n");
+              . (empty($fup) ? '' : 'Followup-To: ' . $fup . "\n");
 
         if ($artid != -1) {
             $this->_require('post');