From: Michael M Slusarz Date: Fri, 23 Jul 2010 15:58:23 +0000 (-0600) Subject: Fix parsing mailto: URLs in HTML viewer X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=b524c489fd3eee15e5c1a7fd8c301a8e0c96a5e2;p=horde.git Fix parsing mailto: URLs in HTML viewer --- diff --git a/imp/lib/IMP.php b/imp/lib/IMP.php index 7e1577563..e269a9771 100644 --- a/imp/lib/IMP.php +++ b/imp/lib/IMP.php @@ -297,13 +297,9 @@ class IMP /** * Checks for To:, Subject:, Cc:, and other compose window arguments and - * pass back either a URI fragment or an associative array with any of - * them which are present. + * pass back an associative array of those that are present. * - * @param string $format Either 'uri' or 'array'. - * - * @return string A URI fragment or an associative array with any compose - * arguments present. + * @return string An associative array with compose arguments. */ static public function getComposeArgs() { @@ -316,7 +312,18 @@ class IMP } } - /* Decode mailto: URLs. */ + return self::_decodeMailto($args); + } + + /** + * Checks for mailto: prefix in the To field. + * + * @param array $args A list of compose arguments. + * + * @return array The array with the To: argument stripped of mailto:. + */ + static protected function _decodeMailto($args) + { if (isset($args['to']) && (strpos($args['to'], 'mailto:') === 0)) { $mailto = @parse_url($args['to']); if (is_array($mailto)) { @@ -376,6 +383,8 @@ class IMP } } + $args = self::_decodeMailto($args); + /* Merge the two argument arrays. */ return (is_array($extra) && !empty($extra)) ? array_merge($args, $extra) diff --git a/imp/lib/Mime/Viewer/Html.php b/imp/lib/Mime/Viewer/Html.php index 364303bdf..d528951c1 100644 --- a/imp/lib/Mime/Viewer/Html.php +++ b/imp/lib/Mime/Viewer/Html.php @@ -301,8 +301,9 @@ class IMP_Horde_Mime_Viewer_Html extends Horde_Mime_Viewer_Html if (!$child->hasAttribute('target') && $child->hasAttribute('href')) { $url = parse_url($child->getAttribute('href')); - if (empty($url['fragment']) && - ($url['scheme'] != 'mailto:')) { + if ($url['scheme'] == 'mailto') { + $child->setAttribute('href', IMP::composeLink($child->getAttribute('href'))); + } elseif (empty($url['fragment'])) { $child->setAttribute('target', $this->_tmp['target']); } }