Replaced ereg_replace with str_replace on several occasions, should be faster.
authorkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 29 Jan 2002 00:07:50 +0000 (00:07 +0000)
committerkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 29 Jan 2002 00:07:50 +0000 (00:07 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2275 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/imap_messages.php
functions/imap_search.php
functions/mailbox_display.php
functions/mime.php
src/compose.php
src/options_highlight.php
src/vcard.php

index d95531576f997564ba082115f4eaa3af44de3ab4..f03e46aa4a12f426ea455477bcc083f1c8de8615 100755 (executable)
@@ -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');
 }
index 6660d38ea39cb81027d8a8aaa6898e7dbbe2babf..86e6f2bd43e36ba3e383f624051240393ef2fa8f 100644 (file)
@@ -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);
index 1a304005bd4e146f772bb3f8b11aef5eb3a8519c..b8ee23f3fddc757b540519a7f4f910bc900991d8 100644 (file)
@@ -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('', '', '', '', '', '');
index b050533c4ff3f9a51208f43200dc3f62a045cf9e..1175f26f4ba2eaee8aa3659463f8a6e9795857d5 100644 (file)
@@ -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)) {
index 37a15656dc083e350c2006878a511fdd885dba9f..749a542ba86679060474bb78348ae23c30d782b1 100644 (file)
@@ -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 = '';
 
index cd7723d24f08506651260c0a960dab8d902bb10d..bade16cbd43665ec831639891a8339777ec54a87 100644 (file)
@@ -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;
index 8aa55c2d5b32673ef6e283464df5e51d54e69905..14d9166008d6a86a2b3b75e7c25a1471e6a89edb 100644 (file)
@@ -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 '</select>' .
         '</TD></TR></TABLE>' .
         '</body></html>';
 
-?>
\ No newline at end of file
+?>