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/preferences_processing.php 1 patch
Braces   +29 added lines, -40 removed lines patch added patch discarded remove patch
@@ -3,8 +3,7 @@  discard block
 block discarded – undo
3 3
 $container = create_container('skeleton.php');
4 4
 if (SmrSession::hasGame()) {
5 5
 	$container['body'] = 'current_sector.php';
6
-}
7
-else {
6
+} else {
8 7
 	$container['body'] = 'game_play.php';
9 8
 }
10 9
 $action = $_REQUEST['action'];
@@ -17,8 +16,7 @@  discard block
 block discarded – undo
17 16
 	// overwrite container
18 17
 	$container['body'] = 'validate.php';
19 18
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your email address, you will now need to revalidate with the code sent to the new email address.';
20
-}
21
-elseif ($action == 'Change Password') {
19
+} elseif ($action == 'Change Password') {
22 20
 	$new_password = $_REQUEST['new_password'];
23 21
 	$old_password = $_REQUEST['old_password'];
24 22
 	$retype_password = $_REQUEST['retype_password'];
@@ -41,8 +39,7 @@  discard block
 block discarded – undo
41 39
 
42 40
 	$account->setPassword($new_password);
43 41
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your password.';
44
-}
45
-elseif ($action == 'Change Name') {
42
+} elseif ($action == 'Change Name') {
46 43
 	$HoF_name = trim($_REQUEST['HoF_name']);
47 44
 
48 45
 	$limited_char = 0;
@@ -67,18 +64,20 @@  discard block
 block discarded – undo
67 64
 	}
68 65
 
69 66
 	//disallow blank names
70
-	if (empty($HoF_name) || $HoF_name == '') create_error('You Hall of Fame name must contain characters!');
67
+	if (empty($HoF_name) || $HoF_name == '') {
68
+		create_error('You Hall of Fame name must contain characters!');
69
+	}
71 70
 
72 71
 	//no duplicates
73 72
 	$db->query('SELECT * FROM account WHERE hof_name = ' . $db->escapeString($HoF_name) . ' AND account_id != ' . $db->escapeNumber($account->getAccountID()) . ' LIMIT 1');
74
-	if ($db->nextRecord()) create_error('Someone is already using that name!');
73
+	if ($db->nextRecord()) {
74
+		create_error('Someone is already using that name!');
75
+	}
75 76
 
76 77
 	// set the HoF name in account stat
77 78
 	$account->setHofName($HoF_name);
78 79
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your hall of fame name.';
79
-}
80
-
81
-elseif ($action == 'Change Discord ID') {
80
+} elseif ($action == 'Change Discord ID') {
82 81
 	$discordId = trim($_REQUEST['discord_id']);
83 82
 
84 83
 	if (empty($discordId)) {
@@ -88,14 +87,14 @@  discard block
 block discarded – undo
88 87
 	} else {
89 88
 		// no duplicates
90 89
 		$db->query('SELECT * FROM account WHERE discord_id =' . $db->escapeString($discordId) . ' AND account_id != ' . $db->escapeNumber($account->getAccountID()) . ' LIMIT 1');
91
-		if ($db->nextRecord()) create_error('Someone is already using that Discord User ID!');
90
+		if ($db->nextRecord()) {
91
+			create_error('Someone is already using that Discord User ID!');
92
+		}
92 93
 
93 94
 		$account->setDiscordId($discordId);
94 95
 		$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your Discord User ID.';
95 96
 	}
96
-}
97
-
98
-elseif ($action == 'Change IRC Nick') {
97
+} elseif ($action == 'Change IRC Nick') {
99 98
 	$ircNick = trim($_REQUEST['irc_nick']);
100 99
 
101 100
 	for ($i = 0; $i < strlen($ircNick); $i++) {
@@ -113,7 +112,9 @@  discard block
 block discarded – undo
113 112
 
114 113
 		// no duplicates
115 114
 		$db->query('SELECT * FROM account WHERE irc_nick = ' . $db->escapeString($ircNick) . ' AND account_id != ' . $db->escapeNumber($account->getAccountID()) . ' LIMIT 1');
116
-		if ($db->nextRecord()) create_error('Someone is already using that nick!');
115
+		if ($db->nextRecord()) {
116
+			create_error('Someone is already using that nick!');
117
+		}
117 118
 
118 119
 		// save irc nick in db and set message
119 120
 		$account->setIrcNick($ircNick);
@@ -121,8 +122,7 @@  discard block
 block discarded – undo
121 122
 
122 123
 	}
123 124
 
124
-}
125
-elseif ($action == 'Yes') {
125
+} elseif ($action == 'Yes') {
126 126
 	$account_id = $var['account_id'];
127 127
 	$amount = $var['amount'];
128 128
 
@@ -134,8 +134,7 @@  discard block
 block discarded – undo
134 134
 	// add to him
135 135
 	$his_account->increaseSmrCredits($amount);
136 136
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have sent SMR credits.';
137
-}
138
-elseif ($action == 'Change Timezone') {
137
+} elseif ($action == 'Change Timezone') {
139 138
 	$timez = $_REQUEST['timez'];
140 139
 	if (!is_numeric($timez)) {
141 140
 		create_error('Numbers only please');
@@ -143,25 +142,20 @@  discard block
 block discarded – undo
143 142
 
144 143
 	$db->query('UPDATE account SET offset = ' . $db->escapeNumber($timez) . ' WHERE account_id = ' . $db->escapeNumber($account->getAccountID()));
145 144
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your time offset.';
146
-}
147
-elseif ($action == 'Change Date Formats') {
145
+} elseif ($action == 'Change Date Formats') {
148 146
 	$account->setShortDateFormat($_REQUEST['dateformat']);
149 147
 	$account->setShortTimeFormat($_REQUEST['timeformat']);
150 148
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your date formats.';
151
-}
152
-elseif ($action == 'Change Images') {
149
+} elseif ($action == 'Change Images') {
153 150
 	$account->setDisplayShipImages($_REQUEST['images']);
154 151
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your ship images preferences.';
155
-}
156
-elseif ($action == 'Change Centering') {
152
+} elseif ($action == 'Change Centering') {
157 153
 	$account->setCenterGalaxyMapOnPlayer($_REQUEST['centergalmap'] == 'Yes');
158 154
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your centering galaxy map preferences.';
159
-}
160
-else if ($action == 'Change Size' && is_numeric($_REQUEST['fontsize']) && $_REQUEST['fontsize'] >= 50) {
155
+} else if ($action == 'Change Size' && is_numeric($_REQUEST['fontsize']) && $_REQUEST['fontsize'] >= 50) {
161 156
 	$account->setFontSize($_REQUEST['fontsize']);
162 157
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your font size.';
163
-}
164
-else if ($action == 'Change CSS Options') {
158
+} else if ($action == 'Change CSS Options') {
165 159
 	$account->setCssLink($_REQUEST['csslink']);
166 160
 	if ($_REQUEST['template'] == 'None') {
167 161
 		$account->setDefaultCSSEnabled(false);
@@ -172,24 +166,20 @@  discard block
 block discarded – undo
172 166
 		$account->setColourScheme($cssColourScheme);
173 167
 	}
174 168
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your CSS options.';
175
-}
176
-else if ($action == 'Change Kamikaze Setting') {
169
+} else if ($action == 'Change Kamikaze Setting') {
177 170
 	$player->setCombatDronesKamikazeOnMines($_REQUEST['kamikaze'] == 'Yes');
178 171
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your combat drones options.';
179
-}
180
-else if ($action == 'Change Message Setting') {
172
+} else if ($action == 'Change Message Setting') {
181 173
 	$player->setForceDropMessages($_REQUEST['forceDropMessages'] == 'Yes');
182 174
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your message options.';
183
-}
184
-else if ($action == 'Save Hotkeys') {
175
+} else if ($action == 'Save Hotkeys') {
185 176
 	foreach (AbstractSmrAccount::getDefaultHotkeys() as $hotkey => $binding) {
186 177
 		if (isset($_REQUEST[$hotkey])) {
187 178
 			$account->setHotkey($hotkey, explode(' ', $_REQUEST[$hotkey]));
188 179
 		}
189 180
 	}
190 181
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have saved your hotkeys.';
191
-}
192
-else if (strpos(trim($action), 'Alter Player') === 0) {
182
+} else if (strpos(trim($action), 'Alter Player') === 0) {
193 183
 	// trim input now
194 184
 	$player_name = trim($_POST['PlayerName']);
195 185
 
@@ -247,8 +237,7 @@  discard block
 block discarded – undo
247 237
 	$news = 'Please be advised that ' . $old_name . ' has changed their name to ' . $player->getBBLink();
248 238
 	$db->query('INSERT INTO news (time, news_message, game_id, type) VALUES (' . $db->escapeNumber(TIME) . ',' . $db->escapeString($news) . ',' . $db->escapeNumber($player->getGameID()) . ', \'admin\')');
249 239
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your player name.';
250
-}
251
-else if ($action == 'Update Colours') {
240
+} else if ($action == 'Update Colours') {
252 241
 	$friendlyColour = $_REQUEST['friendly_color'];
253 242
 	$neutralColour = $_REQUEST['neutral_color'];
254 243
 	$enemyColour = $_REQUEST['enemy_color'];
Please login to merge, or discard this patch.
engine/Default/course_plot_nearest_processing.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,8 +2,7 @@
 block discarded – undo
2 2
 
3 3
 if (isset($var['RealX'])) {
4 4
 	$realX = $var['RealX'];
5
-}
6
-else {
5
+} else {
7 6
 	if (!isset($_REQUEST['xtype']) || !isset($_REQUEST['X'])) {
8 7
 		create_error('You have to select what you would like to find.');
9 8
 	}
Please login to merge, or discard this patch.
engine/Default/sector_jump_processing.php 1 patch
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -4,8 +4,11 @@  discard block
 block discarded – undo
4 4
 	create_error('You cannot move until the game has started!');
5 5
 }
6 6
 
7
-if (isset($_REQUEST['target'])) $target = trim($_REQUEST['target']);
8
-else $target = $var['target'];
7
+if (isset($_REQUEST['target'])) {
8
+	$target = trim($_REQUEST['target']);
9
+} else {
10
+	$target = $var['target'];
11
+}
9 12
 
10 13
 //allow hidden players (admins that don't play) to move without pinging, hitting mines, losing turns
11 14
 if (in_array($player->getAccountID(), Globals::getHiddenPlayers())) {
@@ -86,8 +89,7 @@  discard block
 block discarded – undo
86 89
 	}
87 90
 	$player->setSectorID($misjumpSector);
88 91
 	unset($distances);
89
-}
90
-else { // we hit it. exactly
92
+} else { // we hit it. exactly
91 93
 	$player->setSectorID($targetSector->getSectorID());
92 94
 }
93 95
 $player->takeTurns($turnsToJump, $turnsToJump);
@@ -124,8 +126,7 @@  discard block
 block discarded – undo
124 126
 		$container = create_container('skeleton.php', 'current_sector.php');
125 127
 		$container['msg'] = 'You have just flown past a sprinkle of mines.<br />Because of your newbie status you have been spared from the harsh reality of the forces.';
126 128
 		forward($container);
127
-	}
128
-	else {
129
+	} else {
129 130
 		$container = create_container('forces_attack_processing.php');
130 131
 		$container['action'] = 'bump';
131 132
 		$container['owner_id'] = $mineOwnerID;
Please login to merge, or discard this patch.
engine/Default/planet_financial_processing.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,8 +28,7 @@
 block discarded – undo
28 28
 		$player->decreaseCredits($amount);
29 29
 		$planet->increaseCredits($amount);
30 30
 		$account->log(LOG_TYPE_BANK, 'Player puts ' . $amount . ' credits on planet', $player->getSectorID());
31
-	}
32
-	elseif ($action == 'Withdraw') {
31
+	} elseif ($action == 'Withdraw') {
33 32
 		if ($planet->getCredits() < $amount) {
34 33
 			create_error('There are not enough credits in the planetary account!');
35 34
 		}
Please login to merge, or discard this patch.
engine/Default/course_plot_processing.php 1 patch
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,9 +1,15 @@
 block discarded – undo
1 1
 <?php declare(strict_types=1);
2 2
 
3
-if (isset($var['from'])) $start = $var['from'];
4
-else $start = trim($_POST['from']);
5
-if (isset($var['to'])) $target = $var['to'];
6
-else $target = trim($_POST['to']);
3
+if (isset($var['from'])) {
4
+	$start = $var['from'];
5
+} else {
6
+	$start = trim($_POST['from']);
7
+}
8
+if (isset($var['to'])) {
9
+	$target = $var['to'];
10
+} else {
11
+	$target = trim($_POST['to']);
12
+}
7 13
 
8 14
 // perform some basic checks on both numbers
9 15
 if (empty($start) || empty($target)) {
Please login to merge, or discard this patch.
engine/Default/hall_of_fame_new.php 1 patch
Braces   +9 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,18 +1,21 @@  discard block
 block discarded – undo
1 1
 <?php declare(strict_types=1);
2 2
 require_once(get_file_loc('hof.functions.inc'));
3 3
 $game_id = null;
4
-if (isset($var['game_id'])) $game_id = $var['game_id'];
4
+if (isset($var['game_id'])) {
5
+	$game_id = $var['game_id'];
6
+}
5 7
 
6 8
 if (empty($game_id)) {
7 9
 	$topic = 'All Time Hall of Fame';
8
-}
9
-else {
10
+} else {
10 11
 	$topic = 'Hall of Fame: ' . SmrGame::getGame($game_id)->getDisplayName();
11 12
 }
12 13
 $template->assign('PageTopic', $topic);
13 14
 
14 15
 $container = create_container('skeleton.php', 'hall_of_fame_player_detail.php');
15
-if (isset($game_id)) $container['game_id'] = $game_id;
16
+if (isset($game_id)) {
17
+	$container['game_id'] = $game_id;
18
+}
16 19
 $template->assign('PersonalHofHREF', SmrSession::getNewHREF($container));
17 20
 
18 21
 $db->query('SELECT type FROM hof_visibility WHERE visibility != ' . $db->escapeString(HOF_PRIVATE) . ' ORDER BY type');
@@ -35,8 +38,7 @@  discard block
 block discarded – undo
35 38
 if (!isset($var['view'])) {
36 39
 	$categories = getHofCategories($hofTypes, $game_id, $account->getAccountID());
37 40
 	$template->assign('Categories', $categories);
38
-}
39
-else {
41
+} else {
40 42
 	$gameIDSql = ' AND game_id ' . (isset($game_id) ? '= ' . $db->escapeNumber($game_id) : 'IN (SELECT game_id FROM game WHERE end_time < ' . TIME . ' AND ignore_stats = ' . $db->escapeBoolean(false) . ')');
41 43
 
42 44
 	$vis = HOF_PUBLIC;
@@ -51,8 +53,7 @@  discard block
 block discarded – undo
51 53
 		$statements = SmrAccount::getUserScoreCaseStatement($db);
52 54
 		$query = 'SELECT account_id, ' . $statements['CASE'] . ' amount FROM (SELECT account_id, type, SUM(amount) amount FROM player_hof WHERE type IN (' . $statements['IN'] . ')' . $gameIDSql . ' GROUP BY account_id,type) x GROUP BY account_id ORDER BY amount DESC, account_id ASC LIMIT 25';
53 55
 		$db->query($query);
54
-	}
55
-	else {
56
+	} else {
56 57
 		$db->query('SELECT visibility FROM hof_visibility WHERE type = ' . $db->escapeArray($viewType, false, true, ':', false) . ' LIMIT 1');
57 58
 		if ($db->nextRecord()) {
58 59
 			$vis = $db->getField('visibility');
Please login to merge, or discard this patch.
engine/Default/current_sector.php 1 patch
Braces   +14 added lines, -9 removed lines patch added patch discarded remove patch
@@ -35,9 +35,13 @@  discard block
 block discarded – undo
35 35
 
36 36
 foreach ($links as $key => $linkArray) {
37 37
 	if ($linkArray['ID'] > 0 && $linkArray['ID'] != $player->getSectorID()) {
38
-		if ($player->getLastSectorID() == $linkArray['ID']) $class = 'lastVisited';
39
-		else if (isset($unvisited[$linkArray['ID']])) $class = 'unvisited';
40
-		else $class = 'visited';
38
+		if ($player->getLastSectorID() == $linkArray['ID']) {
39
+			$class = 'lastVisited';
40
+		} else if (isset($unvisited[$linkArray['ID']])) {
41
+			$class = 'unvisited';
42
+		} else {
43
+			$class = 'visited';
44
+		}
41 45
 		$links[$key]['Class'] = $class;
42 46
 	}
43 47
 }
@@ -83,11 +87,9 @@  discard block
 block discarded – undo
83 87
 	} else {
84 88
 		$protectionMessage = '<span class="blue">PROTECTION</span>: You are under <span class="green">NEWBIE</span> protection.';
85 89
 	}
86
-}
87
-elseif ($player->hasFederalProtection()) {
90
+} elseif ($player->hasFederalProtection()) {
88 91
 	$protectionMessage = '<span class="blue">PROTECTION</span>: You are under <span class="blue">FEDERAL</span> protection.';
89
-}
90
-elseif ($sector->offersFederalProtection()) {
92
+} elseif ($sector->offersFederalProtection()) {
91 93
 	$protectionMessage = '<span class="blue">PROTECTION</span>: You are <span class="red">NOT</span> under protection.';
92 94
 }
93 95
 
@@ -117,7 +119,9 @@  discard block
 block discarded – undo
117 119
 }
118 120
 
119 121
 //error msgs take precedence
120
-if (isset($var['errorMsg'])) $template->assign('ErrorMessage', $var['errorMsg']);
122
+if (isset($var['errorMsg'])) {
123
+	$template->assign('ErrorMessage', $var['errorMsg']);
124
+}
121 125
 
122 126
 // *******************************************
123 127
 // *
@@ -152,8 +156,9 @@  discard block
 block discarded – undo
152 156
 				$remainingTime = $db->getInt('refresh_at') - TIME;
153 157
 				$forceRefreshMessage = '<span class="green">REFRESH</span>: All forces will be refreshed in ' . $remainingTime . ' seconds.';
154 158
 				$db->query('REPLACE INTO sector_message (game_id, account_id, message) VALUES (' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeNumber($player->getAccountID()) . ', \'[Force Check]\')');
159
+			} else {
160
+				$forceRefreshMessage = '<span class="green">REFRESH</span>: All forces have finished refreshing.';
155 161
 			}
156
-			else $forceRefreshMessage = '<span class="green">REFRESH</span>: All forces have finished refreshing.';
157 162
 			$template->assign('ForceRefreshMessage', $forceRefreshMessage);
158 163
 		}
159 164
 	}
Please login to merge, or discard this patch.
engine/Default/feature_request_vote_processing.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,8 +15,7 @@
 block discarded – undo
15 15
 	}
16 16
 
17 17
 	forward(create_container('skeleton.php', 'feature_request.php'));
18
-}
19
-else if ($_REQUEST['action'] == 'Set Status') {
18
+} else if ($_REQUEST['action'] == 'Set Status') {
20 19
 	if (empty($_REQUEST['status'])) {
21 20
 		create_error('You have to select a status to set');
22 21
 	}
Please login to merge, or discard this patch.
engine/Default/bank_anon_detail_processing.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,8 +21,7 @@  discard block
 block discarded – undo
21 21
 	$db->query('SELECT transaction_id FROM anon_bank_transactions WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND anon_id = ' . $db->escapeNumber($account_num) . ' ORDER BY transaction_id DESC LIMIT 1');
22 22
 	if ($db->nextRecord()) {
23 23
 		$trans_id = $db->getInt('transaction_id') + 1;
24
-	}
25
-	else {
24
+	} else {
26 25
 		$trans_id = 1;
27 26
 	}
28 27
 	$db->query('INSERT INTO anon_bank_transactions (account_id, game_id, anon_id, transaction_id, transaction, amount, time) ' .
@@ -32,8 +31,7 @@  discard block
 block discarded – undo
32 31
 
33 32
 	// log action
34 33
 	$account->log(LOG_TYPE_BANK, 'Deposits ' . $amount . ' credits in anonymous account #' . $account_num, $player->getSectorID());
35
-}
36
-else {
34
+} else {
37 35
 	$db->query('SELECT * FROM anon_bank WHERE anon_id = ' . $db->escapeNumber($account_num) . ' AND game_id = ' . $db->escapeNumber($player->getGameID()));
38 36
 	$db->nextRecord();
39 37
 	if ($db->getInt('amount') < $amount) {
@@ -42,8 +40,7 @@  discard block
 block discarded – undo
42 40
 	$db->query('SELECT transaction_id FROM anon_bank_transactions WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND anon_id = ' . $db->escapeNumber($account_num) . ' ORDER BY transaction_id DESC LIMIT 1');
43 41
 	if ($db->nextRecord()) {
44 42
 		$trans_id = $db->getInt('transaction_id') + 1;
45
-	}
46
-	else {
43
+	} else {
47 44
 		$trans_id = 1;
48 45
 	}
49 46
 	$db->query('INSERT INTO anon_bank_transactions (account_id, game_id, anon_id, transaction_id, transaction, amount, time)
Please login to merge, or discard this patch.