@@ -1,37 +1,37 @@ 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 | classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | $template = gettemplate('ali_info', true); |
| 8 | 8 | |
| 9 | -if($mode == 'exit') { |
|
| 10 | - if($ally['ally_owner'] == $user['id']) { |
|
| 9 | +if ($mode == 'exit') { |
|
| 10 | + if ($ally['ally_owner'] == $user['id']) { |
|
| 11 | 11 | message(classLocale::$lang['Owner_cant_go_out'], classLocale::$lang['Alliance']); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | - if(sys_get_param_int('ali_info_leave_confirm')) { |
|
| 14 | + if (sys_get_param_int('ali_info_leave_confirm')) { |
|
| 15 | 15 | sn_db_transaction_start(); |
| 16 | 16 | db_user_set_by_id($user['id'], "`ally_id` = null, `ally_name` = null, `ally_tag` = null, `ally_register_time` = 0, `ally_rank_id` = 0"); |
| 17 | 17 | db_ally_list_recalc_counts(); |
| 18 | 18 | sn_db_transaction_commit(); |
| 19 | 19 | message(sprintf(classLocale::$lang['ali_info_leave_success'], $ally['ally_name']), classLocale::$lang['sys_alliance']); |
| 20 | 20 | } |
| 21 | -} elseif($mode == 'ainfo') { |
|
| 21 | +} elseif ($mode == 'ainfo') { |
|
| 22 | 22 | $tag = sys_get_param_str('tag'); |
| 23 | 23 | $id_ally = sys_get_param_id('a'); |
| 24 | - if($tag) { |
|
| 24 | + if ($tag) { |
|
| 25 | 25 | $ally = db_ally_get_by_tag($tag); |
| 26 | - } elseif($id_ally) { |
|
| 26 | + } elseif ($id_ally) { |
|
| 27 | 27 | $ally = db_ally_get_by_id($id_ally); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - if(!$ally) { |
|
| 30 | + if (!$ally) { |
|
| 31 | 31 | message(classLocale::$lang['ali_sys_notFound'], classLocale::$lang['Ally_info_1']); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - if(!$ally['ally_description']) { |
|
| 34 | + if (!$ally['ally_description']) { |
|
| 35 | 35 | $ally['ally_description'] = classLocale::$lang['Ally_nodescription']; |
| 36 | 36 | } |
| 37 | 37 | |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | } else { |
| 44 | 44 | $page_header = classLocale::$lang['your_alliance']; |
| 45 | 45 | |
| 46 | - if($ally['ally_owner'] == $user['id']) { |
|
| 46 | + if ($ally['ally_owner'] == $user['id']) { |
|
| 47 | 47 | $range = $ally['ally_owner_range'] ? $ally['ally_owner_range'] : classLocale::$lang['Founder']; |
| 48 | - } elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) { |
|
| 48 | + } elseif ($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) { |
|
| 49 | 49 | $range = $ranks[$user['ally_rank_id']]['name']; |
| 50 | 50 | } else { |
| 51 | 51 | $range = classLocale::$lang['member']; |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | )); |
| 87 | 87 | |
| 88 | 88 | $relations = ali_relations($ally['id']); |
| 89 | -foreach($relations as $relation) { |
|
| 90 | - if($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id']) { |
|
| 89 | +foreach ($relations as $relation) { |
|
| 90 | + if ($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id']) { |
|
| 91 | 91 | $template->assign_block_vars('relation', array( |
| 92 | 92 | 'NAME' => $relation['alliance_diplomacy_contr_ally_name'], |
| 93 | 93 | 'RELATION' => classLocale::$lang['ali_dip_relations'][$relation['alliance_diplomacy_relation']], |
@@ -106,4 +106,4 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | ali_render(); |
| 108 | 108 | |
| 109 | -display($template, classLocale::$lang['your_alliance'] . ' [' . $ally['ally_name'] . ']'); |
|
| 109 | +display($template, classLocale::$lang['your_alliance'].' ['.$ally['ally_name'].']'); |
|
@@ -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 | classSupernova::$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(classLocale::$lang['ali_adm_lastRank'], classLocale::$lang['ali_adm_rights_title']); |
| 47 | 47 | } |
@@ -53,17 +53,17 @@ 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' : '') ; |
|
| 66 | - $rank_data['N' . $i] = $ally_rights[$i]; |
|
| 65 | + $rank_data['R'.$i] = (($rank[$ally_rights[$i]] == 1) ? ' checked' : ''); |
|
| 66 | + $rank_data['N'.$i] = $ally_rights[$i]; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $template->assign_block_vars('rank', $rank_data); |
@@ -27,19 +27,19 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | function db_set_make_safe_string($set, $delta = false) { |
| 29 | 29 | $set_safe = array(); |
| 30 | - foreach($set as $field => $value) { |
|
| 31 | - if(empty($field)) { |
|
| 30 | + foreach ($set as $field => $value) { |
|
| 31 | + if (empty($field)) { |
|
| 32 | 32 | continue; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - $field = '`' . db_escape($field) . '`'; |
|
| 35 | + $field = '`'.db_escape($field).'`'; |
|
| 36 | 36 | $new_value = $value; |
| 37 | - if($value === null) { |
|
| 37 | + if ($value === null) { |
|
| 38 | 38 | $new_value = 'NULL'; |
| 39 | - } elseif(is_string($value) && (string)($new_value = floatval($value)) != (string)$value) { |
|
| 39 | + } elseif (is_string($value) && (string) ($new_value = floatval($value)) != (string) $value) { |
|
| 40 | 40 | // non-float |
| 41 | - $new_value = '"' . db_escape($value) . '"'; |
|
| 42 | - } elseif($delta) { |
|
| 41 | + $new_value = '"'.db_escape($value).'"'; |
|
| 42 | + } elseif ($delta) { |
|
| 43 | 43 | // float and DELTA-set |
| 44 | 44 | $new_value = "{$field} + ({$new_value})"; |
| 45 | 45 | } |
@@ -2,19 +2,19 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | $classLocale = classLocale::$lang; |
| 4 | 4 | |
| 5 | -if(classSupernova::$config->server_updater_check_auto && classSupernova::$config->server_updater_check_last + classSupernova::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
| 6 | - include(SN_ROOT_PHYSICAL . 'ajax_version_check' . DOT_PHP_EX); |
|
| 5 | +if (classSupernova::$config->server_updater_check_auto && classSupernova::$config->server_updater_check_last + classSupernova::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
| 6 | + include(SN_ROOT_PHYSICAL.'ajax_version_check'.DOT_PHP_EX); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -if(classSupernova::$config->user_birthday_gift && SN_TIME_NOW - classSupernova::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
| 10 | - require_once(SN_ROOT_PHYSICAL . "includes/includes/user_birthday_celebrate" . DOT_PHP_EX); |
|
| 9 | +if (classSupernova::$config->user_birthday_gift && SN_TIME_NOW - classSupernova::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
| 10 | + require_once(SN_ROOT_PHYSICAL."includes/includes/user_birthday_celebrate".DOT_PHP_EX); |
|
| 11 | 11 | sn_user_birthday_celebrate(); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | -if(!classSupernova::$config->var_online_user_count || classSupernova::$config->var_online_user_time + 30 < SN_TIME_NOW) { |
|
| 14 | +if (!classSupernova::$config->var_online_user_count || classSupernova::$config->var_online_user_time + 30 < SN_TIME_NOW) { |
|
| 15 | 15 | classSupernova::$config->db_saveItem('var_online_user_count', db_user_count(true)); |
| 16 | 16 | classSupernova::$config->db_saveItem('var_online_user_time', SN_TIME_NOW); |
| 17 | - if(classSupernova::$config->server_log_online) { |
|
| 17 | + if (classSupernova::$config->server_log_online) { |
|
| 18 | 18 | db_log_online_insert(); |
| 19 | 19 | } |
| 20 | 20 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $template_result[F_ACCOUNT_IS_AUTHORIZED] = $sys_user_logged_in = !empty($user) && isset($user['id']) && $user['id']; |
| 42 | 42 | //pdump($template_result[F_ACCOUNT_IS_AUTHORIZED]);die(); |
| 43 | 43 | |
| 44 | -if(!empty($user['id'])) { |
|
| 44 | +if (!empty($user['id'])) { |
|
| 45 | 45 | classSupernova::$user_options->user_change($user['id']); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -54,15 +54,15 @@ discard block |
||
| 54 | 54 | : false |
| 55 | 55 | ); |
| 56 | 56 | |
| 57 | -if($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
| 58 | - $prohibited_characters = array_map(function ($value) { |
|
| 59 | - return "'" . htmlentities($value, ENT_QUOTES, 'UTF-8') . "'"; |
|
| 57 | +if ($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
| 58 | + $prohibited_characters = array_map(function($value) { |
|
| 59 | + return "'".htmlentities($value, ENT_QUOTES, 'UTF-8')."'"; |
|
| 60 | 60 | }, str_split(LOGIN_REGISTER_CHARACTERS_PROHIBITED)); |
| 61 | 61 | $template_result[F_LOGIN_MESSAGE] .= implode(', ', $prohibited_characters); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | |
| 65 | -if(defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
| 65 | +if (defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
| 66 | 66 | pdump("Отключи отладку перед продакшном!"); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -76,17 +76,17 @@ discard block |
||
| 76 | 76 | ? define('INSTALL_MODE', GAME_DISABLE_INSTALL) |
| 77 | 77 | : false; |
| 78 | 78 | |
| 79 | -if($template_result[F_GAME_DISABLE] = classSupernova::$config->game_disable) { |
|
| 79 | +if ($template_result[F_GAME_DISABLE] = classSupernova::$config->game_disable) { |
|
| 80 | 80 | $template_result[F_GAME_DISABLE_REASON] = sys_bbcodeParse( |
| 81 | 81 | classSupernova::$config->game_disable == GAME_DISABLE_REASON |
| 82 | 82 | ? classSupernova::$config->game_disable_reason |
| 83 | 83 | : classLocale::$lang['sys_game_disable_reason'][classSupernova::$config->game_disable] |
| 84 | 84 | ); |
| 85 | - if(defined('IN_API')) { |
|
| 85 | + if (defined('IN_API')) { |
|
| 86 | 86 | return; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - if( |
|
| 89 | + if ( |
|
| 90 | 90 | ($user['authlevel'] < 1 || !(defined('IN_ADMIN') && IN_ADMIN)) |
| 91 | 91 | && |
| 92 | 92 | !(defined('INSTALL_MODE') && defined('LOGIN_LOGOUT')) |
@@ -100,8 +100,8 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | // TODO ban |
| 102 | 102 | // TODO $skip_ban_check |
| 103 | -if($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
| 104 | - if(defined('IN_API')) { |
|
| 103 | +if ($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
| 104 | + if (defined('IN_API')) { |
|
| 105 | 105 | return; |
| 106 | 106 | } |
| 107 | 107 | |
@@ -119,15 +119,15 @@ discard block |
||
| 119 | 119 | // pdump($allow_anonymous, '$allow_anonymous'); |
| 120 | 120 | // pdump($sys_user_logged_in, '$sys_user_logged_in'); |
| 121 | 121 | |
| 122 | -if($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
| 123 | - sys_redirect(SN_ROOT_VIRTUAL . 'overview.php'); |
|
| 124 | -} elseif($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
| 122 | +if ($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
| 123 | + sys_redirect(SN_ROOT_VIRTUAL.'overview.php'); |
|
| 124 | +} elseif ($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
| 125 | 125 | // pdump($sn_page_name); |
| 126 | 126 | // pdump(INITIAL_PAGE); |
| 127 | 127 | // die('{Тут должна быть ваша реклама. Точнее - ввод имени игрока}'); |
| 128 | -} elseif(!$allow_anonymous && !$sys_user_logged_in) { |
|
| 128 | +} elseif (!$allow_anonymous && !$sys_user_logged_in) { |
|
| 129 | 129 | // sn_setcookie(SN_COOKIE, '', time() - PERIOD_WEEK, SN_ROOT_RELATIVE); |
| 130 | - sys_redirect(SN_ROOT_VIRTUAL . 'login.php'); |
|
| 130 | + sys_redirect(SN_ROOT_VIRTUAL.'login.php'); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | $user_time_diff = playerTimeDiff::user_time_diff_get(); |
@@ -146,16 +146,16 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | global $skip_fleet_update; |
| 148 | 148 | $skip_fleet_update = $skip_fleet_update || $supernova->options['fleet_update_skip'] || defined('IN_ADMIN'); |
| 149 | -if( |
|
| 149 | +if ( |
|
| 150 | 150 | !$skip_fleet_update |
| 151 | 151 | && !(defined('IN_AJAX') && IN_AJAX === true) |
| 152 | 152 | && SN_TIME_NOW - strtotime(classSupernova::$config->fleet_update_last) > classSupernova::$config->fleet_update_interval |
| 153 | 153 | ) { |
| 154 | - require_once(SN_ROOT_PHYSICAL . "includes/includes/flt_flying_fleet_handler2" . DOT_PHP_EX); |
|
| 154 | + require_once(SN_ROOT_PHYSICAL."includes/includes/flt_flying_fleet_handler2".DOT_PHP_EX); |
|
| 155 | 155 | flt_flying_fleet_handler($skip_fleet_update); |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | -if(!defined('IN_AJAX')) { |
|
| 158 | +if (!defined('IN_AJAX')) { |
|
| 159 | 159 | print("Scheduled processes is disabled<br />"); |
| 160 | 160 | } |
| 161 | 161 | // scheduler_process(); |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | function pname_factory_production_field_name($factory_unit_id) |
| 6 | 6 | { |
| 7 | - return get_unit_param($factory_unit_id, P_NAME) . '_porcent'; |
|
| 7 | + return get_unit_param($factory_unit_id, P_NAME).'_porcent'; |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | /** |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | print($round); |
| 28 | 28 | print('<table border=1>'); |
| 29 | 29 | print('<tr align="left">'); |
| 30 | - foreach($header as $key => $value) |
|
| 30 | + foreach ($header as $key => $value) |
|
| 31 | 31 | { |
| 32 | - if(is_array($value)) |
|
| 32 | + if (is_array($value)) |
|
| 33 | 33 | { |
| 34 | 34 | continue; |
| 35 | 35 | } |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | ); |
| 62 | 62 | |
| 63 | 63 | print('<tr align="right">'); |
| 64 | - foreach($unit_crossfire_result as $key => $value) |
|
| 64 | + foreach ($unit_crossfire_result as $key => $value) |
|
| 65 | 65 | { |
| 66 | - if(is_array($value)) |
|
| 66 | + if (is_array($value)) |
|
| 67 | 67 | { |
| 68 | 68 | continue; |
| 69 | 69 | } |
@@ -20,14 +20,14 @@ discard block |
||
| 20 | 20 | $TargetAddress = sprintf(classLocale::$lang['sys_adress_planet'], $fleet_end_coordinates['galaxy'], $fleet_end_coordinates['system'], $fleet_end_coordinates['planet']); |
| 21 | 21 | |
| 22 | 22 | $TheMessage = classLocale::$lang['sys_colo_no_colonizer']; |
| 23 | - if($objFleet->shipsGetTotalById(SHIP_COLONIZER) >= 1) { |
|
| 23 | + if ($objFleet->shipsGetTotalById(SHIP_COLONIZER) >= 1) { |
|
| 24 | 24 | $TheMessage = classLocale::$lang['sys_colo_notfree']; |
| 25 | - if(empty($mission_data->dst_planet)) { |
|
| 25 | + if (empty($mission_data->dst_planet)) { |
|
| 26 | 26 | $iPlanetCount = get_player_current_colonies($src_user_row); |
| 27 | 27 | |
| 28 | 28 | // Can we colonize more planets? |
| 29 | 29 | $TheMessage = classLocale::$lang['sys_colo_maxcolo']; |
| 30 | - if($iPlanetCount < get_player_max_colonies($src_user_row)) { |
|
| 30 | + if ($iPlanetCount < get_player_max_colonies($src_user_row)) { |
|
| 31 | 31 | // Yes, we can colonize |
| 32 | 32 | $TheMessage = classLocale::$lang['sys_colo_badpos']; |
| 33 | 33 | |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | $fleet_end_coordinates['galaxy'], $fleet_end_coordinates['system'], $fleet_end_coordinates['planet'], |
| 36 | 36 | $objFleet->playerOwnerId, "{$classLocale['sys_colo_defaultname']} {$iPlanetCount}", false, |
| 37 | 37 | array('user_row' => $src_user_row)); |
| 38 | - if($NewOwnerPlanet) { |
|
| 39 | - $TheMessage = classLocale::$lang['sys_colo_arrival'] . $TargetAddress . classLocale::$lang['sys_colo_allisok']; |
|
| 38 | + if ($NewOwnerPlanet) { |
|
| 39 | + $TheMessage = classLocale::$lang['sys_colo_arrival'].$TargetAddress.classLocale::$lang['sys_colo_allisok']; |
|
| 40 | 40 | msg_send_simple_message($objFleet->playerOwnerId, '', $objFleet->time_arrive_to_target, MSG_TYPE_SPY, classLocale::$lang['sys_colo_mess_from'], classLocale::$lang['sys_colo_mess_report'], $TheMessage); |
| 41 | 41 | |
| 42 | 42 | $objFleet->shipAdjustCount(SHIP_COLONIZER, -1); |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | $classLocale = classLocale::$lang; |
| 4 | 4 | |
| 5 | -if(!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) |
|
| 5 | +if (!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) |
|
| 6 | 6 | { |
| 7 | 7 | classSupernova::$debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403); |
| 8 | 8 | } |
@@ -17,54 +17,54 @@ discard block |
||
| 17 | 17 | )); |
| 18 | 18 | |
| 19 | 19 | $info_action = sys_get_param_int('action'); |
| 20 | -if($info_action) |
|
| 20 | +if ($info_action) |
|
| 21 | 21 | { |
| 22 | 22 | try |
| 23 | 23 | { |
| 24 | 24 | sn_db_transaction_start(); |
| 25 | 25 | |
| 26 | 26 | $user = db_user_by_id($user['id'], true); |
| 27 | - if(mrc_get_level($user, null, RES_DARK_MATTER) < classSupernova::$config->rpg_cost_info) |
|
| 27 | + if (mrc_get_level($user, null, RES_DARK_MATTER) < classSupernova::$config->rpg_cost_info) |
|
| 28 | 28 | { |
| 29 | 29 | throw new Exception(MARKET_NO_DM, ERR_ERROR); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - switch($info_action) |
|
| 32 | + switch ($info_action) |
|
| 33 | 33 | { |
| 34 | 34 | case MARKET_INFO_PLAYER: |
| 35 | 35 | $user_info_name_unsafe = sys_get_param_str_unsafe('user_info_name'); |
| 36 | - if(!$user_info_name_unsafe) |
|
| 36 | + if (!$user_info_name_unsafe) |
|
| 37 | 37 | { |
| 38 | 38 | throw new Exception(MARKET_INFO_PLAYER_WRONG, ERR_ERROR); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if(is_id($user_info_name_unsafe)) |
|
| 41 | + if (is_id($user_info_name_unsafe)) |
|
| 42 | 42 | { |
| 43 | 43 | $user_info = db_user_by_id($user_info_name_unsafe, true, '`id`, `username`', true); |
| 44 | 44 | } |
| 45 | - if(!is_array($user_info)) |
|
| 45 | + if (!is_array($user_info)) |
|
| 46 | 46 | { |
| 47 | 47 | $user_info = db_user_by_username($user_info_name_unsafe, true, '`id`, `username`', true, true); |
| 48 | 48 | } |
| 49 | - if(!is_array($user_info)) |
|
| 49 | + if (!is_array($user_info)) |
|
| 50 | 50 | { |
| 51 | 51 | throw new Exception(MARKET_INFO_PLAYER_NOT_FOUND, ERR_ERROR); |
| 52 | 52 | } |
| 53 | - if($user_info['id'] == $user['id']) |
|
| 53 | + if ($user_info['id'] == $user['id']) |
|
| 54 | 54 | { |
| 55 | 55 | throw new Exception(MARKET_INFO_PLAYER_SAME, ERR_ERROR); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | $msg_text = array(); |
| 59 | - foreach(sn_get_groups('mercenaries') as $mercenary_id) |
|
| 59 | + foreach (sn_get_groups('mercenaries') as $mercenary_id) |
|
| 60 | 60 | { |
| 61 | - $msg_text[] = "{$classLocale['tech'][$mercenary_id]} - " . (($mercenary_level = mrc_get_level($user_info, null, $mercenary_id)) ? "{$classLocale['sys_level']} {$mercenary_level}" : classLocale::$lang['eco_mrk_info_not_hired']); |
|
| 61 | + $msg_text[] = "{$classLocale['tech'][$mercenary_id]} - ".(($mercenary_level = mrc_get_level($user_info, null, $mercenary_id)) ? "{$classLocale['sys_level']} {$mercenary_level}" : classLocale::$lang['eco_mrk_info_not_hired']); |
|
| 62 | 62 | } |
| 63 | - if($mercenary_level = mrc_get_level($user_info, null, UNIT_PREMIUM)) |
|
| 63 | + if ($mercenary_level = mrc_get_level($user_info, null, UNIT_PREMIUM)) |
|
| 64 | 64 | { |
| 65 | 65 | $msg_text[] = "{$classLocale['tech'][UNIT_PREMIUM]} - {$mercenary_level} {$classLocale['sys_level']}"; |
| 66 | 66 | } |
| 67 | - $msg_text = sprintf(classLocale::$lang['eco_mrk_info_player_message'], $user_info['id'], $user_info['username']) . "\r\n" . implode("\r\n", $msg_text); |
|
| 67 | + $msg_text = sprintf(classLocale::$lang['eco_mrk_info_player_message'], $user_info['id'], $user_info['username'])."\r\n".implode("\r\n", $msg_text); |
|
| 68 | 68 | |
| 69 | 69 | msg_send_simple_message($user['id'], 0, SN_TIME_NOW, MSG_TYPE_SPY, classLocale::$lang['eco_mrk_info_msg_from'], "{$classLocale['eco_mrk_info_player']} ID {$user_info['id']} [{$user_info['username']}]", $msg_text, false, true); |
| 70 | 70 | break; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | break; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - if(!rpg_points_change($user['id'], RPG_MARKET_INFO_MERCENARY, -classSupernova::$config->rpg_cost_info, "Using Black Market page {$classLocale['eco_mrk_info']} - getting info about user ID {$user_info['id']}")) |
|
| 77 | + if (!rpg_points_change($user['id'], RPG_MARKET_INFO_MERCENARY, -classSupernova::$config->rpg_cost_info, "Using Black Market page {$classLocale['eco_mrk_info']} - getting info about user ID {$user_info['id']}")) |
|
| 78 | 78 | { |
| 79 | 79 | // TODO: throw new Exception(MARKET_INFO_PLAYER_SAME, ERR_ERROR); |
| 80 | 80 | } |
@@ -11,12 +11,12 @@ discard block |
||
| 11 | 11 | $uni_galaxy = sys_get_param_int('galaxy', $planetrow['galaxy']); |
| 12 | 12 | $uni_system = sys_get_param_int('system'); |
| 13 | 13 | |
| 14 | - if($uni_galaxy < 1 || $uni_galaxy > Vector::$knownGalaxies) |
|
| 14 | + if ($uni_galaxy < 1 || $uni_galaxy > Vector::$knownGalaxies) |
|
| 15 | 15 | { |
| 16 | 16 | throw new exception(classLocale::$lang['uni_msg_error_wrong_galaxy'], ERR_ERROR); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - if($uni_system < 0 || $uni_system > Vector::$knownSystems) |
|
| 19 | + if ($uni_system < 0 || $uni_system > Vector::$knownSystems) |
|
| 20 | 20 | { |
| 21 | 21 | throw new exception(classLocale::$lang['uni_msg_error_wrong_system'], ERR_ERROR); |
| 22 | 22 | } |
@@ -25,12 +25,12 @@ discard block |
||
| 25 | 25 | $uni_row['universe_price'] += $uni_system ? classSupernova::$config->uni_price_system : classSupernova::$config->uni_price_galaxy; |
| 26 | 26 | $uni_row['universe_name'] = strip_tags($uni_row['universe_name'] ? $uni_row['universe_name'] : ($uni_system ? "{$classLocale['sys_system']} [{$uni_galaxy}:{$uni_system}]" : "{$classLocale['sys_galaxy']} {$uni_galaxy}")); |
| 27 | 27 | |
| 28 | - if(sys_get_param_str('uni_name_submit')) |
|
| 28 | + if (sys_get_param_str('uni_name_submit')) |
|
| 29 | 29 | { |
| 30 | 30 | $uni_row['universe_name'] = strip_tags(sys_get_param_str('uni_name')); |
| 31 | 31 | |
| 32 | 32 | $uni_price = sys_get_param_float('uni_price'); |
| 33 | - if($uni_price < $uni_row['universe_price']) |
|
| 33 | + if ($uni_price < $uni_row['universe_price']) |
|
| 34 | 34 | { |
| 35 | 35 | throw new exception(classLocale::$lang['uni_msg_error_low_price'], ERR_ERROR); |
| 36 | 36 | } |
@@ -39,12 +39,12 @@ discard block |
||
| 39 | 39 | sn_db_transaction_start(); |
| 40 | 40 | $user = db_user_by_id($user['id'], true); |
| 41 | 41 | // if($user[get_unit_param(RES_DARK_MATTER, P_NAME)] < $uni_price) |
| 42 | - if(mrc_get_level($user, null, RES_DARK_MATTER) < $uni_price) |
|
| 42 | + if (mrc_get_level($user, null, RES_DARK_MATTER) < $uni_price) |
|
| 43 | 43 | { |
| 44 | 44 | throw new exception(classLocale::$lang['uni_msg_error_no_dm'], ERR_ERROR); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - if(!rpg_points_change($user['id'], RPG_RENAME, -$uni_price, "Renaming [{$uni_galaxy}:{$uni_system}] to " . sys_get_param_str_unsafe('uni_name'))) |
|
| 47 | + if (!rpg_points_change($user['id'], RPG_RENAME, -$uni_price, "Renaming [{$uni_galaxy}:{$uni_system}] to ".sys_get_param_str_unsafe('uni_name'))) |
|
| 48 | 48 | { |
| 49 | 49 | throw new exception(classLocale::$lang['sys_msg_err_update_dm'], ERR_ERROR); |
| 50 | 50 | } |
@@ -74,4 +74,4 @@ discard block |
||
| 74 | 74 | 'PAGE_HINT' => classLocale::$lang['uni_name_page_hint'], |
| 75 | 75 | )); |
| 76 | 76 | |
| 77 | - display($template, classLocale::$lang['sys_universe'] . ' - ' . classLocale::$lang['uni_naming'], true, '', false); |
|
| 77 | + display($template, classLocale::$lang['sys_universe'].' - '.classLocale::$lang['uni_naming'], true, '', false); |
|