From dae7a3c2759ac891830dd90d26dc8e1da3e4432d Mon Sep 17 00:00:00 2001 From: antipode Date: Fri, 28 Dec 2001 18:47:42 +0000 Subject: [PATCH] Saved four invocations to strpos() in sqimap_find_displayable_name() (take 2) :^) git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1989 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/imap_general.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/functions/imap_general.php b/functions/imap_general.php index a9e1882b..e07bbc99 100755 --- a/functions/imap_general.php +++ b/functions/imap_general.php @@ -343,23 +343,21 @@ function sqimap_find_email ($string) { function sqimap_find_displayable_name ($string) { $string = ' '.trim($string); $orig_string = $string; - if (strpos($string, '<') && strpos($string, '>')) { - if (strpos($string, '<') == 1) { + if (($angle1 = strpos($string, '<')) && strpos($string, '>')) { + if ($angle1 == 1) { $string = sqimap_find_email($string); } else { $string = trim($string); - $string = substr($string, 0, strpos($string, '<')); + $string = substr($string, 0, $angle1-1); $string = ereg_replace ('"', '', $string); } if (trim($string) == '') { $string = sqimap_find_email($orig_string); } - } else if (strpos($string, '(') && strpos($string, ')')) { - $fn_start = strpos($string, '(') + 1; - $fn_len = strpos($string, ')') - $fn_start; - - $string = substr($string, $fn_start, $fn_len); + } else if ( ($paren1 = strpos($string, '(')) + && ($paren2 = strpos($string, ')'))) { + $string = substr($string, $paren1 + 1, $paren2 - $paren1 - 1); } return $string; } -- 2.25.1