Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Branch master (287493)
by Dan
06:08
created
lib/Default/missions.inc 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -135,16 +135,14 @@
 block discarded – undo
135 135
 		}
136 136
 		if(is_array($values)) {
137 137
 			$value = $values[$reqName];
138
-		}
139
-		else if(is_object($values)) {
138
+		} else if(is_object($values)) {
140 139
 			$value = $values->$reqName();
141 140
 		}
142 141
 		if(is_array($req)) {
143 142
 			if(checkMissionRequirements($value, $mission, $player, $req) === false) {
144 143
 				return false;
145 144
 			}
146
-		}
147
-		else {
145
+		} else {
148 146
 			if($value != $req) {
149 147
 				return false;
150 148
 			}
Please login to merge, or discard this patch.
lib/Default/SmrSector.class.inc 1 patch
Braces   +167 added lines, -116 removed lines patch added patch discarded remove patch
@@ -126,15 +126,13 @@  discard block
 block discarded – undo
126 126
 				$this->links['Right'] = $db->getInt('link_right');
127 127
 			}
128 128
 			$this->warp = $db->getInt('warp');
129
-		}
130
-		else if($create) {
129
+		} else if($create) {
131 130
 			$this->battles		= 0;
132 131
 			$this->links = array();
133 132
 			$this->warp = 0;
134 133
 			$this->isNew		= true;
135 134
 			return;
136
-		}
137
-		else {
135
+		} else {
138 136
 			throw new SectorNotFoundException('No such sector: '.$gameID.'-'.$sectorID);
139 137
 		}
140 138
 	}
@@ -150,8 +148,7 @@  discard block
 block discarded – undo
150 148
 									', link_left=' . $this->db->escapeNumber($this->getLinkLeft()) .
151 149
 									', warp=' . $this->db->escapeNumber($this->getWarp()) .
152 150
 								' WHERE ' . $this->SQL . ' LIMIT 1');
153
-			}
154
-			else {
151
+			} else {
155 152
 				$this->db->query('INSERT INTO sector(sector_id,game_id,galaxy_id,link_up,link_down,link_left,link_right,warp)
156 153
 								values
157 154
 								(' . $this->db->escapeNumber($this->getSectorID()) .
@@ -169,21 +166,24 @@  discard block
 block discarded – undo
169 166
 	}
170 167
 
171 168
 	function markVisited(AbstractSmrPlayer $player) {
172
-		if($this->hasPort())
173
-			$this->getPort()->addCachePort($player->getAccountID());
169
+		if($this->hasPort()) {
170
+					$this->getPort()->addCachePort($player->getAccountID());
171
+		}
174 172
 
175 173
 		//now delete the entry from visited
176
-		if(!$this->isVisited($player))
177
-			$this->db->query('DELETE FROM player_visited_sector WHERE ' . $this->SQL . '
174
+		if(!$this->isVisited($player)) {
175
+					$this->db->query('DELETE FROM player_visited_sector WHERE ' . $this->SQL . '
178 176
 								 AND account_id = ' . $this->db->escapeNumber($player->getAccountID()) . ' LIMIT 1');
177
+		}
179 178
 		$this->visited[$player->getAccountID()]=true;
180 179
 	}
181 180
 
182 181
 	function hasWeaponShop() {
183 182
 		$locations = $this->getLocations();
184 183
 		foreach($locations as $location) {
185
-			if($location->isWeaponSold())
186
-				return true;
184
+			if($location->isWeaponSold()) {
185
+							return true;
186
+			}
187 187
 		}
188 188
 		return false;
189 189
 	}
@@ -191,8 +191,9 @@  discard block
 block discarded – undo
191 191
 	function hasHQ() {
192 192
 		$locations = $this->getLocations();
193 193
 		foreach($locations as $location) {
194
-			if($location->isHQ())
195
-				return true;
194
+			if($location->isHQ()) {
195
+							return true;
196
+			}
196 197
 		}
197 198
 		return false;
198 199
 	}
@@ -200,8 +201,9 @@  discard block
 block discarded – undo
200 201
 	function hasUG() {
201 202
 		$locations = $this->getLocations();
202 203
 		foreach($locations as $location) {
203
-			if($location->isUG())
204
-				return true;
204
+			if($location->isUG()) {
205
+							return true;
206
+			}
205 207
 		}
206 208
 		return false;
207 209
 	}
@@ -209,8 +211,9 @@  discard block
 block discarded – undo
209 211
 	function hasShipShop() {
210 212
 		$locations = $this->getLocations();
211 213
 		foreach($locations as $location) {
212
-			if($location->isShipSold())
213
-				return true;
214
+			if($location->isShipSold()) {
215
+							return true;
216
+			}
214 217
 		}
215 218
 		return false;
216 219
 	}
@@ -218,8 +221,9 @@  discard block
 block discarded – undo
218 221
 	function offersFederalProtection() {
219 222
 		$locations = $this->getLocations();
220 223
 		foreach($locations as $location) {
221
-			if($location->isFed())
222
-				return true;
224
+			if($location->isFed()) {
225
+							return true;
226
+			}
223 227
 		}
224 228
 		return false;
225 229
 	}
@@ -228,8 +232,9 @@  discard block
 block discarded – undo
228 232
 		$raceIDs = array();
229 233
 		$locations = $this->getLocations();
230 234
 		foreach($locations as $location) {
231
-			if($location->isFed())
232
-				$raceIDs[$location->getRaceID()] = $location->getRaceID();
235
+			if($location->isFed()) {
236
+							$raceIDs[$location->getRaceID()] = $location->getRaceID();
237
+			}
233 238
 		}
234 239
 		return $raceIDs;
235 240
 	}
@@ -237,8 +242,9 @@  discard block
 block discarded – undo
237 242
 	function hasBar() {
238 243
 		$locations = $this->getLocations();
239 244
 		foreach($locations as $location) {
240
-			if($location->isBar())
241
-				return true;
245
+			if($location->isBar()) {
246
+							return true;
247
+			}
242 248
 		}
243 249
 		return false;
244 250
 	}
@@ -246,8 +252,9 @@  discard block
 block discarded – undo
246 252
 	function hasHardwareShop() {
247 253
 		$locations = $this->getLocations();
248 254
 		foreach($locations as $location) {
249
-			if($location->isHardwareSold())
250
-				return true;
255
+			if($location->isHardwareSold()) {
256
+							return true;
257
+			}
251 258
 		}
252 259
 		return false;
253 260
 	}
@@ -255,8 +262,9 @@  discard block
 block discarded – undo
255 262
 	function hasBank() {
256 263
 		$locations = $this->getLocations();
257 264
 		foreach($locations as $location) {
258
-			if($location->isBank())
259
-				return true;
265
+			if($location->isBank()) {
266
+							return true;
267
+			}
260 268
 		}
261 269
 		return false;
262 270
 	}
@@ -331,8 +339,9 @@  discard block
 block discarded – undo
331 339
 	}
332 340
 
333 341
 	public function setGalaxyID($galaxyID) {
334
-		if($this->galaxyID==$galaxyID)
335
-			return;
342
+		if($this->galaxyID==$galaxyID) {
343
+					return;
344
+		}
336 345
 		$this->galaxyID=$galaxyID;
337 346
 		$this->hasChanged=true;
338 347
 	}
@@ -343,18 +352,21 @@  discard block
 block discarded – undo
343 352
 
344 353
 	public function getNumberOfLinks() {
345 354
 		$num=0;
346
-		if(!is_array($this->getLinks()))
347
-			return $num;
348
-		foreach($this->getLinks() as $link)
349
-			if($link!==0)
355
+		if(!is_array($this->getLinks())) {
356
+					return $num;
357
+		}
358
+		foreach($this->getLinks() as $link) {
359
+					if($link!==0)
350 360
 				$num++;
361
+		}
351 362
 		return $num;
352 363
 	}
353 364
 
354 365
 	public function getNumberOfConnections() {
355 366
 		$links = $this->getNumberOfLinks();
356
-		if($this->hasWarp())
357
-			$links++;
367
+		if($this->hasWarp()) {
368
+					$links++;
369
+		}
358 370
 		return $links;
359 371
 	}
360 372
 
@@ -363,30 +375,35 @@  discard block
 block discarded – undo
363 375
 	}
364 376
 
365 377
 	public function getNeighbourID($dir) {
366
-		if($this->hasLink($dir))
367
-			return $this->getLink($dir);
378
+		if($this->hasLink($dir)) {
379
+					return $this->getLink($dir);
380
+		}
368 381
 		$galaxy = $this->getGalaxy();
369 382
 		$neighbour = $this->getSectorID();
370 383
 		switch($dir) {
371 384
 			case 'Up':
372 385
 				$neighbour -= $galaxy->getWidth();
373
-				if($neighbour<$galaxy->getStartSector())
374
-					$neighbour+=$galaxy->getSize();
386
+				if($neighbour<$galaxy->getStartSector()) {
387
+									$neighbour+=$galaxy->getSize();
388
+				}
375 389
 			break;
376 390
 			case 'Down':
377 391
 				$neighbour += $galaxy->getWidth();
378
-				if($neighbour>$galaxy->getEndSector())
379
-					$neighbour-=$galaxy->getSize();
392
+				if($neighbour>$galaxy->getEndSector()) {
393
+									$neighbour-=$galaxy->getSize();
394
+				}
380 395
 			break;
381 396
 			case 'Left':
382 397
 				$neighbour -= 1;
383
-				if((1+$neighbour-$galaxy->getStartSector())%$galaxy->getWidth()==0)
384
-					$neighbour+=$galaxy->getWidth();
398
+				if((1+$neighbour-$galaxy->getStartSector())%$galaxy->getWidth()==0) {
399
+									$neighbour+=$galaxy->getWidth();
400
+				}
385 401
 			break;
386 402
 			case 'Right':
387 403
 				$neighbour += 1;
388
-				if(($neighbour-$galaxy->getStartSector())%$galaxy->getWidth()==0)
389
-					$neighbour-=$galaxy->getWidth();
404
+				if(($neighbour-$galaxy->getStartSector())%$galaxy->getWidth()==0) {
405
+									$neighbour-=$galaxy->getWidth();
406
+				}
390 407
 			break;
391 408
 			default:
392 409
 				throw new Exception($dir.': is not a valid direction');
@@ -395,13 +412,16 @@  discard block
 block discarded – undo
395 412
 	}
396 413
 
397 414
 	public function getSectorDirection($sectorID) {
398
-		if($sectorID == $this->getSectorID())
399
-			return 'Current';
415
+		if($sectorID == $this->getSectorID()) {
416
+					return 'Current';
417
+		}
400 418
 		$dir = array_search($sectorID, $this->getLinks());
401
-		if($dir !== false)
402
-			return $dir;
403
-		if($sectorID == $this->getWarp())
404
-			return 'Warp';
419
+		if($dir !== false) {
420
+					return $dir;
421
+		}
422
+		if($sectorID == $this->getWarp()) {
423
+					return 'Warp';
424
+		}
405 425
 		return 'None';
406 426
 	}
407 427
 
@@ -426,8 +446,9 @@  discard block
 block discarded – undo
426 446
 	}
427 447
 
428 448
 	public function &getLinkSector($name) {
429
-		if($this->hasLink($name))
430
-			return SmrSector::getSector($this->getGameID(),$this->getLink($name));
449
+		if($this->hasLink($name)) {
450
+					return SmrSector::getSector($this->getGameID(),$this->getLink($name));
451
+		}
431 452
 		return false;
432 453
 	}
433 454
 
@@ -435,12 +456,14 @@  discard block
 block discarded – undo
435 456
 	 * Cannot be used for Warps
436 457
 	 */
437 458
 	public function setLink($name,$linkID) {
438
-		if($this->getLink($name)==$linkID)
439
-			return;
440
-		if($linkID==0)
441
-			unset($this->links[$name]);
442
-		else
443
-			$this->links[$name] = $linkID;
459
+		if($this->getLink($name)==$linkID) {
460
+					return;
461
+		}
462
+		if($linkID==0) {
463
+					unset($this->links[$name]);
464
+		} else {
465
+					$this->links[$name] = $linkID;
466
+		}
444 467
 		$this->hasChanged=true;
445 468
 	}
446 469
 
@@ -448,8 +471,9 @@  discard block
 block discarded – undo
448 471
 	 * Cannot be used for Warps
449 472
 	 */
450 473
 	public function setLinkSector($dir,SmrSector $linkSector) {
451
-		if($this->getLink($dir)==$linkSector->getSectorID()||$linkSector->equals($this))
452
-			return;
474
+		if($this->getLink($dir)==$linkSector->getSectorID()||$linkSector->equals($this)) {
475
+					return;
476
+		}
453 477
 		$this->setLink($dir,$linkSector->getSectorID());
454 478
 		$linkSector->setLink(self::oppositeDir($dir),$this->getSectorID());
455 479
 		$this->hasChanged=true;
@@ -473,8 +497,7 @@  discard block
 block discarded – undo
473 497
 	public function toggleLink($dir) {
474 498
 		if($this->hasLink($dir)) {
475 499
 			$this->disableLink($dir);
476
-		}
477
-		else {
500
+		} else {
478 501
 			$this->enableLink($dir);
479 502
 		}
480 503
 	}
@@ -634,21 +657,25 @@  discard block
 block discarded – undo
634 657
 		$locations = SmrLocation::getSectorLocations($this->getGameID(),$this->getSectorID());
635 658
 		$hasAction = false;
636 659
 		foreach($locations as $location) {
637
-			if($location->hasAction())
638
-				$hasAction = true;
660
+			if($location->hasAction()) {
661
+							$hasAction = true;
662
+			}
639 663
 		}
640 664
 		return $hasAction;
641 665
 	}
642 666
 
643 667
 	public function hasLocation($locationTypeID=false) {
644 668
 		$locations = $this->getLocations();
645
-		if(count($locations) == 0)
646
-			return false;
647
-		if($locationTypeID==false)
648
-			return true;
669
+		if(count($locations) == 0) {
670
+					return false;
671
+		}
672
+		if($locationTypeID==false) {
673
+					return true;
674
+		}
649 675
 		foreach($locations as $location) {
650
-			if($location->getTypeID()==$locationTypeID)
651
-				return true;
676
+			if($location->getTypeID()==$locationTypeID) {
677
+							return true;
678
+			}
652 679
 		}
653 680
 		return false;
654 681
 	}
@@ -689,24 +716,28 @@  discard block
 block discarded – undo
689 716
 	}
690 717
 
691 718
 	public function hasEnemyForces(AbstractSmrPlayer $player=null) {
692
-		if($player == null || !$this->hasForces())
693
-			return false;
719
+		if($player == null || !$this->hasForces()) {
720
+					return false;
721
+		}
694 722
 		$forces = $this->getForces();
695 723
 		foreach($forces as $force) {
696
-			if(!$player->forceNAPAlliance($force->getOwner()))
697
-				return true;
724
+			if(!$player->forceNAPAlliance($force->getOwner())) {
725
+							return true;
726
+			}
698 727
 		}
699 728
 		return false;
700 729
 	}
701 730
 
702 731
 	public function &getEnemyForces(AbstractSmrPlayer $player) {
703 732
 		$enemyForces = array();
704
-		if(!$this->hasForces())
705
-			return $enemyForces;
733
+		if(!$this->hasForces()) {
734
+					return $enemyForces;
735
+		}
706 736
 		$forces = $this->getForces();
707 737
 		foreach($forces as $force) {
708
-			if(!$player->forceNAPAlliance($force->getOwner()))
709
-				$enemyForces[] = $force;
738
+			if(!$player->forceNAPAlliance($force->getOwner())) {
739
+							$enemyForces[] = $force;
740
+			}
710 741
 		}
711 742
 		return $enemyForces;
712 743
 	}
@@ -724,24 +755,28 @@  discard block
 block discarded – undo
724 755
 	}
725 756
 
726 757
 	public function hasFriendlyForces(AbstractSmrPlayer $player=null) {
727
-		if($player == null || !$this->hasForces())
728
-			return false;
758
+		if($player == null || !$this->hasForces()) {
759
+					return false;
760
+		}
729 761
 		$forces = $this->getForces();
730 762
 		foreach($forces as $force) {
731
-			if($player->forceNAPAlliance($force->getOwner()))
732
-				return true;
763
+			if($player->forceNAPAlliance($force->getOwner())) {
764
+							return true;
765
+			}
733 766
 		}
734 767
 		return false;
735 768
 	}
736 769
 
737 770
 	public function &getFriendlyForces(AbstractSmrPlayer $player) {
738 771
 		$friendlyForces = array();
739
-		if(!$this->hasForces())
740
-			return $friendlyForces;
772
+		if(!$this->hasForces()) {
773
+					return $friendlyForces;
774
+		}
741 775
 		$forces = $this->getForces();
742 776
 		foreach($forces as $force) {
743
-			if($player->forceNAPAlliance($force->getOwner()))
744
-				$friendlyForces[] = $force;
777
+			if($player->forceNAPAlliance($force->getOwner())) {
778
+							$friendlyForces[] = $force;
779
+			}
745 780
 		}
746 781
 		return $friendlyForces;
747 782
 	}
@@ -769,8 +804,9 @@  discard block
 block discarded – undo
769 804
 	}
770 805
 
771 806
 	public function hasEnemyTraders(AbstractSmrPlayer $player=null) {
772
-		if($player == null || !$this->hasOtherTraders($player))
773
-			return false;
807
+		if($player == null || !$this->hasOtherTraders($player)) {
808
+					return false;
809
+		}
774 810
 		$otherPlayers = $this->getOtherTraders($player);
775 811
 		foreach($otherPlayers as $otherPlayer) {
776 812
 			if(!$player->traderNAPAlliance($otherPlayer) 
@@ -783,12 +819,14 @@  discard block
 block discarded – undo
783 819
 	}
784 820
 
785 821
 	public function hasFriendlyTraders(AbstractSmrPlayer $player=null) {
786
-		if($player == null || !$this->hasOtherTraders($player))
787
-			return false;
822
+		if($player == null || !$this->hasOtherTraders($player)) {
823
+					return false;
824
+		}
788 825
 		$otherPlayers = $this->getOtherTraders($player);
789 826
 		foreach($otherPlayers as $otherPlayer) {
790
-			if($player->traderNAPAlliance($otherPlayer))
791
-				return true;
827
+			if($player->traderNAPAlliance($otherPlayer)) {
828
+							return true;
829
+			}
792 830
 		}
793 831
 		return false;
794 832
 	}
@@ -810,8 +848,9 @@  discard block
 block discarded – undo
810 848
 	}
811 849
 
812 850
 	public function hasProtectedTraders(AbstractSmrPlayer $player=null) {
813
-		if($player == null || !$this->hasOtherTraders($player))
814
-			return false;
851
+		if($player == null || !$this->hasOtherTraders($player)) {
852
+					return false;
853
+		}
815 854
 		$otherPlayers = $this->getOtherTraders($player);
816 855
 		foreach($otherPlayers as $otherPlayer) {
817 856
 			if(!$player->traderNAPAlliance($otherPlayer) 
@@ -830,11 +869,12 @@  discard block
 block discarded – undo
830 869
 	public function &getFightingTradersAgainstPort(AbstractSmrPlayer $attackingPlayer, SmrPort $defendingPort) {
831 870
 		$fightingPlayers = array();
832 871
 		$alliancePlayers = SmrPlayer::getSectorPlayersByAlliances($this->getGameID(),$this->getSectorID(), array($attackingPlayer->getAllianceID()));
833
-		if(count($alliancePlayers) > 0)
834
-			foreach($alliancePlayers as $accountID => $player) {
872
+		if(count($alliancePlayers) > 0) {
873
+					foreach($alliancePlayers as $accountID => $player) {
835 874
 				if($player->canFight()) {
836 875
 					if($attackingPlayer->traderAttackPortAlliance($player))
837 876
 						$fightingPlayers[$accountID] = $alliancePlayers[$accountID];
877
+		}
838 878
 				}
839 879
 			}
840 880
 		return self::limitFightingTraders($fightingPlayers, $attackingPlayer, MAXIMUM_PORT_FLEET_SIZE);
@@ -847,8 +887,9 @@  discard block
 block discarded – undo
847 887
 			$planetOwner = $defendingPlanet->getOwner();
848 888
 			foreach($alliancePlayers as $accountID => $player) {
849 889
 				if($player->canFight()) {
850
-					if($attackingPlayer->traderAttackPlanetAlliance($player) && !$planetOwner->planetNAPAlliance($player))
851
-						$fightingPlayers[$accountID] = $alliancePlayers[$accountID];
890
+					if($attackingPlayer->traderAttackPlanetAlliance($player) && !$planetOwner->planetNAPAlliance($player)) {
891
+											$fightingPlayers[$accountID] = $alliancePlayers[$accountID];
892
+					}
852 893
 				}
853 894
 			}
854 895
 		}
@@ -856,19 +897,21 @@  discard block
 block discarded – undo
856 897
 	}
857 898
 
858 899
 	public function &getFightingTraders(AbstractSmrPlayer $attackingPlayer, AbstractSmrPlayer $defendingPlayer, $checkForCloak=false) {
859
-		if($attackingPlayer->traderNAPAlliance($defendingPlayer))
860
-			throw new Exception('These traders are NAPed.');
900
+		if($attackingPlayer->traderNAPAlliance($defendingPlayer)) {
901
+					throw new Exception('These traders are NAPed.');
902
+		}
861 903
 		$fightingPlayers = array('Attackers' => array(), 'Defenders' => array());
862 904
 		$alliancePlayers = SmrPlayer::getSectorPlayersByAlliances($this->getGameID(),$this->getSectorID(), array($attackingPlayer->getAllianceID(), $defendingPlayer->getAllianceID()));
863 905
 		$attackers = array();
864 906
 		$defenders = array();
865
-		if(count($alliancePlayers) > 0)
866
-			foreach($alliancePlayers as $accountID => $player) {
907
+		if(count($alliancePlayers) > 0) {
908
+					foreach($alliancePlayers as $accountID => $player) {
867 909
 				if($player->canFight()) {
868 910
 					if($attackingPlayer->traderAttackTraderAlliance($player) && !$defendingPlayer->traderDefendTraderAlliance($player) && !$defendingPlayer->traderNAPAlliance($player))
869 911
 						$attackers[] = $alliancePlayers[$accountID];
870
-					else if($defendingPlayer->traderDefendTraderAlliance($player) && !$attackingPlayer->traderAttackTraderAlliance($player) && !$attackingPlayer->traderNAPAlliance($player) && ($checkForCloak===false || $attackingPlayer->canSee($player)))
871
-						$defenders[] = $alliancePlayers[$accountID];
912
+		} else if($defendingPlayer->traderDefendTraderAlliance($player) && !$attackingPlayer->traderAttackTraderAlliance($player) && !$attackingPlayer->traderNAPAlliance($player) && ($checkForCloak===false || $attackingPlayer->canSee($player))) {
913
+											$defenders[] = $alliancePlayers[$accountID];
914
+					}
872 915
 				}
873 916
 			}
874 917
 		$attackers = self::limitFightingTraders($attackers, $attackingPlayer, MAXIMUM_PVP_FLEET_SIZE);
@@ -902,11 +945,12 @@  discard block
 block discarded – undo
902 945
 	public function &getPotentialFightingTraders(AbstractSmrPlayer $attackingPlayer) {
903 946
 		$fightingPlayers = array();
904 947
 		$alliancePlayers = SmrPlayer::getSectorPlayersByAlliances($this->getGameID(),$this->getSectorID(), array($attackingPlayer->getAllianceID()));
905
-		if(count($alliancePlayers) > 0)
906
-			foreach($alliancePlayers as $accountID => $player) {
948
+		if(count($alliancePlayers) > 0) {
949
+					foreach($alliancePlayers as $accountID => $player) {
907 950
 				if($player->canFight()) {
908 951
 					if($attackingPlayer->traderAttackTraderAlliance($player))
909 952
 						$fightingPlayers['Attackers'][$accountID] = $player;
953
+		}
910 954
 				}
911 955
 			}
912 956
 		return $fightingPlayers;
@@ -917,8 +961,9 @@  discard block
 block discarded – undo
917 961
 	}
918 962
 
919 963
 	public function setBattles($amount) {
920
-		if($this->battles == $amount)
921
-			return;
964
+		if($this->battles == $amount) {
965
+					return;
966
+		}
922 967
 		$this->battles = $amount;
923 968
 		$this->hasChanged = true;
924 969
 	}
@@ -940,8 +985,9 @@  discard block
 block discarded – undo
940 985
 	}
941 986
 
942 987
 	public function isVisited(AbstractSmrPlayer $player=null) {
943
-		if($player===null)
944
-			return true;
988
+		if($player===null) {
989
+					return true;
990
+		}
945 991
 		if(!isset($this->visited[$player->getAccountID()])) {
946 992
 			$this->db->query('SELECT sector_id FROM player_visited_sector WHERE ' . $this->SQL . ' AND account_id=' . $this->db->escapeNumber($player->getAccountID()) . ' LIMIT 1');
947 993
 			$this->visited[$player->getAccountID()] = !$this->db->nextRecord();
@@ -982,17 +1028,22 @@  discard block
 block discarded – undo
982 1028
 			return $x->contains($this);
983 1029
 		}
984 1030
 
985
-		if(is_array($x) && $x['Type']=='Good') //Check if it's possible for port to have X, hacky but nice performance gains
1031
+		if(is_array($x) && $x['Type']=='Good') {
1032
+			//Check if it's possible for port to have X, hacky but nice performance gains
986 1033
 			if ($this->hasPort())
987 1034
 				if ($this->getPort()->hasX($x))
988 1035
 					return true;
1036
+		}
989 1037
 
990
-		if($x instanceof SmrWeapon || (is_array($x) && ($x['Type']=='Ship'||$x['Type']=='Hardware')) || (is_string($x) && ($x=='Bank'||$x=='Bar'||$x=='Fed'||$x=='SafeFed'||$x=='HQ'||$x=='UG'||$x=='Hardware'||$x=='Ship'||$x=='Weapon'))) //Check if it's possible for location to have X, hacky but nice performance gains
1038
+		if($x instanceof SmrWeapon || (is_array($x) && ($x['Type']=='Ship'||$x['Type']=='Hardware')) || (is_string($x) && ($x=='Bank'||$x=='Bar'||$x=='Fed'||$x=='SafeFed'||$x=='HQ'||$x=='UG'||$x=='Hardware'||$x=='Ship'||$x=='Weapon'))) {
1039
+			//Check if it's possible for location to have X, hacky but nice performance gains
991 1040
 			if ($this->hasLocation()) {
992 1041
 				$locations = $this->getLocations();
1042
+		}
993 1043
 				foreach ($locations as $l) {
994
-					if ($l->hasX($x,$player))
995
-						return true;
1044
+					if ($l->hasX($x,$player)) {
1045
+											return true;
1046
+					}
996 1047
 				}
997 1048
 			}
998 1049
 		return false;
Please login to merge, or discard this patch.
lib/Default/SmrForce.class.inc 1 patch
Braces   +8 added lines, -12 removed lines patch added patch discarded remove patch
@@ -274,16 +274,16 @@  discard block
 block discarded – undo
274 274
 		}
275 275
 		$this->hasChanged = true;
276 276
 		$this->expire = $time;
277
-		if(!$this->isNew)
278
-			$this->update();
277
+		if(!$this->isNew) {
278
+					$this->update();
279
+		}
279 280
 	}
280 281
 
281 282
 	public function updateExpire() {
282 283
 		// Changed (26/10/05) - scout drones count * 2
283 284
 		if($this->getCDs() == 0 && $this->getMines() == 0 && $this->getSDs() > 0) {
284 285
 			$time = self::TIME_PER_SCOUT_ONLY*$this->getSDs();
285
-		}
286
-		else {
286
+		} else {
287 287
 			$time = ($this->getCDs()*self::TIME_PERCENT_PER_COMBAT + $this->getSDs()*self::TIME_PERCENT_PER_SCOUT + $this->getMines()*self::TIME_PERCENT_PER_MINE) * $this->getMaxGalaxyExpireTime();
288 288
 		}
289 289
 		$this->setExpire(TIME + $time);
@@ -310,11 +310,9 @@  discard block
 block discarded – undo
310 310
 		}
311 311
 		if($mines < 10) {
312 312
 			$turns = 1;
313
-		}
314
-		else if($mines < 25) {
313
+		} else if($mines < 25) {
315 314
 			$turns = 2;
316
-		}
317
-		else {
315
+		} else {
318 316
 			$turns = 3;
319 317
 		}
320 318
 		if($ship->isFederal() || $ship->hasDCS()) {
@@ -369,12 +367,10 @@  discard block
 block discarded – undo
369 367
 			if (!$this->exists()) {
370 368
 				$this->db->query('DELETE FROM sector_has_forces WHERE ' . $this->SQL);
371 369
 				$this->isNew=true;
372
-			}
373
-			else if ($this->hasChanged) {
370
+			} else if ($this->hasChanged) {
374 371
 				$this->db->query('UPDATE sector_has_forces SET combat_drones = '.$this->db->escapeNumber($this->combatDrones).', scout_drones = ' . $this->db->escapeNumber($this->scoutDrones) . ', mines = ' . $this->db->escapeNumber($this->mines) . ', expire_time = ' . $this->db->escapeNumber($this->expire) . ' WHERE ' . $this->SQL);
375 372
 			}
376
-		}
377
-		else if($this->exists()) {
373
+		} else if($this->exists()) {
378 374
 			$this->db->query('INSERT INTO sector_has_forces (game_id, sector_id, owner_id, combat_drones, scout_drones, mines, expire_time)
379 375
 								VALUES('.$this->db->escapeNumber($this->gameID).', '.$this->db->escapeNumber($this->sectorID).', '.$this->db->escapeNumber($this->ownerID).', '.$this->db->escapeNumber($this->combatDrones).', '.$this->db->escapeNumber($this->scoutDrones).', '.$this->db->escapeNumber($this->mines).', '.$this->db->escapeNumber($this->expire).')');
380 376
 			$this->isNew=false;
Please login to merge, or discard this patch.
lib/External/OpenID/openid.php 1 patch
Braces   +39 added lines, -13 removed lines patch added patch discarded remove patch
@@ -333,7 +333,9 @@  discard block
 block discarded – undo
333 333
      */
334 334
     function discover($url)
335 335
     {
336
-        if (!$url) throw new ErrorException('No identity supplied.');
336
+        if (!$url) {
337
+        	throw new ErrorException('No identity supplied.');
338
+        }
337 339
         # Use xri.net proxy to resolve i-name identities
338 340
         if (!preg_match('#^https?:#', $url)) {
339 341
             $url = "https://xri.net/$url";
@@ -376,7 +378,9 @@  discard block
 block discarded – undo
376 378
                         # OpenID 2
377 379
                         $ns = preg_quote('http://specs.openid.net/auth/2.0/');
378 380
                         if(preg_match('#<Type>\s*'.$ns.'(server|signon)\s*</Type>#s', $content, $type)) {
379
-                            if ($type[1] == 'server') $this->identifier_select = true;
381
+                            if ($type[1] == 'server') {
382
+                            	$this->identifier_select = true;
383
+                            }
380 384
 
381 385
                             preg_match('#<URI.*?>(.*)</URI>#', $content, $server);
382 386
                             preg_match('#<(Local|Canonical)ID>(.*)</\1ID>#', $content, $delegate);
@@ -389,7 +393,9 @@  discard block
 block discarded – undo
389 393
                                        || strpos($content, '<Type>http://openid.net/extensions/sreg/1.1</Type>');
390 394
 
391 395
                             $server = $server[1];
392
-                            if (isset($delegate[2])) $this->identity = trim($delegate[2]);
396
+                            if (isset($delegate[2])) {
397
+                            	$this->identity = trim($delegate[2]);
398
+                            }
393 399
                             $this->version = 2;
394 400
 
395 401
                             $this->server = $server;
@@ -410,7 +416,9 @@  discard block
 block discarded – undo
410 416
                                        || strpos($content, '<Type>http://openid.net/extensions/sreg/1.1</Type>');
411 417
 
412 418
                             $server = $server[1];
413
-                            if (isset($delegate[1])) $this->identity = $delegate[1];
419
+                            if (isset($delegate[1])) {
420
+                            	$this->identity = $delegate[1];
421
+                            }
414 422
                             $this->version = 1;
415 423
 
416 424
                             $this->server = $server;
@@ -424,7 +432,9 @@  discard block
 block discarded – undo
424 432
                     $content = null;
425 433
                     break;
426 434
                 }
427
-                if ($next) continue;
435
+                if ($next) {
436
+                	continue;
437
+                }
428 438
 
429 439
                 # There are no relevant information in headers, so we search the body.
430 440
                 $content = $this->request($url, 'GET');
@@ -435,7 +445,9 @@  discard block
 block discarded – undo
435 445
                 }
436 446
             }
437 447
 
438
-            if (!$content) $content = $this->request($url, 'GET');
448
+            if (!$content) {
449
+            	$content = $this->request($url, 'GET');
450
+            }
439 451
 
440 452
             # At this point, the YADIS Discovery has failed, so we'll switch
441 453
             # to openid2 HTML discovery, then fallback to openid 1.1 discovery.
@@ -475,7 +487,9 @@  discard block
 block discarded – undo
475 487
         if ($this->required) {
476 488
             $params['openid.sreg.required'] = array();
477 489
             foreach ($this->required as $required) {
478
-                if (!isset(self::$ax_to_sreg[$required])) continue;
490
+                if (!isset(self::$ax_to_sreg[$required])) {
491
+                	continue;
492
+                }
479 493
                 $params['openid.sreg.required'][] = self::$ax_to_sreg[$required];
480 494
             }
481 495
             $params['openid.sreg.required'] = implode(',', $params['openid.sreg.required']);
@@ -484,7 +498,9 @@  discard block
 block discarded – undo
484 498
         if ($this->optional) {
485 499
             $params['openid.sreg.optional'] = array();
486 500
             foreach ($this->optional as $optional) {
487
-                if (!isset(self::$ax_to_sreg[$optional])) continue;
501
+                if (!isset(self::$ax_to_sreg[$optional])) {
502
+                	continue;
503
+                }
488 504
                 $params['openid.sreg.optional'][] = self::$ax_to_sreg[$optional];
489 505
             }
490 506
             $params['openid.sreg.optional'] = implode(',', $params['openid.sreg.optional']);
@@ -504,9 +520,13 @@  discard block
 block discarded – undo
504 520
             $optional = array();
505 521
             foreach (array('required','optional') as $type) {
506 522
                 foreach ($this->$type as $alias => $field) {
507
-                    if (is_int($alias)) $alias = strtr($field, '/', '_');
523
+                    if (is_int($alias)) {
524
+                    	$alias = strtr($field, '/', '_');
525
+                    }
508 526
                     $this->aliases[$alias] = 'http://axschema.org/' . $field;
509
-                    if (empty($counts[$alias])) $counts[$alias] = 0;
527
+                    if (empty($counts[$alias])) {
528
+                    	$counts[$alias] = 0;
529
+                    }
510 530
                     $counts[$alias] += 1;
511 531
                     ${$type}[] = $alias;
512 532
                 }
@@ -515,7 +535,9 @@  discard block
 block discarded – undo
515 535
                 $params['openid.ax.type.' . $alias] = $ns;
516 536
             }
517 537
             foreach ($counts as $alias => $count) {
518
-                if ($count == 1) continue;
538
+                if ($count == 1) {
539
+                	continue;
540
+                }
519 541
                 $params['openid.ax.count.' . $alias] = $count;
520 542
             }
521 543
 
@@ -592,8 +614,12 @@  discard block
 block discarded – undo
592 614
      */
593 615
     function authUrl($immediate = false)
594 616
     {
595
-        if ($this->setup_url && !$immediate) return $this->setup_url;
596
-        if (!$this->server) $this->discover($this->identity);
617
+        if ($this->setup_url && !$immediate) {
618
+        	return $this->setup_url;
619
+        }
620
+        if (!$this->server) {
621
+        	$this->discover($this->identity);
622
+        }
597 623
 
598 624
         if ($this->version == 2) {
599 625
             return $this->authUrl_v2($immediate);
Please login to merge, or discard this patch.
lib/db_mysql_debug.inc 1 patch
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -87,12 +87,14 @@  discard block
 block discarded – undo
87 87
     if ($table) {
88 88
       $this->connect();
89 89
       $id = @mysql_list_fields($this->Database, $table);
90
-      if (!$id)
91
-        $this->halt('Metadata query failed.');
90
+      if (!$id) {
91
+              $this->halt('Metadata query failed.');
92
+      }
92 93
     } else {
93 94
       $id = $this->Query_ID;
94
-      if (!$id)
95
-        $this->halt('No query specified.');
95
+      if (!$id) {
96
+              $this->halt('No query specified.');
97
+      }
96 98
     }
97 99
 
98 100
     $count = @mysql_num_fields($id);
@@ -120,6 +122,8 @@  discard block
 block discarded – undo
120 122
     }
121 123
 
122 124
     // free the result only if we were called on a table
123
-    if ($table) @mysql_free_result($id);
125
+    if ($table) {
126
+    	@mysql_free_result($id);
127
+    }
124 128
     return $res;
125 129
   }
Please login to merge, or discard this patch.
lib/Album/album_functions.php 1 patch
Braces   +45 added lines, -34 removed lines patch added patch discarded remove patch
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 
54 54
 			echo('<span style="font-size:85%;"><b>[' . date(defined('DATE_FULL_SHORT')?DATE_FULL_SHORT:DEFAULT_DATE_FULL_SHORT, $created) . ']</b> Picture of <a href="?' . urlencode($nick) . '">'.$nick.'</a> added</span><br />');
55 55
 		}
56
+	} else {
57
+			echo('<span style="font-size:85%;">no entries</span>');
56 58
 	}
57
-	else
58
-		echo('<span style="font-size:85%;">no entries</span>');
59 59
 	echo('</p>');
60 60
 }
61 61
 
@@ -66,11 +66,12 @@  discard block
 block discarded – undo
66 66
 	// list of all first letter nicks
67 67
 	create_link_list();
68 68
 
69
-	if (SmrSession::$account_id != 0 && $album_id != SmrSession::$account_id)
70
-		$db->query('UPDATE album
69
+	if (SmrSession::$account_id != 0 && $album_id != SmrSession::$account_id) {
70
+			$db->query('UPDATE album
71 71
 				SET page_views = page_views + 1
72 72
 				WHERE account_id = '.$db->escapeNumber($album_id).' AND
73 73
 					approved = \'YES\'');
74
+	}
74 75
 
75 76
 	$db->query('SELECT *
76 77
 				FROM album
@@ -86,8 +87,7 @@  discard block
 block discarded – undo
86 87
 		$other = nl2br(stripslashes($db->getField('other')));
87 88
 		$page_views = $db->getField('page_views');
88 89
 		$disabled = $db->getField('disabled') == 'TRUE';
89
-	}
90
-	else {
90
+	} else {
91 91
 		echo('<h1>Error</h1>');
92 92
 		echo('This user doesn\'t have an entry in our album!');
93 93
 		return;
@@ -138,46 +138,54 @@  discard block
 block discarded – undo
138 138
 	echo('<tr>');
139 139
 	echo('<td colspan="2" align="center" valign="middle">');
140 140
 
141
-	if ($disabled == false)
142
-		echo('<img src="../upload/'.$album_id.'">');
143
-	else
144
-		echo('<img src="../images/album/disabled.jpg">');
141
+	if ($disabled == false) {
142
+			echo('<img src="../upload/'.$album_id.'">');
143
+	} else {
144
+			echo('<img src="../images/album/disabled.jpg">');
145
+	}
145 146
 
146 147
 	echo('</td>');
147 148
 	echo('</tr>');
148 149
 
149
-	if (empty($location))
150
-		$location = 'N/A';
150
+	if (empty($location)) {
151
+			$location = 'N/A';
152
+	}
151 153
 	echo('<tr>');
152 154
 	echo('<td align="right" width="10%" style="font-weight:bold;">Location:</td><td>'.$location.'</td>');
153 155
 	echo('</tr>');
154 156
 
155
-	if (empty($email))
156
-		$email = 'N/A';
157
+	if (empty($email)) {
158
+			$email = 'N/A';
159
+	}
157 160
 	echo('<tr>');
158 161
 	echo('<td align="right" width="10%" style="font-weight:bold;">eMail:</td><td>'.$email.'</td>');
159 162
 	echo('</tr>');
160 163
 
161
-	if (empty($website))
162
-		$website = 'N/A';
163
-	else
164
-		$website = '<a href="'.$website.'" target="_new">'.$website.'</a>';
164
+	if (empty($website)) {
165
+			$website = 'N/A';
166
+	} else {
167
+			$website = '<a href="'.$website.'" target="_new">'.$website.'</a>';
168
+	}
165 169
 	echo('<tr>');
166 170
 	echo('<td align="right" width="10%" style="font-weight:bold;">Website:</td><td>'.$website.'</td>');
167 171
 	echo('</tr>');
168 172
 
169 173
 	echo('<tr>');
170
-	if (!empty($day) && !empty($month) && !empty($year))
171
-		$birthdate = $month.' / '.$day.' / '.$year;
172
-	if (empty($birthdate) && !empty($year))
173
-		$birthdate = 'Year '.$year;
174
-	if (empty($birthdate))
175
-		$birthdate = 'N/A';
174
+	if (!empty($day) && !empty($month) && !empty($year)) {
175
+			$birthdate = $month.' / '.$day.' / '.$year;
176
+	}
177
+	if (empty($birthdate) && !empty($year)) {
178
+			$birthdate = 'Year '.$year;
179
+	}
180
+	if (empty($birthdate)) {
181
+			$birthdate = 'N/A';
182
+	}
176 183
 	echo('<td align="right" width="10%" style="font-weight:bold;">Birthdate:</td><td>'.$birthdate.'</td>');
177 184
 	echo('</tr>');
178 185
 
179
-	if (empty($other))
180
-		$other = 'N/A';
186
+	if (empty($other)) {
187
+			$other = 'N/A';
188
+	}
181 189
 	echo('<tr>');
182 190
 	echo('<td align="right" valign="top" width="10%" style="font-weight:bold;">Other&nbsp;Info:<br /><small>(AIM/ICQ)&nbsp;&nbsp;</small></td><td>'.$other.'</td>');
183 191
 	echo('</tr>');
@@ -209,15 +217,16 @@  discard block
 block discarded – undo
209 217
 					FROM account_has_permission
210 218
 					WHERE account_id = '.$db->escapeNumber(SmrSession::$account_id).' AND
211 219
 						permission_id = '.$db->escapeNumber(PERMISSION_MODERATE_PHOTO_ALBUM));
212
-		if ($db->nextRecord())
213
-			echo('<td style="color:green; font-size:70%;"><br /><input type="submit" name="action" value="Moderate" id="InputFields"></td>');
220
+		if ($db->nextRecord()) {
221
+					echo('<td style="color:green; font-size:70%;"><br /><input type="submit" name="action" value="Moderate" id="InputFields"></td>');
222
+		}
214 223
 
215 224
 		echo('</tr>');
216 225
 		echo('</table>');
217 226
 		echo('</form>');
227
+	} else {
228
+			echo('<p>Please <a href="/login.php?return_page=/album/?' . urlencode($nick) . '"><u>login</u></a> if you want comment on this picture!</p>');
218 229
 	}
219
-	else
220
-		echo('<p>Please <a href="/login.php?return_page=/album/?' . urlencode($nick) . '"><u>login</u></a> if you want comment on this picture!</p>');
221 230
 
222 231
 	echo('</td>');
223 232
 	echo('</tr>');
@@ -244,8 +253,9 @@  discard block
 block discarded – undo
244 253
 
245 254
 		echo('<a href="?' . urlencode($nick) . '" style="font-size:80%;">'.$nick.'</a><br />');
246 255
 
247
-		if (floor(sizeof($album_ids) / 4) > 0 && $count % floor(sizeof($album_ids) / 4) == 0)
248
-			echo('</td><td width="25%" valign="top">');
256
+		if (floor(sizeof($album_ids) / 4) > 0 && $count % floor(sizeof($album_ids) / 4) == 0) {
257
+					echo('</td><td width="25%" valign="top">');
258
+		}
249 259
 	}
250 260
 	echo('</td></tr>');
251 261
 	echo('</table>');
@@ -286,8 +296,9 @@  discard block
 block discarded – undo
286 296
 
287 297
 
288 298
 function get_album_nick($album_id) {
289
-	if ($album_id == 0)
290
-		return 'System';
299
+	if ($album_id == 0) {
300
+			return 'System';
301
+	}
291 302
 
292 303
 	return SmrAccount::getAccount($album_id)->getHofName();
293 304
 }
Please login to merge, or discard this patch.
engine/Default/bounty_claim.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,8 +6,7 @@  discard block
 block discarded – undo
6 6
 if ($sector->hasHQ()) {
7 7
 	create_hq_menu();
8 8
 	$bounties = $player->getClaimableBounties('HQ');
9
-}
10
-else {
9
+} else {
11 10
 	create_ug_menu();
12 11
 	$bounties = $player->getClaimableBounties('UG');
13 12
 }
@@ -43,8 +42,7 @@  discard block
 block discarded – undo
43 42
 							AND claimer_id = ' . $db->escapeNumber($player->getAccountID()) . '
44 43
 							AND bounty_id = ' . $db->escapeNumber($bounty['bounty_id']));
45 44
 		}
46
-	}
47
-	else {
45
+	} else {
48 46
 		$claimText.=('You have no claimable bounties<br /><br />');
49 47
 	}
50 48
 	
Please login to merge, or discard this patch.
engine/Default/bank_alliance_exempt_processing.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@
 block discarded – undo
22 22
 $container['url'] = 'skeleton.php';
23 23
 if (isset($var['minVal'])) {
24 24
 	$container['body'] = 'bank_alliance.php';
25
-}
26
-else {
25
+} else {
27 26
 	$container['body'] = 'alliance_exempt_authorize.php';
28 27
 }
29 28
 forward($container);
Please login to merge, or discard this patch.
engine/Default/message_blacklist_add.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,8 +11,7 @@
 block discarded – undo
11 11
 
12 12
 if(isset($var['account_id'])) {
13 13
 	$blacklisted_id = $var['account_id'];
14
-}
15
-else {
14
+} else {
16 15
 	$db = new SmrMySqlDatabase();
17 16
 
18 17
 	$db->query('SELECT account_id FROM player WHERE player_name=' . $db->escapeString($_REQUEST['PlayerName']) . ' AND game_id=' . $db->escapeNumber($player->getGameID()) . ' LIMIT 1');
Please login to merge, or discard this patch.