@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
4 | 4 | |
5 | -if(classSupernova::$config->game_mode == GAME_BLITZ) { |
|
5 | +if (classSupernova::$config->game_mode == GAME_BLITZ) { |
|
6 | 6 | message(classLocale::$lang['sys_blitz_page_disabled'], classLocale::$lang['sys_error'], 'overview.php', 10); |
7 | 7 | die(); |
8 | 8 | } |
@@ -14,16 +14,16 @@ discard block |
||
14 | 14 | |
15 | 15 | $mode = sys_get_param_str('mode'); |
16 | 16 | |
17 | -if($mode == 'ainfo') { |
|
17 | +if ($mode == 'ainfo') { |
|
18 | 18 | include('includes/alliance/ali_info.inc'); |
19 | 19 | } |
20 | 20 | |
21 | -if(!$user['ally_id']) { |
|
21 | +if (!$user['ally_id']) { |
|
22 | 22 | $user_request = db_ally_request_get_by_user_id($user['id']); |
23 | - if($user_request['id_user']) { |
|
23 | + if ($user_request['id_user']) { |
|
24 | 24 | require('includes/alliance/ali_external_request.inc'); |
25 | 25 | } else { |
26 | - switch($mode) { |
|
26 | + switch ($mode) { |
|
27 | 27 | case 'search': |
28 | 28 | require('includes/alliance/ali_external_search.inc'); |
29 | 29 | break; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | sn_ali_fill_user_ally($user); |
47 | -if(!isset($user['ally'])) { |
|
47 | +if (!isset($user['ally'])) { |
|
48 | 48 | db_user_set_by_id($user['id'], "`ally_id` = null, `ally_name` = null, `ally_register_time` = 0, `ally_rank_id` = 0"); |
49 | 49 | message(classLocale::$lang['ali_sys_notFound'], classLocale::$lang['your_alliance'], 'alliance.php'); |
50 | 50 | } |
@@ -72,18 +72,18 @@ discard block |
||
72 | 72 | |
73 | 73 | // This piece converting old ally data to new one |
74 | 74 | // unset($ally['ranklist']); |
75 | -if(!$ally['ranklist'] && $ally['ally_ranks']) { |
|
75 | +if (!$ally['ranklist'] && $ally['ally_ranks']) { |
|
76 | 76 | $ally_ranks = unserialize($ally['ally_ranks']); |
77 | 77 | $i = 0; |
78 | - foreach($ally_ranks as $rank_id => $rank) { |
|
79 | - foreach($ally_rights as $key => $value) { |
|
78 | + foreach ($ally_ranks as $rank_id => $rank) { |
|
79 | + foreach ($ally_rights as $key => $value) { |
|
80 | 80 | $ranks[$i][$value] = $rank[$rights_old[$key]]; |
81 | 81 | } |
82 | 82 | db_user_list_set_ally_deprecated_convert_ranks($user['ally_id'], $i, $rank_id); |
83 | 83 | $i++; |
84 | 84 | } |
85 | 85 | |
86 | - if(!empty($ranks)) { |
|
86 | + if (!empty($ranks)) { |
|
87 | 87 | ali_rank_list_save($ranks); |
88 | 88 | } |
89 | 89 | } |
@@ -101,15 +101,15 @@ discard block |
||
101 | 101 | |
102 | 102 | $edit = sys_get_param_str('edit'); |
103 | 103 | ally_pre_call(); |
104 | -switch($mode) { |
|
104 | +switch ($mode) { |
|
105 | 105 | case 'admin': |
106 | - if(!array_key_exists($edit, $sn_ali_admin_internal)) { |
|
106 | + if (!array_key_exists($edit, $sn_ali_admin_internal)) { |
|
107 | 107 | $edit = 'default'; |
108 | 108 | } |
109 | - if($sn_ali_admin_internal[$edit]['include']) { |
|
109 | + if ($sn_ali_admin_internal[$edit]['include']) { |
|
110 | 110 | require("includes/{$sn_ali_admin_internal[$edit]['include']}"); |
111 | 111 | } |
112 | - if(isset($sn_ali_admin_internal[$edit]['function']) && is_callable($sn_ali_admin_internal[$edit]['function'])) { |
|
112 | + if (isset($sn_ali_admin_internal[$edit]['function']) && is_callable($sn_ali_admin_internal[$edit]['function'])) { |
|
113 | 113 | call_user_func($sn_ali_admin_internal[$edit]['function']); |
114 | 114 | } |
115 | 115 | break; |
@@ -8,18 +8,18 @@ discard block |
||
8 | 8 | * @copyright 2008 by ??????? for XNova |
9 | 9 | */ |
10 | 10 | |
11 | -define('INSIDE' , true); |
|
12 | -define('INSTALL' , false); |
|
11 | +define('INSIDE', true); |
|
12 | +define('INSTALL', false); |
|
13 | 13 | define('IN_ADMIN', true); |
14 | 14 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
15 | 15 | |
16 | -if($user['authlevel'] < 3) { |
|
16 | +if ($user['authlevel'] < 3) { |
|
17 | 17 | AdminMessage(classLocale::$lang['adm_err_denied']); |
18 | 18 | } |
19 | 19 | |
20 | 20 | $template = gettemplate('admin/settings', true); |
21 | 21 | |
22 | -if(sys_get_param('save')) { |
|
22 | +if (sys_get_param('save')) { |
|
23 | 23 | classSupernova::$config->game_name = sys_get_param_str_unsafe('game_name'); |
24 | 24 | classSupernova::$config->game_mode = sys_get_param_int('game_mode'); |
25 | 25 | classSupernova::$config->game_speed = sys_get_param_float('game_speed', 1); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | classSupernova::$config->url_faq = sys_get_param_str_unsafe('url_faq'); |
30 | 30 | classSupernova::$config->url_forum = sys_get_param_str_unsafe('url_forum'); |
31 | 31 | classSupernova::$config->url_rules = sys_get_param_str_unsafe('url_rules'); |
32 | - classSupernova::$config->url_purchase_metamatter = sys_get_param_str_unsafe('url_purchase_metamatter'); |
|
32 | + classSupernova::$config->url_purchase_metamatter = sys_get_param_str_unsafe('url_purchase_metamatter'); |
|
33 | 33 | classSupernova::$config->game_disable = sys_get_param_int('game_disable'); |
34 | 34 | classSupernova::$config->game_disable_reason = sys_get_param_str_unsafe('game_disable_reason'); |
35 | 35 | classSupernova::$config->server_updater_check_auto = sys_get_param_int('server_updater_check_auto'); |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | classSupernova::$config->stats_schedule = sys_get_param_str('stats_schedule'); |
97 | 97 | |
98 | 98 | classSupernova::$config->empire_mercenary_base_period = sys_get_param_int('empire_mercenary_base_period'); |
99 | - if(classSupernova::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) { |
|
100 | - if(classSupernova::$config->empire_mercenary_temporary) { |
|
99 | + if (classSupernova::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) { |
|
100 | + if (classSupernova::$config->empire_mercenary_temporary) { |
|
101 | 101 | db_unit_list_admin_delete_mercenaries_finished(); |
102 | 102 | } else { |
103 | 103 | db_unit_list_admin_set_mercenaries_expire_time(classSupernova::$config->empire_mercenary_base_period); |
@@ -138,21 +138,21 @@ discard block |
||
138 | 138 | 'STATS_HIDE_PM_LINK' => classSupernova::$config->stats_hide_pm_link, |
139 | 139 | )); |
140 | 140 | |
141 | -foreach(classLocale::$lang['sys_game_disable_reason'] as $id => $name) { |
|
141 | +foreach (classLocale::$lang['sys_game_disable_reason'] as $id => $name) { |
|
142 | 142 | $template->assign_block_vars('sys_game_disable_reason', array( |
143 | 143 | 'ID' => $id, |
144 | 144 | 'NAME' => $name, |
145 | 145 | )); |
146 | 146 | } |
147 | 147 | |
148 | -foreach(classLocale::$lang['sys_game_mode'] as $mode_id => $mode_name) { |
|
148 | +foreach (classLocale::$lang['sys_game_mode'] as $mode_id => $mode_name) { |
|
149 | 149 | $template->assign_block_vars('game_modes', array( |
150 | 150 | 'ID' => $mode_id, |
151 | 151 | 'NAME' => $mode_name, |
152 | 152 | )); |
153 | 153 | } |
154 | 154 | |
155 | -foreach(classLocale::$lang['adm_opt_ver_response'] as $ver_id => $ver_response) { |
|
155 | +foreach (classLocale::$lang['adm_opt_ver_response'] as $ver_id => $ver_response) { |
|
156 | 156 | $template->assign_block_vars('ver_response', array( |
157 | 157 | 'ID' => $ver_id, |
158 | 158 | 'NAME' => js_safe_string($ver_response), |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | $lang_list = lng_get_list(); |
163 | -foreach($lang_list as $lang_id => $lang_data) { |
|
163 | +foreach ($lang_list as $lang_id => $lang_data) { |
|
164 | 164 | $template->assign_block_vars('game_languages', array( |
165 | 165 | 'ID' => $lang_id, |
166 | 166 | 'NAME' => "{$lang_data['LANG_NAME_NATIVE']} ({$lang_data['LANG_NAME_ENGLISH']})", |
@@ -13,15 +13,15 @@ |
||
13 | 13 | . '&id=' . urlencode(classSupernova::$config->server_updater_id); |
14 | 14 | |
15 | 15 | switch($mode) { |
16 | - case SNC_MODE_REGISTER: |
|
17 | - if(classSupernova::$config->server_updater_key || classSupernova::$config->server_updater_id) { |
|
18 | - if($ajax) { |
|
19 | - print(SNC_VER_REGISTER_ERROR_REGISTERED); |
|
16 | + case SNC_MODE_REGISTER: |
|
17 | + if(classSupernova::$config->server_updater_key || classSupernova::$config->server_updater_id) { |
|
18 | + if($ajax) { |
|
19 | + print(SNC_VER_REGISTER_ERROR_REGISTERED); |
|
20 | + } |
|
21 | + die(); |
|
20 | 22 | } |
21 | - die(); |
|
22 | - } |
|
23 | - $url .= "&name=" . urlencode(classSupernova::$config->game_name) . "&url=" . urlencode(SN_ROOT_VIRTUAL); |
|
24 | - break; |
|
23 | + $url .= "&name=" . urlencode(classSupernova::$config->game_name) . "&url=" . urlencode(SN_ROOT_VIRTUAL); |
|
24 | + break; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | $check_result = sn_get_url_contents($url); |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | . '&key=' . urlencode(classSupernova::$config->server_updater_key) |
13 | 13 | . '&id=' . urlencode(classSupernova::$config->server_updater_id); |
14 | 14 | |
15 | -switch($mode) { |
|
15 | +switch ($mode) { |
|
16 | 16 | case SNC_MODE_REGISTER: |
17 | - if(classSupernova::$config->server_updater_key || classSupernova::$config->server_updater_id) { |
|
18 | - if($ajax) { |
|
17 | + if (classSupernova::$config->server_updater_key || classSupernova::$config->server_updater_id) { |
|
18 | + if ($ajax) { |
|
19 | 19 | print(SNC_VER_REGISTER_ERROR_REGISTERED); |
20 | 20 | } |
21 | 21 | die(); |
@@ -25,18 +25,18 @@ discard block |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | $check_result = sn_get_url_contents($url); |
28 | -if(!$check_result) { |
|
28 | +if (!$check_result) { |
|
29 | 29 | $version_check = SNC_VER_ERROR_CONNECT; |
30 | -} elseif(($version_check = intval($check_result)) && $version_check == $check_result) { |
|
30 | +} elseif (($version_check = intval($check_result)) && $version_check == $check_result) { |
|
31 | 31 | $version_check = $check_result; |
32 | 32 | } else { |
33 | 33 | // JSON decode if string |
34 | 34 | $check_result = json_decode($check_result, true); |
35 | 35 | $version_check = $check_result === null ? SNC_VER_UNKNOWN_RESPONSE : $check_result['version_check']; |
36 | 36 | |
37 | - switch($mode) { |
|
37 | + switch ($mode) { |
|
38 | 38 | case SNC_MODE_REGISTER: |
39 | - if($check_result['site']['site_key'] && $check_result['site']['site_id'] && $check_result['site']['result'] == SNC_VER_REGISTER_REGISTERED) { |
|
39 | + if ($check_result['site']['site_key'] && $check_result['site']['site_id'] && $check_result['site']['result'] == SNC_VER_REGISTER_REGISTERED) { |
|
40 | 40 | classSupernova::$config->db_saveItem('server_updater_key', $check_result['site']['site_key']); |
41 | 41 | classSupernova::$config->db_saveItem('server_updater_id', $check_result['site']['site_id']); |
42 | 42 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | classSupernova::$config->db_saveItem('server_updater_check_last', SN_TIME_NOW); |
50 | 50 | classSupernova::$config->db_saveItem('server_updater_check_result', $version_check); |
51 | 51 | |
52 | -if($ajax) { |
|
52 | +if ($ajax) { |
|
53 | 53 | define('IN_AJAX', true); |
54 | 54 | print($version_check); |
55 | 55 | } |
@@ -34,69 +34,69 @@ |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | switch($mode) { |
37 | - case ADM_TOOL_CONFIG_RELOAD: |
|
38 | - classSupernova::$config->db_loadAll(); |
|
39 | - sys_refresh_tablelist(); |
|
40 | - |
|
41 | - classSupernova::$config->db_loadItem('game_watchlist'); |
|
42 | - if(classSupernova::$config->game_watchlist) { |
|
43 | - classSupernova::$config->game_watchlist_array = explode(';', classSupernova::$config->game_watchlist); |
|
44 | - } else { |
|
45 | - unset(classSupernova::$config->game_watchlist_array); |
|
46 | - } |
|
47 | - break; |
|
48 | - |
|
49 | - case ADM_TOOL_MD5: |
|
50 | - $template = gettemplate("admin/md5enc", true); |
|
51 | - $password_seed = sys_get_param_str_unsafe('seed', SN_SYS_SEC_CHARS_ALLOWED); |
|
52 | - $password_length = sys_get_param_int('length', 16); |
|
53 | - $string = ($string = sys_get_param_str_unsafe('string')) ? $string : sys_random_string($password_length, $password_seed); |
|
54 | - |
|
55 | - $template->assign_vars(array( |
|
56 | - 'SEED' => $password_seed, |
|
57 | - 'LENGTH' => $password_length, |
|
58 | - 'STRING' => htmlentities($string), |
|
59 | - 'MD5' => md5($string), |
|
60 | - )); |
|
61 | - display($template, classLocale::$lang['adm_tools_md5_header'], false, '', true); |
|
62 | - break; |
|
63 | - |
|
64 | - case ADM_TOOL_FORCE_ALL: |
|
65 | - classSupernova::$config->db_saveItem('db_version', 0); |
|
66 | - require_once('../includes/update.php'); |
|
67 | - break; |
|
68 | - |
|
69 | - case ADM_TOOL_FORCE_LAST: |
|
70 | - classSupernova::$config->db_saveItem('db_version', floor(classSupernova::$config->db_version - 1)); |
|
71 | - require_once('../includes/update.php'); |
|
72 | - break; |
|
73 | - |
|
74 | - case ADM_TOOL_INFO_PHP: |
|
75 | - phpinfo(); |
|
76 | - break; |
|
77 | - |
|
78 | - case ADM_TOOL_INFO_SQL: |
|
79 | - $template = gettemplate("simple_table", true); |
|
80 | - |
|
81 | - $status = array( |
|
82 | - classLocale::$lang['adm_tool_sql_server_version'] => classSupernova::$db->db_get_server_info(), |
|
83 | - classLocale::$lang['adm_tool_sql_client_version'] => classSupernova::$db->db_get_client_info(), |
|
84 | - classLocale::$lang['adm_tool_sql_host_info'] => classSupernova::$db->db_get_host_info(), |
|
85 | - ); |
|
86 | - templateAssignTable($template, 'server', $status); |
|
87 | - |
|
88 | - templateAssignTable($template, 'status', classSupernova::$db->db_get_server_stat()); |
|
89 | - templateAssignTable($template, 'params', classSupernova::$db->db_core_show_status()); |
|
90 | - |
|
91 | - $template->assign_vars(array( |
|
92 | - 'PAGE_HEADER' => classLocale::$lang['adm_tool_sql_page_header'], |
|
93 | - 'COLUMN_NAME_1' => classLocale::$lang['adm_tool_sql_param_name'], |
|
94 | - 'COLUMN_NAME_2' => classLocale::$lang['adm_tool_sql_param_value'], |
|
95 | - 'TABLE_FOOTER' => 'test', |
|
96 | - )); |
|
97 | - |
|
98 | - display($template, classLocale::$lang['adm_bn_ttle'], false, '', true); |
|
99 | - break; |
|
37 | + case ADM_TOOL_CONFIG_RELOAD: |
|
38 | + classSupernova::$config->db_loadAll(); |
|
39 | + sys_refresh_tablelist(); |
|
40 | + |
|
41 | + classSupernova::$config->db_loadItem('game_watchlist'); |
|
42 | + if(classSupernova::$config->game_watchlist) { |
|
43 | + classSupernova::$config->game_watchlist_array = explode(';', classSupernova::$config->game_watchlist); |
|
44 | + } else { |
|
45 | + unset(classSupernova::$config->game_watchlist_array); |
|
46 | + } |
|
47 | + break; |
|
48 | + |
|
49 | + case ADM_TOOL_MD5: |
|
50 | + $template = gettemplate("admin/md5enc", true); |
|
51 | + $password_seed = sys_get_param_str_unsafe('seed', SN_SYS_SEC_CHARS_ALLOWED); |
|
52 | + $password_length = sys_get_param_int('length', 16); |
|
53 | + $string = ($string = sys_get_param_str_unsafe('string')) ? $string : sys_random_string($password_length, $password_seed); |
|
54 | + |
|
55 | + $template->assign_vars(array( |
|
56 | + 'SEED' => $password_seed, |
|
57 | + 'LENGTH' => $password_length, |
|
58 | + 'STRING' => htmlentities($string), |
|
59 | + 'MD5' => md5($string), |
|
60 | + )); |
|
61 | + display($template, classLocale::$lang['adm_tools_md5_header'], false, '', true); |
|
62 | + break; |
|
63 | + |
|
64 | + case ADM_TOOL_FORCE_ALL: |
|
65 | + classSupernova::$config->db_saveItem('db_version', 0); |
|
66 | + require_once('../includes/update.php'); |
|
67 | + break; |
|
68 | + |
|
69 | + case ADM_TOOL_FORCE_LAST: |
|
70 | + classSupernova::$config->db_saveItem('db_version', floor(classSupernova::$config->db_version - 1)); |
|
71 | + require_once('../includes/update.php'); |
|
72 | + break; |
|
73 | + |
|
74 | + case ADM_TOOL_INFO_PHP: |
|
75 | + phpinfo(); |
|
76 | + break; |
|
77 | + |
|
78 | + case ADM_TOOL_INFO_SQL: |
|
79 | + $template = gettemplate("simple_table", true); |
|
80 | + |
|
81 | + $status = array( |
|
82 | + classLocale::$lang['adm_tool_sql_server_version'] => classSupernova::$db->db_get_server_info(), |
|
83 | + classLocale::$lang['adm_tool_sql_client_version'] => classSupernova::$db->db_get_client_info(), |
|
84 | + classLocale::$lang['adm_tool_sql_host_info'] => classSupernova::$db->db_get_host_info(), |
|
85 | + ); |
|
86 | + templateAssignTable($template, 'server', $status); |
|
87 | + |
|
88 | + templateAssignTable($template, 'status', classSupernova::$db->db_get_server_stat()); |
|
89 | + templateAssignTable($template, 'params', classSupernova::$db->db_core_show_status()); |
|
90 | + |
|
91 | + $template->assign_vars(array( |
|
92 | + 'PAGE_HEADER' => classLocale::$lang['adm_tool_sql_page_header'], |
|
93 | + 'COLUMN_NAME_1' => classLocale::$lang['adm_tool_sql_param_name'], |
|
94 | + 'COLUMN_NAME_2' => classLocale::$lang['adm_tool_sql_param_value'], |
|
95 | + 'TABLE_FOOTER' => 'test', |
|
96 | + )); |
|
97 | + |
|
98 | + display($template, classLocale::$lang['adm_bn_ttle'], false, '', true); |
|
99 | + break; |
|
100 | 100 | |
101 | 101 | } |
102 | 102 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
13 | 13 | |
14 | 14 | // if($user['authlevel'] < 1) |
15 | -if($user['authlevel'] < 3) { |
|
15 | +if ($user['authlevel'] < 3) { |
|
16 | 16 | AdminMessage(classLocale::$lang['adm_err_denied']); |
17 | 17 | } |
18 | 18 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function templateAssignTable($template, $str, $status) { |
27 | 27 | $template->assign_block_vars('table', classLocale::$lang['adm_tool_sql_table'][$str]); |
28 | - foreach($status as $key => $value) { |
|
28 | + foreach ($status as $key => $value) { |
|
29 | 29 | $template->assign_block_vars('table.row', array( |
30 | 30 | 'VALUE_1' => $key, |
31 | 31 | 'VALUE_2' => $value, |
@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
36 | -switch($mode) { |
|
36 | +switch ($mode) { |
|
37 | 37 | case ADM_TOOL_CONFIG_RELOAD: |
38 | 38 | classSupernova::$config->db_loadAll(); |
39 | 39 | sys_refresh_tablelist(); |
40 | 40 | |
41 | 41 | classSupernova::$config->db_loadItem('game_watchlist'); |
42 | - if(classSupernova::$config->game_watchlist) { |
|
42 | + if (classSupernova::$config->game_watchlist) { |
|
43 | 43 | classSupernova::$config->game_watchlist_array = explode(';', classSupernova::$config->game_watchlist); |
44 | 44 | } else { |
45 | 45 | unset(classSupernova::$config->game_watchlist_array); |
@@ -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'] == FLIGHT_ALLOWED) { |
|
163 | + foreach ($planet_list as $planet_id => $planet_data) { |
|
164 | + if ($planet_data['RESULT'] == FLIGHT_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'] = classLocale::$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'] == FLIGHT_ALLOWED) { |
|
172 | - foreach($planet_data['FLEET'] as $unit_id => $amount) { |
|
171 | + if (!empty($planet_data['FLEET']) && $planet_data['RESULT'] == FLIGHT_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' => classLocale::$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']) : classLocale::$lang['flt_no_fuel']; |
187 | 187 | $template->assign_block_vars('colonies', $planet_data); |
188 | 188 | } |
@@ -7,9 +7,9 @@ discard block |
||
7 | 7 | |
8 | 8 | // TODO - Переместить это куда-нибудь |
9 | 9 | $fleet_page = sys_get_param_int('fleet_page', sys_get_param_int('mode')); |
10 | -if($fleet_ship_sort = sys_get_param_id('sort_elements') && $fleet_page == 0) { |
|
10 | +if ($fleet_ship_sort = sys_get_param_id('sort_elements') && $fleet_page == 0) { |
|
11 | 11 | define('IN_AJAX', true); |
12 | - if(!empty(classLocale::$lang['player_option_fleet_ship_sort'][$fleet_ship_sort])) { |
|
12 | + if (!empty(classLocale::$lang['player_option_fleet_ship_sort'][$fleet_ship_sort])) { |
|
13 | 13 | // player_save_option($user, PLAYER_OPTION_FLEET_SHIP_SORT, $fleet_ship_sort); |
14 | 14 | // player_save_option($user, PLAYER_OPTION_FLEET_SHIP_SORT_INVERSE, sys_get_param_id('fleet_ship_sort_inverse', 0)); |
15 | 15 | classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT] = $fleet_ship_sort; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $objFleet5->initDefaults($user, $planetrow, $targetVector, $target_mission, $ships, $fleet_group_mr, $speed_percent); |
43 | 43 | |
44 | 44 | |
45 | -switch($fleet_page) { |
|
45 | +switch ($fleet_page) { |
|
46 | 46 | case 1: |
47 | 47 | $objFleet5->fleetPage1(); |
48 | 48 | break; |
@@ -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 | } |
@@ -1,7 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -function sn_ube_combat_helper_round_header($round) |
|
4 | -{ |
|
3 | +function sn_ube_combat_helper_round_header($round) { |
|
5 | 4 | $header = array( |
6 | 5 | 'ИД1', |
7 | 6 | 'ИД2', |
@@ -40,13 +39,11 @@ discard block |
||
40 | 39 | print('</tr>'); |
41 | 40 | } |
42 | 41 | |
43 | -function sn_ube_combat_helper_round_footer($round = 0) |
|
44 | -{ |
|
42 | +function sn_ube_combat_helper_round_footer($round = 0) { |
|
45 | 43 | print('</table>'); |
46 | 44 | } |
47 | 45 | |
48 | -function sn_ube_combat_helper_round_row(&$unit_crossfire_result) |
|
49 | -{ |
|
46 | +function sn_ube_combat_helper_round_row(&$unit_crossfire_result) { |
|
50 | 47 | $SN = array( |
51 | 48 | SHIP_CARGO_SMALL => 'МаТр', SHIP_CARGO_BIG => 'БоТр', SHIP_CARGO_SUPER => 'СуТр', SHIP_CARGO_HYPER => 'ГпТр', |
52 | 49 | SHIP_SATTELITE_SOLAR => 'СоСп', |
@@ -10,7 +10,7 @@ |
||
10 | 10 | 'checkSpeedPercentOld' => FLIGHT_FLEET_SPEED_WRONG, |
11 | 11 | 'checkTargetInUniverse' => FLIGHT_VECTOR_BEYOND_UNIVERSE, |
12 | 12 | 'checkTargetNotSource' => FLIGHT_VECTOR_SAME_SOURCE, |
13 | - 'checkSenderNoVacation' => FLIGHT_PLAYER_VACATION_OWN, // tODO |
|
13 | + 'checkSenderNoVacation' => FLIGHT_PLAYER_VACATION_OWN, // tODO |
|
14 | 14 | 'checkTargetNoVacation' => FLIGHT_PLAYER_VACATION, |
15 | 15 | 'checkFleetNotEmpty' => FLIGHT_SHIPS_NO_SHIPS, |
16 | 16 | // 'checkUnitsPositive' => FLIGHT_SHIPS_NEGATIVE, // Unused - 'cause it's not allowed to put negative units into Unit class |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | 'factor' => 1.5, |
16 | 16 | ), |
17 | 17 | P_UNIT_PRODUCTION => array( |
18 | - RES_METAL => function ($level, $production_factor, $user, $planet_row) {return 40 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
19 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) {return -13 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
18 | + RES_METAL => function($level, $production_factor, $user, $planet_row) {return 40 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
19 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return -13 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
20 | 20 | ), |
21 | 21 | P_MINING_IS_MANAGED => true, |
22 | 22 | ), |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | 'factor' => 1.6, |
34 | 34 | ), |
35 | 35 | P_UNIT_PRODUCTION => array( |
36 | - RES_CRYSTAL => function ($level, $production_factor, $user, $planet_row) {return 32 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
37 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) {return -16 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
36 | + RES_CRYSTAL => function($level, $production_factor, $user, $planet_row) {return 32 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
37 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return -16 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
38 | 38 | ), |
39 | 39 | P_MINING_IS_MANAGED => true, |
40 | 40 | ), |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | 'factor' => 1.5, |
52 | 52 | ), |
53 | 53 | P_UNIT_PRODUCTION => array( |
54 | - RES_DEUTERIUM => function ($level, $production_factor, $user, $planet_row) {return 10 * $level * pow(1.1, $level) * (0.1 * $production_factor) * (-0.002 * $planet_row["temp_max"] + 1.28);}, |
|
55 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) {return -20 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
54 | + RES_DEUTERIUM => function($level, $production_factor, $user, $planet_row) {return 10 * $level * pow(1.1, $level) * (0.1 * $production_factor) * (-0.002 * $planet_row["temp_max"] + 1.28); }, |
|
55 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return -20 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
56 | 56 | ), |
57 | 57 | P_MINING_IS_MANAGED => true, |
58 | 58 | ), |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | 'factor' => 1.5, |
70 | 70 | ), |
71 | 71 | P_UNIT_PRODUCTION => array( |
72 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) {return ($planet_row["temp_max"] / 5 + 15) * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
72 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return ($planet_row["temp_max"] / 5 + 15) * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
73 | 73 | ), |
74 | 74 | P_MINING_IS_MANAGED => true, |
75 | 75 | ), |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | 'factor' => 1.8, |
88 | 88 | ), |
89 | 89 | P_UNIT_PRODUCTION => array( |
90 | - RES_DEUTERIUM => function ($level, $production_factor, $user, $planet_row) {return -10 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
91 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) {return 30 * $level * pow(1.05 + 0.01 * mrc_get_level($user, null, TECH_ENERGY), $level) * (0.1 * $production_factor);}, |
|
90 | + RES_DEUTERIUM => function($level, $production_factor, $user, $planet_row) {return -10 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
91 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return 30 * $level * pow(1.05 + 0.01 * mrc_get_level($user, null, TECH_ENERGY), $level) * (0.1 * $production_factor); }, |
|
92 | 92 | ), |
93 | 93 | P_MINING_IS_MANAGED => true, |
94 | 94 | ), |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | 'factor' => 2, |
106 | 106 | ), |
107 | 107 | 'storage' => array( |
108 | - RES_METAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level);}, |
|
108 | + RES_METAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level); }, |
|
109 | 109 | ), |
110 | 110 | ), |
111 | 111 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | 'factor' => 2, |
122 | 122 | ), |
123 | 123 | 'storage' => array( |
124 | - RES_CRYSTAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level);}, |
|
124 | + RES_CRYSTAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level); }, |
|
125 | 125 | ), |
126 | 126 | ), |
127 | 127 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | 'factor' => 2, |
138 | 138 | ), |
139 | 139 | 'storage' => array( |
140 | - RES_DEUTERIUM => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level);}, |
|
140 | + RES_DEUTERIUM => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level); }, |
|
141 | 141 | ), |
142 | 142 | ), |
143 | 143 |