really fix escaping
authorPierre Habouzit (MadCoder <pierre.habouzit@m4x.org>
Wed, 19 Oct 2005 17:58:21 +0000 (17:58 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 4 Jan 2008 23:34:29 +0000 (00:34 +0100)
git-archimport-id: opensource@polytechnique.org--2005/banana--mainline--1.0--patch-32

banana/banana.inc.php.in
banana/misc.inc.php
po/banana.pot

index 1a8fe03..3b4e5d9 100644 (file)
@@ -262,7 +262,7 @@ class Banana
         
         $this->_newSpool($group, $this->profile['display'], $this->profile['lastnews']);
         $body = preg_replace("/\n\.[ \t\r]*\n/m", "\n..\n", $_POST['body']);
-        $msg  = 'From: '.headerEncode($this->profile['name'])."\n"
+        $msg  = 'From: '.$this->profile['name']."\n"
               . "Newsgroups: ".$_POST['newsgroups']."\n"
               . "Subject: ".headerEncode($_POST['subject'], 128)."\n"
               . (empty($this->profile['org']) ? '' : "Organization: {$this->profile['org']}\n")
index 936414c..3258ef1 100644 (file)
@@ -37,7 +37,9 @@ function headerDecode($value) {
 
 function headerEncode($value, $trim = 0) {
     if ($trim) {
-        $value = substr($value, $trim) . "[...]";
+        if (strlen($value) > $trim) {
+            $value = substr($value, 0, $trim) . "[...]";
+        }
     }
     return "=?UTF-8?B?".base64_encode($value)."?=";
 }
index aed8e86..2e7198b 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2005-10-19 19:06+0200\n"
+"POT-Creation-Date: 2005-10-19 19:56+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"