@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | function sys_user_vacation($user) { |
| 13 | 13 | global $config; |
| 14 | 14 | |
| 15 | - if(sys_get_param_str('vacation') == 'leave') { |
|
| 15 | + if (sys_get_param_str('vacation') == 'leave') { |
|
| 16 | 16 | if ($user['vacation'] < SN_TIME_NOW) { |
| 17 | 17 | $user['vacation'] = 0; |
| 18 | 18 | $user['vacation_next'] = SN_TIME_NOW + $config->player_vacation_timeout; |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - if($user['vacation']) { |
|
| 23 | + if ($user['vacation']) { |
|
| 24 | 24 | // sn_sys_logout(false, true); |
| 25 | 25 | // core_auth::logout(false, true); |
| 26 | 26 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | \DBAL\DbQuery::build()->setTable('users')->setValues($field_set)->doInsert(); |
| 164 | 164 | $user_new = db_user_by_id(SN::$db->db_insert_id()); |
| 165 | 165 | |
| 166 | - if(!($options['galaxy'] && $options['system'] && $options['planet'])) { |
|
| 166 | + if (!($options['galaxy'] && $options['system'] && $options['planet'])) { |
|
| 167 | 167 | $options['galaxy'] = SN::$config->LastSettedGalaxyPos; |
| 168 | 168 | $options['system'] = SN::$config->LastSettedSystemPos; |
| 169 | 169 | $segment_size = floor(SN::$config->game_maxPlanet / 3); |
@@ -171,19 +171,19 @@ discard block |
||
| 171 | 171 | $segment++; |
| 172 | 172 | $options['planet'] = mt_rand(1 + $segment * $segment_size, ($segment + 1) * $segment_size); |
| 173 | 173 | |
| 174 | - while(true) { |
|
| 175 | - if($options['planet'] > SN::$config->game_maxPlanet) { |
|
| 174 | + while (true) { |
|
| 175 | + if ($options['planet'] > SN::$config->game_maxPlanet) { |
|
| 176 | 176 | $options['planet'] = mt_rand(0, $segment_size - 1) + 1; |
| 177 | 177 | $options['system']++; |
| 178 | 178 | } |
| 179 | - if($options['system'] > SN::$config->game_maxSystem) { |
|
| 179 | + if ($options['system'] > SN::$config->game_maxSystem) { |
|
| 180 | 180 | $options['system'] = 1; |
| 181 | 181 | $options['galaxy']++; |
| 182 | 182 | } |
| 183 | 183 | $options['galaxy'] > SN::$config->game_maxGalaxy ? $options['galaxy'] = 1 : false; |
| 184 | 184 | |
| 185 | 185 | $galaxy_row = DBStaticPlanet::db_planet_by_gspt($options['galaxy'], $options['system'], $options['planet'], PT_PLANET, true, 'id'); |
| 186 | - if(!$galaxy_row['id']) { |
|
| 186 | + if (!$galaxy_row['id']) { |
|
| 187 | 187 | SN::$config->db_saveItem(array( |
| 188 | 188 | 'LastSettedGalaxyPos' => $options['galaxy'], |
| 189 | 189 | 'LastSettedSystemPos' => $options['system'], |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | $username_safe = SN::$db->db_escape($username_unsafe); |
| 205 | 205 | doquery("REPLACE INTO `{{player_name_history}}` SET `player_id` = {$user_new['id']}, `player_name` = '{$username_safe}'"); |
| 206 | 206 | |
| 207 | - if(!empty($options['partner_id']) && ($referral_row = db_user_by_id($options['partner_id'], true))) { |
|
| 207 | + if (!empty($options['partner_id']) && ($referral_row = db_user_by_id($options['partner_id'], true))) { |
|
| 208 | 208 | doquery("INSERT INTO `{{referrals}}` SET `id` = {$user_new['id']}, `id_partner` = {$options['partner_id']}"); |
| 209 | 209 | } |
| 210 | 210 | |
@@ -32,28 +32,28 @@ discard block |
||
| 32 | 32 | function rpg_points_change($user_id, $change_type, $dark_matter, $comment = false, $already_changed = false) { |
| 33 | 33 | global $debug, $config, $dm_change_legit, $user; |
| 34 | 34 | |
| 35 | - if(!$user_id) { |
|
| 35 | + if (!$user_id) { |
|
| 36 | 36 | return false; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | $dm_change_legit = true; |
| 40 | 40 | $sn_data_dark_matter_db_name = pname_resource_name(RES_DARK_MATTER); |
| 41 | 41 | |
| 42 | - if($already_changed) { |
|
| 42 | + if ($already_changed) { |
|
| 43 | 43 | $rows_affected = 1; |
| 44 | 44 | } else { |
| 45 | 45 | $changeset = array(); |
| 46 | 46 | $a_user = db_user_by_id($user_id, true); |
| 47 | - if($dark_matter < 0) { |
|
| 47 | + if ($dark_matter < 0) { |
|
| 48 | 48 | $dark_matter_exists = mrc_get_level($a_user, null, RES_DARK_MATTER, false, true); |
| 49 | 49 | $dark_matter_exists < 0 ? $dark_matter_exists = 0 : false; |
| 50 | 50 | $metamatter_to_reduce = -$dark_matter - $dark_matter_exists; |
| 51 | - if($metamatter_to_reduce > 0) { |
|
| 51 | + if ($metamatter_to_reduce > 0) { |
|
| 52 | 52 | $metamatter_exists = mrc_get_level($a_user, null, RES_METAMATTER); |
| 53 | - if($metamatter_exists < $metamatter_to_reduce) { |
|
| 53 | + if ($metamatter_exists < $metamatter_to_reduce) { |
|
| 54 | 54 | $debug->error('Ошибка снятия ТМ - ММ+ТМ меньше, чем сумма для снятия!', 'Ошибка снятия ТМ', LOG_ERR_INT_NOT_ENOUGH_DARK_MATTER); |
| 55 | 55 | } |
| 56 | - if(is_array($comment)) { |
|
| 56 | + if (is_array($comment)) { |
|
| 57 | 57 | $comment = call_user_func_array('sprintf', $comment); |
| 58 | 58 | } |
| 59 | 59 | // mm_points_change($user_id, $change_type, -$metamatter_to_reduce, 'ММ в ТМ: ' . (-$dark_matter) . ' ТМ = ' . $dark_matter_exists . ' ТМ + ' . $metamatter_to_reduce . ' ММ. ' . $comment); |
@@ -68,9 +68,9 @@ discard block |
||
| 68 | 68 | $rows_affected = SN::$db->db_affected_rows(); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if($rows_affected || !$dark_matter) { |
|
| 71 | + if ($rows_affected || !$dark_matter) { |
|
| 72 | 72 | $page_url = SN::$db->db_escape($_SERVER['SCRIPT_NAME']); |
| 73 | - if(is_array($comment)) { |
|
| 73 | + if (is_array($comment)) { |
|
| 74 | 74 | $comment = call_user_func_array('sprintf', $comment); |
| 75 | 75 | } |
| 76 | 76 | $comment = SN::$db->db_escape($comment); |
@@ -84,18 +84,18 @@ discard block |
||
| 84 | 84 | {$dark_matter}, '{$comment}', '{$page_url}', {$user_id} |
| 85 | 85 | );"); |
| 86 | 86 | |
| 87 | - if($user['id'] == $user_id) { |
|
| 87 | + if ($user['id'] == $user_id) { |
|
| 88 | 88 | $user['dark_matter'] += $dark_matter; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - if($dark_matter > 0) { |
|
| 91 | + if ($dark_matter > 0) { |
|
| 92 | 92 | $old_referral = doquery("SELECT * FROM {{referrals}} WHERE `id` = {$user_id} LIMIT 1 FOR UPDATE;", '', true); |
| 93 | - if($old_referral['id']) { |
|
| 93 | + if ($old_referral['id']) { |
|
| 94 | 94 | doquery("UPDATE {{referrals}} SET dark_matter = dark_matter + '{$dark_matter}' WHERE `id` = {$user_id} LIMIT 1;"); |
| 95 | 95 | $new_referral = doquery("SELECT * FROM {{referrals}} WHERE `id` = {$user_id} LIMIT 1;", '', true); |
| 96 | 96 | |
| 97 | 97 | $partner_bonus = floor($new_referral['dark_matter'] / $config->rpg_bonus_divisor) - ($old_referral['dark_matter'] >= $config->rpg_bonus_minimum ? floor($old_referral['dark_matter'] / $config->rpg_bonus_divisor) : 0); |
| 98 | - if($partner_bonus > 0 && $new_referral['dark_matter'] >= $config->rpg_bonus_minimum) { |
|
| 98 | + if ($partner_bonus > 0 && $new_referral['dark_matter'] >= $config->rpg_bonus_minimum) { |
|
| 99 | 99 | rpg_points_change($new_referral['id_partner'], RPG_REFERRAL, $partner_bonus, "Incoming From Referral ID {$user_id}"); |
| 100 | 100 | } |
| 101 | 101 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | { |
| 113 | 113 | $q = 1.03; |
| 114 | 114 | |
| 115 | - switch($type) |
|
| 115 | + switch ($type) |
|
| 116 | 116 | { |
| 117 | 117 | case RPG_STRUCTURE: |
| 118 | 118 | $field_level = 'lvl_minier'; |
@@ -150,19 +150,19 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | $xp = &$user[$field_xp]; |
| 152 | 152 | |
| 153 | - if($xp_to_add) |
|
| 153 | + if ($xp_to_add) |
|
| 154 | 154 | { |
| 155 | 155 | $xp += $xp_to_add; |
| 156 | 156 | db_user_set_by_id($user['id'], "`{$field_xp}` = `{$field_xp}` + '{$xp_to_add}'"); |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | $level = $user[$field_level]; |
| 160 | - while($xp > rpg_xp_for_level($level + 1, $b1, $q)) |
|
| 160 | + while ($xp > rpg_xp_for_level($level + 1, $b1, $q)) |
|
| 161 | 161 | { |
| 162 | 162 | $level++; |
| 163 | 163 | } |
| 164 | 164 | $level -= $user[$field_level]; |
| 165 | - if($level > 0) |
|
| 165 | + if ($level > 0) |
|
| 166 | 166 | { |
| 167 | 167 | db_user_set_by_id($user['id'], "`{$field_level}` = `{$field_level}` + '{$level}'"); |
| 168 | 168 | rpg_points_change($user['id'], $type, $level * 1000, $comment); |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | |
| 173 | 173 | function rpg_xp_for_level($level, $b1, $q) |
| 174 | 174 | { |
| 175 | - return floor($b1 * (pow($q, $level) - 1)/($q - 1)); |
|
| 175 | + return floor($b1 * (pow($q, $level) - 1) / ($q - 1)); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | function rpg_get_miner_xp($level) |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | "ally_id = '{$ally_id}'" . ($ally_rank_id >= 0 ? " AND ally_rank_id = {$ally_rank_id}" : ''), |
| 27 | 27 | false, 'id, username'); |
| 28 | 28 | // while ($u = db_fetch($query)) |
| 29 | - foreach($query as $u) |
|
| 29 | + foreach ($query as $u) |
|
| 30 | 30 | { |
| 31 | 31 | $sendList[] = $u['id']; |
| 32 | 32 | $list .= "<br>{$u['username']} "; |
@@ -53,19 +53,19 @@ discard block |
||
| 53 | 53 | { |
| 54 | 54 | global $config, $user, $sn_message_class_list; |
| 55 | 55 | |
| 56 | - if(!$owners) |
|
| 56 | + if (!$owners) |
|
| 57 | 57 | { |
| 58 | 58 | return; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | $timestamp = $timestamp ? $timestamp : SN_TIME_NOW; |
| 62 | 62 | $sender = intval($sender); |
| 63 | - if(!is_array($owners)) |
|
| 63 | + if (!is_array($owners)) |
|
| 64 | 64 | { |
| 65 | 65 | $owners = array($owners); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - if($escaped == STRING_NEED_ESCAPING) |
|
| 68 | + if ($escaped == STRING_NEED_ESCAPING) |
|
| 69 | 69 | { |
| 70 | 70 | $from = SN::$db->db_escape($from); |
| 71 | 71 | $subject = SN::$db->db_escape($subject); |
@@ -81,9 +81,9 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | $message_class_name_total = $sn_message_class_list[MSG_TYPE_NEW]['name']; |
| 83 | 83 | |
| 84 | - if($owners[0] == '*') |
|
| 84 | + if ($owners[0] == '*') |
|
| 85 | 85 | { |
| 86 | - if($user['authlevel'] < 3) |
|
| 86 | + if ($user['authlevel'] < 3) |
|
| 87 | 87 | { |
| 88 | 88 | return false; |
| 89 | 89 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | foreach ($owners as $owner) |
| 101 | 101 | { |
| 102 | - if($user['id'] != $owner) |
|
| 102 | + if ($user['id'] != $owner) |
|
| 103 | 103 | { |
| 104 | 104 | $owner_row = db_user_by_id($owner); |
| 105 | 105 | } |
@@ -109,14 +109,14 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | sys_user_options_unpack($owner_row); |
| 111 | 111 | |
| 112 | - if($force || !$message_class_switchable || $owner_row["opt_{$message_class_name}"]) |
|
| 112 | + if ($force || !$message_class_switchable || $owner_row["opt_{$message_class_name}"]) |
|
| 113 | 113 | { |
| 114 | 114 | $insert_values[] = sprintf($insert_template, $owner); |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - if($message_class_email && $config->game_email_pm && $owner_row["opt_email_{$message_class_name}"]) |
|
| 117 | + if ($message_class_email && $config->game_email_pm && $owner_row["opt_email_{$message_class_name}"]) |
|
| 118 | 118 | { |
| 119 | - if($message_type == MSG_TYPE_SPY) { |
|
| 119 | + if ($message_type == MSG_TYPE_SPY) { |
|
| 120 | 120 | @$result = mymail($owner_row['email'], $subject, SN::$lang['sys_spy_activity'], '', true); |
| 121 | 121 | } else { |
| 122 | 122 | @$result = mymail($owner_row['email'], $subject, $text_unescaped, '', true); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - if(empty($insert_values)) |
|
| 127 | + if (empty($insert_values)) |
|
| 128 | 128 | { |
| 129 | 129 | return; |
| 130 | 130 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | } |
| 135 | 135 | db_user_list_set_mass_mail($owners, "`{$message_class_name}` = `{$message_class_name}` + 1, `{$message_class_name_total}` = `{$message_class_name_total}` + 1"); |
| 136 | 136 | |
| 137 | - if(in_array($user['id'], $owners) || $owners[0] == '*') |
|
| 137 | + if (in_array($user['id'], $owners) || $owners[0] == '*') |
|
| 138 | 138 | { |
| 139 | 139 | $user[$message_class_name]++; |
| 140 | 140 | $user[$message_class_name_total]++; |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | use Player\playerTimeDiff; |
| 10 | 10 | |
| 11 | 11 | // Защита от двойного инита |
| 12 | -if(defined('INIT')) { |
|
| 12 | +if (defined('INIT')) { |
|
| 13 | 13 | return; |
| 14 | 14 | } |
| 15 | 15 | |
@@ -47,8 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | // Detecting if we are under Google's eye - domain is prefixed with `google.` |
| 49 | 49 | $_server_server_name = |
| 50 | - isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : |
|
| 51 | - (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ''); |
|
| 50 | + isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ''); |
|
| 52 | 51 | if (substr(strtolower($_server_server_name), 0, 7) === 'google.') { |
| 53 | 52 | define('SN_GOOGLE', true); |
| 54 | 53 | } else { |
@@ -58,7 +57,7 @@ discard block |
||
| 58 | 57 | // Instancing |
| 59 | 58 | // If server name contains port - replacing : with _ - servers on different ports are different instances |
| 60 | 59 | $instanceName = str_replace(':', '_', $_server_server_name); |
| 61 | -if(SN_GOOGLE) { |
|
| 60 | +if (SN_GOOGLE) { |
|
| 62 | 61 | $instanceName = substr($instanceName, 7); |
| 63 | 62 | } |
| 64 | 63 | $instancePath = 'servers/' . $instanceName . '/'; |
@@ -192,40 +191,40 @@ discard block |
||
| 192 | 191 | // Но нужно, пока у нас есть не MVC-страницы |
| 193 | 192 | $sn_page_data = $sn_mvc['pages'][$sn_page_name]; |
| 194 | 193 | $sn_page_name_file = 'includes/pages/' . $sn_page_data['filename'] . DOT_PHP_EX; |
| 195 | -if($sn_page_name) { |
|
| 194 | +if ($sn_page_name) { |
|
| 196 | 195 | // Merging page options to global option pull |
| 197 | - if(is_array($sn_page_data['options'])) { |
|
| 196 | + if (is_array($sn_page_data['options'])) { |
|
| 198 | 197 | SN::$options = array_merge(SN::$options, $sn_page_data['options']); |
| 199 | 198 | } |
| 200 | 199 | |
| 201 | - if(isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
| 200 | + if (isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
| 202 | 201 | require_once($sn_page_name_file); |
| 203 | 202 | } |
| 204 | 203 | } |
| 205 | 204 | |
| 206 | -if((defined('IN_AJAX') && IN_AJAX === true) || (defined('IN_ADMIN') && IN_ADMIN === true) || (!empty(SN::$options[PAGE_OPTION_ADMIN]))) { |
|
| 205 | +if ((defined('IN_AJAX') && IN_AJAX === true) || (defined('IN_ADMIN') && IN_ADMIN === true) || (!empty(SN::$options[PAGE_OPTION_ADMIN]))) { |
|
| 207 | 206 | SN::$options[PAGE_OPTION_FLEET_UPDATE_SKIP] = true; |
| 208 | 207 | } |
| 209 | 208 | |
| 210 | 209 | |
| 211 | 210 | // А теперь проверяем - поддерживают ли у нас загруженный код такую страницу |
| 212 | 211 | // TODO - костыль, что бы работали старые модули. Убрать! |
| 213 | -if(is_array($sn_data['pages'])) { |
|
| 212 | +if (is_array($sn_data['pages'])) { |
|
| 214 | 213 | $sn_mvc['pages'] = array_merge($sn_mvc['pages'], $sn_data['pages']); |
| 215 | 214 | } |
| 216 | -if(!isset($sn_mvc['pages'][$sn_page_name])) { |
|
| 215 | +if (!isset($sn_mvc['pages'][$sn_page_name])) { |
|
| 217 | 216 | $sn_page_name = ''; |
| 218 | 217 | } |
| 219 | 218 | |
| 220 | 219 | $lang->lng_switch(sys_get_param_str('lang')); |
| 221 | 220 | |
| 222 | 221 | |
| 223 | -if(SN::$config->server_updater_check_auto && SN::$config->server_updater_check_last + SN::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
| 222 | +if (SN::$config->server_updater_check_auto && SN::$config->server_updater_check_last + SN::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
| 224 | 223 | VersionCheckerDeprecated::performCheckVersion(); |
| 225 | 224 | } |
| 226 | 225 | |
| 227 | 226 | SN::$gc->watchdog->register(new TaskDispatchFleets(), TaskDispatchFleets::class); |
| 228 | -SN::$gc->worker->registerWorker('dispatchFleets', function () { |
|
| 227 | +SN::$gc->worker->registerWorker('dispatchFleets', function() { |
|
| 229 | 228 | \Core\Worker::detachIncomingRequest(); |
| 230 | 229 | |
| 231 | 230 | $result = SN::$gc->fleetDispatcher->flt_flying_fleet_handler(); |
@@ -248,16 +247,16 @@ discard block |
||
| 248 | 247 | die(json_encode($result)); |
| 249 | 248 | } |
| 250 | 249 | |
| 251 | -if(SN::$config->user_birthday_gift && SN_TIME_NOW - SN::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
| 250 | +if (SN::$config->user_birthday_gift && SN_TIME_NOW - SN::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
| 252 | 251 | require_once(SN_ROOT_PHYSICAL . 'includes/includes/user_birthday_celebrate.php'); |
| 253 | 252 | sn_user_birthday_celebrate(); |
| 254 | 253 | } |
| 255 | 254 | |
| 256 | -if(!SN::$config->var_online_user_count || SN::$config->var_online_user_time + SN::$config->game_users_update_online < SN_TIME_NOW) { |
|
| 255 | +if (!SN::$config->var_online_user_count || SN::$config->var_online_user_time + SN::$config->game_users_update_online < SN_TIME_NOW) { |
|
| 257 | 256 | dbUpdateUsersCount(db_user_count()); |
| 258 | 257 | dbUpdateUsersOnline(db_user_count(true)); |
| 259 | 258 | SN::$config->pass()->var_online_user_time = SN_TIME_NOW; |
| 260 | - if(SN::$config->server_log_online) { |
|
| 259 | + if (SN::$config->server_log_online) { |
|
| 261 | 260 | /** @noinspection SqlResolve */ |
| 262 | 261 | doquery("INSERT IGNORE INTO `{{log_users_online}}` SET online_count = " . SN::$config->var_online_user_count . ";"); |
| 263 | 262 | } |
@@ -281,7 +280,7 @@ discard block |
||
| 281 | 280 | |
| 282 | 281 | $template_result[F_ACCOUNT_IS_AUTHORIZED] = $sys_user_logged_in = !empty($user) && isset($user['id']) && $user['id']; |
| 283 | 282 | |
| 284 | -if(!empty($user['id'])) { |
|
| 283 | +if (!empty($user['id'])) { |
|
| 285 | 284 | SN::$user_options->user_change($user['id']); |
| 286 | 285 | } |
| 287 | 286 | |
@@ -294,7 +293,7 @@ discard block |
||
| 294 | 293 | : false |
| 295 | 294 | ); |
| 296 | 295 | |
| 297 | -if($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
| 296 | +if ($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
| 298 | 297 | $prohibited_characters = array_map(function($value) { |
| 299 | 298 | return "'" . htmlentities($value, ENT_QUOTES, 'UTF-8') . "'"; |
| 300 | 299 | }, str_split(LOGIN_REGISTER_CHARACTERS_PROHIBITED)); |
@@ -302,7 +301,7 @@ discard block |
||
| 302 | 301 | } |
| 303 | 302 | |
| 304 | 303 | |
| 305 | -if(defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
| 304 | +if (defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
| 306 | 305 | pdump('Отключи отладку перед продакшном!'); |
| 307 | 306 | } |
| 308 | 307 | |
@@ -317,7 +316,7 @@ discard block |
||
| 317 | 316 | // TODO - to scheduler |
| 318 | 317 | StatUpdateLauncher::unlock(); |
| 319 | 318 | |
| 320 | -if($template_result[F_GAME_DISABLE] = SN::$config->game_disable) { |
|
| 319 | +if ($template_result[F_GAME_DISABLE] = SN::$config->game_disable) { |
|
| 321 | 320 | $template_result[F_GAME_DISABLE_REASON] = HelperString::nl2br( |
| 322 | 321 | SN::$config->game_disable == GAME_DISABLE_REASON |
| 323 | 322 | ? SN::$config->game_disable_reason |
@@ -326,33 +325,33 @@ discard block |
||
| 326 | 325 | |
| 327 | 326 | // For API - just skipping all checks |
| 328 | 327 | // TODO: That is ideologically wrong and should be redone |
| 329 | - if(defined('IN_API')) { |
|
| 328 | + if (defined('IN_API')) { |
|
| 330 | 329 | return; |
| 331 | 330 | } |
| 332 | 331 | |
| 333 | 332 | // Actions for install mode |
| 334 | - if(defined('INSTALL_MODE') && INSTALL_MODE) { |
|
| 333 | + if (defined('INSTALL_MODE') && INSTALL_MODE) { |
|
| 335 | 334 | // Handling log out - should work even in install mode |
| 336 | - if(strtolower(INITIAL_PAGE) === 'logout') { |
|
| 335 | + if (strtolower(INITIAL_PAGE) === 'logout') { |
|
| 337 | 336 | SN::$auth->logout(true); |
| 338 | 337 | die(); |
| 339 | 338 | } |
| 340 | 339 | |
| 341 | 340 | // If user not logged in AND we are not on login page - redirect user there |
| 342 | - if(!$sys_user_logged_in && !defined('LOGIN_LOGOUT')) { |
|
| 341 | + if (!$sys_user_logged_in && !defined('LOGIN_LOGOUT')) { |
|
| 343 | 342 | header('Location: login.php'); |
| 344 | 343 | die(); |
| 345 | 344 | } |
| 346 | 345 | |
| 347 | 346 | // If user is type of admin AND in user pages - redirecting him to admin interface |
| 348 | 347 | // You really shouldn't mess in user interface until game not configured! |
| 349 | - if($user['authlevel'] >= 1 && !defined('IN_ADMIN')) { |
|
| 348 | + if ($user['authlevel'] >= 1 && !defined('IN_ADMIN')) { |
|
| 350 | 349 | header('Location: ' . SN_ROOT_VIRTUAL_PARENT . 'admin/overview.php'); |
| 351 | 350 | die(); |
| 352 | 351 | } |
| 353 | 352 | } |
| 354 | 353 | |
| 355 | - if( |
|
| 354 | + if ( |
|
| 356 | 355 | ($user['authlevel'] < 1 || !(defined('IN_ADMIN') && IN_ADMIN)) |
| 357 | 356 | && |
| 358 | 357 | !(defined('INSTALL_MODE') && defined('LOGIN_LOGOUT')) |
@@ -368,8 +367,8 @@ discard block |
||
| 368 | 367 | // TODO ban |
| 369 | 368 | // TODO $skip_ban_check |
| 370 | 369 | global $skip_ban_check; |
| 371 | -if($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
| 372 | - if(defined('IN_API')) { |
|
| 370 | +if ($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
| 371 | + if (defined('IN_API')) { |
|
| 373 | 372 | return; |
| 374 | 373 | } |
| 375 | 374 | |
@@ -383,10 +382,10 @@ discard block |
||
| 383 | 382 | $allow_anonymous = $allow_anonymous || (isset($sn_page_data['allow_anonymous']) && $sn_page_data['allow_anonymous']); |
| 384 | 383 | |
| 385 | 384 | |
| 386 | -if($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
| 385 | +if ($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
| 387 | 386 | sys_redirect(SN_ROOT_VIRTUAL . 'overview.php'); |
| 388 | -} elseif($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
| 389 | -} elseif(!$allow_anonymous && !$sys_user_logged_in) { |
|
| 387 | +} elseif ($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
| 388 | +} elseif (!$allow_anonymous && !$sys_user_logged_in) { |
|
| 390 | 389 | sys_redirect(SN_ROOT_VIRTUAL . 'login.php'); |
| 391 | 390 | } |
| 392 | 391 | |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | * @copyright 2008-2015 Gorlum for Project "SuperNova.WS" |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | -if(!defined('INSIDE')) { |
|
| 8 | +if (!defined('INSIDE')) { |
|
| 9 | 9 | die(); |
| 10 | 10 | } |
| 11 | 11 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | function db_change_units_perform($query, $tablename, $object_id) { |
| 15 | 15 | $query = implode(',', $query); |
| 16 | - if($query && $object_id) { |
|
| 16 | + if ($query && $object_id) { |
|
| 17 | 17 | return SN::db_upd_record_by_id($tablename == 'users' ? LOC_USER : LOC_PLANET, $object_id, $query); |
| 18 | 18 | } |
| 19 | 19 | |
@@ -31,15 +31,15 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | $group = sn_get_groups('resources_loot'); |
| 33 | 33 | |
| 34 | - foreach($unit_list as $unit_id => $unit_amount) { |
|
| 35 | - if(!in_array($unit_id, $group)) { |
|
| 34 | + foreach ($unit_list as $unit_id => $unit_amount) { |
|
| 35 | + if (!in_array($unit_id, $group)) { |
|
| 36 | 36 | // TODO - remove later |
| 37 | 37 | print('<h1>СООБЩИТЕ ЭТО АДМИНУ: db_change_units() вызван для не-ресурсов!</h1>'); |
| 38 | 38 | pdump(debug_backtrace()); |
| 39 | 39 | die('db_change_units() вызван для не-ресурсов!'); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - if(!$unit_amount) { |
|
| 42 | + if (!$unit_amount) { |
|
| 43 | 43 | continue; |
| 44 | 44 | } |
| 45 | 45 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $unit_location = sys_get_unit_location($user, $planet, $unit_id); |
| 49 | 49 | |
| 50 | 50 | // Changing value in object |
| 51 | - switch($unit_location) { |
|
| 51 | + switch ($unit_location) { |
|
| 52 | 52 | case LOC_USER: |
| 53 | 53 | $user[$unit_db_name] += $unit_amount; |
| 54 | 54 | break; |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * @deprecated |
| 76 | 76 | */ |
| 77 | 77 | function doquery($query, $table = '', $fetch = false, $skip_query_check = false) { |
| 78 | - if(is_bool($table) || !is_string($table)) { |
|
| 78 | + if (is_bool($table) || !is_string($table)) { |
|
| 79 | 79 | $fetch = $table; |
| 80 | 80 | } |
| 81 | 81 | return SN::$db->doquery($query, $fetch, $skip_query_check); |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if((!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) && (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)) { |
|
| 3 | +if ((!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) && (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)) { |
|
| 4 | 4 | $debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403); |
| 5 | 5 | } |
| 6 | 6 | |
@@ -27,12 +27,12 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | // $dm_db_name = pname_resource_name(RES_DARK_MATTER); |
| 29 | 29 | $exchangeTo = in_array($exchangeTo = sys_get_param_int('exchangeTo'), sn_get_groups('resources_trader')) ? $exchangeTo : 0; |
| 30 | - if($exchangeTo && is_array($tradeList = $_POST['spend'])) { |
|
| 30 | + if ($exchangeTo && is_array($tradeList = $_POST['spend'])) { |
|
| 31 | 31 | $value = 0; |
| 32 | 32 | $qry = array(); |
| 33 | 33 | |
| 34 | 34 | SN::db_transaction_start(); |
| 35 | - if($planetrow['id_owner']) { |
|
| 35 | + if ($planetrow['id_owner']) { |
|
| 36 | 36 | $global_data = sys_o_get_updated($user, $planetrow, SN_TIME_NOW); |
| 37 | 37 | $planetrow = $global_data['planet']; |
| 38 | 38 | } |
@@ -41,27 +41,27 @@ discard block |
||
| 41 | 41 | $user = db_user_by_id($user['id'], true); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - foreach(sn_get_groups('resources_trader') as $resource_id) { |
|
| 44 | + foreach (sn_get_groups('resources_trader') as $resource_id) { |
|
| 45 | 45 | $amount = floatval($tradeList[$resource_id]); |
| 46 | - if($amount < 0) { |
|
| 46 | + if ($amount < 0) { |
|
| 47 | 47 | $debug->error('Trying to supply negative resource amount on Black Market Page', 'Hack Attempt', 305); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - if($resource_id == RES_DARK_MATTER && $exchangeTo == RES_DARK_MATTER) { |
|
| 50 | + if ($resource_id == RES_DARK_MATTER && $exchangeTo == RES_DARK_MATTER) { |
|
| 51 | 51 | continue; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | $resource_db_name = pname_resource_name($resource_id); |
| 55 | - if($exchangeTo == RES_DARK_MATTER) { |
|
| 55 | + if ($exchangeTo == RES_DARK_MATTER) { |
|
| 56 | 56 | $sign = '+'; |
| 57 | 57 | $amount = floor($tradeList[RES_DARK_MATTER] / 3 * $rates[RES_DARK_MATTER] / $rates[$resource_id]); |
| 58 | 58 | $value += $amount; |
| 59 | 59 | } else { |
| 60 | 60 | $value += floor($amount * $rates[$resource_id] / $rates[$exchangeTo]); |
| 61 | - if($resource_id == RES_DARK_MATTER) { |
|
| 61 | + if ($resource_id == RES_DARK_MATTER) { |
|
| 62 | 62 | $amount = 0; |
| 63 | 63 | } else { |
| 64 | - if(mrc_get_level($user, $planetrow, $resource_id, true) < $amount) { |
|
| 64 | + if (mrc_get_level($user, $planetrow, $resource_id, true) < $amount) { |
|
| 65 | 65 | $intError = MARKET_NO_RESOURCES; |
| 66 | 66 | break; |
| 67 | 67 | } |
@@ -70,12 +70,12 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if($amount) { |
|
| 73 | + if ($amount) { |
|
| 74 | 74 | $qry[] = "`{$resource_db_name}` = `{$resource_db_name}` {$sign} {$amount}"; |
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - if($exchangeTo != RES_DARK_MATTER) { |
|
| 78 | + if ($exchangeTo != RES_DARK_MATTER) { |
|
| 79 | 79 | $amount = floor($value); |
| 80 | 80 | $exchange_to_db_name = pname_resource_name($exchangeTo); |
| 81 | 81 | $qry[] = "`{$exchange_to_db_name}` = `{$exchange_to_db_name}` + {$amount}"; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | $intError = $value <= 0 ? MARKET_ZERO_DEAL : $intError; |
| 87 | 87 | $intError = mrc_get_level($user, null, RES_DARK_MATTER) < $operation_cost ? MARKET_NO_DM : $intError; |
| 88 | 88 | |
| 89 | - if($intError == MARKET_DEAL) { |
|
| 89 | + if ($intError == MARKET_DEAL) { |
|
| 90 | 90 | $qry = implode(', ', $qry); |
| 91 | 91 | $table = $planetrow['id_owner'] ? 'planets' : 'users'; |
| 92 | 92 | |
@@ -109,8 +109,8 @@ discard block |
||
| 109 | 109 | 'EXCHANGE_TO_RESOURCE_ID' => $exchangeTo, |
| 110 | 110 | )); |
| 111 | 111 | |
| 112 | - foreach(sn_get_groups('resources_trader') as $resource_id) { |
|
| 113 | - if($resource_id == RES_DARK_MATTER) { |
|
| 112 | + foreach (sn_get_groups('resources_trader') as $resource_id) { |
|
| 113 | + if ($resource_id == RES_DARK_MATTER) { |
|
| 114 | 114 | $amount = floor(mrc_get_level($user, null, RES_DARK_MATTER) - $config->rpg_cost_trader); |
| 115 | 115 | } else { |
| 116 | 116 | $amount = floor(mrc_get_level($user, $planetrow, $resource_id)); |
@@ -3,18 +3,18 @@ discard block |
||
| 3 | 3 | use Fleet\DbFleetStatic; |
| 4 | 4 | use Planet\DBStaticPlanet; |
| 5 | 5 | |
| 6 | -if(SN_IN_FLEET !== true) { |
|
| 6 | +if (SN_IN_FLEET !== true) { |
|
| 7 | 7 | $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403); |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | $fleetid = sys_get_param_id('fleetid'); |
| 11 | 11 | |
| 12 | -if(!is_numeric($fleetid) || empty($fleetid)) { |
|
| 12 | +if (!is_numeric($fleetid) || empty($fleetid)) { |
|
| 13 | 13 | sys_redirect("fleet.php"); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | $fleet = DbFleetStatic::db_fleet_get($fleetid); |
| 17 | -if(!$fleet) { |
|
| 17 | +if (!$fleet) { |
|
| 18 | 18 | SnTemplate::messageBox($lang['fl_fleet_not_exists'], $lang['fl_error']); |
| 19 | 19 | } |
| 20 | 20 | |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | SnTemplate::messageBox($lang['fl_isback'], $lang['fl_error']); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | -if($fleet['fleet_owner'] != $user['id']) { |
|
| 26 | - $debug->warning($lang['fl_aks_hack_wrong_fleet'],'Wrong Fleet Owner',301); |
|
| 25 | +if ($fleet['fleet_owner'] != $user['id']) { |
|
| 26 | + $debug->warning($lang['fl_aks_hack_wrong_fleet'], 'Wrong Fleet Owner', 301); |
|
| 27 | 27 | SnTemplate::messageBox($lang['fl_aks_hack_wrong_fleet'], $lang['fl_error']); |
| 28 | 28 | } |
| 29 | 29 | |
@@ -57,8 +57,8 @@ discard block |
||
| 57 | 57 | 'MISSION_NAME' => $lang['type_mission'][MT_AKS], |
| 58 | 58 | )); |
| 59 | 59 | |
| 60 | -if($aks['eingeladen'] && is_array($members = db_user_list("`id` in ({$aks['eingeladen']})")) && !empty($members)) { |
|
| 61 | - foreach($members as $row) { |
|
| 60 | +if ($aks['eingeladen'] && is_array($members = db_user_list("`id` in ({$aks['eingeladen']})")) && !empty($members)) { |
|
| 61 | + foreach ($members as $row) { |
|
| 62 | 62 | $template->assign_block_vars('invited', array( |
| 63 | 63 | 'NAME' => $row['username'], |
| 64 | 64 | )); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $i++; |
| 69 | 69 | $fleet_row = DbFleetStatic::db_fleet_get($fleetid); |
| 70 | 70 | |
| 71 | -if(is_array($fleet_row) && !empty($fleet_row)) { |
|
| 71 | +if (is_array($fleet_row) && !empty($fleet_row)) { |
|
| 72 | 72 | $planet_start = DBStaticPlanet::db_planet_by_id($fleet_row['fleet_start_planet_id']); |
| 73 | 73 | $fleet_row['fleet_start_name'] = !empty($planet_start['name']) ? $planet_start['name'] : ''; |
| 74 | 74 | $planet_end = DBStaticPlanet::db_planet_by_id($fleet_row['fleet_end_planet_id']); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | $fleet_data = tpl_parse_fleet_db($fleet_row, $i, $user); |
| 78 | 78 | $template->assign_block_vars('fleets', $fleet_data['fleet']); |
| 79 | -foreach($fleet_data['ships'] as $ship_data) { |
|
| 79 | +foreach ($fleet_data['ships'] as $ship_data) { |
|
| 80 | 80 | $template->assign_block_vars('fleets.ships', $ship_data); |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -4,18 +4,18 @@ discard block |
||
| 4 | 4 | use Fleet\FleetStatic; |
| 5 | 5 | use Planet\DBStaticPlanet; |
| 6 | 6 | |
| 7 | -if(SN_IN_FLEET !== true) { |
|
| 7 | +if (SN_IN_FLEET !== true) { |
|
| 8 | 8 | $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403); |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | $template = SnTemplate::gettemplate('fleet1', true); |
| 12 | 12 | |
| 13 | 13 | $ships = sys_get_param('ships', array()); |
| 14 | -if(!is_array($ships)) { |
|
| 14 | +if (!is_array($ships)) { |
|
| 15 | 15 | $ships = array(); |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -foreach(array(PT_PLANET, PT_DEBRIS, PT_MOON) as $possible_planet_type_id) { |
|
| 18 | +foreach (array(PT_PLANET, PT_DEBRIS, PT_MOON) as $possible_planet_type_id) { |
|
| 19 | 19 | $template->assign_block_vars('possible_planet_type_id', array( |
| 20 | 20 | 'ID' => $possible_planet_type_id, |
| 21 | 21 | 'NAME' => $lang['sys_planet_type_sh'][$possible_planet_type_id], |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | 'START_NAME' => $planetrow['name'], |
| 29 | 29 | ); |
| 30 | 30 | |
| 31 | -if(!empty($TargetPlanet)) { |
|
| 31 | +if (!empty($TargetPlanet)) { |
|
| 32 | 32 | $template_route += array( |
| 33 | 33 | 'END_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$TargetPlanet['planet_type']], |
| 34 | 34 | 'END_COORDS' => uni_render_coordinates($TargetPlanet), |
@@ -39,10 +39,10 @@ discard block |
||
| 39 | 39 | $template->assign_block_vars('fleets', $template_route); |
| 40 | 40 | |
| 41 | 41 | $sn_groups_fleet = sn_get_groups('fleet'); |
| 42 | -foreach($ships as $ship_id => $ship_count) { |
|
| 43 | - if(in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
| 42 | +foreach ($ships as $ship_id => $ship_count) { |
|
| 43 | + if (in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
| 44 | 44 | $ship_info = get_unit_param($ship_id); |
| 45 | - if($ship_count > mrc_get_level($user, $planetrow, $ship_id, false, true)) { |
|
| 45 | + if ($ship_count > mrc_get_level($user, $planetrow, $ship_id, false, true)) { |
|
| 46 | 46 | $page .= $lang['fl_noenought']; |
| 47 | 47 | } else { |
| 48 | 48 | $fleet['fleetarray'][$ship_id] = $ship_count; |
@@ -61,13 +61,13 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | -if(empty($fleet['fleetarray'])) { |
|
| 64 | +if (empty($fleet['fleetarray'])) { |
|
| 65 | 65 | SnTemplate::messageBox($lang['fl_err_no_ships'], $lang['fl_error'], 'fleet' . DOT_PHP_EX, 5); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // Building list of shortcuts |
| 69 | 69 | $query = doquery("SELECT * FROM {{notes}} WHERE `owner` = {$user['id']} AND `galaxy` <> 0 AND `system` <> 0 AND `planet` <> 0 ORDER BY `priority` DESC, `galaxy`, `system`, `planet`, `planet_type`;"); |
| 70 | -while($shortcut = db_fetch($query)) { |
|
| 70 | +while ($shortcut = db_fetch($query)) { |
|
| 71 | 71 | $template->assign_block_vars('shortcut', array( |
| 72 | 72 | 'NAME' => $shortcut['title'], |
| 73 | 73 | 'GALAXY' => $shortcut['galaxy'], |
@@ -81,10 +81,10 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | // Building list of own planets & moons |
| 84 | -$colonies = DBStaticPlanet::db_planet_list_sorted ( $user ); |
|
| 85 | -if(count($colonies) > 1) { |
|
| 84 | +$colonies = DBStaticPlanet::db_planet_list_sorted($user); |
|
| 85 | +if (count($colonies) > 1) { |
|
| 86 | 86 | // while($row = db_fetch($colonies)) |
| 87 | - foreach($colonies as $row) { |
|
| 87 | + foreach ($colonies as $row) { |
|
| 88 | 88 | $template->assign_block_vars('colonies', array( |
| 89 | 89 | 'NAME' => $row['name'], |
| 90 | 90 | 'GALAXY' => $row['galaxy'], |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | //ACS Start |
| 100 | 100 | //Need to look for acs attacks. |
| 101 | 101 | $aks_madnessred = DbFleetStatic::dbAcsGetAll(); |
| 102 | -while($row = db_fetch($aks_madnessred)) { |
|
| 102 | +while ($row = db_fetch($aks_madnessred)) { |
|
| 103 | 103 | $members = explode(',', $row['eingeladen']); |
| 104 | - foreach($members as $a => $b) { |
|
| 104 | + foreach ($members as $a => $b) { |
|
| 105 | 105 | if ($b == $user['id']) { |
| 106 | 106 | $template->assign_block_vars('acss', array( |
| 107 | 107 | 'ID' => $row['id'], |
@@ -6,12 +6,12 @@ discard block |
||
| 6 | 6 | $uni_galaxy = sys_get_param_int('galaxy', $planetrow['galaxy']); |
| 7 | 7 | $uni_system = sys_get_param_int('system'); |
| 8 | 8 | |
| 9 | - if($uni_galaxy < 1 || $uni_galaxy > $config->game_maxGalaxy) |
|
| 9 | + if ($uni_galaxy < 1 || $uni_galaxy > $config->game_maxGalaxy) |
|
| 10 | 10 | { |
| 11 | 11 | throw new exception($lang['uni_msg_error_wrong_galaxy'], ERR_ERROR); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | - if($uni_system < 0 || $uni_system > $config->game_maxSystem) |
|
| 14 | + if ($uni_system < 0 || $uni_system > $config->game_maxSystem) |
|
| 15 | 15 | { |
| 16 | 16 | throw new exception($lang['uni_msg_error_wrong_system'], ERR_ERROR); |
| 17 | 17 | } |
@@ -20,12 +20,12 @@ discard block |
||
| 20 | 20 | $uni_row['universe_price'] += $uni_system ? $config->uni_price_system : $config->uni_price_galaxy; |
| 21 | 21 | $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}")); |
| 22 | 22 | |
| 23 | - if(sys_get_param_str('uni_name_submit')) |
|
| 23 | + if (sys_get_param_str('uni_name_submit')) |
|
| 24 | 24 | { |
| 25 | 25 | $uni_row['universe_name'] = strip_tags(sys_get_param_str('uni_name')); |
| 26 | 26 | |
| 27 | 27 | $uni_price = sys_get_param_float('uni_price'); |
| 28 | - if($uni_price < $uni_row['universe_price']) |
|
| 28 | + if ($uni_price < $uni_row['universe_price']) |
|
| 29 | 29 | { |
| 30 | 30 | throw new exception($lang['uni_msg_error_low_price'], ERR_ERROR); |
| 31 | 31 | } |
@@ -34,12 +34,12 @@ discard block |
||
| 34 | 34 | SN::db_transaction_start(); |
| 35 | 35 | $user = db_user_by_id($user['id'], true); |
| 36 | 36 | // if($user[get_unit_param(RES_DARK_MATTER, P_NAME)] < $uni_price) |
| 37 | - if(mrc_get_level($user, null, RES_DARK_MATTER) < $uni_price) |
|
| 37 | + if (mrc_get_level($user, null, RES_DARK_MATTER) < $uni_price) |
|
| 38 | 38 | { |
| 39 | 39 | throw new exception($lang['uni_msg_error_no_dm'], ERR_ERROR); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - if(!rpg_points_change($user['id'], RPG_RENAME, -$uni_price, "Renaming [{$uni_galaxy}:{$uni_system}] to " . sys_get_param_str_unsafe('uni_name'))) |
|
| 42 | + if (!rpg_points_change($user['id'], RPG_RENAME, -$uni_price, "Renaming [{$uni_galaxy}:{$uni_system}] to " . sys_get_param_str_unsafe('uni_name'))) |
|
| 43 | 43 | { |
| 44 | 44 | throw new exception($lang['sys_msg_err_update_dm'], ERR_ERROR); |
| 45 | 45 | } |
@@ -49,8 +49,7 @@ |
||
| 49 | 49 | SN::db_transaction_commit(); |
| 50 | 50 | sys_redirect("galaxy.php?mode=name&galaxy={$uni_galaxy}&system={$uni_system}"); |
| 51 | 51 | } |
| 52 | - } |
|
| 53 | - catch (exception $e) |
|
| 52 | + } catch (exception $e) |
|
| 54 | 53 | { |
| 55 | 54 | SN::db_transaction_rollback(); |
| 56 | 55 | $template->assign_block_vars('result', array( |