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 ( 1f1eac...f120a4 )
by Dan
04:33
created
engine/Default/message_delete_processing.php 1 patch
Braces   +9 added lines, -12 removed lines patch added patch discarded remove patch
@@ -19,29 +19,26 @@
 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
 	}
27
-	if ($var['folder_id'] == MSG_SENT)
28
-		$db->query('UPDATE message SET sender_delete = ' . $db->escapeBoolean(true) . ' WHERE message_id IN (' . $db->escapeArray($message_id_list) . ')');
29
-	else
30
-		$db->query('UPDATE message SET receiver_delete = ' . $db->escapeBoolean(true) . ' WHERE message_id IN (' . $db->escapeArray($message_id_list) . ')');
31
-}
32
-else {
26
+	if ($var['folder_id'] == MSG_SENT) {
27
+			$db->query('UPDATE message SET sender_delete = ' . $db->escapeBoolean(true) . ' WHERE message_id IN (' . $db->escapeArray($message_id_list) . ')');
28
+	} else {
29
+			$db->query('UPDATE message SET receiver_delete = ' . $db->escapeBoolean(true) . ' WHERE message_id IN (' . $db->escapeArray($message_id_list) . ')');
30
+	}
31
+	} else {
33 32
 	if ($var['folder_id'] == MSG_SCOUT) {
34 33
 		$db->query('UPDATE message SET receiver_delete = ' . $db->escapeBoolean(true) . '
35 34
 					WHERE account_id = ' . $db->escapeNumber($player->getAccountID()) . '
36 35
 						AND message_type_id = '.$db->escapeNumber($var['folder_id']) . '
37 36
 						AND game_id = ' . $db->escapeNumber($player->getGameID()));
38
-	}
39
-	else if ($var['folder_id'] == MSG_SENT) {
37
+	} else if ($var['folder_id'] == MSG_SENT) {
40 38
 		$db->query('UPDATE message SET sender_delete = ' . $db->escapeBoolean(true) . '
41 39
 					WHERE sender_id = ' . $db->escapeNumber($player->getAccountID()) . '
42 40
 						AND game_id = ' . $db->escapeNumber($player->getGameID()));
43
-	}
44
-	else {
41
+	} else {
45 42
 		$db->query('UPDATE message SET receiver_delete = ' . $db->escapeBoolean(true) . '
46 43
 					WHERE account_id = ' . $db->escapeNumber($player->getAccountID()) . '
47 44
 						AND game_id = ' . $db->escapeNumber($player->getGameID()) . '
Please login to merge, or discard this patch.
engine/Default/forces_attack_processing.php 1 patch
Braces   +27 added lines, -17 removed lines patch added patch discarded remove patch
@@ -3,16 +3,21 @@  discard block
 block discarded – undo
3 3
 $forces = SmrForce::getForce($player->getGameID(), $player->getSectorID(), $var['owner_id']);
4 4
 $forceOwner = $forces->getOwner();
5 5
 
6
-if ($player->hasNewbieTurns())
6
+if ($player->hasNewbieTurns()) {
7 7
 	create_error('You are under newbie protection!');
8
-if ($player->hasFederalProtection())
8
+}
9
+if ($player->hasFederalProtection()) {
9 10
 	create_error('You are under federal protection.');
10
-if ($player->isLandedOnPlanet())
11
+}
12
+if ($player->isLandedOnPlanet()) {
11 13
 	create_error('You cannot attack forces whilst on a planet!');
12
-if (!$player->canFight())
14
+}
15
+if (!$player->canFight()) {
13 16
 	create_error('You are not allowed to fight!');
14
-if ($player->forceNAPAlliance($forceOwner))
17
+}
18
+if ($player->forceNAPAlliance($forceOwner)) {
15 19
 	create_error('You cannot attack allied forces!');
20
+}
16 21
 
17 22
 // The attack is processed slightly differently if the attacker bumped into mines
18 23
 // when moving into sector
@@ -25,16 +30,20 @@  discard block
 block discarded – undo
25 30
 }
26 31
 
27 32
 if ($bump) {
28
-	if (!$forces->hasMines())
29
-		create_error('No mines in sector!');
30
-} else {
31
-	if (!$forces->exists())
32
-		create_error('These forces no longer exist.');
33
-	if ($player->getTurns() < $forces->getAttackTurnCost($ship))
34
-		create_error('You do not have enough turns to attack these forces!');
35
-	if (!$ship->hasWeapons() && !$ship->hasCDs())
36
-		create_error('You cannot attack without weapons!');
37
-}
33
+	if (!$forces->hasMines()) {
34
+			create_error('No mines in sector!');
35
+	}
36
+	} else {
37
+	if (!$forces->exists()) {
38
+			create_error('These forces no longer exist.');
39
+	}
40
+	if ($player->getTurns() < $forces->getAttackTurnCost($ship)) {
41
+			create_error('You do not have enough turns to attack these forces!');
42
+	}
43
+	if (!$ship->hasWeapons() && !$ship->hasCDs()) {
44
+			create_error('You cannot attack without weapons!');
45
+	}
46
+	}
38 47
 
39 48
 // take the turns
40 49
 if ($bump) {
@@ -103,10 +112,11 @@  discard block
 block discarded – undo
103 112
 $container = create_container('skeleton.php', 'forces_attack.php');
104 113
 
105 114
 // If their target is dead there is no continue attack button
106
-if ($forces->exists())
115
+if ($forces->exists()) {
107 116
 	$container['owner_id'] = $forces->getOwnerID();
108
-else
117
+} else {
109 118
 	$container['owner_id'] = 0;
119
+}
110 120
 
111 121
 // If they died on the shot they get to see the results
112 122
 if ($player->isDead()) {
Please login to merge, or discard this patch.
tools/discord/commands/seedlist.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -4,7 +4,9 @@  discard block
 block discarded – undo
4 4
 
5 5
 $fn_seedlist = 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
 	// print the entire seedlist
10 12
 	$results = shared_channel_msg_seedlist($link->player);
@@ -13,7 +15,9 @@  discard block
 block discarded – undo
13 15
 
14 16
 $fn_seedlist_add = function($message, $sectors) {
15 17
 	$link = new GameLink($message->channel, $message->author);
16
-	if (!$link->valid) return;
18
+	if (!$link->valid) {
19
+		return;
20
+	}
17 21
 
18 22
 	// add sectors to the seedlist
19 23
 	$results = shared_channel_msg_seedlist_add($link->player, $sectors);
@@ -22,7 +26,9 @@  discard block
 block discarded – undo
22 26
 
23 27
 $fn_seedlist_del = function($message, $sectors) {
24 28
 	$link = new GameLink($message->channel, $message->author);
25
-	if (!$link->valid) return;
29
+	if (!$link->valid) {
30
+		return;
31
+	}
26 32
 
27 33
 	// delete sectors from the seedlist
28 34
 	$results = shared_channel_msg_seedlist_del($link->player, $sectors);
Please login to merge, or discard this patch.
tools/irc/irc.php 1 patch
Braces   +91 added lines, -63 removed lines patch added patch discarded remove patch
@@ -6,12 +6,13 @@  discard block
 block discarded – undo
6 6
 function echo_r($message)
7 7
 {
8 8
 	if (is_array($message)) {
9
-		foreach ($message as $msg)
10
-			echo_r($msg);
9
+		foreach ($message as $msg) {
10
+					echo_r($msg);
11
+		}
12
+	} else {
13
+			echo date("d.m.Y H:i:s => ") . $message . EOL;
14
+	}
11 15
 	}
12
-	else
13
-		echo date("d.m.Y H:i:s => ") . $message . EOL;
14
-}
15 16
 
16 17
 // not keeping the filehandle might not be the wisest idea.
17 18
 function write_log_message($msg)
@@ -144,8 +145,7 @@  discard block
 block discarded – undo
144 145
 			sleep(60);
145 146
 
146 147
 		}
147
-	}
148
-	catch (TimeoutException $e) {
148
+	} catch (TimeoutException $e) {
149 149
 		// Ignore the timeout exception, we'll loop round and reconnect.
150 150
 	}
151 151
 } // end of while running
@@ -164,12 +164,14 @@  discard block
 block discarded – undo
164 164
 	$rdata = preg_replace('/\s+/', ' ', $rdata);
165 165
 
166 166
 	// log for reports (if enabled via command line (-log)
167
-	if (IRC_LOGGING && strlen($rdata) > 0)
168
-		write_log_message($rdata);
167
+	if (IRC_LOGGING && strlen($rdata) > 0) {
168
+			write_log_message($rdata);
169
+	}
169 170
 
170 171
 	// remember the last time we got something from the server
171
-	if (strlen($rdata) > 0)
172
-		$last_ping = time();
172
+	if (strlen($rdata) > 0) {
173
+			$last_ping = time();
174
+	}
173 175
 
174 176
 	// timeout detection!
175 177
 	if ($last_ping < time() - 300) {
@@ -186,76 +188,102 @@  discard block
 block discarded – undo
186 188
 	}
187 189
 
188 190
 	// required!!! otherwise timeout!
189
-	if (server_ping($fp, $rdata))
190
-		return;
191
+	if (server_ping($fp, $rdata)) {
192
+			return;
193
+	}
191 194
 
192 195
 	// server msg
193
-	if (server_msg_307($fp, $rdata))
194
-		return;
195
-	if (server_msg_318($fp, $rdata))
196
-		return;
197
-	if (server_msg_352($fp, $rdata))
198
-		return;
199
-	if (server_msg_401($fp, $rdata))
200
-		return;
196
+	if (server_msg_307($fp, $rdata)) {
197
+			return;
198
+	}
199
+	if (server_msg_318($fp, $rdata)) {
200
+			return;
201
+	}
202
+	if (server_msg_352($fp, $rdata)) {
203
+			return;
204
+	}
205
+	if (server_msg_401($fp, $rdata)) {
206
+			return;
207
+	}
201 208
 
202 209
 	//Are they using a linked nick instead
203
-	if (notice_nickserv_registered_user($fp, $rdata))
204
-		return;
205
-	if (notice_nickserv_unknown_user($fp, $rdata))
206
-		return;
210
+	if (notice_nickserv_registered_user($fp, $rdata)) {
211
+			return;
212
+	}
213
+	if (notice_nickserv_unknown_user($fp, $rdata)) {
214
+			return;
215
+	}
207 216
 
208 217
 	// some nice things
209
-	if (ctcp_version($fp, $rdata))
210
-		return;
211
-	if (ctcp_finger($fp, $rdata))
212
-		return;
213
-	if (ctcp_time($fp, $rdata))
214
-		return;
215
-	if (ctcp_ping($fp, $rdata))
216
-		return;
218
+	if (ctcp_version($fp, $rdata)) {
219
+			return;
220
+	}
221
+	if (ctcp_finger($fp, $rdata)) {
222
+			return;
223
+	}
224
+	if (ctcp_time($fp, $rdata)) {
225
+			return;
226
+	}
227
+	if (ctcp_ping($fp, $rdata)) {
228
+			return;
229
+	}
217 230
 
218
-	if (invite($fp, $rdata))
219
-		return;
231
+	if (invite($fp, $rdata)) {
232
+			return;
233
+	}
220 234
 
221 235
 	// join and part
222
-	if (channel_join($fp, $rdata))
223
-		return;
224
-	if (channel_part($fp, $rdata))
225
-		return;
236
+	if (channel_join($fp, $rdata)) {
237
+			return;
238
+	}
239
+	if (channel_part($fp, $rdata)) {
240
+			return;
241
+	}
226 242
 
227 243
 	// nick change and quit
228
-	if (user_nick($fp, $rdata))
229
-		return;
230
-	if (user_quit($fp, $rdata))
231
-		return;
244
+	if (user_nick($fp, $rdata)) {
245
+			return;
246
+	}
247
+	if (user_quit($fp, $rdata)) {
248
+			return;
249
+	}
232 250
 
233
-	if (channel_action_slap($fp, $rdata))
234
-		return;
251
+	if (channel_action_slap($fp, $rdata)) {
252
+			return;
253
+	}
235 254
 
236 255
 	// channel msg (!xyz) without registration
237
-	if (channel_msg_help($fp, $rdata))
238
-		return;
239
-	if (channel_msg_seedlist($fp, $rdata))
240
-		return;
241
-	if (channel_msg_op($fp, $rdata))
242
-		return;
243
-	if (channel_msg_timer($fp, $rdata))
244
-		return;
245
-	if (channel_msg_8ball($fp, $rdata))
246
-		return;
247
-	if (channel_msg_seen($fp, $rdata))
248
-		return;
249
-	if (channel_msg_sd($fp, $rdata))
250
-		return;
256
+	if (channel_msg_help($fp, $rdata)) {
257
+			return;
258
+	}
259
+	if (channel_msg_seedlist($fp, $rdata)) {
260
+			return;
261
+	}
262
+	if (channel_msg_op($fp, $rdata)) {
263
+			return;
264
+	}
265
+	if (channel_msg_timer($fp, $rdata)) {
266
+			return;
267
+	}
268
+	if (channel_msg_8ball($fp, $rdata)) {
269
+			return;
270
+	}
271
+	if (channel_msg_seen($fp, $rdata)) {
272
+			return;
273
+	}
274
+	if (channel_msg_sd($fp, $rdata)) {
275
+			return;
276
+	}
251 277
 
252 278
 	// channel msg (!xyz) with registration
253
-	if (channel_msg_with_registration($fp, $rdata))
254
-		return;
279
+	if (channel_msg_with_registration($fp, $rdata)) {
280
+			return;
281
+	}
255 282
 
256 283
 	// MrSpock can use this to send commands as caretaker
257
-	if (query_command($fp, $rdata))
258
-		return;
284
+	if (query_command($fp, $rdata)) {
285
+			return;
286
+	}
259 287
 
260 288
 
261 289
 	// debug
Please login to merge, or discard this patch.
tools/irc/channel_msg_sd.php 1 patch
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -45,8 +45,9 @@  discard block
 block discarded – undo
45 45
 		// delete any old entries in the list
46 46
 		foreach ($sds as $key => $value) {
47 47
 
48
-			if ($value[3] != $channel)
49
-				continue;
48
+			if ($value[3] != $channel) {
49
+							continue;
50
+			}
50 51
 
51 52
 			if ($value[0] == $sector) {
52 53
 				unset($sds[$key]);
@@ -82,8 +83,9 @@  discard block
 block discarded – undo
82 83
 
83 84
 		foreach ($sds as $key => $sd) {
84 85
 
85
-			if ($sd[3] != $channel)
86
-				continue;
86
+			if ($sd[3] != $channel) {
87
+							continue;
88
+			}
87 89
 
88 90
 			if ($sd[0] == $sector) {
89 91
 				fputs($fp, 'PRIVMSG ' . $channel . ' :The supply/demand for sector ' . $sector . ' has been deleted.' . EOL);
@@ -121,7 +123,9 @@  discard block
 block discarded – undo
121 123
 			if ($sd[3] == $channel) {
122 124
 
123 125
 				$seconds_since_refresh = time() - $sd[2];
124
-				if ($seconds_since_refresh < 0) $seconds_since_refresh = 0;
126
+				if ($seconds_since_refresh < 0) {
127
+					$seconds_since_refresh = 0;
128
+				}
125 129
 				$amt_to_add = floor($seconds_since_refresh * $refresh_per_sec);
126 130
 
127 131
 				if ($sd[1] + $amt_to_add > 4000) {
Please login to merge, or discard this patch.
admin/Default/notify_reply_processing.php 1 patch
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,12 +7,14 @@  discard block
 block discarded – undo
7 7
 	transfer('offended');
8 8
 	transfer('game_id');
9 9
 	transfer('sender_id');
10
-	if (!empty($offenderReply))
11
-		$container['PreviewOffender'] = $offenderReply;
10
+	if (!empty($offenderReply)) {
11
+			$container['PreviewOffender'] = $offenderReply;
12
+	}
12 13
 	$container['OffenderBanPoints'] = $_REQUEST['offenderBanPoints'];
13 14
 
14
-	if (!empty($offendedReply))
15
-		$container['PreviewOffended'] = $offendedReply;
15
+	if (!empty($offendedReply)) {
16
+			$container['PreviewOffended'] = $offendedReply;
17
+	}
16 18
 	$container['OffendedBanPoints'] = $_REQUEST['offendedBanPoints'];
17 19
 	forward($container);
18 20
 }
@@ -28,7 +30,9 @@  discard block
 block discarded – undo
28 30
 		$offenderAccount->addPoints($_REQUEST['offenderBanPoints'], $account, 7, $suspicion);
29 31
 	}
30 32
 }
31
-if (isset($_REQUEST['offendedReply'])) $offendedReply = $_REQUEST['offendedReply'];
33
+if (isset($_REQUEST['offendedReply'])) {
34
+	$offendedReply = $_REQUEST['offendedReply'];
35
+}
32 36
 
33 37
 if (isset($offendedReply) && $offendedReply != '') {
34 38
 	//next message
Please login to merge, or discard this patch.
admin/Default/vote_create_processing.php 1 patch
Braces   +19 added lines, -14 removed lines patch added patch discarded remove patch
@@ -15,24 +15,29 @@
 block discarded – undo
15 15
 }
16 16
 
17 17
 if ($_REQUEST['action'] == 'Create Vote') {
18
-	if (empty($question))
19
-		create_error('You have to specify a vote message.');
20
-	if (empty($_REQUEST['days']))
21
-		create_error('You have to specify the amount of time to run the vote for.');
22
-	if (!is_numeric($_REQUEST['days']))
23
-		create_error('The vote runtime must be a number.');
18
+	if (empty($question)) {
19
+			create_error('You have to specify a vote message.');
20
+	}
21
+	if (empty($_REQUEST['days'])) {
22
+			create_error('You have to specify the amount of time to run the vote for.');
23
+	}
24
+	if (!is_numeric($_REQUEST['days'])) {
25
+			create_error('The vote runtime must be a number.');
26
+	}
24 27
 	$end = TIME + 86400 * $_REQUEST['days'];
25 28
 	
26 29
 	// put the msg into the database
27 30
 	$db->query('INSERT INTO voting (question, end) VALUES(' . $db->escapeString($question) . ',' . $db->escapeNumber($end) . ')');
28
-}
29
-else if ($_REQUEST['action'] == 'Add Option') {
30
-	if (empty($option))
31
-		create_error('You have to specify an option message.');
32
-	if (empty($_REQUEST['vote']))
33
-		create_error('You have to select a vote to add the option to.');
34
-	if (!is_numeric($_REQUEST['vote']))
35
-		create_error('Vote ID must be a number.');
31
+} else if ($_REQUEST['action'] == 'Add Option') {
32
+	if (empty($option)) {
33
+			create_error('You have to specify an option message.');
34
+	}
35
+	if (empty($_REQUEST['vote'])) {
36
+			create_error('You have to select a vote to add the option to.');
37
+	}
38
+	if (!is_numeric($_REQUEST['vote'])) {
39
+			create_error('Vote ID must be a number.');
40
+	}
36 41
 	
37 42
 	// put the msg into the database
38 43
 	$db->query('INSERT INTO voting_options (vote_id, text) VALUES(' . $db->escapeNumber($_REQUEST['vote']) . ',' . $db->escapeString($option) . ')');
Please login to merge, or discard this patch.
admin/Default/log_console.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,15 +19,17 @@
 block discarded – undo
19 19
 								'Notes' => '');
20 20
 
21 21
 		$db2->query('SELECT notes FROM log_has_notes WHERE account_id = ' . $db2->escapeNumber($accountID));
22
-		if ($db2->nextRecord())
23
-			$loggedAccounts[$accountID]['Notes'] = nl2br($db2->getField('notes'));
22
+		if ($db2->nextRecord()) {
23
+					$loggedAccounts[$accountID]['Notes'] = nl2br($db2->getField('notes'));
24
+		}
24 25
 	}
25 26
 
26 27
 	// put hidden fields in for log type to have all fields selected on next page.
27 28
 	$logTypes = array();
28 29
 	$db->query('SELECT log_type_id FROM log_type');
29
-	while ($db->nextRecord())
30
-		$logTypes[] = $db->getInt('log_type_id');
30
+	while ($db->nextRecord()) {
31
+			$logTypes[] = $db->getInt('log_type_id');
32
+	}
31 33
 	$template->assign('LogTypes', $logTypes);
32 34
 
33 35
 	$template->assign('LogConsoleFormHREF', SmrSession::getNewHREF(create_container('skeleton.php', 'log_console_detail.php')));
Please login to merge, or discard this patch.
admin/Default/album_moderate.php 1 patch
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,8 +19,7 @@  discard block
 block discarded – undo
19 19
 		$approved[$accountId] = get_album_nick($accountId);
20 20
 	}
21 21
 	$template->assign('Approved', $approved);
22
-}
23
-else {
22
+} else {
24 23
 	// check if the given account really has an entry
25 24
 	$db->query('SELECT * FROM album WHERE account_id = ' . $db->escapeNumber($account_id) . ' AND Approved = \'YES\'');
26 25
 	if ($db->nextRecord()) {
@@ -36,12 +35,15 @@  discard block
 block discarded – undo
36 35
 		create_error('This User doesn\'t have an album entry or it needs to be approved first!');
37 36
 	}
38 37
 
39
-	if (!empty($day) && !empty($month) && !empty($year))
40
-		$birthdate = $month . ' / ' . $day . ' / ' . $year;
41
-	if (empty($birthdate) && !empty($year))
42
-		$birthdate = 'Year ' . $year;
43
-	if (empty($birthdate))
44
-		$birthdate = 'N/A';
38
+	if (!empty($day) && !empty($month) && !empty($year)) {
39
+			$birthdate = $month . ' / ' . $day . ' / ' . $year;
40
+	}
41
+	if (empty($birthdate) && !empty($year)) {
42
+			$birthdate = 'Year ' . $year;
43
+	}
44
+	if (empty($birthdate)) {
45
+			$birthdate = 'N/A';
46
+	}
45 47
 
46 48
 	$entry = [
47 49
 		'disabled' => $disabled,
Please login to merge, or discard this patch.