@@ -232,8 +232,7 @@ discard block |
||
232 | 232 | $this->unauthMessageCache = []; |
233 | 233 | } |
234 | 234 | $this->WriteForUser($loglevel, $message); |
235 | - } |
|
236 | - else { |
|
235 | + } else { |
|
237 | 236 | $this->unauthMessageCache[] = [$loglevel, $message]; |
238 | 237 | } |
239 | 238 | } |
@@ -270,8 +269,7 @@ discard block |
||
270 | 269 | protected function GetLogLevelString($loglevel, $pad = false) { |
271 | 270 | if ($pad) { |
272 | 271 | $s = " "; |
273 | - } |
|
274 | - else { |
|
272 | + } else { |
|
275 | 273 | $s = ""; |
276 | 274 | } |
277 | 275 |
@@ -236,7 +236,7 @@ |
||
236 | 236 | self::STREAMER_VAR => "unapprovedinromapplist", |
237 | 237 | self::STREAMER_PROP => self::STREAMER_TYPE_SEND_EMPTY, |
238 | 238 | self::STREAMER_ARRAY => SYNC_PROVISION_APPNAME, |
239 | - ], // TODO check |
|
239 | + ], // TODO check |
|
240 | 240 | SYNC_PROVISION_APPROVEDAPPLIST => [ |
241 | 241 | self::STREAMER_VAR => "approvedapplist", |
242 | 242 | self::STREAMER_PROP => self::STREAMER_TYPE_SEND_EMPTY, |
@@ -53,8 +53,7 @@ discard block |
||
53 | 53 | )) { |
54 | 54 | SLog::Write(LOGLEVEL_INFO, sprintf("%s->emptySupported(): no supported list available, emptying all not set parameters", get_class($this))); |
55 | 55 | $supportedFields = array_keys($this->mapping); |
56 | - } |
|
57 | - else { |
|
56 | + } else { |
|
58 | 57 | return false; |
59 | 58 | } |
60 | 59 | } |
@@ -118,14 +117,12 @@ discard block |
||
118 | 117 | |
119 | 118 | return false; |
120 | 119 | } |
121 | - } |
|
122 | - else { |
|
120 | + } else { |
|
123 | 121 | SLog::Write(LOGLEVEL_DEBUG, sprintf("SyncObject->equals() array '%s' is set in one but not the other object", $val)); |
124 | 122 | |
125 | 123 | return false; |
126 | 124 | } |
127 | - } |
|
128 | - else { |
|
125 | + } else { |
|
129 | 126 | if (isset($this->{$val}, $odo->{$val})) { |
130 | 127 | if ($strictTypeCompare) { |
131 | 128 | if ($this->{$val} !== $odo->{$val}) { |
@@ -133,19 +130,16 @@ discard block |
||
133 | 130 | |
134 | 131 | return false; |
135 | 132 | } |
136 | - } |
|
137 | - else { |
|
133 | + } else { |
|
138 | 134 | if ($this->{$val} != $odo->{$val}) { |
139 | 135 | SLog::Write(LOGLEVEL_DEBUG, sprintf("SyncObject->equals() false on field '%s': '%s' != '%s'", $val, Utils::PrintAsString($this->{$val}), Utils::PrintAsString($odo->{$val}))); |
140 | 136 | |
141 | 137 | return false; |
142 | 138 | } |
143 | 139 | } |
144 | - } |
|
145 | - elseif (!isset($this->{$val}) && !isset($odo->{$val})) { |
|
140 | + } elseif (!isset($this->{$val}) && !isset($odo->{$val})) { |
|
146 | 141 | continue; |
147 | - } |
|
148 | - else { |
|
142 | + } else { |
|
149 | 143 | SLog::Write(LOGLEVEL_DEBUG, sprintf("SyncObject->equals() false because field '%s' is only defined at one obj: '%s' != '%s'", $val, Utils::PrintAsString(isset($this->{$val})), Utils::PrintAsString(isset($odo->{$val})))); |
150 | 144 | |
151 | 145 | return false; |
@@ -176,8 +170,7 @@ discard block |
||
176 | 170 | |
177 | 171 | if (array_key_exists($k, $streamerVars)) { |
178 | 172 | $strV = "(S) "; |
179 | - } |
|
180 | - else { |
|
173 | + } else { |
|
181 | 174 | $strV = ""; |
182 | 175 | } |
183 | 176 | |
@@ -187,11 +180,9 @@ discard block |
||
187 | 180 | foreach ($v as $value) { |
188 | 181 | $str .= "\t\t" . Utils::PrintAsString($value) . "\n"; |
189 | 182 | } |
190 | - } |
|
191 | - elseif ($v instanceof SyncObject) { |
|
183 | + } elseif ($v instanceof SyncObject) { |
|
192 | 184 | $str .= "\t" . $strV . $k . " => " . str_replace("\n", "\n\t\t\t", $v->__toString()) . "\n"; |
193 | - } |
|
194 | - else { |
|
185 | + } else { |
|
195 | 186 | $str .= "\t" . $strV . $k . " => " . (isset($this->{$k}) ? Utils::PrintAsString($this->{$k}) : "null") . "\n"; |
196 | 187 | } |
197 | 188 | } |
@@ -275,8 +266,7 @@ discard block |
||
275 | 266 | if (!$this->{$v[self::STREAMER_VAR]}->Check($logAsDebug)) { |
276 | 267 | return false; |
277 | 268 | } |
278 | - } |
|
279 | - elseif (is_array($this->{$v[self::STREAMER_VAR]})) { |
|
269 | + } elseif (is_array($this->{$v[self::STREAMER_VAR]})) { |
|
280 | 270 | foreach ($this->{$v[self::STREAMER_VAR]} as $subobj) { |
281 | 271 | if ($subobj instanceof SyncObject && !$subobj->Check($logAsDebug)) { |
282 | 272 | return false; |
@@ -356,8 +346,7 @@ discard block |
||
356 | 346 | SLog::Write(LOGLEVEL_ERROR, sprintf("SyncObject->Check(): Can not compare parameter '%s' against the other value '%s' as it is not defined object from type %s. Please report this! Check skipped!", $objClass, $v[self::STREAMER_VAR], $condition)); |
357 | 347 | |
358 | 348 | continue; |
359 | - } |
|
360 | - else { |
|
349 | + } else { |
|
361 | 350 | $cmpPar = $this->mapping[$condition][self::STREAMER_VAR]; |
362 | 351 | if (isset($this->{$cmpPar})) { |
363 | 352 | $cmp = $this->{$cmpPar}; |
@@ -391,8 +380,7 @@ discard block |
||
391 | 380 | if (is_array($this->{$v[self::STREAMER_VAR]})) { |
392 | 381 | // implosion takes 2bytes, so we just assume ", " here |
393 | 382 | $chkstr = implode(", ", $this->{$v[self::STREAMER_VAR]}); |
394 | - } |
|
395 | - else { |
|
383 | + } else { |
|
396 | 384 | $chkstr = $this->{$v[self::STREAMER_VAR]}; |
397 | 385 | } |
398 | 386 | |
@@ -416,8 +404,7 @@ discard block |
||
416 | 404 | if (is_array($this->{$v[self::STREAMER_VAR]})) { |
417 | 405 | $mails = $this->{$v[self::STREAMER_VAR]}; |
418 | 406 | $as_array = true; |
419 | - } |
|
420 | - else { |
|
407 | + } else { |
|
421 | 408 | $mails = [$this->{$v[self::STREAMER_VAR]}]; |
422 | 409 | } |
423 | 410 | |
@@ -425,8 +412,7 @@ discard block |
||
425 | 412 | foreach ($mails as $mail) { |
426 | 413 | if (!Utils::CheckEmail($mail)) { |
427 | 414 | SLog::Write(LOGLEVEL_WARN, sprintf("SyncObject->Check(): object from type %s: parameter '%s' contains an invalid email address '%s'. Address is removed.", $objClass, $v[self::STREAMER_VAR], $mail)); |
428 | - } |
|
429 | - else { |
|
415 | + } else { |
|
430 | 416 | $output[] = $mail; |
431 | 417 | } |
432 | 418 | } |
@@ -443,8 +429,7 @@ discard block |
||
443 | 429 | // if we are allowed to rewrite the attribute, we do that |
444 | 430 | if ($as_array) { |
445 | 431 | $this->{$v[self::STREAMER_VAR]} = $output; |
446 | - } |
|
447 | - else { |
|
432 | + } else { |
|
448 | 433 | $this->{$v[self::STREAMER_VAR]} = $output[0]; |
449 | 434 | } |
450 | 435 | } |
@@ -76,8 +76,7 @@ discard block |
||
76 | 76 | $zarafaAdmin = listfolders_zarafa_admin_setup($mapi, $user, $pass, $sslcert_file, $sslcert_pass); |
77 | 77 | if (isset($zarafaAdmin['adminStore'], $options['l'])) { |
78 | 78 | listfolders_getlist($zarafaAdmin['adminStore'], $zarafaAdmin['session'], trim($options['l'])); |
79 | - } |
|
80 | - else { |
|
79 | + } else { |
|
81 | 80 | echo "Usage:\n" . |
82 | 81 | "listfolders.php [actions] [options]\n\n" . |
83 | 82 | "Actions: [-l username]\n" . |
@@ -145,8 +144,7 @@ discard block |
||
145 | 144 | } |
146 | 145 | } |
147 | 146 | } |
148 | - } |
|
149 | - else { |
|
147 | + } else { |
|
150 | 148 | $entryid = @mapi_msgstore_createentryid($adminStore, $user); |
151 | 149 | } |
152 | 150 | |
@@ -212,8 +210,7 @@ discard block |
||
212 | 210 | if (version_compare(phpversion("mapi"), $version) == -1) { |
213 | 211 | return false; |
214 | 212 | } |
215 | - } |
|
216 | - else { |
|
213 | + } else { |
|
217 | 214 | return false; |
218 | 215 | } |
219 | 216 |
@@ -110,20 +110,17 @@ discard block |
||
110 | 110 | if ($message->SupportsPrivateStripping()) { |
111 | 111 | SLog::Write(LOGLEVEL_DEBUG, "PHPWrapper->ImportMessageChange(): stripping data of private message from a shared folder"); |
112 | 112 | $message->StripData(Streamer::STRIP_PRIVATE_DATA); |
113 | - } |
|
114 | - else { |
|
113 | + } else { |
|
115 | 114 | SLog::Write(LOGLEVEL_DEBUG, "PHPWrapper->ImportMessageChange(): ignoring private message from a shared folder"); |
116 | 115 | |
117 | 116 | return SYNC_E_IGNORE; |
118 | 117 | } |
119 | 118 | } |
120 | - } |
|
121 | - catch (SyncObjectBrokenException $mbe) { |
|
119 | + } catch (SyncObjectBrokenException $mbe) { |
|
122 | 120 | $brokenSO = $mbe->GetSyncObject(); |
123 | 121 | if (!$brokenSO) { |
124 | 122 | SLog::Write(LOGLEVEL_ERROR, sprintf("PHPWrapper->ImportMessageChange(): Caught SyncObjectBrokenException but broken SyncObject available")); |
125 | - } |
|
126 | - else { |
|
123 | + } else { |
|
127 | 124 | if (!isset($brokenSO->id)) { |
128 | 125 | $brokenSO->id = "Unknown ID"; |
129 | 126 | SLog::Write(LOGLEVEL_ERROR, sprintf("PHPWrapper->ImportMessageChange(): Caught SyncObjectBrokenException but no ID of object set")); |
@@ -137,8 +134,7 @@ discard block |
||
137 | 134 | // substitute the MAPI SYNC_NEW_MESSAGE flag by a grommunio-sync proprietary flag |
138 | 135 | if ($flags == SYNC_NEW_MESSAGE) { |
139 | 136 | $message->flags = SYNC_NEWMESSAGE; |
140 | - } |
|
141 | - else { |
|
137 | + } else { |
|
142 | 138 | $message->flags = $flags; |
143 | 139 | } |
144 | 140 |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | ], |
143 | 143 | ], // EXISTS OR |
144 | 144 | ], |
145 | - ]; // global OR |
|
145 | + ]; // global OR |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | [ |
179 | 179 | RES_CONTENT, |
180 | 180 | [ |
181 | - FUZZYLEVEL => FL_SUBSTRING | FL_IGNORECASE, |
|
181 | + FUZZYLEVEL => FL_SUBSTRING|FL_IGNORECASE, |
|
182 | 182 | ULPROPTAG => PR_DISPLAY_NAME, |
183 | 183 | VALUE => $query, |
184 | 184 | ], |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | [ |
187 | 187 | RES_CONTENT, |
188 | 188 | [ |
189 | - FUZZYLEVEL => FL_SUBSTRING | FL_IGNORECASE, |
|
189 | + FUZZYLEVEL => FL_SUBSTRING|FL_IGNORECASE, |
|
190 | 190 | ULPROPTAG => PR_ACCOUNT, |
191 | 191 | VALUE => $query, |
192 | 192 | ], |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | [ |
195 | 195 | RES_CONTENT, |
196 | 196 | [ |
197 | - FUZZYLEVEL => FL_SUBSTRING | FL_IGNORECASE, |
|
197 | + FUZZYLEVEL => FL_SUBSTRING|FL_IGNORECASE, |
|
198 | 198 | ULPROPTAG => PR_SMTP_ADDRESS, |
199 | 199 | VALUE => $query, |
200 | 200 | ], |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | PR_SENT_REPRESENTING_ENTRYID => $props[PR_SENT_REPRESENTING_ENTRYID], |
679 | 679 | PR_SENT_REPRESENTING_SEARCH_KEY => $props[PR_SENT_REPRESENTING_SEARCH_KEY], |
680 | 680 | // mark the message as read if the main message has read flag |
681 | - PR_MESSAGE_FLAGS => $read ? $mprops[PR_MESSAGE_FLAGS] | MSGFLAG_READ : $mprops[PR_MESSAGE_FLAGS], |
|
681 | + PR_MESSAGE_FLAGS => $read ? $mprops[PR_MESSAGE_FLAGS]|MSGFLAG_READ : $mprops[PR_MESSAGE_FLAGS], |
|
682 | 682 | ]); |
683 | 683 | } |
684 | 684 | // TODO check if we need to do this for encrypted (and signed?) message as well |
@@ -749,13 +749,13 @@ discard block |
||
749 | 749 | $entryId = strtoupper($entryid); |
750 | 750 | |
751 | 751 | $res = [ |
752 | - 'abFlags' => '', // BYTE[4], 4 bytes, 8 hex characters |
|
753 | - 'guid' => '', // GUID, 16 bytes, 32 hex characters |
|
754 | - 'version' => '', // ULONG, 4 bytes, 8 hex characters |
|
755 | - 'type' => '', // ULONG, 4 bytes, 8 hex characters |
|
756 | - 'id' => '', // ULONG, 4 bytes, 8 hex characters |
|
757 | - 'server' => '', // CHAR, variable length |
|
758 | - 'padding' => '', // TCHAR[3], 4 bytes, 8 hex characters (upto 4 bytes) |
|
752 | + 'abFlags' => '', // BYTE[4], 4 bytes, 8 hex characters |
|
753 | + 'guid' => '', // GUID, 16 bytes, 32 hex characters |
|
754 | + 'version' => '', // ULONG, 4 bytes, 8 hex characters |
|
755 | + 'type' => '', // ULONG, 4 bytes, 8 hex characters |
|
756 | + 'id' => '', // ULONG, 4 bytes, 8 hex characters |
|
757 | + 'server' => '', // CHAR, variable length |
|
758 | + 'padding' => '', // TCHAR[3], 4 bytes, 8 hex characters (upto 4 bytes) |
|
759 | 759 | ]; |
760 | 760 | |
761 | 761 | $res['length'] = strlen($entryId); |
@@ -800,13 +800,13 @@ discard block |
||
800 | 800 | $entryId = strtoupper($entryid); |
801 | 801 | |
802 | 802 | $res = [ |
803 | - 'abFlags' => '', // BYTE[4], 4 bytes, 8 hex characters |
|
804 | - 'guid' => '', // GUID, 16 bytes, 32 hex characters |
|
805 | - 'version' => '', // ULONG, 4 bytes, 8 hex characters |
|
806 | - 'type' => '', // ULONG, 4 bytes, 8 hex characters |
|
807 | - 'uniqueId' => '', // ULONG, 16 bytes, 32 hex characters |
|
808 | - 'server' => '', // CHAR, variable length |
|
809 | - 'padding' => '', // TCHAR[3], 4 bytes, 8 hex characters (upto 4 bytes) |
|
803 | + 'abFlags' => '', // BYTE[4], 4 bytes, 8 hex characters |
|
804 | + 'guid' => '', // GUID, 16 bytes, 32 hex characters |
|
805 | + 'version' => '', // ULONG, 4 bytes, 8 hex characters |
|
806 | + 'type' => '', // ULONG, 4 bytes, 8 hex characters |
|
807 | + 'uniqueId' => '', // ULONG, 16 bytes, 32 hex characters |
|
808 | + 'server' => '', // CHAR, variable length |
|
809 | + 'padding' => '', // TCHAR[3], 4 bytes, 8 hex characters (upto 4 bytes) |
|
810 | 810 | ]; |
811 | 811 | |
812 | 812 | $res['length'] = strlen($entryId); |
@@ -717,8 +717,7 @@ discard block |
||
717 | 717 | if ($eid1['length'] < $eid1['min_length'] || $eid1['id'] != $eid2['id']) { |
718 | 718 | return false; |
719 | 719 | } |
720 | - } |
|
721 | - elseif ($eid1['length'] < $eid1['min_length'] || $eid1['uniqueId'] != $eid2['uniqueId']) { |
|
720 | + } elseif ($eid1['length'] < $eid1['min_length'] || $eid1['uniqueId'] != $eid2['uniqueId']) { |
|
722 | 721 | return false; |
723 | 722 | } |
724 | 723 | |
@@ -855,8 +854,7 @@ discard block |
||
855 | 854 | if (substr($entryId, $len - ($offset + 2), $len - $offset) == '00') { |
856 | 855 | $padding .= '00'; |
857 | 856 | $offset += 2; |
858 | - } |
|
859 | - else { |
|
857 | + } else { |
|
860 | 858 | // if non-null character found then break the loop |
861 | 859 | break; |
862 | 860 | } |
@@ -130,8 +130,7 @@ discard block |
||
130 | 130 | if ($this->impersonateUser !== false) { |
131 | 131 | SLog::Write(LOGLEVEL_DEBUG, sprintf("Grommunio->Logon(): Impersonation active - authenticating: '%s' - impersonating '%s'", $this->mainUser, $this->impersonateUser)); |
132 | 132 | $defaultUser = $this->impersonateUser; |
133 | - } |
|
134 | - else { |
|
133 | + } else { |
|
135 | 134 | $defaultUser = $this->mainUser; |
136 | 135 | } |
137 | 136 | |
@@ -145,8 +144,7 @@ discard block |
||
145 | 144 | $gsync_version = 'Grommunio-Sync_' . @constant('GROMMUNIOSYNC_VERSION'); |
146 | 145 | $user_agent = ($deviceId) ? GSync::GetDeviceManager()->GetUserAgent() : "unknown"; |
147 | 146 | $this->session = @mapi_logon_zarafa($this->mainUser, $pass, MAPI_SERVER, null, null, 0, $gsync_version, $user_agent); |
148 | - } |
|
149 | - else { |
|
147 | + } else { |
|
150 | 148 | $this->session = @mapi_logon_zarafa($this->mainUser, $pass, MAPI_SERVER, null, null, 0); |
151 | 149 | } |
152 | 150 | $this->notifications = true; |
@@ -163,8 +161,7 @@ discard block |
||
163 | 161 | throw new ServiceUnavailableException("Error connecting to KC (login)"); |
164 | 162 | } |
165 | 163 | } |
166 | - } |
|
167 | - catch (MAPIException $ex) { |
|
164 | + } catch (MAPIException $ex) { |
|
168 | 165 | throw new AuthenticationRequiredException($ex->getDisplayMessage()); |
169 | 166 | } |
170 | 167 | |
@@ -266,8 +263,7 @@ discard block |
||
266 | 263 | $storeProps = mapi_getprops($userstore, [PR_IPM_SUBTREE_ENTRYID]); |
267 | 264 | $rights = $this->HasSecretaryACLs($userstore, '', $storeProps[PR_IPM_SUBTREE_ENTRYID]); |
268 | 265 | SLog::Write(LOGLEVEL_DEBUG, sprintf("Grommunio->Setup(): Checking for secretary ACLs on root folder of impersonated store '%s': '%s'", $user, Utils::PrintAsString($rights))); |
269 | - } |
|
270 | - else { |
|
266 | + } else { |
|
271 | 267 | $zarafauserinfo = @nsp_getuserinfo($this->mainUser); |
272 | 268 | $rights = (isset($zarafauserinfo['admin']) && $zarafauserinfo['admin']) ? true : false; |
273 | 269 | SLog::Write(LOGLEVEL_DEBUG, sprintf("Grommunio->Setup(): Checking for admin ACLs on store '%s': '%s'", $user, Utils::PrintAsString($rights))); |
@@ -330,8 +326,7 @@ discard block |
||
330 | 326 | // for SYSTEM user open the public folders |
331 | 327 | if (strtoupper($this->storeName) == "SYSTEM") { |
332 | 328 | $rootfolder = mapi_msgstore_openentry($this->store, $storeProps[PR_IPM_PUBLIC_FOLDERS_ENTRYID]); |
333 | - } |
|
334 | - else { |
|
329 | + } else { |
|
335 | 330 | $rootfolder = mapi_msgstore_openentry($this->store); |
336 | 331 | } |
337 | 332 | |
@@ -354,8 +349,7 @@ discard block |
||
354 | 349 | $folder = $mapiprovider->GetFolder($row); |
355 | 350 | if ($folder) { |
356 | 351 | $folders[] = $folder; |
357 | - } |
|
358 | - else { |
|
352 | + } else { |
|
359 | 353 | SLog::Write(LOGLEVEL_DEBUG, sprintf("Grommunio->GetHierarchy(): ignoring folder '%s' as MAPIProvider->GetFolder() did not return a SyncFolder object", (isset($row[PR_DISPLAY_NAME]) ? $row[PR_DISPLAY_NAME] : "unknown"))); |
360 | 354 | } |
361 | 355 | } |
@@ -547,8 +541,7 @@ discard block |
||
547 | 541 | PR_ICON_INDEX => 262, |
548 | 542 | PR_LAST_VERB_EXECUTED => 104, |
549 | 543 | ]; |
550 | - } |
|
551 | - elseif ($sm->replyflag) { |
|
544 | + } elseif ($sm->replyflag) { |
|
552 | 545 | $updateProps = [ |
553 | 546 | PR_ICON_INDEX => 261, |
554 | 547 | PR_LAST_VERB_EXECUTED => 102, |
@@ -608,8 +601,7 @@ discard block |
||
608 | 601 | $mapiprops[$sendMailProps["html"]] = $bodyHtml . "<br><br>" . $fwbodyHtml; |
609 | 602 | } |
610 | 603 | } |
611 | - } |
|
612 | - else { |
|
604 | + } else { |
|
613 | 605 | // no fwmessage could be opened and we need it because we do not replace mime |
614 | 606 | if (!isset($sm->replacemime) || $sm->replacemime == false) { |
615 | 607 | throw new StatusException(sprintf("Grommunio->SendMail(): Could not open message id '%s' in folder id '%s' to be replied/forwarded: 0x%X", $sm->source->itemid, $sm->source->folderid, mapi_last_hresult()), SYNC_COMMONSTATUS_ITEMNOTFOUND); |
@@ -657,8 +649,7 @@ discard block |
||
657 | 649 | if (!$folderid) { |
658 | 650 | $entryid = hex2bin($id); |
659 | 651 | $sk = $id; |
660 | - } |
|
661 | - else { |
|
652 | + } else { |
|
662 | 653 | // id might be in the new longid format, so we have to split it here |
663 | 654 | list($fsk, $sk) = Utils::SplitMessageId($id); |
664 | 655 | // get the entry id of the message |
@@ -751,8 +742,7 @@ discard block |
||
751 | 742 | $stream = mapi_inetmapi_imtoinet($this->session, $addrbook, $embMessage, ['use_tnef' => -1]); |
752 | 743 | // set the default contenttype for this kind of messages |
753 | 744 | $attachment->contenttype = "message/rfc822"; |
754 | - } |
|
755 | - else { |
|
745 | + } else { |
|
756 | 746 | $stream = mapi_openproperty($attach, PR_ATTACH_DATA_BIN, IID_IStream, 0, 0); |
757 | 747 | } |
758 | 748 | |
@@ -764,8 +754,7 @@ discard block |
||
764 | 754 | $attachment->data = MAPIStreamWrapper::Open($stream); |
765 | 755 | if (isset($attprops[PR_ATTACH_MIME_TAG])) { |
766 | 756 | $attachment->contenttype = $attprops[PR_ATTACH_MIME_TAG]; |
767 | - } |
|
768 | - elseif (isset($attprops[PR_ATTACH_MIME_TAG_W])) { |
|
757 | + } elseif (isset($attprops[PR_ATTACH_MIME_TAG_W])) { |
|
769 | 758 | $attachment->contenttype = $attprops[PR_ATTACH_MIME_TAG_W]; |
770 | 759 | } |
771 | 760 | // TODO default contenttype |
@@ -1164,8 +1153,7 @@ discard block |
||
1164 | 1153 | } |
1165 | 1154 | ++$response->recipientcount; |
1166 | 1155 | $response->recipient[] = $entry; |
1167 | - } |
|
1168 | - elseif (is_int($recipient)) { |
|
1156 | + } elseif (is_int($recipient)) { |
|
1169 | 1157 | $response->status = $recipient; |
1170 | 1158 | } |
1171 | 1159 | } |
@@ -1660,8 +1648,7 @@ discard block |
||
1660 | 1648 | if (isset($stateMessageProps[PR_LAST_MODIFICATION_TIME])) { |
1661 | 1649 | return $stateMessageProps[PR_LAST_MODIFICATION_TIME]; |
1662 | 1650 | } |
1663 | - } |
|
1664 | - catch (StateNotFoundException $e) { |
|
1651 | + } catch (StateNotFoundException $e) { |
|
1665 | 1652 | } |
1666 | 1653 | |
1667 | 1654 | return "0"; |
@@ -1859,8 +1846,7 @@ discard block |
||
1859 | 1846 | if ($devid) { |
1860 | 1847 | $this->setDeviceUserData($this->userDeviceData, bin2hex($hierarchyRows[0][PR_ENTRYID]), $devid, $this->mainUser, "statefolder"); |
1861 | 1848 | } |
1862 | - } |
|
1863 | - elseif ($rowCnt == 0) { |
|
1849 | + } elseif ($rowCnt == 0) { |
|
1864 | 1850 | // legacy code: create the hidden state folder and the device subfolder |
1865 | 1851 | // this should happen when the user configures the device (autodiscover or first sync if no autodiscover) |
1866 | 1852 | |
@@ -1872,8 +1858,7 @@ discard block |
||
1872 | 1858 | if ($rowCnt == 1) { |
1873 | 1859 | $hierarchyRows = mapi_table_queryrows($hierarchy, [PR_ENTRYID], 0, 1); |
1874 | 1860 | $stateFolder = mapi_msgstore_openentry($this->store, $hierarchyRows[0][PR_ENTRYID]); |
1875 | - } |
|
1876 | - elseif ($rowCnt == 0) { |
|
1861 | + } elseif ($rowCnt == 0) { |
|
1877 | 1862 | $stateFolder = mapi_folder_createfolder($rootfolder, STORE_STATE_FOLDER, ""); |
1878 | 1863 | mapi_setprops($stateFolder, [PR_ATTR_HIDDEN => true]); |
1879 | 1864 | } |
@@ -1966,8 +1951,7 @@ discard block |
||
1966 | 1951 | |
1967 | 1952 | try { |
1968 | 1953 | $stateMessage = $this->getStateMessage($devid, $type, $key, $counter); |
1969 | - } |
|
1970 | - catch (StateNotFoundException $e) { |
|
1954 | + } catch (StateNotFoundException $e) { |
|
1971 | 1955 | // if message is not available, try to create a new one |
1972 | 1956 | $stateMessage = mapi_folder_createmessage($this->stateFolder, MAPI_ASSOCIATED); |
1973 | 1957 | SLog::Write(LOGLEVEL_DEBUG, sprintf("Grommunio->setStateMessage(): mapi_folder_createmessage 0x%08X", mapi_last_hresult())); |
@@ -2136,8 +2120,7 @@ discard block |
||
2136 | 2120 | } |
2137 | 2121 | } |
2138 | 2122 | } |
2139 | - } |
|
2140 | - else { |
|
2123 | + } else { |
|
2141 | 2124 | $entryid = @mapi_msgstore_createentryid($this->defaultstore, $user); |
2142 | 2125 | } |
2143 | 2126 | |
@@ -2215,8 +2198,7 @@ discard block |
||
2215 | 2198 | // if oof state is set it must be set of oof and get otherwise |
2216 | 2199 | if (isset($oof->oofstate)) { |
2217 | 2200 | $this->settingsOofSet($oof); |
2218 | - } |
|
2219 | - else { |
|
2201 | + } else { |
|
2220 | 2202 | $this->settingsOofGet($oof); |
2221 | 2203 | } |
2222 | 2204 | } |
@@ -2251,13 +2233,11 @@ discard block |
||
2251 | 2233 | @mapi_setprops($this->defaultstore, [PR_EC_OUTOFOFFICE => false]); |
2252 | 2234 | @mapi_deleteprops($this->defaultstore, [PR_EC_OUTOFOFFICE_FROM, PR_EC_OUTOFOFFICE_UNTIL]); |
2253 | 2235 | SLog::Write(LOGLEVEL_INFO, "Grommunio->settingsOofGet(): Out of office is set but the from and until are in the past. Disabling out of office."); |
2254 | - } |
|
2255 | - elseif ($oofprops[PR_EC_OUTOFOFFICE_FROM] < $oofprops[PR_EC_OUTOFOFFICE_UNTIL]) { |
|
2236 | + } elseif ($oofprops[PR_EC_OUTOFOFFICE_FROM] < $oofprops[PR_EC_OUTOFOFFICE_UNTIL]) { |
|
2256 | 2237 | $oof->oofstate = SYNC_SETTINGSOOF_TIMEBASED; |
2257 | 2238 | $oof->starttime = $oofprops[PR_EC_OUTOFOFFICE_FROM]; |
2258 | 2239 | $oof->endtime = $oofprops[PR_EC_OUTOFOFFICE_UNTIL]; |
2259 | - } |
|
2260 | - else { |
|
2240 | + } else { |
|
2261 | 2241 | SLog::Write(LOGLEVEL_WARN, sprintf( |
2262 | 2242 | "Grommunio->settingsOofGet(): Time based out of office set but end time ('%s') is before startime ('%s').", |
2263 | 2243 | date("Y-m-d H:i:s", $oofprops[PR_EC_OUTOFOFFICE_FROM]), |
@@ -2265,8 +2245,7 @@ discard block |
||
2265 | 2245 | )); |
2266 | 2246 | $oof->Status = SYNC_SETTINGSSTATUS_PROTOCOLLERROR; |
2267 | 2247 | } |
2268 | - } |
|
2269 | - elseif ($oof->oofstate == SYNC_SETTINGSOOF_GLOBAL && (isset($oofprops[PR_EC_OUTOFOFFICE_FROM]) || isset($oofprops[PR_EC_OUTOFOFFICE_UNTIL]))) { |
|
2248 | + } elseif ($oof->oofstate == SYNC_SETTINGSOOF_GLOBAL && (isset($oofprops[PR_EC_OUTOFOFFICE_FROM]) || isset($oofprops[PR_EC_OUTOFOFFICE_UNTIL]))) { |
|
2270 | 2249 | SLog::Write(LOGLEVEL_WARN, sprintf( |
2271 | 2250 | "Grommunio->settingsOofGet(): Time based out of office set but either start time ('%s') or end time ('%s') is missing.", |
2272 | 2251 | (isset($oofprops[PR_EC_OUTOFOFFICE_FROM]) ? date("Y-m-d H:i:s", $oofprops[PR_EC_OUTOFOFFICE_FROM]) : 'empty'), |
@@ -2274,8 +2253,7 @@ discard block |
||
2274 | 2253 | )); |
2275 | 2254 | $oof->Status = SYNC_SETTINGSSTATUS_PROTOCOLLERROR; |
2276 | 2255 | } |
2277 | - } |
|
2278 | - else { |
|
2256 | + } else { |
|
2279 | 2257 | SLog::Write(LOGLEVEL_WARN, "Grommunio->Unable to get out of office information"); |
2280 | 2258 | } |
2281 | 2259 | |
@@ -2303,16 +2281,13 @@ discard block |
||
2303 | 2281 | if (isset($oof->starttime, $oof->endtime)) { |
2304 | 2282 | $props[PR_EC_OUTOFOFFICE_FROM] = $oof->starttime; |
2305 | 2283 | $props[PR_EC_OUTOFOFFICE_UNTIL] = $oof->endtime; |
2306 | - } |
|
2307 | - elseif (isset($oof->starttime) || isset($oof->endtime)) { |
|
2284 | + } elseif (isset($oof->starttime) || isset($oof->endtime)) { |
|
2308 | 2285 | $oof->Status = SYNC_SETTINGSSTATUS_PROTOCOLLERROR; |
2309 | 2286 | } |
2310 | - } |
|
2311 | - else { |
|
2287 | + } else { |
|
2312 | 2288 | $deleteProps = [PR_EC_OUTOFOFFICE_FROM, PR_EC_OUTOFOFFICE_UNTIL]; |
2313 | 2289 | } |
2314 | - } |
|
2315 | - elseif ($oof->oofstate == SYNC_SETTINGSOOF_DISABLED) { |
|
2290 | + } elseif ($oof->oofstate == SYNC_SETTINGSOOF_DISABLED) { |
|
2316 | 2291 | $props[PR_EC_OUTOFOFFICE] = false; |
2317 | 2292 | $deleteProps = [PR_EC_OUTOFOFFICE_FROM, PR_EC_OUTOFOFFICE_UNTIL]; |
2318 | 2293 | } |
@@ -2355,8 +2330,7 @@ discard block |
||
2355 | 2330 | $emailaddresses->primarysmtpaddress = $user["primary_email"]; |
2356 | 2331 | $account->emailaddresses = $emailaddresses; |
2357 | 2332 | $userinformation->accounts[] = $account; |
2358 | - } |
|
2359 | - else { |
|
2333 | + } else { |
|
2360 | 2334 | $userinformation->emailaddresses[] = $user["primary_email"]; |
2361 | 2335 | } |
2362 | 2336 | |
@@ -2634,13 +2608,11 @@ discard block |
||
2634 | 2608 | // some devices request 0 ambiguous recipients |
2635 | 2609 | if ($querycnt == 1 && $maxAmbiguousRecipients == 0) { |
2636 | 2610 | $rowsToQuery = 1; |
2637 | - } |
|
2638 | - elseif ($querycnt > 1 && $maxAmbiguousRecipients == 0) { |
|
2611 | + } elseif ($querycnt > 1 && $maxAmbiguousRecipients == 0) { |
|
2639 | 2612 | SLog::Write(LOGLEVEL_INFO, sprintf("Grommunio->resolveRecipientGAL(): GAL search found %d recipients but the device hasn't requested ambiguous recipients", $querycnt)); |
2640 | 2613 | |
2641 | 2614 | return $recipientGal; |
2642 | - } |
|
2643 | - elseif ($querycnt > 1 && $maxAmbiguousRecipients == 1) { |
|
2615 | + } elseif ($querycnt > 1 && $maxAmbiguousRecipients == 1) { |
|
2644 | 2616 | $rowsToQuery = $querycnt; |
2645 | 2617 | } |
2646 | 2618 | // get the certificate every time because caching the certificate is less expensive than opening addressbook entry again |
@@ -2662,13 +2634,11 @@ discard block |
||
2662 | 2634 | SLog::Write(LOGLEVEL_WBXML, sprintf("Grommunio->resolveRecipientGAL(): distlist's '%s' member: '%s'", $to, $distListMembers[$j][PR_DISPLAY_NAME])); |
2663 | 2635 | $recipientGal[] = $this->createResolveRecipient(SYNC_RESOLVERECIPIENTS_TYPE_GAL, $to, $distListMembers[$j], $nrDistListMembers); |
2664 | 2636 | } |
2665 | - } |
|
2666 | - else { |
|
2637 | + } else { |
|
2667 | 2638 | SLog::Write(LOGLEVEL_DEBUG, sprintf("Grommunio->resolveRecipientGAL(): '%s' is a dist list, but return it as is.", $to)); |
2668 | 2639 | $recipientGal[] = $this->createResolveRecipient(SYNC_RESOLVERECIPIENTS_TYPE_GAL, $abentries[$i][PR_SMTP_ADDRESS], $abentries[$i]); |
2669 | 2640 | } |
2670 | - } |
|
2671 | - elseif ($abentries[$i][PR_OBJECT_TYPE] == MAPI_MAILUSER) { |
|
2641 | + } elseif ($abentries[$i][PR_OBJECT_TYPE] == MAPI_MAILUSER) { |
|
2672 | 2642 | $recipientGal[] = $this->createResolveRecipient(SYNC_RESOLVERECIPIENTS_TYPE_GAL, $abentries[$i][PR_SMTP_ADDRESS], $abentries[$i]); |
2673 | 2643 | } |
2674 | 2644 | } |
@@ -2755,8 +2725,7 @@ discard block |
||
2755 | 2725 | break; |
2756 | 2726 | } |
2757 | 2727 | } |
2758 | - } |
|
2759 | - else { |
|
2728 | + } else { |
|
2760 | 2729 | SLog::Write(LOGLEVEL_WARN, sprintf("Grommunio->resolveRecipientContact(): Unable to open public store: 0x%X", $result)); |
2761 | 2730 | } |
2762 | 2731 | |
@@ -2815,18 +2784,15 @@ discard block |
||
2815 | 2784 | |
2816 | 2785 | if ($type == SYNC_RESOLVERECIPIENTS_TYPE_GAL) { |
2817 | 2786 | $certificateProp = PR_EMS_AB_TAGGED_X509_CERT; |
2818 | - } |
|
2819 | - elseif ($type == SYNC_RESOLVERECIPIENTS_TYPE_CONTACT) { |
|
2787 | + } elseif ($type == SYNC_RESOLVERECIPIENTS_TYPE_CONTACT) { |
|
2820 | 2788 | $certificateProp = PR_USER_X509_CERTIFICATE; |
2821 | - } |
|
2822 | - else { |
|
2789 | + } else { |
|
2823 | 2790 | $certificateProp = null; |
2824 | 2791 | } |
2825 | 2792 | |
2826 | 2793 | if (isset($recipientProperties[$certificateProp]) && is_array($recipientProperties[$certificateProp]) && !empty($recipientProperties[$certificateProp])) { |
2827 | 2794 | $certificates = $this->getCertificates($recipientProperties[$certificateProp], $recipientCount); |
2828 | - } |
|
2829 | - else { |
|
2795 | + } else { |
|
2830 | 2796 | $certificates = $this->getCertificates(false); |
2831 | 2797 | SLog::Write(LOGLEVEL_INFO, sprintf("Grommunio->createResolveRecipient(): No certificate found for '%s' (requested email address: '%s')", $recipientProperties[PR_DISPLAY_NAME], $email)); |
2832 | 2798 | } |
@@ -1372,8 +1372,7 @@ discard block |
||
1372 | 1372 | |
1373 | 1373 | // if the search range is set limit the result to it, otherwise return all found messages |
1374 | 1374 | $rows = (is_array($searchRange) && isset($searchRange[0], $searchRange[1])) ? |
1375 | - mapi_table_queryrows($table, [PR_ENTRYID], $searchRange[0], $searchRange[1] - $searchRange[0] + 1) : |
|
1376 | - mapi_table_queryrows($table, [PR_ENTRYID], 0, SEARCH_MAXRESULTS); |
|
1375 | + mapi_table_queryrows($table, [PR_ENTRYID], $searchRange[0], $searchRange[1] - $searchRange[0] + 1) : mapi_table_queryrows($table, [PR_ENTRYID], 0, SEARCH_MAXRESULTS); |
|
1377 | 1376 | |
1378 | 1377 | $cnt = count($rows); |
1379 | 1378 | $items['searchtotal'] = $cnt; |
@@ -1977,12 +1976,12 @@ discard block |
||
1977 | 1976 | mapi_setprops($stateMessage, [PR_DISPLAY_NAME => $messageName, PR_MESSAGE_CLASS => 'IPM.Note.GrommunioState']); |
1978 | 1977 | } |
1979 | 1978 | if (isset($stateMessage)) { |
1980 | - $jsonEncodedState = is_object($state) || is_array($state) ? json_encode($state, JSON_INVALID_UTF8_IGNORE | JSON_UNESCAPED_UNICODE) : $state; |
|
1979 | + $jsonEncodedState = is_object($state) || is_array($state) ? json_encode($state, JSON_INVALID_UTF8_IGNORE|JSON_UNESCAPED_UNICODE) : $state; |
|
1981 | 1980 | |
1982 | 1981 | $encodedState = base64_encode($jsonEncodedState); |
1983 | 1982 | $encodedStateLength = strlen($encodedState); |
1984 | 1983 | mapi_setprops($stateMessage, [PR_LAST_VERB_EXECUTED => is_int($counter) ? $counter : 0]); |
1985 | - $stream = mapi_openproperty($stateMessage, PR_BODY, IID_IStream, STGM_DIRECT, MAPI_CREATE | MAPI_MODIFY); |
|
1984 | + $stream = mapi_openproperty($stateMessage, PR_BODY, IID_IStream, STGM_DIRECT, MAPI_CREATE|MAPI_MODIFY); |
|
1986 | 1985 | mapi_stream_setsize($stream, $encodedStateLength); |
1987 | 1986 | mapi_stream_write($stream, $encodedState); |
1988 | 1987 | mapi_stream_commit($stream); |
@@ -2077,7 +2076,7 @@ discard block |
||
2077 | 2076 | private function adviseStoreToSink($store) { |
2078 | 2077 | // check if we already advised the store |
2079 | 2078 | if (!in_array($store, $this->changesSinkStores)) { |
2080 | - mapi_msgstore_advise($store, null, fnevObjectModified | fnevObjectCreated | fnevObjectMoved | fnevObjectDeleted, $this->changesSink); |
|
2079 | + mapi_msgstore_advise($store, null, fnevObjectModified|fnevObjectCreated|fnevObjectMoved|fnevObjectDeleted, $this->changesSink); |
|
2081 | 2080 | |
2082 | 2081 | if (mapi_last_hresult()) { |
2083 | 2082 | SLog::Write(LOGLEVEL_WARN, sprintf("Grommunio->adviseStoreToSink(): failed to advised store '%s' with code 0x%X. Polling will be performed.", $store, mapi_last_hresult())); |
@@ -2551,7 +2550,7 @@ discard block |
||
2551 | 2550 | $resOr, |
2552 | 2551 | [RES_CONTENT, |
2553 | 2552 | [ |
2554 | - FUZZYLEVEL => FL_SUBSTRING | FL_IGNORECASE, |
|
2553 | + FUZZYLEVEL => FL_SUBSTRING|FL_IGNORECASE, |
|
2555 | 2554 | ULPROPTAG => $property, |
2556 | 2555 | VALUE => u2w($term), |
2557 | 2556 | ], |
@@ -47,8 +47,7 @@ discard block |
||
47 | 47 | if ($this->mapistream) { |
48 | 48 | $stat = mapi_stream_stat($this->mapistream); |
49 | 49 | $this->streamlength = $stat["cb"]; |
50 | - } |
|
51 | - else { |
|
50 | + } else { |
|
52 | 51 | $this->streamlength = 0; |
53 | 52 | } |
54 | 53 | |
@@ -73,8 +72,7 @@ discard block |
||
73 | 72 | } |
74 | 73 | if ($this->mapistream) { |
75 | 74 | $data = mapi_stream_read($this->mapistream, $len); |
76 | - } |
|
77 | - else { |
|
75 | + } else { |
|
78 | 76 | $data = ""; |
79 | 77 | } |
80 | 78 | $this->position += strlen($data); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | // change exporterflags if we are doing a ContentExport |
108 | 108 | if ($this->folderid) { |
109 | - $this->exporterflags |= SYNC_NORMAL | SYNC_READ_STATE; |
|
109 | + $this->exporterflags |= SYNC_NORMAL|SYNC_READ_STATE; |
|
110 | 110 | |
111 | 111 | // Initial sync, we don't want deleted items. If the initial sync is chunked |
112 | 112 | // we check the change ID of the syncstate (0 at initial sync) |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | if (!($this->flags & BACKEND_DISCARD_DATA)) { |
116 | 116 | SLog::Write(LOGLEVEL_DEBUG, "ExportChangesICS->Config(): syncing initial data"); |
117 | 117 | } |
118 | - $this->exporterflags |= SYNC_NO_SOFT_DELETIONS | SYNC_NO_DELETIONS; |
|
118 | + $this->exporterflags |= SYNC_NO_SOFT_DELETIONS|SYNC_NO_DELETIONS; |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 |
@@ -45,13 +45,11 @@ discard block |
||
45 | 45 | try { |
46 | 46 | if ($folderid) { |
47 | 47 | $entryid = mapi_msgstore_entryidfromsourcekey($store, $folderid); |
48 | - } |
|
49 | - else { |
|
48 | + } else { |
|
50 | 49 | $storeprops = mapi_getprops($this->store, [PR_IPM_SUBTREE_ENTRYID, PR_IPM_PUBLIC_FOLDERS_ENTRYID]); |
51 | 50 | if (GSync::GetBackend()->GetImpersonatedUser() == 'system') { |
52 | 51 | $entryid = $storeprops[PR_IPM_PUBLIC_FOLDERS_ENTRYID]; |
53 | - } |
|
54 | - else { |
|
52 | + } else { |
|
55 | 53 | $entryid = $storeprops[PR_IPM_SUBTREE_ENTRYID]; |
56 | 54 | } |
57 | 55 | } |
@@ -68,16 +66,13 @@ discard block |
||
68 | 66 | if ($folder) { |
69 | 67 | if ($folderid) { |
70 | 68 | $this->exporter = mapi_openproperty($folder, PR_CONTENTS_SYNCHRONIZER, IID_IExchangeExportChanges, 0, 0); |
71 | - } |
|
72 | - else { |
|
69 | + } else { |
|
73 | 70 | $this->exporter = mapi_openproperty($folder, PR_HIERARCHY_SYNCHRONIZER, IID_IExchangeExportChanges, 0, 0); |
74 | 71 | } |
75 | - } |
|
76 | - else { |
|
72 | + } else { |
|
77 | 73 | $this->exporter = false; |
78 | 74 | } |
79 | - } |
|
80 | - catch (MAPIException $me) { |
|
75 | + } catch (MAPIException $me) { |
|
81 | 76 | $this->exporter = false; |
82 | 77 | // We return the general error SYNC_FSSTATUS_CODEUNKNOWN (12) which is also SYNC_STATUS_FOLDERHIERARCHYCHANGED (12) |
83 | 78 | // if this happened while doing content sync, the mobile will try to resync the folderhierarchy |
@@ -201,8 +196,7 @@ discard block |
||
201 | 196 | // ICS c++ wrapper |
202 | 197 | $mapiimporter = mapi_wrap_importcontentschanges($phpwrapper); |
203 | 198 | $includeprops = false; |
204 | - } |
|
205 | - else { |
|
199 | + } else { |
|
206 | 200 | $mapiimporter = mapi_wrap_importhierarchychanges($phpwrapper); |
207 | 201 | $includeprops = [PR_SOURCE_KEY, PR_DISPLAY_NAME]; |
208 | 202 | } |
@@ -261,8 +255,7 @@ discard block |
||
261 | 255 | $data = mapi_stream_read($this->statestream, 4096); |
262 | 256 | if (strlen($data)) { |
263 | 257 | $state .= $data; |
264 | - } |
|
265 | - else { |
|
258 | + } else { |
|
266 | 259 | break; |
267 | 260 | } |
268 | 261 | } |