From 701a7dcf5be91b9d55f114d3db5b3629acc29d80 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Fri, 10 Dec 2010 15:35:23 -0500 Subject: [PATCH] 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. --- chora/lib/Chora.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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); } + } -- 2.11.0