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 | } |
@@ -10,25 +10,30 @@ discard block |
||
| 10 | 10 | require_once(LIB . 'Default/smr.inc'); |
| 11 | 11 | require_once(LIB . 'Album/album_functions.php'); |
| 12 | 12 | |
| 13 | - if (SmrSession::$account_id == 0) |
|
| 14 | - create_error_offline('You need to logged in to post comments!'); |
|
| 13 | + if (SmrSession::$account_id == 0) { |
|
| 14 | + create_error_offline('You need to logged in to post comments!'); |
|
| 15 | + } |
|
| 15 | 16 | |
| 16 | - if (!isset($_GET['album_id']) || empty($_GET['album_id'])) |
|
| 17 | - create_error_offline('Which picture do you want comment?'); |
|
| 18 | - else |
|
| 19 | - $album_id = $_GET['album_id']; |
|
| 17 | + if (!isset($_GET['album_id']) || empty($_GET['album_id'])) { |
|
| 18 | + create_error_offline('Which picture do you want comment?'); |
|
| 19 | + } else { |
|
| 20 | + $album_id = $_GET['album_id']; |
|
| 21 | + } |
|
| 20 | 22 | |
| 21 | - if (!is_numeric($album_id)) |
|
| 22 | - create_error_offline('Picture ID has to be numeric!'); |
|
| 23 | + if (!is_numeric($album_id)) { |
|
| 24 | + create_error_offline('Picture ID has to be numeric!'); |
|
| 25 | + } |
|
| 23 | 26 | |
| 24 | - if ($album_id < 1) |
|
| 25 | - create_error_offline('Picture ID has to be positive!'); |
|
| 27 | + if ($album_id < 1) { |
|
| 28 | + create_error_offline('Picture ID has to be positive!'); |
|
| 29 | + } |
|
| 26 | 30 | |
| 27 | 31 | $account = SmrAccount::getAccount(SmrSession::$account_id); |
| 28 | 32 | |
| 29 | 33 | if (isset($_GET['action']) && $_GET['action'] == 'Moderate') { |
| 30 | - if(!$account->hasPermission(PERMISSION_MODERATE_PHOTO_ALBUM)) |
|
| 31 | - create_error_offline('You do not have permission to do that!'); |
|
| 34 | + if(!$account->hasPermission(PERMISSION_MODERATE_PHOTO_ALBUM)) { |
|
| 35 | + create_error_offline('You do not have permission to do that!'); |
|
| 36 | + } |
|
| 32 | 37 | $container = create_container('skeleton.php', 'album_moderate.php'); |
| 33 | 38 | $container['account_id'] = $album_id; |
| 34 | 39 | |
@@ -37,10 +42,11 @@ discard block |
||
| 37 | 42 | |
| 38 | 43 | $db = new SmrMySqlDatabase(); |
| 39 | 44 | |
| 40 | - if (!isset($_GET['comment']) || empty($_GET['comment'])) |
|
| 41 | - create_error_offline('Please enter a comment.'); |
|
| 42 | - else |
|
| 43 | - $comment = $_GET['comment']; |
|
| 45 | + if (!isset($_GET['comment']) || empty($_GET['comment'])) { |
|
| 46 | + create_error_offline('Please enter a comment.'); |
|
| 47 | + } else { |
|
| 48 | + $comment = $_GET['comment']; |
|
| 49 | + } |
|
| 44 | 50 | |
| 45 | 51 | // get current time |
| 46 | 52 | $curr_time = TIME; |
@@ -52,10 +58,11 @@ discard block |
||
| 52 | 58 | $db->lockTable('album_has_comments'); |
| 53 | 59 | |
| 54 | 60 | $db->query('SELECT MAX(comment_id) FROM album_has_comments WHERE album_id = '.$db->escapeNumber($album_id)); |
| 55 | - if ($db->nextRecord()) |
|
| 56 | - $comment_id = $db->getField('MAX(comment_id)') + 1; |
|
| 57 | - else |
|
| 58 | - $comment_id = 1; |
|
| 61 | + if ($db->nextRecord()) { |
|
| 62 | + $comment_id = $db->getField('MAX(comment_id)') + 1; |
|
| 63 | + } else { |
|
| 64 | + $comment_id = 1; |
|
| 65 | + } |
|
| 59 | 66 | |
| 60 | 67 | $db->query('INSERT INTO album_has_comments |
| 61 | 68 | (album_id, comment_id, time, post_id, msg) |
@@ -64,7 +71,6 @@ discard block |
||
| 64 | 71 | |
| 65 | 72 | header('Location: /album/?' . get_album_nick($album_id)); |
| 66 | 73 | exit; |
| 67 | -} |
|
| 68 | -catch(Throwable $e) { |
|
| 74 | +} catch(Throwable $e) { |
|
| 69 | 75 | handleException($e); |
| 70 | 76 | } |
@@ -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 | } |
@@ -37,8 +37,7 @@ discard block |
||
| 37 | 37 | header('location: /error.php?msg=Invalid sector ID'); |
| 38 | 38 | exit; |
| 39 | 39 | } |
| 40 | - } |
|
| 41 | - else if(isset($_REQUEST['galaxy_id'])) { |
|
| 40 | + } else if(isset($_REQUEST['galaxy_id'])) { |
|
| 42 | 41 | $galaxyID = $_REQUEST['galaxy_id']; |
| 43 | 42 | if(!is_numeric($galaxyID)) { |
| 44 | 43 | header('location: /error.php?msg=Galaxy ID was not a number.'); |
@@ -46,8 +45,7 @@ discard block |
||
| 46 | 45 | } |
| 47 | 46 | try { |
| 48 | 47 | $galaxy = SmrGalaxy::getGalaxy(SmrSession::getGameID(), $galaxyID); |
| 49 | - } |
|
| 50 | - catch(Exception $e) { |
|
| 48 | + } catch(Exception $e) { |
|
| 51 | 49 | header('location: /error.php?msg=Invalid galaxy ID'); |
| 52 | 50 | exit; |
| 53 | 51 | } |
@@ -96,8 +94,9 @@ discard block |
||
| 96 | 94 | $template->unassign('Title'); |
| 97 | 95 | $template->assign('Title', 'Galaxy Map'); |
| 98 | 96 | |
| 99 | - if($account->getCssLink()!=null) |
|
| 100 | - $template->assign('ExtraCSSLink',$account->getCssLink()); |
|
| 97 | + if($account->getCssLink()!=null) { |
|
| 98 | + $template->assign('ExtraCSSLink',$account->getCssLink()); |
|
| 99 | + } |
|
| 101 | 100 | $template->assign('CSSLink', $account->getCssUrl()); |
| 102 | 101 | $template->assign('CSSColourLink', $account->getCssColourUrl()); |
| 103 | 102 | $template->assign('FontSize', $account->getFontSize() - 20); |
@@ -113,7 +112,6 @@ discard block |
||
| 113 | 112 | $template->assign('AJAX_ENABLE_REFRESH', false); |
| 114 | 113 | |
| 115 | 114 | $template->display('GalaxyMap.inc'); |
| 116 | -} |
|
| 117 | -catch(Throwable $e) { |
|
| 115 | +} catch(Throwable $e) { |
|
| 118 | 116 | handleException($e); |
| 119 | 117 | } |
@@ -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 | } |
@@ -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 | } |
@@ -42,8 +42,7 @@ discard block |
||
| 42 | 42 | $template->display('socialRegister.inc'); |
| 43 | 43 | exit; |
| 44 | 44 | } |
| 45 | - } |
|
| 46 | - else { |
|
| 45 | + } else { |
|
| 47 | 46 | $login = (isset($_REQUEST['login']) ? $_REQUEST['login'] : (isset($var['login']) ? $var['login'] : '')); |
| 48 | 47 | $password = (isset($_REQUEST['password']) ? $_REQUEST['password'] : (isset($var['password']) ? $var['password'] : '')); |
| 49 | 48 | |
@@ -57,8 +56,7 @@ discard block |
||
| 57 | 56 | $account = SmrAccount::getAccountByName($login); |
| 58 | 57 | if (is_object($account) && $account->checkPassword($password)) { |
| 59 | 58 | SmrSession::$account_id = $account->getAccountID(); |
| 60 | - } |
|
| 61 | - else { |
|
| 59 | + } else { |
|
| 62 | 60 | $msg = 'Password is incorrect!'; |
| 63 | 61 | header('Location: /login.php?msg=' . rawurlencode(htmlspecialchars($msg, ENT_QUOTES))); |
| 64 | 62 | exit; |
@@ -152,49 +150,71 @@ discard block |
||
| 152 | 150 | //convert to array |
| 153 | 151 | $old = explode('-', $db->getField('array')); |
| 154 | 152 | //get rid of old version cookie since it isn't optimal. |
| 155 | - if ($old[0] != MULTI_CHECKING_COOKIE_VERSION) $old = array(); |
|
| 156 | - } else $old = array(); |
|
| 153 | + if ($old[0] != MULTI_CHECKING_COOKIE_VERSION) { |
|
| 154 | + $old = array(); |
|
| 155 | + } |
|
| 156 | + } else { |
|
| 157 | + $old = array(); |
|
| 158 | + } |
|
| 157 | 159 | $old[0] = MULTI_CHECKING_COOKIE_VERSION; |
| 158 | - if (!in_array($account->getAccountID(), $old)) $old[] = $account->getAccountID(); |
|
| 159 | - if (sizeof($old) <= 2) $use = 'FALSE'; |
|
| 160 | - else $use = 'TRUE'; |
|
| 160 | + if (!in_array($account->getAccountID(), $old)) { |
|
| 161 | + $old[] = $account->getAccountID(); |
|
| 162 | + } |
|
| 163 | + if (sizeof($old) <= 2) { |
|
| 164 | + $use = 'FALSE'; |
|
| 165 | + } else { |
|
| 166 | + $use = 'TRUE'; |
|
| 167 | + } |
|
| 161 | 168 | //check that each value is legit and add it to db string |
| 162 | 169 | $new = MULTI_CHECKING_COOKIE_VERSION; |
| 163 | - foreach ($old as $accID) |
|
| 164 | - if (is_numeric($accID)) $new .= '-'.$accID; |
|
| 170 | + foreach ($old as $accID) { |
|
| 171 | + if (is_numeric($accID)) $new .= '-'.$accID; |
|
| 172 | + } |
|
| 165 | 173 | $db->query('REPLACE INTO multi_checking_cookie (account_id, array, `use`) VALUES ('.$db->escapeNumber($account->getAccountID()).', '.$db->escapeString($new).', '.$db->escapeString($use).')'); |
| 166 | 174 | //now we update their cookie with the newest info |
| 167 | 175 | setcookie('Session_Info', $new, TIME + 157680000); |
| 168 | 176 | |
| 169 | - } |
|
| 170 | - else { |
|
| 177 | + } else { |
|
| 171 | 178 | |
| 172 | 179 | //we have a cookie so we see if we add to it etc |
| 173 | 180 | //break cookie into array |
| 174 | 181 | $cookie = explode('-', $_COOKIE['Session_Info']); |
| 175 | 182 | //check for current version |
| 176 | - if ($cookie[0] != MULTI_CHECKING_COOKIE_VERSION) $cookie = array(); |
|
| 183 | + if ($cookie[0] != MULTI_CHECKING_COOKIE_VERSION) { |
|
| 184 | + $cookie = array(); |
|
| 185 | + } |
|
| 177 | 186 | $cookie[0] = MULTI_CHECKING_COOKIE_VERSION; |
| 178 | 187 | //add this acc to the cookie if it isn't there |
| 179 | - if (!in_array($account->getAccountID(), $cookie)) $cookie[] = $account->getAccountID(); |
|
| 188 | + if (!in_array($account->getAccountID(), $cookie)) { |
|
| 189 | + $cookie[] = $account->getAccountID(); |
|
| 190 | + } |
|
| 180 | 191 | |
| 181 | 192 | $db->query('SELECT * FROM multi_checking_cookie WHERE account_id = '.$account->getAccountID()); |
| 182 | 193 | if ($db->nextRecord()) { |
| 183 | 194 | //convert to array |
| 184 | 195 | $old = explode('-', $db->getField('array')); |
| 185 | - if ($old[0] != MULTI_CHECKING_COOKIE_VERSION) $old = array(); |
|
| 186 | - } else $old = array(); |
|
| 196 | + if ($old[0] != MULTI_CHECKING_COOKIE_VERSION) { |
|
| 197 | + $old = array(); |
|
| 198 | + } |
|
| 199 | + } else { |
|
| 200 | + $old = array(); |
|
| 201 | + } |
|
| 187 | 202 | $old[0] = MULTI_CHECKING_COOKIE_VERSION; |
| 188 | 203 | //merge arrays...but keys are all different so we go through each value |
| 189 | - foreach ($cookie as $value) |
|
| 190 | - if (!in_array($value,$old)) $old[] = $value; |
|
| 204 | + foreach ($cookie as $value) { |
|
| 205 | + if (!in_array($value,$old)) $old[] = $value; |
|
| 206 | + } |
|
| 191 | 207 | |
| 192 | - if (sizeof($old) <= 2) $use = 'FALSE'; |
|
| 193 | - else $use = 'TRUE'; |
|
| 208 | + if (sizeof($old) <= 2) { |
|
| 209 | + $use = 'FALSE'; |
|
| 210 | + } else { |
|
| 211 | + $use = 'TRUE'; |
|
| 212 | + } |
|
| 194 | 213 | //check that each value is legit and add it to db string |
| 195 | 214 | $new = MULTI_CHECKING_COOKIE_VERSION; |
| 196 | - foreach ($old as $accID) |
|
| 197 | - if (is_numeric($accID)) $new .= '-'.$accID; |
|
| 215 | + foreach ($old as $accID) { |
|
| 216 | + if (is_numeric($accID)) $new .= '-'.$accID; |
|
| 217 | + } |
|
| 198 | 218 | $db->query('REPLACE INTO multi_checking_cookie (account_id, array, `use`) VALUES ('.$db->escapeNumber($account->getAccountID()).', '.$db->escapeString($new).', '.$db->escapeString($use).')'); |
| 199 | 219 | //update newest cookie |
| 200 | 220 | setcookie('Session_Info', $new, TIME + 157680000); |
@@ -215,7 +235,6 @@ discard block |
||
| 215 | 235 | |
| 216 | 236 | header('Location: '.$href); |
| 217 | 237 | exit; |
| 218 | -} |
|
| 219 | -catch(Throwable $e) { |
|
| 238 | +} catch(Throwable $e) { |
|
| 220 | 239 | handleException($e); |
| 221 | 240 | } |
@@ -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')); |
@@ -116,11 +116,9 @@ discard block |
||
| 116 | 116 | echo ('<body>'); |
| 117 | 117 | if (empty($seq)) { |
| 118 | 118 | $seq = 'ASC'; |
| 119 | - } |
|
| 120 | - elseif ($seq == 'ASC') { |
|
| 119 | + } elseif ($seq == 'ASC') { |
|
| 121 | 120 | $seq = 'DESC'; |
| 122 | - } |
|
| 123 | - else { |
|
| 121 | + } else { |
|
| 124 | 122 | $seq = 'ASC'; |
| 125 | 123 | } |
| 126 | 124 | |
@@ -128,8 +126,7 @@ discard block |
||
| 128 | 126 | |
| 129 | 127 | if (!empty($order) && in_array($order,$allowedOrders)) { |
| 130 | 128 | $order_by = $order .' '. $seq; |
| 131 | - } |
|
| 132 | - else { |
|
| 129 | + } else { |
|
| 133 | 130 | $order_by = 'ship_type.ship_type_id'; |
| 134 | 131 | } |
| 135 | 132 | |
@@ -155,8 +152,7 @@ discard block |
||
| 155 | 152 | $shipArray[] = buildShipStats($db2); |
| 156 | 153 | } |
| 157 | 154 | } |
| 158 | - } |
|
| 159 | - else { |
|
| 155 | + } else { |
|
| 160 | 156 | $db->query('SELECT * |
| 161 | 157 | FROM ship_type |
| 162 | 158 | JOIN ship_type_support_hardware USING(ship_type_id) |
@@ -216,8 +212,7 @@ discard block |
||
| 216 | 212 | echo ('</tr>'); |
| 217 | 213 | } ?> |
| 218 | 214 | </table></div></div><?php |
| 219 | -} |
|
| 220 | -catch(Throwable $e) { |
|
| 215 | +} catch(Throwable $e) { |
|
| 221 | 216 | handleException($e); |
| 222 | 217 | } |
| 223 | 218 | |
@@ -270,12 +265,13 @@ discard block |
||
| 270 | 265 | $stat[] = number_format($db->getInt('cost')); |
| 271 | 266 | $stat[] = $db->getInt('speed'); |
| 272 | 267 | $stat[] = $db->getInt('hardpoint'); |
| 273 | - if ($db->getField('buyer_restriction') == BUYER_RESTRICTION_GOOD) |
|
| 274 | - $restriction = '<font color="green">Good</font>'; |
|
| 275 | - elseif ($db->getField('buyer_restriction') == BUYER_RESTRICTION_EVIL) |
|
| 276 | - $restriction = '<font color="red">Evil</font>'; |
|
| 277 | - else |
|
| 278 | - $restriction = ''; |
|
| 268 | + if ($db->getField('buyer_restriction') == BUYER_RESTRICTION_GOOD) { |
|
| 269 | + $restriction = '<font color="green">Good</font>'; |
|
| 270 | + } elseif ($db->getField('buyer_restriction') == BUYER_RESTRICTION_EVIL) { |
|
| 271 | + $restriction = '<font color="red">Evil</font>'; |
|
| 272 | + } else { |
|
| 273 | + $restriction = ''; |
|
| 274 | + } |
|
| 279 | 275 | $stat[] = $restriction; |
| 280 | 276 | // $stat[] = $db->getInt('lvl_needed'); |
| 281 | 277 | $stat[] = number_format($db->getInt('max_amount')); |
@@ -285,12 +281,13 @@ discard block |
||
| 285 | 281 | { |
| 286 | 282 | if($db->nextRecord()) |
| 287 | 283 | { |
| 288 | - if ($hardware_id < 7) |
|
| 289 | - $stat[] = number_format($db->getInt('max_amount')); |
|
| 290 | - elseif ($db->getInt('max_amount') == 1) |
|
| 291 | - $stat[] = 'Yes'; |
|
| 292 | - else |
|
| 293 | - $stat[] = ''; |
|
| 284 | + if ($hardware_id < 7) { |
|
| 285 | + $stat[] = number_format($db->getInt('max_amount')); |
|
| 286 | + } elseif ($db->getInt('max_amount') == 1) { |
|
| 287 | + $stat[] = 'Yes'; |
|
| 288 | + } else { |
|
| 289 | + $stat[] = ''; |
|
| 290 | + } |
|
| 294 | 291 | } |
| 295 | 292 | $hardware_id++; |
| 296 | 293 | } |
@@ -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 | } |
@@ -37,7 +37,6 @@ |
||
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | header('Location: /login.php'); |
| 40 | -} |
|
| 41 | -catch(Throwable $e) { |
|
| 40 | +} catch(Throwable $e) { |
|
| 42 | 41 | handleException($e); |
| 43 | 42 | } |
@@ -27,6 +27,6 @@ |
||
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | } |
| 30 | -catch(Throwable $e) { |
|
| 30 | +catch (Throwable $e) { |
|
| 31 | 31 | handleException($e); |
| 32 | 32 | } |
@@ -26,7 +26,6 @@ |
||
| 26 | 26 | exit; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | -} |
|
| 30 | -catch(Throwable $e) { |
|
| 29 | +} catch(Throwable $e) { |
|
| 31 | 30 | handleException($e); |
| 32 | 31 | } |
@@ -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 | ?> |
@@ -46,8 +46,7 @@ |
||
| 46 | 46 | 'links' => $links, |
| 47 | 47 | ]); |
| 48 | 48 | |
| 49 | -} |
|
| 50 | -catch(Throwable $e) { |
|
| 49 | +} catch(Throwable $e) { |
|
| 51 | 50 | handleException($e); |
| 52 | 51 | } |
| 53 | 52 | ?> |
@@ -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 = ''; |
@@ -25,10 +25,11 @@ discard block |
||
| 25 | 25 | 'USING_AJAX: '.(defined('USING_AJAX')?var_export(USING_AJAX,true):'undefined'); |
| 26 | 26 | |
| 27 | 27 | try { |
| 28 | - if(function_exists('release_lock')) |
|
| 29 | - release_lock(); //Try to release lock so they can carry on normally |
|
| 30 | - } |
|
| 31 | - catch(Throwable $ee) { |
|
| 28 | + if(function_exists('release_lock')) { |
|
| 29 | + release_lock(); |
|
| 30 | + } |
|
| 31 | + //Try to release lock so they can carry on normally |
|
| 32 | + } catch(Throwable $ee) { |
|
| 32 | 33 | $message .= EOL.EOL.'-----------'.EOL.EOL. |
| 33 | 34 | 'Releasing Lock Failed' .EOL. |
| 34 | 35 | 'Message: ' . $ee .EOL.EOL; |
@@ -90,8 +91,9 @@ discard block |
||
| 90 | 91 | |
| 91 | 92 | // If this is an ajax update, we don't really have a way to redirect |
| 92 | 93 | // 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)); |
|
| 94 | + if(!defined('USING_AJAX')||!USING_AJAX) { |
|
| 95 | + header('location: /error.php?msg='.urlencode($errorType)); |
|
| 96 | + } |
|
| 95 | 97 | exit; |
| 96 | 98 | } |
| 97 | 99 | |