From 1c252cc373fa9e7fc62c10d32d90e6fd336569b0 Mon Sep 17 00:00:00 2001 From: thomppj Date: Mon, 24 Dec 2001 05:31:13 +0000 Subject: [PATCH 1/1] Fixed bug #489722 http://sf.net/tracker/?func=detail&atid=100311&aid=489722&group_id=311 git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1902 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- src/compose.php | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/compose.php b/src/compose.php index 8ccf5594..ca43a142 100644 --- a/src/compose.php +++ b/src/compose.php @@ -126,9 +126,6 @@ require_once('../functions/plugin.php'); $body = $bodyTop . $body; } else if ($reply_id) { $orig_from = decodeHeader($orig_header->from); - $orig_from = trim(substr($orig_from,0,strpos($orig_from,'<'))); - $orig_from = str_replace('"','',$orig_from); - $orig_from = str_replace("'",'',$orig_from); $body = getReplyCitation($orig_from) . $body; } @@ -661,6 +658,23 @@ require_once('../functions/plugin.php'); return (''); } + /* Decode the users name. */ + $parpos = strpos($orig_from, '('); + if ($parpos === false) { + $orig_from = trim(substr($orig_from, 0, strpos($orig_from, '<'))); + $orig_from = str_replace('"', '', $orig_from); + $orig_from = str_replace("'", '', $orig_from); + } else { + $end_parpos = strrpos($orig_from, ')'); + $end_parpos -= ($end_parpos === false ? $end_parpos : $parpos + 1); + $orig_from = trim(substr($orig_from, $parpos + 1, $end_parpos)); + } + + /* Make sure our final value isn't an empty string. */ + if ($orig_from == '') { + return (''); + } + /* Otherwise, try to select the desired citation style. */ switch ($reply_citation_style) { case 'author_said': -- 2.25.1