We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -88,7 +88,7 @@ discard block |
||
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 |
||
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 | } |
@@ -31,8 +31,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -3,7 +3,7 @@ |
||
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 |
@@ -17,7 +17,9 @@ discard block |
||
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 |
||
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)); |
@@ -3,11 +3,11 @@ discard block |
||
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 |
||
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 | } |
@@ -24,7 +24,7 @@ |
||
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 |
@@ -79,8 +79,7 @@ |
||
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 | } |
@@ -10,22 +10,22 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -21,6 +21,6 @@ |
||
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 | } |
@@ -100,7 +100,7 @@ |
||
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) { |
@@ -6,12 +6,13 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -52,7 +52,7 @@ |
||
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()) { |
@@ -62,8 +62,7 @@ discard block |
||
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 |
||
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 |
||
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, |
@@ -33,12 +33,24 @@ |
||
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'); |