We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -4,7 +4,9 @@ |
||
4 | 4 | |
5 | 5 | $fn_seed = function($message) { |
6 | 6 | $link = new GameLink($message->channel, $message->author); |
7 | - if (!$link->valid) return; |
|
7 | + if (!$link->valid) { |
|
8 | + return; |
|
9 | + } |
|
8 | 10 | |
9 | 11 | $result = shared_channel_msg_seed($link->player); |
10 | 12 | $message->channel->sendMessage(join(EOL, $result)); |
@@ -6,7 +6,9 @@ discard block |
||
6 | 6 | |
7 | 7 | $fn_op = function($message) { |
8 | 8 | $link = new GameLink($message->channel, $message->author); |
9 | - if (!$link->valid) return; |
|
9 | + if (!$link->valid) { |
|
10 | + return; |
|
11 | + } |
|
10 | 12 | $player = $link->player; |
11 | 13 | |
12 | 14 | // print info about the next op |
@@ -16,7 +18,9 @@ discard block |
||
16 | 18 | |
17 | 19 | $fn_op_list = function($message) { |
18 | 20 | $link = new GameLink($message->channel, $message->author); |
19 | - if (!$link->valid) return; |
|
21 | + if (!$link->valid) { |
|
22 | + return; |
|
23 | + } |
|
20 | 24 | $player = $link->player; |
21 | 25 | |
22 | 26 | // print list of attendees |
@@ -26,7 +30,9 @@ discard block |
||
26 | 30 | |
27 | 31 | $fn_op_turns = function($message) { |
28 | 32 | $link = new GameLink($message->channel, $message->author); |
29 | - if (!$link->valid) return; |
|
33 | + if (!$link->valid) { |
|
34 | + return; |
|
35 | + } |
|
30 | 36 | $player = $link->player; |
31 | 37 | |
32 | 38 | // print list of attendees |
@@ -2,7 +2,9 @@ |
||
2 | 2 | |
3 | 3 | $fn_game = function($message) { |
4 | 4 | $link = new GameLink($message->channel, $message->author); |
5 | - if (!$link->valid) return; |
|
5 | + if (!$link->valid) { |
|
6 | + return; |
|
7 | + } |
|
6 | 8 | |
7 | 9 | $game = SmrGame::getGame($link->player->getGameID(), true); |
8 | 10 | $msg = "I am linked to game `" . $game->getDisplayName() . "` in this channel."; |
@@ -4,7 +4,9 @@ |
||
4 | 4 | |
5 | 5 | $fn_money = function($message) { |
6 | 6 | $link = new GameLink($message->channel, $message->author); |
7 | - if (!$link->valid) return; |
|
7 | + if (!$link->valid) { |
|
8 | + return; |
|
9 | + } |
|
8 | 10 | |
9 | 11 | $result = shared_channel_msg_money($link->player); |
10 | 12 | if ($result) { |
@@ -4,7 +4,9 @@ |
||
4 | 4 | |
5 | 5 | $fn_forces = function($message, $params) { |
6 | 6 | $link = new GameLink($message->channel, $message->author); |
7 | - if (!$link->valid) return; |
|
7 | + if (!$link->valid) { |
|
8 | + return; |
|
9 | + } |
|
8 | 10 | |
9 | 11 | // print the next expiring forces |
10 | 12 | $option = isset($params[0]) ? $params[0] : null; |
@@ -1,14 +1,16 @@ discard block |
||
1 | 1 | <?php |
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,33 +1,37 @@ |
||
1 | 1 | <?php |
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); |
@@ -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->getField('amount') < $amount) |
|
40 | - create_error('You don\'t have that much money on your account!'); |
|
37 | + if ($db->getField('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->getField('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) |
@@ -10,20 +10,22 @@ |
||
10 | 10 | } |
11 | 11 | $db->query(substr($query, 0, -1)); |
12 | 12 | } |
13 | - if (!empty($_REQUEST['favourite']) && is_numeric($_REQUEST['favourite'])) |
|
14 | - $db->query('REPLACE INTO account_votes_for_feature VALUES(' . $db->escapeNumber($account->getAccountID()) . ', ' . $db->escapeNumber($_REQUEST['favourite']) . ',\'FAVOURITE\')'); |
|
13 | + if (!empty($_REQUEST['favourite']) && is_numeric($_REQUEST['favourite'])) { |
|
14 | + $db->query('REPLACE INTO account_votes_for_feature VALUES(' . $db->escapeNumber($account->getAccountID()) . ', ' . $db->escapeNumber($_REQUEST['favourite']) . ',\'FAVOURITE\')'); |
|
15 | + } |
|
15 | 16 | |
16 | 17 | forward(create_container('skeleton.php', 'feature_request.php')); |
17 | -} |
|
18 | -else if ($_REQUEST['action'] == 'Set Status') { |
|
18 | +} else if ($_REQUEST['action'] == 'Set Status') { |
|
19 | 19 | if (empty($_REQUEST['status'])) { |
20 | 20 | create_error('You have to select a status to set'); |
21 | 21 | } |
22 | 22 | $status = $_REQUEST['status']; |
23 | - if (empty($_REQUEST['set_status_ids'])) |
|
24 | - create_error('You have to select a feature'); |
|
25 | - if (!$account->hasPermission(PERMISSION_MODERATE_FEATURE_REQUEST)) |
|
26 | - create_error('You do not have permission to do that'); |
|
23 | + if (empty($_REQUEST['set_status_ids'])) { |
|
24 | + create_error('You have to select a feature'); |
|
25 | + } |
|
26 | + if (!$account->hasPermission(PERMISSION_MODERATE_FEATURE_REQUEST)) { |
|
27 | + create_error('You do not have permission to do that'); |
|
28 | + } |
|
27 | 29 | |
28 | 30 | $db->query('UPDATE feature_request fr SET status = ' . $db->escapeString($status) . ' |
29 | 31 | , fav = ( |