From 0f8a1ce94ff62c4a6022969cf2b3e8fb695282f4 Mon Sep 17 00:00:00 2001 From: kink Date: Tue, 29 Jan 2002 00:07:50 +0000 Subject: [PATCH] Replaced ereg_replace with str_replace on several occasions, should be faster. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2275 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/imap_messages.php | 2 +- functions/imap_search.php | 14 +++++++------- functions/mailbox_display.php | 2 +- functions/mime.php | 4 ++-- src/compose.php | 2 +- src/options_highlight.php | 12 ++++++------ src/vcard.php | 4 ++-- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/functions/imap_messages.php b/functions/imap_messages.php index d9553157..f03e46aa 100755 --- a/functions/imap_messages.php +++ b/functions/imap_messages.php @@ -245,7 +245,7 @@ function sqimap_get_small_header_list ($imap_stream, $msg_list, $issent) { function sqimap_get_flags ($imap_stream, $i) { $read = sqimap_run_command ($imap_stream, "FETCH $i:$i FLAGS", true, $response, $message); if (ereg("FLAGS(.*)", $read[0], $regs)) { - return explode(" ", trim(ereg_replace('[\\(\\)\\\\]', '', $regs[1]))); + return explode(' ', trim(ereg_replace('[\\(\\)\\\\]', '', $regs[1]))); } return Array('None'); } diff --git a/functions/imap_search.php b/functions/imap_search.php index 6660d38e..86e6f2bd 100644 --- a/functions/imap_search.php +++ b/functions/imap_search.php @@ -31,19 +31,19 @@ function sqimap_search($imapConnection,$search_where,$search_what,$mailbox,$colo # account for multiple search terms $multi_search = array (); - $search_what = ereg_replace("[ ]{2,}", " ", $search_what); - $multi_search = split (" ", $search_what); + $search_what = ereg_replace("[ ]{2,}", ' ', $search_what); + $multi_search = split (' ', $search_what); if (count($multi_search)==1) { - $search_string = $search_where . " " . "\"" . $multi_search[0] . "\""; + $search_string = $search_where . ' ' . '"' . $multi_search[0] . '"'; } else { - $search_string = ""; + $search_string = ''; $count = count($multi_search); for ($x=0;$x<$count;$x++) { - $search_string = $search_string . " " . $search_where . " " . "\"" . $multi_search[$x] . "\""; + $search_string = $search_string . ' ' . $search_where . " " . '"' . $multi_search[$x] . '" '; } } - $search_string = ereg_replace("^ ", "", $search_string); + $search_string = trim($search_string); # now use $search_string in the imap search @@ -110,7 +110,7 @@ function sqimap_search($imapConnection,$search_where,$search_what,$mailbox,$colo $j = 0; while ($j < count($messagelist)) { - $date[$j] = ereg_replace(' ', ' ', $date[$j]); + $date[$j] = str_replace(' ', ' ', $date[$j]); $tmpdate = explode(" ", trim($date[$j])); $messages[$j]["TIME_STAMP"] = getTimeStamp($tmpdate); diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index 1a304005..b8ee23f3 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -266,7 +266,7 @@ function showMessagesForMailbox while ($j < $end_loop) { if (isset($date[$j])) { - $date[$j] = ereg_replace(' ', ' ', $date[$j]); + $date[$j] = str_replace(' ', ' ', $date[$j]); $tmpdate = explode(' ', trim($date[$j])); } else { $tmpdate = $date = array('', '', '', '', '', ''); diff --git a/functions/mime.php b/functions/mime.php index b050533c..1175f26f 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -765,10 +765,10 @@ function decodeBody($body, $encoding) { function decodeHeader ($string, $utfencode=true) { if (eregi('=\\?([^?]+)\\?(q|b)\\?([^?]+)\\?=', $string, $res)) { - if (ucfirst($res[2]) == "B") { + if (ucfirst($res[2]) == 'B') { $replace = base64_decode($res[3]); } else { - $replace = ereg_replace("_", " ", $res[3]); + $replace = str_replace('_', ' ', $res[3]); // Convert lowercase Quoted Printable to uppercase for // quoted_printable_decode to understand it. while (ereg("(=(([0-9][abcdef])|([abcdef][0-9])|([abcdef][abcdef])))", $replace, $res)) { diff --git a/src/compose.php b/src/compose.php index 37a15656..749a542b 100644 --- a/src/compose.php +++ b/src/compose.php @@ -330,7 +330,7 @@ function newMail () { /* This formats a CC string if they hit "reply all" */ if ($send_to_cc != '') { $send_to_cc = ereg_replace('"[^"]*"', '', $send_to_cc); - $send_to_cc = ereg_replace(';', ',', $send_to_cc); + $send_to_cc = str_replace(';', ',', $send_to_cc); $sendcc = explode(',', $send_to_cc); $send_to_cc = ''; diff --git a/src/options_highlight.php b/src/options_highlight.php index cd7723d2..bade16cb 100644 --- a/src/options_highlight.php +++ b/src/options_highlight.php @@ -38,16 +38,16 @@ if ($action == 'delete' && isset($theid)) { exit; } else if ($action == 'save') { if (!$theid) $theid = 0; - $identname = ereg_replace(',', ' ', $identname); + $identname = str_replace(',', ' ', $identname); if ($color_type == 1) $newcolor = $newcolor_choose; elseif ($color_type == 2) $newcolor = $newcolor_input; else $newcolor = $color_type; - $newcolor = ereg_replace(',', '', $newcolor); - $newcolor = ereg_replace('#', '', $newcolor); - $newcolor = ereg_replace('"', '', $newcolor); - $newcolor = ereg_replace('\'', '', $newcolor); - $value = ereg_replace(',', ' ', $value); + $newcolor = str_replace(',', '', $newcolor); + $newcolor = str_replace('#', '', $newcolor); + $newcolor = str_replace('"', '', $newcolor); + $newcolor = str_replace('\'', '', $newcolor); + $value = str_replace(',', ' ', $value); setPref($data_dir, $username, "highlight$theid", $identname.','.$newcolor.','.$value.','.$match_type); $message_highlight_list[$theid]['name'] = $identname; diff --git a/src/vcard.php b/src/vcard.php index 8aa55c2d..14d91660 100644 --- a/src/vcard.php +++ b/src/vcard.php @@ -59,7 +59,7 @@ foreach ($vcard as $l) { $k .= ';' . $attr; } - $v = ereg_replace(';', "\n", $v); + $v = str_replace(';', "\n", $v); $vcard_nice[$k] = $v; } @@ -201,4 +201,4 @@ echo '' . '' . ''; -?> \ No newline at end of file +?> -- 2.25.1