Passed
Branch master (f497d2)
by Mike
03:18
created
lib/request/search.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -145,8 +145,7 @@  discard block
 block discarded – undo
145 145
 				if (!self::$decoder->getElementEndTag()) { // SYNC_SEARCH_AND
146 146
 					return false;
147 147
 				}
148
-			}
149
-			elseif (self::$decoder->getElementStartTag(SYNC_SEARCH_EQUALTO)) {
148
+			} elseif (self::$decoder->getElementStartTag(SYNC_SEARCH_EQUALTO)) {
150 149
 				// linkid can be an empty tag as well as have value
151 150
 				if (self::$decoder->getElementStartTag(SYNC_DOCUMENTLIBRARY_LINKID)) {
152 151
 					if (($linkId = self::$decoder->getElementContent()) !== false) {
@@ -346,18 +345,15 @@  discard block
 block discarded – undo
346 345
 				if ($searchname == ISearchProvider::SEARCH_GAL) {
347 346
 					// get search results from the searchprovider
348 347
 					$rows = $searchprovider->GetGALSearchResults($searchquery, $searchrange, $searchpicture);
349
-				}
350
-				elseif ($searchname == ISearchProvider::SEARCH_MAILBOX) {
348
+				} elseif ($searchname == ISearchProvider::SEARCH_MAILBOX) {
351 349
 					$backendFolderId = self::$deviceManager->GetBackendIdForFolderId($cpo->GetSearchFolderid());
352 350
 					$cpo->SetSearchFolderid($backendFolderId);
353 351
 					$rows = $searchprovider->GetMailboxSearchResults($cpo);
354 352
 				}
355
-			}
356
-			catch (StatusException $stex) {
353
+			} catch (StatusException $stex) {
357 354
 				$storestatus = $stex->getCode();
358 355
 			}
359
-		}
360
-		else {
356
+		} else {
361 357
 			$rows = ['searchtotal' => 0];
362 358
 			$status = SYNC_SEARCHSTATUS_SERVERERROR;
363 359
 			SLog::Write(LOGLEVEL_WARN, sprintf("Searchtype '%s' is not supported.", $searchname));
@@ -471,8 +467,7 @@  discard block
 block discarded – undo
471 467
 								self::$encoder->endTag(); // properties
472 468
 					}
473 469
 				}
474
-			}
475
-			elseif ($searchname == ISearchProvider::SEARCH_MAILBOX) {
470
+			} elseif ($searchname == ISearchProvider::SEARCH_MAILBOX) {
476 471
 				foreach ($rows as $u) {
477 472
 					// TODO: unclear if any clients *require* the folder id where the message is located (it's not available anymore)
478 473
 					// $folderid = self::$deviceManager->GetFolderIdForBackendId($u['folderid']);
Please login to merge, or discard this patch.
lib/request/requestprocessor.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -98,8 +98,7 @@
 block discarded – undo
98 98
 			if (!$handler->Handle(Request::GetCommandCode())) {
99 99
 				throw new WBXMLException(sprintf("Unknown error in %s->Handle()", get_class($handler)));
100 100
 			}
101
-		}
102
-		catch (Exception $ex) {
101
+		} catch (Exception $ex) {
103 102
 			// Log 10 KB of the WBXML data
104 103
 			SLog::Write(LOGLEVEL_FATAL, "WBXML 10K debug data: " . Request::GetInputAsBase64(10240), false);
105 104
 
Please login to merge, or discard this patch.
lib/request/getattachment.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,8 +40,7 @@
 block discarded – undo
40 40
 			}
41 41
 			self::$topCollector->AnnounceInformation(sprintf("Streamed %d KB attachment", round($l / 1024)), true);
42 42
 			SLog::Write(LOGLEVEL_DEBUG, sprintf("HandleGetAttachment(): attachment with %d KB sent to mobile", round($l / 1024)));
43
-		}
44
-		catch (StatusException $s) {
43
+		} catch (StatusException $s) {
45 44
 			// StatusException already logged so we just need to pass it upwards to send a HTTP error
46 45
 			throw new HTTPReturnCodeException($s->getMessage(), HTTP_CODE_500, null, LOGLEVEL_DEBUG);
47 46
 		}
Please login to merge, or discard this patch.
lib/request/sendmail.php 1 patch
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -24,8 +24,7 @@  discard block
 block discarded – undo
24 24
 		}
25 25
 		if ($commandCode == GSync::COMMAND_SMARTFORWARD) {
26 26
 			$forward = Request::GetGETItemId();
27
-		}
28
-		elseif ($commandCode == GSync::COMMAND_SMARTREPLY) {
27
+		} elseif ($commandCode == GSync::COMMAND_SMARTREPLY) {
29 28
 			$reply = Request::GetGETItemId();
30 29
 		}
31 30
 
@@ -38,11 +37,9 @@  discard block
 block discarded – undo
38 37
 
39 38
 			if ($el[EN_TAG] == SYNC_COMPOSEMAIL_SENDMAIL) {
40 39
 				$sendmail = true;
41
-			}
42
-			elseif ($el[EN_TAG] == SYNC_COMPOSEMAIL_SMARTREPLY) {
40
+			} elseif ($el[EN_TAG] == SYNC_COMPOSEMAIL_SMARTREPLY) {
43 41
 				$smartreply = true;
44
-			}
45
-			elseif ($el[EN_TAG] == SYNC_COMPOSEMAIL_SMARTFORWARD) {
42
+			} elseif ($el[EN_TAG] == SYNC_COMPOSEMAIL_SMARTFORWARD) {
46 43
 				$smartforward = true;
47 44
 			}
48 45
 
@@ -51,8 +48,7 @@  discard block
 block discarded – undo
51 48
 			}
52 49
 
53 50
 			$sm->Decode(self::$decoder);
54
-		}
55
-		else {
51
+		} else {
56 52
 			$sm->mime = self::$decoder->GetPlainInputStream();
57 53
 			// no wbxml output is provided, only a http OK
58 54
 			$sm->saveinsent = Request::GetGETSaveInSent();
@@ -92,8 +88,7 @@  discard block
 block discarded – undo
92 88
 			// Even if they are a part of SyncSendMail object, they won't be streamed.
93 89
 			if ($smartreply || $reply) {
94 90
 				$sm->replyflag = true;
95
-			}
96
-			else {
91
+			} else {
97 92
 				$sm->forwardflag = true;
98 93
 			}
99 94
 
@@ -108,8 +103,7 @@  discard block
 block discarded – undo
108 103
 
109 104
 		try {
110 105
 			$status = self::$backend->SendMail($sm);
111
-		}
112
-		catch (StatusException $se) {
106
+		} catch (StatusException $se) {
113 107
 			$status = $se->getCode();
114 108
 			$statusMessage = $se->getMessage();
115 109
 		}
@@ -123,8 +117,7 @@  discard block
 block discarded – undo
123 117
 				self::$encoder->content($status); // TODO return the correct status
124 118
 				self::$encoder->endTag();
125 119
 				self::$encoder->endTag();
126
-			}
127
-			else {
120
+			} else {
128 121
 				throw new HTTPReturnCodeException($statusMessage, HTTP_CODE_500, null, LOGLEVEL_WARN);
129 122
 			}
130 123
 		}
Please login to merge, or discard this patch.
lib/request/meetingresponse.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,8 +81,7 @@
 block discarded – undo
81 81
 				if ($calendarid === false) {
82 82
 					throw new StatusException("HandleMeetingResponse() not possible", SYNC_MEETRESPSTATUS_SERVERERROR);
83 83
 				}
84
-			}
85
-			catch (StatusException $stex) {
84
+			} catch (StatusException $stex) {
86 85
 				$status = $stex->getCode();
87 86
 			}
88 87
 
Please login to merge, or discard this patch.
lib/request/sync.php 1 patch
Braces   +46 added lines, -92 removed lines patch added patch discarded remove patch
@@ -41,8 +41,7 @@  discard block
 block discarded – undo
41 41
 				SLog::Write(LOGLEVEL_INFO, "Request->HandleSync(): Sync request aborted, as exporting of folders has not yet completed");
42 42
 				self::$topCollector->AnnounceInformation("Aborted due incomplete folder sync", true);
43 43
 				$status = SYNC_STATUS_FOLDERHIERARCHYCHANGED;
44
-			}
45
-			else {
44
+			} else {
46 45
 				SLog::Write(LOGLEVEL_INFO, "Request->HandleSync(): FolderSync marked as complete");
47 46
 			}
48 47
 		}
@@ -99,8 +98,7 @@  discard block
 block discarded – undo
99 98
 								return false;
100 99
 							}
101 100
 						}
102
-					}
103
-					else {
101
+					} else {
104 102
 						return false;
105 103
 					}
106 104
 
@@ -133,16 +131,14 @@  discard block
 block discarded – undo
133 131
 							$spa->RemoveSyncKey();
134 132
 							$spa->DelFolderStat();
135 133
 							$spa->SetMoveState(false);
136
-						}
137
-						elseif ($synckey !== false) {
134
+						} elseif ($synckey !== false) {
138 135
 							if ($synckey !== $spa->GetSyncKey() && $synckey !== $spa->GetNewSyncKey()) {
139 136
 								SLog::Write(LOGLEVEL_DEBUG, "HandleSync(): Synckey does not match latest saved for this folder or there is a move state, removing folderstat to force Exporter setup");
140 137
 								$spa->DelFolderStat();
141 138
 							}
142 139
 							$spa->SetSyncKey($synckey);
143 140
 						}
144
-					}
145
-					catch (StateInvalidException $stie) {
141
+					} catch (StateInvalidException $stie) {
146 142
 						$spa = new SyncParameters();
147 143
 						$status = SYNC_STATUS_INVALIDSYNCKEY;
148 144
 						self::$topCollector->AnnounceInformation("State invalid - Resync folder", $this->singleFolder);
@@ -163,8 +159,7 @@  discard block
 block discarded – undo
163 159
 						try {
164 160
 							$spa->SetContentClass(self::$deviceManager->GetFolderClassFromCacheByID($spa->GetFolderId()));
165 161
 							SLog::Write(LOGLEVEL_DEBUG, sprintf("GetFolderClassFromCacheByID from Device Manager: '%s' for id:'%s'", $spa->GetContentClass(), $spa->GetFolderId()));
166
-						}
167
-						catch (NoHierarchyCacheAvailableException $nhca) {
162
+						} catch (NoHierarchyCacheAvailableException $nhca) {
168 163
 							$status = SYNC_STATUS_FOLDERHIERARCHYCHANGED;
169 164
 							self::$deviceManager->ForceFullResync();
170 165
 						}
@@ -176,8 +171,7 @@  discard block
 block discarded – undo
176 171
 
177 172
 					if ($spa->HasContentClass()) {
178 173
 						self::$topCollector->AnnounceInformation(sprintf("%s request", $spa->GetContentClass()), $this->singleFolder);
179
-					}
180
-					else {
174
+					} else {
181 175
 						SLog::Write(LOGLEVEL_WARN, "Not possible to determine class of request. Request did not contain class and apparently there is an issue with the HierarchyCache.");
182 176
 					}
183 177
 
@@ -480,8 +474,7 @@  discard block
 block discarded – undo
480 474
 								if (!self::$decoder->getElementEndTag()) {
481 475
 									return false;
482 476
 								}
483
-							}
484
-							else {
477
+							} else {
485 478
 								$foldertype = false;
486 479
 							}
487 480
 
@@ -500,8 +493,7 @@  discard block
 block discarded – undo
500 493
 								if (!self::$decoder->getElementEndTag()) { // end clientid
501 494
 									return false;
502 495
 								}
503
-							}
504
-							else {
496
+							} else {
505 497
 								$clientid = false;
506 498
 							}
507 499
 
@@ -516,8 +508,7 @@  discard block
 block discarded – undo
516 508
 								if (!self::$decoder->getElementEndTag()) { // end applicationdata
517 509
 									return false;
518 510
 								}
519
-							}
520
-							else {
511
+							} else {
521 512
 								$message = false;
522 513
 							}
523 514
 
@@ -534,8 +525,7 @@  discard block
 block discarded – undo
534 525
 
535 526
 									if ($status == SYNC_STATUS_SUCCESS) {
536 527
 										$this->importMessage($spa, $actiondata, $element[EN_TAG], $message, $clientid, $serverid, $foldertype, $nchanges);
537
-									}
538
-									else {
528
+									} else {
539 529
 										SLog::Write(LOGLEVEL_WARN, "Ignored incoming change, global status indicates problem.");
540 530
 									}
541 531
 									break;
@@ -543,8 +533,7 @@  discard block
 block discarded – undo
543 533
 
544 534
 							if ($actiondata["fetchids"]) {
545 535
 								self::$topCollector->AnnounceInformation(sprintf("Fetching %d", $nchanges));
546
-							}
547
-							else {
536
+							} else {
548 537
 								self::$topCollector->AnnounceInformation(sprintf("Incoming %d", $nchanges));
549 538
 							}
550 539
 
@@ -563,8 +552,7 @@  discard block
 block discarded – undo
563 552
 							try {
564 553
 								// Save the updated state, which is used for the exporter later
565 554
 								$sc->AddParameter($spa, "state", $this->importer->GetState());
566
-							}
567
-							catch (StatusException $stex) {
555
+							} catch (StatusException $stex) {
568 556
 								$status = $stex->getCode();
569 557
 							}
570 558
 						}
@@ -627,8 +615,7 @@  discard block
 block discarded – undo
627 615
 
628 616
 			if (self::$decoder->getElementStartTag(SYNC_PARTIAL)) {
629 617
 				$partial = true;
630
-			}
631
-			else {
618
+			} else {
632 619
 				$partial = false;
633 620
 			}
634 621
 
@@ -657,13 +644,11 @@  discard block
 block discarded – undo
657 644
 			// Load all collections - do not overwrite existing (received!), load states, check permissions and only load confirmed states!
658 645
 			try {
659 646
 				$sc->LoadAllCollections(false, true, true, true, true);
660
-			}
661
-			catch (StateInvalidException $siex) {
647
+			} catch (StateInvalidException $siex) {
662 648
 				$status = SYNC_STATUS_INVALIDSYNCKEY;
663 649
 				self::$topCollector->AnnounceInformation("StateNotFoundException", $this->singleFolder);
664 650
 				$this->saveMultiFolderInfo("exception", "StateNotFoundException");
665
-			}
666
-			catch (StatusException $stex) {
651
+			} catch (StatusException $stex) {
667 652
 				$status = SYNC_STATUS_FOLDERHIERARCHYCHANGED;
668 653
 				self::$topCollector->AnnounceInformation(sprintf("StatusException code: %d", $status), $this->singleFolder);
669 654
 				$this->saveMultiFolderInfo("exception", "StatusException");
@@ -686,8 +671,7 @@  discard block
 block discarded – undo
686 671
 			if (!$sc->HasCollections()) {
687 672
 				$status = SYNC_STATUS_SYNCREQUESTINCOMPLETE;
688 673
 			}
689
-		}
690
-		elseif (isset($hbinterval)) {
674
+		} elseif (isset($hbinterval)) {
691 675
 			// load the hierarchy data - there are no permissions to verify so we just set it to false
692 676
 			if (!$sc->LoadCollection(false, true, false)) {
693 677
 				$status = SYNC_STATUS_FOLDERHIERARCHYCHANGED;
@@ -730,12 +714,10 @@  discard block
 block discarded – undo
730 714
 					// always check for changes
731 715
 					SLog::Write(LOGLEVEL_DEBUG, sprintf("HandleSync(): Entering Heartbeat mode"));
732 716
 					$foundchanges = $sc->CheckForChanges($sc->GetLifetime(), $interval);
733
-				}
734
-				catch (StatusException $stex) {
717
+				} catch (StatusException $stex) {
735 718
 					if ($stex->getCode() == SyncCollections::OBSOLETE_CONNECTION) {
736 719
 						$status = SYNC_COMMONSTATUS_SYNCSTATEVERSIONINVALID;
737
-					}
738
-					else {
720
+					} else {
739 721
 						$status = SYNC_STATUS_FOLDERHIERARCHYCHANGED;
740 722
 						self::$topCollector->AnnounceInformation(sprintf("StatusException code: %d", $status), $this->singleFolder);
741 723
 						$this->saveMultiFolderInfo("exception", "StatusException");
@@ -752,8 +734,7 @@  discard block
 block discarded – undo
752 734
 					foreach ($sc as $folderid => $spa) {
753 735
 						if (self::$deviceManager->CheckHearbeatStateIntegrity($spa->GetFolderId(), $spa->GetUuid(), $spa->GetUuidCounter())) {
754 736
 							$status = SYNC_COMMONSTATUS_SYNCSTATEVERSIONINVALID;
755
-						}
756
-						else {
737
+						} else {
757 738
 							$sc->SaveCollection($spa);
758 739
 						}
759 740
 					}
@@ -774,8 +755,7 @@  discard block
 block discarded – undo
774 755
 						if ($changecount > 0 && $sc->WaitedForChanges() && self::$deviceManager->CheckHearbeatStateIntegrity($spa->GetFolderId(), $spa->GetUuid(), $spa->GetUuidCounter())) {
775 756
 							SLog::Write(LOGLEVEL_DEBUG, sprintf("HandleSync(): heartbeat: found %d changes in '%s' which was already synchronized. Heartbeat aborted!", $changecount, $folderid));
776 757
 							$status = SYNC_COMMONSTATUS_SYNCSTATEVERSIONINVALID;
777
-						}
778
-						else {
758
+						} else {
779 759
 							SLog::Write(LOGLEVEL_DEBUG, sprintf("HandleSync(): heartbeat: found %d changes in '%s'", $changecount, $folderid));
780 760
 						}
781 761
 					}
@@ -875,8 +855,7 @@  discard block
 block discarded – undo
875 855
 							if ($exporter === false) {
876 856
 								throw new StatusException(sprintf("HandleSync() could not get an exporter for folder id %s/%s", $spa->GetFolderId(), $spa->GetBackendFolderId()), SYNC_STATUS_FOLDERHIERARCHYCHANGED);
877 857
 							}
878
-						}
879
-						catch (StatusException $stex) {
858
+						} catch (StatusException $stex) {
880 859
 							$status = $stex->getCode();
881 860
 						}
882 861
 
@@ -891,12 +870,10 @@  discard block
 block discarded – undo
891 870
 
892 871
 								$changecount = $exporter->GetChangeCount();
893 872
 							}
894
-						}
895
-						catch (StatusException $stex) {
873
+						} catch (StatusException $stex) {
896 874
 							if ($stex->getCode() === SYNC_FSSTATUS_CODEUNKNOWN && $spa->HasSyncKey()) {
897 875
 								$status = SYNC_STATUS_INVALIDSYNCKEY;
898
-							}
899
-							else {
876
+							} else {
900 877
 								$status = $stex->getCode();
901 878
 							}
902 879
 						}
@@ -910,8 +887,7 @@  discard block
 block discarded – undo
910 887
 							if ($changecount > 0) {
911 888
 								self::$deviceManager->SetFolderSyncStatus($folderid, DeviceManager::FLD_SYNC_INITIALIZED);
912 889
 							}
913
-						}
914
-						elseif ($status != SYNC_STATUS_SUCCESS) {
890
+						} elseif ($status != SYNC_STATUS_SUCCESS) {
915 891
 							self::$topCollector->AnnounceInformation(sprintf("StatusException code: %d", $status), $this->singleFolder);
916 892
 							$this->saveMultiFolderInfo("exception", "StatusException");
917 893
 						}
@@ -1055,8 +1031,7 @@  discard block
 block discarded – undo
1055 1031
 		self::$encoder->startTag(SYNC_SYNCKEY);
1056 1032
 		if ($status == SYNC_STATUS_SUCCESS && $spa->HasNewSyncKey()) {
1057 1033
 			self::$encoder->content($spa->GetNewSyncKey());
1058
-		}
1059
-		else {
1034
+		} else {
1060 1035
 			self::$encoder->content($spa->GetSyncKey());
1061 1036
 		}
1062 1037
 		self::$encoder->endTag();
@@ -1150,8 +1125,7 @@  discard block
 block discarded – undo
1150 1125
 						SLog::Write(LOGLEVEL_DEBUG, sprintf("HandleSync(): message not to be streamed as requested by DeviceManager, id = %s", $id));
1151 1126
 						$fetchstatus = SYNC_STATUS_CLIENTSERVERCONVERSATIONERROR;
1152 1127
 					}
1153
-				}
1154
-				catch (StatusException $stex) {
1128
+				} catch (StatusException $stex) {
1155 1129
 					$fetchstatus = $stex->getCode();
1156 1130
 				}
1157 1131
 
@@ -1168,8 +1142,7 @@  discard block
 block discarded – undo
1168 1142
 					self::$encoder->startTag(SYNC_DATA);
1169 1143
 					$data->Encode(self::$encoder);
1170 1144
 					self::$encoder->endTag();
1171
-				}
1172
-				else {
1145
+				} else {
1173 1146
 					SLog::Write(LOGLEVEL_WARN, sprintf("Unable to Fetch '%s'", $id));
1174 1147
 				}
1175 1148
 				self::$encoder->endTag();
@@ -1215,13 +1188,11 @@  discard block
 block discarded – undo
1215 1188
 					if ($n % 10 == 0) {
1216 1189
 						self::$topCollector->AnnounceInformation(sprintf("Streamed data of %d objects out of %d", $n, (($changecount > $windowSize) ? $windowSize : $changecount)));
1217 1190
 					}
1218
-				}
1219
-				catch (SyncObjectBrokenException $mbe) {
1191
+				} catch (SyncObjectBrokenException $mbe) {
1220 1192
 					$brokenSO = $mbe->GetSyncObject();
1221 1193
 					if (!$brokenSO) {
1222 1194
 						SLog::Write(LOGLEVEL_ERROR, sprintf("HandleSync(): Caught SyncObjectBrokenException but broken SyncObject not available. This should be fixed in the backend."));
1223
-					}
1224
-					else {
1195
+					} else {
1225 1196
 						if (!isset($brokenSO->id)) {
1226 1197
 							$brokenSO->id = "Unknown ID";
1227 1198
 							SLog::Write(LOGLEVEL_ERROR, sprintf("HandleSync(): Caught SyncObjectBrokenException but no ID of object set. This should be fixed in the backend."));
@@ -1285,13 +1256,11 @@  discard block
 block discarded – undo
1285 1256
 					$newFolderStatAfterExport = self::$backend->GetFolderStat(GSync::GetAdditionalSyncFolderStore($spa->GetBackendFolderId()), $spa->GetBackendFolderId());
1286 1257
 					if ($newFolderStat === $newFolderStatAfterExport) {
1287 1258
 						$this->setFolderStat($spa, $newFolderStat);
1288
-					}
1289
-					else {
1259
+					} else {
1290 1260
 						SLog::Write(LOGLEVEL_DEBUG, "Sync() Folderstat differs after export, force another exporter run.");
1291 1261
 					}
1292 1262
 				}
1293
-			}
1294
-			else {
1263
+			} else {
1295 1264
 				self::$deviceManager->SetFolderSyncStatus($spa->GetFolderId(), DeviceManager::FLD_SYNC_INPROGRESS);
1296 1265
 			}
1297 1266
 		}
@@ -1316,15 +1285,13 @@  discard block
 block discarded – undo
1316 1285
 				elseif (!$spa->HasSyncKey()) {
1317 1286
 					$state = "";
1318 1287
 				}
1319
-			}
1320
-			catch (StatusException $stex) {
1288
+			} catch (StatusException $stex) {
1321 1289
 				$status = $stex->getCode();
1322 1290
 			}
1323 1291
 
1324 1292
 			if (isset($state) && $status == SYNC_STATUS_SUCCESS) {
1325 1293
 				self::$deviceManager->GetStateManager()->SetSyncState($spa->GetNewSyncKey(), $state, $spa->GetFolderId());
1326
-			}
1327
-			else {
1294
+			} else {
1328 1295
 				SLog::Write(LOGLEVEL_ERROR, sprintf("HandleSync(): error saving '%s' - no state information available", $spa->GetNewSyncKey()));
1329 1296
 			}
1330 1297
 		}
@@ -1365,13 +1332,11 @@  discard block
 block discarded – undo
1365 1332
 				if (!self::$backend->Setup(GSync::GetAdditionalSyncFolderStore($spa->GetBackendFolderId()))) {
1366 1333
 					throw new StatusException(sprintf("HandleSync() could not Setup() the backend for folder id %s/%s", $spa->GetFolderId(), $spa->GetBackendFolderId()), SYNC_STATUS_FOLDERHIERARCHYCHANGED);
1367 1334
 				}
1368
-			}
1369
-			catch (StateNotFoundException $snfex) {
1335
+			} catch (StateNotFoundException $snfex) {
1370 1336
 				$status = SYNC_STATUS_INVALIDSYNCKEY;
1371 1337
 				self::$topCollector->AnnounceInformation("StateNotFoundException", $this->singleFolder);
1372 1338
 				$this->saveMultiFolderInfo("exception", "StateNotFoundException");
1373
-			}
1374
-			catch (StatusException $stex) {
1339
+			} catch (StatusException $stex) {
1375 1340
 				$status = $stex->getCode();
1376 1341
 				self::$topCollector->AnnounceInformation(sprintf("StatusException code: %d", $status), $this->singleFolder);
1377 1342
 				$this->saveMultiFolderInfo("exception", "StateNotFoundException");
@@ -1411,8 +1376,7 @@  discard block
 block discarded – undo
1411 1376
 				// if there is a valid state obtained after importing changes in a previous loop, we use that state
1412 1377
 				if (isset($actiondata["failstate"], $actiondata["failstate"]["failedsyncstate"])) {
1413 1378
 					$this->importer->Config($actiondata["failstate"]["failedsyncstate"], $spa->GetConflict());
1414
-				}
1415
-				else {
1379
+				} else {
1416 1380
 					$this->importer->Config($sc->GetParameter($spa, "state"), $spa->GetConflict());
1417 1381
 				}
1418 1382
 
@@ -1420,8 +1384,7 @@  discard block
 block discarded – undo
1420 1384
 				$this->importer->ConfigContentParameters($spa->GetCPO());
1421 1385
 				$this->importer->LoadConflicts($spa->GetCPO(), $sc->GetParameter($spa, "state"));
1422 1386
 			}
1423
-		}
1424
-		catch (StatusException $stex) {
1387
+		} catch (StatusException $stex) {
1425 1388
 			$status = $stex->getCode();
1426 1389
 		}
1427 1390
 
@@ -1503,13 +1466,11 @@  discard block
 block discarded – undo
1503 1466
 						// check incoming message without logging WARN messages about errors
1504 1467
 						elseif (!($message instanceof SyncObject) || !$message->Check(true)) {
1505 1468
 							$actiondata["statusids"][$serverid] = SYNC_STATUS_CLIENTSERVERCONVERSATIONERROR;
1506
-						}
1507
-						else {
1469
+						} else {
1508 1470
 							if (isset($message->read)) {
1509 1471
 								// Currently, 'read' is only sent by the PDA when it is ONLY setting the read flag.
1510 1472
 								$this->importer->ImportMessageReadFlag($serverid, $message->read);
1511
-							}
1512
-							elseif (!isset($message->flag)) {
1473
+							} elseif (!isset($message->flag)) {
1513 1474
 								$this->importer->ImportMessageChange($serverid, $message);
1514 1475
 							}
1515 1476
 
@@ -1521,8 +1482,7 @@  discard block
 block discarded – undo
1521 1482
 
1522 1483
 							$actiondata["statusids"][$serverid] = SYNC_STATUS_SUCCESS;
1523 1484
 						}
1524
-					}
1525
-					catch (StatusException $stex) {
1485
+					} catch (StatusException $stex) {
1526 1486
 						$actiondata["statusids"][$serverid] = $stex->getCode();
1527 1487
 					}
1528 1488
 					break;
@@ -1546,14 +1506,12 @@  discard block
 block discarded – undo
1546 1506
 						elseif (!($message instanceof SyncObject) || !$message->Check(true)) {
1547 1507
 							$actiondata["clientids"][$clientid] = false;
1548 1508
 							$actiondata["statusids"][$clientid] = SYNC_STATUS_CLIENTSERVERCONVERSATIONERROR;
1549
-						}
1550
-						else {
1509
+						} else {
1551 1510
 							$actiondata["clientids"][$clientid] = false;
1552 1511
 							$actiondata["clientids"][$clientid] = $this->importer->ImportMessageChange(false, $message);
1553 1512
 							$actiondata["statusids"][$clientid] = SYNC_STATUS_SUCCESS;
1554 1513
 						}
1555
-					}
1556
-					catch (StatusException $stex) {
1514
+					} catch (StatusException $stex) {
1557 1515
 						$actiondata["statusids"][$clientid] = $stex->getCode();
1558 1516
 					}
1559 1517
 					break;
@@ -1568,8 +1526,7 @@  discard block
 block discarded – undo
1568 1526
 							SLog::Write(LOGLEVEL_DEBUG, "SMS sync are not supported. Ignoring message.");
1569 1527
 							// TODO we should delete the SMS
1570 1528
 							$actiondata["statusids"][$serverid] = SYNC_STATUS_SUCCESS;
1571
-						}
1572
-						else {
1529
+						} else {
1573 1530
 							// if message deletions are to be moved, move them
1574 1531
 							if ($spa->GetDeletesAsMoves()) {
1575 1532
 								$folderid = self::$backend->GetWasteBasket();
@@ -1587,8 +1544,7 @@  discard block
 block discarded – undo
1587 1544
 							$this->importer->ImportMessageDeletion($serverid);
1588 1545
 							$actiondata["statusids"][$serverid] = SYNC_STATUS_SUCCESS;
1589 1546
 						}
1590
-					}
1591
-					catch (StatusException $stex) {
1547
+					} catch (StatusException $stex) {
1592 1548
 						if ($stex->getCode() != SYNC_MOVEITEMSSTATUS_SUCCESS) {
1593 1549
 							$actiondata["statusids"][$serverid] = SYNC_STATUS_OBJECTNOTFOUND;
1594 1550
 						}
@@ -1636,11 +1592,9 @@  discard block
 block discarded – undo
1636 1592
 		}
1637 1593
 		if (isset($this->multiFolderInfo["outgoing"], $this->multiFolderInfo["queued"]) && $this->multiFolderInfo["outgoing"] > 0) {
1638 1594
 			$s .= sprintf(": Streamed %d out of %d", $this->multiFolderInfo["outgoing"], $this->multiFolderInfo["queued"]);
1639
-		}
1640
-		elseif (!isset($this->multiFolderInfo["outgoing"]) && !isset($this->multiFolderInfo["queued"])) {
1595
+		} elseif (!isset($this->multiFolderInfo["outgoing"]) && !isset($this->multiFolderInfo["queued"])) {
1641 1596
 			$s .= ": no changes";
1642
-		}
1643
-		else {
1597
+		} else {
1644 1598
 			if (isset($this->multiFolderInfo["outgoing"])) {
1645 1599
 				$s .= "/" . $this->multiFolderInfo["outgoing"] . " streamed";
1646 1600
 			}
Please login to merge, or discard this patch.
lib/log/syslog.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -102,8 +102,7 @@  discard block
 block discarded – undo
102 102
 				if (isset($match[1])) {
103 103
 					return $this->GetProgramName() . '/' . $match[1];
104 104
 				}
105
-			}
106
-			elseif (basename($trace['file'], '.php') != 'slog') {
105
+			} elseif (basename($trace['file'], '.php') != 'slog') {
107 106
 				return $this->GetProgramName() . '/core';
108 107
 			}
109 108
 		}
@@ -162,8 +161,7 @@  discard block
 block discarded – undo
162 161
 		// when the users differ, we need to log both
163 162
 		if (strcasecmp($this->GetAuthUser(), $this->GetUser()) == 0) {
164 163
 			$log .= ' [' . $this->GetUser() . ']';
165
-		}
166
-		else {
164
+		} else {
167 165
 			$log .= ' [' . $this->GetAuthUser() . Request::IMPERSONATE_DELIM . $this->GetUser() . ']';
168 166
 		}
169 167
 		if ($loglevel >= LOGLEVEL_DEVICEID) {
@@ -195,8 +193,7 @@  discard block
 block discarded – undo
195 193
 				socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, $this->GetHost(), $this->GetPort());
196 194
 			}
197 195
 			socket_close($sock);
198
-		}
199
-		else {
196
+		} else {
200 197
 			openlog($this->GenerateProgramName(), LOG_PID, LOG_SYSLOG_FACILITY);
201 198
 			syslog(
202 199
 				$this->GetGsyncLogLevelToSyslogLogLevel($loglevel),
Please login to merge, or discard this patch.
lib/log/filelog.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,8 +28,7 @@  discard block
 block discarded – undo
28 28
 		if ($this->log_to_user_file === false) {
29 29
 			if (in_array(strtolower($this->GetDevid()), ['', 'validate'])) {
30 30
 				$this->setLogToUserFile(preg_replace('/[^a-z0-9]/', '_', strtolower($this->GetAuthUser())) . '.log');
31
-			}
32
-			else {
31
+			} else {
33 32
 				$this->setLogToUserFile(
34 33
 					preg_replace('/[^a-z0-9]/', '_', strtolower($this->GetAuthUser())) . '-' .
35 34
 						(($this->GetAuthUser() != $this->GetUser()) ? preg_replace('/[^a-z0-9]/', '_', strtolower($this->GetUser())) . '-' : '') .
@@ -67,8 +66,7 @@  discard block
 block discarded – undo
67 66
 			// when the users differ, we need to log both
68 67
 			if (strcasecmp($this->GetAuthUser(), $this->GetUser()) == 0) {
69 68
 				$log .= ' [' . $this->GetUser() . ']';
70
-			}
71
-			else {
69
+			} else {
72 70
 				$log .= ' [' . $this->GetAuthUser() . Request::IMPERSONATE_DELIM . $this->GetUser() . ']';
73 71
 			}
74 72
 		}
Please login to merge, or discard this patch.
lib/log/log.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -232,8 +232,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.