@@ -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); |
@@ -165,8 +165,9 @@ discard block |
||
165 | 165 | if ($messageClass !== 'IPM.Note.SMIME' && |
166 | 166 | $messageClass !== 'IPM.Note.SMIME.SignedEncrypt' && |
167 | 167 | $messageClass !== 'IPM.Note.deferSMIME' && |
168 | - $messageClass !== 'IPM.Note.deferSMIME.SignedEncrypt') |
|
169 | - return; |
|
168 | + $messageClass !== 'IPM.Note.deferSMIME.SignedEncrypt') { |
|
169 | + return; |
|
170 | + } |
|
170 | 171 | |
171 | 172 | $recipients = $data['action']['props']['smime']; |
172 | 173 | $missingCerts = []; |
@@ -300,8 +301,9 @@ discard block |
||
300 | 301 | $importCert = file_get_contents($outcert); |
301 | 302 | $parsedImportCert = openssl_x509_parse($importCert); |
302 | 303 | $parsedUserCert = openssl_x509_parse($userCert); |
303 | - if (!$signed_ok || $openssl_error_code === OPENSSL_CA_VERIFY_FAIL) |
|
304 | - continue; |
|
304 | + if (!$signed_ok || $openssl_error_code === OPENSSL_CA_VERIFY_FAIL) { |
|
305 | + continue; |
|
306 | + } |
|
305 | 307 | |
306 | 308 | // CA Checks out |
307 | 309 | $caCerts = $this->extractCAs($tmpfname); |
@@ -528,8 +530,9 @@ discard block |
||
528 | 530 | * @param {mixed} $data |
529 | 531 | */ |
530 | 532 | public function onUploadCertificate($data) { |
531 | - if ($data['sourcetype'] !== 'certificate') |
|
532 | - return; |
|
533 | + if ($data['sourcetype'] !== 'certificate') { |
|
534 | + return; |
|
535 | + } |
|
533 | 536 | $passphrase = $_POST['passphrase']; |
534 | 537 | $saveCert = false; |
535 | 538 | $tmpname = $data['tmpname']; |
@@ -604,11 +607,13 @@ discard block |
||
604 | 607 | $props = mapi_getprops($message, [PR_MESSAGE_CLASS]); |
605 | 608 | $messageClass = $props[PR_MESSAGE_CLASS]; |
606 | 609 | |
607 | - if (!isset($messageClass)) |
|
608 | - return; |
|
610 | + if (!isset($messageClass)) { |
|
611 | + return; |
|
612 | + } |
|
609 | 613 | if (stripos($messageClass, 'IPM.Note.deferSMIME') === false && |
610 | - stripos($messageClass, 'IPM.Note.SMIME') === false) |
|
611 | - return; |
|
614 | + stripos($messageClass, 'IPM.Note.SMIME') === false) { |
|
615 | + return; |
|
616 | + } |
|
612 | 617 | |
613 | 618 | // FIXME: for now return when we are going to sign but we don't have the passphrase set |
614 | 619 | // This should never happen sign |
@@ -617,8 +622,9 @@ discard block |
||
617 | 622 | $messageClass === 'IPM.Note.deferSMIME.MultipartSigned' || |
618 | 623 | $messageClass === 'IPM.Note.SMIME.SignedEncrypt' || |
619 | 624 | $messageClass === 'IPM.Note.SMIME.MultipartSigned') && |
620 | - !$encryptionStore->get('smime')) |
|
621 | - return; |
|
625 | + !$encryptionStore->get('smime')) { |
|
626 | + return; |
|
627 | + } |
|
622 | 628 | // NOTE: setting message class to IPM.Note, so that mapi_inetmapi_imtoinet converts the message to plain email |
623 | 629 | // and doesn't fail when handling the attachments. |
624 | 630 | mapi_setprops($message, [PR_MESSAGE_CLASS => 'IPM.Note']); |
@@ -862,8 +868,9 @@ discard block |
||
862 | 868 | foreach ($certs as $cert) { |
863 | 869 | $pubkey = mapi_msgstore_openentry($this->getStore(), $cert[PR_ENTRYID]); |
864 | 870 | $certificate = ""; |
865 | - if ($pubkey == false) |
|
866 | - continue; |
|
871 | + if ($pubkey == false) { |
|
872 | + continue; |
|
873 | + } |
|
867 | 874 | // retrieve pkcs#11 certificate from body |
868 | 875 | $stream = mapi_openproperty($pubkey, PR_BODY, IID_IStream, 0, 0); |
869 | 876 | $stat = mapi_stream_stat($stream); |
@@ -985,8 +992,9 @@ discard block |
||
985 | 992 | */ |
986 | 993 | public function importCertificate($cert, $certData, $type = 'public', $force = false) { |
987 | 994 | $certEmail = getCertEmail($certData); |
988 | - if ($this->pubcertExists($certEmail) && !$force && $type !== 'private') |
|
989 | - return; |
|
995 | + if ($this->pubcertExists($certEmail) && !$force && $type !== 'private') { |
|
996 | + return; |
|
997 | + } |
|
990 | 998 | $issued_by = ""; |
991 | 999 | foreach (array_keys($certData['issuer']) as $key) { |
992 | 1000 | $issued_by .= $key . '=' . $certData['issuer'][$key] . "\n"; |
@@ -1110,8 +1118,9 @@ discard block |
||
1110 | 1118 | * @return array with properties |
1111 | 1119 | */ |
1112 | 1120 | public function getSenderAddress($mapiMessage) { |
1113 | - if (method_exists($GLOBALS['operations'], 'getSenderAddress')) |
|
1114 | - return $GLOBALS["operations"]->getSenderAddress($mapiMessage); |
|
1121 | + if (method_exists($GLOBALS['operations'], 'getSenderAddress')) { |
|
1122 | + return $GLOBALS["operations"]->getSenderAddress($mapiMessage); |
|
1123 | + } |
|
1115 | 1124 | |
1116 | 1125 | $messageProps = mapi_getprops($mapiMessage, [PR_SENT_REPRESENTING_ENTRYID, PR_SENDER_ENTRYID]); |
1117 | 1126 | $senderEntryID = isset($messageProps[PR_SENT_REPRESENTING_ENTRYID]) ? $messageProps[PR_SENT_REPRESENTING_ENTRYID] : $messageProps[PR_SENDER_ENTRYID]; |
@@ -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'])) { |
@@ -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"; |
@@ -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 | } |
@@ -106,7 +106,8 @@ discard block |
||
106 | 106 | ] |
107 | 107 | ); |
108 | 108 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
109 | - } catch (PDOException $e) { |
|
109 | + } |
|
110 | + catch (PDOException $e) { |
|
110 | 111 | try { |
111 | 112 | $stm = $this->getDb($item->getEncodedKey(), true) |
112 | 113 | ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword LIMIT 1"); |
@@ -116,7 +117,8 @@ discard block |
||
116 | 117 | ] |
117 | 118 | ); |
118 | 119 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
119 | - } catch (PDOException $e) { |
|
120 | + } |
|
121 | + catch (PDOException $e) { |
|
120 | 122 | return null; |
121 | 123 | } |
122 | 124 | } |
@@ -168,8 +170,7 @@ discard block |
||
168 | 170 | * @param string $keyword |
169 | 171 | * @return int |
170 | 172 | */ |
171 | - public function getDbIndex(string $keyword) |
|
172 | - { |
|
173 | + public function getDbIndex(string $keyword) { |
|
173 | 174 | if (!isset($this->indexing)) { |
174 | 175 | $tableCreated = false; |
175 | 176 | if (!file_exists($this->sqliteDir . '/indexing')) { |
@@ -193,9 +194,11 @@ discard block |
||
193 | 194 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
194 | 195 | if (!isset($row['db'])) { |
195 | 196 | $db = 1; |
196 | - } elseif ($row['db'] <= 1) { |
|
197 | + } |
|
198 | + elseif ($row['db'] <= 1) { |
|
197 | 199 | $db = 1; |
198 | - } else { |
|
200 | + } |
|
201 | + else { |
|
199 | 202 | $db = $row['db']; |
200 | 203 | } |
201 | 204 | |
@@ -221,7 +224,8 @@ discard block |
||
221 | 224 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
222 | 225 | if (isset($row['db']) && $row['db'] != '') { |
223 | 226 | $db = $row['db']; |
224 | - } else { |
|
227 | + } |
|
228 | + else { |
|
225 | 229 | /* |
226 | 230 | * Insert new to Indexing |
227 | 231 | */ |
@@ -292,7 +296,8 @@ discard block |
||
292 | 296 | ); |
293 | 297 | |
294 | 298 | return true; |
295 | - } catch (PDOException $e) { |
|
299 | + } |
|
300 | + catch (PDOException $e) { |
|
296 | 301 | return false; |
297 | 302 | } |
298 | 303 | } |
@@ -314,7 +319,8 @@ discard block |
||
314 | 319 | ':exp' => time(), |
315 | 320 | ] |
316 | 321 | ); |
317 | - } catch (PDOException $e) { |
|
322 | + } |
|
323 | + catch (PDOException $e) { |
|
318 | 324 | return false; |
319 | 325 | } |
320 | 326 | } |
@@ -59,8 +59,7 @@ discard block |
||
59 | 59 | * @throws PhpfastcacheDriverCheckException |
60 | 60 | * @throws PhpfastcacheIOException |
61 | 61 | */ |
62 | - public function __construct(ConfigurationOption $config, string $instanceId, EventManagerInterface $em) |
|
63 | - { |
|
62 | + public function __construct(ConfigurationOption $config, string $instanceId, EventManagerInterface $em) { |
|
64 | 63 | self::checkCollision('Memcache'); |
65 | 64 | $this->__parentConstruct($config, $instanceId, $em); |
66 | 65 | } |
@@ -107,14 +106,16 @@ discard block |
||
107 | 106 | */ |
108 | 107 | if (!empty($server['path'])) { |
109 | 108 | $this->instance->addServer($server['path'], 0); |
110 | - } elseif (!empty($server['host'])) { |
|
109 | + } |
|
110 | + elseif (!empty($server['host'])) { |
|
111 | 111 | $this->instance->addServer($server['host'], $server['port']); |
112 | 112 | } |
113 | 113 | |
114 | 114 | if (!empty($server['saslUser']) && !empty($server['saslPassword'])) { |
115 | 115 | throw new PhpfastcacheDriverException('Unlike Memcached, Memcache does not support SASL authentication'); |
116 | 116 | } |
117 | - } catch (Exception $e) { |
|
117 | + } |
|
118 | + catch (Exception $e) { |
|
118 | 119 | throw new PhpfastcacheDriverConnectException( |
119 | 120 | sprintf( |
120 | 121 | 'Failed to connect to memcache host/path "%s" with the following error: %s', |
@@ -96,7 +96,8 @@ discard block |
||
96 | 96 | * CouchbaseBucket::get() returns a GetResult interface |
97 | 97 | */ |
98 | 98 | return $this->decodeDocument((array)$this->getCollection()->get($item->getEncodedKey())->content()); |
99 | - } catch (DocumentNotFoundException) { |
|
99 | + } |
|
100 | + catch (DocumentNotFoundException) { |
|
100 | 101 | return null; |
101 | 102 | } |
102 | 103 | } |
@@ -122,7 +123,8 @@ discard block |
||
122 | 123 | } |
123 | 124 | |
124 | 125 | return $results; |
125 | - } catch (DocumentNotFoundException) { |
|
126 | + } |
|
127 | + catch (DocumentNotFoundException) { |
|
126 | 128 | return []; |
127 | 129 | } |
128 | 130 | } |
@@ -143,7 +145,8 @@ discard block |
||
143 | 145 | (new UpsertOptions())->expiry($item->getTtl()) |
144 | 146 | ); |
145 | 147 | return true; |
146 | - } catch (CouchbaseException) { |
|
148 | + } |
|
149 | + catch (CouchbaseException) { |
|
147 | 150 | return false; |
148 | 151 | } |
149 | 152 | } |
@@ -158,9 +161,11 @@ discard block |
||
158 | 161 | |
159 | 162 | try { |
160 | 163 | return $this->getCollection()->remove($encodedKey)->mutationToken() !== null; |
161 | - } catch (DocumentNotFoundException) { |
|
164 | + } |
|
165 | + catch (DocumentNotFoundException) { |
|
162 | 166 | return true; |
163 | - } catch (CouchbaseException) { |
|
167 | + } |
|
168 | + catch (CouchbaseException) { |
|
164 | 169 | return false; |
165 | 170 | } |
166 | 171 | } |
@@ -175,7 +180,8 @@ discard block |
||
175 | 180 | try { |
176 | 181 | $this->getCollection()->removeMulti(array_map(fn(string $key) => $this->getEncodedKey($key), $keys)); |
177 | 182 | return true; |
178 | - } catch (CouchbaseException) { |
|
183 | + } |
|
184 | + catch (CouchbaseException) { |
|
179 | 185 | return false; |
180 | 186 | } |
181 | 187 | } |