Fix php 8 errors

This commit is contained in:
Hadi Nategh 2021-04-08 18:36:46 +02:00
parent b5540c7288
commit e88c4edea2

View File

@ -4123,82 +4123,83 @@ class Mail
} }
switch($_flag) { switch($_flag) {
case "delete": case "delete":
$ret = $this->icServer->store($folder, array('add'=>array('\\Deleted'), 'ids'=> $uidsToModify)); $this->icServer->store($folder, array('add'=>array('\\Deleted'), 'ids'=> $uidsToModify));
break; break;
case "undelete": case "undelete":
$ret = $this->icServer->store($folder, array('remove'=>array('\\Deleted'), 'ids'=> $uidsToModify)); $this->icServer->store($folder, array('remove'=>array('\\Deleted'), 'ids'=> $uidsToModify));
break; break;
case "flagged": case "flagged":
$ret = $this->icServer->store($folder, array('add'=>array('\\Flagged'), 'ids'=> $uidsToModify)); $this->icServer->store($folder, array('add'=>array('\\Flagged'), 'ids'=> $uidsToModify));
break; break;
case "read": case "read":
case "seen": case "seen":
$ret = $this->icServer->store($folder, array('add'=>array('\\Seen'), 'ids'=> $uidsToModify)); $this->icServer->store($folder, array('add'=>array('\\Seen'), 'ids'=> $uidsToModify));
break; break;
case "forwarded": case "forwarded":
$ret = $this->icServer->store($folder, array('add'=>array('$Forwarded'), 'ids'=> $uidsToModify)); $this->icServer->store($folder, array('add'=>array('$Forwarded'), 'ids'=> $uidsToModify));
//fall through
case "answered": case "answered":
$ret = $this->icServer->store($folder, array('add'=>array('\\Answered'), 'ids'=> $uidsToModify)); $this->icServer->store($folder, array('add'=>array('\\Answered'), 'ids'=> $uidsToModify));
break; break;
case "unflagged": case "unflagged":
$ret = $this->icServer->store($folder, array('remove'=>array('\\Flagged'), 'ids'=> $uidsToModify)); $this->icServer->store($folder, array('remove'=>array('\\Flagged'), 'ids'=> $uidsToModify));
break; break;
case "unread": case "unread":
case "unseen": case "unseen":
$ret = $this->icServer->store($folder, array('remove'=>array('\\Seen','\\Answered','$Forwarded'), 'ids'=> $uidsToModify)); $this->icServer->store($folder, array('remove'=>array('\\Seen','\\Answered','$Forwarded'), 'ids'=> $uidsToModify));
break; break;
case "mdnsent": case "mdnsent":
$ret = $this->icServer->store($folder, array('add'=>array('MDNSent'), 'ids'=> $uidsToModify)); $this->icServer->store($folder, array('add'=>array('MDNSent'), 'ids'=> $uidsToModify));
break; break;
case "mdnnotsent": case "mdnnotsent":
$ret = $this->icServer->store($folder, array('add'=>array('MDNnotSent'), 'ids'=> $uidsToModify)); $this->icServer->store($folder, array('add'=>array('MDNnotSent'), 'ids'=> $uidsToModify));
break; break;
case "label1": case "label1":
case "labelone": case "labelone":
$ret = $this->icServer->store($folder, array('add'=>array('$label1'), 'ids'=> $uidsToModify)); $this->icServer->store($folder, array('add'=>array('$label1'), 'ids'=> $uidsToModify));
break; break;
case "unlabel1": case "unlabel1":
case "unlabelone": case "unlabelone":
$ret = $this->icServer->store($folder, array('remove'=>array('$label1'), 'ids'=> $uidsToModify)); $this->icServer->store($folder, array('remove'=>array('$label1'), 'ids'=> $uidsToModify));
break; break;
case "label2": case "label2":
case "labeltwo": case "labeltwo":
$ret = $this->icServer->store($folder, array('add'=>array('$label2'), 'ids'=> $uidsToModify)); $this->icServer->store($folder, array('add'=>array('$label2'), 'ids'=> $uidsToModify));
break; break;
case "unlabel2": case "unlabel2":
case "unlabeltwo": case "unlabeltwo":
$ret = $this->icServer->store($folder, array('remove'=>array('$label2'), 'ids'=> $uidsToModify)); $this->icServer->store($folder, array('remove'=>array('$label2'), 'ids'=> $uidsToModify));
break; break;
case "label3": case "label3":
case "labelthree": case "labelthree":
$ret = $this->icServer->store($folder, array('add'=>array('$label3'), 'ids'=> $uidsToModify)); $this->icServer->store($folder, array('add'=>array('$label3'), 'ids'=> $uidsToModify));
break; break;
case "unlabel3": case "unlabel3":
case "unlabelthree": case "unlabelthree":
$ret = $this->icServer->store($folder, array('remove'=>array('$label3'), 'ids'=> $uidsToModify)); $this->icServer->store($folder, array('remove'=>array('$label3'), 'ids'=> $uidsToModify));
break; break;
case "label4": case "label4":
case "labelfour": case "labelfour":
$ret = $this->icServer->store($folder, array('add'=>array('$label4'), 'ids'=> $uidsToModify)); $this->icServer->store($folder, array('add'=>array('$label4'), 'ids'=> $uidsToModify));
break; break;
case "unlabel4": case "unlabel4":
case "unlabelfour": case "unlabelfour":
$ret = $this->icServer->store($folder, array('remove'=>array('$label4'), 'ids'=> $uidsToModify)); $this->icServer->store($folder, array('remove'=>array('$label4'), 'ids'=> $uidsToModify));
break; break;
case "label5": case "label5":
case "labelfive": case "labelfive":
$ret = $this->icServer->store($folder, array('add'=>array('$label5'), 'ids'=> $uidsToModify)); $this->icServer->store($folder, array('add'=>array('$label5'), 'ids'=> $uidsToModify));
break; break;
case "unlabel5": case "unlabel5":
case "unlabelfive": case "unlabelfive":
$ret = $this->icServer->store($folder, array('remove'=>array('$label5'), 'ids'=> $uidsToModify)); $this->icServer->store($folder, array('remove'=>array('$label5'), 'ids'=> $uidsToModify));
break; break;
case "unlabel": case "unlabel":
$ret = $this->icServer->store($folder, array('remove'=>array('$label1'), 'ids'=> $uidsToModify)); $this->icServer->store($folder, array('remove'=>array('$label1'), 'ids'=> $uidsToModify));
$ret = $this->icServer->store($folder, array('remove'=>array('$label2'), 'ids'=> $uidsToModify)); $this->icServer->store($folder, array('remove'=>array('$label2'), 'ids'=> $uidsToModify));
$ret = $this->icServer->store($folder, array('remove'=>array('$label3'), 'ids'=> $uidsToModify)); $this->icServer->store($folder, array('remove'=>array('$label3'), 'ids'=> $uidsToModify));
$ret = $this->icServer->store($folder, array('remove'=>array('$label4'), 'ids'=> $uidsToModify)); $this->icServer->store($folder, array('remove'=>array('$label4'), 'ids'=> $uidsToModify));
$ret = $this->icServer->store($folder, array('remove'=>array('$label5'), 'ids'=> $uidsToModify)); $this->icServer->store($folder, array('remove'=>array('$label5'), 'ids'=> $uidsToModify));
break; break;
} }
} }
@ -5580,20 +5581,20 @@ class Mail
*/ */
function getMessageRawBody($_uid, $_partID = '', $_folder='', $_stream=false) function getMessageRawBody($_uid, $_partID = '', $_folder='', $_stream=false)
{ {
//TODO: caching einbauen static!
static $rawBody; static $rawBody;
if (is_null($rawBody)) $rawBody = array(); $body = [];
if (empty($_folder)) $_folder = ($this->sessionData['mailbox']? $this->sessionData['mailbox'] : $this->icServer->getCurrentMailbox()); if (empty($_folder)) $_folder = $this->sessionData['mailbox']?: $this->icServer->getCurrentMailbox();
if (!$_stream && isset($rawBody[$this->icServer->ImapServerId][$_folder][$_uid][(empty($_partID)?'NIL':$_partID)])) $_uid = !(is_object($_uid) || is_array($_uid)) ? (array)$_uid : $_uid;
if (!$_stream && isset($rawBody[$this->icServer->ImapServerId][$_folder][$_uid[0]][(empty($_partID)?'NIL':$_partID)]))
{ {
//error_log(__METHOD__.' ('.__LINE__.') '." Using Cache for raw Body $_uid, $_partID in Folder $_folder"); //error_log(__METHOD__.' ('.__LINE__.') '." Using Cache for raw Body $_uid, $_partID in Folder $_folder");
return $rawBody[$this->icServer->ImapServerId][$_folder][$_uid][(empty($_partID)?'NIL':$_partID)]; return $rawBody[$this->icServer->ImapServerId][$_folder][$_uid[0]][(empty($_partID)?'NIL':$_partID)];
} }
$uidsToFetch = new Horde_Imap_Client_Ids(); $uidsToFetch = new Horde_Imap_Client_Ids();
$uid = $_uid;
if (!(is_object($_uid) || is_array($_uid))) $uid = (array)$_uid; $uidsToFetch->add($_uid);
$uidsToFetch->add($uid);
$fquery = new Horde_Imap_Client_Fetch_Query(); $fquery = new Horde_Imap_Client_Fetch_Query();
$fquery->fullText(array('peek'=>true)); $fquery->fullText(array('peek'=>true));
@ -5611,7 +5612,6 @@ class Mail
if ($_partID != '') if ($_partID != '')
{ {
$mailStructureObject = $_headerObject->getStructure(); $mailStructureObject = $_headerObject->getStructure();
//_debug_array($mailStructureObject->contentTypeMap());
foreach ($mailStructureObject->contentTypeMap() as $mime_id => $mime_type) foreach ($mailStructureObject->contentTypeMap() as $mime_id => $mime_type)
{ {
if ($mime_id==$_partID) if ($mime_id==$_partID)
@ -5622,10 +5622,11 @@ class Mail
} }
} }
} }
if (!$_stream) if (!$_stream)
{ {
//error_log(__METHOD__.' ('.__LINE__.') '."[{$this->icServer->ImapServerId}][$_folder][$_uid][".(empty($_partID)?'NIL':$_partID)."]"); //error_log(__METHOD__.' ('.__LINE__.') '."[{$this->icServer->ImapServerId}][$_folder][$_uid][".(empty($_partID)?'NIL':$_partID)."]");
$rawBody[$this->icServer->ImapServerId][$_folder][$_uid][(empty($_partID)?'NIL':$_partID)] = $body; $rawBody[$this->icServer->ImapServerId][$_folder][$_uid[0]][(empty($_partID)?'NIL':$_partID)] = $body;
} }
return $body; return $body;
} }
@ -5650,11 +5651,6 @@ class Mail
} }
$uidsToFetch = new Horde_Imap_Client_Ids(); $uidsToFetch = new Horde_Imap_Client_Ids();
if (!(is_object($_uid) || is_array($_uid)))
{
$_uid = (array)$_uid;
}
$uidsToFetch->add($_uid); $uidsToFetch->add($_uid);
try try