@@ -45,37 +45,37 @@ |
||
45 | 45 | |
46 | 46 | case 'server.index.load.custom': |
47 | 47 | switch ($data['name']) { |
48 | - case 'files_get_recipients': |
|
49 | - RecipientHandler::doGetRecipients(); |
|
50 | - break; |
|
48 | + case 'files_get_recipients': |
|
49 | + RecipientHandler::doGetRecipients(); |
|
50 | + break; |
|
51 | 51 | |
52 | - case 'download_file': |
|
53 | - DownloadHandler::doDownload(); |
|
54 | - break; |
|
52 | + case 'download_file': |
|
53 | + DownloadHandler::doDownload(); |
|
54 | + break; |
|
55 | 55 | |
56 | - case 'upload_file': |
|
57 | - UploadHandler::doUpload(); |
|
58 | - break; |
|
56 | + case 'upload_file': |
|
57 | + UploadHandler::doUpload(); |
|
58 | + break; |
|
59 | 59 | |
60 | - case 'form': |
|
61 | - if (isset($_GET['backend'])) { |
|
62 | - $backend = urldecode($_GET["backend"]); |
|
63 | - } |
|
64 | - else { |
|
65 | - $backend = ''; |
|
66 | - } |
|
67 | - $backendstore = Files\Backend\BackendStore::getInstance(); |
|
60 | + case 'form': |
|
61 | + if (isset($_GET['backend'])) { |
|
62 | + $backend = urldecode($_GET["backend"]); |
|
63 | + } |
|
64 | + else { |
|
65 | + $backend = ''; |
|
66 | + } |
|
67 | + $backendstore = Files\Backend\BackendStore::getInstance(); |
|
68 | 68 | |
69 | - if ($backendstore->backendExists($backend)) { |
|
70 | - $backendInstance = $backendstore->getInstanceOfBackend($backend); |
|
71 | - $formdata = $backendInstance->getFormConfig(); |
|
69 | + if ($backendstore->backendExists($backend)) { |
|
70 | + $backendInstance = $backendstore->getInstanceOfBackend($backend); |
|
71 | + $formdata = $backendInstance->getFormConfig(); |
|
72 | 72 | |
73 | - exit($formdata); |
|
74 | - } |
|
73 | + exit($formdata); |
|
74 | + } |
|
75 | 75 | |
76 | - exit("Specified backend does not exist!"); |
|
76 | + exit("Specified backend does not exist!"); |
|
77 | 77 | |
78 | - break; |
|
78 | + break; |
|
79 | 79 | } |
80 | 80 | break; |
81 | 81 | } |
@@ -15,31 +15,31 @@ |
||
15 | 15 | $tag = $this->peek(); |
16 | 16 | |
17 | 17 | switch ($tag) { |
18 | - case 0: |
|
19 | - $res['otherName'] = $this->oid(-6); |
|
20 | - break; |
|
21 | - |
|
22 | - case 1: |
|
23 | - $res['rfc822Name'] = $this->next(-22); |
|
24 | - break; |
|
25 | - |
|
26 | - case 2: |
|
27 | - $res['dNSName'] = $this->next(-22); |
|
28 | - break; |
|
29 | - |
|
30 | - case 4: |
|
31 | - $this->next(4); |
|
32 | - $res['directoryName'] = $this->name(); |
|
33 | - $res['directoryName_'] = $this->nameasstring($res['directoryName']); |
|
34 | - break; |
|
35 | - |
|
36 | - case 6: |
|
37 | - $res['uniformResourceIdentifier'] = $this->next(-22); |
|
38 | - break; |
|
39 | - |
|
40 | - default: |
|
41 | - throw new \Exception("Unsupported GeneralName: {$tag}"); |
|
42 | -# trigger_error("Unsupported GeneralName: $tag", E_USER_ERROR); |
|
18 | + case 0: |
|
19 | + $res['otherName'] = $this->oid(-6); |
|
20 | + break; |
|
21 | + |
|
22 | + case 1: |
|
23 | + $res['rfc822Name'] = $this->next(-22); |
|
24 | + break; |
|
25 | + |
|
26 | + case 2: |
|
27 | + $res['dNSName'] = $this->next(-22); |
|
28 | + break; |
|
29 | + |
|
30 | + case 4: |
|
31 | + $this->next(4); |
|
32 | + $res['directoryName'] = $this->name(); |
|
33 | + $res['directoryName_'] = $this->nameasstring($res['directoryName']); |
|
34 | + break; |
|
35 | + |
|
36 | + case 6: |
|
37 | + $res['uniformResourceIdentifier'] = $this->next(-22); |
|
38 | + break; |
|
39 | + |
|
40 | + default: |
|
41 | + throw new \Exception("Unsupported GeneralName: {$tag}"); |
|
42 | + # trigger_error("Unsupported GeneralName: $tag", E_USER_ERROR); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | return $res; |
@@ -29,62 +29,62 @@ |
||
29 | 29 | if (!isset($actionType)) |
30 | 30 | continue; |
31 | 31 | switch ($actionType) { |
32 | - case 'certificate': |
|
33 | - $data = $this->verifyCertificate($actionData); |
|
34 | - $response = [ |
|
35 | - 'type' => 3, |
|
36 | - 'status' => $data['status'], |
|
37 | - 'message' => $data['message'], |
|
38 | - 'data' => $data['data'], |
|
39 | - ]; |
|
40 | - $this->addActionData('certificate', $response); |
|
41 | - $GLOBALS['bus']->addData($this->getResponseData()); |
|
42 | - break; |
|
32 | + case 'certificate': |
|
33 | + $data = $this->verifyCertificate($actionData); |
|
34 | + $response = [ |
|
35 | + 'type' => 3, |
|
36 | + 'status' => $data['status'], |
|
37 | + 'message' => $data['message'], |
|
38 | + 'data' => $data['data'], |
|
39 | + ]; |
|
40 | + $this->addActionData('certificate', $response); |
|
41 | + $GLOBALS['bus']->addData($this->getResponseData()); |
|
42 | + break; |
|
43 | 43 | |
44 | - case 'passphrase': |
|
45 | - $data = $this->verifyPassphrase($actionData); |
|
46 | - $response = [ |
|
47 | - 'type' => 3, |
|
48 | - 'status' => $data['status'], |
|
49 | - ]; |
|
50 | - $this->addActionData('passphrase', $response); |
|
51 | - $GLOBALS['bus']->addData($this->getResponseData()); |
|
52 | - break; |
|
44 | + case 'passphrase': |
|
45 | + $data = $this->verifyPassphrase($actionData); |
|
46 | + $response = [ |
|
47 | + 'type' => 3, |
|
48 | + 'status' => $data['status'], |
|
49 | + ]; |
|
50 | + $this->addActionData('passphrase', $response); |
|
51 | + $GLOBALS['bus']->addData($this->getResponseData()); |
|
52 | + break; |
|
53 | 53 | |
54 | - case 'changepassphrase': |
|
55 | - $data = $this->changePassphrase($actionData); |
|
56 | - if ($data === CHANGE_PASSPHRASE_SUCCESS) { |
|
57 | - // Reset cached passphrase. |
|
58 | - $encryptionStore = EncryptionStore::getInstance(); |
|
59 | - withPHPSession(function () use ($encryptionStore) { |
|
60 | - $encryptionStore->add('smime', ''); |
|
61 | - }); |
|
62 | - } |
|
63 | - $response = [ |
|
64 | - 'type' => 3, |
|
65 | - 'code' => $data, |
|
66 | - ]; |
|
67 | - $this->addActionData('changepassphrase', $response); |
|
68 | - $GLOBALS['bus']->addData($this->getResponseData()); |
|
69 | - break; |
|
54 | + case 'changepassphrase': |
|
55 | + $data = $this->changePassphrase($actionData); |
|
56 | + if ($data === CHANGE_PASSPHRASE_SUCCESS) { |
|
57 | + // Reset cached passphrase. |
|
58 | + $encryptionStore = EncryptionStore::getInstance(); |
|
59 | + withPHPSession(function () use ($encryptionStore) { |
|
60 | + $encryptionStore->add('smime', ''); |
|
61 | + }); |
|
62 | + } |
|
63 | + $response = [ |
|
64 | + 'type' => 3, |
|
65 | + 'code' => $data, |
|
66 | + ]; |
|
67 | + $this->addActionData('changepassphrase', $response); |
|
68 | + $GLOBALS['bus']->addData($this->getResponseData()); |
|
69 | + break; |
|
70 | 70 | |
71 | - case 'list': |
|
72 | - $data = $this->getPublicCertificates(); |
|
73 | - $this->addActionData('list', $data); |
|
74 | - $GLOBALS['bus']->addData($this->getResponseData()); |
|
75 | - break; |
|
71 | + case 'list': |
|
72 | + $data = $this->getPublicCertificates(); |
|
73 | + $this->addActionData('list', $data); |
|
74 | + $GLOBALS['bus']->addData($this->getResponseData()); |
|
75 | + break; |
|
76 | 76 | |
77 | - case 'delete': |
|
78 | - // FIXME: handle multiple deletes? Separate function? |
|
79 | - $entryid = $actionData['entryid']; |
|
80 | - $root = mapi_msgstore_openentry($this->store, null); |
|
81 | - mapi_folder_deletemessages($root, [hex2bin($entryid)]); |
|
77 | + case 'delete': |
|
78 | + // FIXME: handle multiple deletes? Separate function? |
|
79 | + $entryid = $actionData['entryid']; |
|
80 | + $root = mapi_msgstore_openentry($this->store, null); |
|
81 | + mapi_folder_deletemessages($root, [hex2bin($entryid)]); |
|
82 | 82 | |
83 | - $this->sendFeedback(true); |
|
84 | - break; |
|
83 | + $this->sendFeedback(true); |
|
84 | + break; |
|
85 | 85 | |
86 | - default: |
|
87 | - $this->handleUnknownActionType($actionType); |
|
86 | + default: |
|
87 | + $this->handleUnknownActionType($actionType); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | catch (Exception $e) { |
@@ -92,45 +92,45 @@ discard block |
||
92 | 92 | public function execute($eventID, &$data) { |
93 | 93 | switch ($eventID) { |
94 | 94 | // Register plugin |
95 | - case 'server.core.settings.init.before': |
|
96 | - $this->onBeforeSettingsInit($data); |
|
97 | - break; |
|
98 | - // Verify a signed or encrypted message when an email is opened |
|
99 | - case 'server.util.parse_smime.signed': |
|
100 | - $this->onSignedMessage($data); |
|
101 | - break; |
|
102 | - |
|
103 | - case 'server.util.parse_smime.encrypted': |
|
104 | - $this->onEncrypted($data); |
|
105 | - break; |
|
106 | - // Add S/MIME property, which is send to the client |
|
107 | - case 'server.module.itemmodule.open.after': |
|
108 | - $this->onAfterOpen($data); |
|
109 | - break; |
|
110 | - // Catch uploaded certificate |
|
111 | - case 'server.upload_attachment.upload': |
|
112 | - $this->onUploadCertificate($data); |
|
113 | - break; |
|
114 | - // Sign email before sending |
|
115 | - case 'server.core.operations.submitmessage': |
|
116 | - $this->onBeforeSend($data); |
|
117 | - break; |
|
118 | - // Verify that we have public certificates for all recipients |
|
119 | - case 'server.module.createmailitemmodule.beforesend': |
|
120 | - $this->onCertificateCheck($data); |
|
121 | - break; |
|
122 | - |
|
123 | - case 'server.index.load.custom': |
|
124 | - if ($data['name'] === 'smime_passphrase') { |
|
125 | - include 'templates/passphrase.tpl.php'; |
|
126 | - exit(); |
|
127 | - } |
|
128 | - if ($data['name'] === 'smime_passphrasecheck') { |
|
129 | - // No need to do anything, this is just used to trigger |
|
130 | - // the browser's autofill save password dialog. |
|
131 | - exit(); |
|
132 | - } |
|
133 | - break; |
|
95 | + case 'server.core.settings.init.before': |
|
96 | + $this->onBeforeSettingsInit($data); |
|
97 | + break; |
|
98 | + // Verify a signed or encrypted message when an email is opened |
|
99 | + case 'server.util.parse_smime.signed': |
|
100 | + $this->onSignedMessage($data); |
|
101 | + break; |
|
102 | + |
|
103 | + case 'server.util.parse_smime.encrypted': |
|
104 | + $this->onEncrypted($data); |
|
105 | + break; |
|
106 | + // Add S/MIME property, which is send to the client |
|
107 | + case 'server.module.itemmodule.open.after': |
|
108 | + $this->onAfterOpen($data); |
|
109 | + break; |
|
110 | + // Catch uploaded certificate |
|
111 | + case 'server.upload_attachment.upload': |
|
112 | + $this->onUploadCertificate($data); |
|
113 | + break; |
|
114 | + // Sign email before sending |
|
115 | + case 'server.core.operations.submitmessage': |
|
116 | + $this->onBeforeSend($data); |
|
117 | + break; |
|
118 | + // Verify that we have public certificates for all recipients |
|
119 | + case 'server.module.createmailitemmodule.beforesend': |
|
120 | + $this->onCertificateCheck($data); |
|
121 | + break; |
|
122 | + |
|
123 | + case 'server.index.load.custom': |
|
124 | + if ($data['name'] === 'smime_passphrase') { |
|
125 | + include 'templates/passphrase.tpl.php'; |
|
126 | + exit(); |
|
127 | + } |
|
128 | + if ($data['name'] === 'smime_passphrasecheck') { |
|
129 | + // No need to do anything, this is just used to trigger |
|
130 | + // the browser's autofill save password dialog. |
|
131 | + exit(); |
|
132 | + } |
|
133 | + break; |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
@@ -663,23 +663,23 @@ discard block |
||
663 | 663 | |
664 | 664 | // Sign then Encrypt email |
665 | 665 | switch ($messageClass) { |
666 | - case 'IPM.Note.deferSMIME.SignedEncrypt': |
|
667 | - case 'IPM.Note.SMIME.SignedEncrypt': |
|
668 | - $tmpFile = tempnam(sys_get_temp_dir(), true); |
|
669 | - $this->sign($tmpSendEmail, $tmpFile, $message, $signedAttach, $smimeProps); |
|
670 | - $this->encrypt($tmpFile, $tmpSendSmimeEmail, $message, $signedAttach, $smimeProps); |
|
671 | - unlink($tmpFile); |
|
672 | - break; |
|
673 | - |
|
674 | - case 'IPM.Note.deferSMIME.MultipartSigned': |
|
675 | - case 'IPM.Note.SMIME.MultipartSigned': |
|
676 | - $this->sign($tmpSendEmail, $tmpSendSmimeEmail, $message, $signedAttach, $smimeProps); |
|
677 | - break; |
|
678 | - |
|
679 | - case 'IPM.Note.deferSMIME': |
|
680 | - case 'IPM.Note.SMIME': |
|
681 | - $this->encrypt($tmpSendEmail, $tmpSendSmimeEmail, $message, $signedAttach, $smimeProps); |
|
682 | - break; |
|
666 | + case 'IPM.Note.deferSMIME.SignedEncrypt': |
|
667 | + case 'IPM.Note.SMIME.SignedEncrypt': |
|
668 | + $tmpFile = tempnam(sys_get_temp_dir(), true); |
|
669 | + $this->sign($tmpSendEmail, $tmpFile, $message, $signedAttach, $smimeProps); |
|
670 | + $this->encrypt($tmpFile, $tmpSendSmimeEmail, $message, $signedAttach, $smimeProps); |
|
671 | + unlink($tmpFile); |
|
672 | + break; |
|
673 | + |
|
674 | + case 'IPM.Note.deferSMIME.MultipartSigned': |
|
675 | + case 'IPM.Note.SMIME.MultipartSigned': |
|
676 | + $this->sign($tmpSendEmail, $tmpSendSmimeEmail, $message, $signedAttach, $smimeProps); |
|
677 | + break; |
|
678 | + |
|
679 | + case 'IPM.Note.deferSMIME': |
|
680 | + case 'IPM.Note.SMIME': |
|
681 | + $this->encrypt($tmpSendEmail, $tmpSendSmimeEmail, $message, $signedAttach, $smimeProps); |
|
682 | + break; |
|
683 | 683 | } |
684 | 684 | |
685 | 685 | // Save the signed message as attachment of the send email |
@@ -33,14 +33,14 @@ |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | switch ($this->status) { |
36 | - case 'good': |
|
37 | - return OCSP_CERT_STATUS_GOOD; |
|
36 | + case 'good': |
|
37 | + return OCSP_CERT_STATUS_GOOD; |
|
38 | 38 | |
39 | - case 'revoked': |
|
40 | - return OCSP_CERT_STATUS_REVOKED; |
|
39 | + case 'revoked': |
|
40 | + return OCSP_CERT_STATUS_REVOKED; |
|
41 | 41 | |
42 | - default: |
|
43 | - return OCSP_CERT_STATUS_UNKOWN; |
|
42 | + default: |
|
43 | + return OCSP_CERT_STATUS_UNKOWN; |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | } |
@@ -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) { |