@@ -167,8 +167,9 @@ discard block |
||
167 | 167 | if ($messageClass !== 'IPM.Note.SMIME' && |
168 | 168 | $messageClass !== 'IPM.Note.SMIME.SignedEncrypt' && |
169 | 169 | $messageClass !== 'IPM.Note.deferSMIME' && |
170 | - $messageClass !== 'IPM.Note.deferSMIME.SignedEncrypt') |
|
171 | - return; |
|
170 | + $messageClass !== 'IPM.Note.deferSMIME.SignedEncrypt') { |
|
171 | + return; |
|
172 | + } |
|
172 | 173 | |
173 | 174 | $recipients = $data['action']['props']['smime']; |
174 | 175 | $missingCerts = []; |
@@ -303,8 +304,9 @@ discard block |
||
303 | 304 | $importCert = file_get_contents($outcert); |
304 | 305 | $parsedImportCert = openssl_x509_parse($importCert); |
305 | 306 | $parsedUserCert = openssl_x509_parse($userCert); |
306 | - if (!$signed_ok || $openssl_error_code === OPENSSL_CA_VERIFY_FAIL) |
|
307 | - continue; |
|
307 | + if (!$signed_ok || $openssl_error_code === OPENSSL_CA_VERIFY_FAIL) { |
|
308 | + continue; |
|
309 | + } |
|
308 | 310 | |
309 | 311 | // CA Checks out |
310 | 312 | $caCerts = $this->extractCAs($tmpfname); |
@@ -549,8 +551,9 @@ discard block |
||
549 | 551 | * @param mixed $data |
550 | 552 | */ |
551 | 553 | public function onUploadCertificate($data) { |
552 | - if ($data['sourcetype'] !== 'certificate') |
|
553 | - return; |
|
554 | + if ($data['sourcetype'] !== 'certificate') { |
|
555 | + return; |
|
556 | + } |
|
554 | 557 | $passphrase = $_POST['passphrase']; |
555 | 558 | $saveCert = false; |
556 | 559 | $tmpname = $data['tmpname']; |
@@ -625,11 +628,13 @@ discard block |
||
625 | 628 | $props = mapi_getprops($message, [PR_MESSAGE_CLASS]); |
626 | 629 | $messageClass = $props[PR_MESSAGE_CLASS]; |
627 | 630 | |
628 | - if (!isset($messageClass)) |
|
629 | - return; |
|
631 | + if (!isset($messageClass)) { |
|
632 | + return; |
|
633 | + } |
|
630 | 634 | if (stripos($messageClass, 'IPM.Note.deferSMIME') === false && |
631 | - stripos($messageClass, 'IPM.Note.SMIME') === false) |
|
632 | - return; |
|
635 | + stripos($messageClass, 'IPM.Note.SMIME') === false) { |
|
636 | + return; |
|
637 | + } |
|
633 | 638 | |
634 | 639 | // FIXME: for now return when we are going to sign but we don't have the passphrase set |
635 | 640 | // This should never happen sign |
@@ -638,8 +643,9 @@ discard block |
||
638 | 643 | $messageClass === 'IPM.Note.deferSMIME.MultipartSigned' || |
639 | 644 | $messageClass === 'IPM.Note.SMIME.SignedEncrypt' || |
640 | 645 | $messageClass === 'IPM.Note.SMIME.MultipartSigned') && |
641 | - !$encryptionStore->get('smime')) |
|
642 | - return; |
|
646 | + !$encryptionStore->get('smime')) { |
|
647 | + return; |
|
648 | + } |
|
643 | 649 | // NOTE: setting message class to IPM.Note, so that mapi_inetmapi_imtoinet converts the message to plain email |
644 | 650 | // and doesn't fail when handling the attachments. |
645 | 651 | mapi_setprops($message, [PR_MESSAGE_CLASS => 'IPM.Note']); |
@@ -883,8 +889,9 @@ discard block |
||
883 | 889 | foreach ($certs as $cert) { |
884 | 890 | $pubkey = mapi_msgstore_openentry($this->getStore(), $cert[PR_ENTRYID]); |
885 | 891 | $certificate = ""; |
886 | - if ($pubkey == false) |
|
887 | - continue; |
|
892 | + if ($pubkey == false) { |
|
893 | + continue; |
|
894 | + } |
|
888 | 895 | // retrieve pkcs#11 certificate from body |
889 | 896 | $stream = mapi_openproperty($pubkey, PR_BODY, IID_IStream, 0, 0); |
890 | 897 | $stat = mapi_stream_stat($stream); |
@@ -1006,8 +1013,9 @@ discard block |
||
1006 | 1013 | */ |
1007 | 1014 | public function importCertificate($cert, $certData, $type = 'public', $force = false) { |
1008 | 1015 | $certEmail = getCertEmail($certData); |
1009 | - if ($this->pubcertExists($certEmail) && !$force && $type !== 'private') |
|
1010 | - return; |
|
1016 | + if ($this->pubcertExists($certEmail) && !$force && $type !== 'private') { |
|
1017 | + return; |
|
1018 | + } |
|
1011 | 1019 | $issued_by = ""; |
1012 | 1020 | foreach (array_keys($certData['issuer']) as $key) { |
1013 | 1021 | $issued_by .= $key . '=' . $certData['issuer'][$key] . "\n"; |
@@ -1131,8 +1139,9 @@ discard block |
||
1131 | 1139 | * @return array with properties |
1132 | 1140 | */ |
1133 | 1141 | public function getSenderAddress($mapiMessage) { |
1134 | - if (method_exists($GLOBALS['operations'], 'getSenderAddress')) |
|
1135 | - return $GLOBALS["operations"]->getSenderAddress($mapiMessage); |
|
1142 | + if (method_exists($GLOBALS['operations'], 'getSenderAddress')) { |
|
1143 | + return $GLOBALS["operations"]->getSenderAddress($mapiMessage); |
|
1144 | + } |
|
1136 | 1145 | |
1137 | 1146 | $messageProps = mapi_getprops($mapiMessage, [PR_SENT_REPRESENTING_ENTRYID, PR_SENDER_ENTRYID]); |
1138 | 1147 | $senderEntryID = isset($messageProps[PR_SENT_REPRESENTING_ENTRYID]) ? $messageProps[PR_SENT_REPRESENTING_ENTRYID] : $messageProps[PR_SENDER_ENTRYID]; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @return bool true on success or false on failure |
109 | 109 | */ |
110 | 110 | public function save($store, $parententryid, $entryid, $action) { |
111 | - $properiesToDelete = []; // create an array of properties which should be deleted |
|
111 | + $properiesToDelete = []; // create an array of properties which should be deleted |
|
112 | 112 | // this array is passed to $GLOBALS['operations']->saveMessage() function |
113 | 113 | |
114 | 114 | if (!$store && !$parententryid) { |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | |
450 | 450 | // UTC time |
451 | 451 | $startDateUTC = $actionProps[$type]; |
452 | - $dueDateUTC = $actionProps[$type] + (24 * 60 * 60); // ONE DAY is added to set duedate of item. |
|
452 | + $dueDateUTC = $actionProps[$type] + (24 * 60 * 60); // ONE DAY is added to set duedate of item. |
|
453 | 453 | |
454 | 454 | // get local time from UTC time |
455 | 455 | $recur = new Recurrence($store, []); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $abHierarchyRows = mapi_table_queryallrows($hierarchyTable, [PR_AB_PROVIDER_ID, PR_ENTRYID]); |
243 | 243 | |
244 | 244 | // Look for the 'Contacts Folders' |
245 | - for ($i = 0,$len = count($abHierarchyRows); $i < $len; ++$i) { |
|
245 | + for ($i = 0, $len = count($abHierarchyRows); $i < $len; ++$i) { |
|
246 | 246 | // Check if the folder matches the Contact Provider GUID |
247 | 247 | if ($abHierarchyRows[$i][PR_AB_PROVIDER_ID] == MUIDZCSAB) { |
248 | 248 | $abContactContainerEntryid = $abHierarchyRows[$i][PR_ENTRYID]; |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | $abContactContainerHierarchyRows = mapi_table_queryallrows($abContactContainerHierarchyTable, [PR_DISPLAY_NAME, PR_OBJECT_TYPE, PR_ENTRYID]); |
259 | 259 | |
260 | 260 | // Loop through all the contact folders found under the 'Contacts Folders' hierarchy |
261 | - for ($j = 0,$len = count($abContactContainerHierarchyRows); $j < $len; ++$j) { |
|
261 | + for ($j = 0, $len = count($abContactContainerHierarchyRows); $j < $len; ++$j) { |
|
262 | 262 | // Open, get contents table, restrict, sort and then merge the result in the list of $rows |
263 | 263 | $abContactFolder = mapi_ab_openentry($ab, $abContactContainerHierarchyRows[$j][PR_ENTRYID]); |
264 | 264 | $abContactFolderTable = mapi_folder_getcontentstable($abContactFolder, MAPI_DEFERRED_ERRORS); |
@@ -851,7 +851,7 @@ |
||
851 | 851 | ], |
852 | 852 | [ |
853 | 853 | RES_OR, |
854 | - $tempRestrictions, // all group restrictions |
|
854 | + $tempRestrictions, // all group restrictions |
|
855 | 855 | ], |
856 | 856 | ], |
857 | 857 | ], |
@@ -507,12 +507,12 @@ |
||
507 | 507 | $data["search_meta"]["searchfolder_entryid"] = $entryid; |
508 | 508 | $data["search_meta"]["search_store_entryid"] = $action["store_entryid"]; |
509 | 509 | $data["search_meta"]["searchstate"] = $searchState; |
510 | - $data["search_meta"]["results"] = $numberOfResults; // actual number of items that we are sending to client |
|
510 | + $data["search_meta"]["results"] = $numberOfResults; // actual number of items that we are sending to client |
|
511 | 511 | |
512 | 512 | $data["page"] = []; |
513 | 513 | $data["page"]["start"] = 0; |
514 | 514 | $data["page"]["rowcount"] = $rowCount; |
515 | - $data["page"]["totalrowcount"] = $totalRowCount; // total number of items |
|
515 | + $data["page"]["totalrowcount"] = $totalRowCount; // total number of items |
|
516 | 516 | |
517 | 517 | if (!empty($listData)) { |
518 | 518 | $data["item"] = array_merge([], $listData); |
@@ -575,7 +575,7 @@ |
||
575 | 575 | ]; |
576 | 576 | |
577 | 577 | $rule[PR_RULE_NAME] = ''; |
578 | - $rule[PR_RULE_PROVIDER_DATA] = ''; // 0 byte binary string |
|
578 | + $rule[PR_RULE_PROVIDER_DATA] = ''; // 0 byte binary string |
|
579 | 579 | $rule[PR_RULE_STATE] = ST_ENABLED; |
580 | 580 | $rule[PR_RULE_LEVEL] = 0; |
581 | 581 | $rule[PR_RULE_SEQUENCE] = 0; |
@@ -727,10 +727,10 @@ |
||
727 | 727 | /** |
728 | 728 | * Function which copies or moves one or more items. |
729 | 729 | * |
730 | - * @param resource $store MAPI Message Store Object |
|
731 | - * @param string $parententryid entryid of the folder |
|
732 | - * @param mixed $entryids list of entryids which will be copied or moved (in binary format) |
|
733 | - * @param array $action the action data, sent by the client |
|
730 | + * @param resource $store MAPI Message Store Object |
|
731 | + * @param string $parententryid entryid of the folder |
|
732 | + * @param mixed $entryids list of entryids which will be copied or moved (in binary format) |
|
733 | + * @param array $action the action data, sent by the client |
|
734 | 734 | * |
735 | 735 | * @return bool true on success or false on failure |
736 | 736 | */ |
@@ -52,241 +52,241 @@ |
||
52 | 52 | $entryid = $this->getActionEntryID($action); |
53 | 53 | |
54 | 54 | switch ($actionType) { |
55 | - case "open": |
|
56 | - $this->open($store, $entryid, $action); |
|
57 | - break; |
|
55 | + case "open": |
|
56 | + $this->open($store, $entryid, $action); |
|
57 | + break; |
|
58 | 58 | |
59 | - case "save": |
|
60 | - if (!$store || !$parententryid) { |
|
61 | - /* |
|
59 | + case "save": |
|
60 | + if (!$store || !$parententryid) { |
|
61 | + /* |
|
62 | 62 | * if parententryid or storeentryid is not passed then we can take a guess that |
63 | 63 | * it would be a save operation but instead of depending on server to get default |
64 | 64 | * parent and store client should always send parententryid and storeentryid |
65 | 65 | * |
66 | 66 | * we can also assume that user has permission to right in his own store |
67 | 67 | */ |
68 | - $this->save($store, $parententryid, $entryid, $action); |
|
69 | - break; |
|
70 | - } |
|
71 | - /* |
|
68 | + $this->save($store, $parententryid, $entryid, $action); |
|
69 | + break; |
|
70 | + } |
|
71 | + /* |
|
72 | 72 | * The "message_action" object has been set, check the action_type field for |
73 | 73 | * the exact action which must be taken. |
74 | 74 | * Supported actions: |
75 | 75 | * - acceptmeetingrequest: attendee has accepted mr |
76 | 76 | * - declineMeetingRequest: attendee has declined mr |
77 | 77 | */ |
78 | - if (!isset($action["message_action"], $action["message_action"]["action_type"])) { |
|
79 | - $this->save($store, $parententryid, $entryid, $action); |
|
80 | - break; |
|
81 | - } |
|
82 | - |
|
83 | - switch ($action["message_action"]["action_type"]) { |
|
84 | - case "declineMeetingRequest": |
|
85 | - case "acceptMeetingRequest": |
|
86 | - $message = $GLOBALS["operations"]->openMessage($store, $entryid); |
|
87 | - $basedate = (isset($action['basedate']) ? $action['basedate'] : false); |
|
88 | - $delete = false; |
|
89 | - |
|
90 | - if ($basedate) { |
|
91 | - $recurrence = new Recurrence($store, $message); |
|
92 | - $exceptionatt = $recurrence->getExceptionAttachment($basedate); |
|
93 | - if ($exceptionatt) { |
|
94 | - // get properties of existing exception. |
|
95 | - $exceptionattProps = mapi_getprops($exceptionatt, [PR_ATTACH_NUM]); |
|
96 | - $attach_num = $exceptionattProps[PR_ATTACH_NUM]; |
|
97 | - } |
|
78 | + if (!isset($action["message_action"], $action["message_action"]["action_type"])) { |
|
79 | + $this->save($store, $parententryid, $entryid, $action); |
|
80 | + break; |
|
98 | 81 | } |
99 | 82 | |
100 | - /** |
|
83 | + switch ($action["message_action"]["action_type"]) { |
|
84 | + case "declineMeetingRequest": |
|
85 | + case "acceptMeetingRequest": |
|
86 | + $message = $GLOBALS["operations"]->openMessage($store, $entryid); |
|
87 | + $basedate = (isset($action['basedate']) ? $action['basedate'] : false); |
|
88 | + $delete = false; |
|
89 | + |
|
90 | + if ($basedate) { |
|
91 | + $recurrence = new Recurrence($store, $message); |
|
92 | + $exceptionatt = $recurrence->getExceptionAttachment($basedate); |
|
93 | + if ($exceptionatt) { |
|
94 | + // get properties of existing exception. |
|
95 | + $exceptionattProps = mapi_getprops($exceptionatt, [PR_ATTACH_NUM]); |
|
96 | + $attach_num = $exceptionattProps[PR_ATTACH_NUM]; |
|
97 | + } |
|
98 | + } |
|
99 | + |
|
100 | + /** |
|
101 | 101 | * Get message class from original message. This can be changed to |
102 | 102 | * IPM.Appointment if the item is a Meeting Request in the maillist. |
103 | 103 | * After Accepting/Declining the message is moved and changed. |
104 | 104 | */ |
105 | - $originalMessageProps = mapi_getprops($message, [PR_MESSAGE_CLASS]); |
|
106 | - $req = new Meetingrequest($store, $message, $GLOBALS["mapisession"]->getSession(), $this->directBookingMeetingRequest); |
|
105 | + $originalMessageProps = mapi_getprops($message, [PR_MESSAGE_CLASS]); |
|
106 | + $req = new Meetingrequest($store, $message, $GLOBALS["mapisession"]->getSession(), $this->directBookingMeetingRequest); |
|
107 | 107 | |
108 | - // Update extra body information |
|
109 | - if (isset($action["message_action"]['meetingTimeInfo']) && !empty($action["message_action"]['meetingTimeInfo'])) { |
|
110 | - $req->setMeetingTimeInfo($action["message_action"]['meetingTimeInfo']); |
|
111 | - unset($action["message_action"]['meetingTimeInfo']); |
|
112 | - } |
|
108 | + // Update extra body information |
|
109 | + if (isset($action["message_action"]['meetingTimeInfo']) && !empty($action["message_action"]['meetingTimeInfo'])) { |
|
110 | + $req->setMeetingTimeInfo($action["message_action"]['meetingTimeInfo']); |
|
111 | + unset($action["message_action"]['meetingTimeInfo']); |
|
112 | + } |
|
113 | 113 | |
114 | - // sendResponse flag if it is set then send the mail response to the organzer. |
|
115 | - $sendResponse = true; |
|
116 | - if (isset($action["message_action"]["sendResponse"]) && $action["message_action"]["sendResponse"] == false) { |
|
117 | - $sendResponse = false; |
|
118 | - } |
|
114 | + // sendResponse flag if it is set then send the mail response to the organzer. |
|
115 | + $sendResponse = true; |
|
116 | + if (isset($action["message_action"]["sendResponse"]) && $action["message_action"]["sendResponse"] == false) { |
|
117 | + $sendResponse = false; |
|
118 | + } |
|
119 | 119 | |
120 | - // @FIXME: fix body |
|
121 | - $body = false; |
|
122 | - if (isset($action["props"]["isHTML"]) && $action["props"]["isHTML"] === true) { |
|
123 | - $body = isset($action["props"]["html_body"]) ? $action["props"]["html_body"] : false; |
|
124 | - } |
|
125 | - else { |
|
126 | - $body = isset($action["props"]["body"]) ? $action["props"]["body"] : false; |
|
127 | - } |
|
120 | + // @FIXME: fix body |
|
121 | + $body = false; |
|
122 | + if (isset($action["props"]["isHTML"]) && $action["props"]["isHTML"] === true) { |
|
123 | + $body = isset($action["props"]["html_body"]) ? $action["props"]["html_body"] : false; |
|
124 | + } |
|
125 | + else { |
|
126 | + $body = isset($action["props"]["body"]) ? $action["props"]["body"] : false; |
|
127 | + } |
|
128 | 128 | |
129 | - if ($action["message_action"]["action_type"] == "acceptMeetingRequest") { |
|
130 | - $tentative = $action["message_action"]["responseType"] === olResponseTentative; |
|
131 | - $newProposedStartTime = isset($action["message_action"]["proposed_starttime"]) ? $action["message_action"]["proposed_starttime"] : false; |
|
132 | - $newProposedEndTime = isset($action["message_action"]["proposed_endtime"]) ? $action["message_action"]["proposed_endtime"] : false; |
|
129 | + if ($action["message_action"]["action_type"] == "acceptMeetingRequest") { |
|
130 | + $tentative = $action["message_action"]["responseType"] === olResponseTentative; |
|
131 | + $newProposedStartTime = isset($action["message_action"]["proposed_starttime"]) ? $action["message_action"]["proposed_starttime"] : false; |
|
132 | + $newProposedEndTime = isset($action["message_action"]["proposed_endtime"]) ? $action["message_action"]["proposed_endtime"] : false; |
|
133 | 133 | |
134 | - // We are accepting MR from preview-read-mail so set delete the actual mail flag. |
|
135 | - $delete = $req->isMeetingRequest($originalMessageProps[PR_MESSAGE_CLASS]); |
|
134 | + // We are accepting MR from preview-read-mail so set delete the actual mail flag. |
|
135 | + $delete = $req->isMeetingRequest($originalMessageProps[PR_MESSAGE_CLASS]); |
|
136 | 136 | |
137 | - $req->doAccept($tentative, $sendResponse, $delete, $newProposedStartTime, $newProposedEndTime, $body, true, $store, $basedate); |
|
138 | - } |
|
139 | - else { |
|
140 | - $delete = $req->doDecline($sendResponse, $basedate, $body); |
|
141 | - } |
|
137 | + $req->doAccept($tentative, $sendResponse, $delete, $newProposedStartTime, $newProposedEndTime, $body, true, $store, $basedate); |
|
138 | + } |
|
139 | + else { |
|
140 | + $delete = $req->doDecline($sendResponse, $basedate, $body); |
|
141 | + } |
|
142 | 142 | |
143 | - /** |
|
143 | + /** |
|
144 | 144 | * Now if the item is the Meeting Request that was sent to the attendee |
145 | 145 | * it is removed when the user has clicked on Accept/Decline. If the |
146 | 146 | * item is the appointment in the calendar it will not be moved. To only |
147 | 147 | * notify the bus when the item is a Meeting Request we are going to |
148 | 148 | * check the PR_MESSAGE_CLASS and see if it is "IPM.Meeting*". |
149 | 149 | */ |
150 | - $messageProps = mapi_getprops($message, [PR_ENTRYID, PR_STORE_ENTRYID, PR_PARENT_ENTRYID]); |
|
150 | + $messageProps = mapi_getprops($message, [PR_ENTRYID, PR_STORE_ENTRYID, PR_PARENT_ENTRYID]); |
|
151 | 151 | |
152 | - // if opened appointment is exception then it will add |
|
153 | - // the attach_num and basedate in messageProps. |
|
154 | - if (isset($attach_num)) { |
|
155 | - $messageProps[PR_ATTACH_NUM] = [$attach_num]; |
|
156 | - $messageProps[$this->properties["basedate"]] = $basedate; |
|
157 | - } |
|
152 | + // if opened appointment is exception then it will add |
|
153 | + // the attach_num and basedate in messageProps. |
|
154 | + if (isset($attach_num)) { |
|
155 | + $messageProps[PR_ATTACH_NUM] = [$attach_num]; |
|
156 | + $messageProps[$this->properties["basedate"]] = $basedate; |
|
157 | + } |
|
158 | 158 | |
159 | - if ($delete) { |
|
160 | - // send TABLE_DELETE event because the message has moved |
|
161 | - $this->sendFeedback(true); |
|
162 | - $GLOBALS["bus"]->notify(bin2hex($messageProps[PR_PARENT_ENTRYID]), TABLE_DELETE, $messageProps); |
|
163 | - } |
|
164 | - else { |
|
165 | - $this->addActionData("update", ["item" => Conversion::mapMAPI2XML($this->properties, $messageProps)]); |
|
166 | - $GLOBALS["bus"]->addData($this->getResponseData()); |
|
159 | + if ($delete) { |
|
160 | + // send TABLE_DELETE event because the message has moved |
|
161 | + $this->sendFeedback(true); |
|
162 | + $GLOBALS["bus"]->notify(bin2hex($messageProps[PR_PARENT_ENTRYID]), TABLE_DELETE, $messageProps); |
|
163 | + } |
|
164 | + else { |
|
165 | + $this->addActionData("update", ["item" => Conversion::mapMAPI2XML($this->properties, $messageProps)]); |
|
166 | + $GLOBALS["bus"]->addData($this->getResponseData()); |
|
167 | 167 | |
168 | - // send TABLE_SAVE event because an occurrence is deleted |
|
169 | - $GLOBALS["bus"]->notify(bin2hex($messageProps[PR_PARENT_ENTRYID]), TABLE_SAVE, $messageProps); |
|
170 | - } |
|
168 | + // send TABLE_SAVE event because an occurrence is deleted |
|
169 | + $GLOBALS["bus"]->notify(bin2hex($messageProps[PR_PARENT_ENTRYID]), TABLE_SAVE, $messageProps); |
|
170 | + } |
|
171 | 171 | |
172 | - break; |
|
172 | + break; |
|
173 | 173 | |
174 | - case "acceptTaskRequest": |
|
175 | - case "declineTaskRequest": |
|
176 | - $message = $GLOBALS["operations"]->openMessage($store, $entryid); |
|
174 | + case "acceptTaskRequest": |
|
175 | + case "declineTaskRequest": |
|
176 | + $message = $GLOBALS["operations"]->openMessage($store, $entryid); |
|
177 | 177 | |
178 | - if (isset($action["props"]) && !empty($action["props"])) { |
|
179 | - $properties = $GLOBALS["properties"]->getTaskProperties(); |
|
180 | - mapi_setprops($message, Conversion::mapXML2MAPI($properties, $action["props"])); |
|
181 | - mapi_savechanges($message); |
|
182 | - } |
|
183 | - // The task may be a delegated task, do an update if needed (will fail for non-delegated tasks) |
|
184 | - $tr = new TaskRequest($store, $message, $GLOBALS["mapisession"]->getSession()); |
|
185 | - $isAccept = $action["message_action"]["action_type"] == "acceptTaskRequest"; |
|
186 | - if (isset($action["message_action"]["task_comments_info"]) && !empty($action["message_action"]["task_comments_info"])) { |
|
187 | - $tr->setTaskCommentsInfo($action["message_action"]["task_comments_info"]); |
|
188 | - } |
|
189 | - if ($isAccept) { |
|
190 | - $result = $tr->doAccept(); |
|
191 | - } |
|
192 | - else { |
|
193 | - $result = $tr->doDecline(); |
|
194 | - } |
|
178 | + if (isset($action["props"]) && !empty($action["props"])) { |
|
179 | + $properties = $GLOBALS["properties"]->getTaskProperties(); |
|
180 | + mapi_setprops($message, Conversion::mapXML2MAPI($properties, $action["props"])); |
|
181 | + mapi_savechanges($message); |
|
182 | + } |
|
183 | + // The task may be a delegated task, do an update if needed (will fail for non-delegated tasks) |
|
184 | + $tr = new TaskRequest($store, $message, $GLOBALS["mapisession"]->getSession()); |
|
185 | + $isAccept = $action["message_action"]["action_type"] == "acceptTaskRequest"; |
|
186 | + if (isset($action["message_action"]["task_comments_info"]) && !empty($action["message_action"]["task_comments_info"])) { |
|
187 | + $tr->setTaskCommentsInfo($action["message_action"]["task_comments_info"]); |
|
188 | + } |
|
189 | + if ($isAccept) { |
|
190 | + $result = $tr->doAccept(); |
|
191 | + } |
|
192 | + else { |
|
193 | + $result = $tr->doDecline(); |
|
194 | + } |
|
195 | 195 | |
196 | - $this->sendFeedback(true); |
|
197 | - if ($result !== false) { |
|
198 | - $GLOBALS["bus"]->notify(bin2hex($result[PR_PARENT_ENTRYID]), TABLE_DELETE, $result); |
|
199 | - } |
|
196 | + $this->sendFeedback(true); |
|
197 | + if ($result !== false) { |
|
198 | + $GLOBALS["bus"]->notify(bin2hex($result[PR_PARENT_ENTRYID]), TABLE_DELETE, $result); |
|
199 | + } |
|
200 | 200 | |
201 | - $props = mapi_getprops($message, [PR_ENTRYID, PR_STORE_ENTRYID, PR_PARENT_ENTRYID]); |
|
202 | - if (!$tr->isTaskRequest()) { |
|
203 | - unset($props[PR_MESSAGE_CLASS]); |
|
204 | - $GLOBALS["bus"]->notify(bin2hex($props[PR_PARENT_ENTRYID]), $isAccept ? TABLE_SAVE : TABLE_DELETE, $props); |
|
201 | + $props = mapi_getprops($message, [PR_ENTRYID, PR_STORE_ENTRYID, PR_PARENT_ENTRYID]); |
|
202 | + if (!$tr->isTaskRequest()) { |
|
203 | + unset($props[PR_MESSAGE_CLASS]); |
|
204 | + $GLOBALS["bus"]->notify(bin2hex($props[PR_PARENT_ENTRYID]), $isAccept ? TABLE_SAVE : TABLE_DELETE, $props); |
|
205 | + } |
|
206 | + break; |
|
207 | + |
|
208 | + case "copy": |
|
209 | + case "move": |
|
210 | + $this->copy($store, $parententryid, $entryid, $action); |
|
211 | + break; |
|
212 | + |
|
213 | + case "reply": |
|
214 | + case "replyall": |
|
215 | + case "forward": |
|
216 | + default: |
|
217 | + $this->save($store, $parententryid, $entryid, $action); |
|
205 | 218 | } |
206 | - break; |
|
207 | - |
|
208 | - case "copy": |
|
209 | - case "move": |
|
210 | - $this->copy($store, $parententryid, $entryid, $action); |
|
211 | - break; |
|
212 | - |
|
213 | - case "reply": |
|
214 | - case "replyall": |
|
215 | - case "forward": |
|
216 | - default: |
|
217 | - $this->save($store, $parententryid, $entryid, $action); |
|
218 | - } |
|
219 | 219 | break; |
220 | 220 | |
221 | - case "delete": |
|
222 | - $subActionType = false; |
|
223 | - if (isset($action["message_action"], $action["message_action"]["action_type"])) { |
|
224 | - $subActionType = $action["message_action"]["action_type"]; |
|
225 | - } |
|
221 | + case "delete": |
|
222 | + $subActionType = false; |
|
223 | + if (isset($action["message_action"], $action["message_action"]["action_type"])) { |
|
224 | + $subActionType = $action["message_action"]["action_type"]; |
|
225 | + } |
|
226 | 226 | |
227 | - /* |
|
227 | + /* |
|
228 | 228 | * The "message_action" object has been set, check the action_type field for |
229 | 229 | * the exact action which must be taken. |
230 | 230 | * Supported actions: |
231 | 231 | * - cancelInvitation: organizer cancels already scheduled meeting |
232 | 232 | * - removeFromCalendar: attendee receives meeting cancellation and wants to remove item from calendar |
233 | 233 | */ |
234 | - switch ($subActionType) { |
|
235 | - case "removeFromCalendar": |
|
236 | - $basedate = (isset($action['basedate']) && !empty($action['basedate'])) ? $action['basedate'] : false; |
|
237 | - |
|
238 | - $this->removeFromCalendar($store, $entryid, $basedate, $this->directBookingMeetingRequest); |
|
239 | - $this->sendFeedback(true); |
|
240 | - break; |
|
241 | - |
|
242 | - case "cancelInvitation": |
|
243 | - $this->cancelInvitation($store, $entryid, $action, $this->directBookingMeetingRequest); |
|
244 | - $this->sendFeedback(true); |
|
245 | - break; |
|
246 | - |
|
247 | - case "declineMeeting": |
|
248 | - // @FIXME can we somehow merge declineMeeting and declineMeetingRequest sub actions? |
|
249 | - $message = $GLOBALS["operations"]->openMessage($store, $entryid); |
|
250 | - $basedate = (isset($action['basedate']) && !empty($action['basedate'])) ? $action['basedate'] : false; |
|
251 | - |
|
252 | - $req = new Meetingrequest($store, $message, $GLOBALS["mapisession"]->getSession(), $this->directBookingMeetingRequest); |
|
253 | - |
|
254 | - // @FIXME: may be we can remove this body check any get it while declining meeting 'body' |
|
255 | - $body = false; |
|
256 | - if (isset($action["props"]["isHTML"]) && $action["props"]["isHTML"] === true) { |
|
257 | - $body = isset($action["props"]["html_body"]) ? $action["props"]["html_body"] : false; |
|
258 | - } |
|
259 | - else { |
|
260 | - $body = isset($action["props"]["body"]) ? $action["props"]["body"] : false; |
|
261 | - } |
|
262 | - $req->doDecline(true, $basedate, $body); |
|
234 | + switch ($subActionType) { |
|
235 | + case "removeFromCalendar": |
|
236 | + $basedate = (isset($action['basedate']) && !empty($action['basedate'])) ? $action['basedate'] : false; |
|
237 | + |
|
238 | + $this->removeFromCalendar($store, $entryid, $basedate, $this->directBookingMeetingRequest); |
|
239 | + $this->sendFeedback(true); |
|
240 | + break; |
|
241 | + |
|
242 | + case "cancelInvitation": |
|
243 | + $this->cancelInvitation($store, $entryid, $action, $this->directBookingMeetingRequest); |
|
244 | + $this->sendFeedback(true); |
|
245 | + break; |
|
246 | + |
|
247 | + case "declineMeeting": |
|
248 | + // @FIXME can we somehow merge declineMeeting and declineMeetingRequest sub actions? |
|
249 | + $message = $GLOBALS["operations"]->openMessage($store, $entryid); |
|
250 | + $basedate = (isset($action['basedate']) && !empty($action['basedate'])) ? $action['basedate'] : false; |
|
251 | + |
|
252 | + $req = new Meetingrequest($store, $message, $GLOBALS["mapisession"]->getSession(), $this->directBookingMeetingRequest); |
|
253 | + |
|
254 | + // @FIXME: may be we can remove this body check any get it while declining meeting 'body' |
|
255 | + $body = false; |
|
256 | + if (isset($action["props"]["isHTML"]) && $action["props"]["isHTML"] === true) { |
|
257 | + $body = isset($action["props"]["html_body"]) ? $action["props"]["html_body"] : false; |
|
258 | + } |
|
259 | + else { |
|
260 | + $body = isset($action["props"]["body"]) ? $action["props"]["body"] : false; |
|
261 | + } |
|
262 | + $req->doDecline(true, $basedate, $body); |
|
263 | 263 | |
264 | - $messageProps = mapi_getprops($message, [PR_ENTRYID, PR_STORE_ENTRYID, PR_PARENT_ENTRYID]); |
|
265 | - $GLOBALS["bus"]->notify(bin2hex($messageProps[PR_PARENT_ENTRYID]), $basedate ? TABLE_SAVE : TABLE_DELETE, $messageProps); |
|
264 | + $messageProps = mapi_getprops($message, [PR_ENTRYID, PR_STORE_ENTRYID, PR_PARENT_ENTRYID]); |
|
265 | + $GLOBALS["bus"]->notify(bin2hex($messageProps[PR_PARENT_ENTRYID]), $basedate ? TABLE_SAVE : TABLE_DELETE, $messageProps); |
|
266 | 266 | |
267 | - break; |
|
267 | + break; |
|
268 | 268 | |
269 | - case "snooze": |
|
270 | - case "dismiss": |
|
271 | - $this->delete($store, $parententryid, $entryid, $action); |
|
272 | - break; |
|
269 | + case "snooze": |
|
270 | + case "dismiss": |
|
271 | + $this->delete($store, $parententryid, $entryid, $action); |
|
272 | + break; |
|
273 | 273 | |
274 | - default: |
|
275 | - // Deleting an occurrence means that we have to save the message to |
|
276 | - // generate an exception. So when the basedate is provided, we actually |
|
277 | - // perform a save rather then delete. |
|
278 | - if (isset($action['basedate']) && !empty($action['basedate'])) { |
|
279 | - $this->save($store, $parententryid, $entryid, $action, "delete"); |
|
280 | - } |
|
281 | - else { |
|
282 | - $this->delete($store, $parententryid, $entryid, $action); |
|
274 | + default: |
|
275 | + // Deleting an occurrence means that we have to save the message to |
|
276 | + // generate an exception. So when the basedate is provided, we actually |
|
277 | + // perform a save rather then delete. |
|
278 | + if (isset($action['basedate']) && !empty($action['basedate'])) { |
|
279 | + $this->save($store, $parententryid, $entryid, $action, "delete"); |
|
280 | + } |
|
281 | + else { |
|
282 | + $this->delete($store, $parententryid, $entryid, $action); |
|
283 | + } |
|
284 | + break; |
|
283 | 285 | } |
284 | - break; |
|
285 | - } |
|
286 | 286 | break; |
287 | 287 | |
288 | - default: |
|
289 | - $this->handleUnknownActionType($actionType); |
|
288 | + default: |
|
289 | + $this->handleUnknownActionType($actionType); |
|
290 | 290 | } |
291 | 291 | } |
292 | 292 | catch (MAPIException $e) { |
@@ -315,7 +315,7 @@ |
||
315 | 315 | throw new MAPIException(null, MAPI_E_NO_ACCESS); |
316 | 316 | } |
317 | 317 | |
318 | - $noPermissionFolders = array_filter($data['item'][0]['folders']['item'], function ($item) { |
|
318 | + $noPermissionFolders = array_filter($data['item'][0]['folders']['item'], function($item) { |
|
319 | 319 | return $item['props']['access'] === 0; |
320 | 320 | }); |
321 | 321 | if (count($noPermissionFolders) >= $folders) { |
@@ -247,14 +247,14 @@ discard block |
||
247 | 247 | $properties["reminderset"] = "PT_BOOLEAN:PSETID_Common:" . PidLidReminderSet; |
248 | 248 | $properties["flag_request"] = "PT_STRING8:PSETID_Common:" . PidLidFlagRequest; |
249 | 249 | $properties["flag_due_by"] = "PT_SYSTIME:PSETID_Common:" . PidLidReminderSignalTime; |
250 | - $properties["updatecounter"] = "PT_LONG:PSETID_Appointment:" . PidLidAppointmentSequence; // AppointmentSequenceNumber |
|
251 | - $properties["last_updatecounter"] = "PT_LONG:PSETID_Appointment:0x8203"; // AppointmentLastSequence |
|
250 | + $properties["updatecounter"] = "PT_LONG:PSETID_Appointment:" . PidLidAppointmentSequence; // AppointmentSequenceNumber |
|
251 | + $properties["last_updatecounter"] = "PT_LONG:PSETID_Appointment:0x8203"; // AppointmentLastSequence |
|
252 | 252 | $properties["busystatus"] = "PT_LONG:PSETID_Appointment:" . PidLidBusyStatus; |
253 | 253 | $properties["intendedbusystatus"] = "PT_LONG:PSETID_Appointment:" . PidLidIntendedBusyStatus; |
254 | 254 | $properties["start"] = "PT_SYSTIME:PSETID_Appointment:" . PidLidAppointmentStartWhole; |
255 | 255 | $properties["responselocation"] = "PT_STRING8:PSETID_Meeting:0x2"; |
256 | 256 | $properties["location"] = "PT_STRING8:PSETID_Appointment:" . PidLidLocation; |
257 | - $properties["requestsent"] = "PT_BOOLEAN:PSETID_Appointment:0x8229"; // PidLidFInvited, MeetingRequestWasSent |
|
257 | + $properties["requestsent"] = "PT_BOOLEAN:PSETID_Appointment:0x8229"; // PidLidFInvited, MeetingRequestWasSent |
|
258 | 258 | $properties["startdate"] = "PT_SYSTIME:PSETID_Appointment:" . PidLidAppointmentStartWhole; |
259 | 259 | $properties["duedate"] = "PT_SYSTIME:PSETID_Appointment:" . PidLidAppointmentEndWhole; |
260 | 260 | $properties["commonstart"] = "PT_SYSTIME:PSETID_Common:0x8516"; |
@@ -262,11 +262,11 @@ discard block |
||
262 | 262 | $properties["recurring"] = "PT_BOOLEAN:PSETID_Appointment:" . PidLidRecurring; |
263 | 263 | $properties["clipstart"] = "PT_SYSTIME:PSETID_Appointment:" . PidLidClipStart; |
264 | 264 | $properties["clipend"] = "PT_SYSTIME:PSETID_Appointment:" . PidLidClipEnd; |
265 | - $properties["start_recur_date"] = "PT_LONG:PSETID_Meeting:0xD"; // StartRecurTime |
|
266 | - $properties["start_recur_time"] = "PT_LONG:PSETID_Meeting:0xE"; // StartRecurTime |
|
267 | - $properties["end_recur_date"] = "PT_LONG:PSETID_Meeting:0xF"; // EndRecurDate |
|
268 | - $properties["end_recur_time"] = "PT_LONG:PSETID_Meeting:0x10"; // EndRecurTime |
|
269 | - $properties["is_exception"] = "PT_BOOLEAN:PSETID_Meeting:0xA"; // LID_IS_EXCEPTION |
|
265 | + $properties["start_recur_date"] = "PT_LONG:PSETID_Meeting:0xD"; // StartRecurTime |
|
266 | + $properties["start_recur_time"] = "PT_LONG:PSETID_Meeting:0xE"; // StartRecurTime |
|
267 | + $properties["end_recur_date"] = "PT_LONG:PSETID_Meeting:0xF"; // EndRecurDate |
|
268 | + $properties["end_recur_time"] = "PT_LONG:PSETID_Meeting:0x10"; // EndRecurTime |
|
269 | + $properties["is_exception"] = "PT_BOOLEAN:PSETID_Meeting:0xA"; // LID_IS_EXCEPTION |
|
270 | 270 | // Propose new time properties |
271 | 271 | $properties["proposed_start_whole"] = "PT_SYSTIME:PSETID_Appointment:" . PidLidAppointmentProposedStartWhole; |
272 | 272 | $properties["proposed_end_whole"] = "PT_SYSTIME:PSETID_Appointment:" . PidLidAppointmentProposedEndWhole; |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | $properties = []; |
646 | 646 | $properties["entryid"] = PR_ENTRYID; |
647 | 647 | $properties["parent_entryid"] = PR_PARENT_ENTRYID; |
648 | - $properties["store_entryid"] = PR_STORE_ENTRYID; // is this required ??? |
|
648 | + $properties["store_entryid"] = PR_STORE_ENTRYID; // is this required ??? |
|
649 | 649 | $properties["icon_index"] = PR_ICON_INDEX; |
650 | 650 | $properties["message_class"] = PR_MESSAGE_CLASS; |
651 | 651 | $properties["message_flags"] = PR_MESSAGE_FLAGS; |
@@ -961,9 +961,9 @@ discard block |
||
961 | 961 | $properties["appointment_location"] = "PT_STRING8:PSETID_Appointment:" . PidLidLocation; |
962 | 962 | $properties["appointment_recurring_pattern"] = "PT_STRING8:PSETID_Appointment:0x8232"; |
963 | 963 | $properties["appointment_recurring"] = "PT_BOOLEAN:PSETID_Appointment:" . PidLidRecurring; |
964 | - $properties["appointment_startdate_recurring"] = "PT_SYSTIME:PSETID_Appointment:" . PidLidClipStart; // ClipStart |
|
965 | - $properties["appointment_enddate_recurring"] = "PT_SYSTIME:PSETID_Appointment:" . PidLidClipEnd; // ClipEnd |
|
966 | - $properties["appointment_exception"] = "PT_BOOLEAN:PSETID_Meeting:0xA"; // LID_IS_EXCEPTION |
|
964 | + $properties["appointment_startdate_recurring"] = "PT_SYSTIME:PSETID_Appointment:" . PidLidClipStart; // ClipStart |
|
965 | + $properties["appointment_enddate_recurring"] = "PT_SYSTIME:PSETID_Appointment:" . PidLidClipEnd; // ClipEnd |
|
966 | + $properties["appointment_exception"] = "PT_BOOLEAN:PSETID_Meeting:0xA"; // LID_IS_EXCEPTION |
|
967 | 967 | $properties["appointment_location"] = "PT_STRING8:PSETID_Appointment:" . PidLidLocation; |
968 | 968 | // Propose new time properties |
969 | 969 | $properties["proposed_start_date"] = "PT_SYSTIME:PSETID_Appointment:" . PidLidAppointmentProposedStartWhole; |
@@ -1250,18 +1250,18 @@ discard block |
||
1250 | 1250 | $properties["object_type"] = PR_OBJECT_TYPE; |
1251 | 1251 | |
1252 | 1252 | $properties["recurring"] = "PT_BOOLEAN:PSETID_Appointment:" . PidLidRecurring; |
1253 | - $properties["reminder"] = "PT_BOOLEAN:PSETID_Common:" . PidLidReminderSet; // PidLidReminderSet |
|
1254 | - $properties["reminder_minutes"] = "PT_LONG:PSETID_Common:" . PidLidReminderDelta; // PidLidReminderDelta |
|
1255 | - $properties["reminder_time"] = "PT_SYSTIME:PSETID_Common:" . PidLidReminderTime; // PidLidReminderTime |
|
1256 | - $properties["flagdueby"] = "PT_SYSTIME:PSETID_Common:" . PidLidReminderSignalTime; // PidLidReminderSignalTime |
|
1257 | - |
|
1258 | - $properties["task_duedate"] = "PT_SYSTIME:PSETID_Task:" . PidLidTaskDueDate; // PidLidTaskDueDate |
|
1259 | - $properties["task_startdate"] = "PT_SYSTIME:PSETID_Task:" . PidLidTaskStartDate; // PidLidTaskStartDate |
|
1260 | - $properties["task_resetreminder"] = "PT_BOOLEAN:PSETID_Task:0x8107"; // PidLidTaskResetReminder |
|
1261 | - $properties["task_recurring"] = "PT_BOOLEAN:PSETID_Task:0x8126"; // PidLidTaskFRecurring |
|
1253 | + $properties["reminder"] = "PT_BOOLEAN:PSETID_Common:" . PidLidReminderSet; // PidLidReminderSet |
|
1254 | + $properties["reminder_minutes"] = "PT_LONG:PSETID_Common:" . PidLidReminderDelta; // PidLidReminderDelta |
|
1255 | + $properties["reminder_time"] = "PT_SYSTIME:PSETID_Common:" . PidLidReminderTime; // PidLidReminderTime |
|
1256 | + $properties["flagdueby"] = "PT_SYSTIME:PSETID_Common:" . PidLidReminderSignalTime; // PidLidReminderSignalTime |
|
1257 | + |
|
1258 | + $properties["task_duedate"] = "PT_SYSTIME:PSETID_Task:" . PidLidTaskDueDate; // PidLidTaskDueDate |
|
1259 | + $properties["task_startdate"] = "PT_SYSTIME:PSETID_Task:" . PidLidTaskStartDate; // PidLidTaskStartDate |
|
1260 | + $properties["task_resetreminder"] = "PT_BOOLEAN:PSETID_Task:0x8107"; // PidLidTaskResetReminder |
|
1261 | + $properties["task_recurring"] = "PT_BOOLEAN:PSETID_Task:0x8126"; // PidLidTaskFRecurring |
|
1262 | 1262 | $properties["taskmode"] = "PT_LONG:PSETID_Common:0x8518"; |
1263 | 1263 | |
1264 | - $properties["appointment_recurring"] = "PT_BOOLEAN:PSETID_Appointment:" . PidLidRecurring; // PidLidRecurring |
|
1264 | + $properties["appointment_recurring"] = "PT_BOOLEAN:PSETID_Appointment:" . PidLidRecurring; // PidLidRecurring |
|
1265 | 1265 | $properties["appointment_startdate"] = "PT_SYSTIME:PSETID_Appointment:" . PidLidAppointmentStartWhole; |
1266 | 1266 | $properties["appointment_enddate"] = "PT_SYSTIME:PSETID_Appointment:" . PidLidAppointmentEndWhole; |
1267 | 1267 | $properties["appointment_startdate_recurring"] = "PT_SYSTIME:PSETID_Appointment:" . PidLidClipStart; |