From c42efe2f093bae5e429288c6a39df6ff9357a88f Mon Sep 17 00:00:00 2001 From: "Pierre Habouzit (MadCoder" Date: Tue, 24 May 2005 19:13:06 +0000 Subject: [PATCH] fix wrt IE.. sucky browser git-archimport-id: opensource@polytechnique.org--2005/banana--mainline--1.0--patch-26 --- banana/banana.inc.php.in | 8 ++++++++ banana/misc.inc.php | 2 ++ banana/post.inc.php | 2 ++ banana/spool.inc.php | 6 +++++- po/banana.pot | 4 ++-- po/en.po | 4 ++-- po/fr.po | 4 ++-- 7 files changed, 23 insertions(+), 7 deletions(-) diff --git a/banana/banana.inc.php.in b/banana/banana.inc.php.in index bfaa934..8cd704f 100644 --- a/banana/banana.inc.php.in +++ b/banana/banana.inc.php.in @@ -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" diff --git a/banana/misc.inc.php b/banana/misc.inc.php index 9510b14..e9f7c94 100644 --- a/banana/misc.inc.php +++ b/banana/misc.inc.php @@ -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 */ diff --git a/banana/post.inc.php b/banana/post.inc.php index 7f4e9cd..f9ca5cc 100644 --- a/banana/post.inc.php +++ b/banana/post.inc.php @@ -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); } } diff --git a/banana/spool.inc.php b/banana/spool.inc.php index c41cedc..2df59e4 100644 --- a/banana/spool.inc.php +++ b/banana/spool.inc.php @@ -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; diff --git a/po/banana.pot b/po/banana.pot index a6dbb65..a77981a 100644 --- a/po/banana.pot +++ b/po/banana.pot @@ -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 \n" "Language-Team: LANGUAGE \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 "" diff --git a/po/en.po b/po/en.po index c586b64..8295d7e 100644 --- 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 \n" "Language-Team: \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" diff --git a/po/fr.po b/po/fr.po index 111086d..7e829b3 100644 --- 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 \n" "Language-Team: \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" -- 2.1.4