Fix for folder cache if the cache was somehow broken. Reproduced bad cache
[squirrelmail.git] / functions / mailbox_display.php
index 1ffe727c35c238d3663712f545e998dd761439bf..26290e6813d059359eefd48b301f9e703ee530fb 100644 (file)
@@ -342,7 +342,7 @@ function fetchMessageHeaders($imapConnection, &$aMailbox) {
 
         $id_slice = array_slice($aUid,$start_msg-1,$iLimit);
         /* do some funky cache checks */
-        if (isset($aMailbox['MSG_HEADERS'])) {
+        if (isset($aMailbox['MSG_HEADERS']) && is_array($aMailbox['MSG_HEADERS'])) {
             $aUidCached = array_keys($aMailbox['MSG_HEADERS']);
         } else {
             $aMailbox['MSG_HEADERS'] = array();
@@ -576,7 +576,8 @@ function prepareMessageList(&$aMailbox, $aProps) {
                     // FIXME: don't break 8bit symbols and html entities during truncation
                     if (isset($aColumnDesc[$k]['truncate']) && $aColumnDesc[$k]['truncate']) {
                         $sTmp = truncateWithEntities($value, $aColumnDesc[$k]['truncate']-$iIndent);
-                        $title = ($sTmp != $value) ? $value : '';
+                        // drop any double spaces since these will be displayed in the title
+                        $title = ($sTmp != $value) ? preg_replace('/\s{2,}/', ' ', $value) : '';
                         $value = $sTmp;
                     }
                     /* generate the link to the message */
@@ -1381,4 +1382,4 @@ function attachSelectedMessages($imapConnection,$aMsgHeaders) {
     return $composesession;
 }
 
-?>
\ No newline at end of file
+?>