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

Passed
Push — master ( bc8a60...3938d8 )
by Dan
03:51
created
templates/Default/engine/Default/includes/ForcesCombatResults.inc 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -1,34 +1,34 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(isset($ForcesCombatResults['Results']) && is_array($ForcesCombatResults['Results'])) {
3
-	foreach($ForcesCombatResults['Results'] as $ForceType => $ForceResults) {
4
-		$ShootingWeapon =& $ForceResults['Weapon'];
5
-		$ShotHit =& $ForceResults['Hit'];
6
-		$ActualDamage =& $ForceResults['ActualDamage'];
7
-		$WeaponDamage =& $ForceResults['WeaponDamage'];
8
-		$TargetPlayer =& $ForceResults['TargetPlayer'];
2
+if (isset($ForcesCombatResults['Results']) && is_array($ForcesCombatResults['Results'])) {
3
+	foreach ($ForcesCombatResults['Results'] as $ForceType => $ForceResults) {
4
+		$ShootingWeapon = & $ForceResults['Weapon'];
5
+		$ShotHit = & $ForceResults['Hit'];
6
+		$ActualDamage = & $ForceResults['ActualDamage'];
7
+		$WeaponDamage = & $ForceResults['WeaponDamage'];
8
+		$TargetPlayer = & $ForceResults['TargetPlayer'];
9 9
 		?>
10 10
 		<span class="cds"><?php echo isset($ActualDamage['Launched']) ? $ActualDamage['Launched'] : $WeaponDamage['Launched']; ?></span><?php
11
-		if($ForceType == 'Mines') {
11
+		if ($ForceType == 'Mines') {
12 12
 			?> mines kamikaze themselves against <?php
13
-		} else if($ForceType == 'Drones') {
13
+		} else if ($ForceType == 'Drones') {
14 14
 			?> combat drones launch at <?php
15
-		} else if($ForceType == 'Scouts') {
15
+		} else if ($ForceType == 'Scouts') {
16 16
 			?> scout drones kamikaze themselves against <?php
17 17
 		}
18 18
 		
19
-		if($ShotHit && $ActualDamage['TargetAlreadyDead']){ ?> the debris that was once <?php }
19
+		if ($ShotHit && $ActualDamage['TargetAlreadyDead']) { ?> the debris that was once <?php }
20 20
 		echo $TargetPlayer->getDisplayName();
21 21
 		if (!$ShotHit || !$ActualDamage['TargetAlreadyDead']) {
22
-			if(!$ShotHit) {
22
+			if (!$ShotHit) {
23 23
 				?> and misses<?php
24
-			} else if($ActualDamage['TotalDamage'] == 0) {
25
-				if($WeaponDamage['Shield'] > 0) {
26
-					if($ActualDamage['HasCDs']) {
24
+			} else if ($ActualDamage['TotalDamage'] == 0) {
25
+				if ($WeaponDamage['Shield'] > 0) {
26
+					if ($ActualDamage['HasCDs']) {
27 27
 						?> which proves ineffective against their combat drones<?php
28 28
 					} else {
29 29
 						?> which washes harmlessly over their hull<?php
30 30
 					}
31
-				} else if($WeaponDamage['Armour'] > 0) {
31
+				} else if ($WeaponDamage['Armour'] > 0) {
32 32
 					?> which is deflected by their shields<?php
33 33
 				} else {
34 34
 					?> but it cannot do any damage<?php
@@ -37,31 +37,31 @@  discard block
 block discarded – undo
37 37
 				?> destroying <?php
38 38
 			}
39 39
 			$DamageTypes = 0;
40
-			if($ActualDamage['Shield'] > 0){ $DamageTypes = $DamageTypes+1; }
41
-			if($ActualDamage['NumCDs'] > 0){ $DamageTypes = $DamageTypes+1; }
42
-			if($ActualDamage['Armour'] > 0){ $DamageTypes = $DamageTypes+1; }
40
+			if ($ActualDamage['Shield'] > 0) { $DamageTypes = $DamageTypes + 1; }
41
+			if ($ActualDamage['NumCDs'] > 0) { $DamageTypes = $DamageTypes + 1; }
42
+			if ($ActualDamage['Armour'] > 0) { $DamageTypes = $DamageTypes + 1; }
43 43
 
44
-			if($ActualDamage['Shield'] > 0) {
44
+			if ($ActualDamage['Shield'] > 0) {
45 45
 				?><span class="shields"><?php echo number_format($ActualDamage['Shield']) ?></span> shields<?php
46 46
 				$this->doDamageTypeReductionDisplay($DamageTypes);
47 47
 			}
48
-			if($ActualDamage['NumCDs'] > 0) {
48
+			if ($ActualDamage['NumCDs'] > 0) {
49 49
 				?><span class="cds"><?php echo number_format($ActualDamage['NumCDs']) ?></span> drones<?php
50 50
 				$this->doDamageTypeReductionDisplay($DamageTypes);
51 51
 			}
52
-			if($ActualDamage['Armour'] > 0) {
52
+			if ($ActualDamage['Armour'] > 0) {
53 53
 				?><span class="red"><?php echo number_format($ActualDamage['Armour']) ?></span> plates of armour<?php
54 54
 			}
55 55
 		} ?>.
56 56
 		<br /><?php
57 57
 		if ($ShotHit && $ActualDamage['KillingShot']) {
58
-			$this->includeTemplate('includes/TraderCombatKillMessage.inc',array('KillResults'=>$ForceResults['KillResults'],'TargetPlayer'=>$TargetPlayer));
58
+			$this->includeTemplate('includes/TraderCombatKillMessage.inc', array('KillResults'=>$ForceResults['KillResults'], 'TargetPlayer'=>$TargetPlayer));
59 59
 		}
60 60
 	}
61 61
 }
62
-if(isset($ForcesCombatResults['ForcesDestroyed']) && $ForcesCombatResults['ForcesDestroyed']) {
62
+if (isset($ForcesCombatResults['ForcesDestroyed']) && $ForcesCombatResults['ForcesDestroyed']) {
63 63
 	?>Forces are <span class="red">DESTROYED!</span><br /><?php
64 64
 }
65 65
 
66
-$TotalDamage =& $ForcesCombatResults['TotalDamage'] ?>
67
-The forces <?php if($TotalDamage > 0){ ?>hit for a total of <span class="red"><?php echo number_format($TotalDamage) ?></span> damage in this round of combat<?php } else{ ?>do no damage this round<?php } ?>.
66
+$TotalDamage = & $ForcesCombatResults['TotalDamage'] ?>
67
+The forces <?php if ($TotalDamage > 0) { ?>hit for a total of <span class="red"><?php echo number_format($TotalDamage) ?></span> damage in this round of combat<?php } else { ?>do no damage this round<?php } ?>.
Please login to merge, or discard this patch.
templates/Default/engine/Default/includes/TraderTeamCombatResults.inc 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -1,36 +1,36 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(is_array($TraderTeamCombatResults['Traders'])) {
3
-	foreach($TraderTeamCombatResults['Traders'] as $AccountID => $TraderResults) {
4
-		$ShootingPlayer =& $TraderResults['Player'];
5
-		$TotalDamage =& $TraderResults['TotalDamage'];
2
+if (is_array($TraderTeamCombatResults['Traders'])) {
3
+	foreach ($TraderTeamCombatResults['Traders'] as $AccountID => $TraderResults) {
4
+		$ShootingPlayer = & $TraderResults['Player'];
5
+		$TotalDamage = & $TraderResults['TotalDamage'];
6 6
 	
7
-		if($TraderResults['DeadBeforeShot']) {
7
+		if ($TraderResults['DeadBeforeShot']) {
8 8
 			echo $ShootingPlayer->getDisplayName() ?> died before they were able to attack!<br /><?php
9 9
 		} else {
10
-			if(isset($TraderResults['Weapons']) && is_array($TraderResults['Weapons'])) {
11
-				foreach($TraderResults['Weapons'] as $WeaponResults) {
12
-					$ShootingWeapon =& $WeaponResults['Weapon'];
13
-					$ShotHit =& $WeaponResults['Hit'];
14
-					$ActualDamage =& $WeaponResults['ActualDamage'];
15
-					$WeaponDamage =& $WeaponResults['WeaponDamage'];
16
-					$TargetPlayer =& $WeaponResults['TargetPlayer'];
10
+			if (isset($TraderResults['Weapons']) && is_array($TraderResults['Weapons'])) {
11
+				foreach ($TraderResults['Weapons'] as $WeaponResults) {
12
+					$ShootingWeapon = & $WeaponResults['Weapon'];
13
+					$ShotHit = & $WeaponResults['Hit'];
14
+					$ActualDamage = & $WeaponResults['ActualDamage'];
15
+					$WeaponDamage = & $WeaponResults['WeaponDamage'];
16
+					$TargetPlayer = & $WeaponResults['TargetPlayer'];
17 17
 					
18 18
 					echo $ShootingPlayer->getDisplayName() ?> fires their <?php echo $ShootingWeapon->getName() ?> at <?php
19
-					if($ShotHit && $ActualDamage['TargetAlreadyDead']) {
19
+					if ($ShotHit && $ActualDamage['TargetAlreadyDead']) {
20 20
 						?>the debris that was once <?php
21 21
 					}
22 22
 					echo $TargetPlayer->getDisplayName();
23 23
 					if (!$ShotHit || !$ActualDamage['TargetAlreadyDead']) {
24
-						if(!$ShotHit) {
24
+						if (!$ShotHit) {
25 25
 							?> and misses<?php
26
-						} else if($ActualDamage['TotalDamage'] == 0) {
27
-							if($WeaponDamage['Shield'] > 0) {
28
-								if($ActualDamage['HasCDs']) {
26
+						} else if ($ActualDamage['TotalDamage'] == 0) {
27
+							if ($WeaponDamage['Shield'] > 0) {
28
+								if ($ActualDamage['HasCDs']) {
29 29
 									?> which proves ineffective against their combat drones<?php
30 30
 								} else {
31 31
 									?> which washes harmlessly over their hull<?php
32 32
 								}
33
-							} else if($WeaponDamage['Armour'] > 0) {
33
+							} else if ($WeaponDamage['Armour'] > 0) {
34 34
 								?> which is deflected by their shields<?php
35 35
 							} else {
36 36
 								?> but it cannot do any damage<?php
@@ -38,94 +38,94 @@  discard block
 block discarded – undo
38 38
 						} else {
39 39
 							?> destroying <?php
40 40
 							$DamageTypes = 0;
41
-							if($ActualDamage['Shield'] > 0){ $DamageTypes = $DamageTypes+1; }
42
-							if($ActualDamage['NumCDs'] > 0){ $DamageTypes = $DamageTypes+1; }
43
-							if($ActualDamage['Armour'] > 0){ $DamageTypes = $DamageTypes+1; }
41
+							if ($ActualDamage['Shield'] > 0) { $DamageTypes = $DamageTypes + 1; }
42
+							if ($ActualDamage['NumCDs'] > 0) { $DamageTypes = $DamageTypes + 1; }
43
+							if ($ActualDamage['Armour'] > 0) { $DamageTypes = $DamageTypes + 1; }
44 44
 
45
-							if($ActualDamage['Shield'] > 0) {
45
+							if ($ActualDamage['Shield'] > 0) {
46 46
 								?><span class="shields"><?php echo number_format($ActualDamage['Shield']) ?></span> shields<?php
47 47
 								$this->doDamageTypeReductionDisplay($DamageTypes);
48 48
 							}
49
-							if($ActualDamage['NumCDs'] > 0) {
49
+							if ($ActualDamage['NumCDs'] > 0) {
50 50
 								?><span class="cds"><?php echo number_format($ActualDamage['NumCDs']) ?></span> combat drones<?php
51 51
 								$this->doDamageTypeReductionDisplay($DamageTypes);
52 52
 							}
53
-							if($ActualDamage['Armour'] > 0) {
53
+							if ($ActualDamage['Armour'] > 0) {
54 54
 								?><span class="red"><?php echo number_format($ActualDamage['Armour']) ?></span> plates of armour<?php
55 55
 							}
56 56
 						}
57 57
 					} ?>.
58 58
 					<br /><?php
59 59
 					if ($ShotHit && $ActualDamage['KillingShot']) {
60
-						$this->includeTemplate('includes/TraderCombatKillMessage.inc',array('KillResults'=>$WeaponResults['KillResults'],'TargetPlayer'=>$TargetPlayer,'ShootingPlayer'=>$ShootingPlayer));
60
+						$this->includeTemplate('includes/TraderCombatKillMessage.inc', array('KillResults'=>$WeaponResults['KillResults'], 'TargetPlayer'=>$TargetPlayer, 'ShootingPlayer'=>$ShootingPlayer));
61 61
 					}
62 62
 				}
63 63
 			}
64
-			if(isset($TraderResults['Drones'])) {
65
-				$Drones =& $TraderResults['Drones'];
66
-				$ActualDamage =& $Drones['ActualDamage'];
67
-				$WeaponDamage =& $Drones['WeaponDamage'];
68
-				$TargetPlayer =& $Drones['TargetPlayer'];
64
+			if (isset($TraderResults['Drones'])) {
65
+				$Drones = & $TraderResults['Drones'];
66
+				$ActualDamage = & $Drones['ActualDamage'];
67
+				$WeaponDamage = & $Drones['WeaponDamage'];
68
+				$TargetPlayer = & $Drones['TargetPlayer'];
69 69
 				$DamageTypes = 0;
70
-				if($ActualDamage['Shield'] > 0){ $DamageTypes = $DamageTypes+1; }
71
-				if($ActualDamage['NumCDs'] > 0){ $DamageTypes = $DamageTypes+1; }
72
-				if($ActualDamage['Armour'] > 0){ $DamageTypes = $DamageTypes+1; }
70
+				if ($ActualDamage['Shield'] > 0) { $DamageTypes = $DamageTypes + 1; }
71
+				if ($ActualDamage['NumCDs'] > 0) { $DamageTypes = $DamageTypes + 1; }
72
+				if ($ActualDamage['Armour'] > 0) { $DamageTypes = $DamageTypes + 1; }
73 73
 	
74 74
 				echo $ShootingPlayer->getDisplayName();
75
-				if($WeaponDamage['Launched'] == 0) {
75
+				if ($WeaponDamage['Launched'] == 0) {
76 76
 					?> fails to launch their combat drones<?php
77 77
 				} else {
78 78
 					?> launches <span class="cds"><?php echo $WeaponDamage['Launched'] ?></span> combat drones at <?php
79
-					if($ActualDamage['TargetAlreadyDead']) {
79
+					if ($ActualDamage['TargetAlreadyDead']) {
80 80
 						?>the debris that was once <?php
81 81
 					}
82 82
 					echo $TargetPlayer->getDisplayName();
83
-					if(!$ActualDamage['TargetAlreadyDead']) {
84
-						if($ActualDamage['TotalDamage'] == 0) {
85
-							if($WeaponDamage['Shield'] > 0) {
86
-								if($ActualDamage['HasCDs']) {
83
+					if (!$ActualDamage['TargetAlreadyDead']) {
84
+						if ($ActualDamage['TotalDamage'] == 0) {
85
+							if ($WeaponDamage['Shield'] > 0) {
86
+								if ($ActualDamage['HasCDs']) {
87 87
 									?> which prove ineffective against their combat drones<?php
88 88
 								} else {
89 89
 									?> which washes harmlessly over their hull<?php
90 90
 								}
91 91
 							}
92
-							if($ActualDamage['Armour'] > 0) {
92
+							if ($ActualDamage['Armour'] > 0) {
93 93
 								?> which is deflected by their shields<?php
94 94
 							} else {
95 95
 								?> but they cannot do any damage<?php
96 96
 							}
97 97
 						} else {
98 98
 							?> destroying <?php
99
-							if($ActualDamage['Shield'] > 0) {
99
+							if ($ActualDamage['Shield'] > 0) {
100 100
 								?><span class="shields"><?php echo number_format($ActualDamage['Shield']) ?></span> shields<?php
101 101
 								$this->doDamageTypeReductionDisplay($DamageTypes);
102 102
 							}
103
-							if($ActualDamage['NumCDs'] > 0) {
103
+							if ($ActualDamage['NumCDs'] > 0) {
104 104
 								?><span class="cds"><?php echo number_format($ActualDamage['NumCDs']) ?></span> combat drones<?php
105 105
 								$this->doDamageTypeReductionDisplay($DamageTypes);
106 106
 							}
107
-							if($ActualDamage['Armour'] > 0) {
107
+							if ($ActualDamage['Armour'] > 0) {
108 108
 								?><span class="red"><?php echo number_format($ActualDamage['Armour']) ?></span> plates of armour<?php
109 109
 							}
110 110
 						}
111 111
 					}
112 112
 				} ?>.
113 113
 				<br /><?php
114
-				if($ActualDamage['KillingShot']) {
115
-					$this->includeTemplate('includes/TraderCombatKillMessage.inc',array('KillResults'=>$Drones['KillResults'],'TargetPlayer'=>$TargetPlayer,'ShootingPlayer'=>$ShootingPlayer));
114
+				if ($ActualDamage['KillingShot']) {
115
+					$this->includeTemplate('includes/TraderCombatKillMessage.inc', array('KillResults'=>$Drones['KillResults'], 'TargetPlayer'=>$TargetPlayer, 'ShootingPlayer'=>$ShootingPlayer));
116 116
 				}
117 117
 			}
118 118
 		}
119 119
 		echo $ShootingPlayer->getDisplayName();
120
-		if($TotalDamage > 0) {
120
+		if ($TotalDamage > 0) {
121 121
 			?> hits for a total of <span class="red"><?php echo $TotalDamage ?></span> damage in this round of combat<?php
122 122
 		} else {
123 123
 			?> does no damage this round.<?php
124
-			if(!$TraderResults['DeadBeforeShot']) {
124
+			if (!$TraderResults['DeadBeforeShot']) {
125 125
 				?> Maybe they should go back to the academy<?php
126 126
 			}
127 127
 		} ?>.<br /><br /><?php
128 128
 	}
129 129
 }
130 130
 $TotalDamage = $TraderTeamCombatResults['TotalDamage']; ?>
131
-This fleet <?php if($TotalDamage > 0){ ?>hits for a total of <span class="red"><?php echo $TotalDamage ?></span> damage in this round of combat<?php } else{ ?>does no damage this round. You call that a fleet? They need a better recruiter<?php } ?>.<br />
131
+This fleet <?php if ($TotalDamage > 0) { ?>hits for a total of <span class="red"><?php echo $TotalDamage ?></span> damage in this round of combat<?php } else { ?>does no damage this round. You call that a fleet? They need a better recruiter<?php } ?>.<br />
Please login to merge, or discard this patch.
engine/Default/cargo_dump_processing.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 
47 47
 	// Don't lose more exp than you have
48 48
 	$lost_xp = min($player->getExperience(),
49
-	               IRound(SmrPort::getBaseExperience($amount, $good_distance)));
49
+				   IRound(SmrPort::getBaseExperience($amount, $good_distance)));
50 50
 	$player->decreaseExperience($lost_xp);
51 51
 	$player->increaseHOF($lost_xp, array('Trade', 'Experience', 'Jettisoned'), HOF_PUBLIC);
52 52
 
Please login to merge, or discard this patch.
engine/Default/shop_hardware_processing.php 1 patch
Braces   +15 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,8 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php declare(strict_types=1);
2 2
 $action = $_REQUEST['action'];
3 3
 $amount = $_REQUEST['amount'];
4
-if (!is_numeric($amount))
4
+if (!is_numeric($amount)) {
5 5
 	create_error('Numbers only please');
6
+}
6 7
 
7 8
 // only whole numbers allowed
8 9
 $amount = floor($amount);
@@ -12,8 +13,9 @@  discard block
 block discarded – undo
12 13
 $cost = Globals::getHardwareCost($hardware_id);
13 14
 
14 15
 // no negative amounts are allowed
15
-if ($amount <= 0)
16
+if ($amount <= 0) {
16 17
 	create_error('You must actually enter an amount greater than zero!');
18
+}
17 19
 
18 20
 if ($action == 'Buy') {
19 21
 	// do we have enough cash?
@@ -30,11 +32,16 @@  discard block
 block discarded – undo
30 32
 	$ship->increaseHardware($hardware_id, $amount);
31 33
 
32 34
 	//HoF
33
-	if ($hardware_id == HARDWARE_COMBAT) $player->increaseHOF($amount, array('Forces', 'Bought', 'Combat Drones'), HOF_ALLIANCE);
34
-	if ($hardware_id == HARDWARE_SCOUT) $player->increaseHOF($amount, array('Forces', 'Bought', 'Scout Drones'), HOF_ALLIANCE);
35
-	if ($hardware_id == HARDWARE_MINE) $player->increaseHOF($amount, array('Forces', 'Bought', 'Mines'), HOF_ALLIANCE);
36
-}
37
-else if ($action == 'Sell') {
35
+	if ($hardware_id == HARDWARE_COMBAT) {
36
+		$player->increaseHOF($amount, array('Forces', 'Bought', 'Combat Drones'), HOF_ALLIANCE);
37
+	}
38
+	if ($hardware_id == HARDWARE_SCOUT) {
39
+		$player->increaseHOF($amount, array('Forces', 'Bought', 'Scout Drones'), HOF_ALLIANCE);
40
+	}
41
+	if ($hardware_id == HARDWARE_MINE) {
42
+		$player->increaseHOF($amount, array('Forces', 'Bought', 'Mines'), HOF_ALLIANCE);
43
+	}
44
+	} else if ($action == 'Sell') {
38 45
 	// We only allow selling combat drones
39 46
 	if ($hardware_id != HARDWARE_COMBAT) {
40 47
 		throw new Exception('This item cannot be sold!');
@@ -47,8 +54,7 @@  discard block
 block discarded – undo
47 54
 
48 55
 	$player->increaseCredits(IRound($cost * CDS_REFUND_PERCENT) * $amount);
49 56
 	$ship->decreaseCDs($amount, true); // 2nd arg avoids under attack warning
50
-}
51
-else {
57
+} else {
52 58
 	throw new Exception('Action must be either Buy or Sell.');
53 59
 }
54 60
 
Please login to merge, or discard this patch.
lib/Default/SmrWeapon.class.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -192,21 +192,21 @@  discard block
 block discarded – undo
192 192
 	public function &getModifiedDamageAgainstForces(AbstractSmrPlayer $weaponPlayer, SmrForce $forces) {
193 193
 		if (!$this->canShootForces()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
194 194
 			return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
195
-		$damage =& $this->getModifiedDamage();
195
+		$damage = & $this->getModifiedDamage();
196 196
 		return $damage;
197 197
 	}
198 198
 	
199 199
 	public function &getModifiedDamageAgainstPort(AbstractSmrPlayer $weaponPlayer, SmrPort $port) {
200 200
 		if (!$this->canShootPorts()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
201 201
 			return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
202
-		$damage =& $this->getModifiedDamage();
202
+		$damage = & $this->getModifiedDamage();
203 203
 		return $damage;
204 204
 	}
205 205
 	
206 206
 	public function &getModifiedDamageAgainstPlanet(AbstractSmrPlayer $weaponPlayer, SmrPlanet $planet) {
207 207
 		if (!$this->canShootPlanets()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
208 208
 			return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
209
-		$damage =& $this->getModifiedDamage();
209
+		$damage = & $this->getModifiedDamage();
210 210
 		
211 211
 		$planetMod = self::PLANET_DAMAGE_MOD;
212 212
 		$damage['MaxDamage'] = ICeil($damage['MaxDamage'] * $planetMod);
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 			$return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
227 227
 			return $return;
228 228
 		}
229
-		$damage =& $this->getModifiedDamage();
229
+		$damage = & $this->getModifiedDamage();
230 230
 		return $damage;
231 231
 	}
232 232
 	
Please login to merge, or discard this patch.
Braces   +20 added lines, -11 removed lines patch added patch discarded remove patch
@@ -12,17 +12,19 @@  discard block
 block discarded – undo
12 12
 
13 13
 	
14 14
 	protected static function initialiseDatabase() {
15
-		if (self::$db == null)
16
-			self::$db = new SmrMySqlDatabase();
15
+		if (self::$db == null) {
16
+					self::$db = new SmrMySqlDatabase();
17
+		}
17 18
 	}
18 19
 
19 20
 	public static function getWeapon($weaponTypeID, $forceUpdate = false, $db = null) {
20 21
 		if ($forceUpdate || !isset(self::$CACHE_WEAPONS[$weaponTypeID])) {
21 22
 			$w = new SmrWeapon($weaponTypeID, $db);
22
-			if ($w->exists())
23
-				self::$CACHE_WEAPONS[$weaponTypeID] = $w;
24
-			else
25
-				self::$CACHE_WEAPONS[$weaponTypeID] = false;
23
+			if ($w->exists()) {
24
+							self::$CACHE_WEAPONS[$weaponTypeID] = $w;
25
+			} else {
26
+							self::$CACHE_WEAPONS[$weaponTypeID] = false;
27
+			}
26 28
 		}
27 29
 		return self::$CACHE_WEAPONS[$weaponTypeID];
28 30
 	}
@@ -151,8 +153,9 @@  discard block
 block discarded – undo
151 153
 		$weaponShip = $weaponPlayer->getShip();
152 154
 		$targetShip = $targetPlayer->getShip();
153 155
 		$mrDiff = $targetShip->getMR() - $weaponShip->getMR();
154
-		if ($mrDiff > 0)
155
-			$modifiedAccuracy -= $this->getBaseAccuracy() * ($mrDiff / MR_FACTOR) / 100;
156
+		if ($mrDiff > 0) {
157
+					$modifiedAccuracy -= $this->getBaseAccuracy() * ($mrDiff / MR_FACTOR) / 100;
158
+		}
156 159
 	
157 160
 		return $modifiedAccuracy;
158 161
 	}
@@ -190,22 +193,28 @@  discard block
 block discarded – undo
190 193
 	}
191 194
 	
192 195
 	public function &getModifiedDamageAgainstForces(AbstractSmrPlayer $weaponPlayer, SmrForce $forces) {
193
-		if (!$this->canShootForces()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
196
+		if (!$this->canShootForces()) {
197
+			// If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
194 198
 			return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
199
+		}
195 200
 		$damage =& $this->getModifiedDamage();
196 201
 		return $damage;
197 202
 	}
198 203
 	
199 204
 	public function &getModifiedDamageAgainstPort(AbstractSmrPlayer $weaponPlayer, SmrPort $port) {
200
-		if (!$this->canShootPorts()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
205
+		if (!$this->canShootPorts()) {
206
+			// If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
201 207
 			return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
208
+		}
202 209
 		$damage =& $this->getModifiedDamage();
203 210
 		return $damage;
204 211
 	}
205 212
 	
206 213
 	public function &getModifiedDamageAgainstPlanet(AbstractSmrPlayer $weaponPlayer, SmrPlanet $planet) {
207
-		if (!$this->canShootPlanets()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
214
+		if (!$this->canShootPlanets()) {
215
+			// If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
208 216
 			return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
217
+		}
209 218
 		$damage =& $this->getModifiedDamage();
210 219
 		
211 220
 		$planetMod = self::PLANET_DAMAGE_MOD;
Please login to merge, or discard this patch.
lib/Default/SmrMines.class.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 			$return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
95 95
 			return $return;
96 96
 		}
97
-		$damage =& $this->getModifiedDamage();
97
+		$damage = & $this->getModifiedDamage();
98 98
 		if ($targetPlayer->getShip()->isFederal()) { // do less damage to fed ships 
99 99
 			$damage['MaxDamage'] = IRound($damage['MaxDamage'] * self::FED_SHIP_DAMAGE_MODIFIER);
100 100
 			$damage['Shield'] = IRound($damage['Shield'] * self::FED_SHIP_DAMAGE_MODIFIER);
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
 	}
132 132
 	
133 133
 	protected function &doForceDamageToPlayer(array &$return, SmrForce $forces, AbstractSmrPlayer $targetPlayer, $minesAreAttacker = false) {
134
-		$return['WeaponDamage'] =& $this->getModifiedForceDamageAgainstPlayer($forces, $targetPlayer, $minesAreAttacker);
135
-		$return['ActualDamage'] =& $targetPlayer->getShip()->doMinesDamage($return['WeaponDamage']);
134
+		$return['WeaponDamage'] = & $this->getModifiedForceDamageAgainstPlayer($forces, $targetPlayer, $minesAreAttacker);
135
+		$return['ActualDamage'] = & $targetPlayer->getShip()->doMinesDamage($return['WeaponDamage']);
136 136
 		$return['ActualDamage']['Launched'] = ICeil($return['WeaponDamage']['Launched'] * $return['ActualDamage']['TotalDamage'] / $return['WeaponDamage']['MaxDamage']);
137 137
 
138 138
 		if ($return['ActualDamage']['KillingShot']) {
139
-			$return['KillResults'] =& $targetPlayer->killPlayerByForces($forces);
139
+			$return['KillResults'] = & $targetPlayer->killPlayerByForces($forces);
140 140
 		}
141 141
 		return $return;
142 142
 	}
Please login to merge, or discard this patch.
lib/Default/SmrCombatDrones.class.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	public function &getModifiedDamageAgainstForces(AbstractSmrPlayer $weaponPlayer, SmrForce $forces) {
130 130
 		if (!$this->canShootForces()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
131 131
 			return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
132
-		$damage =& $this->getModifiedDamage();
132
+		$damage = & $this->getModifiedDamage();
133 133
 		$damage['Launched'] = ICeil($this->getNumberOfCDs() * $this->getModifiedAccuracyAgainstForces($weaponPlayer, $forces) / 100);
134 134
 		$damage['Kamikaze'] = 0;
135 135
 		if ($weaponPlayer->isCombatDronesKamikazeOnMines()) { // If kamikaze then damage is same as MINE_ARMOUR
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	public function &getModifiedDamageAgainstPort(AbstractSmrPlayer $weaponPlayer, SmrPort $port) {
152 152
 		if (!$this->canShootPorts()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
153 153
 			return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
154
-		$damage =& $this->getModifiedDamage();
154
+		$damage = & $this->getModifiedDamage();
155 155
 		$damage['Launched'] = ICeil($this->getNumberOfCDs() * $this->getModifiedAccuracyAgainstPort($weaponPlayer, $port) / 100);
156 156
 		$damage['MaxDamage'] = ICeil($damage['Launched'] * $damage['MaxDamage']);
157 157
 		$damage['Shield'] = ICeil($damage['Launched'] * $damage['Shield']);
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	public function &getModifiedDamageAgainstPlanet(AbstractSmrPlayer $weaponPlayer, SmrPlanet $planet) {
164 164
 		if (!$this->canShootPlanets()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
165 165
 			return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
166
-		$damage =& $this->getModifiedDamage();
166
+		$damage = & $this->getModifiedDamage();
167 167
 		$damage['Launched'] = ICeil($this->getNumberOfCDs() * $this->getModifiedAccuracyAgainstPlanet($weaponPlayer, $planet) / 100);
168 168
 		$planetMod = self::PLANET_DAMAGE_MOD;
169 169
 		$damage['MaxDamage'] = ICeil($damage['Launched'] * $damage['MaxDamage'] * $planetMod);
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 			$return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
179 179
 			return $return;
180 180
 		}
181
-		$damage =& $this->getModifiedDamage();
181
+		$damage = & $this->getModifiedDamage();
182 182
 		if ($targetPlayer->getShip()->hasDCS()) {
183 183
 			$damage['MaxDamage'] *= DCS_PLAYER_DAMAGE_DECIMAL_PERCENT;
184 184
 			$damage['Shield'] *= DCS_PLAYER_DAMAGE_DECIMAL_PERCENT;
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 			$return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
197 197
 			return $return;
198 198
 		}
199
-		$damage =& $this->getModifiedDamage();
199
+		$damage = & $this->getModifiedDamage();
200 200
 		
201 201
 		if ($targetPlayer->getShip()->hasDCS()) {
202 202
 			$damage['MaxDamage'] *= DCS_FORCE_DAMAGE_DECIMAL_PERCENT;
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 			$return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
217 217
 			return $return;
218 218
 		}
219
-		$damage =& $this->getModifiedDamage();
219
+		$damage = & $this->getModifiedDamage();
220 220
 		
221 221
 		if ($targetPlayer->getShip()->hasDCS()) {
222 222
 			$damage['MaxDamage'] *= DCS_PORT_DAMAGE_DECIMAL_PERCENT;
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 			$return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
236 236
 			return $return;
237 237
 		}
238
-		$damage =& $this->getModifiedDamage();
238
+		$damage = & $this->getModifiedDamage();
239 239
 		
240 240
 		if ($targetPlayer->getShip()->hasDCS()) {
241 241
 			$damage['MaxDamage'] *= DCS_PLANET_DAMAGE_DECIMAL_PERCENT;
Please login to merge, or discard this patch.
Braces   +13 added lines, -7 removed lines patch added patch discarded remove patch
@@ -13,8 +13,7 @@  discard block
 block discarded – undo
13 13
 			$this->maxDamage = 2;
14 14
 			$this->shieldDamage = 2;
15 15
 			$this->armourDamage = 2;
16
-		}
17
-		else {
16
+		} else {
18 17
 			$this->maxDamage = 1;
19 18
 			$this->shieldDamage = 1;
20 19
 			$this->armourDamage = 1;
@@ -84,8 +83,9 @@  discard block
 block discarded – undo
84 83
 		$weaponShip = $weaponPlayer->getShip();
85 84
 		$targetShip = $targetPlayer->getShip();
86 85
 		$mrDiff = $targetShip->getMR() - $weaponShip->getMR();
87
-		if ($mrDiff > 0)
88
-			$modifiedAccuracy -= $this->getBaseAccuracy() * ($mrDiff / MR_FACTOR) / 100;
86
+		if ($mrDiff > 0) {
87
+					$modifiedAccuracy -= $this->getBaseAccuracy() * ($mrDiff / MR_FACTOR) / 100;
88
+		}
89 89
 	
90 90
 		return max(0, min(100, $modifiedAccuracy));
91 91
 	}
@@ -127,8 +127,10 @@  discard block
 block discarded – undo
127 127
 	}
128 128
 	
129 129
 	public function &getModifiedDamageAgainstForces(AbstractSmrPlayer $weaponPlayer, SmrForce $forces) {
130
-		if (!$this->canShootForces()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
130
+		if (!$this->canShootForces()) {
131
+			// If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
131 132
 			return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
133
+		}
132 134
 		$damage =& $this->getModifiedDamage();
133 135
 		$damage['Launched'] = ICeil($this->getNumberOfCDs() * $this->getModifiedAccuracyAgainstForces($weaponPlayer, $forces) / 100);
134 136
 		$damage['Kamikaze'] = 0;
@@ -149,8 +151,10 @@  discard block
 block discarded – undo
149 151
 	}
150 152
 	
151 153
 	public function &getModifiedDamageAgainstPort(AbstractSmrPlayer $weaponPlayer, SmrPort $port) {
152
-		if (!$this->canShootPorts()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
154
+		if (!$this->canShootPorts()) {
155
+			// If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
153 156
 			return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
157
+		}
154 158
 		$damage =& $this->getModifiedDamage();
155 159
 		$damage['Launched'] = ICeil($this->getNumberOfCDs() * $this->getModifiedAccuracyAgainstPort($weaponPlayer, $port) / 100);
156 160
 		$damage['MaxDamage'] = ICeil($damage['Launched'] * $damage['MaxDamage']);
@@ -161,8 +165,10 @@  discard block
 block discarded – undo
161 165
 	}
162 166
 	
163 167
 	public function &getModifiedDamageAgainstPlanet(AbstractSmrPlayer $weaponPlayer, SmrPlanet $planet) {
164
-		if (!$this->canShootPlanets()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
168
+		if (!$this->canShootPlanets()) {
169
+			// If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
165 170
 			return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
171
+		}
166 172
 		$damage =& $this->getModifiedDamage();
167 173
 		$damage['Launched'] = ICeil($this->getNumberOfCDs() * $this->getModifiedAccuracyAgainstPlanet($weaponPlayer, $planet) / 100);
168 174
 		$planetMod = self::PLANET_DAMAGE_MOD;
Please login to merge, or discard this patch.
lib/Default/SmrScoutDrones.class.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@
 block discarded – undo
80 80
 			$return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
81 81
 			return $return;
82 82
 		}
83
-		$damage =& $this->getModifiedDamage();
83
+		$damage = & $this->getModifiedDamage();
84 84
 		$damage['Launched'] = ICeil($this->getNumberOfSDs() * $this->getModifiedForceAccuracyAgainstPlayer($forces, $targetPlayer) / 100);
85 85
 		$damage['MaxDamage'] = ICeil($damage['Launched'] * $damage['MaxDamage']);
86 86
 		$damage['Shield'] = ICeil($damage['Launched'] * $damage['Shield']);
Please login to merge, or discard this patch.
lib/Default/smr.inc 1 patch
Braces   +80 added lines, -58 removed lines patch added patch discarded remove patch
@@ -8,8 +8,9 @@  discard block
 block discarded – undo
8 8
 
9 9
 function parseBoolean($check) {
10 10
 	// Only negative strings are not implicitly converted to the correct bool
11
-	if (is_string($check) && (strcasecmp($check, 'NO') == 0 || strcasecmp($check, 'FALSE') == 0))
12
-		return false;
11
+	if (is_string($check) && (strcasecmp($check, 'NO') == 0 || strcasecmp($check, 'FALSE') == 0)) {
12
+			return false;
13
+	}
13 14
 	return (bool)$check;
14 15
 }
15 16
 
@@ -32,8 +33,9 @@  discard block
 block discarded – undo
32 33
 			break;
33 34
 			case 'player':
34 35
 				$playerID = $default;
35
-				if (!is_numeric($playerID))
36
-					$playerID = $tagParams['id'];
36
+				if (!is_numeric($playerID)) {
37
+									$playerID = $tagParams['id'];
38
+				}
37 39
 				$bbPlayer = SmrPlayer::getPlayerByPlayerID($playerID, $overrideGameID);
38 40
 				if ($action == \Nbbc\BBCode::BBCODE_CHECK) {
39 41
 					return true;
@@ -46,8 +48,9 @@  discard block
 block discarded – undo
46 48
 			break;
47 49
 			case 'alliance':
48 50
 				$allianceID = $default;
49
-				if (!is_numeric($allianceID))
50
-					$allianceID = $tagParams['id'];
51
+				if (!is_numeric($allianceID)) {
52
+									$allianceID = $tagParams['id'];
53
+				}
51 54
 				$alliance = SmrAlliance::getAlliance($allianceID, $overrideGameID);
52 55
 				if ($action == \Nbbc\BBCode::BBCODE_CHECK) {
53 56
 					return true;
@@ -56,10 +59,11 @@  discard block
 block discarded – undo
56 59
 				if ($disableBBLinks === false && $overrideGameID == SmrSession::getGameID()) {
57 60
 					$container = create_container('skeleton.php');
58 61
 					$container['alliance_id'] = $alliance->getAllianceID();
59
-					if (is_object($player) && $alliance->getAllianceID() == $player->getAllianceID())
60
-						$container['body'] = 'alliance_mod.php';
61
-					else
62
-						$container['body'] = 'alliance_roster.php';
62
+					if (is_object($player) && $alliance->getAllianceID() == $player->getAllianceID()) {
63
+											$container['body'] = 'alliance_mod.php';
64
+					} else {
65
+											$container['body'] = 'alliance_roster.php';
66
+					}
63 67
 					return create_link($container, $alliance->getAllianceDisplayName());
64 68
 				}
65 69
 				return $alliance->getAllianceDisplayName();
@@ -83,8 +87,9 @@  discard block
 block discarded – undo
83 87
 					return true;
84 88
 				}
85 89
 				if ($timeString != '' && ($time = strtotime($timeString)) !== false) {
86
-					if (is_object($account))
87
-						$time += $account->getOffset() * 3600;
90
+					if (is_object($account)) {
91
+											$time += $account->getOffset() * 3600;
92
+					}
88 93
 					return date(DATE_FULL_SHORT, $time);
89 94
 				}
90 95
 			break;
@@ -127,8 +132,7 @@  discard block
 block discarded – undo
127 132
 				return '<div class="buttonA"><a class="buttonA" href="' . SmrSession::getNewHREF($container) . '">Join ' . $alliance->getAllianceDisplayName() . '</a></div>';
128 133
 			break;
129 134
 		}
130
-	}
131
-	catch (Exception $e) {
135
+	} catch (Exception $e) {
132 136
 	}
133 137
 	if ($action == \Nbbc\BBCode::BBCODE_CHECK) {
134 138
 		return false;
@@ -173,15 +177,15 @@  discard block
 block discarded – undo
173 177
 		$bbParser->addRule('join_alliance', $smrRule);
174 178
 	}
175 179
 	global $disableBBLinks;
176
-	if ($noLinks === true)
177
-		$disableBBLinks = true;
178
-	else
179
-		$disableBBLinks = false;
180
+	if ($noLinks === true) {
181
+			$disableBBLinks = true;
182
+	} else {
183
+			$disableBBLinks = false;
184
+	}
180 185
 	if (strpos($message, '[') !== false) { //We have BBCode so let's do a full parse.
181 186
 		$message = $bbParser->parse($message);
182 187
 		$message = str_replace('&lt;br /&gt;', '<br />', $message);
183
-	}
184
-	else { //Otherwise just convert newlines
188
+	} else { //Otherwise just convert newlines
185 189
 		$message = nl2br($message, true);
186 190
 	}
187 191
 	return $message;
@@ -221,8 +225,7 @@  discard block
 block discarded – undo
221 225
 
222 226
 	if (!is_array($actions)) {
223 227
 		$form['submit'] = '<input class="submit" type="submit" name="action" value="' . htmlspecialchars($actions) . '">';
224
-	}
225
-	else {
228
+	} else {
226 229
 		$form['submit'] = array();
227 230
 		foreach ($actions as $action) {
228 231
 			$form['submit'][$action[0]] = '<input class="submit" type="submit" name="action" value="' . htmlspecialchars($action[1]) . '">';
@@ -267,8 +270,9 @@  discard block
 block discarded – undo
267 270
 }
268 271
 
269 272
 function forward($new_container) {
270
-	if (defined('OVERRIDE_FORWARD') && OVERRIDE_FORWARD === true)
271
-		return overrideForward($new_container);
273
+	if (defined('OVERRIDE_FORWARD') && OVERRIDE_FORWARD === true) {
274
+			return overrideForward($new_container);
275
+	}
272 276
 	resetContainer($new_container);
273 277
 	do_voodoo();
274 278
 }
@@ -284,8 +288,9 @@  discard block
 block discarded – undo
284 288
 	global $var, $container;
285 289
 
286 290
 	// transfer this value to next container
287
-	if (isset($var[$what]))
288
-		$container[$what] = $var[$what];
291
+	if (isset($var[$what])) {
292
+			$container[$what] = $var[$what];
293
+	}
289 294
 
290 295
 }
291 296
 
@@ -313,8 +318,7 @@  discard block
 block discarded – undo
313 318
 	}
314 319
 	if ($maxValue - $minValue == 0) {
315 320
 		return $text;
316
-	}
317
-	else {
321
+	} else {
318 322
 		$normalisedValue = round(510 * max(0, min($maxValue, $value) - $minValue) / ($maxValue - $minValue)) - 255;
319 323
 	}
320 324
 	if ($type == 'Game') {
@@ -324,28 +328,33 @@  discard block
 block discarded – undo
324 328
 			if (strlen($g_component) == 1) {
325 329
 				$g_component = '0' . $g_component;
326 330
 			}
327
-		}
328
-		else if ($normalisedValue > 0) {
331
+		} else if ($normalisedValue > 0) {
329 332
 			$g_component = 'ff';
330 333
 			$r_component = dechex(255 - $normalisedValue);
331 334
 			if (strlen($r_component) == 1) {
332 335
 				$r_component = '0' . $r_component;
333 336
 			}
334
-		}
335
-		else {
337
+		} else {
336 338
 			$r_component = 'ff';
337 339
 			$g_component = 'ff';
338 340
 		}
339 341
 		$colour = $r_component . $g_component . '00';
340
-		if ($return_type == 'Colour') return $colour;
342
+		if ($return_type == 'Colour') {
343
+			return $colour;
344
+		}
341 345
 		return '<span style="color:#' . $colour . '">' . $text . '</span>';
342
-	}
343
-	elseif ($type == 'IRC') {
346
+	} elseif ($type == 'IRC') {
344 347
 		//IRC color codes
345
-		if ($normalisedValue == 255) $colour = '[k03]';
346
-		elseif ($normalisedValue == -255) $colour = '[k04]';
347
-		else $colour = '[k08]';
348
-		if ($return_type == 'Colour') return $colour;
348
+		if ($normalisedValue == 255) {
349
+			$colour = '[k03]';
350
+		} elseif ($normalisedValue == -255) {
351
+			$colour = '[k04]';
352
+		} else {
353
+			$colour = '[k08]';
354
+		}
355
+		if ($return_type == 'Colour') {
356
+			return $colour;
357
+		}
349 358
 		return $colour . $text;
350 359
 	}
351 360
 }
@@ -404,10 +413,18 @@  discard block
 block discarded – undo
404 413
 	// create account object
405 414
 	$account = SmrSession::getAccount();
406 415
 
407
-	if (!defined('DATE_DATE_SHORT')) define('DATE_DATE_SHORT', $account->getShortDateFormat());
408
-	if (!defined('DATE_TIME_SHORT')) define('DATE_TIME_SHORT', $account->getShortTimeFormat());
409
-	if (!defined('DATE_FULL_SHORT')) define('DATE_FULL_SHORT', DATE_DATE_SHORT . ' ' . DATE_TIME_SHORT);
410
-	if (!defined('DATE_FULL_SHORT_SPLIT')) define('DATE_FULL_SHORT_SPLIT', DATE_DATE_SHORT . '\<b\r /\>' . DATE_TIME_SHORT);
416
+	if (!defined('DATE_DATE_SHORT')) {
417
+		define('DATE_DATE_SHORT', $account->getShortDateFormat());
418
+	}
419
+	if (!defined('DATE_TIME_SHORT')) {
420
+		define('DATE_TIME_SHORT', $account->getShortTimeFormat());
421
+	}
422
+	if (!defined('DATE_FULL_SHORT')) {
423
+		define('DATE_FULL_SHORT', DATE_DATE_SHORT . ' ' . DATE_TIME_SHORT);
424
+	}
425
+	if (!defined('DATE_FULL_SHORT_SPLIT')) {
426
+		define('DATE_FULL_SHORT_SPLIT', DATE_DATE_SHORT . '\<b\r /\>' . DATE_TIME_SHORT);
427
+	}
411 428
 
412 429
 	if ($var['url'] == 'game_play_preprocessing.php') { // Would rather not have these here but if we go through the initialisation based on game id when leaving a classic game it breaks.
413 430
 		SmrSession::clearLinks();
@@ -466,8 +483,9 @@  discard block
 block discarded – undo
466 483
 
467 484
 		if (!$player->isDead() && $player->getNewbieTurns() <= NEWBIE_TURNS_WARNING_LIMIT &&
468 485
 			$player->getNewbieWarning() &&
469
-			$var['url'] != 'newbie_warning_processing.php')
470
-			forward(create_container('newbie_warning_processing.php'));
486
+			$var['url'] != 'newbie_warning_processing.php') {
487
+					forward(create_container('newbie_warning_processing.php'));
488
+		}
471 489
 	}
472 490
 
473 491
 	// Initialize the template
@@ -545,8 +563,9 @@  discard block
 block discarded – undo
545 563
 function acquire_lock($sector) {
546 564
 	global $db, $lock, $locksFailed;
547 565
 
548
-	if ($lock)
549
-		return true;
566
+	if ($lock) {
567
+			return true;
568
+	}
550 569
 
551 570
 	// Insert ourselves into the queue.
552 571
 	$db->query('INSERT INTO locks_queue (game_id,account_id,sector_id,timestamp) VALUES(' . $db->escapeNumber(SmrSession::getGameID()) . ',' . $db->escapeNumber(SmrSession::getAccountID()) . ',' . $db->escapeNumber($sector) . ',' . $db->escapeNumber(TIME) . ')');
@@ -572,8 +591,7 @@  discard block
 block discarded – undo
572 591
 
573 592
 			usleep(25000 * $locksInQueue);
574 593
 			continue;
575
-		}
576
-		else {
594
+		} else {
577 595
 			return true;
578 596
 		}
579 597
 	}
@@ -770,7 +788,9 @@  discard block
 block discarded – undo
770 788
 		$container['player_id'] = $player->getPlayerID();
771 789
 		$template->assign('PlayerNameLink', SmrSession::getNewHREF($container));
772 790
 
773
-		if (is_array(Globals::getHiddenPlayers()) && in_array($player->getAccountID(), Globals::getHiddenPlayers())) $template->assign('PlayerInvisible', true);
791
+		if (is_array(Globals::getHiddenPlayers()) && in_array($player->getAccountID(), Globals::getHiddenPlayers())) {
792
+			$template->assign('PlayerInvisible', true);
793
+		}
774 794
 
775 795
 		// ******* Hardware *******
776 796
 		$container = create_container('skeleton.php', 'configure_hardware.php');
@@ -910,16 +930,18 @@  discard block
 block discarded – undo
910 930
 
911 931
 function number_colour_format($number, $justSign = false) {
912 932
 	$formatted = '<span';
913
-	if ($number > 0)
914
-		$formatted .= ' class="green">+';
915
-	else if ($number < 0)
916
-		$formatted .= ' class="red">-';
917
-	else
918
-		$formatted .= '>';
933
+	if ($number > 0) {
934
+			$formatted .= ' class="green">+';
935
+	} else if ($number < 0) {
936
+			$formatted .= ' class="red">-';
937
+	} else {
938
+			$formatted .= '>';
939
+	}
919 940
 	if ($justSign === false) {
920 941
 		$decimalPlaces = 0;
921
-		if (($pos = strpos((string)$number, '.')) !== false)
922
-			$decimalPlaces = strlen(substr((string)$number, $pos + 1));
942
+		if (($pos = strpos((string)$number, '.')) !== false) {
943
+					$decimalPlaces = strlen(substr((string)$number, $pos + 1));
944
+		}
923 945
 		$formatted .= number_format(abs($number), $decimalPlaces);
924 946
 	}
925 947
 	$formatted .= '</span>';
Please login to merge, or discard this patch.