We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -1,33 +1,37 @@ |
||
1 | 1 | <?php declare(strict_types=1); |
2 | -if (!$player->isLandedOnPlanet()) |
|
2 | +if (!$player->isLandedOnPlanet()) { |
|
3 | 3 | create_error('You are not on a planet!'); |
4 | +} |
|
4 | 5 | $planet = $player->getSectorPlanet(); |
5 | 6 | $action = $_REQUEST['action']; |
6 | 7 | |
7 | 8 | // Player has requested a planetary fund transaction |
8 | 9 | if ($action == 'Deposit' || $action == 'Withdraw') { |
9 | 10 | $amount = $_REQUEST['amount']; |
10 | - if (!is_numeric($amount)) |
|
11 | - create_error('Numbers only please!'); |
|
11 | + if (!is_numeric($amount)) { |
|
12 | + create_error('Numbers only please!'); |
|
13 | + } |
|
12 | 14 | |
13 | 15 | // only whole numbers allowed |
14 | 16 | $amount = floor($amount); |
15 | 17 | |
16 | 18 | // no negative amounts are allowed |
17 | - if ($amount <= 0) |
|
18 | - create_error('You must actually enter an amount > 0!'); |
|
19 | + if ($amount <= 0) { |
|
20 | + create_error('You must actually enter an amount > 0!'); |
|
21 | + } |
|
19 | 22 | |
20 | 23 | if ($action == 'Deposit') { |
21 | - if ($player->getCredits() < $amount) |
|
22 | - create_error('You don\'t own that much money!'); |
|
24 | + if ($player->getCredits() < $amount) { |
|
25 | + create_error('You don\'t own that much money!'); |
|
26 | + } |
|
23 | 27 | |
24 | 28 | $player->decreaseCredits($amount); |
25 | 29 | $planet->increaseCredits($amount); |
26 | 30 | $account->log(LOG_TYPE_BANK, 'Player puts ' . $amount . ' credits on planet', $player->getSectorID()); |
27 | - } |
|
28 | - elseif ($action == 'Withdraw') { |
|
29 | - if ($planet->getCredits() < $amount) |
|
30 | - create_error('There are not enough credits in the planetary account!'); |
|
31 | + } elseif ($action == 'Withdraw') { |
|
32 | + if ($planet->getCredits() < $amount) { |
|
33 | + create_error('There are not enough credits in the planetary account!'); |
|
34 | + } |
|
31 | 35 | |
32 | 36 | $player->increaseCredits($amount); |
33 | 37 | $planet->decreaseCredits($amount); |
@@ -1,14 +1,16 @@ discard block |
||
1 | 1 | <?php declare(strict_types=1); |
2 | -if (!$player->isLandedOnPlanet()) |
|
2 | +if (!$player->isLandedOnPlanet()) { |
|
3 | 3 | create_error('You are not on a planet!'); |
4 | +} |
|
4 | 5 | // get a planet from the sector where the player is in |
5 | 6 | $planet = $player->getSectorPlanet(); |
6 | 7 | $action = $_REQUEST['action']; |
7 | 8 | $password = isset($_REQUEST['password']) ? $_REQUEST['password'] : ''; |
8 | 9 | |
9 | 10 | if ($action == 'Take Ownership') { |
10 | - if ($planet->hasOwner() && $planet->getPassword() != $password) |
|
11 | - create_error('You are not allowed to take ownership!'); |
|
11 | + if ($planet->hasOwner() && $planet->getPassword() != $password) { |
|
12 | + create_error('You are not allowed to take ownership!'); |
|
13 | + } |
|
12 | 14 | |
13 | 15 | // delete all previous ownerships |
14 | 16 | $db->query('UPDATE planet SET owner_id = 0, password = NULL |
@@ -20,8 +22,7 @@ discard block |
||
20 | 22 | $planet->removePassword(); |
21 | 23 | $planet->update(); |
22 | 24 | $account->log(LOG_TYPE_PLANETS, 'Player takes ownership of planet.', $player->getSectorID()); |
23 | -} |
|
24 | -else if ($action == 'Rename') { |
|
25 | +} else if ($action == 'Rename') { |
|
25 | 26 | $name = trim($_REQUEST['name']); |
26 | 27 | if (empty($name)) { |
27 | 28 | create_error('You cannot leave your planet nameless!'); |
@@ -31,8 +32,7 @@ discard block |
||
31 | 32 | $planet->update(); |
32 | 33 | $account->log(LOG_TYPE_PLANETS, 'Player renames planet to ' . $name . '.', $player->getSectorID()); |
33 | 34 | |
34 | -} |
|
35 | -else if ($action == 'Set Password') { |
|
35 | +} else if ($action == 'Set Password') { |
|
36 | 36 | // set password |
37 | 37 | $planet->setPassword($password); |
38 | 38 | $planet->update(); |
@@ -1,30 +1,36 @@ discard block |
||
1 | 1 | <?php declare(strict_types=1); |
2 | 2 | |
3 | -if ($player->hasNewbieTurns()) |
|
3 | +if ($player->hasNewbieTurns()) { |
|
4 | 4 | create_error('You are under newbie protection.'); |
5 | -if ($player->hasFederalProtection()) |
|
5 | +} |
|
6 | +if ($player->hasFederalProtection()) { |
|
6 | 7 | create_error('You are under federal protection.'); |
7 | -if ($player->isLandedOnPlanet()) |
|
8 | +} |
|
9 | +if ($player->isLandedOnPlanet()) { |
|
8 | 10 | create_error('You cannot attack whilst on a planet!'); |
9 | -if ($player->getTurns() < 3) |
|
11 | +} |
|
12 | +if ($player->getTurns() < 3) { |
|
10 | 13 | create_error('You have insufficient turns to perform that action.'); |
11 | -if (!$player->canFight()) |
|
14 | +} |
|
15 | +if (!$player->canFight()) { |
|
12 | 16 | create_error('You are not allowed to fight!'); |
17 | +} |
|
13 | 18 | |
14 | 19 | $targetPlayer = SmrPlayer::getPlayer($var['target'], $player->getGameID()); |
15 | 20 | |
16 | - if ($player->traderNAPAlliance($targetPlayer)) |
|
17 | - create_error('Your alliance does not allow you to attack this trader.'); |
|
18 | - else if ($targetPlayer->isDead()) |
|
19 | - create_error('Target is already dead.'); |
|
20 | - else if ($targetPlayer->getSectorID() != $player->getSectorID()) |
|
21 | - create_error('Target is no longer in this sector.'); |
|
22 | - else if ($targetPlayer->hasNewbieTurns()) |
|
23 | - create_error('Target is under newbie protection.'); |
|
24 | - else if ($targetPlayer->isLandedOnPlanet()) |
|
25 | - create_error('Target is protected by planetary shields.'); |
|
26 | - else if ($targetPlayer->hasFederalProtection()) |
|
27 | - create_error('Target is under federal protection.'); |
|
21 | + if ($player->traderNAPAlliance($targetPlayer)) { |
|
22 | + create_error('Your alliance does not allow you to attack this trader.'); |
|
23 | + } else if ($targetPlayer->isDead()) { |
|
24 | + create_error('Target is already dead.'); |
|
25 | + } else if ($targetPlayer->getSectorID() != $player->getSectorID()) { |
|
26 | + create_error('Target is no longer in this sector.'); |
|
27 | + } else if ($targetPlayer->hasNewbieTurns()) { |
|
28 | + create_error('Target is under newbie protection.'); |
|
29 | + } else if ($targetPlayer->isLandedOnPlanet()) { |
|
30 | + create_error('Target is protected by planetary shields.'); |
|
31 | + } else if ($targetPlayer->hasFederalProtection()) { |
|
32 | + create_error('Target is under federal protection.'); |
|
33 | + } |
|
28 | 34 | |
29 | 35 | $fightingPlayers = $sector->getFightingTraders($player, $targetPlayer); |
30 | 36 | |
@@ -76,10 +82,11 @@ discard block |
||
76 | 82 | $container = create_container('skeleton.php', 'trader_attack.php'); |
77 | 83 | |
78 | 84 | // If their target is dead there is no continue attack button |
79 | -if (!$targetPlayer->isDead()) |
|
85 | +if (!$targetPlayer->isDead()) { |
|
80 | 86 | $container['target'] = $var['target']; |
81 | -else |
|
87 | +} else { |
|
82 | 88 | $container['target'] = 0; |
89 | +} |
|
83 | 90 | |
84 | 91 | // If they died on the shot they get to see the results |
85 | 92 | if ($player->isDead()) { |
@@ -1,23 +1,31 @@ discard block |
||
1 | 1 | <?php declare(strict_types=1); |
2 | 2 | |
3 | -if ($player->hasNewbieTurns()) |
|
3 | +if ($player->hasNewbieTurns()) { |
|
4 | 4 | create_error('You are under newbie protection!'); |
5 | -if ($player->hasFederalProtection()) |
|
5 | +} |
|
6 | +if ($player->hasFederalProtection()) { |
|
6 | 7 | create_error('You are under federal protection!'); |
7 | -if ($player->isLandedOnPlanet()) |
|
8 | +} |
|
9 | +if ($player->isLandedOnPlanet()) { |
|
8 | 10 | create_error('You cannot attack planets whilst on a planet!'); |
9 | -if ($player->getTurns() < 3) |
|
11 | +} |
|
12 | +if ($player->getTurns() < 3) { |
|
10 | 13 | create_error('You do not have enough turns to attack this planet!'); |
11 | -if (!$ship->hasWeapons() && !$ship->hasCDs()) |
|
14 | +} |
|
15 | +if (!$ship->hasWeapons() && !$ship->hasCDs()) { |
|
12 | 16 | create_error('What are you going to do? Insult it to death?'); |
13 | -if (!$player->canFight()) |
|
17 | +} |
|
18 | +if (!$player->canFight()) { |
|
14 | 19 | create_error('You are not allowed to fight!'); |
20 | +} |
|
15 | 21 | |
16 | 22 | $planet = $player->getSectorPlanet(); |
17 | -if (!$planet->exists()) |
|
23 | +if (!$planet->exists()) { |
|
18 | 24 | create_error('This planet does not exist.'); |
19 | -if (!$planet->isClaimed()) |
|
25 | +} |
|
26 | +if (!$planet->isClaimed()) { |
|
20 | 27 | create_error('This planet is not claimed.'); |
28 | +} |
|
21 | 29 | |
22 | 30 | $planetOwner = $planet->getOwner(); |
23 | 31 | |
@@ -88,9 +96,10 @@ discard block |
||
88 | 96 | |
89 | 97 | // Update sector messages for attackers |
90 | 98 | foreach ($attackers as $attacker) { |
91 | - if (!$player->equals($attacker)) |
|
92 | - $db->query('REPLACE INTO sector_message VALUES(' . $attacker->getAccountID() . ',' . $attacker->getGameID() . ',' . $db->escapeString('[ATTACK_RESULTS]' . $logId) . ')'); |
|
93 | -} |
|
99 | + if (!$player->equals($attacker)) { |
|
100 | + $db->query('REPLACE INTO sector_message VALUES(' . $attacker->getAccountID() . ',' . $attacker->getGameID() . ',' . $db->escapeString('[ATTACK_RESULTS]' . $logId) . ')'); |
|
101 | + } |
|
102 | + } |
|
94 | 103 | |
95 | 104 | $container = create_container('skeleton.php', 'planet_attack.php'); |
96 | 105 | $container['sector_id'] = $planet->getSectorID(); |
@@ -1,17 +1,21 @@ discard block |
||
1 | 1 | <?php declare(strict_types=1); |
2 | 2 | |
3 | 3 | function checkPortTradeable($port, $player) { |
4 | - if ($port->getSectorID() != $player->getSectorID()) |
|
5 | - return 'That port is not in this sector!'; |
|
4 | + if ($port->getSectorID() != $player->getSectorID()) { |
|
5 | + return 'That port is not in this sector!'; |
|
6 | + } |
|
6 | 7 | |
7 | - if (!$port->exists()) |
|
8 | - return 'There is no port in this sector!'; |
|
8 | + if (!$port->exists()) { |
|
9 | + return 'There is no port in this sector!'; |
|
10 | + } |
|
9 | 11 | |
10 | - if ($player->getRelation($port->getRaceID()) <= RELATIONS_WAR) |
|
11 | - return 'We will not trade with our enemies!'; |
|
12 | + if ($player->getRelation($port->getRaceID()) <= RELATIONS_WAR) { |
|
13 | + return 'We will not trade with our enemies!'; |
|
14 | + } |
|
12 | 15 | |
13 | - if ($port->getReinforceTime() > TIME) |
|
14 | - return 'We are still repairing damage caused during the last raid.'; |
|
16 | + if ($port->getReinforceTime() > TIME) { |
|
17 | + return 'We are still repairing damage caused during the last raid.'; |
|
18 | + } |
|
15 | 19 | |
16 | 20 | return true; |
17 | 21 | } |
@@ -50,39 +54,43 @@ discard block |
||
50 | 54 | if (abs($port_off_rel) > abs($trader_off_rel)) { |
51 | 55 | // get a random number between |
52 | 56 | // (port_off) and (100 +/- $trader_off_rel) |
53 | - if (100 + $trader_off_rel < $port_off) |
|
54 | - $offer_modifier = mt_rand(100 + $trader_off_rel, $port_off); |
|
55 | - else |
|
56 | - $offer_modifier = mt_rand($port_off, 100 + $trader_off_rel); |
|
57 | + if (100 + $trader_off_rel < $port_off) { |
|
58 | + $offer_modifier = mt_rand(100 + $trader_off_rel, $port_off); |
|
59 | + } else { |
|
60 | + $offer_modifier = mt_rand($port_off, 100 + $trader_off_rel); |
|
61 | + } |
|
57 | 62 | |
58 | 63 | $container['offered_price'] = round($container['ideal_price'] * $offer_modifier / 100); |
59 | 64 | } |
65 | + } else { |
|
66 | + $container['overall_number_of_bargains'] = mt_rand(2, 5); |
|
67 | + } |
|
60 | 68 | } |
61 | - else |
|
62 | - $container['overall_number_of_bargains'] = mt_rand(2, 5); |
|
63 | -} |
|
64 | 69 | |
65 | 70 | function get_amount() { |
66 | 71 | global $var; |
67 | 72 | |
68 | 73 | // retrieve amount |
69 | - if (isset($var['amount'])) |
|
70 | - $amount = $var['amount']; |
|
71 | - else if (isset($_REQUEST['amount'])) |
|
72 | - $amount = $_REQUEST['amount']; |
|
73 | - else |
|
74 | - $amount = 0; |
|
74 | + if (isset($var['amount'])) { |
|
75 | + $amount = $var['amount']; |
|
76 | + } else if (isset($_REQUEST['amount'])) { |
|
77 | + $amount = $_REQUEST['amount']; |
|
78 | + } else { |
|
79 | + $amount = 0; |
|
80 | + } |
|
75 | 81 | |
76 | 82 | // only numbers |
77 | - if (!is_numeric($amount)) |
|
78 | - create_error('You must actually enter a number!'); |
|
83 | + if (!is_numeric($amount)) { |
|
84 | + create_error('You must actually enter a number!'); |
|
85 | + } |
|
79 | 86 | |
80 | 87 | // we take as it is but round it |
81 | 88 | $amount = floor($amount); |
82 | 89 | |
83 | 90 | // no negative amounts are allowed |
84 | - if ($amount <= 0) |
|
85 | - create_error('You must actually enter an amount > 0!'); |
|
91 | + if ($amount <= 0) { |
|
92 | + create_error('You must actually enter an amount > 0!'); |
|
93 | + } |
|
86 | 94 | |
87 | 95 | return $amount; |
88 | 96 | } |
@@ -91,23 +99,26 @@ discard block |
||
91 | 99 | global $var; |
92 | 100 | |
93 | 101 | // we get it from form |
94 | - if (isset($_REQUEST['bargain_price'])) |
|
95 | - $price = $_REQUEST['bargain_price']; |
|
96 | - else if (isset($var['bargain_price'])) |
|
97 | - $price = $var['bargain_price']; |
|
98 | - else |
|
99 | - $price = 0; |
|
102 | + if (isset($_REQUEST['bargain_price'])) { |
|
103 | + $price = $_REQUEST['bargain_price']; |
|
104 | + } else if (isset($var['bargain_price'])) { |
|
105 | + $price = $var['bargain_price']; |
|
106 | + } else { |
|
107 | + $price = 0; |
|
108 | + } |
|
100 | 109 | |
101 | 110 | // only numbers |
102 | - if (!is_numeric($price)) |
|
103 | - create_error('You must actually enter a number!'); |
|
111 | + if (!is_numeric($price)) { |
|
112 | + create_error('You must actually enter a number!'); |
|
113 | + } |
|
104 | 114 | |
105 | 115 | // we take as it is but round it |
106 | 116 | $price = floor($price); |
107 | 117 | |
108 | 118 | // no negative amounts are allowed |
109 | - if ($price < 0) |
|
110 | - create_error('No negative prices are allowed!'); |
|
119 | + if ($price < 0) { |
|
120 | + create_error('No negative prices are allowed!'); |
|
121 | + } |
|
111 | 122 | |
112 | 123 | return $price; |
113 | 124 | } |
@@ -156,8 +156,7 @@ discard block |
||
156 | 156 | // now try the cookie |
157 | 157 | if (isset($_COOKIE['session_id']) && strlen($_COOKIE['session_id']) === 32) { |
158 | 158 | self::$session_id = $_COOKIE['session_id']; |
159 | - } |
|
160 | - else { |
|
159 | + } else { |
|
161 | 160 | // create a new session id |
162 | 161 | do { |
163 | 162 | self::$session_id = md5(uniqid(strval(rand()))); |
@@ -211,18 +210,15 @@ discard block |
||
211 | 210 | self::$account_id = 0; |
212 | 211 | self::$game_id = 0; |
213 | 212 | self::$var = array(); |
214 | - } |
|
215 | - else { |
|
213 | + } else { |
|
216 | 214 | foreach (self::$var as $key => &$value) { |
217 | 215 | if ($value['Expires'] > 0 && $value['Expires'] <= TIME) { // Use 0 for infinity |
218 | 216 | //This link is no longer valid |
219 | 217 | unset(self::$var[$key]); |
220 | - } |
|
221 | - else if ($value['RemainingPageLoads'] < 0) { |
|
218 | + } else if ($value['RemainingPageLoads'] < 0) { |
|
222 | 219 | //This link is no longer valid |
223 | 220 | unset(self::$var[$key]); |
224 | - } |
|
225 | - else { |
|
221 | + } else { |
|
226 | 222 | --$value['RemainingPageLoads']; |
227 | 223 | if (isset($value['CommonID'])) { |
228 | 224 | self::$commonIDs[$value['CommonID']] = $key; |
@@ -230,8 +226,7 @@ discard block |
||
230 | 226 | } |
231 | 227 | } unset($value); |
232 | 228 | } |
233 | - } |
|
234 | - else { |
|
229 | + } else { |
|
235 | 230 | self::$generate = true; |
236 | 231 | self::$account_id = 0; |
237 | 232 | self::$game_id = 0; |
@@ -252,8 +247,7 @@ discard block |
||
252 | 247 | self::$db->query('UPDATE active_session SET account_id=' . self::$db->escapeNumber(self::$account_id) . ',game_id=' . self::$db->escapeNumber(self::$game_id) . (!USING_AJAX ? ',last_accessed=' . self::$db->escapeNumber(TIME) : '') . ',session_var=' . self::$db->escapeBinary($compressed) . |
253 | 248 | ',last_sn=' . self::$db->escapeString(self::$SN) . |
254 | 249 | ' WHERE session_id=' . self::$db->escapeString(self::$session_id) . (USING_AJAX ? ' AND last_sn=' . self::$db->escapeString(self::$lastSN) : '') . ' LIMIT 1'); |
255 | - } |
|
256 | - else { |
|
250 | + } else { |
|
257 | 251 | self::$db->query('DELETE FROM active_session WHERE account_id = ' . self::$db->escapeNumber(self::$account_id) . ' AND game_id = ' . self::$db->escapeNumber(self::$game_id)); |
258 | 252 | self::$db->query('INSERT INTO active_session (session_id, account_id, game_id, last_accessed, session_var) VALUES(' . self::$db->escapeString(self::$session_id) . ',' . self::$db->escapeNumber(self::$account_id) . ',' . self::$db->escapeNumber(self::$game_id) . ',' . self::$db->escapeNumber(TIME) . ',' . self::$db->escapeBinary($compressed) . ')'); |
259 | 253 | self::$generate = false; |
@@ -400,8 +394,7 @@ discard block |
||
400 | 394 | if ($value === null) { |
401 | 395 | unset($var[$key]); |
402 | 396 | unset(self::$var[self::$SN][$key]); |
403 | - } |
|
404 | - else { |
|
397 | + } else { |
|
405 | 398 | $var[$key] = $value; |
406 | 399 | self::$var[self::$SN][$key] = $value; |
407 | 400 | } |
@@ -423,8 +416,7 @@ discard block |
||
423 | 416 | |
424 | 417 | if ($sn === false) { |
425 | 418 | $sn = self::generateSN($container); |
426 | - } |
|
427 | - else { |
|
419 | + } else { |
|
428 | 420 | // If we've been provided an SN to use then copy over the existing 'PreviousRequestTime' |
429 | 421 | $container['PreviousRequestTime'] = self::$var[$sn]['PreviousRequestTime']; |
430 | 422 | } |
@@ -437,8 +429,7 @@ discard block |
||
437 | 429 | if (isset(self::$commonIDs[$container['CommonID']])) { |
438 | 430 | $sn = self::$commonIDs[$container['CommonID']]; |
439 | 431 | $container['PreviousRequestTime'] = isset(self::$var[$sn]) ? self::$var[$sn]['PreviousRequestTime'] : MICRO_TIME; |
440 | - } |
|
441 | - else { |
|
432 | + } else { |
|
442 | 433 | do { |
443 | 434 | $sn = substr(md5(strval(rand())), 0, 8); |
444 | 435 | } while (isset(self::$var[$sn])); |
@@ -1,8 +1,9 @@ discard block |
||
1 | 1 | <?php declare(strict_types=1); |
2 | 2 | |
3 | 3 | function get_album_nick($album_id) { |
4 | - if ($album_id == 0) |
|
5 | - return 'System'; |
|
4 | + if ($album_id == 0) { |
|
5 | + return 'System'; |
|
6 | + } |
|
6 | 7 | |
7 | 8 | return SmrAccount::getAccount($album_id)->getHofDisplayName(); |
8 | 9 | } |
@@ -59,12 +60,15 @@ discard block |
||
59 | 60 | $nick = get_album_nick($album_id); |
60 | 61 | $template->assign('Nick', $nick); |
61 | 62 | |
62 | - if (!empty($day) && !empty($month) && !empty($year)) |
|
63 | - $birthdate = $month . ' / ' . $day . ' / ' . $year; |
|
64 | - if (empty($birthdate) && !empty($year)) |
|
65 | - $birthdate = 'Year ' . $year; |
|
66 | - if (empty($birthdate)) |
|
67 | - $birthdate = 'N/A'; |
|
63 | + if (!empty($day) && !empty($month) && !empty($year)) { |
|
64 | + $birthdate = $month . ' / ' . $day . ' / ' . $year; |
|
65 | + } |
|
66 | + if (empty($birthdate) && !empty($year)) { |
|
67 | + $birthdate = 'Year ' . $year; |
|
68 | + } |
|
69 | + if (empty($birthdate)) { |
|
70 | + $birthdate = 'N/A'; |
|
71 | + } |
|
68 | 72 | $template->assign('Birthdate', $birthdate); |
69 | 73 | |
70 | 74 | // get the time that passed since the entry was last changed |
@@ -1,15 +1,17 @@ |
||
1 | 1 | <?php declare(strict_types=1); |
2 | 2 | $action = $_REQUEST['action']; |
3 | 3 | if ($action == 'Marked Messages') { |
4 | - if (!isset($_REQUEST['message_id'])) |
|
5 | - create_error('You must choose the messages you want to delete.'); |
|
4 | + if (!isset($_REQUEST['message_id'])) { |
|
5 | + create_error('You must choose the messages you want to delete.'); |
|
6 | + } |
|
6 | 7 | |
7 | - foreach ($_REQUEST['message_id'] as $id) |
|
8 | - $db->query('DELETE FROM message_boxes WHERE message_id = ' . $db->escapeNumber($id)); |
|
9 | -} |
|
10 | -else if ($action == 'All Messages') { |
|
11 | - if (!isset($var['box_type_id'])) |
|
12 | - create_error('No box selected.'); |
|
8 | + foreach ($_REQUEST['message_id'] as $id) { |
|
9 | + $db->query('DELETE FROM message_boxes WHERE message_id = ' . $db->escapeNumber($id)); |
|
10 | + } |
|
11 | + } else if ($action == 'All Messages') { |
|
12 | + if (!isset($var['box_type_id'])) { |
|
13 | + create_error('No box selected.'); |
|
14 | + } |
|
13 | 15 | $db->query('DELETE FROM message_boxes WHERE box_type_id = ' . $db->escapeNumber($var['box_type_id'])); |
14 | 16 | } |
15 | 17 | forward(create_container('skeleton.php', 'box_view.php')); |
@@ -21,8 +21,7 @@ discard block |
||
21 | 21 | $db->query('SELECT transaction_id FROM anon_bank_transactions WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND anon_id = ' . $db->escapeNumber($account_num) . ' ORDER BY transaction_id DESC LIMIT 1'); |
22 | 22 | if ($db->nextRecord()) { |
23 | 23 | $trans_id = $db->getInt('transaction_id') + 1; |
24 | - } |
|
25 | - else { |
|
24 | + } else { |
|
26 | 25 | $trans_id = 1; |
27 | 26 | } |
28 | 27 | $db->query('INSERT INTO anon_bank_transactions (account_id, game_id, anon_id, transaction_id, transaction, amount, time) ' . |
@@ -32,17 +31,16 @@ discard block |
||
32 | 31 | |
33 | 32 | // log action |
34 | 33 | $account->log(LOG_TYPE_BANK, 'Deposits ' . $amount . ' credits in anonymous account #' . $account_num, $player->getSectorID()); |
35 | -} |
|
36 | -else { |
|
34 | +} else { |
|
37 | 35 | $db->query('SELECT * FROM anon_bank WHERE anon_id = ' . $db->escapeNumber($account_num) . ' AND game_id = ' . $db->escapeNumber($player->getGameID())); |
38 | 36 | $db->nextRecord(); |
39 | - if ($db->getInt('amount') < $amount) |
|
40 | - create_error('You don\'t have that much money on your account!'); |
|
37 | + if ($db->getInt('amount') < $amount) { |
|
38 | + create_error('You don\'t have that much money on your account!'); |
|
39 | + } |
|
41 | 40 | $db->query('SELECT transaction_id FROM anon_bank_transactions WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND anon_id = ' . $db->escapeNumber($account_num) . ' ORDER BY transaction_id DESC LIMIT 1'); |
42 | 41 | if ($db->nextRecord()) { |
43 | 42 | $trans_id = $db->getInt('transaction_id') + 1; |
44 | - } |
|
45 | - else { |
|
43 | + } else { |
|
46 | 44 | $trans_id = 1; |
47 | 45 | } |
48 | 46 | $db->query('INSERT INTO anon_bank_transactions (account_id, game_id, anon_id, transaction_id, transaction, amount, time) |