We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | // get this user from db |
| 13 | 13 | $account = SmrAccount::getAccountByEmail($_REQUEST['email']); |
| 14 | - if ($account==null) { |
|
| 14 | + if ($account == null) { |
|
| 15 | 15 | // unknown user |
| 16 | 16 | header('Location: /error.php?msg=' . rawurlencode('The specified e-mail address is not registered!')); |
| 17 | 17 | exit; |
@@ -19,13 +19,13 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | $account->generatePasswordReset(); |
| 21 | 21 | |
| 22 | - $resetURL = URL.'/reset_password.php?login='.$account->getLogin().'&resetcode='.$account->getPasswordReset(); |
|
| 22 | + $resetURL = URL . '/reset_password.php?login=' . $account->getLogin() . '&resetcode=' . $account->getPasswordReset(); |
|
| 23 | 23 | $emailMessage = |
| 24 | - 'A user from ' . getIpAddress() . ' requested to reset your password!'.EOL.EOL. |
|
| 25 | - ' Your game login is: ' . $account->getLogin().EOL. |
|
| 26 | - ' Your password reset code is: ' . $account->getPasswordReset().EOL.EOL. |
|
| 27 | - ' You can use this url: '.$resetURL .EOL.EOL. |
|
| 28 | - 'The Space Merchant Realms server is on the web at '.URL.'/'; |
|
| 24 | + 'A user from ' . getIpAddress() . ' requested to reset your password!' . EOL . EOL . |
|
| 25 | + ' Your game login is: ' . $account->getLogin() . EOL . |
|
| 26 | + ' Your password reset code is: ' . $account->getPasswordReset() . EOL . EOL . |
|
| 27 | + ' You can use this url: ' . $resetURL . EOL . EOL . |
|
| 28 | + 'The Space Merchant Realms server is on the web at ' . URL . '/'; |
|
| 29 | 29 | |
| 30 | 30 | // send email with password to user |
| 31 | 31 | $mail = setupMailer(); |
@@ -39,6 +39,6 @@ discard block |
||
| 39 | 39 | exit; |
| 40 | 40 | |
| 41 | 41 | } |
| 42 | -catch(Throwable $e) { |
|
| 42 | +catch (Throwable $e) { |
|
| 43 | 43 | handleException($e); |
| 44 | 44 | } |
@@ -38,7 +38,6 @@ |
||
| 38 | 38 | header('Location: /reset_password.php'); |
| 39 | 39 | exit; |
| 40 | 40 | |
| 41 | -} |
|
| 42 | -catch(Throwable $e) { |
|
| 41 | +} catch(Throwable $e) { |
|
| 43 | 42 | handleException($e); |
| 44 | 43 | } |
@@ -115,18 +115,20 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | echo ('<body onload="resetBoxes()">'); |
| 117 | 117 | $seq = isset($_REQUEST['seq']) ? $_REQUEST['seq'] : ''; |
| 118 | - if (empty($seq)) |
|
| 119 | - $seq = 'ASC'; |
|
| 120 | - elseif ($seq == 'ASC') |
|
| 121 | - $seq = 'DESC'; |
|
| 122 | - else |
|
| 123 | - $seq = 'ASC'; |
|
| 118 | + if (empty($seq)) { |
|
| 119 | + $seq = 'ASC'; |
|
| 120 | + } elseif ($seq == 'ASC') { |
|
| 121 | + $seq = 'DESC'; |
|
| 122 | + } else { |
|
| 123 | + $seq = 'ASC'; |
|
| 124 | + } |
|
| 124 | 125 | |
| 125 | 126 | $columnNames = array('weapon_name','race_name','cost','shield_damage','armour_damage','accuracy','power_level','buyer_restriction'); |
| 126 | - if (isset($_REQUEST['order'])&&in_array($_REQUEST['order'],$columnNames)) |
|
| 127 | - $order_by = $_REQUEST['order']; |
|
| 128 | - else |
|
| 129 | - $order_by = 'weapon_type_id'; |
|
| 127 | + if (isset($_REQUEST['order'])&&in_array($_REQUEST['order'],$columnNames)) { |
|
| 128 | + $order_by = $_REQUEST['order']; |
|
| 129 | + } else { |
|
| 130 | + $order_by = 'weapon_type_id'; |
|
| 131 | + } |
|
| 130 | 132 | |
| 131 | 133 | //$race = buildSelector($db, "racePick", "race_name", "race"); |
| 132 | 134 | $race = ""; |
@@ -182,8 +184,7 @@ discard block |
||
| 182 | 184 | |
| 183 | 185 | |
| 184 | 186 | |
| 185 | -} |
|
| 186 | -catch(Throwable $e) { |
|
| 187 | +} catch(Throwable $e) { |
|
| 187 | 188 | handleException($e); |
| 188 | 189 | } |
| 189 | 190 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | echo ('<link rel="stylesheet" type="text/css" href="css/Default.css">'); |
| 12 | 12 | echo ('<link rel="stylesheet" type="text/css" href="css/Default/Default.css">'); |
| 13 | 13 | echo ('<title>Weapon List</title>'); |
| 14 | - echo ('<meta http-equiv="pragma" content="no-cache">');?> |
|
| 14 | + echo ('<meta http-equiv="pragma" content="no-cache">'); ?> |
|
| 15 | 15 | <style> |
| 16 | 16 | #container { |
| 17 | 17 | margin: 0; |
@@ -44,42 +44,42 @@ discard block |
||
| 44 | 44 | else |
| 45 | 45 | $seq = 'ASC'; |
| 46 | 46 | |
| 47 | - $columnNames = array('weapon_name','race_name','cost','shield_damage','armour_damage','accuracy','power_level','buyer_restriction'); |
|
| 48 | - if (isset($_REQUEST['order'])&&in_array($_REQUEST['order'],$columnNames)) |
|
| 47 | + $columnNames = array('weapon_name', 'race_name', 'cost', 'shield_damage', 'armour_damage', 'accuracy', 'power_level', 'buyer_restriction'); |
|
| 48 | + if (isset($_REQUEST['order']) && in_array($_REQUEST['order'], $columnNames)) |
|
| 49 | 49 | $order_by = $_REQUEST['order']; |
| 50 | 50 | else |
| 51 | 51 | $order_by = 'weapon_type_id'; |
| 52 | 52 | |
| 53 | 53 | //$race = buildSelector($db, "racePick", "race_name", "race"); |
| 54 | 54 | $race = ""; |
| 55 | - $power = buildSelector($db, "powerPick", "power_level", "weapon_type"); |
|
| 56 | - $restrict = buildRestriction(); |
|
| 55 | + $power = buildSelector($db, "powerPick", "power_level", "weapon_type"); |
|
| 56 | + $restrict = buildRestriction(); |
|
| 57 | 57 | |
| 58 | 58 | echo ('<div id="container" style="padding: 0;">'); |
| 59 | 59 | echo ('<div id="main" style="width:810px; margin-left:auto; margin-right:auto;">'); |
| 60 | 60 | echo (buildRaceBox($db)); |
| 61 | - $db->query('SELECT * FROM weapon_type JOIN race USING(race_id) ORDER BY '.$order_by.' '.$seq); |
|
| 61 | + $db->query('SELECT * FROM weapon_type JOIN race USING(race_id) ORDER BY ' . $order_by . ' ' . $seq); |
|
| 62 | 62 | echo ('<table id="table" class="standard center">'); |
| 63 | 63 | echo ('<tr>'); |
| 64 | - echo ('<th style="width: 240px;"><a href="?order=weapon_name&seq='.$seq.'"><span style=color:#80C870;>Weapon Name</span></a></th>'); |
|
| 65 | - echo ('<th style="width: 90px;"><a href="?order=race_name&seq='.$seq.'"><span style=color:#80C870;>Race</span></a>'.$race.'</th>'); |
|
| 66 | - echo ('<th style="width: 64px;"><a href="?order=cost&seq='.$seq.'"><span style=color:#80C870;>Cost</span></a></th>'); |
|
| 67 | - echo ('<th style="width: 74px;"><a href="?order=shield_damage&seq='.$seq.'"><span style=color:#80C870;>Shield<br>Damage</span></a></th>'); |
|
| 68 | - echo ('<th style="width: 74px;"><a href="?order=armour_damage&seq='.$seq.'"><span style=color:#80C870;>Armour<br>Damage</span></a></th>'); |
|
| 69 | - echo ('<th style="width: 85px;"><a href="?order=accuracy&seq='.$seq.'"><span style=color:#80C870;>Accuracy<br>%</span></a></th>'); |
|
| 70 | - echo ('<th style="width: 51px;"><a href="?order=power_level&seq='.$seq.'"><span style=color:#80C870;>Level</span></a>'.$power.'</th>'); |
|
| 71 | - echo ('<th style="width: 92px;"><a href="?order=buyer_restriction&seq='.$seq.'"><span style=color:#80C870;>Restriction</span></a>'.$restrict.'</th>'); |
|
| 64 | + echo ('<th style="width: 240px;"><a href="?order=weapon_name&seq=' . $seq . '"><span style=color:#80C870;>Weapon Name</span></a></th>'); |
|
| 65 | + echo ('<th style="width: 90px;"><a href="?order=race_name&seq=' . $seq . '"><span style=color:#80C870;>Race</span></a>' . $race . '</th>'); |
|
| 66 | + echo ('<th style="width: 64px;"><a href="?order=cost&seq=' . $seq . '"><span style=color:#80C870;>Cost</span></a></th>'); |
|
| 67 | + echo ('<th style="width: 74px;"><a href="?order=shield_damage&seq=' . $seq . '"><span style=color:#80C870;>Shield<br>Damage</span></a></th>'); |
|
| 68 | + echo ('<th style="width: 74px;"><a href="?order=armour_damage&seq=' . $seq . '"><span style=color:#80C870;>Armour<br>Damage</span></a></th>'); |
|
| 69 | + echo ('<th style="width: 85px;"><a href="?order=accuracy&seq=' . $seq . '"><span style=color:#80C870;>Accuracy<br>%</span></a></th>'); |
|
| 70 | + echo ('<th style="width: 51px;"><a href="?order=power_level&seq=' . $seq . '"><span style=color:#80C870;>Level</span></a>' . $power . '</th>'); |
|
| 71 | + echo ('<th style="width: 92px;"><a href="?order=buyer_restriction&seq=' . $seq . '"><span style=color:#80C870;>Restriction</span></a>' . $restrict . '</th>'); |
|
| 72 | 72 | echo ('</tr>'); |
| 73 | 73 | while ($db->nextRecord()) { |
| 74 | 74 | echo ('<tr>'); |
| 75 | - echo ('<td>'.$db->getField('weapon_name').'</td>'); |
|
| 76 | - echo ('<td class="race'.$db->getInt('race_id').'">'.$db->getField('race_name').'</td>'); |
|
| 77 | - echo ('<td>'.number_format($db->getInt('cost')).'</td>'); |
|
| 78 | - echo ('<td>'.$db->getInt('shield_damage').'</td>'); |
|
| 79 | - echo ('<td>'.$db->getInt('armour_damage').'</td>'); |
|
| 80 | - echo ('<td>'.$db->getInt('accuracy').'</td>'); |
|
| 81 | - echo ('<td>'.$db->getInt('power_level').'</td>'); |
|
| 82 | - switch($db->getInt('buyer_restriction')) { |
|
| 75 | + echo ('<td>' . $db->getField('weapon_name') . '</td>'); |
|
| 76 | + echo ('<td class="race' . $db->getInt('race_id') . '">' . $db->getField('race_name') . '</td>'); |
|
| 77 | + echo ('<td>' . number_format($db->getInt('cost')) . '</td>'); |
|
| 78 | + echo ('<td>' . $db->getInt('shield_damage') . '</td>'); |
|
| 79 | + echo ('<td>' . $db->getInt('armour_damage') . '</td>'); |
|
| 80 | + echo ('<td>' . $db->getInt('accuracy') . '</td>'); |
|
| 81 | + echo ('<td>' . $db->getInt('power_level') . '</td>'); |
|
| 82 | + switch ($db->getInt('buyer_restriction')) { |
|
| 83 | 83 | case BUYER_RESTRICTION_GOOD: |
| 84 | 84 | echo ('<td style="color: green;">Good</td>'); |
| 85 | 85 | break; |
@@ -105,16 +105,16 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | |
| 107 | 107 | } |
| 108 | -catch(Throwable $e) { |
|
| 108 | +catch (Throwable $e) { |
|
| 109 | 109 | handleException($e); |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | function buildSelector($db, $id, $name, $table) { |
| 113 | - $selector = '<br><select id="'.$id.'" name="'.$name.'" onchange="'.$id.'f()"><option value="All">All</option>'; |
|
| 114 | - $db->query("SELECT DISTINCT ".$name." FROM ".$table." ORDER BY ".$name); |
|
| 113 | + $selector = '<br><select id="' . $id . '" name="' . $name . '" onchange="' . $id . 'f()"><option value="All">All</option>'; |
|
| 114 | + $db->query("SELECT DISTINCT " . $name . " FROM " . $table . " ORDER BY " . $name); |
|
| 115 | 115 | while ($db->nextRecord()) { |
| 116 | - $selector .= '<option value="'.$db->getField($name).'">' |
|
| 117 | - .$db->getField($name).'</option>'; |
|
| 116 | + $selector .= '<option value="' . $db->getField($name) . '">' |
|
| 117 | + .$db->getField($name) . '</option>'; |
|
| 118 | 118 | } |
| 119 | 119 | $selector .= '</select>'; |
| 120 | 120 | return $selector; |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | $raceID = $db->getInt('race_id'); |
| 141 | 141 | $raceName = $db->getField('race_name'); |
| 142 | 142 | $racebox .= ' |
| 143 | - <input type="checkbox" id="race'.$raceID.'" name="races" value="'.$raceName.'" onClick="raceToggle()"> |
|
| 144 | - <label for="race'.$raceID.'" class="race'.$raceID.'">'.$raceName.'</label>'; |
|
| 143 | + <input type="checkbox" id="race'.$raceID . '" name="races" value="' . $raceName . '" onClick="raceToggle()"> |
|
| 144 | + <label for="race'.$raceID . '" class="race' . $raceID . '">' . $raceName . '</label>'; |
|
| 145 | 145 | } |
| 146 | 146 | $racebox .= '</form>'; |
| 147 | 147 | return $racebox; |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | } ?> |
| 31 | 31 | </table><?php |
| 32 | 32 | } |
| 33 | -catch(Throwable $e) { |
|
| 33 | +catch (Throwable $e) { |
|
| 34 | 34 | handleException($e); |
| 35 | 35 | } |
| 36 | 36 | ?> |
@@ -29,8 +29,7 @@ |
||
| 29 | 29 | </tr><?php |
| 30 | 30 | } ?> |
| 31 | 31 | </table><?php |
| 32 | -} |
|
| 33 | -catch(Throwable $e) { |
|
| 32 | +} catch(Throwable $e) { |
|
| 34 | 33 | handleException($e); |
| 35 | 34 | } |
| 36 | 35 | ?> |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | require_once(ENGINE . 'Default/help.inc'); |
| 6 | 6 | |
| 7 | 7 | $topic_id = $_SERVER['QUERY_STRING']; |
| 8 | - if (empty($topic_id)||!is_numeric($topic_id)) |
|
| 8 | + if (empty($topic_id) || !is_numeric($topic_id)) |
|
| 9 | 9 | $topic_id = 1; |
| 10 | 10 | ?> |
| 11 | 11 | <!DOCTYPE html> |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | </body> |
| 50 | 50 | </html><?php |
| 51 | 51 | } |
| 52 | -catch(Throwable $e) { |
|
| 52 | +catch (Throwable $e) { |
|
| 53 | 53 | handleException($e); |
| 54 | 54 | } |
| 55 | 55 | ?> |
@@ -5,8 +5,9 @@ discard block |
||
| 5 | 5 | require_once(ENGINE . 'Default/help.inc'); |
| 6 | 6 | |
| 7 | 7 | $topic_id = $_SERVER['QUERY_STRING']; |
| 8 | - if (empty($topic_id)||!is_numeric($topic_id)) |
|
| 9 | - $topic_id = 1; |
|
| 8 | + if (empty($topic_id)||!is_numeric($topic_id)) { |
|
| 9 | + $topic_id = 1; |
|
| 10 | + } |
|
| 10 | 11 | ?> |
| 11 | 12 | <!DOCTYPE html> |
| 12 | 13 | |
@@ -48,8 +49,7 @@ discard block |
||
| 48 | 49 | |
| 49 | 50 | </body> |
| 50 | 51 | </html><?php |
| 51 | -} |
|
| 52 | -catch(Throwable $e) { |
|
| 52 | +} catch(Throwable $e) { |
|
| 53 | 53 | handleException($e); |
| 54 | 54 | } |
| 55 | 55 | ?> |
@@ -148,8 +148,7 @@ discard block |
||
| 148 | 148 | // creates a new user account object |
| 149 | 149 | try { |
| 150 | 150 | $account = SmrAccount::createAccount($login, $password, $email, $timez, $referral); |
| 151 | - } |
|
| 152 | - catch(AccountNotFoundException $e) { |
|
| 151 | + } catch(AccountNotFoundException $e) { |
|
| 153 | 152 | $msg = 'Invalid referral account ID!'; |
| 154 | 153 | header('Location: /error.php?msg=' . rawurlencode(htmlspecialchars($msg, ENT_QUOTES))); |
| 155 | 154 | exit; |
@@ -192,7 +191,6 @@ discard block |
||
| 192 | 191 | $container['login'] = $login; |
| 193 | 192 | $container['password'] = $password; |
| 194 | 193 | forwardURL($container); |
| 195 | -} |
|
| 196 | -catch(Throwable $e) { |
|
| 194 | +} catch(Throwable $e) { |
|
| 197 | 195 | handleException($e); |
| 198 | 196 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | $account->increaseSmrRewardCredits(2 * CREDITS_PER_DOLLAR); // Give $2 worth of "reward" credits for joining. |
| 158 | 158 | if($socialLogin) { |
| 159 | 159 | $account->addAuthMethod($_SESSION['socialLogin']->getLoginType(), |
| 160 | - $_SESSION['socialLogin']->getUserID()); |
|
| 160 | + $_SESSION['socialLogin']->getUserID()); |
|
| 161 | 161 | if ($validatedBySocial) { |
| 162 | 162 | $account->setValidated(true); |
| 163 | 163 | } |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | |
| 186 | 186 | // remember when we sent validation code |
| 187 | 187 | $db->query('INSERT INTO notification (notification_type, account_id, time) ' . |
| 188 | - 'VALUES(\'validation_code\', '.$db->escapeNumber($account->getAccountID()).', ' . $db->escapeNumber(TIME) . ')'); |
|
| 188 | + 'VALUES(\'validation_code\', '.$db->escapeNumber($account->getAccountID()).', ' . $db->escapeNumber(TIME) . ')'); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | $container = create_container('login_processing.php'); |
@@ -10,9 +10,9 @@ discard block |
||
| 10 | 10 | exit; |
| 11 | 11 | } |
| 12 | 12 | $socialLogin = isset($_REQUEST['socialReg']); |
| 13 | - if($socialLogin) { |
|
| 13 | + if ($socialLogin) { |
|
| 14 | 14 | session_start(); |
| 15 | - if(!$_SESSION['socialLogin']) { |
|
| 15 | + if (!$_SESSION['socialLogin']) { |
|
| 16 | 16 | $msg = 'Tried a social registration without having a social session.'; |
| 17 | 17 | header('Location: /error.php?msg=' . rawurlencode(htmlspecialchars($msg, ENT_QUOTES))); |
| 18 | 18 | exit; |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | header('Location: /error.php?msg=' . rawurlencode(htmlspecialchars($msg, ENT_QUOTES))); |
| 51 | 51 | exit; |
| 52 | 52 | } |
| 53 | - if(strpos($login,'NPC')===0) { |
|
| 53 | + if (strpos($login, 'NPC') === 0) { |
|
| 54 | 54 | $msg = 'Login names cannot begin with "NPC".'; |
| 55 | 55 | header('Location: /error.php?msg=' . rawurlencode(htmlspecialchars($msg, ENT_QUOTES))); |
| 56 | 56 | exit; |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | // check if the host got a MX or at least an A entry |
| 111 | 111 | if (!checkdnsrr($host, 'MX') && !checkdnsrr($host, 'A')) { |
| 112 | - $msg = 'This is not a valid email address! The domain '.$host.' does not exist.'; |
|
| 112 | + $msg = 'This is not a valid email address! The domain ' . $host . ' does not exist.'; |
|
| 113 | 113 | header('Location: /error.php?msg=' . rawurlencode(htmlspecialchars($msg, ENT_QUOTES))); |
| 114 | 114 | exit; |
| 115 | 115 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | exit; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - $db->query('SELECT * FROM account WHERE login = '.$db->escapeString($login)); |
|
| 123 | + $db->query('SELECT * FROM account WHERE login = ' . $db->escapeString($login)); |
|
| 124 | 124 | if ($db->getNumRows() > 0) { |
| 125 | 125 | $msg = 'This user name is already registered.'; |
| 126 | 126 | header('Location: /error.php?msg=' . rawurlencode(htmlspecialchars($msg, ENT_QUOTES))); |
@@ -149,13 +149,13 @@ discard block |
||
| 149 | 149 | try { |
| 150 | 150 | $account = SmrAccount::createAccount($login, $password, $email, $timez, $referral); |
| 151 | 151 | } |
| 152 | - catch(AccountNotFoundException $e) { |
|
| 152 | + catch (AccountNotFoundException $e) { |
|
| 153 | 153 | $msg = 'Invalid referral account ID!'; |
| 154 | 154 | header('Location: /error.php?msg=' . rawurlencode(htmlspecialchars($msg, ENT_QUOTES))); |
| 155 | 155 | exit; |
| 156 | 156 | } |
| 157 | 157 | $account->increaseSmrRewardCredits(2 * CREDITS_PER_DOLLAR); // Give $2 worth of "reward" credits for joining. |
| 158 | - if($socialLogin) { |
|
| 158 | + if ($socialLogin) { |
|
| 159 | 159 | $account->addAuthMethod($_SESSION['socialLogin']->getLoginType(), |
| 160 | 160 | $_SESSION['socialLogin']->getUserID()); |
| 161 | 161 | if ($validatedBySocial) { |
@@ -173,8 +173,8 @@ discard block |
||
| 173 | 173 | if (!$account->isValidated()) { |
| 174 | 174 | // send email with validation code to user |
| 175 | 175 | $emailMessage = |
| 176 | - 'Your validation code is: '.$account->getValidationCode().EOL. |
|
| 177 | - 'The Space Merchant Realms server is on the web at '.URL; |
|
| 176 | + 'Your validation code is: ' . $account->getValidationCode() . EOL . |
|
| 177 | + 'The Space Merchant Realms server is on the web at ' . URL; |
|
| 178 | 178 | |
| 179 | 179 | $mail = setupMailer(); |
| 180 | 180 | $mail->Subject = 'New Space Merchant Realms Account'; |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | |
| 186 | 186 | // remember when we sent validation code |
| 187 | 187 | $db->query('INSERT INTO notification (notification_type, account_id, time) ' . |
| 188 | - 'VALUES(\'validation_code\', '.$db->escapeNumber($account->getAccountID()).', ' . $db->escapeNumber(TIME) . ')'); |
|
| 188 | + 'VALUES(\'validation_code\', ' . $db->escapeNumber($account->getAccountID()) . ', ' . $db->escapeNumber(TIME) . ')'); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | $container = create_container('login_processing.php'); |
@@ -193,6 +193,6 @@ discard block |
||
| 193 | 193 | $container['password'] = $password; |
| 194 | 194 | forwardURL($container); |
| 195 | 195 | } |
| 196 | -catch(Throwable $e) { |
|
| 196 | +catch (Throwable $e) { |
|
| 197 | 197 | handleException($e); |
| 198 | 198 | } |
@@ -69,7 +69,7 @@ |
||
| 69 | 69 | </body> |
| 70 | 70 | </html><?php |
| 71 | 71 | } |
| 72 | -catch(Throwable $e) { |
|
| 72 | +catch (Throwable $e) { |
|
| 73 | 73 | handleException($e); |
| 74 | 74 | } |
| 75 | 75 | ?> |
@@ -68,8 +68,7 @@ |
||
| 68 | 68 | |
| 69 | 69 | </body> |
| 70 | 70 | </html><?php |
| 71 | -} |
|
| 72 | -catch(Throwable $e) { |
|
| 71 | +} catch(Throwable $e) { |
|
| 73 | 72 | handleException($e); |
| 74 | 73 | } |
| 75 | 74 | ?> |
@@ -45,14 +45,14 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | $db->query('SELECT account_id as album_id |
| 47 | 47 | FROM album JOIN account USING(account_id) |
| 48 | - WHERE hof_name LIKE '.$db->escapeString($query.'%').' AND |
|
| 48 | + WHERE hof_name LIKE '.$db->escapeString($query . '%') . ' AND |
|
| 49 | 49 | approved = \'YES\' |
| 50 | 50 | ORDER BY hof_name'); |
| 51 | 51 | |
| 52 | 52 | if ($db->getNumRows() > 1) { |
| 53 | 53 | $db2->query('SELECT account_id as album_id |
| 54 | 54 | FROM album JOIN account USING(account_id) |
| 55 | - WHERE hof_name = '.$db->escapeString($query).' AND |
|
| 55 | + WHERE hof_name = '.$db->escapeString($query) . ' AND |
|
| 56 | 56 | approved = \'YES\' |
| 57 | 57 | ORDER BY hof_name'); |
| 58 | 58 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | else |
| 86 | 86 | main_page(); |
| 87 | 87 | } |
| 88 | -catch(Throwable $e) { |
|
| 88 | +catch (Throwable $e) { |
|
| 89 | 89 | handleException($e); |
| 90 | 90 | } |
| 91 | 91 | ?> |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | <tr> |
| 141 | 141 | <td class="left" style='font-size:65%;'> |
| 142 | - © 2002-<?php echo date('Y',TIME); ?> by <a href="<?php echo URL; ?>"><?php echo URL; ?></a><br /> |
|
| 142 | + © 2002-<?php echo date('Y', TIME); ?> by <a href="<?php echo URL; ?>"><?php echo URL; ?></a><br /> |
|
| 143 | 143 | Hosted by <a href='http://www.fem.tu-ilmenau.de/' target='fem'>FeM</a> |
| 144 | 144 | </td> |
| 145 | 145 | </tr> |
@@ -56,36 +56,37 @@ |
||
| 56 | 56 | approved = \'YES\' |
| 57 | 57 | ORDER BY hof_name'); |
| 58 | 58 | |
| 59 | - if ($db2->nextRecord()) |
|
| 60 | - album_entry($db2->getField('album_id')); |
|
| 61 | - else { |
|
| 59 | + if ($db2->nextRecord()) { |
|
| 60 | + album_entry($db2->getField('album_id')); |
|
| 61 | + } else { |
|
| 62 | 62 | // get all id's and build array |
| 63 | 63 | $album_ids = array(); |
| 64 | 64 | |
| 65 | - while ($db->nextRecord()) |
|
| 66 | - $album_ids[] = $db->getField('album_id'); |
|
| 65 | + while ($db->nextRecord()) { |
|
| 66 | + $album_ids[] = $db->getField('album_id'); |
|
| 67 | + } |
|
| 67 | 68 | |
| 68 | 69 | // double check if we have id's |
| 69 | - if (count($album_ids) > 0) |
|
| 70 | - search_result($album_ids); |
|
| 71 | - else |
|
| 72 | - main_page(); |
|
| 70 | + if (count($album_ids) > 0) { |
|
| 71 | + search_result($album_ids); |
|
| 72 | + } else { |
|
| 73 | + main_page(); |
|
| 74 | + } |
|
| 73 | 75 | } |
| 74 | 76 | |
| 77 | + } elseif ($db->getNumRows() == 1) { |
|
| 78 | + if ($db->nextRecord()) { |
|
| 79 | + album_entry($db->getField('album_id')); |
|
| 80 | + } else { |
|
| 81 | + main_page(); |
|
| 82 | + } |
|
| 83 | + } else { |
|
| 84 | + main_page(); |
|
| 75 | 85 | } |
| 76 | - elseif ($db->getNumRows() == 1) { |
|
| 77 | - if ($db->nextRecord()) |
|
| 78 | - album_entry($db->getField('album_id')); |
|
| 79 | - else |
|
| 80 | - main_page(); |
|
| 81 | - } |
|
| 82 | - else |
|
| 86 | + } else { |
|
| 83 | 87 | main_page(); |
| 84 | 88 | } |
| 85 | - else |
|
| 86 | - main_page(); |
|
| 87 | -} |
|
| 88 | -catch(Throwable $e) { |
|
| 89 | + } catch(Throwable $e) { |
|
| 89 | 90 | handleException($e); |
| 90 | 91 | } |
| 91 | 92 | ?> |
@@ -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::hasAccount()) { |
| 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; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | $_SESSION['socialLogin'] = $socialLogin; |
| 34 | 34 | $template = new Template(); |
| 35 | - $template->assign('SocialLogin',$socialLogin); |
|
| 35 | + $template->assign('SocialLogin', $socialLogin); |
|
| 36 | 36 | // Pre-populate the login field if an account with this email exists. |
| 37 | 37 | // (Also disable creating a new account because they would just get |
| 38 | 38 | // an "Email already registered" error anyway.) |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $account = SmrSession::getAccount(); |
| 82 | 82 | |
| 83 | 83 | // If linking a social login to an existing account |
| 84 | - if(isset($_REQUEST['social'])) { |
|
| 84 | + if (isset($_REQUEST['social'])) { |
|
| 85 | 85 | session_start(); |
| 86 | 86 | if (!isset($_SESSION['socialLogin'])) { |
| 87 | 87 | $msg = 'Tried a social login link without having a social session.'; |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | // ******************************** |
| 111 | 111 | |
| 112 | 112 | // get reason for disabled user |
| 113 | - if(($disabled = $account->isDisabled())!==false) { |
|
| 113 | + if (($disabled = $account->isDisabled()) !== false) { |
|
| 114 | 114 | // save session (incase we forward) |
| 115 | 115 | SmrSession::update(); |
| 116 | 116 | if (($disabled['Reason'] != CLOSE_ACCOUNT_INVALID_EMAIL_REASON) && |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | //now we set a cookie that we can use for mult checking |
| 149 | 149 | if (!isset($_COOKIE['Session_Info'])) { |
| 150 | 150 | //we get their info from db if they have any |
| 151 | - $db->query('SELECT * FROM multi_checking_cookie WHERE account_id = '.$account->getAccountID()); |
|
| 151 | + $db->query('SELECT * FROM multi_checking_cookie WHERE account_id = ' . $account->getAccountID()); |
|
| 152 | 152 | if ($db->nextRecord()) { |
| 153 | 153 | //convert to array |
| 154 | 154 | $old = explode('-', $db->getField('array')); |
@@ -162,8 +162,8 @@ discard block |
||
| 162 | 162 | //check that each value is legit and add it to db string |
| 163 | 163 | $new = MULTI_CHECKING_COOKIE_VERSION; |
| 164 | 164 | foreach ($old as $accID) |
| 165 | - if (is_numeric($accID)) $new .= '-'.$accID; |
|
| 166 | - $db->query('REPLACE INTO multi_checking_cookie (account_id, array, `use`) VALUES ('.$db->escapeNumber($account->getAccountID()).', '.$db->escapeString($new).', '.$db->escapeString($use).')'); |
|
| 165 | + if (is_numeric($accID)) $new .= '-' . $accID; |
|
| 166 | + $db->query('REPLACE INTO multi_checking_cookie (account_id, array, `use`) VALUES (' . $db->escapeNumber($account->getAccountID()) . ', ' . $db->escapeString($new) . ', ' . $db->escapeString($use) . ')'); |
|
| 167 | 167 | //now we update their cookie with the newest info |
| 168 | 168 | setcookie('Session_Info', $new, TIME + 157680000); |
| 169 | 169 | |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | //add this acc to the cookie if it isn't there |
| 180 | 180 | if (!in_array($account->getAccountID(), $cookie)) $cookie[] = $account->getAccountID(); |
| 181 | 181 | |
| 182 | - $db->query('SELECT * FROM multi_checking_cookie WHERE account_id = '.$account->getAccountID()); |
|
| 182 | + $db->query('SELECT * FROM multi_checking_cookie WHERE account_id = ' . $account->getAccountID()); |
|
| 183 | 183 | if ($db->nextRecord()) { |
| 184 | 184 | //convert to array |
| 185 | 185 | $old = explode('-', $db->getField('array')); |
@@ -188,35 +188,35 @@ discard block |
||
| 188 | 188 | $old[0] = MULTI_CHECKING_COOKIE_VERSION; |
| 189 | 189 | //merge arrays...but keys are all different so we go through each value |
| 190 | 190 | foreach ($cookie as $value) |
| 191 | - if (!in_array($value,$old)) $old[] = $value; |
|
| 191 | + if (!in_array($value, $old)) $old[] = $value; |
|
| 192 | 192 | |
| 193 | 193 | if (sizeof($old) <= 2) $use = 'FALSE'; |
| 194 | 194 | else $use = 'TRUE'; |
| 195 | 195 | //check that each value is legit and add it to db string |
| 196 | 196 | $new = MULTI_CHECKING_COOKIE_VERSION; |
| 197 | 197 | foreach ($old as $accID) |
| 198 | - if (is_numeric($accID)) $new .= '-'.$accID; |
|
| 199 | - $db->query('REPLACE INTO multi_checking_cookie (account_id, array, `use`) VALUES ('.$db->escapeNumber($account->getAccountID()).', '.$db->escapeString($new).', '.$db->escapeString($use).')'); |
|
| 198 | + if (is_numeric($accID)) $new .= '-' . $accID; |
|
| 199 | + $db->query('REPLACE INTO multi_checking_cookie (account_id, array, `use`) VALUES (' . $db->escapeNumber($account->getAccountID()) . ', ' . $db->escapeString($new) . ', ' . $db->escapeString($use) . ')'); |
|
| 200 | 200 | //update newest cookie |
| 201 | 201 | setcookie('Session_Info', $new, TIME + 157680000); |
| 202 | 202 | |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | //get rid of expired messages |
| 206 | - $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 | + $db2->query('UPDATE message SET receiver_delete = \'TRUE\', sender_delete = \'TRUE\', expire_time = 0 WHERE expire_time < ' . $db->escapeNumber(TIME) . ' AND expire_time != 0'); |
|
| 207 | 207 | // Mark message as read if it was sent to self as a mass mail. |
| 208 | 208 | $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)) . ');'); |
| 209 | 209 | //check to see if we need to remove player_has_unread |
| 210 | 210 | $db2 = new SmrMySqlDatabase(); |
| 211 | - $db2->query('DELETE FROM player_has_unread_messages WHERE account_id = '.$db->escapeNumber($account->getAccountID())); |
|
| 211 | + $db2->query('DELETE FROM player_has_unread_messages WHERE account_id = ' . $db->escapeNumber($account->getAccountID())); |
|
| 212 | 212 | $db2->query(' |
| 213 | 213 | INSERT INTO player_has_unread_messages (game_id, account_id, message_type_id) |
| 214 | 214 | 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) |
| 215 | 215 | ); |
| 216 | 216 | |
| 217 | - header('Location: '.$href); |
|
| 217 | + header('Location: ' . $href); |
|
| 218 | 218 | exit; |
| 219 | 219 | } |
| 220 | -catch(Throwable $e) { |
|
| 220 | +catch (Throwable $e) { |
|
| 221 | 221 | handleException($e); |
| 222 | 222 | } |
@@ -43,8 +43,7 @@ discard block |
||
| 43 | 43 | $template->display('socialRegister.inc'); |
| 44 | 44 | exit; |
| 45 | 45 | } |
| 46 | - } |
|
| 47 | - else { |
|
| 46 | + } else { |
|
| 48 | 47 | $login = (isset($_REQUEST['login']) ? $_REQUEST['login'] : (isset($var['login']) ? $var['login'] : '')); |
| 49 | 48 | $password = (isset($_REQUEST['password']) ? $_REQUEST['password'] : (isset($var['password']) ? $var['password'] : '')); |
| 50 | 49 | |
@@ -58,8 +57,7 @@ discard block |
||
| 58 | 57 | $account = SmrAccount::getAccountByName($login); |
| 59 | 58 | if (is_object($account) && $account->checkPassword($password)) { |
| 60 | 59 | SmrSession::setAccount($account); |
| 61 | - } |
|
| 62 | - else { |
|
| 60 | + } else { |
|
| 63 | 61 | $msg = 'Password is incorrect!'; |
| 64 | 62 | header('Location: /login.php?msg=' . rawurlencode(htmlspecialchars($msg, ENT_QUOTES))); |
| 65 | 63 | exit; |
@@ -153,49 +151,71 @@ discard block |
||
| 153 | 151 | //convert to array |
| 154 | 152 | $old = explode('-', $db->getField('array')); |
| 155 | 153 | //get rid of old version cookie since it isn't optimal. |
| 156 | - if ($old[0] != MULTI_CHECKING_COOKIE_VERSION) $old = array(); |
|
| 157 | - } else $old = array(); |
|
| 154 | + if ($old[0] != MULTI_CHECKING_COOKIE_VERSION) { |
|
| 155 | + $old = array(); |
|
| 156 | + } |
|
| 157 | + } else { |
|
| 158 | + $old = array(); |
|
| 159 | + } |
|
| 158 | 160 | $old[0] = MULTI_CHECKING_COOKIE_VERSION; |
| 159 | - if (!in_array($account->getAccountID(), $old)) $old[] = $account->getAccountID(); |
|
| 160 | - if (sizeof($old) <= 2) $use = 'FALSE'; |
|
| 161 | - else $use = 'TRUE'; |
|
| 161 | + if (!in_array($account->getAccountID(), $old)) { |
|
| 162 | + $old[] = $account->getAccountID(); |
|
| 163 | + } |
|
| 164 | + if (sizeof($old) <= 2) { |
|
| 165 | + $use = 'FALSE'; |
|
| 166 | + } else { |
|
| 167 | + $use = 'TRUE'; |
|
| 168 | + } |
|
| 162 | 169 | //check that each value is legit and add it to db string |
| 163 | 170 | $new = MULTI_CHECKING_COOKIE_VERSION; |
| 164 | - foreach ($old as $accID) |
|
| 165 | - if (is_numeric($accID)) $new .= '-'.$accID; |
|
| 171 | + foreach ($old as $accID) { |
|
| 172 | + if (is_numeric($accID)) $new .= '-'.$accID; |
|
| 173 | + } |
|
| 166 | 174 | $db->query('REPLACE INTO multi_checking_cookie (account_id, array, `use`) VALUES ('.$db->escapeNumber($account->getAccountID()).', '.$db->escapeString($new).', '.$db->escapeString($use).')'); |
| 167 | 175 | //now we update their cookie with the newest info |
| 168 | 176 | setcookie('Session_Info', $new, TIME + 157680000); |
| 169 | 177 | |
| 170 | - } |
|
| 171 | - else { |
|
| 178 | + } else { |
|
| 172 | 179 | |
| 173 | 180 | //we have a cookie so we see if we add to it etc |
| 174 | 181 | //break cookie into array |
| 175 | 182 | $cookie = explode('-', $_COOKIE['Session_Info']); |
| 176 | 183 | //check for current version |
| 177 | - if ($cookie[0] != MULTI_CHECKING_COOKIE_VERSION) $cookie = array(); |
|
| 184 | + if ($cookie[0] != MULTI_CHECKING_COOKIE_VERSION) { |
|
| 185 | + $cookie = array(); |
|
| 186 | + } |
|
| 178 | 187 | $cookie[0] = MULTI_CHECKING_COOKIE_VERSION; |
| 179 | 188 | //add this acc to the cookie if it isn't there |
| 180 | - if (!in_array($account->getAccountID(), $cookie)) $cookie[] = $account->getAccountID(); |
|
| 189 | + if (!in_array($account->getAccountID(), $cookie)) { |
|
| 190 | + $cookie[] = $account->getAccountID(); |
|
| 191 | + } |
|
| 181 | 192 | |
| 182 | 193 | $db->query('SELECT * FROM multi_checking_cookie WHERE account_id = '.$account->getAccountID()); |
| 183 | 194 | if ($db->nextRecord()) { |
| 184 | 195 | //convert to array |
| 185 | 196 | $old = explode('-', $db->getField('array')); |
| 186 | - if ($old[0] != MULTI_CHECKING_COOKIE_VERSION) $old = array(); |
|
| 187 | - } else $old = array(); |
|
| 197 | + if ($old[0] != MULTI_CHECKING_COOKIE_VERSION) { |
|
| 198 | + $old = array(); |
|
| 199 | + } |
|
| 200 | + } else { |
|
| 201 | + $old = array(); |
|
| 202 | + } |
|
| 188 | 203 | $old[0] = MULTI_CHECKING_COOKIE_VERSION; |
| 189 | 204 | //merge arrays...but keys are all different so we go through each value |
| 190 | - foreach ($cookie as $value) |
|
| 191 | - if (!in_array($value,$old)) $old[] = $value; |
|
| 205 | + foreach ($cookie as $value) { |
|
| 206 | + if (!in_array($value,$old)) $old[] = $value; |
|
| 207 | + } |
|
| 192 | 208 | |
| 193 | - if (sizeof($old) <= 2) $use = 'FALSE'; |
|
| 194 | - else $use = 'TRUE'; |
|
| 209 | + if (sizeof($old) <= 2) { |
|
| 210 | + $use = 'FALSE'; |
|
| 211 | + } else { |
|
| 212 | + $use = 'TRUE'; |
|
| 213 | + } |
|
| 195 | 214 | //check that each value is legit and add it to db string |
| 196 | 215 | $new = MULTI_CHECKING_COOKIE_VERSION; |
| 197 | - foreach ($old as $accID) |
|
| 198 | - if (is_numeric($accID)) $new .= '-'.$accID; |
|
| 216 | + foreach ($old as $accID) { |
|
| 217 | + if (is_numeric($accID)) $new .= '-'.$accID; |
|
| 218 | + } |
|
| 199 | 219 | $db->query('REPLACE INTO multi_checking_cookie (account_id, array, `use`) VALUES ('.$db->escapeNumber($account->getAccountID()).', '.$db->escapeString($new).', '.$db->escapeString($use).')'); |
| 200 | 220 | //update newest cookie |
| 201 | 221 | setcookie('Session_Info', $new, TIME + 157680000); |
@@ -216,7 +236,6 @@ discard block |
||
| 216 | 236 | |
| 217 | 237 | header('Location: '.$href); |
| 218 | 238 | exit; |
| 219 | -} |
|
| 220 | -catch(Throwable $e) { |
|
| 239 | +} catch(Throwable $e) { |
|
| 221 | 240 | handleException($e); |
| 222 | 241 | } |
@@ -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 | } |