Replaced ereg_replace with str_replace on several occasions, should be faster.
[squirrelmail.git] / functions / mailbox_display.php
index 1fdcc78c5bc8bc3ad7d39b2d3111c13d74c7c51c..b8ee23f3fddc757b540519a7f4f910bc900991d8 100644 (file)
@@ -12,6 +12,8 @@
  * $Id$
  */
 
+require_once('../functions/strings.php');
+
 define('PG_SEL_MAX', 10);  /* Default value for page_selector_max. */
 
 function printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $start_msg, $where, $what) {
@@ -41,11 +43,13 @@ function printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $start
      * because you can have multi receiver.
      */
     $sendersName = split(',', $msg['FROM']);
-    for( $index = 0 ; $index < count($sendersName) ; $index++ ) {
-        if( strlen($senderName) > 0 )
+    $senderName = '';
+    for ($index = 0 ; $index < count($sendersName) ; $index++) {
+        if ($senderName != '') {
             $senderName .= ', ';
-        $senderName .= sqimap_find_displayable_name($sendersName[$index]);
         }
+        $senderName .= sqimap_find_displayable_name($sendersName[$index]);
+    }
 
     if( $mailbox == 'None' ) {
         // $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
@@ -262,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('', '', '', '', '', '');