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

Failed Conditions
Pull Request — master (#812)
by Dan
04:25
created
engine/Default/message_delete_processing.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,8 +19,7 @@  discard block
 block discarded – undo
19 19
 			while ($db->nextRecord()) {
20 20
 				$message_id_list[] = $db->getInt('message_id');
21 21
 			}
22
-		}
23
-		else {
22
+		} else {
24 23
 			$message_id_list[] = $id;
25 24
 		}
26 25
 	}
@@ -29,20 +28,17 @@  discard block
 block discarded – undo
29 28
 	} else {
30 29
 		$db->query('UPDATE message SET receiver_delete = ' . $db->escapeBoolean(true) . ' WHERE message_id IN (' . $db->escapeArray($message_id_list) . ')');
31 30
 	}
32
-}
33
-else {
31
+} else {
34 32
 	if ($var['folder_id'] == MSG_SCOUT) {
35 33
 		$db->query('UPDATE message SET receiver_delete = ' . $db->escapeBoolean(true) . '
36 34
 					WHERE account_id = ' . $db->escapeNumber($player->getAccountID()) . '
37 35
 						AND message_type_id = '.$db->escapeNumber($var['folder_id']) . '
38 36
 						AND game_id = ' . $db->escapeNumber($player->getGameID()));
39
-	}
40
-	else if ($var['folder_id'] == MSG_SENT) {
37
+	} else if ($var['folder_id'] == MSG_SENT) {
41 38
 		$db->query('UPDATE message SET sender_delete = ' . $db->escapeBoolean(true) . '
42 39
 					WHERE sender_id = ' . $db->escapeNumber($player->getAccountID()) . '
43 40
 						AND game_id = ' . $db->escapeNumber($player->getGameID()));
44
-	}
45
-	else {
41
+	} else {
46 42
 		$db->query('UPDATE message SET receiver_delete = ' . $db->escapeBoolean(true) . '
47 43
 					WHERE account_id = ' . $db->escapeNumber($player->getAccountID()) . '
48 44
 						AND game_id = ' . $db->escapeNumber($player->getGameID()) . '
Please login to merge, or discard this patch.
lib/Album/album_functions.php 1 patch
Braces   +7 added lines, -8 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="?nick=' . 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
 
@@ -87,8 +87,7 @@  discard block
 block discarded – undo
87 87
 		$other = nl2br(stripslashes($db->getField('other')));
88 88
 		$page_views = $db->getInt('page_views');
89 89
 		$disabled = $db->getBoolean('disabled');
90
-	}
91
-	else {
90
+	} else {
92 91
 		echo('<h1>Error</h1>');
93 92
 		echo('This user doesn\'t have an entry in our album!');
94 93
 		return;
@@ -164,9 +163,9 @@  discard block
 block discarded – undo
164 163
 
165 164
 	if (empty($website)) {
166 165
 		$website = 'N/A';
166
+	} else {
167
+			$website = '<a href="' . $website . '" target="_new">' . $website . '</a>';
167 168
 	}
168
-	else
169
-		$website = '<a href="' . $website . '" target="_new">' . $website . '</a>';
170 169
 	echo('<tr>');
171 170
 	echo('<td class="right bold" width="10%">Website:</td><td>' . $website . '</td>');
172 171
 	echo('</tr>');
@@ -225,9 +224,9 @@  discard block
 block discarded – undo
225 224
 		echo('</tr>');
226 225
 		echo('</table>');
227 226
 		echo('</form>');
227
+	} else {
228
+			echo('<p>Please <a href="/login.php?return_page=/album/?nick=' . urlencode($nick) . '"><u>login</u></a> if you want comment on this picture!</p>');
228 229
 	}
229
-	else
230
-		echo('<p>Please <a href="/login.php?return_page=/album/?nick=' . urlencode($nick) . '"><u>login</u></a> if you want comment on this picture!</p>');
231 230
 
232 231
 	echo('</td>');
233 232
 	echo('</tr>');
Please login to merge, or discard this patch.
lib/Default/shop_goods.inc 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -58,10 +58,10 @@
 block discarded – undo
58 58
 
59 59
 			$container['offered_price'] = round($container['ideal_price'] * $offer_modifier / 100);
60 60
 		}
61
+	} else {
62
+			$container['overall_number_of_bargains'] = mt_rand(2, 5);
63
+	}
61 64
 	}
62
-	else
63
-		$container['overall_number_of_bargains'] = mt_rand(2, 5);
64
-}
65 65
 
66 66
 function get_amount() {
67 67
 	global $var;
Please login to merge, or discard this patch.
lib/Default/AbstractSmrLocation.class.php 1 patch
Braces   +10 added lines, -16 removed lines patch added patch discarded remove patch
@@ -98,8 +98,7 @@  discard block
 block discarded – undo
98 98
 			$this->name = $db->getField('location_name');
99 99
 			$this->processor = $db->getField('location_processor');
100 100
 			$this->image = $db->getField('location_image');
101
-		}
102
-		else {
101
+		} else {
103 102
 			throw new Exception('Cannot find location: ' . $locationTypeID);
104 103
 		}
105 104
 	}
@@ -158,8 +157,7 @@  discard block
 block discarded – undo
158 157
 		if ($bool === true) {
159 158
 			$this->db->query('INSERT IGNORE INTO location_is_fed (location_type_id) values (' . $this->db->escapeNumber($this->getTypeID()) . ')');
160 159
 			$this->fed = true;
161
-		}
162
-		else if ($bool === false) {
160
+		} else if ($bool === false) {
163 161
 			$this->db->query('DELETE FROM location_is_fed WHERE ' . $this->SQL . ' LIMIT 1');
164 162
 			$this->fed = false;
165 163
 		}
@@ -180,8 +178,7 @@  discard block
 block discarded – undo
180 178
 		if ($bool === true) {
181 179
 			$this->db->query('INSERT INTO location_is_bank (location_type_id) values (' . $this->db->escapeNumber($this->getTypeID()) . ')');
182 180
 			$this->bank = true;
183
-		}
184
-		else if ($bool === false) {
181
+		} else if ($bool === false) {
185 182
 			$this->db->query('DELETE FROM location_is_bank WHERE ' . $this->SQL . ' LIMIT 1');
186 183
 			$this->bank = false;
187 184
 		}
@@ -202,8 +199,7 @@  discard block
 block discarded – undo
202 199
 		if ($bool === true) {
203 200
 			$this->db->query('INSERT IGNORE INTO location_is_bar (location_type_id) values (' . $this->db->escapeNumber($this->getTypeID()) . ')');
204 201
 			$this->bar = true;
205
-		}
206
-		else if ($bool === false) {
202
+		} else if ($bool === false) {
207 203
 			$this->db->query('DELETE FROM location_is_bar WHERE ' . $this->SQL . ' LIMIT 1');
208 204
 			$this->bar = false;
209 205
 		}
@@ -224,8 +220,7 @@  discard block
 block discarded – undo
224 220
 		if ($bool === true) {
225 221
 			$this->db->query('INSERT IGNORE INTO location_is_hq (location_type_id) values (' . $this->db->escapeNumber($this->getTypeID()) . ')');
226 222
 			$this->HQ = true;
227
-		}
228
-		else if ($bool === false) {
223
+		} else if ($bool === false) {
229 224
 			$this->db->query('DELETE FROM location_is_hq WHERE ' . $this->SQL . ' LIMIT 1');
230 225
 			$this->HQ = false;
231 226
 		}
@@ -246,8 +241,7 @@  discard block
 block discarded – undo
246 241
 		if ($bool === true) {
247 242
 			$this->db->query('INSERT INTO location_is_ug (location_type_id) values (' . $this->db->escapeNumber($this->getTypeID()) . ')');
248 243
 			$this->UG = true;
249
-		}
250
-		else if ($bool === false) {
244
+		} else if ($bool === false) {
251 245
 			$this->db->query('DELETE FROM location_is_ug WHERE ' . $this->SQL . ' LIMIT 1');
252 246
 			$this->UG = false;
253 247
 		}
@@ -335,8 +329,9 @@  discard block
 block discarded – undo
335 329
 		if (!isset($this->weaponsSold)) {
336 330
 			$this->weaponsSold = array();
337 331
 			$this->db->query('SELECT * FROM location_sells_weapons JOIN weapon_type USING (weapon_type_id) WHERE ' . $this->SQL);
338
-			while ($this->db->nextRecord())
339
-				$this->weaponsSold[$this->db->getInt('weapon_type_id')] = SmrWeapon::getWeapon($this->db->getInt('weapon_type_id'), false, $this->db);
332
+			while ($this->db->nextRecord()) {
333
+							$this->weaponsSold[$this->db->getInt('weapon_type_id')] = SmrWeapon::getWeapon($this->db->getInt('weapon_type_id'), false, $this->db);
334
+			}
340 335
 		}
341 336
 		return $this->weaponsSold;
342 337
 	}
@@ -375,8 +370,7 @@  discard block
 block discarded – undo
375 370
 			if ($this->getTypeID() == LOCATION_TYPE_FEDERAL_HQ) {
376 371
 				$linkedLocations[] = SmrLocation::getLocation(LOCATION_TYPE_FEDERAL_BEACON);
377 372
 				$linkedLocations[] = SmrLocation::getLocation(LOCATION_TYPE_FEDERAL_MINT);
378
-			}
379
-			else {
373
+			} else {
380 374
 				$raceID = $this->getRaceID();
381 375
 				$linkedLocations[] = SmrLocation::getLocation(LOCATION_GROUP_RACIAL_BEACONS + $raceID);
382 376
 				$linkedLocations[] = SmrLocation::getLocation(LOCATION_GROUP_RACIAL_SHIPS + $raceID);
Please login to merge, or discard this patch.
lib/Default/MySqlDatabase.class.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -227,8 +227,7 @@
 block discarded – undo
227 227
 				}
228 228
 			}
229 229
 			$string = substr($string, 0, -1);
230
-		}
231
-		else {
230
+		} else {
232 231
 			$string = $this->escape(implode($implodeString, $array), $autoQuotes, $quotes);
233 232
 		}
234 233
 		return $string;
Please login to merge, or discard this patch.
lib/Default/AbstractSmrShip.class.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -273,8 +273,7 @@  discard block
 block discarded – undo
273 273
 		if ($replacement < 0) {
274 274
 			// Shift everything up by one and put the selected weapon at the bottom
275 275
 			array_push($this->weapons, array_shift($this->weapons));
276
-		}
277
-		else {
276
+		} else {
278 277
 			// Swap the selected weapon with the one above it
279 278
 			$temp = $this->weapons[$replacement];
280 279
 			$this->weapons[$replacement] = $this->weapons[$orderID];
@@ -288,8 +287,7 @@  discard block
 block discarded – undo
288 287
 		if ($replacement >= count($this->weapons)) {
289 288
 			// Shift everything down by one and put the selected weapon at the top
290 289
 			array_unshift($this->weapons, array_pop($this->weapons));
291
-		}
292
-		else {
290
+		} else {
293 291
 			// Swap the selected weapon with the one below it
294 292
 			$temp = $this->weapons[$replacement];
295 293
 			$this->weapons[$replacement] = $this->weapons[$orderID];
@@ -348,8 +346,7 @@  discard block
 block discarded – undo
348 346
 			$this->setArmour(150, true);
349 347
 			$this->setCargoHolds(40);
350 348
 			$this->setShipTypeID(SHIP_TYPE_NEWBIE_MERCHANT_VESSEL);
351
-		}
352
-		else {
349
+		} else {
353 350
 			$this->setShields(50, true);
354 351
 			$this->setArmour(50, true);
355 352
 			$this->setCargoHolds(5);
Please login to merge, or discard this patch.
lib/Default/SmrWeapon.class.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -193,22 +193,28 @@
 block discarded – undo
193 193
 	}
194 194
 	
195 195
 	public function &getModifiedDamageAgainstForces(AbstractSmrPlayer $weaponPlayer, SmrForce $forces) {
196
-		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.
197 198
 			return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
199
+		}
198 200
 		$damage =& $this->getModifiedDamage();
199 201
 		return $damage;
200 202
 	}
201 203
 	
202 204
 	public function &getModifiedDamageAgainstPort(AbstractSmrPlayer $weaponPlayer, SmrPort $port) {
203
-		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.
204 207
 			return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
208
+		}
205 209
 		$damage =& $this->getModifiedDamage();
206 210
 		return $damage;
207 211
 	}
208 212
 	
209 213
 	public function &getModifiedDamageAgainstPlanet(AbstractSmrPlayer $weaponPlayer, SmrPlanet $planet) {
210
-		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.
211 216
 			return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
217
+		}
212 218
 		$damage =& $this->getModifiedDamage();
213 219
 		
214 220
 		$planetMod = self::PLANET_DAMAGE_MOD;
Please login to merge, or discard this patch.
lib/Default/SmrForce.class.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -279,8 +279,7 @@  discard block
 block discarded – undo
279 279
 		// Changed (26/10/05) - scout drones count * 2
280 280
 		if ($this->getCDs() == 0 && $this->getMines() == 0 && $this->getSDs() > 0) {
281 281
 			$time = self::TIME_PER_SCOUT_ONLY * $this->getSDs();
282
-		}
283
-		else {
282
+		} else {
284 283
 			$time = ($this->getCDs() * self::TIME_PERCENT_PER_COMBAT + $this->getSDs() * self::TIME_PERCENT_PER_SCOUT + $this->getMines() * self::TIME_PERCENT_PER_MINE) * $this->getMaxGalaxyExpireTime();
285 284
 		}
286 285
 		$this->setExpire(TIME + $time);
@@ -307,11 +306,9 @@  discard block
 block discarded – undo
307 306
 		}
308 307
 		if ($mines < 10) {
309 308
 			$turns = 1;
310
-		}
311
-		else if ($mines < 25) {
309
+		} else if ($mines < 25) {
312 310
 			$turns = 2;
313
-		}
314
-		else {
311
+		} else {
315 312
 			$turns = 3;
316 313
 		}
317 314
 		if ($ship->isFederal() || $ship->hasDCS()) {
@@ -366,12 +363,10 @@  discard block
 block discarded – undo
366 363
 			if (!$this->exists()) {
367 364
 				$this->db->query('DELETE FROM sector_has_forces WHERE ' . $this->SQL);
368 365
 				$this->isNew = true;
369
-			}
370
-			else if ($this->hasChanged) {
366
+			} else if ($this->hasChanged) {
371 367
 				$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);
372 368
 			}
373
-		}
374
-		else if ($this->exists()) {
369
+		} else if ($this->exists()) {
375 370
 			$this->db->query('INSERT INTO sector_has_forces (game_id, sector_id, owner_id, combat_drones, scout_drones, mines, expire_time)
376 371
 								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) . ')');
377 372
 			$this->isNew = false;
Please login to merge, or discard this patch.
lib/Default/SmrPlanet.class.php 1 patch
Braces   +20 added lines, -36 removed lines patch added patch discarded remove patch
@@ -151,26 +151,19 @@  discard block
 block discarded – undo
151 151
 		$level = $this->getLevel();
152 152
 		if ($level < 9) {
153 153
 			return .0404;
154
-		}
155
-		elseif ($level < 19) {
154
+		} elseif ($level < 19) {
156 155
 			return .0609;
157
-		}
158
-		elseif ($level < 29) {
156
+		} elseif ($level < 29) {
159 157
 			return .1236;
160
-		}
161
-		elseif ($level < 39) {
158
+		} elseif ($level < 39) {
162 159
 			return .050625;
163
-		}
164
-		elseif ($level < 49) {
160
+		} elseif ($level < 49) {
165 161
 			return .0404;
166
-		}
167
-		elseif ($level < 59) {
162
+		} elseif ($level < 59) {
168 163
 			return .030225;
169
-		}
170
-		elseif ($level < 69) {
164
+		} elseif ($level < 69) {
171 165
 			return .0201;
172
-		}
173
-		else {
166
+		} else {
174 167
 			return .018081;
175 168
 		}
176 169
 	}
@@ -383,8 +376,7 @@  discard block
 block discarded – undo
383 376
 		}
384 377
 		if ($delayed === false) {
385 378
 			$this->setShields($this->getShields() - $number);
386
-		}
387
-		else {
379
+		} else {
388 380
 			$this->delayedShieldsDelta -= $number;
389 381
 		}
390 382
 	}
@@ -395,8 +387,7 @@  discard block
 block discarded – undo
395 387
 		}
396 388
 		if ($delayed === false) {
397 389
 			$this->setShields($this->getShields() + $number);
398
-		}
399
-		else {
390
+		} else {
400 391
 			$this->delayedShieldsDelta += $number;
401 392
 		}
402 393
 	}
@@ -428,8 +419,7 @@  discard block
 block discarded – undo
428 419
 		}
429 420
 		if ($delayed === false) {
430 421
 			$this->setArmour($this->getArmour() - $number);
431
-		}
432
-		else {
422
+		} else {
433 423
 			$this->delayedArmourDelta -= $number;
434 424
 		}
435 425
 	}
@@ -440,8 +430,7 @@  discard block
 block discarded – undo
440 430
 		}
441 431
 		if ($delayed === false) {
442 432
 			$this->setArmour($this->getArmour() + $number);
443
-		}
444
-		else {
433
+		} else {
445 434
 			$this->delayedArmourDelta += $number;
446 435
 		}
447 436
 	}
@@ -473,8 +462,7 @@  discard block
 block discarded – undo
473 462
 		}
474 463
 		if ($delayed === false) {
475 464
 			$this->setCDs($this->getCDs() - $number);
476
-		}
477
-		else {
465
+		} else {
478 466
 			$this->delayedCDsDelta -= $number;
479 467
 		}
480 468
 	}
@@ -485,8 +473,7 @@  discard block
 block discarded – undo
485 473
 		}
486 474
 		if ($delayed === false) {
487 475
 			$this->setCDs($this->getCDs() + $number);
488
-		}
489
-		else {
476
+		} else {
490 477
 			$this->delayedCDsDelta += $number;
491 478
 		}
492 479
 	}
@@ -580,8 +567,9 @@  discard block
 block discarded – undo
580 567
 			// get supplies from db
581 568
 			$this->db->query('SELECT good_id, amount FROM planet_has_cargo WHERE ' . $this->SQL);
582 569
 			// adding cargo and amount to array
583
-			while ($this->db->nextRecord())
584
-				$this->stockpile[$this->db->getInt('good_id')] = $this->db->getInt('amount');
570
+			while ($this->db->nextRecord()) {
571
+							$this->stockpile[$this->db->getInt('good_id')] = $this->db->getInt('amount');
572
+			}
585 573
 		}
586 574
 		if ($goodID === false) {
587 575
 			return $this->stockpile;
@@ -596,8 +584,7 @@  discard block
 block discarded – undo
596 584
 		if ($goodID === false) {
597 585
 			$stockpile = $this->getStockpile($goodID);
598 586
 			return count($stockpile) > 0 && max($stockpile) > 0;
599
-		}
600
-		else {
587
+		} else {
601 588
 			return $this->getStockpile($goodID) > 0;
602 589
 		}
603 590
 	}
@@ -831,8 +818,7 @@  discard block
 block discarded – undo
831 818
 				if ($amount != 0) {
832 819
 					$this->db->query('REPLACE INTO planet_has_cargo (game_id, sector_id, good_id, amount) ' .
833 820
 										 'VALUES(' . $this->db->escapeNumber($this->getGameID()) . ', ' . $this->db->escapeNumber($this->getSectorID()) . ', ' . $this->db->escapeNumber($id) . ', ' . $this->db->escapeNumber($amount) . ')');
834
-				}
835
-				else {
821
+				} else {
836 822
 					$this->db->query('DELETE FROM planet_has_cargo WHERE ' . $this->SQL . '
837 823
 										AND good_id = ' . $this->db->escapeNumber($id));
838 824
 				}
@@ -861,8 +847,7 @@  discard block
 block discarded – undo
861 847
 				if ($this->hasBuilding($id)) {
862 848
 					$this->db->query('REPLACE INTO planet_has_building (game_id, sector_id, construction_id, amount) ' .
863 849
 										'VALUES(' . $this->db->escapeNumber($this->gameID) . ', ' . $this->db->escapeNumber($this->sectorID) . ', ' . $this->db->escapeNumber($id) . ', ' . $this->db->escapeNumber($this->getBuilding($id)) . ')');
864
-				}
865
-				else {
850
+				} else {
866 851
 					$this->db->query('DELETE FROM planet_has_building WHERE ' . $this->SQL . '
867 852
 										AND construction_id = ' . $this->db->escapeNumber($id));
868 853
 				}
@@ -1236,8 +1221,7 @@  discard block
 block discarded – undo
1236 1221
 					}
1237 1222
 				}
1238 1223
 
1239
-			}
1240
-			else { // hit drones behind shields - we should only use this reduced damage branch if we cannot hit shields.
1224
+			} else { // hit drones behind shields - we should only use this reduced damage branch if we cannot hit shields.
1241 1225
 				$cdDamage = $this->doCDDamage(IFloor(min($damage['MaxDamage'], $damage['Armour']) * DRONES_BEHIND_SHIELDS_DAMAGE_PERCENT), $delayed);
1242 1226
 			}
1243 1227
 		}
Please login to merge, or discard this patch.