Passed
Branch master (f497d2)
by Mike
03:18
created
lib/grommunio/listfolders.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -76,8 +76,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
lib/grommunio/mapiphpwrapper.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -110,20 +110,17 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
lib/grommunio/mapiutils.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -717,8 +717,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 			}
Please login to merge, or discard this patch.
lib/grommunio/grommunio.php 1 patch
Braces   +34 added lines, -68 removed lines patch added patch discarded remove patch
@@ -130,8 +130,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
lib/grommunio/mapistreamwrapper.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,8 +47,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
lib/grommunio/exporter.php 1 patch
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -45,13 +45,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
lib/grommunio/mapiprovider.php 1 patch
Braces   +64 added lines, -128 removed lines patch added patch discarded remove patch
@@ -46,8 +46,7 @@  discard block
 block discarded – undo
46 46
 		$props = mapi_getprops($mapimessage, [PR_MESSAGE_CLASS]);
47 47
 		if (isset($props[PR_MESSAGE_CLASS])) {
48 48
 			$messageclass = $props[PR_MESSAGE_CLASS];
49
-		}
50
-		else {
49
+		} else {
51 50
 			$messageclass = "IPM";
52 51
 		}
53 52
 
@@ -177,16 +176,14 @@  discard block
 block discarded – undo
177 176
 		if (isset($messageprops[$appointmentprops["reminderset"]]) && $messageprops[$appointmentprops["reminderset"]] == true) {
178 177
 			if ($messageprops[$appointmentprops["remindertime"]] == 0x5AE980E1) {
179 178
 				$message->reminder = 15;
180
-			}
181
-			else {
179
+			} else {
182 180
 				$message->reminder = $messageprops[$appointmentprops["remindertime"]];
183 181
 			}
184 182
 		}
185 183
 
186 184
 		if (!isset($message->uid)) {
187 185
 			$message->uid = bin2hex($messageprops[$appointmentprops["sourcekey"]]);
188
-		}
189
-		else {
186
+		} else {
190 187
 			$message->uid = Utils::GetICalUidFromOLUid($message->uid);
191 188
 		}
192 189
 
@@ -205,14 +202,12 @@  discard block
 block discarded – undo
205 202
 		if (!empty($messageprops[$appointmentprops["timezonetag"]])) {
206 203
 			$tz = $this->getTZFromMAPIBlob($messageprops[$appointmentprops["timezonetag"]]);
207 204
 			$appTz = true;
208
-		}
209
-		elseif (!empty($messageprops[$appointmentprops["timezonedesc"]])) {
205
+		} elseif (!empty($messageprops[$appointmentprops["timezonedesc"]])) {
210 206
 			// Windows uses UTC in timezone description in opposite to mstzones in TimezoneUtil which uses GMT
211 207
 			$wintz = str_replace("UTC", "GMT", $messageprops[$appointmentprops["timezonedesc"]]);
212 208
 			$tz = TimezoneUtil::GetFullTZFromTZName(TimezoneUtil::GetTZNameFromWinTZ($wintz));
213 209
 			$appTz = true;
214
-		}
215
-		else {
210
+		} else {
216 211
 			// set server default timezone (correct timezone should be configured!)
217 212
 			$tz = TimezoneUtil::GetFullTZ();
218 213
 		}
@@ -252,8 +247,7 @@  discard block
 block discarded – undo
252 247
 			// smtp address is always a proper email address
253 248
 			if (isset($row[PR_SMTP_ADDRESS])) {
254 249
 				$attendee->email = w2u($row[PR_SMTP_ADDRESS]);
255
-			}
256
-			elseif (isset($row[PR_ADDRTYPE], $row[PR_EMAIL_ADDRESS])) {
250
+			} elseif (isset($row[PR_ADDRTYPE], $row[PR_EMAIL_ADDRESS])) {
257 251
 				// if address type is SMTP, it's also a proper email address
258 252
 				if ($row[PR_ADDRTYPE] == "SMTP") {
259 253
 					$attendee->email = w2u($row[PR_EMAIL_ADDRESS]);
@@ -268,8 +262,7 @@  discard block
 block discarded – undo
268 262
 					// @see https://jira.z-hub.io/browse/ZP-1178
269 263
 					elseif (isset($row[PR_SEARCH_KEY])) {
270 264
 						$attendee->email = w2u($this->getEmailAddressFromSearchKey($row[PR_SEARCH_KEY]));
271
-					}
272
-					else {
265
+					} else {
273 266
 						SLog::Write(LOGLEVEL_WARN, sprintf("MAPIProvider->getAppointment: The attendee '%s' of type ZARAFA can not be resolved. Code: 0x%X", $row[PR_EMAIL_ADDRESS], mapi_last_hresult()));
274 267
 					}
275 268
 				}
@@ -331,8 +324,7 @@  discard block
 block discarded – undo
331 324
 
332 325
 		if (!isset($message->nativebodytype)) {
333 326
 			$message->nativebodytype = MAPIUtils::GetNativeBodyType($messageprops);
334
-		}
335
-		elseif ($message->nativebodytype == SYNC_BODYPREFERENCE_UNDEFINED) {
327
+		} elseif ($message->nativebodytype == SYNC_BODYPREFERENCE_UNDEFINED) {
336 328
 			$nbt = MAPIUtils::GetNativeBodyType($messageprops);
337 329
 			SLog::Write(LOGLEVEL_INFO, sprintf("MAPIProvider->getAppointment(): native body type is undefined. Set it to %d.", $nbt));
338 330
 			$message->nativebodytype = $nbt;
@@ -381,8 +373,7 @@  discard block
 block discarded – undo
381 373
 	private function getRecurrence($mapimessage, $recurprops, &$syncMessage, &$syncRecurrence, $tz) {
382 374
 		if ($syncRecurrence instanceof SyncTaskRecurrence) {
383 375
 			$recurrence = new TaskRecurrence($this->store, $mapimessage);
384
-		}
385
-		else {
376
+		} else {
386 377
 			$recurrence = new Recurrence($this->store, $mapimessage);
387 378
 		}
388 379
 
@@ -606,8 +597,7 @@  discard block
 block discarded – undo
606 597
 
607 598
 		if (isset($messageprops[PR_SOURCE_KEY])) {
608 599
 			$sourcekey = $messageprops[PR_SOURCE_KEY];
609
-		}
610
-		else {
600
+		} else {
611 601
 			$mbe = new SyncObjectBrokenException("The message doesn't have a sourcekey");
612 602
 			$mbe->SetSyncObject($message);
613 603
 
@@ -638,8 +628,7 @@  discard block
 block discarded – undo
638 628
 
639 629
 		if ($fromname) {
640 630
 			$from = "\"" . w2u($fromname) . "\" <" . w2u($fromaddr) . ">";
641
-		}
642
-		else { // START CHANGED dw2412 HTC shows "error" if sender name is unknown
631
+		} else { // START CHANGED dw2412 HTC shows "error" if sender name is unknown
643 632
 			$from = "\"" . w2u($fromaddr) . "\" <" . w2u($fromaddr) . ">";
644 633
 		}
645 634
 		// END CHANGED dw2412 HTC shows "error" if sender name is unknown
@@ -662,8 +651,7 @@  discard block
 block discarded – undo
662 651
 			// Set Timezone
663 652
 			if (isset($props[$meetingrequestproperties["timezonetag"]])) {
664 653
 				$tz = $this->getTZFromMAPIBlob($props[$meetingrequestproperties["timezonetag"]]);
665
-			}
666
-			else {
654
+			} else {
667 655
 				$tz = TimezoneUtil::GetFullTZ();
668 656
 			}
669 657
 
@@ -675,12 +663,10 @@  discard block
 block discarded – undo
675 663
 				if (isset($props[$meetingrequestproperties["recReplTime"]])) {
676 664
 					$basedate = $props[$meetingrequestproperties["recReplTime"]];
677 665
 					$message->meetingrequest->recurrenceid = $this->getGMTTimeByTZ($basedate, $this->getGMTTZ());
678
-				}
679
-				else {
666
+				} else {
680 667
 					if (!isset($props[$meetingrequestproperties["goidtag"]]) || !isset($props[$meetingrequestproperties["recurStartTime"]]) || !isset($props[$meetingrequestproperties["timezonetag"]])) {
681 668
 						SLog::Write(LOGLEVEL_WARN, "Missing property to set correct basedate for exception");
682
-					}
683
-					else {
669
+					} else {
684 670
 						$basedate = Utils::ExtractBaseDate($props[$meetingrequestproperties["goidtag"]], $props[$meetingrequestproperties["recurStartTime"]]);
685 671
 						$message->meetingrequest->recurrenceid = $this->getGMTTimeByTZ($basedate, $tz);
686 672
 					}
@@ -690,8 +676,7 @@  discard block
 block discarded – undo
690 676
 			// Organizer is the sender
691 677
 			if (strpos($message->messageclass, "IPM.Schedule.Meeting.Resp") === 0) {
692 678
 				$message->meetingrequest->organizer = $message->to;
693
-			}
694
-			else {
679
+			} else {
695 680
 				$message->meetingrequest->organizer = $message->from;
696 681
 			}
697 682
 
@@ -716,12 +701,10 @@  discard block
 block discarded – undo
716 701
 			$message->meetingrequest->instancetype = 0;
717 702
 			if (isset($props[$meetingrequestproperties["isrecurringtag"]]) && $props[$meetingrequestproperties["isrecurringtag"]] == 1) {
718 703
 				$message->meetingrequest->instancetype = 1;
719
-			}
720
-			elseif ((!isset($props[$meetingrequestproperties["isrecurringtag"]]) || $props[$meetingrequestproperties["isrecurringtag"]] == 0) && isset($message->meetingrequest->recurrenceid)) {
704
+			} elseif ((!isset($props[$meetingrequestproperties["isrecurringtag"]]) || $props[$meetingrequestproperties["isrecurringtag"]] == 0) && isset($message->meetingrequest->recurrenceid)) {
721 705
 				if (isset($props[$meetingrequestproperties["appSeqNr"]]) && $props[$meetingrequestproperties["appSeqNr"]] == 0) {
722 706
 					$message->meetingrequest->instancetype = 2;
723
-				}
724
-				else {
707
+				} else {
725 708
 					$message->meetingrequest->instancetype = 3;
726 709
 				}
727 710
 			}
@@ -735,8 +718,7 @@  discard block
 block discarded – undo
735 718
 				// /set the default reminder time to seconds
736 719
 				if ($props[$meetingrequestproperties["remindertime"]] == 0x5AE980E1) {
737 720
 					$message->meetingrequest->reminder = 900;
738
-				}
739
-				else {
721
+				} else {
740 722
 					$message->meetingrequest->reminder = $props[$meetingrequestproperties["remindertime"]] * 60;
741 723
 				}
742 724
 			}
@@ -820,8 +802,7 @@  discard block
 block discarded – undo
820 802
 			if (isset($row[PR_ATTACH_NUM])) {
821 803
 				if (Request::GetProtocolVersion() >= 12.0) {
822 804
 					$attach = new SyncBaseAttachment();
823
-				}
824
-				else {
805
+				} else {
825 806
 					$attach = new SyncAttachment();
826 807
 				}
827 808
 
@@ -867,8 +848,7 @@  discard block
 block discarded – undo
867 848
 						}
868 849
 						$stat = mapi_stream_stat($stream);
869 850
 						$attach->estimatedDataSize = $stat['cb'];
870
-					}
871
-					else {
851
+					} else {
872 852
 						$attach->estimatedDataSize = $attachprops[PR_ATTACH_SIZE];
873 853
 					}
874 854
 
@@ -893,8 +873,7 @@  discard block
 block discarded – undo
893 873
 					}
894 874
 
895 875
 					array_push($message->asattachments, $attach);
896
-				}
897
-				else {
876
+				} else {
898 877
 					$attach->attsize = $attachprops[PR_ATTACH_SIZE];
899 878
 					$attach->attname = sprintf("%s:%s:%s", $entryid, $row[PR_ATTACH_NUM], $parentSourcekey);
900 879
 					if (!isset($message->attachments)) {
@@ -922,11 +901,9 @@  discard block
 block discarded – undo
922 901
 
923 902
 			if (isset($row[PR_SMTP_ADDRESS])) {
924 903
 				$address = $row[PR_SMTP_ADDRESS];
925
-			}
926
-			elseif ($addrtype == "SMTP" && isset($row[PR_EMAIL_ADDRESS])) {
904
+			} elseif ($addrtype == "SMTP" && isset($row[PR_EMAIL_ADDRESS])) {
927 905
 				$address = $row[PR_EMAIL_ADDRESS];
928
-			}
929
-			elseif ($addrtype == "ZARAFA" && isset($row[PR_ENTRYID])) {
906
+			} elseif ($addrtype == "ZARAFA" && isset($row[PR_ENTRYID])) {
930 907
 				$address = $this->getSMTPAddressFromEntryID($row[PR_ENTRYID]);
931 908
 			}
932 909
 
@@ -940,20 +917,17 @@  discard block
 block discarded – undo
940 917
 
941 918
 			if ($name == "" || $name == $address) {
942 919
 				$fulladdr = w2u($address);
943
-			}
944
-			else {
920
+			} else {
945 921
 				if (substr($name, 0, 1) != '"' && substr($name, -1) != '"') {
946 922
 					$fulladdr = "\"" . w2u($name) . "\" <" . w2u($address) . ">";
947
-				}
948
-				else {
923
+				} else {
949 924
 					$fulladdr = w2u($name) . "<" . w2u($address) . ">";
950 925
 				}
951 926
 			}
952 927
 
953 928
 			if ($row[PR_RECIPIENT_TYPE] == MAPI_TO) {
954 929
 				array_push($message->to, $fulladdr);
955
-			}
956
-			elseif ($row[PR_RECIPIENT_TYPE] == MAPI_CC) {
930
+			} elseif ($row[PR_RECIPIENT_TYPE] == MAPI_CC) {
957 931
 				array_push($message->cc, $fulladdr);
958 932
 			}
959 933
 		}
@@ -981,8 +955,7 @@  discard block
 block discarded – undo
981 955
 
982 956
 		if (!isset($message->nativebodytype)) {
983 957
 			$message->nativebodytype = MAPIUtils::GetNativeBodyType($messageprops);
984
-		}
985
-		elseif ($message->nativebodytype == SYNC_BODYPREFERENCE_UNDEFINED) {
958
+		} elseif ($message->nativebodytype == SYNC_BODYPREFERENCE_UNDEFINED) {
986 959
 			$nbt = MAPIUtils::GetNativeBodyType($messageprops);
987 960
 			SLog::Write(LOGLEVEL_INFO, sprintf("MAPIProvider->getEmail(): native body type is undefined. Set it to %d.", $nbt));
988 961
 			$message->nativebodytype = $nbt;
@@ -1071,8 +1044,7 @@  discard block
 block discarded – undo
1071 1044
 		$folder->serverid = GSync::GetDeviceManager()->GetFolderIdForBackendId($folder->BackendId, true, $folderOrigin, $folderprops[PR_DISPLAY_NAME]);
1072 1045
 		if ($folderprops[PR_PARENT_ENTRYID] == $storeprops[PR_IPM_SUBTREE_ENTRYID] || $folderprops[PR_PARENT_ENTRYID] == $storeprops[PR_IPM_PUBLIC_FOLDERS_ENTRYID]) {
1073 1046
 			$folder->parentid = "0";
1074
-		}
1075
-		else {
1047
+		} else {
1076 1048
 			$folder->parentid = GSync::GetDeviceManager()->GetFolderIdForBackendId(bin2hex($folderprops[PR_PARENT_SOURCE_KEY]));
1077 1049
 		}
1078 1050
 		$folder->displayname = w2u($folderprops[PR_DISPLAY_NAME]);
@@ -1322,8 +1294,7 @@  discard block
 block discarded – undo
1322 1294
 			$delprops[] = $flagprops["completetime"];
1323 1295
 			$delprops[] = $flagprops["flagstatus"];
1324 1296
 			$delprops[] = $flagprops["flagicon"];
1325
-		}
1326
-		else {
1297
+		} else {
1327 1298
 			$this->setPropsInMAPI($mapimessage, $message->flag, $flagmapping);
1328 1299
 			$props[$flagprops["todoitemsflags"]] = 1;
1329 1300
 			if (isset($message->subject) && strlen($message->subject) > 0) {
@@ -1373,8 +1344,7 @@  discard block
 block discarded – undo
1373 1344
 		// Get timezone info
1374 1345
 		if (isset($appointment->timezone)) {
1375 1346
 			$tz = $this->getTZFromSyncBlob(base64_decode($appointment->timezone));
1376
-		}
1377
-		else {
1347
+		} else {
1378 1348
 			$tz = false;
1379 1349
 		}
1380 1350
 
@@ -1497,8 +1467,7 @@  discard block
 block discarded – undo
1497 1467
 						$noexceptions = false;
1498 1468
 						// Delete exception
1499 1469
 						$recurrence->createException([], $basedate, true);
1500
-					}
1501
-					else {
1470
+					} else {
1502 1471
 						// Change exception
1503 1472
 						$mapiexception = ["basedate" => $basedate];
1504 1473
 						// other exception properties which are not handled in recurrence
@@ -1550,8 +1519,7 @@  discard block
 block discarded – undo
1550 1519
 							$noexceptions = false;
1551 1520
 							if ($recurrence->isException($basedate)) {
1552 1521
 								$recurrence->modifyException($exceptionprops, $basedate);
1553
-							}
1554
-							else {
1522
+							} else {
1555 1523
 								$recurrence->createException($exceptionprops, $basedate);
1556 1524
 							}
1557 1525
 						}
@@ -1563,8 +1531,7 @@  discard block
 block discarded – undo
1563 1531
 			if ($noexceptions) {
1564 1532
 				$recurrence->setRecurrence($tz, $recur);
1565 1533
 			}
1566
-		}
1567
-		else {
1534
+		} else {
1568 1535
 			$props[$appointmentprops["isrecurring"]] = false;
1569 1536
 		}
1570 1537
 
@@ -1640,8 +1607,7 @@  discard block
 block discarded – undo
1640 1607
 					$recip[PR_RECIPIENT_TYPE] = isset($attendee->attendeetype) ? $attendee->attendeetype : MAPI_TO;
1641 1608
 					$recip[PR_RECIPIENT_FLAGS] = recipSendable;
1642 1609
 					$recip[PR_RECIPIENT_TRACKSTATUS] = isset($attendee->attendeestatus) ? $attendee->attendeestatus : olResponseNone;
1643
-				}
1644
-				else {
1610
+				} else {
1645 1611
 					$recip[PR_DISPLAY_NAME] = u2w($attendee->name);
1646 1612
 					$recip[PR_SEARCH_KEY] = "SMTP:" . $recip[PR_EMAIL_ADDRESS] . "\0";
1647 1613
 					$recip[PR_ADDRTYPE] = "SMTP";
@@ -1727,12 +1693,10 @@  discard block
 block discarded – undo
1727 1693
 		if (isset($props[$contactprops["businessaddress"]])) {
1728 1694
 			$props[$contactprops["mailingaddress"]] = 2;
1729 1695
 			$this->setMailingAddress($contact->businesscity, $contact->businesscountry, $contact->businesspostalcode, $contact->businessstate, $contact->businessstreet, $props[$contactprops["businessaddress"]], $props, $contactprops);
1730
-		}
1731
-		elseif (isset($props[$contactprops["homeaddress"]])) {
1696
+		} elseif (isset($props[$contactprops["homeaddress"]])) {
1732 1697
 			$props[$contactprops["mailingaddress"]] = 1;
1733 1698
 			$this->setMailingAddress($contact->homecity, $contact->homecountry, $contact->homepostalcode, $contact->homestate, $contact->homestreet, $props[$contactprops["homeaddress"]], $props, $contactprops);
1734
-		}
1735
-		elseif (isset($props[$contactprops["otheraddress"]])) {
1699
+		} elseif (isset($props[$contactprops["otheraddress"]])) {
1736 1700
 			$props[$contactprops["mailingaddress"]] = 3;
1737 1701
 			$this->setMailingAddress($contact->othercity, $contact->othercountry, $contact->otherpostalcode, $contact->otherstate, $contact->otherstreet, $props[$contactprops["otheraddress"]], $props, $contactprops);
1738 1702
 		}
@@ -1793,8 +1757,7 @@  discard block
 block discarded – undo
1793 1757
 			$middlename = (isset($contact->middlename)) ? $contact->middlename : "";
1794 1758
 			$company = (isset($contact->companyname)) ? $contact->companyname : "";
1795 1759
 			$props[$contactprops["fileas"]] = Utils::BuildFileAs($lastname, $firstname, $middlename, $company);
1796
-		}
1797
-		else {
1760
+		} else {
1798 1761
 			SLog::Write(LOGLEVEL_DEBUG, "FILEAS_ORDER not defined");
1799 1762
 		}
1800 1763
 
@@ -1833,8 +1796,7 @@  discard block
 block discarded – undo
1833 1796
 				$props[$taskprops["completion"]] = 1.0;
1834 1797
 				$props[$taskprops["status"]] = 2;
1835 1798
 				$props[$taskprops["reminderset"]] = false;
1836
-			}
1837
-			else {
1799
+			} else {
1838 1800
 				// Set completion to 0%
1839 1801
 				// Set status to 'not started'
1840 1802
 				$props[$taskprops["completion"]] = 0.0;
@@ -1993,12 +1955,10 @@  discard block
 block discarded – undo
1993 1955
 				if (mapi_prop_type($mapiprop) != PT_BINARY && mapi_prop_type($mapiprop) != PT_MV_BINARY) {
1994 1956
 					if (is_array($message->{$asprop})) {
1995 1957
 						$value = array_map("u2wi", $message->{$asprop});
1996
-					}
1997
-					else {
1958
+					} else {
1998 1959
 						$value = u2wi($message->{$asprop});
1999 1960
 					}
2000
-				}
2001
-				else {
1961
+				} else {
2002 1962
 					$value = $message->{$asprop};
2003 1963
 				}
2004 1964
 
@@ -2033,13 +1993,11 @@  discard block
 block discarded – undo
2033 1993
 				if (is_array($value) && empty($value)) {
2034 1994
 					$propsToDelete[] = $mapiprop;
2035 1995
 					SLog::Write(LOGLEVEL_DEBUG, sprintf("MAPIProvider->setPropsInMAPI(): Property '%s' to be deleted as it is an empty array", $asprop));
2036
-				}
2037
-				else {
1996
+				} else {
2038 1997
 					// all properties will be set at once
2039 1998
 					$propsToSet[$mapiprop] = $value;
2040 1999
 				}
2041
-			}
2042
-			elseif (in_array($asprop, $unsetVars)) {
2000
+			} elseif (in_array($asprop, $unsetVars)) {
2043 2001
 				$propsToDelete[] = $mapiprop;
2044 2002
 			}
2045 2003
 		}
@@ -2099,12 +2057,10 @@  discard block
 block discarded – undo
2099 2057
 					// Force to actual '0' or '1'
2100 2058
 					if ($messageprops[$mapiprop]) {
2101 2059
 						$message->{$asprop} = 1;
2102
-					}
2103
-					else {
2060
+					} else {
2104 2061
 						$message->{$asprop} = 0;
2105 2062
 					}
2106
-				}
2107
-				else {
2063
+				} else {
2108 2064
 					// Special handling for PR_MESSAGE_FLAGS
2109 2065
 					if ($mapiprop == PR_MESSAGE_FLAGS) {
2110 2066
 						$message->{$asprop} = $messageprops[$mapiprop] & 1;
@@ -2112,15 +2068,12 @@  discard block
 block discarded – undo
2112 2068
 					elseif ($mapiprop == PR_RTF_COMPRESSED) {
2113 2069
 						// do not send rtf to the mobile
2114 2070
 						continue;
2115
-					}
2116
-					elseif (is_array($messageprops[$mapiprop])) {
2071
+					} elseif (is_array($messageprops[$mapiprop])) {
2117 2072
 						$message->{$asprop} = array_map("w2u", $messageprops[$mapiprop]);
2118
-					}
2119
-					else {
2073
+					} else {
2120 2074
 						if (mapi_prop_type($mapiprop) != PT_BINARY && mapi_prop_type($mapiprop) != PT_MV_BINARY) {
2121 2075
 							$message->{$asprop} = w2u($messageprops[$mapiprop]);
2122
-						}
2123
-						else {
2076
+						} else {
2124 2077
 							$message->{$asprop} = $messageprops[$mapiprop];
2125 2078
 						}
2126 2079
 					}
@@ -2316,17 +2269,14 @@  discard block
 block discarded – undo
2316 2269
 			// northern hemisphere (july = dst)
2317 2270
 			if ($localtime >= $start && $localtime < $end) {
2318 2271
 				$dst = true;
2319
-			}
2320
-			else {
2272
+			} else {
2321 2273
 				$dst = false;
2322 2274
 			}
2323
-		}
2324
-		else {
2275
+		} else {
2325 2276
 			// southern hemisphere (january = dst)
2326 2277
 			if ($localtime >= $end && $localtime < $start) {
2327 2278
 				$dst = false;
2328
-			}
2329
-			else {
2279
+			} else {
2330 2280
 				$dst = true;
2331 2281
 			}
2332 2282
 		}
@@ -2372,8 +2322,7 @@  discard block
 block discarded – undo
2372 2322
 			$monthnow = gmdate("n", $date); // gmdate returns 1-12
2373 2323
 			if ($monthnow > $month) {
2374 2324
 				$date = $date - (24 * 7 * 60 * 60);
2375
-			}
2376
-			else {
2325
+			} else {
2377 2326
 				break;
2378 2327
 			}
2379 2328
 		}
@@ -2602,8 +2551,7 @@  discard block
 block discarded – undo
2602 2551
 				$recur["type"] = 10;
2603 2552
 				if (isset($message->recurrence->dayofweek)) {
2604 2553
 					$recur["subtype"] = 1;
2605
-				}
2606
-				else {
2554
+				} else {
2607 2555
 					$recur["subtype"] = 0;
2608 2556
 				}
2609 2557
 
@@ -2660,12 +2608,10 @@  discard block
 block discarded – undo
2660 2608
 		if (isset($message->recurrence->until)) {
2661 2609
 			$recur["term"] = 0x21;
2662 2610
 			$recur["end"] = $message->recurrence->until;
2663
-		}
2664
-		elseif (isset($message->recurrence->occurrences)) {
2611
+		} elseif (isset($message->recurrence->occurrences)) {
2665 2612
 			$recur["term"] = 0x22;
2666 2613
 			$recur["numoccur"] = $message->recurrence->occurrences;
2667
-		}
2668
-		else {
2614
+		} else {
2669 2615
 			$recur["term"] = 0x23;
2670 2616
 		}
2671 2617
 
@@ -2745,8 +2691,7 @@  discard block
 block discarded – undo
2745 2691
 		if ($stream) {
2746 2692
 			$stat = mapi_stream_stat($stream);
2747 2693
 			$streamsize = $stat['cb'];
2748
-		}
2749
-		else {
2694
+		} else {
2750 2695
 			$streamsize = 0;
2751 2696
 		}
2752 2697
 
@@ -2757,24 +2702,20 @@  discard block
 block discarded – undo
2757 2702
 			if ($bpReturnType == SYNC_BODYPREFERENCE_RTF) {
2758 2703
 				$body = $this->mapiReadStream($stream, $streamsize);
2759 2704
 				$message->asbody->data = StringStreamWrapper::Open(base64_encode($body));
2760
-			}
2761
-			elseif (isset($message->internetcpid) && $bpReturnType == SYNC_BODYPREFERENCE_HTML) {
2705
+			} elseif (isset($message->internetcpid) && $bpReturnType == SYNC_BODYPREFERENCE_HTML) {
2762 2706
 				// if PR_HTML is UTF-8 we can stream it directly, else we have to convert to UTF-8 & wrap it
2763 2707
 				if ($message->internetcpid == INTERNET_CPID_UTF8) {
2764 2708
 					$message->asbody->data = MAPIStreamWrapper::Open($stream, $truncateHtmlSafe);
2765
-				}
2766
-				else {
2709
+				} else {
2767 2710
 					$body = $this->mapiReadStream($stream, $streamsize);
2768 2711
 					$message->asbody->data = StringStreamWrapper::Open(Utils::ConvertCodepageStringToUtf8($message->internetcpid, $body), $truncateHtmlSafe);
2769 2712
 					$message->internetcpid = INTERNET_CPID_UTF8;
2770 2713
 				}
2771
-			}
2772
-			else {
2714
+			} else {
2773 2715
 				$message->asbody->data = MAPIStreamWrapper::Open($stream);
2774 2716
 			}
2775 2717
 			$message->asbody->estimatedDataSize = $streamsize;
2776
-		}
2777
-		else {
2718
+		} else {
2778 2719
 			$body = $this->mapiReadStream($stream, $streamsize);
2779 2720
 			$message->body = str_replace("\n", "\r\n", w2u(str_replace("\r", "", $body)));
2780 2721
 			$message->bodysize = $streamsize;
@@ -2814,8 +2755,7 @@  discard block
 block discarded – undo
2814 2755
 		if (isset($mapiEmail[PR_EC_IMAP_EMAIL]) || MAPIUtils::GetError(PR_EC_IMAP_EMAIL, $mapiEmail) == MAPI_E_NOT_ENOUGH_MEMORY) {
2815 2756
 			$stream = mapi_openproperty($mapimessage, PR_EC_IMAP_EMAIL, IID_IStream, 0, 0);
2816 2757
 			SLog::Write(LOGLEVEL_DEBUG, "MAPIProvider->imtoinet(): using PR_EC_IMAP_EMAIL as full RFC822 message");
2817
-		}
2818
-		else {
2758
+		} else {
2819 2759
 			$addrbook = $this->getAddressbook();
2820 2760
 			$stream = mapi_inetmapi_imtoinet($this->session, $addrbook, $mapimessage, ['use_tnef' => -1, 'ignore_missing_attachments' => 1]);
2821 2761
 		}
@@ -2830,8 +2770,7 @@  discard block
 block discarded – undo
2830 2770
 					$message->asbody->data = MAPIStreamWrapper::Open($stream);
2831 2771
 					$message->asbody->estimatedDataSize = $streamsize;
2832 2772
 					$message->asbody->truncated = 0;
2833
-				}
2834
-				else {
2773
+				} else {
2835 2774
 					$message->mimedata = MAPIStreamWrapper::Open($stream);
2836 2775
 					$message->mimesize = $streamsize;
2837 2776
 					$message->mimetruncated = 0;
@@ -2902,8 +2841,7 @@  discard block
 block discarded – undo
2902 2841
 			if (Request::GetProtocolVersion() >= 14.0 && $bpo->GetPreview()) {
2903 2842
 				$message->asbody->preview = Utils::Utf8_truncate(MAPIUtils::readPropStream($mapimessage, PR_BODY), $bpo->GetPreview());
2904 2843
 			}
2905
-		}
2906
-		else {
2844
+		} else {
2907 2845
 			// Override 'body' for truncation
2908 2846
 			$truncsize = Utils::GetTruncSize($contentparameters->GetTruncation());
2909 2847
 			$this->setMessageBodyForType($mapimessage, SYNC_BODYPREFERENCE_PLAIN, $message);
@@ -2968,8 +2906,7 @@  discard block
 block discarded – undo
2968 2906
 				case SYNC_BODYPREFERENCE_MIME:
2969 2907
 					break;
2970 2908
 			}
2971
-		}
2972
-		else {
2909
+		} else {
2973 2910
 			SLog::Write(LOGLEVEL_DEBUG, "MAPIProvider->setASbody either type or data are not set. Setting to empty body");
2974 2911
 			$props[$appointmentprops["body"]] = "";
2975 2912
 		}
@@ -3105,8 +3042,7 @@  discard block
 block discarded – undo
3105 3042
 						$this->specialFoldersData[] = substr($persistData, 8, $unpackedData['elDataSize']);
3106 3043
 						// Add PersistId and DataElementsSize lengths to the data size as they're not part of it
3107 3044
 						$persistData = substr($persistData, $unpackedData['dataSize'] + 4);
3108
-					}
3109
-					else {
3045
+					} else {
3110 3046
 						SLog::Write(LOGLEVEL_INFO, "MAPIProvider->getSpecialFoldersData(): persistent data is not valid");
3111 3047
 						break;
3112 3048
 					}
Please login to merge, or discard this patch.
lib/grommunio/importer.php 1 patch
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -60,13 +60,11 @@  discard block
 block discarded – undo
60 60
 			if ($folderidForBackendId != $this->folderidHex) {
61 61
 				$this->prefix = $folderidForBackendId . ':';
62 62
 			}
63
-		}
64
-		else {
63
+		} else {
65 64
 			$storeprops = mapi_getprops($store, [PR_IPM_SUBTREE_ENTRYID, PR_IPM_PUBLIC_FOLDERS_ENTRYID]);
66 65
 			if (GSync::GetBackend()->GetImpersonatedUser() == 'system') {
67 66
 				$entryid = $storeprops[PR_IPM_PUBLIC_FOLDERS_ENTRYID];
68
-			}
69
-			else {
67
+			} else {
70 68
 				$entryid = $storeprops[PR_IPM_SUBTREE_ENTRYID];
71 69
 			}
72 70
 		}
@@ -88,8 +86,7 @@  discard block
 block discarded – undo
88 86
 
89 87
 		if ($folderid) {
90 88
 			$this->importer = mapi_openproperty($folder, PR_COLLECTOR, IID_IExchangeImportContentsChanges, 0, 0);
91
-		}
92
-		else {
89
+		} else {
93 90
 			$this->importer = mapi_openproperty($folder, PR_COLLECTOR, IID_IExchangeImportHierarchyChanges, 0, 0);
94 91
 		}
95 92
 	}
@@ -127,8 +124,7 @@  discard block
 block discarded – undo
127 124
 			// possible conflicting messages will be cached here
128 125
 			$this->memChanges = new ChangesMemoryWrapper();
129 126
 			$stat = mapi_importcontentschanges_config($this->importer, $stream, $flags);
130
-		}
131
-		else {
127
+		} else {
132 128
 			$stat = mapi_importhierarchychanges_config($this->importer, $stream, $flags);
133 129
 		}
134 130
 
@@ -201,8 +197,7 @@  discard block
 block discarded – undo
201 197
 			$data = mapi_stream_read($this->statestream, 4096);
202 198
 			if (strlen($data)) {
203 199
 				$state .= $data;
204
-			}
205
-			else {
200
+			} else {
206 201
 				break;
207 202
 			}
208 203
 		}
@@ -395,8 +390,7 @@  discard block
 block discarded – undo
395 390
 
396 391
 				return false;
397 392
 			}
398
-		}
399
-		else {
393
+		} else {
400 394
 			$flags = SYNC_NEW_MESSAGE;
401 395
 		}
402 396
 
@@ -436,8 +430,7 @@  discard block
 block discarded – undo
436 430
 		$this->lazyLoadConflicts();
437 431
 		if ($this->memChanges->IsChanged($id)) {
438 432
 			SLog::Write(LOGLEVEL_INFO, sprintf("ImportChangesICS->ImportMessageDeletion('%s'): Conflict detected. Data from Server will be dropped! PIM deleted object.", $id));
439
-		}
440
-		elseif ($this->memChanges->IsDeleted($id)) {
433
+		} elseif ($this->memChanges->IsDeleted($id)) {
441 434
 			SLog::Write(LOGLEVEL_INFO, sprintf("ImportChangesICS->ImportMessageDeletion('%s'): Conflict detected. Data is already deleted. Request will be ignored.", $id));
442 435
 
443 436
 			return true;
@@ -658,12 +651,10 @@  discard block
 block discarded – undo
658 651
 				$parentprops = mapi_getprops($this->store, [PR_IPM_SUBTREE_ENTRYID, PR_IPM_PUBLIC_FOLDERS_ENTRYID]);
659 652
 				if (GSync::GetBackend()->GetImpersonatedUser() == 'system' && isset($parentprops[PR_IPM_PUBLIC_FOLDERS_ENTRYID])) {
660 653
 					$parentfentryid = $parentprops[PR_IPM_PUBLIC_FOLDERS_ENTRYID];
661
-				}
662
-				elseif (isset($parentprops[PR_IPM_SUBTREE_ENTRYID])) {
654
+				} elseif (isset($parentprops[PR_IPM_SUBTREE_ENTRYID])) {
663 655
 					$parentfentryid = $parentprops[PR_IPM_SUBTREE_ENTRYID];
664 656
 				}
665
-			}
666
-			else {
657
+			} else {
667 658
 				$parentfentryid = mapi_msgstore_entryidfromsourcekey($this->store, hex2bin($parent));
668 659
 			}
669 660
 
@@ -726,8 +717,7 @@  discard block
 block discarded – undo
726 717
 			$parentprops = mapi_getprops($this->store, [PR_IPM_SUBTREE_ENTRYID, PR_IPM_PUBLIC_FOLDERS_ENTRYID]);
727 718
 			if (GSync::GetBackend()->GetImpersonatedUser() == 'system') {
728 719
 				$parentfentryid = $parentprops[PR_IPM_PUBLIC_FOLDERS_ENTRYID];
729
-			}
730
-			else {
720
+			} else {
731 721
 				$parentfentryid = $parentprops[PR_IPM_SUBTREE_ENTRYID];
732 722
 			}
733 723
 			$mapifolder = mapi_msgstore_openentry($this->store, $parentfentryid);
Please login to merge, or discard this patch.
lib/core/redisconnection.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -48,8 +48,7 @@  discard block
 block discarded – undo
48 48
 	public function getKey($key) {
49 49
 		try {
50 50
 			return $this->redisObj->get($key);
51
-		}
52
-		catch (Exception $e) {
51
+		} catch (Exception $e) {
53 52
 			SLog::Write(LOGLEVEL_ERROR, sprintf("%s->getKey(): %s", get_class($this), $e->getMessage()));
54 53
 		}
55 54
 	}
@@ -61,8 +60,7 @@  discard block
 block discarded – undo
61 60
 			}
62 61
 
63 62
 			return $this->redisObj->set($key, $value);
64
-		}
65
-		catch (Exception $e) {
63
+		} catch (Exception $e) {
66 64
 			SLog::Write(LOGLEVEL_ERROR, sprintf("%s->setKey(): %s", get_class($this), $e->getMessage()));
67 65
 		}
68 66
 	}
@@ -70,8 +68,7 @@  discard block
 block discarded – undo
70 68
 	public function delKey($key) {
71 69
 		try {
72 70
 			return $this->redisObj->del($key);
73
-		}
74
-		catch (Exception $e) {
71
+		} catch (Exception $e) {
75 72
 			SLog::Write(LOGLEVEL_ERROR, sprintf("%s->delKey(): %s", get_class($this), $e->getMessage()));
76 73
 		}
77 74
 	}
Please login to merge, or discard this patch.