' .
- _("Server-side sorting is not supported by your IMAP server.") . ' ' .
- _("Please contact your system administrator and report this error.") .
- '
';
- } else {
- $aMailbox['UIDSET'][$iSetIndx] = $id;
- }
- break;
- default:
- $id = NULL;
- if ($aMailbox['SEARCH'][$iSetIndx] != 'ALL') {
- $id = sqimap_run_search($imapConnection, $aMailbox['SEARCH'][$iSetIndx], $aMailbox['CHARSET'][$iSetIndx]);
- }
- $sSortField = getSortField($aMailbox['SORT'],false);
- $aMailbox['UIDSET'][$iSetIndx] = get_squirrel_sort($imapConnection, $sSortField, $bDirection, $id);
- break;
- }
- return $error;
-}
-
-
-
-
function fetchMessageHeaders($imapConnection, &$aMailbox) {
+ /* FIX ME, this function is kind of big, maybe we can split it up in
+ a couple of functions. Make sure the functions are private and starts with _
+ Also make sure that the error codes are propagated */
+
/**
* Retrieve the UIDSET.
* Setindex is used to be able to store multiple uid sets. That will make it
@@ -904,31 +288,39 @@ function fetchMessageHeaders($imapConnection, &$aMailbox) {
}
}
-
if (is_array($aMailbox['UIDSET'])) {
$aUid =& $aMailbox['UIDSET'][$iSetIndx];
} else {
$aUid = false;
}
+ $aFetchHeaders = $aMailbox['FETCHHEADERS'];
+ $iError = 0;
+ $aFetchItems = $aHeaderItems = array();
// initialize the fields we want to retrieve:
- $aHeaderFields = array('Date', 'To', 'Cc', 'From', 'Subject', 'X-Priority', 'Importance', 'Priority', 'Content-Type');
- $aFetchItems = array('FLAGS', 'RFC822.SIZE');
-
- // Are we sorting on internaldate then retrieve the internaldate value as well
- if ($aMailbox['INTERNALDATE']) {
- $aFetchItems[] = 'INTERNALDATE';
+ $aHeaderFields = array();
+ foreach ($aFetchHeaders as $v) {
+ switch ($v) {
+ case SQM_COL_DATE: $aHeaderFields[] = 'Date'; break;
+ case SQM_COL_TO: $aHeaderFields[] = 'To'; break;
+ case SQM_COL_CC: $aHeaderFields[] = 'Cc'; break;
+ case SQM_COL_FROM: $aHeaderFields[] = 'From'; break;
+ case SQM_COL_SUBJ: $aHeaderFields[] = 'Subject'; break;
+ case SQM_COL_PRIO: $aHeaderFields[] = 'X-Priority'; break;
+ case SQM_COL_ATTACHMENT: $aHeaderFields[] = 'Content-Type'; break;
+ case SQM_COL_INT_DATE: $aFetchItems[] = 'INTERNALDATE'; break;
+ case SQM_COL_FLAGS: $aFetchItems[] = 'FLAGS'; break;
+ case SQM_COL_SIZE: $aFetchItems[] = 'RFC822.SIZE'; break;
+ default: break;
+ }
}
-
/**
* A uidset with sorted uid's is available. We can use the cache
*/
- if (($aMailbox['SORT'] != SQSORT_NONE || $aMailbox['SEARCH'][$iSetIndx] != 'ALL') &&
- isset($aUid) && $aUid ) {
-
+ if (isset($aUid) && $aUid ) {
// limit the cache to SQM_MAX_PAGES_IN_CACHE
- if (!$aMailbox['SHOWALL'][$iSetIndx]) {
+ if (!$aMailbox['SHOWALL'][$iSetIndx] && isset($aMailbox['MSG_HEADERS'])) {
$iMaxMsgs = $iLimit * SQM_MAX_PAGES_IN_CACHE;
$iCacheSize = count($aMailbox['MSG_HEADERS']);
if ($iCacheSize > $iMaxMsgs) {
@@ -946,8 +338,20 @@ function fetchMessageHeaders($imapConnection, &$aMailbox) {
$id_slice = array_slice($aUid,$start_msg-1,$iLimit);
/* do some funky cache checks */
- $aUidCached = array_keys($aMailbox['MSG_HEADERS']);
+ if (isset($aMailbox['MSG_HEADERS']) && is_array($aMailbox['MSG_HEADERS'])) {
+ // temp code, read_body del / next links fo not update fields.
+ foreach ($aMailbox['MSG_HEADERS'] as $iUid => $aValue) {
+ if (!isset($aValue['UID'])) {
+ unset($aMailbox['MSG_HEADERS'][$iUid]);
+ }
+ }
+ $aUidCached = array_keys($aMailbox['MSG_HEADERS']);
+ } else {
+ $aMailbox['MSG_HEADERS'] = array();
+ $aUidCached = array();
+ }
$aUidNotCached = array_values(array_diff($id_slice,$aUidCached));
+
/**
* $aUidNotCached contains an array with UID's which need to be fetched to
* complete the needed message headers.
@@ -958,210 +362,139 @@ function fetchMessageHeaders($imapConnection, &$aMailbox) {
// append the msgs to the existend headers
$aMailbox['MSG_HEADERS'] += $aMsgs;
}
-
} else {
/**
- * Initialize the sorted UID list and fetch the visible message headers
+ * Initialize the sorted UID list or initiate a UID list with search
+ * results and fetch the visible message headers
*/
- if ($aMailbox['SORT'] != SQSORT_NONE || $aMailbox['SEARCH'][$iSetIndx] != 'ALL') {// || $aMailbox['SORT_METHOD'] & SQSORT_THREAD 'THREAD') {
- $error = false;
+ if ($aMailbox['SEARCH'][$iSetIndx] != 'ALL') { // in case of a search request
+
if ($aMailbox['SEARCH'][$iSetIndx] && $aMailbox['SORT'] == 0) {
$aUid = sqimap_run_search($imapConnection, $aMailbox['SEARCH'][$iSetIndx], $aMailbox['CHARSET'][$iSetIndx]);
} else {
- $error = get_sorted_msgs_list($imapConnection,$aMailbox,$error);
+
+ $iError = 0;
+ $iError = _get_sorted_msgs_list($imapConnection,$aMailbox,$iError);
$aUid = $aMailbox['UIDSET'][$iSetIndx];
}
- if ($error === false) {
+ if (!$iError) {
+ /**
+ * Number of messages is the resultset
+ */
+ $aMailbox['TOTAL'][$iSetIndx] = count($aUid);
$id_slice = array_slice($aUid,$aMailbox['OFFSET'], $iLimit);
if (count($id_slice)) {
$aMailbox['MSG_HEADERS'] = sqimap_get_small_header_list($imapConnection,$id_slice,
$aHeaderFields,$aFetchItems);
} else {
- return false;
+ $iError = 1; // FIX ME, define an error code
}
-
- } else {
- // FIX ME, format message and fallback to squirrel sort
- if ($error) {
- echo $error;
+ }
+ } else { //
+ $iError = 0;
+ $iError = _get_sorted_msgs_list($imapConnection,$aMailbox,$iError);
+ $aUid = $aMailbox['UIDSET'][$iSetIndx];
+
+ if (!$iError) {
+ /**
+ * Number of messages is the resultset
+ */
+ $aMailbox['TOTAL'][$iSetIndx] = count($aUid);
+ $id_slice = array_slice($aUid,$aMailbox['OFFSET'], $iLimit);
+ if (count($id_slice)) {
+ $aMailbox['MSG_HEADERS'] = sqimap_get_small_header_list($imapConnection,$id_slice,
+ $aHeaderFields,$aFetchItems);
+ } else {
+ $iError = 1; // FIX ME, define an error code
}
}
- } else {
- // limit the cache to SQM_MAX_PAGES_IN_CACHE
- if (!$aMailbox['SHOWALL'][$iSetIndx] && isset($aMailbox['MSG_HEADERS']) && is_array($aMailbox['MSG_HEADERS'])) {
- $iMaxMsgs = $iLimit * SQM_MAX_PAGES_IN_CACHE;
- $iCacheSize = count($aMailbox['MSG_HEADERS']);
- if ($iCacheSize > $iMaxMsgs) {
- $iReduce = $iCacheSize - $iMaxMsgs;
- foreach ($aMailbox['MSG_HEADERS'] as $iUid => $value) {
- if ($iReduce) {
- $iId = $aMailbox['MSG_HEADERS'][$iUid]['ID'];
- unset($aMailbox['MSG_HEADERS'][$iUid]);
- unset($aMailbox['ID'][$iId]);
- } else {
- break;
- }
- --$iReduce;
- }
- }
- }
-
- /**
- * retrieve messages by sequence id's and fetch the UID to retrieve
- * the UID. for sorted lists this is not needed because a UID FETCH
- * automaticly add the UID value in fetch results
- **/
- $aFetchItems[] = 'UID';
-
- //create id range
- $iRangeStart = $aMailbox['EXISTS'] - $aMailbox['OFFSET'];
- $iRangeEnd = ($iRangeStart > $iLimit) ?
- ($iRangeStart - $iLimit+1):1;
-
- $id_slice = range($iRangeStart, $iRangeEnd);
- /**
- * Non sorted mailbox with cached message headers
- */
- if (isset($aMailbox['ID']) && is_array($aMailbox['ID'])) {
- // the fetched id => uid relation
- $aId = $aMailbox['ID'];
- $aIdCached = array();
- foreach ($aId as $iId => $iUid) {
- if (isset($aMailbox['MSG_HEADERS'][$iUid])) {
- if ($iId <= $iRangeStart && $iId >= $iRangeEnd) {
- $aIdCached[] = $iId;
- }
- }
- }
- $aIdNotCached = array_diff($id_slice,$aIdCached);
- } else {
- $aIdNotCached = $id_slice;
- }
-
- if (count($aIdNotCached)) {
- $aMsgs = sqimap_get_small_header_list($imapConnection,$aIdNotCached,
- $aHeaderFields,$aFetchItems);
- // append the msgs to the existend headers
- if (isset($aMailbox['MSG_HEADERS']) && is_array($aMailbox['MSG_HEADERS'])) {
- $aMailbox['MSG_HEADERS'] += $aMsgs;
- } else {
- $aMailbox['MSG_HEADERS'] = $aMsgs;
- }
- // update the ID array
- foreach ($aMsgs as $iUid => $aMsg) {
- if (isset($aMsg['ID'])) {
- $aMailbox['ID'][$aMsg['ID']] = $iUid;
- }
- }
- }
-
- /**
- * In unsorted state we show newest messages first which means
- * that the UIDSET which represents the order of the messages
- * should contain a high to low ordered UID list
- */
- $aSortedUidList = array();
- foreach ($id_slice as $iId) {
- if (isset($aMailbox['ID'][$iId])) {
- $aSortedUidList[] = $aMailbox['ID'][$iId];
- }
- }
- $aMailbox['UIDSET'][$iSetIndx] = $aSortedUidList;
- $aMailbox['OFFSET'] = 0;
}
}
- return true;
+ return $iError;
}
/**
- * This function loops through a group of messages in the mailbox
- * and shows them to the user.
+ * Prepares the message headers for display inside a template. The links are calculated,
+ * color for row highlighting is calculated and optionally the strings are truncated.
*
- * @param mixed $imapConnection
- * @param array $aMailbox associative array with mailbox related vars
+ * @param array $aMailbox (reference) mailbox retrieved from sqm_api_mailbox_select
+ * @param array $aProps properties
+ * @return array $aFormattedMessages array with message headers and format info
+ * @since 1.5.1
+ * @author Marc Groot Koerkamp
*/
-function showMessagesForMailbox($imapConnection, &$aMailbox) {
- global $color, $javascript_on, $compact_paginator;
-
- // to retrieve the internaldate pref: (I know this is not the right place to do that, move up in front
- // and use a properties array as function argument to provide user preferences
- global $data_dir, $username;
-
- if (!fetchMessageHeaders($imapConnection, $aMailbox)) {
- return false;
- }
- $iSetIndx = $aMailbox['SETINDEX'];
- $iLimit = ($aMailbox['SHOWALL'][$iSetIndx]) ? $aMailbox['EXISTS'] : $aMailbox['LIMIT'];
- $iEnd = ($aMailbox['PAGEOFFSET'] + ($iLimit - 1) < $aMailbox['EXISTS']) ?
- $aMailbox['PAGEOFFSET'] + $iLimit - 1 : $aMailbox['EXISTS'];
+function prepareMessageList(&$aMailbox, $aProps) {
- $paginator_str = get_paginator_str($aMailbox['NAME'], $aMailbox['PAGEOFFSET'],
- $aMailbox['EXISTS'], $aMailbox['LIMIT'], $aMailbox['SHOWALL'][$iSetIndx]);
+ /* Globalize link attributes so plugins can share in modifying them */
+ global $link, $title, $target, $onclick, $link_extra, $preselected;
- $msg_cnt_str = get_msgcnt_str($aMailbox['PAGEOFFSET'], $iEnd,$aMailbox['EXISTS']);
+ /* retrieve the properties */
+ $my_email_address = (isset($aProps['email'])) ? $aProps['email'] : false;
+ $highlight_list = (isset($aProps['config']['highlight_list'])) ? $aProps['config']['highlight_list'] : false;
+ $aColumnDesc = (isset($aProps['columns'])) ? $aProps['columns'] : false;
+ $aExtraColumns = (isset($aProps['extra_columns'])) ? $aProps['extra_columns'] : array();
+ $iAccount = (isset($aProps['account'])) ? (int) $aProps['account'] : 0;
+ $sMailbox = (isset($aProps['mailbox'])) ? $aProps['mailbox'] : false;
+ $sTargetModule = (isset($aProps['module'])) ? $aProps['module'] : 'read_body';
- do_hook('mailbox_index_before');
+ /*
+ * TODO 1, retrieve array with identity email addresses in order to match against to,cc and set a flag
+ * $aFormattedMessages[$iUid]['match_identity'] = true
+ * The template can show some image if there is a match.
+ * TODO 2, makes sure the matching is done fast by doing a strpos call on the returned $value
+ */
- if ($javascript_on && $compact_paginator) {
- // Insert compact paginator javascript
- echo "\n\n"
- . "\n"
- . "\n";
+ /**
+ * Only retrieve values for displayable columns
+ */
+ foreach ($aColumnDesc as $k => $v) {
+ switch ($k) {
+ case SQM_COL_FROM: $aCol[SQM_COL_FROM] = 'from'; break;
+ case SQM_COL_DATE: $aCol[SQM_COL_DATE] = 'date'; break;
+ case SQM_COL_SUBJ: $aCol[SQM_COL_SUBJ] = 'subject'; break;
+ case SQM_COL_FLAGS: $aCol[SQM_COL_FLAGS] = 'FLAGS'; break;
+ case SQM_COL_SIZE: $aCol[SQM_COL_SIZE] = 'SIZE'; break;
+ case SQM_COL_PRIO: $aCol[SQM_COL_PRIO] = 'x-priority'; break;
+ case SQM_COL_ATTACHMENT: $aCol[SQM_COL_ATTACHMENT] = 'content-type'; break;
+ case SQM_COL_INT_DATE: $aCol[SQM_COL_INT_DATE] = 'INTERNALDATE'; break;
+ case SQM_COL_TO: $aCol[SQM_COL_TO] = 'to'; break;
+ case SQM_COL_CC: $aCol[SQM_COL_CC] = 'cc'; break;
+ case SQM_COL_BCC: $aCol[SQM_COL_BCC] = 'bcc'; break;
+ default: break;
+ }
+ }
+ $aExtraHighLightColumns = array();
+ foreach ($aExtraColumns as $v) {
+ switch ($v) {
+ case SQM_COL_FROM: $aExtraHighLightColumns[] = 'from'; break;
+ case SQM_COL_SUBJ: $aExtraHighLightColumns[] = 'subject'; break;
+ case SQM_COL_TO: $aExtraHighLightColumns[] = 'to'; break;
+ case SQM_COL_CC: $aExtraHighLightColumns[] = 'cc'; break;
+ case SQM_COL_BCC: $aExtraHighLightColumns[] = 'bcc'; break;
+ default: break;
+ }
+ }
+ $aFormattedMessages = array();
+
+
+ $iSetIndx = $aMailbox['SETINDEX'];
+ $aId = $aMailbox['UIDSET'][$iSetIndx];
+ $aHeaders =& $aMailbox['MSG_HEADERS']; /* use a reference to avoid a copy.
+ MSG_HEADERS can contain large amounts of data */
+ $iOffset = $aMailbox['OFFSET'];
+ $sort = $aMailbox['SORT'];
+ $iPageOffset = $aMailbox['PAGEOFFSET'];
+ $sMailbox = $aMailbox['NAME'];
+ $sSearch = (isset($aMailbox['SEARCH'][$aMailbox['SETINDEX']]) &&
+ $aMailbox['SEARCH'][$aMailbox['SETINDEX']] != 'ALL') ? $aMailbox['SEARCH'][$aMailbox['SETINDEX']] : false;
+ $aSearch = ($sSearch) ? array('search.php',$aMailbox['SETINDEX']) : null;
+ /* avoid improper usage */
+ if ($sMailbox && isset($iAccount) && $sTargetModule) {
+ $aInitQuery = array("account=$iAccount",'mailbox='.urlencode($sMailbox));
+ } else {
+ $aInitQuery = false;
}
- mail_message_listing_beginning($imapConnection, $aMailbox, $msg_cnt_str, $paginator_str);
-?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $aHeaders[$aId[$i]],
- 'INDX' => $t,
- 'OFFSET' => $iOffset,
- 'PAGEOFFSET' => $iPageOffset,
- 'SORT' => $sort,
- 'SEARCH' => $aSearch,
- 'MAILBOX' => $sMailbox,
- 'INDENT' => $indent,
- 'LAST' => $bLast
- );
- printMessageInfo($aMsg);
- ++$t;
- } else {
- break;
- }
- }
-}
-
-/**
- * Displays the standard message list header.
- *
- * To finish the table, you need to do a "";
- *
- * @param resource $imapConnection
- * @param array $aMailbox associative array with mailbox related information
- * @param string $msg_cnt_str
- * @param string $paginator Paginator string
- */
-function mail_message_listing_beginning ($imapConnection,
- $aMailbox,
- $msg_cnt_str = '',
- $paginator = ' '
- ) {
- global $color, $show_flag_buttons, $PHP_SELF;
- global $lastTargetMailbox, $boxes;
-
- $php_self = $PHP_SELF;
-
- if (preg_match('/^(.+)\?.+$/',$php_self,$regs)) {
- $source_url = $regs[1];
- } else {
- $source_url = $php_self;
- }
- $php_self = str_replace('&', '&', $php_self);
- if (!isset($msg)) {
- $msg = '';
- }
+ $bHighLight = false;
+ $value = $title = $link = $target = $onclick = $link_extra = '';
+ $aQuery = ($aInitQuery !== false) ? $aInitQuery : false;
+ $aMsg = $aHeaders[$aId[$i]];
+ if (isset($aSearch) && count($aSearch) > 1 && $aQuery) {
+ $aQuery[] = "where=". $aSearch[0];
+ $aQuery[] = "what=" . $aSearch[1];
+ }
+ $iUid = (isset($aMsg['UID'])) ? $aMsg['UID'] : $aId[$i];
+ if ($aQuery) {
+ $aQuery[] = "passed_id=$aId[$i]";
+ $aQuery[] = "startMessage=$iPageOffset";
+ }
- $moveFields = addHidden('msg', $msg).
- addHidden('mailbox', $aMailbox['NAME']).
- addHidden('startMessage', $aMailbox['PAGEOFFSET']);
+ foreach ($aCol as $k => $v) {
+ $title = $link = $target = $onclick = $link_extra = '';
+ $aColumns[$k] = array();
+ $value = (isset($aMsg[$v])) ? $aMsg[$v] : '';
+ $sUnknown = _("Unknown recipient");
+ switch ($k) {
+ case SQM_COL_FROM:
+ $sUnknown = _("Unknown sender");
+ case SQM_COL_TO:
+ case SQM_COL_CC:
+ case SQM_COL_BCC:
+ $sTmp = false;
+ if ($value) {
+ if ($highlight_list && !$bHighLight) {
+ $bHighLight = highlightMessage($aCol[$k], $value, $highlight_list,$aFormattedMessages[$iUid]);
+ }
+ $aAddressList = parseRFC822Address($value);
+ $sTmp = getAddressString($aAddressList,array('best' => true));
+ $title = $title_maybe = '';
+ foreach ($aAddressList as $aAddr) {
+ $sPersonal = (isset($aAddr[SQM_ADDR_PERSONAL])) ? $aAddr[SQM_ADDR_PERSONAL] : '';
+ $sMailbox = (isset($aAddr[SQM_ADDR_MAILBOX])) ? $aAddr[SQM_ADDR_MAILBOX] : '';
+ $sHost = (isset($aAddr[SQM_ADDR_HOST])) ? $aAddr[SQM_ADDR_HOST] : '';
+ if ($sPersonal) {
+ $title .= htmlspecialchars($sMailbox.'@'.$sHost).', ';
+ } else {
+ // if $value gets truncated we need to add the addresses with no
+ // personal name as well
+ $title_maybe .= htmlspecialchars($sMailbox.'@'.$sHost).', ';
+ }
+ }
+ if ($title) {
+ $title = substr($title,0,-2); // strip ', ';
+ }
+ $sTmp = decodeHeader($sTmp);
+ if (isset($aColumnDesc[$k]['truncate']) && $aColumnDesc[$k]['truncate']) {
+ $sTrunc = truncateWithEntities($sTmp, $aColumnDesc[$k]['truncate']);
+ if ($sTrunc != $sTmp) {
+ if (!$title) {
+ $title = $sTmp;
+ } else if ($title_maybe) {
+ $title = $title .', '.$title_maybe;
+ $title = substr($title,0,-2); // strip ', ';
+ }
+ }
+ $sTmp = $sTrunc;
+ }
+ }
+ $value = ($sTmp) ? $sTmp : $sUnknown;
+ break;
+ case SQM_COL_SUBJ:
+ // subject is mime encoded, decode it.
+ // value is sanitized in decoding function.
+ // TODO, verify if it should be done before or after the highlighting
+ $value=decodeHeader($value);
+ if ($highlight_list && !$bHighLight) {
+ $bHighLight = highlightMessage('SUBJECT', $value, $highlight_list, $aFormattedMessages[$iUid]);
+ }
+ $iIndent = (isset($aIndentArray[$aId[$i]])) ? $aIndentArray[$aId[$i]] : 0;
+ // 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);
+ // 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 */
+ if ($aQuery) {
+ // TODO, $sTargetModule should be a query parameter so that we can use a single entrypoint
+ $link = $sTargetModule.'.php?' . implode('&',$aQuery);
+
+ // see top of this function for which attributes are available
+ // in the global scope for plugin use (like $link, $target,
+ // $onclick, $link_extra, $title, and so forth)
+ // plugins are responsible for sharing nicely (such as for
+ // setting the target, etc)
+ $temp = array(&$iPageOffset, &$sSearch, &$aSearch, $aMsg);
+ do_hook('subject_link', $temp);
+ }
+ $value = (trim($value)) ? $value : _("(no subject)");
+ /* add thread indentation */
+ $aColumns[$k]['indent'] = $iIndent;
+ break;
+ case SQM_COL_SIZE:
+ $value = show_readable_size($value);
+ break;
+ case SQM_COL_DATE:
+ case SQM_COL_INT_DATE:
+ $value = getDateString(getTimeStamp(explode(' ',trim($value))));
+ break;
+ case SQM_COL_FLAGS:
+ $aFlagColumn = array('seen' => false,
+ 'deleted'=>false,
+ 'answered'=>false,
+ 'flagged' => false,
+ 'draft' => false);
+
+ if(!is_array($value)) $value = array();
+ foreach ($value as $sFlag => $v) {
+ switch ($sFlag) {
+ case '\\seen' : $aFlagColumn['seen'] = true; break;
+ case '\\deleted' : $aFlagColumn['deleted'] = true; break;
+ case '\\answered': $aFlagColumn['answered'] = true; break;
+ case '\\flagged' : $aFlagColumn['flagged'] = true; break;
+ case '\\draft' : $aFlagColumn['draft'] = true; break;
+ default: break;
+ }
+ }
+ $value = $aFlagColumn;
+ break;
+ case SQM_COL_PRIO:
+ $value = ($value) ? (int) $value : 3;
+ break;
+ case SQM_COL_ATTACHMENT:
+ $value = (is_array($value) && $value[0] == 'multipart' && $value[1] == 'mixed') ? true : false;
+ break;
+ case SQM_COL_CHECK:
+ $value = ($checkall || in_array($iUid, $preselected));
+ break;
+ default : break;
+ }
+ if ($title) { $aColumns[$k]['title'] = $title; }
+ if ($link) { $aColumns[$k]['link'] = $link; }
+ if ($link_extra) { $aColumns[$k]['link_extra'] = $link_extra; }
+ if ($onclick) { $aColumns[$k]['onclick'] = $onclick; }
+ if ($target) { $aColumns[$k]['target'] = $target; }
+ $aColumns[$k]['value'] = $value;
+ }
+ /* columns which will not be displayed but should be inspected
+ because the highlight list contains rules with those columns */
+ foreach ($aExtraHighLightColumns as $v) {
+ if ($highlight_list && !$bHighLight && isset($aMsg[$v])) {
+ $bHighLight = highlightMessage($v, $aMsg[$v], $highlight_list,$aFormattedMessages[$iUid]);
+ }
+ }
+ $aFormattedMessages[$iUid]['columns'] = $aColumns;
- /* build thread sorting links */
- $sort = $aMailbox['SORT'];
- if ($aMailbox['ALLOW_THREAD']) {
- if ($aMailbox['SORT'] & SQSORT_THREAD) {
- $sort -= SQSORT_THREAD;
- $thread_name = _("Unthread View");
} else {
- $thread_name = _("Thread View");
- $sort = $aMailbox['SORT'] + SQSORT_THREAD;
+ break;
}
- $thread_link_str = '[' . $thread_name
- . ']';
- } else {
- $thread_link_str ='';
- }
- /*
- * This is the beginning of the message list table.
- * It wraps around all messages
- */
- $safe_name = preg_replace("/[^0-9A-Za-z_]/", '_', $aMailbox['NAME']);
- $form_name = "FormMsgs" . $safe_name;
-
- echo '