@@ -23,8 +23,7 @@ |
||
| 23 | 23 | |
| 24 | 24 | # Replicate value logic from php-src/ext/zlib/zlib.c |
| 25 | 25 | $sv = ini_get("zlib.output_compression"); |
| 26 | - $sv = strcasecmp($sv, "on") == 0 ? 1 : |
|
| 27 | - (strcasecmp($sv, "off") == 0 ? 0 : intval($sv)); |
|
| 26 | + $sv = strcasecmp($sv, "on") == 0 ? 1 : (strcasecmp($sv, "off") == 0 ? 0 : intval($sv)); |
|
| 28 | 27 | if ($sv != 0) { |
| 29 | 28 | $this->error_config("zlib.output_compression", "off", "With this option enabled, it could occur that XMLHTTP requests will fail"); |
| 30 | 29 | } |
@@ -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) { |
@@ -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')) { |
@@ -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 |
@@ -21,17 +21,17 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | class PhpfastcacheIOException extends PhpfastcacheCoreException |
| 23 | 23 | { |
| 24 | - /** |
|
| 25 | - * @inheritdoc |
|
| 26 | - */ |
|
| 27 | - public function __construct(string $message = "", int $code = 0, \Throwable $previous = null) |
|
| 28 | - { |
|
| 29 | - $lastError = error_get_last(); |
|
| 30 | - if ($lastError) { |
|
| 31 | - $message .= "\n"; |
|
| 32 | - $message .= "Additional information provided by error_get_last():\n"; |
|
| 33 | - $message .= "{$lastError['message']} in {$lastError['file']} line {$lastError['line']}"; |
|
| 34 | - } |
|
| 35 | - parent::__construct($message, $code, $previous); |
|
| 36 | - } |
|
| 24 | + /** |
|
| 25 | + * @inheritdoc |
|
| 26 | + */ |
|
| 27 | + public function __construct(string $message = "", int $code = 0, \Throwable $previous = null) |
|
| 28 | + { |
|
| 29 | + $lastError = error_get_last(); |
|
| 30 | + if ($lastError) { |
|
| 31 | + $message .= "\n"; |
|
| 32 | + $message .= "Additional information provided by error_get_last():\n"; |
|
| 33 | + $message .= "{$lastError['message']} in {$lastError['file']} line {$lastError['line']}"; |
|
| 34 | + } |
|
| 35 | + parent::__construct($message, $code, $previous); |
|
| 36 | + } |
|
| 37 | 37 | } |
@@ -24,8 +24,7 @@ |
||
| 24 | 24 | /** |
| 25 | 25 | * @inheritdoc |
| 26 | 26 | */ |
| 27 | - public function __construct(string $message = "", int $code = 0, \Throwable $previous = null) |
|
| 28 | - { |
|
| 27 | + public function __construct(string $message = "", int $code = 0, \Throwable $previous = null) { |
|
| 29 | 28 | $lastError = error_get_last(); |
| 30 | 29 | if ($lastError) { |
| 31 | 30 | $message .= "\n"; |
@@ -18,12 +18,12 @@ |
||
| 18 | 18 | |
| 19 | 19 | class PhpfastcacheCorruptedDataException extends PhpfastcacheDriverException |
| 20 | 20 | { |
| 21 | - /** |
|
| 22 | - * @param string $message |
|
| 23 | - * @param mixed|null $corruptedData |
|
| 24 | - */ |
|
| 25 | - public function __construct(protected $message = '', protected mixed $corruptedData = null) |
|
| 26 | - { |
|
| 27 | - parent::__construct($message); |
|
| 28 | - } |
|
| 21 | + /** |
|
| 22 | + * @param string $message |
|
| 23 | + * @param mixed|null $corruptedData |
|
| 24 | + */ |
|
| 25 | + public function __construct(protected $message = '', protected mixed $corruptedData = null) |
|
| 26 | + { |
|
| 27 | + parent::__construct($message); |
|
| 28 | + } |
|
| 29 | 29 | } |
@@ -22,8 +22,7 @@ |
||
| 22 | 22 | * @param string $message |
| 23 | 23 | * @param mixed|null $corruptedData |
| 24 | 24 | */ |
| 25 | - public function __construct(protected $message = '', protected mixed $corruptedData = null) |
|
| 26 | - { |
|
| 25 | + public function __construct(protected $message = '', protected mixed $corruptedData = null) { |
|
| 27 | 26 | parent::__construct($message); |
| 28 | 27 | } |
| 29 | 28 | } |