From e2e29b2deafffb98d156fb3f726a3968b3492522 Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 18 Sep 2011 17:16:02 -0700 Subject: [PATCH] only header encode if necessary --- boot.php | 2 +- include/email.php | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/boot.php b/boot.php index e073aee68..6e78b21f6 100644 --- a/boot.php +++ b/boot.php @@ -7,7 +7,7 @@ require_once('include/text.php'); require_once("include/pgettext.php"); -define ( 'FRIENDIKA_VERSION', '2.2.1106' ); +define ( 'FRIENDIKA_VERSION', '2.2.1107' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); define ( 'DB_UPDATE_VERSION', 1087 ); diff --git a/include/email.php b/include/email.php index b34084549..3e6a8186d 100644 --- a/include/email.php +++ b/include/email.php @@ -169,6 +169,17 @@ function email_get_part($mbox,$uid,$p,$partno) { function email_header_encode($in_str, $charset) { $out_str = $in_str; + $need_to_convert = false; + + for($x = 0; $x < strlen($in_str); $x ++) { + if((ord($in_str[$x]) == 0) || ((ord($in_str[$x]) > 128))) { + $need_to_convert = true; + } + } + + if(! $need_to_convert) + return $in_str; + if ($out_str && $charset) { // define start delimimter, end delimiter and spacer