Fixed bug #489722
authorthomppj <thomppj@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 24 Dec 2001 05:31:13 +0000 (05:31 +0000)
committerthomppj <thomppj@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 24 Dec 2001 05:31:13 +0000 (05:31 +0000)
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

index 8ccf559404bb196861289085a0ba3c36a0d89a77..ca43a14251bbfa1e52d6862c5622657c8618d24a 100644 (file)
@@ -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':