fix wrt IE.. sucky browser
authorPierre Habouzit (MadCoder <pierre.habouzit@m4x.org>
Tue, 24 May 2005 19:13:06 +0000 (19:13 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 4 Jan 2008 23:34:27 +0000 (00:34 +0100)
git-archimport-id: opensource@polytechnique.org--2005/banana--mainline--1.0--patch-26

banana/banana.inc.php.in
banana/misc.inc.php
banana/post.inc.php
banana/spool.inc.php
po/banana.pot
po/en.po
po/fr.po

index bfaa934..8cd704f 100644 (file)
@@ -252,6 +252,14 @@ class Banana
 
     function action_doFup($group, $artid = -1)
     {
+        if ( ! ( is_utf8($_POST['subject']) && is_utf8($_POST['name'])
+                 && is_utf8($_POST['org']) && is_utf8($_POST['body']) )
+        ) {
+            foreach(array('subject', 'name', 'org', 'body') as $key) {
+                $_POST[$key] = utf8_encode($_POST[$key]);
+            }
+        }
+        
         $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"
index 9510b14..e9f7c94 100644 (file)
@@ -18,6 +18,8 @@ function to_entities($str) {
     return utf8entities(htmlentities($str, ENT_NOQUOTES, 'UTF-8'));
 }
 
+function is_utf8($s) { return iconv('utf-8', 'utf-8', $s) == $s; }
+
 /********************************************************************************
  *  HEADER STUFF
  */
index 7f4e9cd..f9ca5cc 100644 (file)
@@ -45,6 +45,8 @@ class BananaPost
 
         if (preg_match('!charset=([^;]*)\s*(;|$)!', $this->headers['content-type'], $matches)) {
             $this->body = iconv($matches[1], 'utf-8', $this->body);
+        } else {
+            $this->body = utf8_encode($this->body);
         }
     }
 
index c41cedc..2df59e4 100644 (file)
@@ -106,7 +106,11 @@ class BananaSpool
                 $this->delid($id, false);
                 $do_save = true;
             }
-            $first = max(array_keys($this->overview))+1;
+            if (!empty($this->overview)) {
+                $first = max(array_keys($this->overview))+1;
+            } else {
+                return;
+            }
         } else {
             unset($this->overview, $this->ids);
             $this->version = BANANA_SPOOL_VERSION;
index a6dbb65..a77981a 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2005-05-24 12:57+0200\n"
+"POT-Creation-Date: 2005-05-24 21:12+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"
@@ -89,7 +89,7 @@ msgstr ""
 msgid "Corps"
 msgstr ""
 
-#: ../banana/banana.inc.php:275
+#: ../banana/banana.inc.php:275 ../banana/banana.inc.php:283
 msgid "Impossible de poster le message"
 msgstr ""
 
index c586b64..8295d7e 100644 (file)
--- a/po/en.po
+++ b/po/en.po
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: en\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2005-01-07 20:29+0100\n"
+"POT-Creation-Date: 2005-05-24 21:04+0200\n"
 "PO-Revision-Date: 2005-01-02 17:13+0100\n"
 "Last-Translator: Pierre Habouzit <pierre.habouzit@m4x.org>\n"
 "Language-Team:  <en@li.org>\n"
@@ -89,7 +89,7 @@ msgstr "Organization"
 msgid "Corps"
 msgstr "Body"
 
-#: ../banana/banana.inc.php:275
+#: ../banana/banana.inc.php:275 ../banana/banana.inc.php:283
 msgid "Impossible de poster le message"
 msgstr "Impossible to post that message"
 
index 111086d..7e829b3 100644 (file)
--- a/po/fr.po
+++ b/po/fr.po
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: fr\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2005-01-07 20:29+0100\n"
+"POT-Creation-Date: 2005-05-24 21:04+0200\n"
 "PO-Revision-Date: 2005-01-02 17:13+0100\n"
 "Last-Translator: Pierre Habouzit <pierre.habouzit@m4x.org>\n"
 "Language-Team:  <fr@li.org>\n"
@@ -89,7 +89,7 @@ msgstr "Organisation"
 msgid "Corps"
 msgstr "Corps"
 
-#: ../banana/banana.inc.php:275
+#: ../banana/banana.inc.php:275 ../banana/banana.inc.php:283
 msgid "Impossible de poster le message"
 msgstr "Impossible de poster le message"