@@ -360,7 +360,7 @@ |
||
| 360 | 360 | ]; |
| 361 | 361 | $fileDependencies[$filename] = [ |
| 362 | 362 | 'depends' => [], |
| 363 | - 'core' => $core, // Based on tag or on class or on file path? |
|
| 363 | + 'core' => $core, // Based on tag or on class or on file path? |
|
| 364 | 364 | ]; |
| 365 | 365 | |
| 366 | 366 | for ($j = 0, $lenJ = count($class[1]); $j < $lenJ; ++$j) { |
@@ -218,7 +218,7 @@ |
||
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | $Language->setLanguage($lang); |
| 221 | - setcookie('lang', $lang, [ 'expires' => time() + 31536000, 'path' => '/', 'domain' => '', 'secure' => true, 'httponly' => true, 'samesite' => 'Strict' ]); |
|
| 221 | + setcookie('lang', $lang, ['expires' => time() + 31536000, 'path' => '/', 'domain' => '', 'secure' => true, 'httponly' => true, 'samesite' => 'Strict']); |
|
| 222 | 222 | |
| 223 | 223 | // add extra header |
| 224 | 224 | header("X-grommunio: " . trim(file_get_contents('version'))); |
@@ -195,8 +195,7 @@ |
||
| 195 | 195 | // TODO: move logon from MAPISession to here |
| 196 | 196 | |
| 197 | 197 | WebAppAuthentication::$_errorCode = isset($_SESSION['_keycloak_auth']) ? |
| 198 | - WebAppAuthentication::$_mapiSession->logon_token($username, $pass) : |
|
| 199 | - WebAppAuthentication::$_mapiSession->logon($username, $pass, DEFAULT_SERVER); |
|
| 198 | + WebAppAuthentication::$_mapiSession->logon_token($username, $pass) : WebAppAuthentication::$_mapiSession->logon($username, $pass, DEFAULT_SERVER); |
|
| 200 | 199 | |
| 201 | 200 | // Include external login plugins to be loaded |
| 202 | 201 | if (file_exists(BASE_PATH . 'extlogin.php')) { |
@@ -2059,9 +2059,9 @@ discard block |
||
| 2059 | 2059 | $messageProps = []; |
| 2060 | 2060 | // It stores the values that is exception allowed or not false -> not allowed |
| 2061 | 2061 | $isExceptionAllowed = true; |
| 2062 | - $delete = $actionType == 'delete'; // Flag for MeetingRequest Class whether to send update or cancel mail. |
|
| 2063 | - $basedate = false; // Flag for MeetingRequest Class whether to send an exception or not. |
|
| 2064 | - $isReminderTimeAllowed = true; // Flag to check reminder minutes is in range of the occurrences |
|
| 2062 | + $delete = $actionType == 'delete'; // Flag for MeetingRequest Class whether to send update or cancel mail. |
|
| 2063 | + $basedate = false; // Flag for MeetingRequest Class whether to send an exception or not. |
|
| 2064 | + $isReminderTimeAllowed = true; // Flag to check reminder minutes is in range of the occurrences |
|
| 2065 | 2065 | $properties = $GLOBALS['properties']->getAppointmentProperties(); |
| 2066 | 2066 | $send = false; |
| 2067 | 2067 | $oldProps = []; |
@@ -3003,7 +3003,7 @@ discard block |
||
| 3003 | 3003 | * convert flags of PR_MESSAGE_FLAGS property to flags that is |
| 3004 | 3004 | * used in mapi_message_setreadflag. |
| 3005 | 3005 | */ |
| 3006 | - $flag = MAPI_DEFERRED_ERRORS; // set unread flag, read receipt will be sent |
|
| 3006 | + $flag = MAPI_DEFERRED_ERRORS; // set unread flag, read receipt will be sent |
|
| 3007 | 3007 | |
| 3008 | 3008 | if (($flags & MSGFLAG_RN_PENDING) && isset($msg_action['send_read_receipt']) && $msg_action['send_read_receipt'] == false) { |
| 3009 | 3009 | $flag |= SUPPRESS_RECEIPT; |
@@ -3056,7 +3056,7 @@ discard block |
||
| 3056 | 3056 | |
| 3057 | 3057 | if (array_search(strtolower($foldername), $folderNames) !== false) { |
| 3058 | 3058 | $i = 2; |
| 3059 | - while (array_search(strtolower($foldername)." ($i)", $folderNames) !== false) |
|
| 3059 | + while (array_search(strtolower($foldername) . " ($i)", $folderNames) !== false) |
|
| 3060 | 3060 | ++$i; |
| 3061 | 3061 | $foldername .= " ($i)"; |
| 3062 | 3062 | } |
@@ -2105,9 +2105,9 @@ discard block |
||
| 2105 | 2105 | $props = mapi_getprops($message, $properties); |
| 2106 | 2106 | // Do not update timezone information if the appointment times haven't changed |
| 2107 | 2107 | if (!isset($action['props']['commonstart']) && |
| 2108 | - !isset($action['props']['commonend']) && |
|
| 2109 | - !isset($action['props']['startdate']) && |
|
| 2110 | - !isset($action['props']['enddate']) |
|
| 2108 | + !isset($action['props']['commonend']) && |
|
| 2109 | + !isset($action['props']['startdate']) && |
|
| 2110 | + !isset($action['props']['enddate']) |
|
| 2111 | 2111 | ) { |
| 2112 | 2112 | unset($action['props']['tzdefstart'], $action['props']['tzdefend']); |
| 2113 | 2113 | } |
@@ -2832,7 +2832,7 @@ discard block |
||
| 2832 | 2832 | * @return bool true if action succeeded, false if not |
| 2833 | 2833 | */ |
| 2834 | 2834 | public function deleteMessages($store, $parententryid, $entryids, |
| 2835 | - $softDelete = false, $unread = false) |
|
| 2835 | + $softDelete = false, $unread = false) |
|
| 2836 | 2836 | { |
| 2837 | 2837 | $result = false; |
| 2838 | 2838 | if (!is_array($entryids)) { |
@@ -2856,7 +2856,7 @@ discard block |
||
| 2856 | 2856 | $msgprops = mapi_getprops($defaultstore, [PR_IPM_WASTEBASKET_ENTRYID, PR_MDB_PROVIDER]); |
| 2857 | 2857 | |
| 2858 | 2858 | if (!isset($msgprops[PR_IPM_WASTEBASKET_ENTRYID]) || |
| 2859 | - $msgprops[PR_IPM_WASTEBASKET_ENTRYID] == $parententryid) { |
|
| 2859 | + $msgprops[PR_IPM_WASTEBASKET_ENTRYID] == $parententryid) { |
|
| 2860 | 2860 | $result = mapi_folder_deletemessages($folder, $entryids, $flags); |
| 2861 | 2861 | break; |
| 2862 | 2862 | } |
@@ -2844,68 +2844,68 @@ |
||
| 2844 | 2844 | $msgprops = mapi_getprops($store, [PR_IPM_WASTEBASKET_ENTRYID, PR_MDB_PROVIDER, PR_IPM_OUTBOX_ENTRYID]); |
| 2845 | 2845 | |
| 2846 | 2846 | switch ($msgprops[PR_MDB_PROVIDER]) { |
| 2847 | - case ZARAFA_STORE_DELEGATE_GUID: |
|
| 2848 | - $softDelete = $softDelete || defined('ENABLE_DEFAULT_SOFT_DELETE') ? ENABLE_DEFAULT_SOFT_DELETE : false; |
|
| 2849 | - // with a store from an other user we need our own waste basket... |
|
| 2850 | - if (isset($msgprops[PR_IPM_WASTEBASKET_ENTRYID]) && $msgprops[PR_IPM_WASTEBASKET_ENTRYID] == $parententryid || $softDelete) { |
|
| 2851 | - // except when it is the waste basket itself |
|
| 2852 | - $result = mapi_folder_deletemessages($folder, $entryids, $flags); |
|
| 2853 | - break; |
|
| 2854 | - } |
|
| 2855 | - $defaultstore = $GLOBALS["mapisession"]->getDefaultMessageStore(); |
|
| 2856 | - $msgprops = mapi_getprops($defaultstore, [PR_IPM_WASTEBASKET_ENTRYID, PR_MDB_PROVIDER]); |
|
| 2847 | + case ZARAFA_STORE_DELEGATE_GUID: |
|
| 2848 | + $softDelete = $softDelete || defined('ENABLE_DEFAULT_SOFT_DELETE') ? ENABLE_DEFAULT_SOFT_DELETE : false; |
|
| 2849 | + // with a store from an other user we need our own waste basket... |
|
| 2850 | + if (isset($msgprops[PR_IPM_WASTEBASKET_ENTRYID]) && $msgprops[PR_IPM_WASTEBASKET_ENTRYID] == $parententryid || $softDelete) { |
|
| 2851 | + // except when it is the waste basket itself |
|
| 2852 | + $result = mapi_folder_deletemessages($folder, $entryids, $flags); |
|
| 2853 | + break; |
|
| 2854 | + } |
|
| 2855 | + $defaultstore = $GLOBALS["mapisession"]->getDefaultMessageStore(); |
|
| 2856 | + $msgprops = mapi_getprops($defaultstore, [PR_IPM_WASTEBASKET_ENTRYID, PR_MDB_PROVIDER]); |
|
| 2857 | 2857 | |
| 2858 | - if (!isset($msgprops[PR_IPM_WASTEBASKET_ENTRYID]) || |
|
| 2859 | - $msgprops[PR_IPM_WASTEBASKET_ENTRYID] == $parententryid) { |
|
| 2860 | - $result = mapi_folder_deletemessages($folder, $entryids, $flags); |
|
| 2858 | + if (!isset($msgprops[PR_IPM_WASTEBASKET_ENTRYID]) || |
|
| 2859 | + $msgprops[PR_IPM_WASTEBASKET_ENTRYID] == $parententryid) { |
|
| 2860 | + $result = mapi_folder_deletemessages($folder, $entryids, $flags); |
|
| 2861 | + break; |
|
| 2862 | + } |
|
| 2863 | + try { |
|
| 2864 | + $result = $this->copyMessages($store, $parententryid, $defaultstore, $msgprops[PR_IPM_WASTEBASKET_ENTRYID], $entryids, [], true); |
|
| 2865 | + } |
|
| 2866 | + catch (MAPIException $e) { |
|
| 2867 | + $e->setHandled(); |
|
| 2868 | + // if moving fails, try normal delete |
|
| 2869 | + $result = mapi_folder_deletemessages($folder, $entryids, $flags); |
|
| 2870 | + } |
|
| 2861 | 2871 | break; |
| 2862 | - } |
|
| 2863 | - try { |
|
| 2864 | - $result = $this->copyMessages($store, $parententryid, $defaultstore, $msgprops[PR_IPM_WASTEBASKET_ENTRYID], $entryids, [], true); |
|
| 2865 | - } |
|
| 2866 | - catch (MAPIException $e) { |
|
| 2867 | - $e->setHandled(); |
|
| 2868 | - // if moving fails, try normal delete |
|
| 2869 | - $result = mapi_folder_deletemessages($folder, $entryids, $flags); |
|
| 2870 | - } |
|
| 2871 | - break; |
|
| 2872 | 2872 | |
| 2873 | - case ZARAFA_STORE_ARCHIVER_GUID: |
|
| 2874 | - case ZARAFA_STORE_PUBLIC_GUID: |
|
| 2875 | - // always delete in public store and archive store |
|
| 2876 | - $result = mapi_folder_deletemessages($folder, $entryids, $flags); |
|
| 2877 | - break; |
|
| 2878 | - |
|
| 2879 | - case ZARAFA_SERVICE_GUID: |
|
| 2880 | - // delete message when in your own waste basket, else move it to the waste basket |
|
| 2881 | - if (isset($msgprops[PR_IPM_WASTEBASKET_ENTRYID]) && $msgprops[PR_IPM_WASTEBASKET_ENTRYID] == $parententryid || $softDelete == true) { |
|
| 2873 | + case ZARAFA_STORE_ARCHIVER_GUID: |
|
| 2874 | + case ZARAFA_STORE_PUBLIC_GUID: |
|
| 2875 | + // always delete in public store and archive store |
|
| 2882 | 2876 | $result = mapi_folder_deletemessages($folder, $entryids, $flags); |
| 2883 | 2877 | break; |
| 2884 | - } |
|
| 2885 | - try { |
|
| 2886 | - // if the message is deleting from outbox then first delete the |
|
| 2887 | - // message from an outgoing queue. |
|
| 2888 | - if (function_exists("mapi_msgstore_abortsubmit") && isset($msgprops[PR_IPM_OUTBOX_ENTRYID]) && $msgprops[PR_IPM_OUTBOX_ENTRYID] === $parententryid) { |
|
| 2889 | - foreach ($entryids as $entryid) { |
|
| 2890 | - $message = mapi_msgstore_openentry($store, $entryid); |
|
| 2891 | - $messageProps = mapi_getprops($message, [PR_DEFERRED_SEND_TIME]); |
|
| 2892 | - if (isset($messageProps[PR_DEFERRED_SEND_TIME])) { |
|
| 2893 | - mapi_msgstore_abortsubmit($store, $entryid); |
|
| 2878 | + |
|
| 2879 | + case ZARAFA_SERVICE_GUID: |
|
| 2880 | + // delete message when in your own waste basket, else move it to the waste basket |
|
| 2881 | + if (isset($msgprops[PR_IPM_WASTEBASKET_ENTRYID]) && $msgprops[PR_IPM_WASTEBASKET_ENTRYID] == $parententryid || $softDelete == true) { |
|
| 2882 | + $result = mapi_folder_deletemessages($folder, $entryids, $flags); |
|
| 2883 | + break; |
|
| 2884 | + } |
|
| 2885 | + try { |
|
| 2886 | + // if the message is deleting from outbox then first delete the |
|
| 2887 | + // message from an outgoing queue. |
|
| 2888 | + if (function_exists("mapi_msgstore_abortsubmit") && isset($msgprops[PR_IPM_OUTBOX_ENTRYID]) && $msgprops[PR_IPM_OUTBOX_ENTRYID] === $parententryid) { |
|
| 2889 | + foreach ($entryids as $entryid) { |
|
| 2890 | + $message = mapi_msgstore_openentry($store, $entryid); |
|
| 2891 | + $messageProps = mapi_getprops($message, [PR_DEFERRED_SEND_TIME]); |
|
| 2892 | + if (isset($messageProps[PR_DEFERRED_SEND_TIME])) { |
|
| 2893 | + mapi_msgstore_abortsubmit($store, $entryid); |
|
| 2894 | + } |
|
| 2894 | 2895 | } |
| 2895 | 2896 | } |
| 2897 | + $result = $this->copyMessages($store, $parententryid, $store, $msgprops[PR_IPM_WASTEBASKET_ENTRYID], $entryids, [], true); |
|
| 2896 | 2898 | } |
| 2897 | - $result = $this->copyMessages($store, $parententryid, $store, $msgprops[PR_IPM_WASTEBASKET_ENTRYID], $entryids, [], true); |
|
| 2898 | - } |
|
| 2899 | - catch (MAPIException $e) { |
|
| 2900 | - if ($e->getCode() === MAPI_E_NOT_IN_QUEUE || $e->getCode() === MAPI_E_UNABLE_TO_ABORT) { |
|
| 2901 | - throw $e; |
|
| 2902 | - } |
|
| 2899 | + catch (MAPIException $e) { |
|
| 2900 | + if ($e->getCode() === MAPI_E_NOT_IN_QUEUE || $e->getCode() === MAPI_E_UNABLE_TO_ABORT) { |
|
| 2901 | + throw $e; |
|
| 2902 | + } |
|
| 2903 | 2903 | |
| 2904 | - $e->setHandled(); |
|
| 2905 | - // if moving fails, try normal delete |
|
| 2906 | - $result = mapi_folder_deletemessages($folder, $entryids, $flags); |
|
| 2907 | - } |
|
| 2908 | - break; |
|
| 2904 | + $e->setHandled(); |
|
| 2905 | + // if moving fails, try normal delete |
|
| 2906 | + $result = mapi_folder_deletemessages($folder, $entryids, $flags); |
|
| 2907 | + } |
|
| 2908 | + break; |
|
| 2909 | 2909 | } |
| 2910 | 2910 | |
| 2911 | 2911 | return $result; |
@@ -1059,8 +1059,9 @@ discard block |
||
| 1059 | 1059 | */ |
| 1060 | 1060 | public function renameFolder($store, $entryid, $name, &$folderProps) { |
| 1061 | 1061 | $folder = mapi_msgstore_openentry($store, $entryid); |
| 1062 | - if (!$folder) |
|
| 1063 | - return false; |
|
| 1062 | + if (!$folder) { |
|
| 1063 | + return false; |
|
| 1064 | + } |
|
| 1064 | 1065 | $result = false; |
| 1065 | 1066 | $folderProps = mapi_getprops($folder, [PR_ENTRYID, PR_STORE_ENTRYID, PR_DISPLAY_NAME]); |
| 1066 | 1067 | /* |
@@ -2088,7 +2089,8 @@ discard block |
||
| 2088 | 2089 | if (!empty($action['props']['timezone_iana'])) { |
| 2089 | 2090 | try { |
| 2090 | 2091 | $tzdef = mapi_ianatz_to_tzdef($action['props']['timezone_iana']); |
| 2091 | - } catch (Exception $e) { |
|
| 2092 | + } |
|
| 2093 | + catch (Exception $e) { |
|
| 2092 | 2094 | } |
| 2093 | 2095 | if ($tzdef !== false) { |
| 2094 | 2096 | $action['props']['tzdefstart'] = $action['props']['tzdefend'] = bin2hex($tzdef); |
@@ -2611,8 +2613,9 @@ discard block |
||
| 2611 | 2613 | $storeprops = mapi_getprops($store, [PR_IPM_OUTBOX_ENTRYID, PR_IPM_SENTMAIL_ENTRYID, PR_ENTRYID]); |
| 2612 | 2614 | $origStoreprops = mapi_getprops($origStore, [PR_ENTRYID]); |
| 2613 | 2615 | |
| 2614 | - if (!isset($storeprops[PR_IPM_OUTBOX_ENTRYID])) |
|
| 2615 | - return false; |
|
| 2616 | + if (!isset($storeprops[PR_IPM_OUTBOX_ENTRYID])) { |
|
| 2617 | + return false; |
|
| 2618 | + } |
|
| 2616 | 2619 | if (isset($storeprops[PR_IPM_SENTMAIL_ENTRYID])) { |
| 2617 | 2620 | $props[PR_SENTMAIL_ENTRYID] = $storeprops[PR_IPM_SENTMAIL_ENTRYID]; |
| 2618 | 2621 | } |
@@ -2779,8 +2782,9 @@ discard block |
||
| 2779 | 2782 | $message = $this->saveMessage($store, $entryid, $storeprops[PR_IPM_OUTBOX_ENTRYID], $props, $messageProps, $recipients, $attachments, [], $copyFromMessage, $copyAttachments, $copyRecipients, $copyInlineAttachmentsOnly, true, true, $isPlainText); |
| 2780 | 2783 | } |
| 2781 | 2784 | |
| 2782 | - if (!$message) |
|
| 2783 | - return false; |
|
| 2785 | + if (!$message) { |
|
| 2786 | + return false; |
|
| 2787 | + } |
|
| 2784 | 2788 | // Allowing to hook in just before the data sent away to be sent to the client |
| 2785 | 2789 | $GLOBALS['PluginManager']->triggerHook('server.core.operations.submitmessage', [ |
| 2786 | 2790 | 'moduleObject' => $this, |
@@ -2832,8 +2836,7 @@ discard block |
||
| 2832 | 2836 | * @return bool true if action succeeded, false if not |
| 2833 | 2837 | */ |
| 2834 | 2838 | public function deleteMessages($store, $parententryid, $entryids, |
| 2835 | - $softDelete = false, $unread = false) |
|
| 2836 | - { |
|
| 2839 | + $softDelete = false, $unread = false) { |
|
| 2837 | 2840 | $result = false; |
| 2838 | 2841 | if (!is_array($entryids)) { |
| 2839 | 2842 | $entryids = [$entryids]; |
@@ -3059,8 +3062,9 @@ discard block |
||
| 3059 | 3062 | |
| 3060 | 3063 | if (array_search(strtolower($foldername), $folderNames) !== false) { |
| 3061 | 3064 | $i = 2; |
| 3062 | - while (array_search(strtolower($foldername)." ($i)", $folderNames) !== false) |
|
| 3063 | - ++$i; |
|
| 3065 | + while (array_search(strtolower($foldername)." ($i)", $folderNames) !== false) { |
|
| 3066 | + ++$i; |
|
| 3067 | + } |
|
| 3064 | 3068 | $foldername .= " ($i)"; |
| 3065 | 3069 | } |
| 3066 | 3070 | |
@@ -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) { |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | if ($data === CHANGE_PASSPHRASE_SUCCESS) { |
| 57 | 57 | // Reset cached passphrase. |
| 58 | 58 | $encryptionStore = EncryptionStore::getInstance(); |
| 59 | - withPHPSession(function () use ($encryptionStore) { |
|
| 59 | + withPHPSession(function() use ($encryptionStore) { |
|
| 60 | 60 | $encryptionStore->add('smime', ''); |
| 61 | 61 | }); |
| 62 | 62 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $encryptionStore->add('smime', $data['passphrase'], time() + (5 * 60)); |
| 168 | 168 | } |
| 169 | 169 | else { |
| 170 | - withPHPSession(function () use ($encryptionStore, $data) { |
|
| 170 | + withPHPSession(function() use ($encryptionStore, $data) { |
|
| 171 | 171 | $encryptionStore->add('smime', $data['passphrase']); |
| 172 | 172 | }); |
| 173 | 173 | } |
@@ -25,9 +25,11 @@ |
||
| 25 | 25 | * @return bool true on success or false on failure |
| 26 | 26 | */ |
| 27 | 27 | public function execute() { |
| 28 | - foreach ($this->data as $actionType => $actionData) try { |
|
| 28 | + foreach ($this->data as $actionType => $actionData) { |
|
| 29 | + try { |
|
| 29 | 30 | if (!isset($actionType)) |
| 30 | 31 | continue; |
| 32 | + } |
|
| 31 | 33 | switch ($actionType) { |
| 32 | 34 | case 'certificate': |
| 33 | 35 | $data = $this->verifyCertificate($actionData); |
@@ -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 | } |
@@ -98,8 +98,9 @@ |
||
| 98 | 98 | // Get messages from certificates |
| 99 | 99 | foreach ($privateCerts as $privateCert) { |
| 100 | 100 | $privateCertMessage = mapi_msgstore_openentry($store, $privateCert[PR_ENTRYID]); |
| 101 | - if ($privateCertMessage === false) |
|
| 102 | - continue; |
|
| 101 | + if ($privateCertMessage === false) { |
|
| 102 | + continue; |
|
| 103 | + } |
|
| 103 | 104 | $pkcs12 = ""; |
| 104 | 105 | $certs = []; |
| 105 | 106 | // Read pkcs12 cert from message |
@@ -376,8 +376,9 @@ discard block |
||
| 376 | 376 | |
| 377 | 377 | // Compare the timezone definitions of the client and the appointment. |
| 378 | 378 | // Further processing is only required if they don't match. |
| 379 | - if ($GLOBALS['entryid']->compareEntryIds($this->tzdef, $calendaritem['props']['tzdefstart'])) |
|
| 380 | - return; |
|
| 379 | + if ($GLOBALS['entryid']->compareEntryIds($this->tzdef, $calendaritem['props']['tzdefstart'])) { |
|
| 380 | + return; |
|
| 381 | + } |
|
| 381 | 382 | |
| 382 | 383 | if ($this->tzdefObj === false) { |
| 383 | 384 | $this->tzdefObj = $GLOBALS['entryid']->createTimezoneDefinitionObject($this->tzdef); |
@@ -389,8 +390,9 @@ discard block |
||
| 389 | 390 | // Find TZRULE_FLAG_EFFECTIVE_TZREG rule for the appointment's timezone |
| 390 | 391 | $appTzEffRuleIdx = getEffectiveTzreg($appTzDefStart['rules']); |
| 391 | 392 | |
| 392 | - if (is_null($this->tzEffRuleIdx) && !is_null($appTzEffRuleIdx)) |
|
| 393 | - return; |
|
| 393 | + if (is_null($this->tzEffRuleIdx) && !is_null($appTzEffRuleIdx)) { |
|
| 394 | + return; |
|
| 395 | + } |
|
| 394 | 396 | // first apply the bias of the appointment timezone and the bias of the browser |
| 395 | 397 | $localStart = $calendaritem['props']['startdate'] - $appTzDefStart['rules'][$appTzEffRuleIdx]['bias'] * 60 + $this->tzdefObj['rules'][$this->tzEffRuleIdx]['bias'] * 60; |
| 396 | 398 | if (isDst($appTzDefStart['rules'][$appTzEffRuleIdx], $calendaritem['props']['startdate'])) { |