We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $account = SmrAccount::getAccount(SmrSession::$account_id); |
28 | 28 | |
29 | 29 | if (isset($_GET['action']) && $_GET['action'] == 'Moderate') { |
30 | - if(!$account->hasPermission(PERMISSION_MODERATE_PHOTO_ALBUM)) |
|
30 | + if (!$account->hasPermission(PERMISSION_MODERATE_PHOTO_ALBUM)) |
|
31 | 31 | create_error_offline('You do not have permission to do that!'); |
32 | 32 | $container = create_container('skeleton.php', 'album_moderate.php'); |
33 | 33 | $container['account_id'] = $album_id; |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | $curr_time = TIME; |
47 | 47 | |
48 | 48 | $comment = word_filter($comment); |
49 | - $account->sendMessageToBox(BOX_ALBUM_COMMENTS,$comment); |
|
49 | + $account->sendMessageToBox(BOX_ALBUM_COMMENTS, $comment); |
|
50 | 50 | |
51 | 51 | // check if we have comments for this album already |
52 | 52 | $db->lockTable('album_has_comments'); |
53 | 53 | |
54 | - $db->query('SELECT MAX(comment_id) FROM album_has_comments WHERE album_id = '.$db->escapeNumber($album_id)); |
|
54 | + $db->query('SELECT MAX(comment_id) FROM album_has_comments WHERE album_id = ' . $db->escapeNumber($album_id)); |
|
55 | 55 | if ($db->nextRecord()) |
56 | 56 | $comment_id = $db->getField('MAX(comment_id)') + 1; |
57 | 57 | else |
@@ -59,12 +59,12 @@ discard block |
||
59 | 59 | |
60 | 60 | $db->query('INSERT INTO album_has_comments |
61 | 61 | (album_id, comment_id, time, post_id, msg) |
62 | - VALUES ('.$db->escapeNumber($album_id).', '.$db->escapeNumber($comment_id).', '.$db->escapeNumber($curr_time).', '.$db->escapeNumber($account->getAccountID()).', '.$db->escapeString($comment).')'); |
|
62 | + VALUES ('.$db->escapeNumber($album_id) . ', ' . $db->escapeNumber($comment_id) . ', ' . $db->escapeNumber($curr_time) . ', ' . $db->escapeNumber($account->getAccountID()) . ', ' . $db->escapeString($comment) . ')'); |
|
63 | 63 | $db->unlock(); |
64 | 64 | |
65 | 65 | header('Location: /album/?' . get_album_nick($album_id)); |
66 | 66 | exit; |
67 | 67 | } |
68 | -catch(Throwable $e) { |
|
68 | +catch (Throwable $e) { |
|
69 | 69 | handleException($e); |
70 | 70 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | |
6 | 6 | // avoid site caching |
7 | 7 | header('Expires: Mon, 03 Nov 1976 16:10:00 GMT'); |
8 | - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') .' GMT'); |
|
8 | + header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|
9 | 9 | header('Cache-Control: no-cache'); |
10 | 10 | header('Pragma: no-cache'); |
11 | 11 | header('Cache-Control: post-check=0, pre-check=0', FALSE); |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | |
26 | 26 | } |
27 | 27 | |
28 | - if(isset($_REQUEST['sector_id'])) { |
|
28 | + if (isset($_REQUEST['sector_id'])) { |
|
29 | 29 | $sectorID = $_REQUEST['sector_id']; |
30 | - if(!is_numeric($sectorID)) { |
|
30 | + if (!is_numeric($sectorID)) { |
|
31 | 31 | header('location: /error.php?msg=Sector ID was not a number.'); |
32 | 32 | exit; |
33 | 33 | } |
@@ -38,16 +38,16 @@ discard block |
||
38 | 38 | exit; |
39 | 39 | } |
40 | 40 | } |
41 | - else if(isset($_REQUEST['galaxy_id'])) { |
|
41 | + else if (isset($_REQUEST['galaxy_id'])) { |
|
42 | 42 | $galaxyID = $_REQUEST['galaxy_id']; |
43 | - if(!is_numeric($galaxyID)) { |
|
43 | + if (!is_numeric($galaxyID)) { |
|
44 | 44 | header('location: /error.php?msg=Galaxy ID was not a number.'); |
45 | 45 | exit; |
46 | 46 | } |
47 | 47 | try { |
48 | 48 | $galaxy = SmrGalaxy::getGalaxy(SmrSession::getGameID(), $galaxyID); |
49 | 49 | } |
50 | - catch(Exception $e) { |
|
50 | + catch (Exception $e) { |
|
51 | 51 | header('location: /error.php?msg=Invalid galaxy ID'); |
52 | 52 | exit; |
53 | 53 | } |
@@ -96,24 +96,24 @@ discard block |
||
96 | 96 | $template->unassign('Title'); |
97 | 97 | $template->assign('Title', 'Galaxy Map'); |
98 | 98 | |
99 | - if($account->getCssLink()!=null) |
|
100 | - $template->assign('ExtraCSSLink',$account->getCssLink()); |
|
99 | + if ($account->getCssLink() != null) |
|
100 | + $template->assign('ExtraCSSLink', $account->getCssLink()); |
|
101 | 101 | $template->assign('CSSLink', $account->getCssUrl()); |
102 | 102 | $template->assign('CSSColourLink', $account->getCssColourUrl()); |
103 | 103 | $template->assign('FontSize', $account->getFontSize() - 20); |
104 | - $template->assign('ThisGalaxy',$galaxy); |
|
105 | - $template->assign('ThisAccount',$account); |
|
106 | - $template->assign('GameGalaxies',SmrGalaxy::getGameGalaxies($player->getGameID())); |
|
107 | - $template->assign('ThisSector',$player->getSector()); |
|
108 | - $template->assign('MapSectors',$mapSectors); |
|
109 | - $template->assign('ThisShip',$player->getShip()); |
|
110 | - $template->assign('ThisPlayer',$player); |
|
104 | + $template->assign('ThisGalaxy', $galaxy); |
|
105 | + $template->assign('ThisAccount', $account); |
|
106 | + $template->assign('GameGalaxies', SmrGalaxy::getGameGalaxies($player->getGameID())); |
|
107 | + $template->assign('ThisSector', $player->getSector()); |
|
108 | + $template->assign('MapSectors', $mapSectors); |
|
109 | + $template->assign('ThisShip', $player->getShip()); |
|
110 | + $template->assign('ThisPlayer', $player); |
|
111 | 111 | |
112 | 112 | // AJAX updates are not set up for the galaxy map at this time |
113 | 113 | $template->assign('AJAX_ENABLE_REFRESH', false); |
114 | 114 | |
115 | 115 | $template->display('GalaxyMap.inc'); |
116 | 116 | } |
117 | -catch(Throwable $e) { |
|
117 | +catch (Throwable $e) { |
|
118 | 118 | handleException($e); |
119 | 119 | } |
@@ -14,9 +14,9 @@ discard block |
||
14 | 14 | // ******************************** |
15 | 15 | |
16 | 16 | if (SmrSession::$account_id == 0) { |
17 | - if(isset($_REQUEST['loginType'])) { |
|
17 | + if (isset($_REQUEST['loginType'])) { |
|
18 | 18 | $socialLogin = new SocialLogin($_REQUEST['loginType']); |
19 | - if(!$socialLogin->isValid()) { |
|
19 | + if (!$socialLogin->isValid()) { |
|
20 | 20 | $msg = 'Error validating login.'; |
21 | 21 | header('Location: /login.php?msg=' . rawurlencode(htmlspecialchars($msg, ENT_QUOTES))); |
22 | 22 | exit; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | session_start(); |
32 | 32 | } |
33 | 33 | $_SESSION['socialLogin'] = $socialLogin; |
34 | - $template->assign('SocialLogin',$socialLogin); |
|
34 | + $template->assign('SocialLogin', $socialLogin); |
|
35 | 35 | // Pre-populate the login field if an account with this email exists. |
36 | 36 | // (Also disable creating a new account because they would just get |
37 | 37 | // an "Email already registered" error anyway.) |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $account = SmrAccount::getAccount(SmrSession::$account_id); |
81 | 81 | |
82 | 82 | // If linking a social login to an existing account |
83 | - if(isset($_REQUEST['social'])) { |
|
83 | + if (isset($_REQUEST['social'])) { |
|
84 | 84 | session_start(); |
85 | 85 | if (!isset($_SESSION['socialLogin'])) { |
86 | 86 | $msg = 'Tried a social login link without having a social session.'; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | // ******************************** |
110 | 110 | |
111 | 111 | // get reason for disabled user |
112 | - if(($disabled = $account->isDisabled())!==false) { |
|
112 | + if (($disabled = $account->isDisabled()) !== false) { |
|
113 | 113 | // save session (incase we forward) |
114 | 114 | SmrSession::update(); |
115 | 115 | if (($disabled['Reason'] != CLOSE_ACCOUNT_INVALID_EMAIL_REASON) && |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | //now we set a cookie that we can use for mult checking |
148 | 148 | if (!isset($_COOKIE['Session_Info'])) { |
149 | 149 | //we get their info from db if they have any |
150 | - $db->query('SELECT * FROM multi_checking_cookie WHERE account_id = '.$account->getAccountID()); |
|
150 | + $db->query('SELECT * FROM multi_checking_cookie WHERE account_id = ' . $account->getAccountID()); |
|
151 | 151 | if ($db->nextRecord()) { |
152 | 152 | //convert to array |
153 | 153 | $old = explode('-', $db->getField('array')); |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | //check that each value is legit and add it to db string |
162 | 162 | $new = MULTI_CHECKING_COOKIE_VERSION; |
163 | 163 | foreach ($old as $accID) |
164 | - if (is_numeric($accID)) $new .= '-'.$accID; |
|
165 | - $db->query('REPLACE INTO multi_checking_cookie (account_id, array, `use`) VALUES ('.$db->escapeNumber($account->getAccountID()).', '.$db->escapeString($new).', '.$db->escapeString($use).')'); |
|
164 | + if (is_numeric($accID)) $new .= '-' . $accID; |
|
165 | + $db->query('REPLACE INTO multi_checking_cookie (account_id, array, `use`) VALUES (' . $db->escapeNumber($account->getAccountID()) . ', ' . $db->escapeString($new) . ', ' . $db->escapeString($use) . ')'); |
|
166 | 166 | //now we update their cookie with the newest info |
167 | 167 | setcookie('Session_Info', $new, TIME + 157680000); |
168 | 168 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | //add this acc to the cookie if it isn't there |
179 | 179 | if (!in_array($account->getAccountID(), $cookie)) $cookie[] = $account->getAccountID(); |
180 | 180 | |
181 | - $db->query('SELECT * FROM multi_checking_cookie WHERE account_id = '.$account->getAccountID()); |
|
181 | + $db->query('SELECT * FROM multi_checking_cookie WHERE account_id = ' . $account->getAccountID()); |
|
182 | 182 | if ($db->nextRecord()) { |
183 | 183 | //convert to array |
184 | 184 | $old = explode('-', $db->getField('array')); |
@@ -187,35 +187,35 @@ discard block |
||
187 | 187 | $old[0] = MULTI_CHECKING_COOKIE_VERSION; |
188 | 188 | //merge arrays...but keys are all different so we go through each value |
189 | 189 | foreach ($cookie as $value) |
190 | - if (!in_array($value,$old)) $old[] = $value; |
|
190 | + if (!in_array($value, $old)) $old[] = $value; |
|
191 | 191 | |
192 | 192 | if (sizeof($old) <= 2) $use = 'FALSE'; |
193 | 193 | else $use = 'TRUE'; |
194 | 194 | //check that each value is legit and add it to db string |
195 | 195 | $new = MULTI_CHECKING_COOKIE_VERSION; |
196 | 196 | foreach ($old as $accID) |
197 | - if (is_numeric($accID)) $new .= '-'.$accID; |
|
198 | - $db->query('REPLACE INTO multi_checking_cookie (account_id, array, `use`) VALUES ('.$db->escapeNumber($account->getAccountID()).', '.$db->escapeString($new).', '.$db->escapeString($use).')'); |
|
197 | + if (is_numeric($accID)) $new .= '-' . $accID; |
|
198 | + $db->query('REPLACE INTO multi_checking_cookie (account_id, array, `use`) VALUES (' . $db->escapeNumber($account->getAccountID()) . ', ' . $db->escapeString($new) . ', ' . $db->escapeString($use) . ')'); |
|
199 | 199 | //update newest cookie |
200 | 200 | setcookie('Session_Info', $new, TIME + 157680000); |
201 | 201 | |
202 | 202 | } |
203 | 203 | |
204 | 204 | //get rid of expired messages |
205 | - $db2->query('UPDATE message SET receiver_delete = \'TRUE\', sender_delete = \'TRUE\', expire_time = 0 WHERE expire_time < '.$db->escapeNumber(TIME).' AND expire_time != 0'); |
|
205 | + $db2->query('UPDATE message SET receiver_delete = \'TRUE\', sender_delete = \'TRUE\', expire_time = 0 WHERE expire_time < ' . $db->escapeNumber(TIME) . ' AND expire_time != 0'); |
|
206 | 206 | // Mark message as read if it was sent to self as a mass mail. |
207 | 207 | $db2->query('UPDATE message SET msg_read = \'TRUE\' WHERE account_id = ' . $db->escapeNumber($account->getAccountID()) . ' AND account_id = sender_id AND message_type_id IN (' . $db->escapeArray(array(MSG_ALLIANCE, MSG_GLOBAL, MSG_POLITICAL)) . ');'); |
208 | 208 | //check to see if we need to remove player_has_unread |
209 | 209 | $db2 = new SmrMySqlDatabase(); |
210 | - $db2->query('DELETE FROM player_has_unread_messages WHERE account_id = '.$db->escapeNumber($account->getAccountID())); |
|
210 | + $db2->query('DELETE FROM player_has_unread_messages WHERE account_id = ' . $db->escapeNumber($account->getAccountID())); |
|
211 | 211 | $db2->query(' |
212 | 212 | INSERT INTO player_has_unread_messages (game_id, account_id, message_type_id) |
213 | 213 | SELECT game_id, account_id, message_type_id FROM message WHERE account_id = ' . $db->escapeNumber($account->getAccountID()) . ' AND msg_read = ' . $db->escapeBoolean(false) . ' AND receiver_delete = ' . $db->escapeBoolean(false) |
214 | 214 | ); |
215 | 215 | |
216 | - header('Location: '.$href); |
|
216 | + header('Location: ' . $href); |
|
217 | 217 | exit; |
218 | 218 | } |
219 | -catch(Throwable $e) { |
|
219 | +catch (Throwable $e) { |
|
220 | 220 | handleException($e); |
221 | 221 | } |
@@ -103,14 +103,14 @@ discard block |
||
103 | 103 | $hardwarea = @$_REQUEST['hardwarea']; |
104 | 104 | |
105 | 105 | $class = buildSelector($db, 'class', 'ship_class_name', 'ship_class'); |
106 | - $race = buildSelector($db, 'race', 'race_name', 'race', 'race_id'); |
|
106 | + $race = buildSelector($db, 'race', 'race_name', 'race', 'race_id'); |
|
107 | 107 | $speed = buildSelector($db, 'speed', 'speed', 'ship_type'); |
108 | - $hardpoint = buildSelector($db, 'hp', 'hardpoint', 'ship_type'); |
|
108 | + $hardpoint = buildSelector($db, 'hp', 'hardpoint', 'ship_type'); |
|
109 | 109 | $restrict = buildRestriction(); |
110 | - $scanner = buildToggle('scannerPick'); |
|
111 | - $cloak = buildToggle('cloakPick'); |
|
110 | + $scanner = buildToggle('scannerPick'); |
|
111 | + $cloak = buildToggle('cloakPick'); |
|
112 | 112 | $illusion = buildToggle('illusionPick'); |
113 | - $jump = buildToggle('jumpPick'); |
|
113 | + $jump = buildToggle('jumpPick'); |
|
114 | 114 | $scramble = buildToggle('scramblePick'); |
115 | 115 | |
116 | 116 | echo ('<body>'); |
@@ -124,10 +124,10 @@ discard block |
||
124 | 124 | $seq = 'ASC'; |
125 | 125 | } |
126 | 126 | |
127 | - $allowedOrders = array('ship_name','race_name','cost','speed','hardpoint','buyer_restriction','lvl_needed','ship_class_name'); |
|
127 | + $allowedOrders = array('ship_name', 'race_name', 'cost', 'speed', 'hardpoint', 'buyer_restriction', 'lvl_needed', 'ship_class_name'); |
|
128 | 128 | |
129 | - if (!empty($order) && in_array($order,$allowedOrders)) { |
|
130 | - $order_by = $order .' '. $seq; |
|
129 | + if (!empty($order) && in_array($order, $allowedOrders)) { |
|
130 | + $order_by = $order . ' ' . $seq; |
|
131 | 131 | } |
132 | 132 | else { |
133 | 133 | $order_by = 'ship_type.ship_type_id'; |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | $order_by .= ', ship_name ASC, ship_type_support_hardware.hardware_type_id ASC'; |
138 | 138 | |
139 | 139 | |
140 | - if(!empty($hardwarea) && is_numeric($hardwarea) && $hardwarea >=1 && $hardwarea <= 11) { |
|
140 | + if (!empty($hardwarea) && is_numeric($hardwarea) && $hardwarea >= 1 && $hardwarea <= 11) { |
|
141 | 141 | $db->query('SELECT ship_type_id |
142 | 142 | FROM ship_type_support_hardware |
143 | - WHERE hardware_type_id = '.$db->escapeNumber($hardwarea).' |
|
143 | + WHERE hardware_type_id = '.$db->escapeNumber($hardwarea) . ' |
|
144 | 144 | ORDER BY max_amount '.$seq); |
145 | 145 | $db2 = new SmrMySqlDatabase(); |
146 | 146 | while ($db->nextRecord()) { |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | JOIN race USING(race_id) |
152 | 152 | WHERE ship_type_id=' . $db->escapeNumber($db->getInt('ship_type_id')) . ' |
153 | 153 | ORDER BY hardware_type_id ASC'); |
154 | - if($db2->nextRecord()) { |
|
154 | + if ($db2->nextRecord()) { |
|
155 | 155 | $shipArray[] = buildShipStats($db2); |
156 | 156 | } |
157 | 157 | } |
@@ -203,37 +203,37 @@ discard block |
||
203 | 203 | <?php echo $scramble ?></th> |
204 | 204 | </tr><?php |
205 | 205 | $search = array("'", " ", ",", "<", ">", "\""); |
206 | - foreach($shipArray as $stat) { |
|
206 | + foreach ($shipArray as $stat) { |
|
207 | 207 | echo ('<tr>'); |
208 | 208 | foreach ($stat as $value) { |
209 | 209 | $class = ''; |
210 | - if(is_array($value)) { |
|
210 | + if (is_array($value)) { |
|
211 | 211 | $class = 'class="' . $value[0] . '"'; |
212 | 212 | $value = $value[1]; |
213 | 213 | } |
214 | - echo ('<td align="center" '.$class.'>'.$value.'</td>'); |
|
214 | + echo ('<td align="center" ' . $class . '>' . $value . '</td>'); |
|
215 | 215 | } |
216 | 216 | echo ('</tr>'); |
217 | 217 | } ?> |
218 | 218 | </table></div></div><?php |
219 | 219 | } |
220 | -catch(Throwable $e) { |
|
220 | +catch (Throwable $e) { |
|
221 | 221 | handleException($e); |
222 | 222 | } |
223 | 223 | |
224 | 224 | function buildSelector($db, $id, $name, $table, $typeField = false) { |
225 | - $selector = '<br><select id="'.$id.'Pick" name="'.$name.'" onchange="'.$id.'Pickf()"><option value="All">All</option>'; |
|
225 | + $selector = '<br><select id="' . $id . 'Pick" name="' . $name . '" onchange="' . $id . 'Pickf()"><option value="All">All</option>'; |
|
226 | 226 | $db->query(' |
227 | - SELECT DISTINCT '.$name. ($typeField!==false?',' . $typeField: '') . ' |
|
228 | - FROM '.$table.' |
|
227 | + SELECT DISTINCT '.$name . ($typeField !== false ? ',' . $typeField : '') . ' |
|
228 | + FROM '.$table . ' |
|
229 | 229 | ORDER BY '.$name); |
230 | 230 | $class = ''; |
231 | 231 | while ($db->nextRecord()) { |
232 | - if($typeField !== false) { |
|
232 | + if ($typeField !== false) { |
|
233 | 233 | $class = 'class="' . $id . $db->getInt($typeField) . '"'; |
234 | 234 | } |
235 | - $selector .= '<option '.$class.' value="'.$db->getField($name).'">' |
|
236 | - .$db->getField($name).'</option>'; |
|
235 | + $selector .= '<option ' . $class . ' value="' . $db->getField($name) . '">' |
|
236 | + .$db->getField($name) . '</option>'; |
|
237 | 237 | } |
238 | 238 | $selector .= '</select>'; |
239 | 239 | return $selector; |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | } |
252 | 252 | |
253 | 253 | function buildToggle($id) { |
254 | - $toggle = '<br><select id="'.$id.'" name="'.$id.'" onchange="'.$id.'f()">' |
|
254 | + $toggle = '<br><select id="' . $id . '" name="' . $id . '" onchange="' . $id . 'f()">' |
|
255 | 255 | .'<option value="All">All</option>' |
256 | 256 | .'<option value="Yes">Yes</option>' |
257 | 257 | .'<option value="">No</option></select>'; |
@@ -263,10 +263,10 @@ discard block |
||
263 | 263 | function buildShipStats($db) { |
264 | 264 | //we want to put them all in an array so we dont have to have 15 td rows |
265 | 265 | $stat = array(); |
266 | - $stat[] = str_replace(' ',' ',$db->getField('ship_name')); |
|
266 | + $stat[] = str_replace(' ', ' ', $db->getField('ship_name')); |
|
267 | 267 | //$stat[] = str_replace(' ',' ',$db->getField('race_name')); |
268 | 268 | $stat[] = array('race' . $db->getInt('race_id'), $db->getField('race_name')); |
269 | - $stat[] = str_replace(' ',' ',$db->getField('ship_class_name')); |
|
269 | + $stat[] = str_replace(' ', ' ', $db->getField('ship_class_name')); |
|
270 | 270 | $stat[] = number_format($db->getInt('cost')); |
271 | 271 | $stat[] = $db->getInt('speed'); |
272 | 272 | $stat[] = $db->getInt('hardpoint'); |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | //get our hardware |
284 | 284 | while ($hardware_id <= 11) |
285 | 285 | { |
286 | - if($db->nextRecord()) |
|
286 | + if ($db->nextRecord()) |
|
287 | 287 | { |
288 | 288 | if ($hardware_id < 7) |
289 | 289 | $stat[] = number_format($db->getInt('max_amount')); |
@@ -5,14 +5,14 @@ discard block |
||
5 | 5 | define('TIME', intval(MICRO_TIME)); |
6 | 6 | |
7 | 7 | // Repository paths |
8 | -const ROOT = __DIR__ . '/../'; |
|
9 | -const LIB = ROOT.'lib/'; |
|
10 | -const ENGINE = ROOT.'engine/'; |
|
11 | -const WWW = ROOT.'htdocs/'; |
|
12 | -const UPLOAD = WWW.'upload/'; |
|
13 | -const ADMIN = ROOT.'admin/'; |
|
14 | -const TOOLS = ROOT.'tools/'; |
|
15 | -const CONFIG = ROOT.'config/'; |
|
8 | +const ROOT = __DIR__ . '/../'; |
|
9 | +const LIB = ROOT . 'lib/'; |
|
10 | +const ENGINE = ROOT . 'engine/'; |
|
11 | +const WWW = ROOT . 'htdocs/'; |
|
12 | +const UPLOAD = WWW . 'upload/'; |
|
13 | +const ADMIN = ROOT . 'admin/'; |
|
14 | +const TOOLS = ROOT . 'tools/'; |
|
15 | +const CONFIG = ROOT . 'config/'; |
|
16 | 16 | const TEMPLATES_DIR = ROOT . 'templates/'; |
17 | 17 | |
18 | 18 | // Define server-specific constants |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | if (ENABLE_DEBUG) { |
22 | 22 | // Warn about everything when in debug mode |
23 | - error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); |
|
23 | + error_reporting(E_ERROR|E_WARNING|E_PARSE|E_NOTICE); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | const ACCOUNT_ID_PORT = 65535; |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | */ |
59 | 59 | const DEFAULT_DATE_DATE_SHORT = 'j/n/Y'; |
60 | 60 | const DEFAULT_DATE_TIME_SHORT = 'g:i:s A'; |
61 | -const DEFAULT_DATE_FULL_SHORT = DEFAULT_DATE_DATE_SHORT.' '.DEFAULT_DATE_TIME_SHORT; |
|
62 | -const DEFAULT_DATE_FULL_SHORT_SPLIT = DEFAULT_DATE_DATE_SHORT.'\<b\r /\>'.DEFAULT_DATE_TIME_SHORT; |
|
63 | -const DEFAULT_DATE_FULL_LONG = 'l jS F '.DEFAULT_DATE_TIME_SHORT; |
|
61 | +const DEFAULT_DATE_FULL_SHORT = DEFAULT_DATE_DATE_SHORT . ' ' . DEFAULT_DATE_TIME_SHORT; |
|
62 | +const DEFAULT_DATE_FULL_SHORT_SPLIT = DEFAULT_DATE_DATE_SHORT . '\<b\r /\>' . DEFAULT_DATE_TIME_SHORT; |
|
63 | +const DEFAULT_DATE_FULL_LONG = 'l jS F ' . DEFAULT_DATE_TIME_SHORT; |
|
64 | 64 | |
65 | 65 | /* |
66 | 66 | * Buyer restrictions for ships and weapons |
@@ -416,4 +416,4 @@ discard block |
||
416 | 416 | const LOCK_DURATION = 10; // The max time for a lock to last before timing out. |
417 | 417 | const LOCK_BUFFER = 3; // The minimum time that must be remaining on the lock duration for the lock to be valid. |
418 | 418 | |
419 | -define('USING_AJAX',isset($_REQUEST['ajax'])&&$_REQUEST['ajax']==1); |
|
419 | +define('USING_AJAX', isset($_REQUEST['ajax']) && $_REQUEST['ajax'] == 1); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | // creates a new user account object |
28 | 28 | $account = SmrAccount::getAccountByName($login); |
29 | 29 | $passwordReset = $_REQUEST['password_reset']; |
30 | - if ($account==null || empty($passwordReset) || $account->getPasswordReset() != $passwordReset) { |
|
30 | + if ($account == null || empty($passwordReset) || $account->getPasswordReset() != $passwordReset) { |
|
31 | 31 | // unknown user |
32 | 32 | header('Location: /error.php?msg=' . rawurlencode('User does not exist or reset password code is incorrect.')); |
33 | 33 | exit; |
@@ -38,6 +38,6 @@ discard block |
||
38 | 38 | |
39 | 39 | header('Location: /login.php'); |
40 | 40 | } |
41 | -catch(Throwable $e) { |
|
41 | +catch (Throwable $e) { |
|
42 | 42 | handleException($e); |
43 | 43 | } |
@@ -27,6 +27,6 @@ |
||
27 | 27 | } |
28 | 28 | |
29 | 29 | } |
30 | -catch(Throwable $e) { |
|
30 | +catch (Throwable $e) { |
|
31 | 31 | handleException($e); |
32 | 32 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | // The d3 graph links are the warp connections between galaxies |
32 | 32 | $db = new SmrMySqlDatabase(); |
33 | - $db->query('SELECT sector_id, warp FROM sector WHERE warp !=0 AND game_id = '.$db->escapeNumber($gameID)); |
|
33 | + $db->query('SELECT sector_id, warp FROM sector WHERE warp !=0 AND game_id = ' . $db->escapeNumber($gameID)); |
|
34 | 34 | while ($db->nextRecord()) { |
35 | 35 | $warp1 = SmrSector::getSector($gameID, $db->getInt('sector_id')); |
36 | 36 | $warp2 = SmrSector::getSector($gameID, $db->getInt('warp')); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | ]); |
48 | 48 | |
49 | 49 | } |
50 | -catch(Throwable $e) { |
|
50 | +catch (Throwable $e) { |
|
51 | 51 | handleException($e); |
52 | 52 | } |
53 | 53 | ?> |
@@ -1,44 +1,44 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | function logException(Throwable $e) { |
3 | - global $account,$var,$player,$db; |
|
3 | + global $account, $var, $player, $db; |
|
4 | 4 | $errorType = 'Unexpected Game Error!'; |
5 | - $message=''; |
|
6 | - $currMySQLError=''; |
|
5 | + $message = ''; |
|
6 | + $currMySQLError = ''; |
|
7 | 7 | |
8 | - if(is_object($account)) { |
|
9 | - $message .= 'Login: '.$account->getLogin().EOL.EOL.'-----------'.EOL.EOL. |
|
10 | - 'Account ID: '.$account->getAccountID().EOL.EOL.'-----------'.EOL.EOL. |
|
11 | - 'E-Mail: '.$account->getEmail().EOL.EOL.'-----------'.EOL.EOL; |
|
8 | + if (is_object($account)) { |
|
9 | + $message .= 'Login: ' . $account->getLogin() . EOL . EOL . '-----------' . EOL . EOL . |
|
10 | + 'Account ID: ' . $account->getAccountID() . EOL . EOL . '-----------' . EOL . EOL . |
|
11 | + 'E-Mail: ' . $account->getEmail() . EOL . EOL . '-----------' . EOL . EOL; |
|
12 | 12 | } |
13 | - $message .= 'Error Message: '. $e .EOL.EOL.'-----------'.EOL.EOL; |
|
13 | + $message .= 'Error Message: ' . $e . EOL . EOL . '-----------' . EOL . EOL; |
|
14 | 14 | |
15 | 15 | // Only check database if it was already loaded (do not try to autoload) |
16 | 16 | if (class_exists('MySqlDatabase', false) && ($db instanceof MySqlDatabase)) { |
17 | - if($currMySQLError = $db->getError()) { |
|
17 | + if ($currMySQLError = $db->getError()) { |
|
18 | 18 | $errorType = 'Database Error'; |
19 | - $message .= 'MySQL Error MSG: '.$db->getError().EOL.EOL.'-----------'.EOL.EOL; |
|
19 | + $message .= 'MySQL Error MSG: ' . $db->getError() . EOL . EOL . '-----------' . EOL . EOL; |
|
20 | 20 | } |
21 | 21 | } |
22 | 22 | |
23 | 23 | $message .= |
24 | - '$var: '.var_export($var,true).EOL.EOL.'-----------'.EOL.EOL. |
|
25 | - 'USING_AJAX: '.(defined('USING_AJAX')?var_export(USING_AJAX,true):'undefined'); |
|
24 | + '$var: ' . var_export($var, true) . EOL . EOL . '-----------' . EOL . EOL . |
|
25 | + 'USING_AJAX: ' . (defined('USING_AJAX') ?var_export(USING_AJAX, true) : 'undefined'); |
|
26 | 26 | |
27 | 27 | try { |
28 | - if(function_exists('release_lock')) |
|
28 | + if (function_exists('release_lock')) |
|
29 | 29 | release_lock(); //Try to release lock so they can carry on normally |
30 | 30 | } |
31 | - catch(Throwable $ee) { |
|
32 | - $message .= EOL.EOL.'-----------'.EOL.EOL. |
|
33 | - 'Releasing Lock Failed' .EOL. |
|
34 | - 'Message: ' . $ee .EOL.EOL; |
|
35 | - if($currMySQLError!=$db->getError()) { |
|
36 | - $message .= 'MySQL Error MSG: '.$db->getError().EOL.EOL; |
|
31 | + catch (Throwable $ee) { |
|
32 | + $message .= EOL . EOL . '-----------' . EOL . EOL . |
|
33 | + 'Releasing Lock Failed' . EOL . |
|
34 | + 'Message: ' . $ee . EOL . EOL; |
|
35 | + if ($currMySQLError != $db->getError()) { |
|
36 | + $message .= 'MySQL Error MSG: ' . $db->getError() . EOL . EOL; |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
40 | 40 | if (defined('NPC_SCRIPT')) { |
41 | - $message = 'Script: '.SCRIPT_ID.EOL.EOL.'-----------'.EOL.EOL.$message; |
|
41 | + $message = 'Script: ' . SCRIPT_ID . EOL . EOL . '-----------' . EOL . EOL . $message; |
|
42 | 42 | var_dump($message); |
43 | 43 | return; |
44 | 44 | } |
@@ -46,16 +46,16 @@ discard block |
||
46 | 46 | // Unconditionally send error message to the log |
47 | 47 | error_log($message); |
48 | 48 | |
49 | - if(ENABLE_DEBUG) { |
|
49 | + if (ENABLE_DEBUG) { |
|
50 | 50 | // Display error message on the page and then exit |
51 | 51 | echo nl2br($message); |
52 | 52 | exit; |
53 | 53 | } |
54 | 54 | |
55 | 55 | // Send error message to the in-game auto bugs mailbox |
56 | - if (is_object($player) && method_exists($player,'sendMessageToBox')) { |
|
56 | + if (is_object($player) && method_exists($player, 'sendMessageToBox')) { |
|
57 | 57 | $player->sendMessageToBox(BOX_BUGS_AUTO, $message); |
58 | - } elseif (is_object($account) && method_exists($account,'sendMessageToBox')) { |
|
58 | + } elseif (is_object($account) && method_exists($account, 'sendMessageToBox')) { |
|
59 | 59 | // Will be logged without a game_id |
60 | 60 | $account->sendMessageToBox(BOX_BUGS_AUTO, $message); |
61 | 61 | } else { |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | |
91 | 91 | // If this is an ajax update, we don't really have a way to redirect |
92 | 92 | // to an error page at this time, so we just quit. |
93 | - if(!defined('USING_AJAX')||!USING_AJAX) |
|
94 | - header('location: /error.php?msg='.urlencode($errorType)); |
|
93 | + if (!defined('USING_AJAX') || !USING_AJAX) |
|
94 | + header('location: /error.php?msg=' . urlencode($errorType)); |
|
95 | 95 | exit; |
96 | 96 | } |
97 | 97 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | // Initialize the template |
116 | 116 | $template = new Template(); |
117 | -$GLOBALS['template'] =& $template; |
|
117 | +$GLOBALS['template'] = & $template; |
|
118 | 118 | |
119 | 119 | // Change the browser title based on the server config |
120 | 120 | $prefix = ''; |