From: Michael J. Rubinsky Date: Fri, 10 Dec 2010 20:35:23 +0000 (-0500) Subject: One last ditch effort to get a good email address for looking up gravatars. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=701a7dcf5be91b9d55f114d3db5b3629acc29d80;p=horde.git One last ditch effort to get a good email address for looking up gravatars. At least in the case of git, the email address returned isn't properly quoted so parseAddressList() fails. --- diff --git a/chora/lib/Chora.php b/chora/lib/Chora.php index 8f6bb9d9b..24276c6a6 100644 --- a/chora/lib/Chora.php +++ b/chora/lib/Chora.php @@ -442,7 +442,7 @@ class Chora return htmlspecialchars($name); } - public function getAuthorEmail($name) + static public function getAuthorEmail($name) { try { $users = $GLOBALS['VC']->getUsers($GLOBALS['conf']['paths']['cvsusers']); @@ -457,11 +457,18 @@ class Chora if (count($results)) { return $results[0]->mailbox . '@' . $results[0]->host; } - } catch (Horde_Mail_Exception $e) {} + } catch (Horde_Mail_Exception $e) { + try { + if (preg_match('|<(\S+)>|', $name, $matches)) { + return self::getAuthorEmail($matches[1]); + } + } catch (Horde_Mail_Exception $e){} + } return $name; } + /** * Return formatted date information. * @@ -496,4 +503,5 @@ class Chora ? $log : preg_replace($GLOBALS['conf']['tickets']['regexp'], $GLOBALS['conf']['tickets']['replacement'], $log); } + }