@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
| 3 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
| 4 | 4 | { |
| 5 | 5 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
| 6 | 6 | } |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | $lang['r_list'] = "<option value=\"-1\">{$lang['All_players']}</option>"; |
| 19 | 19 | if ($ranks) { |
| 20 | - foreach($ranks as $id => $array) { |
|
| 21 | - $lang['r_list'] .= "<option value=\"" . $id . "\">" . $array['name'] . "</option>"; |
|
| 20 | + foreach ($ranks as $id => $array) { |
|
| 21 | + $lang['r_list'] .= "<option value=\"" . $id . "\">" . $array['name'] . "</option>"; |
|
| 22 | 22 | } |
| 23 | 23 | } |
| 24 | 24 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
| 3 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
| 4 | 4 | { |
| 5 | 5 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
| 6 | 6 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | $new_rank_name = sys_get_param_str('newRankName'); |
| 15 | 15 | if ($new_rank_name) |
| 16 | 16 | { |
| 17 | - foreach($ally_rights as $fieldName) |
|
| 17 | + foreach ($ally_rights as $fieldName) |
|
| 18 | 18 | { |
| 19 | 19 | $newRank[$fieldName] = 0; |
| 20 | 20 | } |
@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | { |
| 29 | 29 | unset($ranks); |
| 30 | 30 | |
| 31 | - foreach($rankListInput as $rankID => $rank) |
|
| 31 | + foreach ($rankListInput as $rankID => $rank) |
|
| 32 | 32 | { |
| 33 | - foreach($ally_rights as $rightName) |
|
| 33 | + foreach ($ally_rights as $rightName) |
|
| 34 | 34 | { |
| 35 | 35 | $ranks[$rankID][$rightName] = $rank[$rightName] ? 1 : 0; |
| 36 | 36 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $d = sys_get_param_int('d'); |
| 42 | 42 | if ($d && isset($ranks[$d])) |
| 43 | 43 | { |
| 44 | - if(count($ranks) == 1) |
|
| 44 | + if (count($ranks) == 1) |
|
| 45 | 45 | { |
| 46 | 46 | message($lang['ali_adm_lastRank'], $lang['ali_adm_rights_title']); |
| 47 | 47 | } |
@@ -53,16 +53,16 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | if (count($ranks)) |
| 55 | 55 | { |
| 56 | - foreach($ranks as $rankID => $rank) |
|
| 56 | + foreach ($ranks as $rankID => $rank) |
|
| 57 | 57 | { |
| 58 | 58 | $rank_data = array( |
| 59 | 59 | 'ID' => $rankID, |
| 60 | 60 | 'NAME' => $rank['name'], |
| 61 | 61 | ); |
| 62 | 62 | |
| 63 | - for($i = 1; $i < count($rank); $i++) |
|
| 63 | + for ($i = 1; $i < count($rank); $i++) |
|
| 64 | 64 | { |
| 65 | - $rank_data['R' . $i] = (($rank[$ally_rights[$i]] == 1) ? ' checked' : '') ; |
|
| 65 | + $rank_data['R' . $i] = (($rank[$ally_rights[$i]] == 1) ? ' checked' : ''); |
|
| 66 | 66 | $rank_data['N' . $i] = $ally_rights[$i]; |
| 67 | 67 | } |
| 68 | 68 | |
@@ -34,15 +34,16 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | $sort2s = "DESC"; |
| 36 | 36 | $sort2 = 0; |
| 37 | -} |
|
| 38 | -else |
|
| 37 | +} else |
|
| 39 | 38 | { |
| 40 | 39 | $sort2s = "ASC"; |
| 41 | 40 | $sort2 = 1; |
| 42 | 41 | } |
| 43 | 42 | |
| 44 | 43 | $sort1 = sys_get_param_int('sort1'); |
| 45 | -if($sort1>5 || $sort1<0) $sort1 = 0; |
|
| 44 | +if($sort1>5 || $sort1<0) { |
|
| 45 | + $sort1 = 0; |
|
| 46 | +} |
|
| 46 | 47 | $sort1s = array( |
| 47 | 48 | 0 => '`ally_rank_id` %1$s;', |
| 48 | 49 | 1 => '`username` %1$s;', |
@@ -69,8 +70,7 @@ discard block |
||
| 69 | 70 | if ($ally['ally_owner'] == $userRow['id']) |
| 70 | 71 | { |
| 71 | 72 | $ally_range = ($ally['ally_owner_range'])?$ally['ally_owner_range']:$lang['Founder']; |
| 72 | - } |
|
| 73 | - else |
|
| 73 | + } else |
|
| 74 | 74 | { |
| 75 | 75 | if($user_admin) |
| 76 | 76 | { |
@@ -78,14 +78,14 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | foreach($ranks as $rankID => $rankArray){ |
| 80 | 80 | $ally_range .= '<option value="' . $rankID . '"'; |
| 81 | - if($rankID == $userRow['ally_rank_id']) |
|
| 82 | - $ally_range .= " selected"; |
|
| 81 | + if($rankID == $userRow['ally_rank_id']) { |
|
| 82 | + $ally_range .= " selected"; |
|
| 83 | + } |
|
| 83 | 84 | $ally_range .= '>' . $rankArray['name']; |
| 84 | 85 | $ally_range .= '</option>'; |
| 85 | 86 | } |
| 86 | 87 | $ally_range .= '</select>'; |
| 87 | - } |
|
| 88 | - else |
|
| 88 | + } else |
|
| 89 | 89 | { |
| 90 | 90 | $ally_range = $ranks[$userRow['ally_rank_id']]['name']; |
| 91 | 91 | } |
@@ -97,53 +97,44 @@ discard block |
||
| 97 | 97 | if ( $last_active < 60 ) |
| 98 | 98 | { |
| 99 | 99 | $tmp = "lime>{$lang['On']}"; |
| 100 | - } |
|
| 101 | - elseif ($last_active < 60 * 60) |
|
| 100 | + } elseif ($last_active < 60 * 60) |
|
| 102 | 101 | { |
| 103 | 102 | $last_active = round($last_active / 60); |
| 104 | 103 | $tmp = "lime>{$last_active} {$lang['sys_min_short']}"; |
| 105 | - } |
|
| 106 | - elseif ($last_active < 60 * 60 * 24) |
|
| 104 | + } elseif ($last_active < 60 * 60 * 24) |
|
| 107 | 105 | { |
| 108 | 106 | $last_active = round( $last_active / (60 * 60)); |
| 109 | 107 | $tmp = "green>{$last_active} {$lang['sys_hrs_short']}"; |
| 110 | - } |
|
| 111 | - else |
|
| 108 | + } else |
|
| 112 | 109 | { |
| 113 | 110 | $last_active = round( $last_active / (60 * 60 * 24)); |
| 114 | 111 | if ($last_active < 7) |
| 115 | 112 | { |
| 116 | 113 | $tmp = "yellow"; |
| 117 | - } |
|
| 118 | - elseif ($last_active < 30) |
|
| 114 | + } elseif ($last_active < 30) |
|
| 119 | 115 | { |
| 120 | 116 | $tmp = "orange"; |
| 121 | - } |
|
| 122 | - else |
|
| 117 | + } else |
|
| 123 | 118 | { |
| 124 | 119 | $tmp = "red"; |
| 125 | 120 | } |
| 126 | 121 | $tmp .= ">{$last_active} {$lang['sys_day_short']}"; |
| 127 | 122 | } |
| 128 | - } |
|
| 129 | - else |
|
| 123 | + } else |
|
| 130 | 124 | { |
| 131 | 125 | if($user_onlinestatus) |
| 132 | 126 | { |
| 133 | 127 | if ( $last_active < 60 * 5 ) |
| 134 | 128 | { |
| 135 | 129 | $tmp = "lime>{$lang['On']}"; |
| 136 | - } |
|
| 137 | - elseif ($last_active < 60 * 15) |
|
| 130 | + } elseif ($last_active < 60 * 15) |
|
| 138 | 131 | { |
| 139 | 132 | $tmp = "yellow>{$lang['ali_lessThen15min']}"; |
| 140 | - } |
|
| 141 | - else |
|
| 133 | + } else |
|
| 142 | 134 | { |
| 143 | 135 | $tmp = "red>{$lang['Off']}"; |
| 144 | 136 | } |
| 145 | - } |
|
| 146 | - else |
|
| 137 | + } else |
|
| 147 | 138 | { |
| 148 | 139 | $sort1 = max($sort1, 4); |
| 149 | 140 | $tmp = "orange>-"; |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
| 3 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
| 4 | 4 | { |
| 5 | 5 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
| 6 | 6 | } |
@@ -10,11 +10,11 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | // Changing rank for single user |
| 12 | 12 | $id_user = sys_get_param_id('id_user'); |
| 13 | -if(isset($_GET['id_rank'])) |
|
| 13 | +if (isset($_GET['id_rank'])) |
|
| 14 | 14 | { |
| 15 | 15 | $id_rank = sys_get_param_int('id_rank'); |
| 16 | 16 | } |
| 17 | -if($id_user && isset($id_rank) && $user_admin){ |
|
| 17 | +if ($id_user && isset($id_rank) && $user_admin) { |
|
| 18 | 18 | db_user_set_by_id($id_user, "`ally_rank_id` = {$id_rank}"); |
| 19 | 19 | } |
| 20 | 20 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | $sort1 = sys_get_param_int('sort1'); |
| 46 | -if($sort1>5 || $sort1<0) $sort1 = 0; |
|
| 46 | +if ($sort1 > 5 || $sort1 < 0) $sort1 = 0; |
|
| 47 | 47 | $sort1s = array( |
| 48 | 48 | 0 => '`ally_rank_id` %1$s;', |
| 49 | 49 | 1 => '`username` %1$s;', |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | 'id, username, galaxy, system, planet, onlinetime, ally_rank_id, ally_register_time, total_points'); |
| 60 | 60 | |
| 61 | 61 | // while ($userRow = db_fetch($userList)) |
| 62 | -foreach($userList as $userRow) |
|
| 62 | +foreach ($userList as $userRow) |
|
| 63 | 63 | { |
| 64 | 64 | $i++; |
| 65 | 65 | if (!isset($ranks[$userRow['ally_rank_id']])) |
@@ -69,17 +69,17 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | if ($ally['ally_owner'] == $userRow['id']) |
| 71 | 71 | { |
| 72 | - $ally_range = ($ally['ally_owner_range'])?$ally['ally_owner_range']:classLocale::$lang['Founder']; |
|
| 72 | + $ally_range = ($ally['ally_owner_range']) ? $ally['ally_owner_range'] : classLocale::$lang['Founder']; |
|
| 73 | 73 | } |
| 74 | 74 | else |
| 75 | 75 | { |
| 76 | - if($user_admin) |
|
| 76 | + if ($user_admin) |
|
| 77 | 77 | { |
| 78 | 78 | $ally_range = '<select onchange="window.location=\'alliance.php?mode=admin&edit=members&id_user=' . $userRow['id'] . '&id_rank=\' + this.value">'; |
| 79 | 79 | |
| 80 | - foreach($ranks as $rankID => $rankArray){ |
|
| 80 | + foreach ($ranks as $rankID => $rankArray) { |
|
| 81 | 81 | $ally_range .= '<option value="' . $rankID . '"'; |
| 82 | - if($rankID == $userRow['ally_rank_id']) |
|
| 82 | + if ($rankID == $userRow['ally_rank_id']) |
|
| 83 | 83 | $ally_range .= " selected"; |
| 84 | 84 | $ally_range .= '>' . $rankArray['name']; |
| 85 | 85 | $ally_range .= '</option>'; |
@@ -93,9 +93,9 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | $last_active = time() - $userRow["onlinetime"]; |
| 96 | - if($user_admin) |
|
| 96 | + if ($user_admin) |
|
| 97 | 97 | { |
| 98 | - if ( $last_active < 60 ) |
|
| 98 | + if ($last_active < 60) |
|
| 99 | 99 | { |
| 100 | 100 | $tmp = "lime>{$lang['On']}"; |
| 101 | 101 | } |
@@ -106,12 +106,12 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | elseif ($last_active < 60 * 60 * 24) |
| 108 | 108 | { |
| 109 | - $last_active = round( $last_active / (60 * 60)); |
|
| 109 | + $last_active = round($last_active / (60 * 60)); |
|
| 110 | 110 | $tmp = "green>{$last_active} {$lang['sys_hrs_short']}"; |
| 111 | 111 | } |
| 112 | 112 | else |
| 113 | 113 | { |
| 114 | - $last_active = round( $last_active / (60 * 60 * 24)); |
|
| 114 | + $last_active = round($last_active / (60 * 60 * 24)); |
|
| 115 | 115 | if ($last_active < 7) |
| 116 | 116 | { |
| 117 | 117 | $tmp = "yellow"; |
@@ -129,9 +129,9 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | else |
| 131 | 131 | { |
| 132 | - if($user_onlinestatus) |
|
| 132 | + if ($user_onlinestatus) |
|
| 133 | 133 | { |
| 134 | - if ( $last_active < 60 * 5 ) |
|
| 134 | + if ($last_active < 60 * 5) |
|
| 135 | 135 | { |
| 136 | 136 | $tmp = "lime>{$lang['On']}"; |
| 137 | 137 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
| 3 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
| 4 | 4 | { |
| 5 | 5 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
| 6 | 6 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | header('Location: alliance.php'); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - if($user_request['request_denied']) |
|
| 23 | + if ($user_request['request_denied']) |
|
| 24 | 24 | { |
| 25 | 25 | $lang['request_text'] = sprintf($lang['ali_req_deny_msg'], $ally['ally_tag'], $user_request['request_text']); |
| 26 | 26 | } |
@@ -42,12 +42,12 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | $ally = doquery("SELECT * FROM {{alliance}} WHERE `id` ='{$id_ally}'", true); |
| 44 | 44 | |
| 45 | -if(!$ally) |
|
| 45 | +if (!$ally) |
|
| 46 | 46 | { |
| 47 | 47 | message($lang['ali_sys_notFound'], $lang['ali_req_title']); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | -if($ally['ally_request_notallow']) |
|
| 50 | +if ($ally['ally_request_notallow']) |
|
| 51 | 51 | { |
| 52 | 52 | message($lang['ali_req_not_allowed'], $lang['ali_req_title']); |
| 53 | 53 | } |
@@ -115,8 +115,7 @@ |
||
| 115 | 115 | )); |
| 116 | 116 | |
| 117 | 117 | display($template, $lang['tech'][STRUC_MOON_GATE]); |
| 118 | - } |
|
| 119 | - else |
|
| 118 | + } else |
|
| 120 | 119 | { |
| 121 | 120 | message($lang['gate_no_src_ga'], $lang['tech'][STRUC_MOON_GATE], "overview.php", 10); |
| 122 | 121 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
| 3 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
| 4 | 4 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
| 5 | 5 | } |
| 6 | 6 | |
@@ -9,12 +9,12 @@ discard block |
||
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | $d = sys_get_param_id('d'); |
| 12 | -if($d) { |
|
| 12 | +if ($d) { |
|
| 13 | 13 | doquery("UPDATE {{alliance_requests}} SET `request_denied` = 1, `request_text` = '{$lang['ali_req_deny_reason']}' WHERE `id_user`= {$d} LIMIT 1;"); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | $id_user = sys_get_param_id('id_user'); |
| 17 | -if($id_user) { |
|
| 17 | +if ($id_user) { |
|
| 18 | 18 | $ally_name_safe = db_escape($ally['ally_name']); |
| 19 | 19 | $ally_tag_safe = db_escape($ally['ally_tag']); |
| 20 | 20 | db_user_set_by_id($id_user, "`ally_id` = '{$ally['id']}', `ally_name` = '{$ally_name_safe}', `ally_tag` = '{$ally_tag_safe}', `ally_register_time` = " . SN_TIME_NOW . ", `ally_rank_id` = 0"); |
@@ -3,12 +3,12 @@ discard block |
||
| 3 | 3 | { |
| 4 | 4 | $template = gettemplate('universe_rename', true); |
| 5 | 5 | |
| 6 | - if($uni_galaxy < 1 || $uni_galaxy > $config->game_maxGalaxy) |
|
| 6 | + if ($uni_galaxy < 1 || $uni_galaxy > $config->game_maxGalaxy) |
|
| 7 | 7 | { |
| 8 | 8 | throw new exception($lang['uni_msg_error_wrong_galaxy'], ERR_ERROR); |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | - if($uni_system < 0 || $uni_system > $config->game_maxSystem) |
|
| 11 | + if ($uni_system < 0 || $uni_system > $config->game_maxSystem) |
|
| 12 | 12 | { |
| 13 | 13 | throw new exception($lang['uni_msg_error_wrong_system'], ERR_ERROR); |
| 14 | 14 | } |
@@ -17,12 +17,12 @@ discard block |
||
| 17 | 17 | $uni_row['universe_price'] += $uni_system ? $config->uni_price_system : $config->uni_price_galaxy; |
| 18 | 18 | $uni_row['universe_name'] = strip_tags($uni_row['universe_name'] ? $uni_row['universe_name'] : ($uni_system ? "{$lang['sys_system']} [{$uni_galaxy}:{$uni_system}]" : "{$lang['sys_galaxy']} {$uni_galaxy}")); |
| 19 | 19 | |
| 20 | - if(sys_get_param_str('uni_name_submit')) |
|
| 20 | + if (sys_get_param_str('uni_name_submit')) |
|
| 21 | 21 | { |
| 22 | 22 | $uni_row['universe_name'] = strip_tags(sys_get_param_str('uni_name')); |
| 23 | 23 | |
| 24 | 24 | $uni_price = sys_get_param_float('uni_price'); |
| 25 | - if($uni_price < $uni_row['universe_price']) |
|
| 25 | + if ($uni_price < $uni_row['universe_price']) |
|
| 26 | 26 | { |
| 27 | 27 | throw new exception($lang['uni_msg_error_low_price'], ERR_ERROR); |
| 28 | 28 | } |
@@ -31,12 +31,12 @@ discard block |
||
| 31 | 31 | sn_db_transaction_start(); |
| 32 | 32 | $user = db_user_by_id($user['id'], true); |
| 33 | 33 | // if($user[get_unit_param(RES_DARK_MATTER, P_NAME)] < $uni_price) |
| 34 | - if(mrc_get_level($user, null, RES_DARK_MATTER) < $uni_price) |
|
| 34 | + if (mrc_get_level($user, null, RES_DARK_MATTER) < $uni_price) |
|
| 35 | 35 | { |
| 36 | 36 | throw new exception($lang['uni_msg_error_no_dm'], ERR_ERROR); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - if(!rpg_points_change($user['id'], RPG_RENAME, -$uni_price, "Renaming [{$uni_galaxy}:{$uni_system}] to " . sys_get_param_str_unsafe('uni_name'))) |
|
| 39 | + if (!rpg_points_change($user['id'], RPG_RENAME, -$uni_price, "Renaming [{$uni_galaxy}:{$uni_system}] to " . sys_get_param_str_unsafe('uni_name'))) |
|
| 40 | 40 | { |
| 41 | 41 | throw new exception($lang['sys_msg_err_update_dm'], ERR_ERROR); |
| 42 | 42 | } |
@@ -46,8 +46,7 @@ |
||
| 46 | 46 | sn_db_transaction_commit(); |
| 47 | 47 | sys_redirect("galaxy.php?mode=name&galaxy={$uni_galaxy}&system={$uni_system}"); |
| 48 | 48 | } |
| 49 | - } |
|
| 50 | - catch (exception $e) |
|
| 49 | + } catch (exception $e) |
|
| 51 | 50 | { |
| 52 | 51 | sn_db_transaction_rollback(); |
| 53 | 52 | $template->assign_block_vars('result', array( |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if(!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) { |
|
| 3 | +if (!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) { |
|
| 4 | 4 | $debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403); |
| 5 | 5 | } |
| 6 | 6 | |
@@ -12,8 +12,8 @@ discard block |
||
| 12 | 12 | 'rpg_cost' => $rpg_cost, |
| 13 | 13 | )); |
| 14 | 14 | |
| 15 | -if(is_array($shipList)) { |
|
| 16 | - if(mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) { |
|
| 15 | +if (is_array($shipList)) { |
|
| 16 | + if (mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) { |
|
| 17 | 17 | $intError = MARKET_NO_DM; |
| 18 | 18 | } |
| 19 | 19 | |
@@ -30,30 +30,30 @@ discard block |
||
| 30 | 30 | $qry = array(); |
| 31 | 31 | $total = array(); |
| 32 | 32 | $db_changeset = array(); |
| 33 | - foreach($shipList as $shipID => &$shipCount) { |
|
| 33 | + foreach ($shipList as $shipID => &$shipCount) { |
|
| 34 | 34 | $shipCount = ceil(floatval($shipCount)); |
| 35 | - if(!$shipCount) { |
|
| 35 | + if (!$shipCount) { |
|
| 36 | 36 | continue; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - if($shipCount < 0) { |
|
| 39 | + if ($shipCount < 0) { |
|
| 40 | 40 | $debug->warning('User supplied negative ship count on Black Market page', 'Hack Attempt', 307); |
| 41 | 41 | $intError = MARKET_NEGATIVE_SHIPS; |
| 42 | 42 | break; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - if($mode == MARKET_SCRAPPER) { |
|
| 45 | + if ($mode == MARKET_SCRAPPER) { |
|
| 46 | 46 | $amount = mrc_get_level($user, $planetrow, $shipID, true, true); // $planetrow[get_unit_param($shipID, P_NAME)]; |
| 47 | - } elseif($mode == MARKET_STOCKMAN) { |
|
| 47 | + } elseif ($mode == MARKET_STOCKMAN) { |
|
| 48 | 48 | $amount = $stock[$shipID]; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - if($amount < $shipCount) { |
|
| 51 | + if ($amount < $shipCount) { |
|
| 52 | 52 | $intError = $error_no_stock; |
| 53 | 53 | break; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - if(!in_array($shipID, sn_get_groups('fleet'))) { |
|
| 56 | + if (!in_array($shipID, sn_get_groups('fleet'))) { |
|
| 57 | 57 | $debug->warning('Hack Attempt', 'User supplied non-ship unit ID on Black Market page', 306); |
| 58 | 58 | $intError = MARKET_NOT_A_SHIP; |
| 59 | 59 | break; |
@@ -69,16 +69,16 @@ discard block |
||
| 69 | 69 | $resTemp[RES_CRYSTAL] = floor($build_data[BUILD_CREATE][RES_CRYSTAL] * $shipCount * $config_rpg_scrape_crystal * (-$multiplier)); |
| 70 | 70 | $resTemp[RES_DEUTERIUM] = floor($build_data[BUILD_CREATE][RES_DEUTERIUM] * $shipCount * $config_rpg_scrape_deuterium * (-$multiplier)); |
| 71 | 71 | |
| 72 | - foreach($resTemp as $resID => $resCount) { |
|
| 72 | + foreach ($resTemp as $resID => $resCount) { |
|
| 73 | 73 | $total[$resID] += $resCount; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | $message .= "<li>{$lang['tech'][$shipID]}: " . pretty_number($shipCount); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - if($mode == MARKET_STOCKMAN && $intError == MARKET_DEAL) { |
|
| 80 | - foreach($total as $resID => $resCount) { |
|
| 81 | - if(mrc_get_level($user, $planetrow, $resID, true, true) < -$resCount) { |
|
| 79 | + if ($mode == MARKET_STOCKMAN && $intError == MARKET_DEAL) { |
|
| 80 | + foreach ($total as $resID => $resCount) { |
|
| 81 | + if (mrc_get_level($user, $planetrow, $resID, true, true) < -$resCount) { |
|
| 82 | 82 | $intError = MARKET_NO_RESOURCES; |
| 83 | 83 | $debug->warning('Trying to use bug in s/h market', 'S/H Ship Market', 301); |
| 84 | 84 | break; |
@@ -88,10 +88,10 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | $intError = ($intError == MARKET_DEAL) && (array_sum($total) == 0) ? $error_zero_res : $intError; |
| 90 | 90 | |
| 91 | - if($intError == MARKET_DEAL) { |
|
| 91 | + if ($intError == MARKET_DEAL) { |
|
| 92 | 92 | $message .= '</ul>' . $lang["eco_mrk_{$submode}_res"] . '<ul>'; |
| 93 | - foreach($total as $resID => $resCount) { |
|
| 94 | - if(!$resCount) { |
|
| 93 | + foreach ($total as $resID => $resCount) { |
|
| 94 | + if (!$resCount) { |
|
| 95 | 95 | continue; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -125,38 +125,38 @@ discard block |
||
| 125 | 125 | 'MESSAGE' => $lang['eco_mrk_errors'][$intError], |
| 126 | 126 | )); |
| 127 | 127 | |
| 128 | - foreach($shipList as $shipID => $shipCount) { |
|
| 128 | + foreach ($shipList as $shipID => $shipCount) { |
|
| 129 | 129 | $data['ships'][$shipID] = max(0, intval($shipCount)); |
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | $message = ''; |
| 134 | 134 | |
| 135 | -if(!$config->eco_stockman_fleet && $config->eco_stockman_fleet_populate) { |
|
| 136 | - $config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item){return mt_rand(1, 1000);}, sn_get_groups('fleet')))); |
|
| 135 | +if (!$config->eco_stockman_fleet && $config->eco_stockman_fleet_populate) { |
|
| 136 | + $config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item) {return mt_rand(1, 1000); }, sn_get_groups('fleet')))); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | tpl_set_resource_info($template, $planetrow, array()); |
| 140 | 140 | |
| 141 | -if(!$array) { |
|
| 141 | +if (!$array) { |
|
| 142 | 142 | $array = array(); |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | $group_fleet = sn_get_groups('fleet'); |
| 146 | -foreach($array as $key => $value) { |
|
| 147 | - if($mode == MARKET_SCRAPPER) { |
|
| 146 | +foreach ($array as $key => $value) { |
|
| 147 | + if ($mode == MARKET_SCRAPPER) { |
|
| 148 | 148 | $shipID = $value; |
| 149 | 149 | $amount = mrc_get_level($user, $planetrow, $shipID, false, true); // $planetrow[get_unit_param($shipID, P_NAME)]; |
| 150 | - } elseif($mode == MARKET_STOCKMAN) { |
|
| 150 | + } elseif ($mode == MARKET_STOCKMAN) { |
|
| 151 | 151 | $shipID = $key; |
| 152 | 152 | $amount = $value; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - if(!in_array($shipID, $group_fleet)) { |
|
| 155 | + if (!in_array($shipID, $group_fleet)) { |
|
| 156 | 156 | continue; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - if($amount > 0) { |
|
| 159 | + if ($amount > 0) { |
|
| 160 | 160 | $build_data = eco_get_build_data($user, $planetrow, $shipID); |
| 161 | 161 | $template->assign_block_vars('ships', array( |
| 162 | 162 | 'ID' => $shipID, |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | * |
| 13 | 13 | **/ |
| 14 | 14 | |
| 15 | -if(SN_IN_FLEET !== true) { |
|
| 15 | +if (SN_IN_FLEET !== true) { |
|
| 16 | 16 | $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403); |
| 17 | 17 | } |
| 18 | 18 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | $planet_list = array(); |
| 27 | 27 | |
| 28 | - if(is_array($resources_taken)) |
|
| 28 | + if (is_array($resources_taken)) |
|
| 29 | 29 | { |
| 30 | 30 | $query = implode(',', array_keys($resources_taken)); |
| 31 | 31 | $query = " AND `destruyed` = 0 AND `id` IN ({$query})"; |
@@ -33,16 +33,16 @@ discard block |
||
| 33 | 33 | $query = ''; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - foreach(sn_get_groups('flt_transports') as $transport_id) { |
|
| 36 | + foreach (sn_get_groups('flt_transports') as $transport_id) { |
|
| 37 | 37 | $transports[$transport_id] = get_unit_param($transport_id, P_CAPACITY); |
| 38 | 38 | } |
| 39 | 39 | arsort($transports); |
| 40 | 40 | |
| 41 | 41 | $planets_db_list = db_planet_list_sorted($user, $planetrow['id'], '*', $query); |
| 42 | 42 | !is_array($planets_db_list) ? $planets_db_list = array() : false; |
| 43 | - foreach($planets_db_list as $planet_db_data) { |
|
| 43 | + foreach ($planets_db_list as $planet_db_data) { |
|
| 44 | 44 | // begin planet loop |
| 45 | - if(!$query) { |
|
| 45 | + if (!$query) { |
|
| 46 | 46 | $resources_taken[$planet_db_data['id']] = 1; |
| 47 | 47 | } |
| 48 | 48 | sn_db_transaction_start(); |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | $planet_id = $planet_db_data['id']; |
| 55 | 55 | |
| 56 | 56 | $planet_resources = 0; |
| 57 | - foreach(sn_get_groups('resources_loot') as $resource_id) { |
|
| 58 | - if($resources_taken[$planet_id] == 1 || $resources_taken[$planet_id][$resource_id]) { |
|
| 57 | + foreach (sn_get_groups('resources_loot') as $resource_id) { |
|
| 58 | + if ($resources_taken[$planet_id] == 1 || $resources_taken[$planet_id][$resource_id]) { |
|
| 59 | 59 | $planet_resources += floor(mrc_get_level($user, $planet_db_data, $resource_id, true, true)); // $planet_db_data[get_unit_param($resource_id, P_NAME)]); |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | $fleet_capacity = 0; |
| 87 | 87 | $ship_loadout = array(); |
| 88 | 88 | $fleet = array(); |
| 89 | - foreach($transports as $ship_id => $ship_capacity) { |
|
| 90 | - if($ship_count = mrc_get_level($user, $planet_db_data, $ship_id, true, true)) { |
|
| 89 | + foreach ($transports as $ship_id => $ship_capacity) { |
|
| 90 | + if ($ship_count = mrc_get_level($user, $planet_db_data, $ship_id, true, true)) { |
|
| 91 | 91 | $ship_loadout[$ship_id]['capacity'] = $ship_count * $ship_capacity; |
| 92 | 92 | $ship_loadout[$ship_id]['taken'] = 0; |
| 93 | 93 | $fleet_capacity += $ship_loadout[$ship_id]['capacity']; |
@@ -98,9 +98,9 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | $will_take = min($planet_resources, $fleet_capacity); |
| 100 | 100 | |
| 101 | - foreach($ship_loadout as $ship_id => &$planet_ship) { |
|
| 101 | + foreach ($ship_loadout as $ship_id => &$planet_ship) { |
|
| 102 | 102 | $can_take = min($will_take, $planet_ship['capacity']); |
| 103 | - if($can_take <= 0) { |
|
| 103 | + if ($can_take <= 0) { |
|
| 104 | 104 | continue; |
| 105 | 105 | } |
| 106 | 106 | $planet_ship['capacity'] -= $can_take; |
@@ -108,23 +108,23 @@ discard block |
||
| 108 | 108 | $fleet[$ship_id] = ceil($planet_ship['taken'] / $transports[$ship_id]); |
| 109 | 109 | |
| 110 | 110 | $will_take -= $can_take; |
| 111 | - if($will_take <= 0) { |
|
| 111 | + if ($will_take <= 0) { |
|
| 112 | 112 | break; |
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - if(!empty($fleet)) { |
|
| 116 | + if (!empty($fleet)) { |
|
| 117 | 117 | $travel_data = flt_travel_data($user, $planetrow, $planet_db_data, $fleet, 10); |
| 118 | 118 | $planet_data['FLEET_SPEED'] = $travel_data['fleet_speed']; |
| 119 | 119 | $planet_data['DISTANCE'] = $travel_data['distance']; |
| 120 | 120 | $planet_data['DURATION'] = $travel_data['duration']; |
| 121 | 121 | $planet_data['CONSUMPTION'] = $travel_data['consumption']; |
| 122 | 122 | |
| 123 | - if(floor(mrc_get_level($user, $planet_db_data, RES_DEUTERIUM, true)) >= $planet_data['CONSUMPTION']) { |
|
| 123 | + if (floor(mrc_get_level($user, $planet_db_data, RES_DEUTERIUM, true)) >= $planet_data['CONSUMPTION']) { |
|
| 124 | 124 | $will_take = min($planet_resources, $fleet_capacity) - $planet_data['CONSUMPTION']; |
| 125 | 125 | |
| 126 | - foreach(sn_get_groups('resources_loot') as $resource_id) { |
|
| 127 | - if($resources_taken[$planet_id] != 1 && !$resources_taken[$planet_id][$resource_id]) { |
|
| 126 | + foreach (sn_get_groups('resources_loot') as $resource_id) { |
|
| 127 | + if ($resources_taken[$planet_id] != 1 && !$resources_taken[$planet_id][$resource_id]) { |
|
| 128 | 128 | continue; |
| 129 | 129 | } |
| 130 | 130 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $fleet[$resource_id] = min($will_take, $resource_amount); |
| 134 | 134 | $will_take -= $resource_amount; |
| 135 | 135 | |
| 136 | - if($will_take <= 0) { |
|
| 136 | + if ($will_take <= 0) { |
|
| 137 | 137 | break; |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -157,19 +157,19 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | $resources_taken = sys_get_param('resources'); |
| 159 | 159 | |
| 160 | -if(!empty($resources_taken)) { // begin processing parameters |
|
| 160 | +if (!empty($resources_taken)) { // begin processing parameters |
|
| 161 | 161 | $planet_list = flt_build_gathering($resources_taken); |
| 162 | 162 | |
| 163 | - foreach($planet_list as $planet_id => $planet_data) { |
|
| 164 | - if($planet_data['RESULT'] == ATTACK_ALLOWED) { |
|
| 163 | + foreach ($planet_list as $planet_id => $planet_data) { |
|
| 164 | + if ($planet_data['RESULT'] == ATTACK_ALLOWED) { |
|
| 165 | 165 | $planet_data['RESULT'] = flt_t_send_fleet($user, $planet_data['PLANET_DB_DATA'], $planetrow, $planet_data['FLEET'], MT_TRANSPORT); |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | $planet_data['MESSAGE'] = $lang['fl_attack_error'][$planet_data['RESULT']]; |
| 169 | 169 | |
| 170 | 170 | $template->assign_block_vars('results', $planet_data); |
| 171 | - if(!empty($planet_data['FLEET']) && $planet_data['RESULT'] == ATTACK_ALLOWED) { |
|
| 172 | - foreach($planet_data['FLEET'] as $unit_id => $amount) { |
|
| 171 | + if (!empty($planet_data['FLEET']) && $planet_data['RESULT'] == ATTACK_ALLOWED) { |
|
| 172 | + foreach ($planet_data['FLEET'] as $unit_id => $amount) { |
|
| 173 | 173 | $template->assign_block_vars('results.units', array( |
| 174 | 174 | 'ID' => $unit_id, |
| 175 | 175 | 'NAME' => $lang['tech'][$unit_id], |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | // Building list of own planets & moons |
| 184 | 184 | $planet_list = flt_build_gathering(); |
| 185 | -foreach($planet_list as $planet_data) { |
|
| 185 | +foreach ($planet_list as $planet_data) { |
|
| 186 | 186 | $planet_data['DURATION'] = $planet_data['DURATION'] ? pretty_time($planet_data['DURATION']) : $lang['flt_no_fuel']; |
| 187 | 187 | $template->assign_block_vars('colonies', $planet_data); |
| 188 | 188 | } |
@@ -79,8 +79,7 @@ |
||
| 79 | 79 | |
| 80 | 80 | sn_db_transaction_commit(); |
| 81 | 81 | throw new Exception($info_action, ERR_NONE); |
| 82 | - } |
|
| 83 | - catch (Exception $e) |
|
| 82 | + } catch (Exception $e) |
|
| 84 | 83 | { |
| 85 | 84 | sn_db_transaction_rollback(); |
| 86 | 85 | |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | global $lang; |
| 4 | 4 | $classLocale = $lang; |
| 5 | 5 | |
| 6 | -if(!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) |
|
| 6 | +if (!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) |
|
| 7 | 7 | { |
| 8 | 8 | $debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403); |
| 9 | 9 | } |
@@ -18,50 +18,50 @@ discard block |
||
| 18 | 18 | )); |
| 19 | 19 | |
| 20 | 20 | $info_action = sys_get_param_int('action'); |
| 21 | -if($info_action) |
|
| 21 | +if ($info_action) |
|
| 22 | 22 | { |
| 23 | 23 | try |
| 24 | 24 | { |
| 25 | 25 | sn_db_transaction_start(); |
| 26 | 26 | |
| 27 | 27 | $user = db_user_by_id($user['id'], true); |
| 28 | - if(mrc_get_level($user, null, RES_DARK_MATTER) < $config->rpg_cost_info) |
|
| 28 | + if (mrc_get_level($user, null, RES_DARK_MATTER) < $config->rpg_cost_info) |
|
| 29 | 29 | { |
| 30 | 30 | throw new Exception(MARKET_NO_DM, ERR_ERROR); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - switch($info_action) |
|
| 33 | + switch ($info_action) |
|
| 34 | 34 | { |
| 35 | 35 | case MARKET_INFO_PLAYER: |
| 36 | 36 | $user_info_name_unsafe = sys_get_param_str_unsafe('user_info_name'); |
| 37 | - if(!$user_info_name_unsafe) |
|
| 37 | + if (!$user_info_name_unsafe) |
|
| 38 | 38 | { |
| 39 | 39 | throw new Exception(MARKET_INFO_PLAYER_WRONG, ERR_ERROR); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - if(is_id($user_info_name_unsafe)) |
|
| 42 | + if (is_id($user_info_name_unsafe)) |
|
| 43 | 43 | { |
| 44 | 44 | $user_info = db_user_by_id($user_info_name_unsafe, true, '`id`, `username`', true); |
| 45 | 45 | } |
| 46 | - if(!is_array($user_info)) |
|
| 46 | + if (!is_array($user_info)) |
|
| 47 | 47 | { |
| 48 | 48 | $user_info = db_user_by_username($user_info_name_unsafe, true, '`id`, `username`', true, true); |
| 49 | 49 | } |
| 50 | - if(!is_array($user_info)) |
|
| 50 | + if (!is_array($user_info)) |
|
| 51 | 51 | { |
| 52 | 52 | throw new Exception(MARKET_INFO_PLAYER_NOT_FOUND, ERR_ERROR); |
| 53 | 53 | } |
| 54 | - if($user_info['id'] == $user['id']) |
|
| 54 | + if ($user_info['id'] == $user['id']) |
|
| 55 | 55 | { |
| 56 | 56 | throw new Exception(MARKET_INFO_PLAYER_SAME, ERR_ERROR); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | $msg_text = array(); |
| 60 | - foreach(sn_get_groups('mercenaries') as $mercenary_id) |
|
| 60 | + foreach (sn_get_groups('mercenaries') as $mercenary_id) |
|
| 61 | 61 | { |
| 62 | 62 | $msg_text[] = "{$classLocale['tech'][$mercenary_id]} - " . (($mercenary_level = mrc_get_level($user_info, false, $mercenary_id)) ? "{$classLocale['sys_level']} {$mercenary_level}" : classLocale::$lang['eco_mrk_info_not_hired']); |
| 63 | 63 | } |
| 64 | - if($mercenary_level = mrc_get_level($user_info, false, UNIT_PREMIUM)) |
|
| 64 | + if ($mercenary_level = mrc_get_level($user_info, false, UNIT_PREMIUM)) |
|
| 65 | 65 | { |
| 66 | 66 | $msg_text[] = "{$classLocale['tech'][UNIT_PREMIUM]} - {$mercenary_level} {$classLocale['sys_level']}"; |
| 67 | 67 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | break; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - if(!rpg_points_change($user['id'], RPG_MARKET_INFO_MERCENARY, -$config->rpg_cost_info, "Using Black Market page {$classLocale['eco_mrk_info']} - getting info about user ID {$user_info['id']}")) |
|
| 78 | + if (!rpg_points_change($user['id'], RPG_MARKET_INFO_MERCENARY, -$config->rpg_cost_info, "Using Black Market page {$classLocale['eco_mrk_info']} - getting info about user ID {$user_info['id']}")) |
|
| 79 | 79 | { |
| 80 | 80 | // TODO: throw new Exception(MARKET_INFO_PLAYER_SAME, ERR_ERROR); |
| 81 | 81 | } |