fix PHP 8 errors shown by PHPStorm

This commit is contained in:
Ralf Becker 2021-03-30 20:34:34 +02:00
parent 7307d28e53
commit 6ce05919b6
7 changed files with 59 additions and 96 deletions

View File

@ -162,8 +162,9 @@ class mail_acl
$n = 1; $n = 1;
foreach ($acl as $key => $value) foreach ($acl as $key => $value)
{ {
$virtuals = array_pop(array_values((array)$value)); $parts = array_values((array)$value);
$rights = array_shift(array_values((array)$value)); $virtuals = array_pop($parts);
$rights = array_shift($parts);
foreach ($rights as $right) foreach ($rights as $right)
{ {

View File

@ -1073,7 +1073,8 @@ class mail_compose
if (($_REQUEST['mimeType']=="text" ||$_REQUEST['mimeType']=="plain") && $content['mimeType'] == 'html') if (($_REQUEST['mimeType']=="text" ||$_REQUEST['mimeType']=="plain") && $content['mimeType'] == 'html')
{ {
$_content['mimeType'] = $content['mimeType'] = 'plain'; $_content['mimeType'] = $content['mimeType'] = 'plain';
$content['body'] = $this->convertHTMLToText(str_replace(array("\n\r","\n"),' ',$content['body'])); $html = str_replace(array("\n\r","\n"),' ',$content['body']);
$content['body'] = $this->convertHTMLToText($html);
} }
if ($_REQUEST['mimeType']=="html" && $content['mimeType'] != 'html') if ($_REQUEST['mimeType']=="html" && $content['mimeType'] != 'html')
{ {
@ -1092,7 +1093,8 @@ class mail_compose
$content['mimeType'] == 'html') $content['mimeType'] == 'html')
{ {
$_content['mimeType'] = $content['mimeType'] = 'plain'; $_content['mimeType'] = $content['mimeType'] = 'plain';
$content['body'] = $this->convertHTMLToText(str_replace(array("\n\r","\n"),' ',$content['body'])); $html = str_replace(array("\n\r","\n"),' ',$content['body']);
$content['body'] = $this->convertHTMLToText($html);
} }
if (!empty($this->mailPreferences['replyOptions']) && $this->mailPreferences['replyOptions']=="html" && if (!empty($this->mailPreferences['replyOptions']) && $this->mailPreferences['replyOptions']=="html" &&
$content['mimeType'] != 'html') $content['mimeType'] != 'html')
@ -1553,10 +1555,10 @@ class mail_compose
case 'forward': case 'forward':
$mode = ($_GET['mode']=='forwardinline'?'inline':'asmail'); $mode = ($_GET['mode']=='forwardinline'?'inline':'asmail');
// this fill the session data with the values from the original email // this fill the session data with the values from the original email
foreach ($replyIds as &$mail_id) foreach ($replyIds as &$m_id)
{ {
//error_log(__METHOD__.__LINE__.' ID:'.$mail_id.' Mode:'.$mode); //error_log(__METHOD__.__LINE__.' ID:'.$m_id.' Mode:'.$mode);
$hA = mail_ui::splitRowID($mail_id); $hA = mail_ui::splitRowID($m_id);
$msgUID = $hA['msgUID']; $msgUID = $hA['msgUID'];
$folder = $hA['folder']; $folder = $hA['folder'];
$content = $this->getForwardData($icServer, $folder, $msgUID, $part_id, $mode); $content = $this->getForwardData($icServer, $folder, $msgUID, $part_id, $mode);
@ -1610,13 +1612,6 @@ class mail_compose
base64_encode($folder).mail_ui::$delimiter.$merged_mail_id; base64_encode($folder).mail_ui::$delimiter.$merged_mail_id;
$content = $this->getComposeFrom($merged_mail_id, $part_id, 'composefromdraft', $_focusElement, $suppressSigOnTop, $isReply); $content = $this->getComposeFrom($merged_mail_id, $part_id, 'composefromdraft', $_focusElement, $suppressSigOnTop, $isReply);
} }
else
{
$success = implode(', ',$results['success']);
$fail = implode(', ', $results['failed']);
if($success) Framework::message($success, 'success');
Framework::window_close($fail);
}
} }
catch (Api\Exception\WrongUserinput $e) catch (Api\Exception\WrongUserinput $e)
{ {
@ -2116,7 +2111,8 @@ class mail_compose
} }
} }
//error_log(__METHOD__.__LINE__.'->'.array2string($attachment)); //error_log(__METHOD__.__LINE__.'->'.array2string($attachment));
Api\Header\Content::safe($attachment['attachment'], $attachment['name'], $attachment['type'], $size=0, true, $_GET['mode'] == "save"); $size = 0;
Api\Header\Content::safe($attachment['attachment'], $attachment['name'], $attachment['type'], $size, true, $_GET['mode'] == "save");
echo $attachment['attachment']; echo $attachment['attachment'];
exit(); exit();

View File

@ -657,7 +657,7 @@ class mail_hooks
// $_folderName, $_startMessage, $_numberOfMessages, $_sort, $_reverse, $_filter, $_thisUIDOnly=null, $_cacheResult=true // $_folderName, $_startMessage, $_numberOfMessages, $_sort, $_reverse, $_filter, $_thisUIDOnly=null, $_cacheResult=true
$headers = $bomail->getHeaders($notify_folder, 1, 999, 0, true, $_filter,null,false); $headers = $bomail->getHeaders($notify_folder, 1, 999, 0, true, $_filter,null,false);
if(is_array($headers['header']) && count($headers['header']) > 0) { if(is_array($headers['header']) && count($headers['header']) > 0) {
foreach($headers['header'] as $id=>$header) { foreach($headers['header'] as $header) {
// check if unseen mail has already been notified // check if unseen mail has already been notified
$headerrowid = mail_ui::generateRowID($activeProfile, $notify_folder, $header['uid'], $_prependApp=false); $headerrowid = mail_ui::generateRowID($activeProfile, $notify_folder, $header['uid'], $_prependApp=false);
if(!in_array($headerrowid, $notified_mail_uidsCache[$activeProfile][$notify_folder])) { if(!in_array($headerrowid, $notified_mail_uidsCache[$activeProfile][$notify_folder])) {

View File

@ -400,7 +400,7 @@ class mail_integration {
'html_message' => $mailcontent['html_message'], 'html_message' => $mailcontent['html_message'],
'date' => $mailcontent['date'], 'date' => $mailcontent['date'],
'subject' => $mailcontent['subject'], 'subject' => $mailcontent['subject'],
'entry_id' => $app_entry_id 'entry_id' => null,
); );
} }

View File

@ -278,6 +278,7 @@ class mail_sieve
//$ruleID is calculated by priority from the selected rule and is an unique ID //$ruleID is calculated by priority from the selected rule and is an unique ID
$content['ruleID'] = $ruleID = ($this->rulesByID['priority'] -1) / 2; $content['ruleID'] = $ruleID = ($this->rulesByID['priority'] -1) / 2;
$error = 0; $error = 0;
$msg = '';
switch ($button) switch ($button)
{ {
case 'save': case 'save':
@ -1040,14 +1041,9 @@ class mail_sieve
$complete .= $andor; $complete .= $andor;
} }
$complete .= "message " . $xthan . $rule['size'] . "KB'"; $complete .= "message " . $xthan . $rule['size'] . "KB'";
$started = 1;
} }
if (!empty($rule['field_bodytransform'])) if (!empty($rule['field_bodytransform']))
{ {
if ($started)
{
$newruletext .= ", ";
}
$btransform = " :raw "; $btransform = " :raw ";
$match = ' :contains'; $match = ' :contains';
if ($rule['bodytransform']) if ($rule['bodytransform'])
@ -1063,15 +1059,9 @@ class mail_sieve
$match = ':regex'; $match = ':regex';
} }
$complete .= " body " . $btransform . $match . " \"" . $rule['field_bodytransform'] . "\""; $complete .= " body " . $btransform . $match . " \"" . $rule['field_bodytransform'] . "\"";
$started = 1;
} }
if ($rule['ctype']!= '0' && !empty($rule['ctype'])) if ($rule['ctype']!= '0' && !empty($rule['ctype']))
{ {
if ($started)
{
$newruletext .= ", ";
}
$btransform_ctype = Mail\Script::$btransform_ctype_array[$rule['ctype']]; $btransform_ctype = Mail\Script::$btransform_ctype_array[$rule['ctype']];
$ctype_subtype = ""; $ctype_subtype = "";
if ($rule['field_ctype_val']) if ($rule['field_ctype_val'])
@ -1079,7 +1069,6 @@ class mail_sieve
$ctype_subtype = "/"; $ctype_subtype = "/";
} }
$complete .= " body :content " . " \"" . $btransform_ctype . $ctype_subtype . $rule['field_ctype_val'] . "\"" . " :contains \"\""; $complete .= " body :content " . " \"" . $btransform_ctype . $ctype_subtype . $rule['field_ctype_val'] . "\"" . " :contains \"\"";
$started = 1;
//error_log(__CLASS__."::".__METHOD__.array2string(Mail\Script::$btransform_ctype_array)); //error_log(__CLASS__."::".__METHOD__.array2string(Mail\Script::$btransform_ctype_array));
} }
if (!$rule['unconditional']) if (!$rule['unconditional'])

View File

@ -2803,7 +2803,8 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
} }
//error_log(__METHOD__.__LINE__.'->'.array2string($attachment)); //error_log(__METHOD__.__LINE__.'->'.array2string($attachment));
$filename = ($attachment['name']?$attachment['name']:($attachment['filename']?$attachment['filename']:$mailbox.'_uid'.$uid.'_part'.$part)); $filename = ($attachment['name']?$attachment['name']:($attachment['filename']?$attachment['filename']:$mailbox.'_uid'.$uid.'_part'.$part));
Api\Header\Content::safe($attachment['attachment'], $filename, $attachment['type'], $size=0, True, $_GET['mode'] == "save"); $size = 0;
Api\Header\Content::safe($attachment['attachment'], $filename, $attachment['type'], $size, True, $_GET['mode'] == "save");
echo $attachment['attachment']; echo $attachment['attachment'];
exit(); exit();
@ -2845,18 +2846,20 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
} }
$GLOBALS['egw']->session->commit_session(); $GLOBALS['egw']->session->commit_session();
$headers = Horde_Mime_Headers::parseHeaders($message);
$subject = str_replace('$$','__',Mail::decode_header($headers['SUBJECT']));
if (!$display) if (!$display)
{ {
$headers = Horde_Mime_Headers::parseHeaders($message);
$subject = str_replace('$$','__',Mail::decode_header($headers['SUBJECT']));
$subject = Api\Mail::clean_subject_for_filename($subject); $subject = Api\Mail::clean_subject_for_filename($subject);
Api\Header\Content::safe($message, $subject.".eml", $mime='message/rfc822', $size=0, true, true); $mime='message/rfc822';
Api\Header\Content::safe($message, $subject.".eml", $mime);
echo $message; echo $message;
} }
else else
{ {
$subject = Api\Mail::clean_subject_for_filename($subject); $subject = Api\Mail::clean_subject_for_filename($subject);
Api\Header\Content::safe($message, $subject.".eml", $mime='text/html', $size=0, true, false); $mime='text/html'; $size=0;
Api\Header\Content::safe($message, $subject.".eml", $mime, $size, true, false);
print '<pre>'. htmlspecialchars($message, ENT_NOQUOTES|ENT_SUBSTITUTE, 'utf-8') .'</pre>'; print '<pre>'. htmlspecialchars($message, ENT_NOQUOTES|ENT_SUBSTITUTE, 'utf-8') .'</pre>';
} }
} }
@ -3387,7 +3390,11 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
$body = ''; $body = '';
//error_log(__METHOD__.array2string($bodyParts)); //exit; //error_log(__METHOD__.array2string($bodyParts)); //exit;
if (empty($bodyParts)) return ""; if (empty($bodyParts))
{
$ret = '';
return $ret;
}
foreach((array)$bodyParts as $singleBodyPart) { foreach((array)$bodyParts as $singleBodyPart) {
if (!isset($singleBodyPart['body'])) { if (!isset($singleBodyPart['body'])) {
$singleBodyPart['body'] = $this->getdisplayableBody($singleBodyPart,$modifyURI,$useTidy); $singleBodyPart['body'] = $this->getdisplayableBody($singleBodyPart,$modifyURI,$useTidy);
@ -3462,26 +3469,15 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
// create links for websites // create links for websites
if ($modifyURI) $newBody = Api\Html::activate_links($newBody); if ($modifyURI) $newBody = Api\Html::activate_links($newBody);
//error_log(__METHOD__.__LINE__.'..'.$newBody);
// redirect links for websites if you use no cookies
#if (!($GLOBALS['egw_info']['server']['usecookies']))
# $newBody = preg_replace("/href=(\"|\')((http(s?):\/\/)|(www\.))([\w,\-,\/,\?,\=,\.,&amp;,!\n,\%,@,\(,\),\*,#,:,~,\+]+)(\"|\')/ie",
# "'href=\"$webserverURL/redirect.php?go='.@htmlentities(urlencode('http$4://$5$6'),ENT_QUOTES,\"Mail::$displayCharset\").'\"'", $newBody);
// create links for email addresses // create links for email addresses
//TODO:if ($modifyURI) $this->parseEmail($newBody);
// create links for inline images // create links for inline images
if ($modifyURI) if ($modifyURI)
{ {
$newBody = self::resolve_inline_images($newBody, $this->mailbox, $this->uid, $this->partID, 'plain'); $newBody = self::resolve_inline_images($newBody, $this->mailbox, $this->uid, $this->partID, 'plain');
} }
//TODO:$newBody = $this->highlightQuotes($newBody);
// to display a mailpart of mimetype plain/text, may be better taged as preformatted // to display a mailpart of mimetype plain/text, may be better taged as preformatted
#$newBody = nl2br($newBody);
// since we do not display the message as HTML anymore we may want to insert good linebreaking (for visibility).
//error_log(__METHOD__.__LINE__.'..'.$newBody);
// dont break lines that start with > (&gt; as the text was processed with htmlentities before)
$newBody = "<pre>".Mail::wordwrap($newBody,90,"\n",'&gt;')."</pre>"; $newBody = "<pre>".Mail::wordwrap($newBody,90,"\n",'&gt;')."</pre>";
} }
else else
@ -3503,22 +3499,17 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
{ {
$newBody = $cleaned; $newBody = $cleaned;
} }
if (!$preserveHTML) // ToDo KL: $preserveHTML is NOT initialised, so always if is dead code // filter only the 'body', as we only want that part, if we throw away the Api\Html
if (preg_match('`(<htm.+?<body[^>]*>)(.+?)(</body>.*?</html>)`ims', $newBody, $matches) && !empty($matches[2]))
{ {
// filter only the 'body', as we only want that part, if we throw away the Api\Html $hasOther = true;
preg_match('`(<htm.+?<body[^>]*>)(.+?)(</body>.*?</html>)`ims', $newBody, $matches=array()); $newBody = $matches[2];
if ($matches[2])
{
$hasOther = true;
$newBody = $matches[2];
}
} }
} }
else else
{ {
// htmLawed filter only the 'body' // htmLawed filter only the 'body'
preg_match('`(<htm.+?<body[^>]*>)(.+?)(</body>.*?</html>)`ims', $newBody, $matches=array()); if (preg_match('`(<htm.+?<body[^>]*>)(.+?)(</body>.*?</html>)`ims', $newBody, $matches)&& !empty($matches[2]))
if ($matches[2])
{ {
$hasOther = true; $hasOther = true;
$newBody = $matches[2]; $newBody = $matches[2];
@ -3528,28 +3519,11 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
// as we switched off HTMLaweds tidy functionality // as we switched off HTMLaweds tidy functionality
$newBody = str_replace(array('&amp;amp;','<DIV><BR></DIV>',"<DIV>&nbsp;</DIV>",'<div>&nbsp;</div>'),array('&amp;','<BR>','<BR>','<BR>'),$newBody); $newBody = str_replace(array('&amp;amp;','<DIV><BR></DIV>',"<DIV>&nbsp;</DIV>",'<div>&nbsp;</div>'),array('&amp;','<BR>','<BR>','<BR>'),$newBody);
$newBody = $htmLawed->run($newBody,Mail::$htmLawed_config); $newBody = $htmLawed->run($newBody,Mail::$htmLawed_config);
if ($hasOther && $preserveHTML) $newBody = $matches[1]. $newBody. $matches[3];
$alreadyHtmlLawed=true; $alreadyHtmlLawed=true;
} }
// do the cleanup, set for the use of purifier // do the cleanup, set for the use of purifier
//$newBodyBuff = $newBody; Mail::getCleanHTML($newBody);
/* if (!$alreadyHtmlLawed)*/ Mail::getCleanHTML($newBody);
/*
// in a way, this tests if we are having real utf-8 (the displayCharset) by now; we should if charsets reported (or detected) are correct
if (strtoupper(Mail::$displayCharset) == 'UTF-8')
{
$test = @json_encode($newBody);
//error_log(__METHOD__.__LINE__.' ->'.strlen($singleBodyPart['body']).' Error:'.json_last_error().'<- BodyPart:#'.$test.'#');
if (($test=="null" || $test === false || is_null($test)) && strlen($newBody)>0)
{
$newBody = $newBodyBuff;
$tv = Mail::$htmLawed_config['tidy'];
Mail::$htmLawed_config['tidy'] = 0;
Mail::getCleanHTML($newBody);
Mail::$htmLawed_config['tidy'] = $tv;
}
}
*/
// removes stuff between http and ?http // removes stuff between http and ?http
$Protocol = '(http:\/\/|(ftp:\/\/|https:\/\/))'; // only http:// gets removed, other protocolls are shown $Protocol = '(http:\/\/|(ftp:\/\/|https:\/\/))'; // only http:// gets removed, other protocolls are shown
$newBody = preg_replace('~'.$Protocol.'[^>]*\?'.$Protocol.'~sim','$1',$newBody); // removes stuff between http:// and ?http:// $newBody = preg_replace('~'.$Protocol.'[^>]*\?'.$Protocol.'~sim','$1',$newBody); // removes stuff between http:// and ?http://
@ -3558,10 +3532,6 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
"\\1@\\2.\\3", "\\1@\\2.\\3",
$newBody); $newBody);
// redirect links for websites if you use no cookies
#if (!($GLOBALS['egw_info']['server']['usecookies'])) { //do it all the time, since it does mask the mailadresses in urls
//TODO:if ($modifyURI) $this->parseHREF($newBody);
#}
// create links for inline images // create links for inline images
if ($modifyURI) if ($modifyURI)
{ {
@ -3872,6 +3842,7 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
//error_log(__METHOD__.__LINE__.array2string($_formData)); //error_log(__METHOD__.__LINE__.array2string($_formData));
if (empty($_formData['file'])) $_formData['file'] = $_formData['tmp_name']; if (empty($_formData['file'])) $_formData['file'] = $_formData['tmp_name'];
// check if formdata meets basic restrictions (in tmp dir, or vfs, mimetype, etc.) // check if formdata meets basic restrictions (in tmp dir, or vfs, mimetype, etc.)
$alert_msg = '';
try try
{ {
$tmpFileName = Mail::checkFileBasics($_formData,$importID); $tmpFileName = Mail::checkFileBasics($_formData,$importID);
@ -4909,7 +4880,8 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
$this->mail_bo->deleteMessages('all',$junkFolder,'remove_immediately'); $this->mail_bo->deleteMessages('all',$junkFolder,'remove_immediately');
$heirarchyDelimeter = $this->mail_bo->getHierarchyDelimiter(true); $heirarchyDelimeter = $this->mail_bo->getHierarchyDelimiter(true);
$fShortName = array_pop(explode($heirarchyDelimeter, $junkFolder)); $parts = explode($heirarchyDelimeter, $junkFolder);
$fShortName = array_pop($parts);
$fStatus = array( $fStatus = array(
$icServerID.self::$delimiter.$junkFolder => lang($fShortName) $icServerID.self::$delimiter.$junkFolder => lang($fShortName)
); );
@ -4959,7 +4931,8 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
$this->mail_bo->compressFolder($trashFolder); $this->mail_bo->compressFolder($trashFolder);
$heirarchyDelimeter = $this->mail_bo->getHierarchyDelimiter(true); $heirarchyDelimeter = $this->mail_bo->getHierarchyDelimiter(true);
$fShortName = array_pop(explode($heirarchyDelimeter, $trashFolder)); $parts = explode($heirarchyDelimeter, $trashFolder);
$fShortName = array_pop($parts);
$fStatus = array( $fStatus = array(
$icServerID.self::$delimiter.$trashFolder => lang($fShortName) $icServerID.self::$delimiter.$trashFolder => lang($fShortName)
); );
@ -5077,8 +5050,8 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
if ($query['enddate']) $cutoffdate2 = Api\DateTime::to($query['enddate'],'ts');//BEFORE, startdate if ($query['enddate']) $cutoffdate2 = Api\DateTime::to($query['enddate'],'ts');//BEFORE, startdate
//error_log(__METHOD__.__LINE__.' Startdate:'.$cutoffdate2.' Enddate'.$cutoffdate); //error_log(__METHOD__.__LINE__.' Startdate:'.$cutoffdate2.' Enddate'.$cutoffdate);
$filter = array( $filter = array(
'filterName' => (Mail::$supportsORinQuery[$mail_ui->mail_bo->profileID]?lang('quicksearch'):lang('subject')), 'filterName' => lang('subject'),
'type' => ($query['cat_id']?$query['cat_id']:(Mail::$supportsORinQuery[$mail_ui->mail_bo->profileID]?'quick':'subject')), 'type' => ($query['cat_id']?$query['cat_id']:'subject'),
'string' => $query['search'], 'string' => $query['search'],
'status' => 'any',//this is a status change. status will be manipulated later on 'status' => 'any',//this is a status change. status will be manipulated later on
//'range'=>"BETWEEN",'since'=> date("d-M-Y", $cutoffdate),'before'=> date("d-M-Y", $cutoffdate2) //'range'=>"BETWEEN",'since'=> date("d-M-Y", $cutoffdate),'before'=> date("d-M-Y", $cutoffdate2)
@ -5112,12 +5085,14 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
{ {
$filter2toggle['status'][] = $query['filter']; $filter2toggle['status'][] = $query['filter'];
} }
$reverse = 1;
$rByUid = true;
$_sRt = $this->mail_bo->getSortedList( $_sRt = $this->mail_bo->getSortedList(
$folder, $folder,
$sort = 0, $sort = 0,
$reverse = 1, $reverse,
$filter2toggle, $filter2toggle,
$rByUid = true, $rByUid,
false false
); );
$messageListForToggle = $_sRt['match']->ids; $messageListForToggle = $_sRt['match']->ids;
@ -5126,12 +5101,14 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
{ {
$filter['status'][] = $query['filter']; $filter['status'][] = $query['filter'];
} }
$reverse = 1;
$rByUid = true;
$_sR = $this->mail_bo->getSortedList( $_sR = $this->mail_bo->getSortedList(
$folder, $folder,
$sort = 0, $sort = 0,
$reverse = 1, $reverse,
$filter, $filter,
$rByUid = true, $rByUid,
false false
); );
$messageList = $_sR['match']->ids; $messageList = $_sR['match']->ids;
@ -5267,8 +5244,8 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
if ($query['enddate']) $cutoffdate2 = Api\DateTime::to($query['enddate'],'ts');//BEFORE, startdate if ($query['enddate']) $cutoffdate2 = Api\DateTime::to($query['enddate'],'ts');//BEFORE, startdate
//error_log(__METHOD__.__LINE__.' Startdate:'.$cutoffdate2.' Enddate'.$cutoffdate); //error_log(__METHOD__.__LINE__.' Startdate:'.$cutoffdate2.' Enddate'.$cutoffdate);
$filter = array( $filter = array(
'filterName' => (Mail::$supportsORinQuery[$mail_ui->mail_bo->profileID]?lang('quicksearch'):lang('subject')), 'filterName' => lang('subject'),
'type' => ($query['cat_id']?$query['cat_id']:(Mail::$supportsORinQuery[$mail_ui->mail_bo->profileID]?'quick':'subject')), 'type' => ($query['cat_id']?$query['cat_id']:'subject'),
'string' => $query['search'], 'string' => $query['search'],
'status' => (!empty($query['filter'])?$query['filter']:'any'), 'status' => (!empty($query['filter'])?$query['filter']:'any'),
//'range'=>"BETWEEN",'since'=> date("d-M-Y", $cutoffdate),'before'=> date("d-M-Y", $cutoffdate2) //'range'=>"BETWEEN",'since'=> date("d-M-Y", $cutoffdate),'before'=> date("d-M-Y", $cutoffdate2)
@ -5429,8 +5406,8 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
if ($query['enddate']) $cutoffdate2 = Api\DateTime::to($query['enddate'],'ts');//BEFORE, startdate if ($query['enddate']) $cutoffdate2 = Api\DateTime::to($query['enddate'],'ts');//BEFORE, startdate
//error_log(__METHOD__.__LINE__.' Startdate:'.$cutoffdate2.' Enddate'.$cutoffdate); //error_log(__METHOD__.__LINE__.' Startdate:'.$cutoffdate2.' Enddate'.$cutoffdate);
$filter = array( $filter = array(
'filterName' => (Mail::$supportsORinQuery[$mail_ui->mail_bo->profileID]?lang('quicksearch'):lang('subject')), 'filterName' => lang('subject'),
'type' => ($query['cat_id']?$query['cat_id']:(Mail::$supportsORinQuery[$mail_ui->mail_bo->profileID]?'quick':'subject')), 'type' => ($query['cat_id']?$query['cat_id']:'subject'),
'string' => $query['search'], 'string' => $query['search'],
'status' => (!empty($query['filter'])?$query['filter']:'any'), 'status' => (!empty($query['filter'])?$query['filter']:'any'),
//'range'=>"BETWEEN",'since'=> date("d-M-Y", $cutoffdate),'before'=> date("d-M-Y", $cutoffdate2) //'range'=>"BETWEEN",'since'=> date("d-M-Y", $cutoffdate),'before'=> date("d-M-Y", $cutoffdate2)
@ -5458,7 +5435,7 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
$sort=0, $sort=0,
$reverse, $reverse,
$filter, $filter,
$rByUid=true, $rByUid,
false false
); );
$messageList = $_sR['match']->ids; $messageList = $_sR['match']->ids;

View File

@ -658,12 +658,12 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
$this->mail->reopen($folder); $this->mail->reopen($folder);
// receive entire mail (header + body) // receive entire mail (header + body)
// get message headers for specified message // get message headers for specified message
$headers = $this->mail->getMessageEnvelope($uid, $_partID, true, $folder); $headers = $this->mail->getMessageEnvelope($uid, '', true, $folder);
// build a new mime message, forward entire old mail as file // build a new mime message, forward entire old mail as file
if ($preferencesArray['message_forwarding'] == 'asmail') if ($preferencesArray['message_forwarding'] == 'asmail')
{ {
$rawHeader = $this->mail->getMessageRawHeader($smartdata->source->itemid, $_partID,$folder); $rawHeader = $this->mail->getMessageRawHeader($smartdata->source->itemid, '',$folder);
$rawBody = $this->mail->getMessageRawBody($smartdata->source->itemid, $_partID,$folder); $rawBody = $this->mail->getMessageRawBody($smartdata->source->itemid, '',$folder);
$mailObject->AddStringAttachment($rawHeader.$rawBody, $headers['SUBJECT'].'.eml', 'message/rfc822'); $mailObject->AddStringAttachment($rawHeader.$rawBody, $headers['SUBJECT'].'.eml', 'message/rfc822');
$AltBody = $AltBody."</br>".lang("See Attachments for Content of the Orignial Mail").$sigTextHtml; $AltBody = $AltBody."</br>".lang("See Attachments for Content of the Orignial Mail").$sigTextHtml;
$Body = $Body."\r\n".lang("See Attachments for Content of the Orignial Mail").$sigTextPlain; $Body = $Body."\r\n".lang("See Attachments for Content of the Orignial Mail").$sigTextPlain;
@ -714,7 +714,7 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
if ($this->debugLevel>0) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.__LINE__.' Key:'.$key.'->'.array2string($attachment)); if ($this->debugLevel>0) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.__LINE__.' Key:'.$key.'->'.array2string($attachment));
$attachmentNames .= $attachment['name']."\n"; $attachmentNames .= $attachment['name']."\n";
$attachmentData = $this->mail->getAttachment($uid, $attachment['partID'],0,false,false,$folder); $attachmentData = $this->mail->getAttachment($uid, $attachment['partID'],0,false,false,$folder);
/*$x =*/ $mailObject->AddStringAttachment($attachmentData['attachment'], $attachment['name'], $attachment['mimeType']); $x = $mailObject->AddStringAttachment($attachmentData['attachment'], $attachment['name'], $attachment['mimeType']);
ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.__LINE__.' added part with number:'.$x); ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.__LINE__.' added part with number:'.$x);
} }
} }