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 | } |
@@ -4,16 +4,16 @@ |
||
4 | 4 | |
5 | 5 | |
6 | 6 | if (get_magic_quotes_gpc()) { |
7 | - function stripslashes_array($array) |
|
8 | - { |
|
9 | - return is_array($array) ? array_map('stripslashes_array', $array) : stripslashes($array); |
|
10 | - } |
|
7 | + function stripslashes_array($array) |
|
8 | + { |
|
9 | + return is_array($array) ? array_map('stripslashes_array', $array) : stripslashes($array); |
|
10 | + } |
|
11 | 11 | |
12 | - $_COOKIE = stripslashes_array($_COOKIE); |
|
13 | - $_FILES = stripslashes_array($_FILES); |
|
14 | - $_GET = stripslashes_array($_GET); |
|
15 | - $_POST = stripslashes_array($_POST); |
|
16 | - $_REQUEST = stripslashes_array($_REQUEST); |
|
12 | + $_COOKIE = stripslashes_array($_COOKIE); |
|
13 | + $_FILES = stripslashes_array($_FILES); |
|
14 | + $_GET = stripslashes_array($_GET); |
|
15 | + $_POST = stripslashes_array($_POST); |
|
16 | + $_REQUEST = stripslashes_array($_REQUEST); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | header('Cache-Control: no-cache, must-revalidate'); |
@@ -68,9 +68,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -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', intval(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 |
@@ -31,10 +31,11 @@ |
||
31 | 31 | $routesForPort=-1; |
32 | 32 | $numberOfRoutes=5; |
33 | 33 | |
34 | -if ($maxNumberOfPorts == 1) |
|
34 | +if ($maxNumberOfPorts == 1) { |
|
35 | 35 | $allRoutes = RouteGenerator::generateOneWayRoutes($allSectors, $distances, $goods, $races, $routesForPort); |
36 | -else |
|
36 | +} else { |
|
37 | 37 | $allRoutes = RouteGenerator::generateMultiPortRoutes($maxNumberOfPorts, $allSectors, $goods, $races, $distances, $routesForPort, $numberOfRoutes); |
38 | +} |
|
38 | 39 | |
39 | 40 | //var_dump($allRoutes); |
40 | 41 |
@@ -19,15 +19,15 @@ discard block |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | $maxNumberOfPorts = 2; |
22 | -$goods = array(true,true,true,true,false,false,false,false,false,false,false,false,false); |
|
23 | -$races = array(true,true,true,true,false,false,false,false,false,false,false,false,false,false); |
|
22 | +$goods = array(true, true, true, true, false, false, false, false, false, false, false, false, false); |
|
23 | +$races = array(true, true, true, true, false, false, false, false, false, false, false, false, false, false); |
|
24 | 24 | |
25 | 25 | //$distances =& Plotter::calculatePortToPortDistances($allSectors,10,0,1440); |
26 | -$distances =& Plotter::calculatePortToPortDistances($allSectors,10,0,14); |
|
26 | +$distances = & Plotter::calculatePortToPortDistances($allSectors, 10, 0, 14); |
|
27 | 27 | //var_dump($distances); |
28 | 28 | |
29 | -$routesForPort=-1; |
|
30 | -$numberOfRoutes=5; |
|
29 | +$routesForPort = -1; |
|
30 | +$numberOfRoutes = 5; |
|
31 | 31 | |
32 | 32 | if ($maxNumberOfPorts == 1) |
33 | 33 | $allRoutes = RouteGenerator::generateOneWayRoutes($allSectors, $distances, $goods, $races, $routesForPort); |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | |
37 | 37 | //var_dump($allRoutes); |
38 | 38 | |
39 | -foreach($allRoutes as $routeType) |
|
39 | +foreach ($allRoutes as $routeType) |
|
40 | 40 | { |
41 | 41 | $c = 0; |
42 | - foreach($routeType as $routeMulti) |
|
42 | + foreach ($routeType as $routeMulti) |
|
43 | 43 | { |
44 | 44 | $c += (count($routeMulti)); |
45 | 45 | // foreach($routeMulti as $multi => $route) { |