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
Push — master ( 8d8584...432c27 )
by Dan
31s queued 20s
created
tools/discord/commands/game.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,9 @@
 block discarded – undo
2 2
 
3 3
 $fn_game = function($message) {
4 4
 	$link = new GameLink($message->channel, $message->author);
5
-	if (!$link->valid) return;
5
+	if (!$link->valid) {
6
+		return;
7
+	}
6 8
 
7 9
 	$game = SmrGame::getGame($link->player->getGameID(), true);
8 10
 	$msg = "I am linked to game `" . $game->getDisplayName() . "` in this channel.";
Please login to merge, or discard this patch.
tools/discord/commands/money.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,9 @@
 block discarded – undo
4 4
 
5 5
 $fn_money = function($message) {
6 6
 	$link = new GameLink($message->channel, $message->author);
7
-	if (!$link->valid) return;
7
+	if (!$link->valid) {
8
+		return;
9
+	}
8 10
 
9 11
 	$result = shared_channel_msg_money($link->player);
10 12
 	if ($result) {
Please login to merge, or discard this patch.
tools/discord/commands/forces.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,9 @@
 block discarded – undo
4 4
 
5 5
 $fn_forces = function($message, $params) {
6 6
 	$link = new GameLink($message->channel, $message->author);
7
-	if (!$link->valid) return;
7
+	if (!$link->valid) {
8
+		return;
9
+	}
8 10
 
9 11
 	// print the next expiring forces
10 12
 	$option = isset($params[0]) ? $params[0] : null;
Please login to merge, or discard this patch.
engine/Default/feature_request_vote_processing.php 1 patch
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -10,20 +10,22 @@
 block discarded – undo
10 10
 		}
11 11
 		$db->query(substr($query, 0, -1));
12 12
 	}
13
-	if (!empty($_REQUEST['favourite']) && is_numeric($_REQUEST['favourite']))
14
-		$db->query('REPLACE INTO account_votes_for_feature VALUES(' . $db->escapeNumber($account->getAccountID()) . ', ' . $db->escapeNumber($_REQUEST['favourite']) . ',\'FAVOURITE\')');
13
+	if (!empty($_REQUEST['favourite']) && is_numeric($_REQUEST['favourite'])) {
14
+			$db->query('REPLACE INTO account_votes_for_feature VALUES(' . $db->escapeNumber($account->getAccountID()) . ', ' . $db->escapeNumber($_REQUEST['favourite']) . ',\'FAVOURITE\')');
15
+	}
15 16
 
16 17
 	forward(create_container('skeleton.php', 'feature_request.php'));
17
-}
18
-else if ($_REQUEST['action'] == 'Set Status') {
18
+} else if ($_REQUEST['action'] == 'Set Status') {
19 19
 	if (empty($_REQUEST['status'])) {
20 20
 		create_error('You have to select a status to set');
21 21
 	}
22 22
 	$status = $_REQUEST['status'];
23
-	if (empty($_REQUEST['set_status_ids']))
24
-		create_error('You have to select a feature');
25
-	if (!$account->hasPermission(PERMISSION_MODERATE_FEATURE_REQUEST))
26
-		create_error('You do not have permission to do that');
23
+	if (empty($_REQUEST['set_status_ids'])) {
24
+			create_error('You have to select a feature');
25
+	}
26
+	if (!$account->hasPermission(PERMISSION_MODERATE_FEATURE_REQUEST)) {
27
+			create_error('You do not have permission to do that');
28
+	}
27 29
 
28 30
 	$db->query('UPDATE feature_request fr SET status = ' . $db->escapeString($status) . '
29 31
 			, fav = (
Please login to merge, or discard this patch.
engine/Default/course_plot_nearest_processing.php 1 patch
Braces   +6 added lines, -5 removed lines patch added patch discarded remove patch
@@ -2,10 +2,10 @@  discard block
 block discarded – undo
2 2
 
3 3
 if (isset($var['RealX'])) {
4 4
 	$realX = $var['RealX'];
5
-}
6
-else {
7
-	if (!isset($_REQUEST['xtype']) || !isset($_REQUEST['X']))
8
-		create_error('You have to select what you would like to find.');
5
+} else {
6
+	if (!isset($_REQUEST['xtype']) || !isset($_REQUEST['X'])) {
7
+			create_error('You have to select what you would like to find.');
8
+	}
9 9
 	$xType = $_REQUEST['xtype'];
10 10
 	$X = $_REQUEST['X'];
11 11
 	$realX = Plotter::getX($xType, $X, $player->getGameID(), $player);
@@ -16,8 +16,9 @@  discard block
 block discarded – undo
16 16
 	$account->log(LOG_TYPE_MOVEMENT, 'Player plots to nearest ' . $xType . ': ' . $X . '.', $player->getSectorID());
17 17
 }
18 18
 
19
-if ($sector->hasX($realX, $player))
19
+if ($sector->hasX($realX, $player)) {
20 20
 	create_error('Current sector has what you\'re looking for!');
21
+}
21 22
 
22 23
 $path = Plotter::findReversiblePathToX($realX, $sector, true, $player, $player);
23 24
 
Please login to merge, or discard this patch.
engine/Default/weapon_reorder.php 1 patch
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,6 +11,7 @@
 block discarded – undo
11 11
 }
12 12
 
13 13
 if (isset($var['Form'])) {
14
-	if (isset($_REQUEST['weapon_reorder']) && is_array($_REQUEST['weapon_reorder']))
15
-		$ship->setWeaponLocations($_REQUEST['weapon_reorder']);
16
-}
14
+	if (isset($_REQUEST['weapon_reorder']) && is_array($_REQUEST['weapon_reorder'])) {
15
+			$ship->setWeaponLocations($_REQUEST['weapon_reorder']);
16
+	}
17
+	}
Please login to merge, or discard this patch.
engine/Default/preferences_processing.php 1 patch
Braces   +62 added lines, -62 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,35 +16,38 @@  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'];
25 23
 
26
-	if (empty($new_password))
27
-		create_error('You must enter a non empty password!');
24
+	if (empty($new_password)) {
25
+			create_error('You must enter a non empty password!');
26
+	}
28 27
 
29
-	if (!$account->checkPassword($old_password))
30
-		create_error('Your current password is wrong!');
28
+	if (!$account->checkPassword($old_password)) {
29
+			create_error('Your current password is wrong!');
30
+	}
31 31
 
32
-	if ($new_password != $retype_password)
33
-		create_error('The passwords you entered don\'t match!');
32
+	if ($new_password != $retype_password) {
33
+			create_error('The passwords you entered don\'t match!');
34
+	}
34 35
 
35
-	if ($new_password == $account->getLogin())
36
-		create_error('Your chosen password is invalid!');
36
+	if ($new_password == $account->getLogin()) {
37
+			create_error('Your chosen password is invalid!');
38
+	}
37 39
 
38 40
 	$account->setPassword($new_password);
39 41
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your password.';
40
-}
41
-elseif ($action == 'Change Name') {
42
+} elseif ($action == 'Change Name') {
42 43
 	$HoF_name = trim($_REQUEST['HoF_name']);
43 44
 
44 45
 	$limited_char = 0;
45 46
 	for ($i = 0; $i < strlen($HoF_name); $i++) {
46 47
 		// disallow certain ascii chars
47
-		if (ord($HoF_name[$i]) < 32 || ord($HoF_name[$i]) > 127)
48
-			create_error('Your Hall Of Fame name contains invalid characters!');
48
+		if (ord($HoF_name[$i]) < 32 || ord($HoF_name[$i]) > 127) {
49
+					create_error('Your Hall Of Fame name contains invalid characters!');
50
+		}
49 51
 
50 52
 		// numbers 48..57
51 53
 		// Letters 65..90
@@ -57,23 +59,26 @@  discard block
 block discarded – undo
57 59
 		}
58 60
 	}
59 61
 
60
-	if ($limited_char > 4)
61
-		create_error('You cannot use a name with more than 4 special characters.');
62
+	if ($limited_char > 4) {
63
+			create_error('You cannot use a name with more than 4 special characters.');
64
+	}
62 65
 
63 66
 
64 67
 	//disallow blank names
65
-	if (empty($HoF_name) || $HoF_name == '') create_error('You Hall of Fame name must contain characters!');
68
+	if (empty($HoF_name) || $HoF_name == '') {
69
+		create_error('You Hall of Fame name must contain characters!');
70
+	}
66 71
 
67 72
 	//no duplicates
68 73
 	$db->query('SELECT * FROM account WHERE hof_name = ' . $db->escapeString($HoF_name) . ' AND account_id != ' . $db->escapeNumber($account->getAccountID()) . ' LIMIT 1');
69
-	if ($db->nextRecord()) create_error('Someone is already using that name!');
74
+	if ($db->nextRecord()) {
75
+		create_error('Someone is already using that name!');
76
+	}
70 77
 
71 78
 	// set the HoF name in account stat
72 79
 	$account->setHofName($HoF_name);
73 80
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your hall of fame name.';
74
-}
75
-
76
-elseif ($action == 'Change Discord ID') {
81
+} elseif ($action == 'Change Discord ID') {
77 82
 	$discordId = trim($_REQUEST['discord_id']);
78 83
 
79 84
 	if (empty($discordId)) {
@@ -83,20 +88,21 @@  discard block
 block discarded – undo
83 88
 	} else {
84 89
 		// no duplicates
85 90
 		$db->query('SELECT * FROM account WHERE discord_id =' . $db->escapeString($discordId) . ' AND account_id != ' . $db->escapeNumber($account->getAccountID()) . ' LIMIT 1');
86
-		if ($db->nextRecord()) create_error('Someone is already using that Discord User ID!');
91
+		if ($db->nextRecord()) {
92
+			create_error('Someone is already using that Discord User ID!');
93
+		}
87 94
 
88 95
 		$account->setDiscordId($discordId);
89 96
 		$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your Discord User ID.';
90 97
 	}
91
-}
92
-
93
-elseif ($action == 'Change IRC Nick') {
98
+} elseif ($action == 'Change IRC Nick') {
94 99
 	$ircNick = trim($_REQUEST['irc_nick']);
95 100
 
96 101
 	for ($i = 0; $i < strlen($ircNick); $i++) {
97 102
 		// disallow certain ascii chars (and whitespace!)
98
-		if (ord($ircNick[$i]) < 33 || ord($ircNick[$i]) > 127)
99
-			create_error('Your IRC Nick contains invalid characters!');
103
+		if (ord($ircNick[$i]) < 33 || ord($ircNick[$i]) > 127) {
104
+					create_error('Your IRC Nick contains invalid characters!');
105
+		}
100 106
 	}
101 107
 
102 108
 	// here you can delete your registered irc nick
@@ -107,7 +113,9 @@  discard block
 block discarded – undo
107 113
 
108 114
 		// no duplicates
109 115
 		$db->query('SELECT * FROM account WHERE irc_nick = ' . $db->escapeString($ircNick) . ' AND account_id != ' . $db->escapeNumber($account->getAccountID()) . ' LIMIT 1');
110
-		if ($db->nextRecord()) create_error('Someone is already using that nick!');
116
+		if ($db->nextRecord()) {
117
+			create_error('Someone is already using that nick!');
118
+		}
111 119
 
112 120
 		// save irc nick in db and set message
113 121
 		$account->setIrcNick($ircNick);
@@ -115,8 +123,7 @@  discard block
 block discarded – undo
115 123
 
116 124
 	}
117 125
 
118
-}
119
-elseif ($action == 'Yes') {
126
+} elseif ($action == 'Yes') {
120 127
 	$account_id = $var['account_id'];
121 128
 	$amount = $var['amount'];
122 129
 
@@ -128,33 +135,28 @@  discard block
 block discarded – undo
128 135
 	// add to him
129 136
 	$his_account->increaseSmrCredits($amount);
130 137
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have sent SMR credits.';
131
-}
132
-elseif ($action == 'Change Timezone') {
138
+} elseif ($action == 'Change Timezone') {
133 139
 	$timez = $_REQUEST['timez'];
134
-	if (!is_numeric($timez))
135
-		create_error('Numbers only please');
140
+	if (!is_numeric($timez)) {
141
+			create_error('Numbers only please');
142
+	}
136 143
 
137 144
 	$db->query('UPDATE account SET offset = ' . $db->escapeNumber($timez) . ' WHERE account_id = ' . $db->escapeNumber($account->getAccountID()));
138 145
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your time offset.';
139
-}
140
-elseif ($action == 'Change Date Formats') {
146
+} elseif ($action == 'Change Date Formats') {
141 147
 	$account->setShortDateFormat($_REQUEST['dateformat']);
142 148
 	$account->setShortTimeFormat($_REQUEST['timeformat']);
143 149
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your date formats.';
144
-}
145
-elseif ($action == 'Change Images') {
150
+} elseif ($action == 'Change Images') {
146 151
 	$account->setDisplayShipImages($_REQUEST['images']);
147 152
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your ship images preferences.';
148
-}
149
-elseif ($action == 'Change Centering') {
153
+} elseif ($action == 'Change Centering') {
150 154
 	$account->setCenterGalaxyMapOnPlayer($_REQUEST['centergalmap'] == 'Yes');
151 155
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your centering galaxy map preferences.';
152
-}
153
-else if ($action == 'Change Size' && is_numeric($_REQUEST['fontsize']) && $_REQUEST['fontsize'] >= 50) {
156
+} else if ($action == 'Change Size' && is_numeric($_REQUEST['fontsize']) && $_REQUEST['fontsize'] >= 50) {
154 157
 	$account->setFontSize($_REQUEST['fontsize']);
155 158
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your font size.';
156
-}
157
-else if ($action == 'Change CSS Options') {
159
+} else if ($action == 'Change CSS Options') {
158 160
 	$account->setCssLink($_REQUEST['csslink']);
159 161
 	if ($_REQUEST['template'] == 'None') {
160 162
 		$account->setDefaultCSSEnabled(false);
@@ -165,24 +167,20 @@  discard block
 block discarded – undo
165 167
 		$account->setColourScheme($cssColourScheme);
166 168
 	}
167 169
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your CSS options.';
168
-}
169
-else if ($action == 'Change Kamikaze Setting') {
170
+} else if ($action == 'Change Kamikaze Setting') {
170 171
 	$player->setCombatDronesKamikazeOnMines($_REQUEST['kamikaze'] == 'Yes');
171 172
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your combat drones options.';
172
-}
173
-else if ($action == 'Change Message Setting') {
173
+} else if ($action == 'Change Message Setting') {
174 174
 	$player->setForceDropMessages($_REQUEST['forceDropMessages'] == 'Yes');
175 175
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your message options.';
176
-}
177
-else if ($action == 'Save Hotkeys') {
176
+} else if ($action == 'Save Hotkeys') {
178 177
 	foreach (AbstractSmrAccount::getDefaultHotkeys() as $hotkey => $binding) {
179 178
 		if (isset($_REQUEST[$hotkey])) {
180 179
 			$account->setHotkey($hotkey, explode(' ', $_REQUEST[$hotkey]));
181 180
 		}
182 181
 	}
183 182
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have saved your hotkeys.';
184
-}
185
-else if (strpos(trim($action), 'Alter Player') === 0) {
183
+} else if (strpos(trim($action), 'Alter Player') === 0) {
186 184
 	// trim input now
187 185
 	$player_name = trim($_POST['PlayerName']);
188 186
 
@@ -193,8 +191,9 @@  discard block
 block discarded – undo
193 191
 	$limited_char = 0;
194 192
 	for ($i = 0; $i < strlen($player_name); $i++) {
195 193
 		// disallow certain ascii chars
196
-		if (ord($player_name[$i]) < 32 || ord($player_name[$i]) > 127)
197
-			create_error('The player name contains invalid characters!');
194
+		if (ord($player_name[$i]) < 32 || ord($player_name[$i]) > 127) {
195
+					create_error('The player name contains invalid characters!');
196
+		}
198 197
 
199 198
 		// numbers 48..57
200 199
 		// Letters 65..90
@@ -206,11 +205,13 @@  discard block
 block discarded – undo
206 205
 		}
207 206
 	}
208 207
 
209
-	if ($limited_char > 4)
210
-		create_error('You cannot use a name with more than 4 special characters.');
208
+	if ($limited_char > 4) {
209
+			create_error('You cannot use a name with more than 4 special characters.');
210
+	}
211 211
 
212
-	if (empty($player_name))
213
-		create_error('You must enter a player name!');
212
+	if (empty($player_name)) {
213
+			create_error('You must enter a player name!');
214
+	}
214 215
 
215 216
 	// Escape html elements so the name displays correctly
216 217
 	$player_name = htmlentities($player_name);
@@ -237,8 +238,7 @@  discard block
 block discarded – undo
237 238
 	$news = 'Please be advised that ' . $old_name . ' has changed their name to ' . $player->getBBLink();
238 239
 	$db->query('INSERT INTO news (time, news_message, game_id, type) VALUES (' . $db->escapeNumber(TIME) . ',' . $db->escapeString($news) . ',' . $db->escapeNumber($player->getGameID()) . ', \'admin\')');
239 240
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your player name.';
240
-}
241
-else if ($action == 'Update Colours') {
241
+} else if ($action == 'Update Colours') {
242 242
 	$friendlyColour = $_REQUEST['friendly_color'];
243 243
 	$neutralColour = $_REQUEST['neutral_color'];
244 244
 	$enemyColour = $_REQUEST['enemy_color'];
Please login to merge, or discard this patch.
htdocs/manual.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,8 +5,9 @@  discard block
 block discarded – undo
5 5
 	require_once(ENGINE . 'Default/help.inc');
6 6
 
7 7
 	$topic_id = $_SERVER['QUERY_STRING'];
8
-	if (empty($topic_id) || !is_numeric($topic_id))
9
-		$topic_id = 1;
8
+	if (empty($topic_id) || !is_numeric($topic_id)) {
9
+			$topic_id = 1;
10
+	}
10 11
 	?>
11 12
 <!DOCTYPE html>
12 13
 
@@ -48,8 +49,7 @@  discard block
 block discarded – undo
48 49
 
49 50
 	</body>
50 51
 	</html><?php
51
-}
52
-catch (Throwable $e) {
52
+} catch (Throwable $e) {
53 53
 	handleException($e);
54 54
 }
55 55
 ?>
Please login to merge, or discard this patch.
htdocs/loader.php 1 patch
Braces   +16 added lines, -13 removed lines patch added patch discarded remove patch
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
 		if (!USING_AJAX) {
69 69
 			require_once(get_file_loc('smr.inc'));
70 70
 			create_error('Your browser lost the SN. Try to reload the page!');
71
+		} else {
72
+					exit;
71 73
 		}
72
-		else
73
-			exit;
74 74
 	}
75 75
 	
76 76
 	// do we have such a container object in the db?
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 		if (!USING_AJAX) {
79 79
 			require_once(get_file_loc('smr.inc'));
80 80
 			create_error('Please avoid using the back button!');
81
+		} else {
82
+					exit;
81 83
 		}
82
-		else
83
-			exit;
84 84
 	}
85 85
 	
86 86
 	// Determine where to load game scripts from (in case we need a special
@@ -88,9 +88,15 @@  discard block
 block discarded – undo
88 88
 	// Must not call `get_file_loc` until after we have set $overrideGameID
89 89
 	// (unless we're exiting immediately with an error, as above).
90 90
 	$overrideGameID = 0;
91
-	if (isset($var['game_id']) && is_numeric($var['game_id'])) $overrideGameID = $var['game_id'];
92
-	if ($overrideGameID == 0 && isset($var['GameID']) && is_numeric($var['GameID'])) $overrideGameID = $var['GameID'];
93
-	if ($overrideGameID == 0) $overrideGameID = SmrSession::getGameID();
91
+	if (isset($var['game_id']) && is_numeric($var['game_id'])) {
92
+		$overrideGameID = $var['game_id'];
93
+	}
94
+	if ($overrideGameID == 0 && isset($var['GameID']) && is_numeric($var['GameID'])) {
95
+		$overrideGameID = $var['GameID'];
96
+	}
97
+	if ($overrideGameID == 0) {
98
+		$overrideGameID = SmrSession::getGameID();
99
+	}
94 100
 
95 101
 	require_once(get_file_loc('smr.inc'));
96 102
 
@@ -106,22 +112,19 @@  discard block
 block discarded – undo
106 112
 			} else {
107 113
 				forward(create_container('skeleton.php', 'invalid_email.php'));
108 114
 			}
109
-		}
110
-		else if ($disabled['Reason'] == CLOSE_ACCOUNT_BY_REQUEST_REASON) {
115
+		} else if ($disabled['Reason'] == CLOSE_ACCOUNT_BY_REQUEST_REASON) {
111 116
 			if (isset($var['do_reopen_account'])) {
112 117
 				// The user has requested to reopen their account
113 118
 				$account->unbanAccount($account);
114 119
 			} else {
115 120
 				forward(create_container('skeleton.php', 'reopen_account.php'));
116 121
 			}
117
-		}
118
-		else {
122
+		} else {
119 123
 			forward(create_container('disabled.php'));
120 124
 		}
121 125
 	}
122 126
 	
123 127
 	do_voodoo();
124
-}
125
-catch (Throwable $e) {
128
+} catch (Throwable $e) {
126 129
 	handleException($e);
127 130
 }
Please login to merge, or discard this patch.