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
htdocs/login_processing.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 			exit;
89 89
 		}
90 90
 		$account->addAuthMethod($_SESSION['socialLogin']->getLoginType(),
91
-		                        $_SESSION['socialLogin']->getUserID());
91
+								$_SESSION['socialLogin']->getUserID());
92 92
 		session_destroy();
93 93
 	}
94 94
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 		// save session (incase we forward)
114 114
 		SmrSession::update();
115 115
 		if (($disabled['Reason'] != CLOSE_ACCOUNT_INVALID_EMAIL_REASON) &&
116
-		    ($disabled['Reason'] != CLOSE_ACCOUNT_BY_REQUEST_REASON)) {
116
+			($disabled['Reason'] != CLOSE_ACCOUNT_BY_REQUEST_REASON)) {
117 117
 			forward(create_container('disabled.php'));
118 118
 		}
119 119
 	}
Please login to merge, or discard this patch.
Braces   +31 added lines, -18 removed lines patch added patch discarded remove patch
@@ -31,8 +31,7 @@  discard block
 block discarded – undo
31 31
 				header('Location: /login_social_create.php');
32 32
 				exit;
33 33
 			}
34
-		}
35
-		else {
34
+		} else {
36 35
 			$login = (isset($_REQUEST['login']) ? $_REQUEST['login'] : (isset($var['login']) ? $var['login'] : ''));
37 36
 			$password = (isset($_REQUEST['password']) ? $_REQUEST['password'] : (isset($var['password']) ? $var['password'] : ''));
38 37
 
@@ -46,8 +45,7 @@  discard block
 block discarded – undo
46 45
 			$account = SmrAccount::getAccountByName($login);
47 46
 			if (is_object($account) && $account->checkPassword($password)) {
48 47
 				SmrSession::setAccount($account);
49
-			}
50
-			else {
48
+			} else {
51 49
 				$msg = 'Password is incorrect!';
52 50
 				header('Location: /login.php?msg=' . rawurlencode(htmlspecialchars($msg, ENT_QUOTES)));
53 51
 				exit;
@@ -142,38 +140,54 @@  discard block
 block discarded – undo
142 140
 			//convert to array
143 141
 			$old = explode('-', $db->getField('array'));
144 142
 			//get rid of old version cookie since it isn't optimal.
145
-			if ($old[0] != MULTI_CHECKING_COOKIE_VERSION) $old = array();
146
-		} else $old = array();
143
+			if ($old[0] != MULTI_CHECKING_COOKIE_VERSION) {
144
+				$old = array();
145
+			}
146
+		} else {
147
+			$old = array();
148
+		}
147 149
 		$old[0] = MULTI_CHECKING_COOKIE_VERSION;
148
-		if (!in_array($account->getAccountID(), $old)) $old[] = $account->getAccountID();
149
-	}
150
-	else {
150
+		if (!in_array($account->getAccountID(), $old)) {
151
+			$old[] = $account->getAccountID();
152
+		}
153
+	} else {
151 154
 
152 155
 		//we have a cookie so we see if we add to it etc
153 156
 		//break cookie into array
154 157
 		$cookie = explode('-', $_COOKIE['Session_Info']);
155 158
 		//check for current version
156
-		if ($cookie[0] != MULTI_CHECKING_COOKIE_VERSION) $cookie = array();
159
+		if ($cookie[0] != MULTI_CHECKING_COOKIE_VERSION) {
160
+			$cookie = array();
161
+		}
157 162
 		$cookie[0] = MULTI_CHECKING_COOKIE_VERSION;
158 163
 		//add this acc to the cookie if it isn't there
159
-		if (!in_array($account->getAccountID(), $cookie)) $cookie[] = $account->getAccountID();
164
+		if (!in_array($account->getAccountID(), $cookie)) {
165
+			$cookie[] = $account->getAccountID();
166
+		}
160 167
 
161 168
 		$db->query('SELECT * FROM multi_checking_cookie WHERE account_id = ' . $account->getAccountID());
162 169
 		if ($db->nextRecord()) {
163 170
 			//convert to array
164 171
 			$old = explode('-', $db->getField('array'));
165
-			if ($old[0] != MULTI_CHECKING_COOKIE_VERSION) $old = array();
166
-		} else $old = array();
172
+			if ($old[0] != MULTI_CHECKING_COOKIE_VERSION) {
173
+				$old = array();
174
+			}
175
+		} else {
176
+			$old = array();
177
+		}
167 178
 		$old[0] = MULTI_CHECKING_COOKIE_VERSION;
168 179
 		//merge arrays...but keys are all different so we go through each value
169
-		foreach ($cookie as $value)
170
-			if (!in_array($value, $old)) $old[] = $value;
180
+		foreach ($cookie as $value) {
181
+					if (!in_array($value, $old)) $old[] = $value;
182
+		}
171 183
 	}
172 184
 	$use = (count($old) <= 2) ? 'FALSE' : 'TRUE';
173 185
 	//check that each value is legit and add it to db string
174 186
 	$new = MULTI_CHECKING_COOKIE_VERSION;
175 187
 	foreach ($old as $accID) {
176
-		if (is_numeric($accID)) $new .= '-' . $accID;
188
+		if (is_numeric($accID)) {
189
+			$new .= '-' . $accID;
190
+		}
177 191
 	}
178 192
 	$db->query('REPLACE INTO multi_checking_cookie (account_id, array, `use`) VALUES (' . $db->escapeNumber($account->getAccountID()) . ', ' . $db->escapeString($new) . ', ' . $db->escapeString($use) . ')');
179 193
 	//now we update their cookie with the newest info
@@ -193,7 +207,6 @@  discard block
 block discarded – undo
193 207
 
194 208
 	header('Location: ' . $href);
195 209
 	exit;
196
-}
197
-catch (Throwable $e) {
210
+} catch (Throwable $e) {
198 211
 	handleException($e);
199 212
 }
Please login to merge, or discard this patch.
tools/discord/commands/turns.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 function get_turns_message($player) {
4 4
 	// turns only update when the player is active, so calculate current turns
5 5
 	$turns = min($player->getTurns() + $player->getTurnsGained(time(), true),
6
-	             $player->getMaxTurns());
6
+				 $player->getMaxTurns());
7 7
 	$msg = $player->getPlayerName() . " has $turns/" . $player->getMaxTurns() . " turns.";
8 8
 
9 9
 	// Calculate time to max turns if under the max
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@  discard block
 block discarded – undo
17 17
 
18 18
 $fn_turns = function($message) {
19 19
 	$link = new GameLink($message->channel, $message->author);
20
-	if (!$link->valid) return;
20
+	if (!$link->valid) {
21
+		return;
22
+	}
21 23
 
22 24
 	$msg = get_turns_message($link->player);
23 25
 	$message->channel->sendMessage($msg);
@@ -25,7 +27,9 @@  discard block
 block discarded – undo
25 27
 
26 28
 $fn_turns_all = function($message) {
27 29
 	$link = new GameLink($message->channel, $message->author);
28
-	if (!$link->valid) return;
30
+	if (!$link->valid) {
31
+		return;
32
+	}
29 33
 	$player = $link->player;
30 34
 
31 35
 	$results = array_map('get_turns_message', $player->getSharingPlayers(true));
Please login to merge, or discard this patch.
tools/discord/GameLink.inc 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3,11 +3,11 @@  discard block
 block discarded – undo
3 3
 // Holds information linking the received message and the game data
4 4
 class GameLink
5 5
 {
6
-	public $valid = false;  // identifies if the message is linked to game data
7
-	public $user;           // Discord user associated with the message
8
-	public $account;        // SmrAccount instance
9
-	public $alliance;       // SmrAlliance instance
10
-	public $player;         // SmrPlayer instance
6
+	public $valid = false; // identifies if the message is linked to game data
7
+	public $user; // Discord user associated with the message
8
+	public $account; // SmrAccount instance
9
+	public $alliance; // SmrAlliance instance
10
+	public $player; // SmrPlayer instance
11 11
 
12 12
 	// Takes the following arguments:
13 13
 	//	channel = Discord\Parts\Channel\Channel instance
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
 			$this->player = SmrPlayer::getPlayer($this->account->getAccountID(), $this->alliance->getGameID(), true);
62 62
 			if ($this->player->getAllianceID() != $this->alliance->getAllianceID()) {
63
-				$channel->sendMessage("Player `".$this->player->getPlayerName()."` is not a member of alliance `".$this->alliance->getAllianceName()."`");
63
+				$channel->sendMessage("Player `" . $this->player->getPlayerName() . "` is not a member of alliance `" . $this->alliance->getAllianceName() . "`");
64 64
 				return;
65 65
 			}
66 66
 		}
Please login to merge, or discard this patch.
tools/chat_helpers/channel_msg_op_turns.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 			continue;
25 25
 		}
26 26
 		$turns = min($attendeePlayer->getTurns() + $attendeePlayer->getTurnsGained(time(), true),
27
-		             $attendeePlayer->getMaxTurns());
27
+					 $attendeePlayer->getMaxTurns());
28 28
 		$oppers[$attendeePlayer->getPlayerName()] = $turns;
29 29
 	}
30 30
 
Please login to merge, or discard this patch.
tools/npc/chess.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,8 +79,7 @@
 block discarded – undo
79 79
 	fclose($toEngine);
80 80
 	fclose($fromEngine);
81 81
 	proc_close($engine);
82
-}
83
-catch(Throwable $e) {
82
+} catch(Throwable $e) {
84 83
 	logException($e);
85 84
 	exit;
86 85
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -10,22 +10,22 @@  discard block
 block discarded – undo
10 10
 
11 11
 	debug('Script started');
12 12
 	define('SCRIPT_ID', $db->getInsertID());
13
-	$db->query('UPDATE npc_logs SET script_id='.SCRIPT_ID.' WHERE log_id='.SCRIPT_ID);
13
+	$db->query('UPDATE npc_logs SET script_id=' . SCRIPT_ID . ' WHERE log_id=' . SCRIPT_ID);
14 14
 
15 15
 	define('NPC_SCRIPT', true);
16 16
 
17 17
 	$descriptorSpec = array(
18
-		0 => array("pipe", "r"),  // stdin is a pipe that the child will read from
18
+		0 => array("pipe", "r"), // stdin is a pipe that the child will read from
19 19
 		1 => array("pipe", "w")  // stdout is a pipe that the child will write to
20 20
 	);
21 21
 	$engine = proc_open(UCI_CHESS_ENGINE, $descriptorSpec, $pipes);
22
-	$toEngine =& $pipes[0];
23
-	$fromEngine =& $pipes[1];
22
+	$toEngine = & $pipes[0];
23
+	$fromEngine = & $pipes[1];
24 24
 
25 25
 	function readFromEngine($block = true) {
26 26
 		global $fromEngine;
27 27
 		stream_set_blocking($fromEngine, $block == true ? 1 : 0);
28
-		while(($s = fgets($fromEngine)) !== false) {
28
+		while (($s = fgets($fromEngine)) !== false) {
29 29
 			debug('<-- ' . trim($s));
30 30
 			stream_set_blocking($fromEngine, 0);
31 31
 		}
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		global $toEngine;
35 35
 		debug('--> ' . $s);
36 36
 		fputs($toEngine, $s . EOL);
37
-		if($read === true) {
37
+		if ($read === true) {
38 38
 			readFromEngine($block);
39 39
 		}
40 40
 	}
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	writeToEngine('isready');
46 46
 	writeToEngine('ucinewgame', false);
47 47
 
48
-	while(true) {
48
+	while (true) {
49 49
 		//Redefine MICRO_TIME and TIME, the rest of the game expects them to be the single point in time that the script is executing, with it being redefined for each page load - unfortunately NPCs are one consistent script so we have to do a hack and redefine it (or change every instance of the TIME constant).
50 50
 		runkit_constant_redefine('MICRO_TIME', microtime(true));
51 51
 		runkit_constant_redefine('TIME', IFloor(MICRO_TIME));
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 			writeToEngine('position fen ' . $chessGame->getFENString(), false);
56 56
 			writeToEngine('go ' . ($chessGame->getCurrentTurnColour() == ChessGame::PLAYER_WHITE ? 'w' : 'b') . 'time ' . UCI_TIME_PER_MOVE_MS, true, false);
57 57
 			stream_set_blocking($fromEngine, 1);
58
-			while(stripos($move = trim(fgets($fromEngine)), 'bestmove') !== 0) {
58
+			while (stripos($move = trim(fgets($fromEngine)), 'bestmove') !== 0) {
59 59
 				debug('<-- ' . $move);
60
-				if(stripos($move, 'Seg') === 0) {
60
+				if (stripos($move, 'Seg') === 0) {
61 61
 					// Segfault
62 62
 					debug('UCI engine segfaulted?');
63 63
 					exit;
@@ -78,12 +78,12 @@  discard block
 block discarded – undo
78 78
 	fclose($fromEngine);
79 79
 	proc_close($engine);
80 80
 }
81
-catch(Throwable $e) {
81
+catch (Throwable $e) {
82 82
 	logException($e);
83 83
 	exit;
84 84
 }
85 85
 function debug($message, $debugObject = null) {
86
-	global $account,$var,$db;
87
-	echo date('Y-m-d H:i:s - ').$message.($debugObject!==null?EOL.var_export($debugObject,true):'').EOL;
88
-	$db->query('INSERT INTO npc_logs (script_id, npc_id, time, message, debug_info, var) VALUES ('.(defined('SCRIPT_ID')?SCRIPT_ID:0).', '.(is_object($account)?$account->getAccountID():0).',NOW(),'.$db->escapeString($message).','.$db->escapeString(var_export($debugObject,true)).','.$db->escapeString(var_export($var,true)).')');
86
+	global $account, $var, $db;
87
+	echo date('Y-m-d H:i:s - ') . $message . ($debugObject !== null ?EOL.var_export($debugObject, true) : '') . EOL;
88
+	$db->query('INSERT INTO npc_logs (script_id, npc_id, time, message, debug_info, var) VALUES (' . (defined('SCRIPT_ID') ?SCRIPT_ID:0) . ', ' . (is_object($account) ? $account->getAccountID() : 0) . ',NOW(),' . $db->escapeString($message) . ',' . $db->escapeString(var_export($debugObject, true)) . ',' . $db->escapeString(var_export($var, true)) . ')');
89 89
 }
Please login to merge, or discard this patch.
tools/reserializeCombatLogs.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,6 +21,6 @@
 block discarded – undo
21 21
 //}
22 22
 
23 23
 $db->query('SELECT result,log_id FROM combat_logs');
24
-while($db->nextRecord()) {
25
-	$db2->query('UPDATE combat_logs SET result='.$db2->escapeBinary(gzcompress(serialize(unserialize(gzuncompress($db->getField('result')))))).' WHERE log_id='.$db->getField('log_id'));
24
+while ($db->nextRecord()) {
25
+	$db2->query('UPDATE combat_logs SET result=' . $db2->escapeBinary(gzcompress(serialize(unserialize(gzuncompress($db->getField('result')))))) . ' WHERE log_id=' . $db->getField('log_id'));
26 26
 }
Please login to merge, or discard this patch.
tools/irc/irc.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@
 block discarded – undo
100 100
 
101 101
 			safefputs($fp, 'NICKSERV IDENTIFY ' . IRC_BOT_PASS . EOL);
102 102
 
103
-            sleep(5);
103
+			sleep(5);
104 104
 
105 105
 			// join our public channel
106 106
 			if (!IRC_DEBUGGING) {
Please login to merge, or discard this patch.
Braces   +7 added lines, -7 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
Please login to merge, or discard this patch.
engine/Default/rankings_alliance_vs_alliance.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
 	foreach ($alliance_vs_ids as $id) {
53 53
 		$row_alliance = SmrAlliance::getAlliance($id, $player->getGameID());
54 54
 		$showRed = (!$curr_alliance->isNone() && $curr_alliance->hasDisbanded()) ||
55
-		           (!$row_alliance->isNone() && $row_alliance->hasDisbanded());
55
+				   (!$row_alliance->isNone() && $row_alliance->hasDisbanded());
56 56
 		$showBold = $curr_id == $player->getAllianceID() || $id == $player->getAllianceID();
57 57
 		$style = '';
58 58
 		if ($curr_id == $id && !$row_alliance->isNone()) {
Please login to merge, or discard this patch.
Braces   +17 added lines, -10 removed lines patch added patch discarded remove patch
@@ -62,8 +62,7 @@  discard block
 block discarded – undo
62 62
 			} elseif ($showBold) {
63 63
 				$style = 'class="bold"';
64 64
 			}
65
-		}
66
-		else {
65
+		} else {
67 66
 			$db2->query('SELECT kills FROM alliance_vs_alliance
68 67
 						WHERE alliance_id_2 = ' . $db2->escapeNumber($curr_id) . '
69 68
 							AND alliance_id_1 = ' . $db2->escapeNumber($id) . '
@@ -104,11 +103,15 @@  discard block
 block discarded – undo
104 103
 	if ($id > 0) {
105 104
 		$killer_alliance = SmrAlliance::getAlliance($id, $player->getGameID());
106 105
 		$alliance_name = $killer_alliance->getAllianceDisplayName();
106
+	} elseif ($id == 0) {
107
+		$alliance_name = 'No Alliance';
108
+	} elseif ($id == ALLIANCE_VS_FORCES) {
109
+		$alliance_name = '<span class="yellow">Forces</span>';
110
+	} elseif ($id == ALLIANCE_VS_PLANETS) {
111
+		$alliance_name = '<span class="yellow">Planets</span>';
112
+	} elseif ($id == ALLIANCE_VS_PORTS) {
113
+		$alliance_name = '<span class="yellow">Ports</span>';
107 114
 	}
108
-	elseif ($id == 0) $alliance_name = 'No Alliance';
109
-	elseif ($id == ALLIANCE_VS_FORCES) $alliance_name = '<span class="yellow">Forces</span>';
110
-	elseif ($id == ALLIANCE_VS_PLANETS) $alliance_name = '<span class="yellow">Planets</span>';
111
-	elseif ($id == ALLIANCE_VS_PORTS) $alliance_name = '<span class="yellow">Ports</span>';
112 115
 
113 116
 	$kills[] = [
114 117
 		'Name' => $alliance_name,
@@ -126,11 +129,15 @@  discard block
 block discarded – undo
126 129
 	if ($id > 0) {
127 130
 		$killer_alliance = SmrAlliance::getAlliance($id, $player->getGameID());
128 131
 		$alliance_name = $killer_alliance->getAllianceDisplayName();
132
+	} elseif ($id == 0) {
133
+		$alliance_name = 'No Alliance';
134
+	} elseif ($id == ALLIANCE_VS_FORCES) {
135
+		$alliance_name = '<span class="yellow">Forces</span>';
136
+	} elseif ($id == ALLIANCE_VS_PLANETS) {
137
+		$alliance_name = '<span class="yellow">Planets</span>';
138
+	} elseif ($id == ALLIANCE_VS_PORTS) {
139
+		$alliance_name = '<span class="yellow">Ports</span>';
129 140
 	}
130
-	elseif ($id == 0) $alliance_name = 'No Alliance';
131
-	elseif ($id == ALLIANCE_VS_FORCES) $alliance_name = '<span class="yellow">Forces</span>';
132
-	elseif ($id == ALLIANCE_VS_PLANETS) $alliance_name = '<span class="yellow">Planets</span>';
133
-	elseif ($id == ALLIANCE_VS_PORTS) $alliance_name = '<span class="yellow">Ports</span>';
134 141
 
135 142
 	$deaths[] = [
136 143
 		'Name' => $alliance_name,
Please login to merge, or discard this patch.
engine/Default/trader_status.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,12 +33,24 @@
 block discarded – undo
33 33
 $template->assign('HardwareHREF', SmrSession::getNewHREF($container));
34 34
 
35 35
 $hardware = [];
36
-if ($ship->canHaveScanner()) $hardware[] = 'Scanner';
37
-if ($ship->canHaveIllusion()) $hardware[] = 'Illusion Generator';
38
-if ($ship->canHaveCloak()) $hardware[] = 'Cloaking Device';
39
-if ($ship->canHaveJump()) $hardware[] = 'Jump Drive';
40
-if ($ship->canHaveDCS()) $hardware[] = 'Drone Scrambler';
41
-if (empty($hardware)) $hardware[] = 'none';
36
+if ($ship->canHaveScanner()) {
37
+	$hardware[] = 'Scanner';
38
+}
39
+if ($ship->canHaveIllusion()) {
40
+	$hardware[] = 'Illusion Generator';
41
+}
42
+if ($ship->canHaveCloak()) {
43
+	$hardware[] = 'Cloaking Device';
44
+}
45
+if ($ship->canHaveJump()) {
46
+	$hardware[] = 'Jump Drive';
47
+}
48
+if ($ship->canHaveDCS()) {
49
+	$hardware[] = 'Drone Scrambler';
50
+}
51
+if (empty($hardware)) {
52
+	$hardware[] = 'none';
53
+}
42 54
 $template->assign('Hardware', $hardware);
43 55
 
44 56
 $db->query('SELECT level_name,requirement FROM level WHERE requirement>' . $db->escapeNumber($player->getExperience()) . ' ORDER BY requirement ASC LIMIT 1');
Please login to merge, or discard this patch.