forked from extern/egroupware
backporting some fixes for the display of the message list, and filtering issues
This commit is contained in:
parent
7dddf8041f
commit
64a409adae
@ -1166,11 +1166,18 @@
|
||||
$filter = $this->createIMAPFilter($_folderName, $_filter);
|
||||
if($this->icServer->hasCapability('SORT')) {
|
||||
$sortOrder = $this->_getSortString($_sort);
|
||||
$sortResult = $this->icServer->sort($sortOrder, 'US-ASCII', $filter, true);
|
||||
if (!empty($this->displayCharset)) {
|
||||
$sortResult = $this->icServer->sort($sortOrder, strtoupper( $this->displayCharset ), $filter, true);
|
||||
}
|
||||
if (PEAR::isError($sortResult) || empty($this->displayCharset)) {
|
||||
$sortResult = $this->icServer->sort($sortOrder, 'US-ASCII', $filter, true);
|
||||
}
|
||||
} else {
|
||||
$sortResult = $this->icServer->search($filter, true);
|
||||
$advFilter = 'CHARSET '. strtoupper($this->displayCharset) .' '.$filter;
|
||||
$sortResult = $this->icServer->search($advFilter, true);
|
||||
if (PEAR::isError($sortResult)) $sortResult = $this->icServer->search($filter, true);
|
||||
if(is_array($sortResult)) {
|
||||
sort($sortResult, SORT_NUMERIC);
|
||||
sort($sortResult, SORT_NUMERIC);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1290,70 +1297,79 @@
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
|
||||
foreach((array)$headersNew as $headerObject) {
|
||||
#if($count == 0) _debug_array($headerObject);
|
||||
$uid = $headerObject['UID'];
|
||||
if (is_array($headersNew)) {
|
||||
foreach((array)$headersNew as $headerObject) {
|
||||
#if($count == 0) _debug_array($headerObject);
|
||||
$uid = $headerObject['UID'];
|
||||
|
||||
// make dates like "Mon, 23 Apr 2007 10:11:06 UT" working with strtotime
|
||||
if(substr($headerObject['DATE'],-2) === 'UT') {
|
||||
$headerObject['DATE'] .= 'C';
|
||||
}
|
||||
// make dates like "Mon, 23 Apr 2007 10:11:06 UT" working with strtotime
|
||||
if(substr($headerObject['DATE'],-2) === 'UT') {
|
||||
$headerObject['DATE'] .= 'C';
|
||||
}
|
||||
|
||||
$retValue['header'][$sortOrder[$uid]]['subject'] = $this->decode_header($headerObject['SUBJECT']);
|
||||
$retValue['header'][$sortOrder[$uid]]['size'] = $headerObject['SIZE'];
|
||||
$retValue['header'][$sortOrder[$uid]]['date'] = strtotime($headerObject['DATE']);
|
||||
$retValue['header'][$sortOrder[$uid]]['mimetype'] = $headerObject['MIMETYPE'];
|
||||
$retValue['header'][$sortOrder[$uid]]['id'] = $headerObject['MSG_NUM'];
|
||||
$retValue['header'][$sortOrder[$uid]]['uid'] = $headerObject['UID'];
|
||||
$retValue['header'][$sortOrder[$uid]]['recent'] = in_array('\\Recent', $headerObject['FLAGS']);
|
||||
$retValue['header'][$sortOrder[$uid]]['flagged'] = in_array('\\Flagged', $headerObject['FLAGS']);
|
||||
$retValue['header'][$sortOrder[$uid]]['answered'] = in_array('\\Answered', $headerObject['FLAGS']);
|
||||
$retValue['header'][$sortOrder[$uid]]['deleted'] = in_array('\\Deleted', $headerObject['FLAGS']);
|
||||
$retValue['header'][$sortOrder[$uid]]['seen'] = in_array('\\Seen', $headerObject['FLAGS']);
|
||||
$retValue['header'][$sortOrder[$uid]]['draft'] = in_array('\\Draft', $headerObject['FLAGS']);
|
||||
|
||||
if(is_array($headerObject['FROM'][0])) {
|
||||
if($headerObject['FROM'][0]['HOST_NAME'] != 'NIL') {
|
||||
$retValue['header'][$sortOrder[$uid]]['sender_address'] = $headerObject['FROM'][0]['EMAIL'];
|
||||
} else {
|
||||
$retValue['header'][$sortOrder[$uid]]['sender_address'] = $headerObject['FROM'][0]['MAILBOX_NAME'];
|
||||
}
|
||||
if($headerObject['FROM'][0]['PERSONAL_NAME'] != 'NIL') {
|
||||
$retValue['header'][$sortOrder[$uid]]['sender_name'] = $this->decode_header($headerObject['FROM'][0]['PERSONAL_NAME']);
|
||||
$retValue['header'][$sortOrder[$uid]]['subject'] = $this->decode_header($headerObject['SUBJECT']);
|
||||
$retValue['header'][$sortOrder[$uid]]['size'] = $headerObject['SIZE'];
|
||||
$retValue['header'][$sortOrder[$uid]]['date'] = strtotime($headerObject['DATE']);
|
||||
$retValue['header'][$sortOrder[$uid]]['mimetype'] = $headerObject['MIMETYPE'];
|
||||
$retValue['header'][$sortOrder[$uid]]['id'] = $headerObject['MSG_NUM'];
|
||||
$retValue['header'][$sortOrder[$uid]]['uid'] = $headerObject['UID'];
|
||||
if (is_array($headerObject['FLAGS'])) {
|
||||
$retValue['header'][$sortOrder[$uid]]['recent'] = in_array('\\Recent', $headerObject['FLAGS']);
|
||||
$retValue['header'][$sortOrder[$uid]]['flagged'] = in_array('\\Flagged', $headerObject['FLAGS']);
|
||||
$retValue['header'][$sortOrder[$uid]]['answered'] = in_array('\\Answered', $headerObject['FLAGS']);
|
||||
$retValue['header'][$sortOrder[$uid]]['deleted'] = in_array('\\Deleted', $headerObject['FLAGS']);
|
||||
$retValue['header'][$sortOrder[$uid]]['seen'] = in_array('\\Seen', $headerObject['FLAGS']);
|
||||
$retValue['header'][$sortOrder[$uid]]['draft'] = in_array('\\Draft', $headerObject['FLAGS']);
|
||||
}
|
||||
if(is_array($headerObject['FROM']) && is_array($headerObject['FROM'][0])) {
|
||||
if($headerObject['FROM'][0]['HOST_NAME'] != 'NIL') {
|
||||
$retValue['header'][$sortOrder[$uid]]['sender_address'] = $headerObject['FROM'][0]['EMAIL'];
|
||||
} else {
|
||||
$retValue['header'][$sortOrder[$uid]]['sender_address'] = $headerObject['FROM'][0]['MAILBOX_NAME'];
|
||||
}
|
||||
if($headerObject['FROM'][0]['PERSONAL_NAME'] != 'NIL') {
|
||||
$retValue['header'][$sortOrder[$uid]]['sender_name'] = $this->decode_header($headerObject['FROM'][0]['PERSONAL_NAME']);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(is_array($headerObject['TO'][0])) {
|
||||
if($headerObject['TO'][0]['HOST_NAME'] != 'NIL') {
|
||||
$retValue['header'][$sortOrder[$uid]]['to_address'] = $headerObject['TO'][0]['EMAIL'];
|
||||
} else {
|
||||
$retValue['header'][$sortOrder[$uid]]['to_address'] = $headerObject['TO'][0]['MAILBOX_NAME'];
|
||||
}
|
||||
if($headerObject['TO'][0]['PERSONAL_NAME'] != 'NIL') {
|
||||
$retValue['header'][$sortOrder[$uid]]['to_name'] = $this->decode_header($headerObject['TO'][0]['PERSONAL_NAME']);
|
||||
}
|
||||
if(is_array($headerObject['TO']) && is_array($headerObject['TO'][0])) {
|
||||
if($headerObject['TO'][0]['HOST_NAME'] != 'NIL') {
|
||||
$retValue['header'][$sortOrder[$uid]]['to_address'] = $headerObject['TO'][0]['EMAIL'];
|
||||
} else {
|
||||
$retValue['header'][$sortOrder[$uid]]['to_address'] = $headerObject['TO'][0]['MAILBOX_NAME'];
|
||||
}
|
||||
if($headerObject['TO'][0]['PERSONAL_NAME'] != 'NIL') {
|
||||
$retValue['header'][$sortOrder[$uid]]['to_name'] = $this->decode_header($headerObject['TO'][0]['PERSONAL_NAME']);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$count++;
|
||||
}
|
||||
|
||||
// sort the messages to the requested displayorder
|
||||
if(is_array($retValue['header'])) {
|
||||
ksort($retValue['header']);
|
||||
$retValue['info']['total'] = $total;
|
||||
$retValue['info']['first'] = $_startMessage;
|
||||
$retValue['info']['last'] = $_startMessage + $count - 1 ;
|
||||
return $retValue;
|
||||
$count++;
|
||||
}
|
||||
// sort the messages to the requested displayorder
|
||||
if(is_array($retValue['header'])) {
|
||||
ksort($retValue['header']);
|
||||
$retValue['info']['total'] = $total;
|
||||
$retValue['info']['first'] = $_startMessage;
|
||||
$retValue['info']['last'] = $_startMessage + $count - 1 ;
|
||||
return $retValue;
|
||||
} else {
|
||||
$retValue = array();
|
||||
$retValue['info']['total'] = 0;
|
||||
$retValue['info']['first'] = 0;
|
||||
$retValue['info']['last'] = 0;
|
||||
return $retValue;
|
||||
}
|
||||
} else {
|
||||
$retValue = array();
|
||||
$retValue['info']['total'] = 0;
|
||||
$retValue['info']['first'] = 0;
|
||||
$retValue['info']['last'] = 0;
|
||||
return $retValue;
|
||||
}
|
||||
error_log("bofelamimail::getHeaders -> retrieval of Message Details failed: ".print_r($headersNew,TRUE));
|
||||
$retValue = array();
|
||||
$retValue['info']['total'] = 0;
|
||||
$retValue['info']['first'] = 0;
|
||||
$retValue['info']['last'] = 0;
|
||||
return $retValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function getNextMessage($_foldername, $_id)
|
||||
|
Loading…
Reference in New Issue
Block a user