@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Защита от двойного инита |
4 | -if(defined('INIT')) { |
|
4 | +if (defined('INIT')) { |
|
5 | 5 | return; |
6 | 6 | } |
7 | 7 | |
@@ -20,22 +20,22 @@ discard block |
||
20 | 20 | version_compare(PHP_VERSION, '5.3.2') < 0 ? die('FATAL ERROR: SuperNova REQUIRE PHP version > 5.3.2') : false; |
21 | 21 | |
22 | 22 | // Бенчмарк |
23 | -register_shutdown_function(function () { |
|
24 | - if(defined('IN_AJAX')) { |
|
23 | +register_shutdown_function(function() { |
|
24 | + if (defined('IN_AJAX')) { |
|
25 | 25 | return; |
26 | 26 | } |
27 | 27 | |
28 | 28 | global $user, $locale_cache_statistic; |
29 | 29 | |
30 | - print('<hr><div class="benchmark">Benchmark ' . (microtime(true) - SN_TIME_MICRO) . 's, memory: ' . number_format(memory_get_usage() - SN_MEM_START) . |
|
31 | - (!empty($locale_cache_statistic['misses']) ? ', LOCALE MISSED' : '') . |
|
32 | - (class_exists('classSupernova') && is_object(classSupernova::$db) ? ', DB time: ' . classSupernova::$db->time_mysql_total . 'ms' : '') . |
|
30 | + print('<hr><div class="benchmark">Benchmark '.(microtime(true) - SN_TIME_MICRO).'s, memory: '.number_format(memory_get_usage() - SN_MEM_START). |
|
31 | + (!empty($locale_cache_statistic['misses']) ? ', LOCALE MISSED' : ''). |
|
32 | + (class_exists('classSupernova') && is_object(classSupernova::$db) ? ', DB time: '.classSupernova::$db->time_mysql_total.'ms' : ''). |
|
33 | 33 | '</div>'); |
34 | - if($user['authlevel'] >= 2 && file_exists(SN_ROOT_PHYSICAL . 'badqrys.txt') && @filesize(SN_ROOT_PHYSICAL . 'badqrys.txt') > 0) { |
|
34 | + if ($user['authlevel'] >= 2 && file_exists(SN_ROOT_PHYSICAL.'badqrys.txt') && @filesize(SN_ROOT_PHYSICAL.'badqrys.txt') > 0) { |
|
35 | 35 | echo '<a href="badqrys.txt" target="_blank" style="color:red">', 'HACK ALERT!', '</a>'; |
36 | 36 | } |
37 | 37 | |
38 | - if(!empty($locale_cache_statistic['misses'])) { |
|
38 | + if (!empty($locale_cache_statistic['misses'])) { |
|
39 | 39 | print('<!--'); |
40 | 40 | pdump($locale_cache_statistic); |
41 | 41 | print('-->'); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | define('SN_TIME_NOW_GMT_STRING', gmdate(DATE_ATOM, SN_TIME_NOW)); |
57 | 57 | |
58 | -if(strpos(strtolower($_SERVER['SERVER_NAME']), 'google.') !== false) { |
|
58 | +if (strpos(strtolower($_SERVER['SERVER_NAME']), 'google.') !== false) { |
|
59 | 59 | define('SN_GOOGLE', true); |
60 | 60 | } |
61 | 61 | |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | $sn_root_relative = str_replace($sn_root_relative, '', $_SERVER['SCRIPT_NAME']); |
75 | 75 | define('SN_ROOT_RELATIVE', $sn_root_relative); |
76 | 76 | |
77 | -define('SN_ROOT_VIRTUAL', 'http' . (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . SN_ROOT_RELATIVE); |
|
77 | +define('SN_ROOT_VIRTUAL', 'http'.(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '').'://'.$_SERVER['HTTP_HOST'].SN_ROOT_RELATIVE); |
|
78 | 78 | define('SN_ROOT_VIRTUAL_PARENT', str_replace('//google.', '//', SN_ROOT_VIRTUAL)); |
79 | 79 | |
80 | 80 | $phpEx = strpos($phpEx = substr(strrchr(__FILE__, '.'), 1), '/') === false ? $phpEx : ''; |
81 | 81 | define('PHP_EX', $phpEx); // PHP extension on this server |
82 | -define('DOT_PHP_EX', '.' . PHP_EX); // PHP extension on this server |
|
82 | +define('DOT_PHP_EX', '.'.PHP_EX); // PHP extension on this server |
|
83 | 83 | |
84 | 84 | |
85 | 85 | require_once('constants.php'); |
@@ -100,16 +100,16 @@ discard block |
||
100 | 100 | |
101 | 101 | // required for db.php |
102 | 102 | // Initializing global 'debug' object |
103 | -require_once(SN_ROOT_PHYSICAL . "includes/debug.class" . DOT_PHP_EX); |
|
103 | +require_once(SN_ROOT_PHYSICAL."includes/debug.class".DOT_PHP_EX); |
|
104 | 104 | classSupernova::$debug = new debug(); |
105 | 105 | |
106 | -empty($classRoot) ? $classRoot = SN_ROOT_PHYSICAL . 'includes/classes/' : false; |
|
107 | -spl_autoload_register(function ($class) use ($classRoot) { |
|
106 | +empty($classRoot) ? $classRoot = SN_ROOT_PHYSICAL.'includes/classes/' : false; |
|
107 | +spl_autoload_register(function($class) use ($classRoot) { |
|
108 | 108 | $class = str_replace('\\', '/', $class); |
109 | - if (file_exists($classRoot . $class . '.php')) { |
|
110 | - require_once $classRoot . $class . '.php'; |
|
111 | - } elseif (file_exists($classRoot . 'UBE/' . $class . '.php')) { |
|
112 | - require_once $classRoot . 'UBE/' . $class . '.php'; |
|
109 | + if (file_exists($classRoot.$class.'.php')) { |
|
110 | + require_once $classRoot.$class.'.php'; |
|
111 | + } elseif (file_exists($classRoot.'UBE/'.$class.'.php')) { |
|
112 | + require_once $classRoot.'UBE/'.$class.'.php'; |
|
113 | 113 | } |
114 | 114 | }); |
115 | 115 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | //}); |
125 | 125 | |
126 | 126 | |
127 | -require_once(SN_ROOT_PHYSICAL . "includes/db" . DOT_PHP_EX); |
|
127 | +require_once(SN_ROOT_PHYSICAL."includes/db".DOT_PHP_EX); |
|
128 | 128 | require_once('classes/db_mysql_v4.php'); |
129 | 129 | require_once('classes/db_mysql_v5.php'); |
130 | 130 | require_once('classes/db_mysql.php'); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | require_once('classes/module.php'); |
138 | 138 | |
139 | 139 | require_once('classes/user_options.php'); |
140 | -require_once(SN_ROOT_PHYSICAL . "includes/init/init_functions" . DOT_PHP_EX); |
|
140 | +require_once(SN_ROOT_PHYSICAL."includes/init/init_functions".DOT_PHP_EX); |
|
141 | 141 | |
142 | 142 | /** |
143 | 143 | * @var classConfig $config |
@@ -150,8 +150,8 @@ discard block |
||
150 | 150 | // define('BE_DEBUG', true); // Отладка боевого движка |
151 | 151 | classSupernova::init_debug_state(); |
152 | 152 | |
153 | -require_once(SN_ROOT_PHYSICAL . "includes/vars/vars" . DOT_PHP_EX); |
|
154 | -require_once(SN_ROOT_PHYSICAL . "includes/general" . DOT_PHP_EX); |
|
153 | +require_once(SN_ROOT_PHYSICAL."includes/vars/vars".DOT_PHP_EX); |
|
154 | +require_once(SN_ROOT_PHYSICAL."includes/general".DOT_PHP_EX); |
|
155 | 155 | |
156 | 156 | init_update(); |
157 | 157 | |
@@ -160,28 +160,28 @@ discard block |
||
160 | 160 | ? trim(strip_tags($_GET['page'])) |
161 | 161 | : str_replace(DOT_PHP_EX, '', str_replace(SN_ROOT_RELATIVE, '', str_replace('\\', '/', $_SERVER['SCRIPT_NAME']))); |
162 | 162 | define('INITIAL_PAGE', $sn_page_name_original); |
163 | -define('SN_COOKIE', (classSupernova::$config->COOKIE_NAME ? classSupernova::$config->COOKIE_NAME : 'SuperNova') . (defined('SN_GOOGLE') ? '_G' : '')); |
|
164 | -define('SN_COOKIE_I', SN_COOKIE . AUTH_COOKIE_IMPERSONATE_SUFFIX); |
|
165 | -define('SN_COOKIE_D', SN_COOKIE . '_D'); |
|
166 | -define('SN_COOKIE_T', SN_COOKIE . '_T'); // Time measure cookie |
|
167 | -define('SN_COOKIE_F', SN_COOKIE . '_F'); // Font size cookie |
|
168 | -define('SN_COOKIE_U', SN_COOKIE . '_U'); // Current user cookie aka user ID |
|
169 | -define('SN_COOKIE_U_I', SN_COOKIE_U . AUTH_COOKIE_IMPERSONATE_SUFFIX); // Current impersonator user cookie aka impersonator user ID |
|
163 | +define('SN_COOKIE', (classSupernova::$config->COOKIE_NAME ? classSupernova::$config->COOKIE_NAME : 'SuperNova').(defined('SN_GOOGLE') ? '_G' : '')); |
|
164 | +define('SN_COOKIE_I', SN_COOKIE.AUTH_COOKIE_IMPERSONATE_SUFFIX); |
|
165 | +define('SN_COOKIE_D', SN_COOKIE.'_D'); |
|
166 | +define('SN_COOKIE_T', SN_COOKIE.'_T'); // Time measure cookie |
|
167 | +define('SN_COOKIE_F', SN_COOKIE.'_F'); // Font size cookie |
|
168 | +define('SN_COOKIE_U', SN_COOKIE.'_U'); // Current user cookie aka user ID |
|
169 | +define('SN_COOKIE_U_I', SN_COOKIE_U.AUTH_COOKIE_IMPERSONATE_SUFFIX); // Current impersonator user cookie aka impersonator user ID |
|
170 | 170 | define('TEMPLATE_NAME', classSupernova::$config->game_default_template ? classSupernova::$config->game_default_template : 'OpenGame'); |
171 | -define('TEMPLATE_PATH', 'design/templates/' . TEMPLATE_NAME); |
|
172 | -define('TEMPLATE_DIR', SN_ROOT_PHYSICAL . TEMPLATE_PATH); |
|
171 | +define('TEMPLATE_PATH', 'design/templates/'.TEMPLATE_NAME); |
|
172 | +define('TEMPLATE_DIR', SN_ROOT_PHYSICAL.TEMPLATE_PATH); |
|
173 | 173 | define('DEFAULT_SKINPATH', classSupernova::$config->game_default_skin ? classSupernova::$config->game_default_skin : 'skins/EpicBlue/'); |
174 | 174 | define('DEFAULT_LANG', classSupernova::$config->game_default_language ? classSupernova::$config->game_default_language : 'ru'); |
175 | 175 | define('FMT_DATE', classSupernova::$config->int_format_date ? classSupernova::$config->int_format_date : 'd.m.Y'); |
176 | 176 | define('FMT_TIME', classSupernova::$config->int_format_time ? classSupernova::$config->int_format_time : 'H:i:s'); |
177 | -define('FMT_DATE_TIME', FMT_DATE . ' ' . FMT_TIME); |
|
177 | +define('FMT_DATE_TIME', FMT_DATE.' '.FMT_TIME); |
|
178 | 178 | |
179 | 179 | $HTTP_ACCEPT_LANGUAGE = DEFAULT_LANG; |
180 | 180 | |
181 | -require_once(SN_ROOT_PHYSICAL . "includes/template" . DOT_PHP_EX); |
|
181 | +require_once(SN_ROOT_PHYSICAL."includes/template".DOT_PHP_EX); |
|
182 | 182 | $template_result = array('.' => array('result' => array())); |
183 | 183 | |
184 | -sn_sys_load_php_files(SN_ROOT_PHYSICAL . "includes/functions/", PHP_EX); |
|
184 | +sn_sys_load_php_files(SN_ROOT_PHYSICAL."includes/functions/", PHP_EX); |
|
185 | 185 | |
186 | 186 | |
187 | 187 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | // Конфиг - часть манифеста? |
193 | 193 | classSupernova::$auth = new core_auth(); |
194 | 194 | |
195 | -sn_sys_load_php_files(SN_ROOT_PHYSICAL . "modules/", PHP_EX, true); |
|
195 | +sn_sys_load_php_files(SN_ROOT_PHYSICAL."modules/", PHP_EX, true); |
|
196 | 196 | // Здесь - потому что core_auth модуль лежит в другом каталоге и его нужно инициализировать отдельно |
197 | 197 | |
198 | 198 | // Подключаем дефолтную страницу |
@@ -200,10 +200,10 @@ discard block |
||
200 | 200 | // Сейчас мы делаем это здесь только для того, что бы содержание дефолтной страницы оказалось вверху. Что не факт, что нужно всегда |
201 | 201 | // Но нужно, пока у нас есть не MVC-страницы |
202 | 202 | $sn_page_data = $sn_data['pages'][$sn_page_name]; |
203 | -$sn_page_name_file = 'includes/pages/' . $sn_page_data['filename'] . DOT_PHP_EX; |
|
204 | -if($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
203 | +$sn_page_name_file = 'includes/pages/'.$sn_page_data['filename'].DOT_PHP_EX; |
|
204 | +if ($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
205 | 205 | require_once($sn_page_name_file); |
206 | - if(is_array($sn_page_data['options'])) { |
|
206 | + if (is_array($sn_page_data['options'])) { |
|
207 | 207 | classSupernova::$options = array_merge(classSupernova::$options, $sn_page_data['options']); |
208 | 208 | } |
209 | 209 | } |
@@ -218,10 +218,10 @@ discard block |
||
218 | 218 | $load_order = array(); |
219 | 219 | $sn_req = array(); |
220 | 220 | |
221 | -foreach(sn_module::$sn_module as $loaded_module_name => $module_data) { |
|
221 | +foreach (sn_module::$sn_module as $loaded_module_name => $module_data) { |
|
222 | 222 | $load_order[$loaded_module_name] = isset($module_data->manifest['load_order']) && !empty($module_data->manifest['load_order']) ? $module_data->manifest['load_order'] : 100000; |
223 | - if(isset($module_data->manifest['require']) && !empty($module_data->manifest['require'])) { |
|
224 | - foreach($module_data->manifest['require'] as $require_name) { |
|
223 | + if (isset($module_data->manifest['require']) && !empty($module_data->manifest['require'])) { |
|
224 | + foreach ($module_data->manifest['require'] as $require_name) { |
|
225 | 225 | $sn_req[$loaded_module_name][$require_name] = 0; |
226 | 226 | } |
227 | 227 | } |
@@ -234,10 +234,10 @@ discard block |
||
234 | 234 | do { |
235 | 235 | $prev_order = $load_order; |
236 | 236 | |
237 | - foreach($sn_req as $loaded_module_name => &$req_data) { |
|
237 | + foreach ($sn_req as $loaded_module_name => &$req_data) { |
|
238 | 238 | $level = 1; |
239 | - foreach($req_data as $req_name => &$req_level) { |
|
240 | - if($load_order[$req_name] == -1 || !isset($load_order[$req_name])) { |
|
239 | + foreach ($req_data as $req_name => &$req_level) { |
|
240 | + if ($load_order[$req_name] == -1 || !isset($load_order[$req_name])) { |
|
241 | 241 | $level = $req_level = -1; |
242 | 242 | break; |
243 | 243 | } else { |
@@ -245,20 +245,20 @@ discard block |
||
245 | 245 | } |
246 | 246 | $req_level = $load_order[$req_name]; |
247 | 247 | } |
248 | - if($level > $load_order[$loaded_module_name] || $level == -1) { |
|
248 | + if ($level > $load_order[$loaded_module_name] || $level == -1) { |
|
249 | 249 | $load_order[$loaded_module_name] = $level; |
250 | 250 | } |
251 | 251 | } |
252 | -} while($prev_order != $load_order); |
|
252 | +} while ($prev_order != $load_order); |
|
253 | 253 | |
254 | 254 | asort($load_order); |
255 | 255 | |
256 | 256 | // Инициализируем модули |
257 | 257 | // По нормальным делам это должна быть загрузка модулей и лишь затем инициализация - что бы минимизировать размер процесса в памяти |
258 | -foreach($load_order as $loaded_module_name => $load_order_order) { |
|
259 | - if($load_order_order >= 0) { |
|
258 | +foreach ($load_order as $loaded_module_name => $load_order_order) { |
|
259 | + if ($load_order_order >= 0) { |
|
260 | 260 | sn_module::$sn_module[$loaded_module_name]->check_status(); |
261 | - if(!sn_module::$sn_module[$loaded_module_name]->manifest['active']) { |
|
261 | + if (!sn_module::$sn_module[$loaded_module_name]->manifest['active']) { |
|
262 | 262 | unset(sn_module::$sn_module[$loaded_module_name]); |
263 | 263 | continue; |
264 | 264 | } |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | unset($sn_req); |
276 | 276 | |
277 | 277 | // А теперь проверяем - поддерживают ли у нас загруженный код такую страницу |
278 | -if(!isset($sn_data['pages'][$sn_page_name])) { |
|
278 | +if (!isset($sn_data['pages'][$sn_page_name])) { |
|
279 | 279 | $sn_page_name = ''; |
280 | 280 | } |
281 | 281 | |
@@ -283,6 +283,6 @@ discard block |
||
283 | 283 | classLocale::$lang = $lang = new classLocale(classSupernova::$config->server_locale_log_usage); |
284 | 284 | classLocale::$lang->lng_switch(sys_get_param_str('lang')); |
285 | 285 | |
286 | -if(!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) { |
|
286 | +if (!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) { |
|
287 | 287 | require_once "init_secondary.php"; |
288 | 288 | } |
@@ -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 |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | 'shield' => 10, |
36 | 36 | 'armor' => 400, |
37 | 37 | 'attack' => 5, |
38 | - 'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250, ), |
|
38 | + 'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250,), |
|
39 | 39 | ), |
40 | 40 | SHIP_CARGO_BIG => array( |
41 | 41 | 'name' => 'big_ship_cargo', |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | 'shield' => 25, |
56 | 56 | 'armor' => 1200, |
57 | 57 | 'attack' => 5, |
58 | - 'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250, ), |
|
58 | + 'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250,), |
|
59 | 59 | 'engine' => array( |
60 | 60 | array( |
61 | 61 | 'tech' => TECH_ENGINE_CHEMICAL, |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | 'shield' => 50, |
84 | 84 | 'armor' => 3000, |
85 | 85 | 'attack' => 10, |
86 | - 'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250, ), |
|
86 | + 'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250,), |
|
87 | 87 | 'engine' => array( |
88 | 88 | array( |
89 | 89 | 'tech' => TECH_ENGINE_ION, |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | 'shield' => 200, |
112 | 112 | 'armor' => 70000, |
113 | 113 | 'attack' => 50, |
114 | - 'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250, ), |
|
114 | + 'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250,), |
|
115 | 115 | 'engine' => array( |
116 | 116 | array( |
117 | 117 | 'tech' => TECH_ENGINE_HYPER, |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | 'shield' => 100, |
141 | 141 | 'armor' => 3000, |
142 | 142 | 'attack' => 50, |
143 | - 'amplify' => array(SHIP_SPY => 10.001, SHIP_SATTELITE_SOLAR => 21, ), |
|
143 | + 'amplify' => array(SHIP_SPY => 10.001, SHIP_SATTELITE_SOLAR => 21,), |
|
144 | 144 | 'engine' => array( |
145 | 145 | array( |
146 | 146 | 'tech' => TECH_ENGINE_ION, |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | 'shield' => 10, |
169 | 169 | 'armor' => 1600, |
170 | 170 | 'attack' => 1, |
171 | - 'amplify' => array(SHIP_SPY => 500.05, SHIP_SATTELITE_SOLAR => 1050, ), |
|
171 | + 'amplify' => array(SHIP_SPY => 500.05, SHIP_SATTELITE_SOLAR => 1050,), |
|
172 | 172 | 'engine' => array( |
173 | 173 | array( |
174 | 174 | 'tech' => TECH_ENGINE_CHEMICAL, |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | 'shield' => 0.01, |
197 | 197 | 'armor' => 100, |
198 | 198 | 'attack' => 0.01, |
199 | - 'amplify' => array( SHIP_SPY => 1,), |
|
199 | + 'amplify' => array(SHIP_SPY => 1,), |
|
200 | 200 | 'engine' => array( |
201 | 201 | array( |
202 | 202 | 'tech' => TECH_ENGINE_CHEMICAL, |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | 'factor' => 1, |
221 | 221 | ), |
222 | 222 | P_UNIT_PRODUCTION => array( |
223 | - RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return ($planet_row["temp_max"] / 4 + 20) * $level * (0.1 * $production_factor);}, |
|
223 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return ($planet_row["temp_max"] / 4 + 20) * $level * (0.1 * $production_factor); }, |
|
224 | 224 | ), |
225 | 225 | P_MINING_IS_MANAGED => true, |
226 | 226 | |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | 'shield' => 10, |
230 | 230 | 'armor' => 200, |
231 | 231 | 'attack' => 1, |
232 | - 'amplify' => array(SHIP_SPY => 1, ), |
|
232 | + 'amplify' => array(SHIP_SPY => 1,), |
|
233 | 233 | 'engine' => array( |
234 | 234 | array( |
235 | 235 | 'tech' => TECH_ENGINE_CHEMICAL, |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | 'shield' => 10, |
262 | 262 | 'armor' => 400, |
263 | 263 | 'attack' => 50, |
264 | - 'amplify' => array(SHIP_CARGO_SMALL => 16.4, SHIP_SPY => 10.001, SHIP_SATTELITE_SOLAR => 21, ), |
|
264 | + 'amplify' => array(SHIP_CARGO_SMALL => 16.4, SHIP_SPY => 10.001, SHIP_SATTELITE_SOLAR => 21,), |
|
265 | 265 | 'engine' => array( |
266 | 266 | array( |
267 | 267 | 'tech' => TECH_ENGINE_CHEMICAL, |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | 'shield' => 25, |
291 | 291 | 'armor' => 1000, |
292 | 292 | 'attack' => 150, |
293 | - 'amplify' => array(SHIP_CARGO_SMALL => 8.2, SHIP_SPY => 3.33367, SHIP_SATTELITE_SOLAR => 7, ), |
|
293 | + 'amplify' => array(SHIP_CARGO_SMALL => 8.2, SHIP_SPY => 3.33367, SHIP_SATTELITE_SOLAR => 7,), |
|
294 | 294 | 'engine' => array( |
295 | 295 | array( |
296 | 296 | 'tech' => TECH_ENGINE_ION, |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | 'shield' => 50, |
350 | 350 | 'armor' => 2700, |
351 | 351 | 'attack' => 400, |
352 | - 'amplify' => array(SHIP_SMALL_FIGHTER_LIGHT => 6.15, SHIP_SPY => 1.25013, SHIP_SATTELITE_SOLAR => 2.625, UNIT_DEF_TURRET_MISSILE => 5.5, ), |
|
352 | + 'amplify' => array(SHIP_SMALL_FIGHTER_LIGHT => 6.15, SHIP_SPY => 1.25013, SHIP_SATTELITE_SOLAR => 2.625, UNIT_DEF_TURRET_MISSILE => 5.5,), |
|
353 | 353 | 'engine' => array( |
354 | 354 | array( |
355 | 355 | 'tech' => TECH_ENGINE_ION, |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | 'shield' => 200, |
409 | 409 | 'armor' => 6000, |
410 | 410 | 'attack' => 1000, |
411 | - 'amplify' => array(SHIP_SPY => 0.50005, SHIP_SATTELITE_SOLAR => 1.05, UNIT_DEF_TURRET_MISSILE => 1.76, ), |
|
411 | + 'amplify' => array(SHIP_SPY => 0.50005, SHIP_SATTELITE_SOLAR => 1.05, UNIT_DEF_TURRET_MISSILE => 1.76,), |
|
412 | 412 | 'engine' => array( |
413 | 413 | array( |
414 | 414 | 'tech' => TECH_ENGINE_HYPER, |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | 'shield' => 500, |
505 | 505 | 'armor' => 11000, |
506 | 506 | 'attack' => 2000, |
507 | - 'amplify' => array(SHIP_SPY => 0.25003, SHIP_SATTELITE_SOLAR => 0.525, SHIP_LARGE_BATTLESHIP => 7.4, UNIT_DEF_TURRET_LASER_SMALL => 1.125, ), |
|
507 | + 'amplify' => array(SHIP_SPY => 0.25003, SHIP_SATTELITE_SOLAR => 0.525, SHIP_LARGE_BATTLESHIP => 7.4, UNIT_DEF_TURRET_LASER_SMALL => 1.125,), |
|
508 | 508 | 'engine' => array( |
509 | 509 | array( |
510 | 510 | 'tech' => TECH_ENGINE_HYPER, |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | 'shield' => 20, |
609 | 609 | 'armor' => 200, |
610 | 610 | 'attack' => 80, |
611 | - 'amplify' => array(SHIP_SPY => 7, ), |
|
611 | + 'amplify' => array(SHIP_SPY => 7,), |
|
612 | 612 | ), |
613 | 613 | UNIT_DEF_TURRET_LASER_SMALL => array( |
614 | 614 | 'name' => 'small_laser', |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | 'shield' => 25, |
627 | 627 | 'armor' => 200, |
628 | 628 | 'attack' => 100, |
629 | - 'amplify' => array(SHIP_SPY => 5, ), |
|
629 | + 'amplify' => array(SHIP_SPY => 5,), |
|
630 | 630 | ), |
631 | 631 | UNIT_DEF_TURRET_LASER_BIG => array( |
632 | 632 | 'name' => 'big_laser', |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | 'shield' => 100, |
645 | 645 | 'armor' => 800, |
646 | 646 | 'attack' => 250, |
647 | - 'amplify' => array(SHIP_SPY => 2, ), |
|
647 | + 'amplify' => array(SHIP_SPY => 2,), |
|
648 | 648 | ), |
649 | 649 | UNIT_DEF_TURRET_GAUSS => array( |
650 | 650 | 'name' => 'gauss_canyon', |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | 'armor' => 3500, |
663 | 663 | 'shield' => 200, |
664 | 664 | 'attack' => 1100, |
665 | - 'amplify' => array(SHIP_SPY => 0.5, ), |
|
665 | + 'amplify' => array(SHIP_SPY => 0.5,), |
|
666 | 666 | ), |
667 | 667 | UNIT_DEF_TURRET_ION => array( |
668 | 668 | 'name' => 'ionic_canyon', |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | 'shield' => 500, |
681 | 681 | 'armor' => 800, |
682 | 682 | 'attack' => 150, |
683 | - 'amplify' => array(SHIP_SPY => 3.3, ), |
|
683 | + 'amplify' => array(SHIP_SPY => 3.3,), |
|
684 | 684 | ), |
685 | 685 | UNIT_DEF_TURRET_PLASMA => array( |
686 | 686 | 'name' => 'buster_canyon', |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | 'shield' => 300, |
699 | 699 | 'armor' => 10000, |
700 | 700 | 'attack' => 3000, |
701 | - 'amplify' => array(SHIP_SPY => 0.17, ), |
|
701 | + 'amplify' => array(SHIP_SPY => 0.17,), |
|
702 | 702 | ), |
703 | 703 | |
704 | 704 | UNIT_DEF_SHIELD_SMALL => array( |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | 'shield' => 2000, |
719 | 719 | 'armor' => 2000, |
720 | 720 | 'attack' => 1, |
721 | - 'amplify' => array(SHIP_SPY => 500, ), |
|
721 | + 'amplify' => array(SHIP_SPY => 500,), |
|
722 | 722 | ), |
723 | 723 | UNIT_DEF_SHIELD_BIG => array( |
724 | 724 | 'name' => 'big_protection_shield', |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | 'shield' => 2000, |
738 | 738 | 'armor' => 10000, |
739 | 739 | 'attack' => 1, |
740 | - 'amplify' => array(SHIP_SPY => 500, ), |
|
740 | + 'amplify' => array(SHIP_SPY => 500,), |
|
741 | 741 | ), |
742 | 742 | UNIT_DEF_SHIELD_PLANET => array( |
743 | 743 | 'name' => 'planet_protector', |
@@ -104,21 +104,21 @@ discard block |
||
104 | 104 | 'LEVEL' => 'submenu', |
105 | 105 | 'TYPE' => 'lang', |
106 | 106 | 'ITEM' => 'tech[UNIT_STRUCTURES]', |
107 | - 'LINK' => 'buildings.php?mode=' . QUE_STRUCTURES, |
|
107 | + 'LINK' => 'buildings.php?mode='.QUE_STRUCTURES, |
|
108 | 108 | 'ICON' => true, |
109 | 109 | ), |
110 | 110 | 'menu_planet_shipyard' => array( |
111 | 111 | 'LEVEL' => 'submenu', |
112 | 112 | 'TYPE' => 'lang', |
113 | 113 | 'ITEM' => 'Shipyard', |
114 | - 'LINK' => 'buildings.php?mode=' . SUBQUE_FLEET, |
|
114 | + 'LINK' => 'buildings.php?mode='.SUBQUE_FLEET, |
|
115 | 115 | 'ICON' => true, |
116 | 116 | ), |
117 | 117 | 'menu_planet_defense' => array( |
118 | 118 | 'LEVEL' => 'submenu', |
119 | 119 | 'TYPE' => 'lang', |
120 | 120 | 'ITEM' => 'Defense', |
121 | - 'LINK' => 'buildings.php?mode=' . SUBQUE_DEFENSE, |
|
121 | + 'LINK' => 'buildings.php?mode='.SUBQUE_DEFENSE, |
|
122 | 122 | 'ICON' => true, |
123 | 123 | ), |
124 | 124 | 'menu_planet_resources' => array( |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | 'LEVEL' => 'submenu', |
148 | 148 | 'TYPE' => 'lang', |
149 | 149 | 'ITEM' => 'Research', |
150 | - 'LINK' => 'buildings.php?mode=' . QUE_RESEARCH, |
|
150 | + 'LINK' => 'buildings.php?mode='.QUE_RESEARCH, |
|
151 | 151 | 'ICON' => true, |
152 | 152 | ), |
153 | 153 | 'menu_empire_techtree' => array( |
@@ -233,14 +233,14 @@ discard block |
||
233 | 233 | 'LEVEL' => 'submenu', |
234 | 234 | 'TYPE' => 'lang', |
235 | 235 | 'ITEM' => 'tech[UNIT_MERCENARIES]', |
236 | - 'LINK' => 'officer.php?mode=' . UNIT_MERCENARIES, |
|
236 | + 'LINK' => 'officer.php?mode='.UNIT_MERCENARIES, |
|
237 | 237 | 'ICON' => true, |
238 | 238 | ), |
239 | 239 | 'menu_empire_schematics' => array( |
240 | 240 | 'LEVEL' => 'submenu', |
241 | 241 | 'TYPE' => 'lang', |
242 | 242 | 'ITEM' => 'tech[UNIT_PLANS]', |
243 | - 'LINK' => 'officer.php?mode=' . UNIT_PLANS, |
|
243 | + 'LINK' => 'officer.php?mode='.UNIT_PLANS, |
|
244 | 244 | 'ICON' => true, |
245 | 245 | ), |
246 | 246 | 'menu_empire_artifacts' => array( |
@@ -270,14 +270,14 @@ discard block |
||
270 | 270 | 'LEVEL' => 'submenu', |
271 | 271 | 'TYPE' => 'lang', |
272 | 272 | 'ITEM' => 'Chat', |
273 | - 'LINK' => 'index.php?page=chat&mode=' . CHAT_MODE_COMMON, |
|
273 | + 'LINK' => 'index.php?page=chat&mode='.CHAT_MODE_COMMON, |
|
274 | 274 | 'ICON' => true, |
275 | 275 | ), |
276 | 276 | 'menu_ally_chat' => array( |
277 | 277 | 'LEVEL' => 'submenu', |
278 | 278 | 'TYPE' => 'lang', |
279 | 279 | 'ITEM' => 'AllyChat', |
280 | - 'LINK' => 'index.php?page=chat&mode=' . CHAT_MODE_ALLY, |
|
280 | + 'LINK' => 'index.php?page=chat&mode='.CHAT_MODE_ALLY, |
|
281 | 281 | 'ICON' => true, |
282 | 282 | 'DISABLED' => classSupernova::$config->game_mode == GAME_BLITZ, |
283 | 283 | ), |
@@ -458,8 +458,8 @@ discard block |
||
458 | 458 | ), |
459 | 459 | 'menu_admin_version_info' => array( |
460 | 460 | 'TYPE' => 'text', |
461 | - 'ITEM' => (classSupernova::$config->server_updater_check_last ? date(FMT_DATE, classSupernova::$config->server_updater_check_last) : '') . '<div class="' . |
|
462 | - $sn_version_check_class[classSupernova::$config->server_updater_check_result] . '">' . classLocale::$lang['adm_opt_ver_response_short'][classSupernova::$config->server_updater_check_result] . '</div>', |
|
461 | + 'ITEM' => (classSupernova::$config->server_updater_check_last ? date(FMT_DATE, classSupernova::$config->server_updater_check_last) : '').'<div class="'. |
|
462 | + $sn_version_check_class[classSupernova::$config->server_updater_check_result].'">'.classLocale::$lang['adm_opt_ver_response_short'][classSupernova::$config->server_updater_check_result].'</div>', |
|
463 | 463 | ), |
464 | 464 | |
465 | 465 | 'USER_AUTHLEVEL_NAME' => array( |
@@ -547,13 +547,13 @@ discard block |
||
547 | 547 | 'menu_admin_planet_list_planets' => array( |
548 | 548 | 'TYPE' => 'lang', |
549 | 549 | 'ITEM' => 'adm_pltlst', |
550 | - 'LINK' => 'admin/adm_planet_list.php?planet_type=' . PT_PLANET, |
|
550 | + 'LINK' => 'admin/adm_planet_list.php?planet_type='.PT_PLANET, |
|
551 | 551 | 'AUTH_LEVEL' => 3, |
552 | 552 | ), |
553 | 553 | 'menu_admin_planet_list_moons' => array( |
554 | 554 | 'TYPE' => 'lang', |
555 | 555 | 'ITEM' => 'adm_moonlst', |
556 | - 'LINK' => 'admin/adm_planet_list.php?planet_type=' . PT_MOON, |
|
556 | + 'LINK' => 'admin/adm_planet_list.php?planet_type='.PT_MOON, |
|
557 | 557 | 'AUTH_LEVEL' => 3, |
558 | 558 | ), |
559 | 559 | 'menu_admin_planet_moon_add' => array( |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | parent::__construct(); |
326 | 326 | $this->exists_missions = sn_get_groups('missions'); |
327 | 327 | $this->allowed_missions = $this->exists_missions; |
328 | - if(empty(static::$snGroupFleet)) { |
|
328 | + if (empty(static::$snGroupFleet)) { |
|
329 | 329 | static::$snGroupFleet = sn_get_groups('fleet'); |
330 | 330 | static::$snGroupFleetAndMissiles = sn_get_groups(array('fleet', 'missile')); |
331 | 331 | static::$snGroupRecyclers = sn_get_groups('flt_recyclers'); |
@@ -408,31 +408,31 @@ discard block |
||
408 | 408 | |
409 | 409 | return doquery( |
410 | 410 | // Блокировка самого флота |
411 | - "SELECT 1 FROM {{fleets}} AS f " . |
|
411 | + "SELECT 1 FROM {{fleets}} AS f ". |
|
412 | 412 | |
413 | 413 | // Блокировка всех юнитов, принадлежащих этому флоту |
414 | - "LEFT JOIN {{unit}} as unit ON unit.unit_location_type = " . static::$locationType . " AND unit.unit_location_id = f.fleet_id " . |
|
414 | + "LEFT JOIN {{unit}} as unit ON unit.unit_location_type = ".static::$locationType." AND unit.unit_location_id = f.fleet_id ". |
|
415 | 415 | |
416 | 416 | // Блокировка всех прилетающих и улетающих флотов, если нужно |
417 | 417 | // TODO - lock fleets by COORDINATES |
418 | - ($mission_data['dst_fleets'] ? "LEFT JOIN {{fleets}} AS fd ON fd.fleet_end_planet_id = f.fleet_end_planet_id OR fd.fleet_start_planet_id = f.fleet_end_planet_id " : '') . |
|
418 | + ($mission_data['dst_fleets'] ? "LEFT JOIN {{fleets}} AS fd ON fd.fleet_end_planet_id = f.fleet_end_planet_id OR fd.fleet_start_planet_id = f.fleet_end_planet_id " : ''). |
|
419 | 419 | // Блокировка всех юнитов, принадлежащих прилетающим и улетающим флотам - ufd = unit_fleet_destination |
420 | - ($mission_data['dst_fleets'] ? "LEFT JOIN {{unit}} AS ufd ON ufd.unit_location_type = " . static::$locationType . " AND ufd.unit_location_id = fd.fleet_id " : '') . |
|
420 | + ($mission_data['dst_fleets'] ? "LEFT JOIN {{unit}} AS ufd ON ufd.unit_location_type = ".static::$locationType." AND ufd.unit_location_id = fd.fleet_id " : ''). |
|
421 | 421 | |
422 | - ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{users}} AS ud ON ud.id = f.fleet_target_owner " : '') . |
|
422 | + ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{users}} AS ud ON ud.id = f.fleet_target_owner " : ''). |
|
423 | 423 | // Блокировка всех юнитов, принадлежащих владельцу планеты-цели |
424 | - ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS unit_player_dest ON unit_player_dest.unit_player_id = ud.id " : '') . |
|
424 | + ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS unit_player_dest ON unit_player_dest.unit_player_id = ud.id " : ''). |
|
425 | 425 | // Блокировка планеты-цели |
426 | - ($mission_data['dst_planet'] ? "LEFT JOIN {{planets}} AS pd ON pd.id = f.fleet_end_planet_id " : '') . |
|
426 | + ($mission_data['dst_planet'] ? "LEFT JOIN {{planets}} AS pd ON pd.id = f.fleet_end_planet_id " : ''). |
|
427 | 427 | // Блокировка всех юнитов, принадлежащих планете-цели - НЕ НУЖНО. Уже залочили ранее, как принадлежащие игроку-цели |
428 | 428 | // ($mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS upd ON upd.unit_location_type = " . LOC_PLANET . " AND upd.unit_location_id = pd.id " : '') . |
429 | 429 | |
430 | 430 | |
431 | - ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{users}} AS us ON us.id = f.fleet_owner " : '') . |
|
431 | + ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{users}} AS us ON us.id = f.fleet_owner " : ''). |
|
432 | 432 | // Блокировка всех юнитов, принадлежащих владельцу флота |
433 | - ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS unit_player_src ON unit_player_src.unit_player_id = us.id " : '') . |
|
433 | + ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS unit_player_src ON unit_player_src.unit_player_id = us.id " : ''). |
|
434 | 434 | // Блокировка планеты отправления |
435 | - ($mission_data['src_planet'] ? "LEFT JOIN {{planets}} AS ps ON ps.id = f.fleet_start_planet_id " : '') . |
|
435 | + ($mission_data['src_planet'] ? "LEFT JOIN {{planets}} AS ps ON ps.id = f.fleet_start_planet_id " : ''). |
|
436 | 436 | // Блокировка всех юнитов, принадлежащих планете с которой юниты были отправлены - НЕ НУЖНО. Уже залочили ранее, как принадлежащие владельцу флота |
437 | 437 | // ($mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS ups ON ups.unit_location_type = " . LOC_PLANET . " AND ups.unit_location_id = ps.id " : '') . |
438 | 438 | |
@@ -449,11 +449,11 @@ discard block |
||
449 | 449 | public function dbGetLockById($dbId) { |
450 | 450 | doquery( |
451 | 451 | // Блокировка самого флота |
452 | - "SELECT 1 FROM {{fleets}} AS FLEET0 " . |
|
452 | + "SELECT 1 FROM {{fleets}} AS FLEET0 ". |
|
453 | 453 | // Lock fleet owner |
454 | - "LEFT JOIN {{users}} as USER0 on USER0.id = FLEET0.fleet_owner " . |
|
454 | + "LEFT JOIN {{users}} as USER0 on USER0.id = FLEET0.fleet_owner ". |
|
455 | 455 | // Блокировка всех юнитов, принадлежащих этому флоту |
456 | - "LEFT JOIN {{unit}} as UNIT0 ON UNIT0.unit_location_type = " . LOC_FLEET . " AND UNIT0.unit_location_id = FLEET0.fleet_id " . |
|
456 | + "LEFT JOIN {{unit}} as UNIT0 ON UNIT0.unit_location_type = ".LOC_FLEET." AND UNIT0.unit_location_id = FLEET0.fleet_id ". |
|
457 | 457 | |
458 | 458 | // Без предварительной выборки неизвестно - куда летит этот флот. |
459 | 459 | // Поэтому надо выбирать флоты, чьи координаты прибытия ИЛИ отбытия совпадают с координатами прибытия ИЛИ отбытия текущего флота. |
@@ -469,9 +469,9 @@ discard block |
||
469 | 469 | FLEET1.fleet_end_planet = FLEET0.fleet_end_planet |
470 | 470 | " . |
471 | 471 | // Блокировка всех юнитов, принадлежащих этим флотам |
472 | - "LEFT JOIN {{unit}} as UNIT1 ON UNIT1.unit_location_type = " . LOC_FLEET . " AND UNIT1.unit_location_id = FLEET1.fleet_id " . |
|
472 | + "LEFT JOIN {{unit}} as UNIT1 ON UNIT1.unit_location_type = ".LOC_FLEET." AND UNIT1.unit_location_id = FLEET1.fleet_id ". |
|
473 | 473 | // Lock fleet owner |
474 | - "LEFT JOIN {{users}} as USER1 on USER1.id = FLEET1.fleet_owner " . |
|
474 | + "LEFT JOIN {{users}} as USER1 on USER1.id = FLEET1.fleet_owner ". |
|
475 | 475 | |
476 | 476 | "LEFT JOIN {{fleets}} AS FLEET2 ON |
477 | 477 | FLEET2.fleet_mess = 1 AND FLEET0.fleet_mess = 0 AND |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | " . |
482 | 482 | // Блокировка всех юнитов, принадлежащих этим флотам |
483 | 483 | "LEFT JOIN {{unit}} as UNIT2 ON |
484 | - UNIT2.unit_location_type = " . LOC_FLEET . " AND |
|
484 | + UNIT2.unit_location_type = " . LOC_FLEET." AND |
|
485 | 485 | UNIT2.unit_location_id = FLEET2.fleet_id |
486 | 486 | " . |
487 | 487 | // Lock fleet owner |
@@ -498,11 +498,11 @@ discard block |
||
498 | 498 | " . |
499 | 499 | // Блокировка всех юнитов, принадлежащих этим флотам |
500 | 500 | "LEFT JOIN {{unit}} as UNIT3 ON |
501 | - UNIT3.unit_location_type = " . LOC_FLEET . " AND |
|
501 | + UNIT3.unit_location_type = " . LOC_FLEET." AND |
|
502 | 502 | UNIT3.unit_location_id = FLEET3.fleet_id |
503 | 503 | " . |
504 | 504 | // Lock fleet owner |
505 | - "LEFT JOIN {{users}} as USER3 on USER3.id = FLEET3.fleet_owner " . |
|
505 | + "LEFT JOIN {{users}} as USER3 on USER3.id = FLEET3.fleet_owner ". |
|
506 | 506 | |
507 | 507 | "LEFT JOIN {{fleets}} AS FLEET4 ON |
508 | 508 | FLEET4.fleet_mess = 1 AND FLEET0.fleet_mess = 1 AND |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | " . |
513 | 513 | // Блокировка всех юнитов, принадлежащих этим флотам |
514 | 514 | "LEFT JOIN {{unit}} as UNIT4 ON |
515 | - UNIT4.unit_location_type = " . LOC_FLEET . " AND |
|
515 | + UNIT4.unit_location_type = " . LOC_FLEET." AND |
|
516 | 516 | UNIT4.unit_location_id = FLEET4.fleet_id |
517 | 517 | " . |
518 | 518 | // Lock fleet owner |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | " . |
535 | 535 | // Блокировка всех юнитов, принадлежащих этой планете |
536 | 536 | "LEFT JOIN {{unit}} as UNIT5 ON |
537 | - UNIT5.unit_location_type = " . LOC_PLANET . " AND |
|
537 | + UNIT5.unit_location_type = " . LOC_PLANET." AND |
|
538 | 538 | UNIT5.unit_location_id = PLANETS5.id |
539 | 539 | " . |
540 | 540 | |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | " . |
553 | 553 | // Блокировка всех юнитов, принадлежащих этой планете |
554 | 554 | "LEFT JOIN {{unit}} as UNIT6 ON |
555 | - UNIT6.unit_location_type = " . LOC_PLANET . " AND |
|
555 | + UNIT6.unit_location_type = " . LOC_PLANET." AND |
|
556 | 556 | UNIT6.unit_location_id = PLANETS6.id |
557 | 557 | " . |
558 | 558 | "WHERE FLEET0.fleet_id = {$dbId} GROUP BY 1 FOR UPDATE" |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | } elseif ($this->isResource($unit_id)) { |
672 | 672 | $this->resource_list[$unit_id] = $unit_count; |
673 | 673 | } else { |
674 | - throw new Exception('Trying to pass to fleet non-resource and non-ship ' . var_export($unit_array, true), FLIGHT_SHIPS_UNIT_WRONG); |
|
674 | + throw new Exception('Trying to pass to fleet non-resource and non-ship '.var_export($unit_array, true), FLIGHT_SHIPS_UNIT_WRONG); |
|
675 | 675 | } |
676 | 676 | } |
677 | 677 | } |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | * @param int $unit_count |
802 | 802 | */ |
803 | 803 | public function shipSetCount($unit_id, $unit_count = 0) { |
804 | -pdump(__CLASS__ . '->' . __FUNCTION__); |
|
804 | +pdump(__CLASS__.'->'.__FUNCTION__); |
|
805 | 805 | $this->shipAdjustCount($unit_id, $unit_count, true); |
806 | 806 | } |
807 | 807 | |
@@ -877,8 +877,8 @@ discard block |
||
877 | 877 | */ |
878 | 878 | public function shipsGetCapacityRecyclers($recycler_info) { |
879 | 879 | $recyclers_incoming_capacity = 0; |
880 | - foreach($this->shipsIterator() as $unitId => $unit) { |
|
881 | - if(!empty(static::$snGroupRecyclers[$unitId]) && $unit->count >= 1) { |
|
880 | + foreach ($this->shipsIterator() as $unitId => $unit) { |
|
881 | + if (!empty(static::$snGroupRecyclers[$unitId]) && $unit->count >= 1) { |
|
882 | 882 | $recyclers_incoming_capacity += $unit->count * $recycler_info[$unitId]['capacity']; |
883 | 883 | } |
884 | 884 | } |
@@ -1009,7 +1009,7 @@ discard block |
||
1009 | 1009 | */ |
1010 | 1010 | public function resourcesSet($resource_list) { |
1011 | 1011 | if (!empty($this->propertiesAdjusted['resource_list'])) { |
1012 | - throw new PropertyAccessException('Property "resource_list" already was adjusted so no SET is possible until dbSave in ' . get_called_class() . '::unitSetResourceList', ERR_ERROR); |
|
1012 | + throw new PropertyAccessException('Property "resource_list" already was adjusted so no SET is possible until dbSave in '.get_called_class().'::unitSetResourceList', ERR_ERROR); |
|
1013 | 1013 | } |
1014 | 1014 | $this->resourcesAdjust($resource_list, true); |
1015 | 1015 | } |
@@ -1043,7 +1043,7 @@ discard block |
||
1043 | 1043 | // Check for negative unit value |
1044 | 1044 | if ($this->resource_list[$resource_id] < 0) { |
1045 | 1045 | // TODO |
1046 | - throw new Exception('Resource ' . $resource_id . ' will become negative in ' . get_called_class() . '::unitAdjustResourceList', ERR_ERROR); |
|
1046 | + throw new Exception('Resource '.$resource_id.' will become negative in '.get_called_class().'::unitAdjustResourceList', ERR_ERROR); |
|
1047 | 1047 | } |
1048 | 1048 | } |
1049 | 1049 | } |
@@ -1211,7 +1211,7 @@ discard block |
||
1211 | 1211 | protected function populateTargetPlanetAndOwner() { |
1212 | 1212 | // If vector points to no exact object OR debris - then getting planet on coordinates |
1213 | 1213 | $targetVector = clone $this->targetVector; |
1214 | - if($targetVector->type == PT_DEBRIS || $targetVector == PT_NONE) { |
|
1214 | + if ($targetVector->type == PT_DEBRIS || $targetVector == PT_NONE) { |
|
1215 | 1215 | $targetVector->type = PT_PLANET; |
1216 | 1216 | } |
1217 | 1217 | |
@@ -1224,7 +1224,7 @@ discard block |
||
1224 | 1224 | |
1225 | 1225 | protected function printErrorIfNoShips() { |
1226 | 1226 | if ($this->unitList->unitsCount() <= 0) { |
1227 | - message(classLocale::$lang['fl_err_no_ships'], classLocale::$lang['fl_error'], 'fleet' . DOT_PHP_EX, 5); |
|
1227 | + message(classLocale::$lang['fl_err_no_ships'], classLocale::$lang['fl_error'], 'fleet'.DOT_PHP_EX, 5); |
|
1228 | 1228 | } |
1229 | 1229 | } |
1230 | 1230 | |
@@ -1559,8 +1559,8 @@ discard block |
||
1559 | 1559 | |
1560 | 1560 | public function fleetSpeed() { |
1561 | 1561 | $maxSpeed = array(); |
1562 | - foreach($this->shipsIterator() as $ship_id => $unit) { |
|
1563 | - if($unit->count > 0 && !empty(static::$snGroupFleetAndMissiles[$ship_id])) { |
|
1562 | + foreach ($this->shipsIterator() as $ship_id => $unit) { |
|
1563 | + if ($unit->count > 0 && !empty(static::$snGroupFleetAndMissiles[$ship_id])) { |
|
1564 | 1564 | $single_ship_data = get_ship_data($ship_id, $this->dbOwnerRow); |
1565 | 1565 | $maxSpeed[$ship_id] = $single_ship_data['speed']; |
1566 | 1566 | } |
@@ -1592,7 +1592,7 @@ discard block |
||
1592 | 1592 | $this->fleetPage2Prepare($planetResourcesWithoutConsumption); |
1593 | 1593 | } catch (Exception $e) { |
1594 | 1594 | // TODO - MESSAGE BOX |
1595 | - if($e instanceof ExceptionFleetInvalid) { |
|
1595 | + if ($e instanceof ExceptionFleetInvalid) { |
|
1596 | 1596 | sn_db_transaction_rollback(); |
1597 | 1597 | pdie(classLocale::$lang['fl_attack_error'][$e->getCode()]); |
1598 | 1598 | } else { |
@@ -1683,7 +1683,7 @@ discard block |
||
1683 | 1683 | $validator->validate(); |
1684 | 1684 | } catch (Exception $e) { |
1685 | 1685 | // TODO - MESSAGE BOX |
1686 | - if($e instanceof ExceptionFleetInvalid) { |
|
1686 | + if ($e instanceof ExceptionFleetInvalid) { |
|
1687 | 1687 | sn_db_transaction_rollback(); |
1688 | 1688 | pdie(classLocale::$lang['fl_attack_error'][$e->getCode()]); |
1689 | 1689 | } else { |
@@ -1747,7 +1747,7 @@ discard block |
||
1747 | 1747 | |
1748 | 1748 | |
1749 | 1749 | if (!empty($this->captain['unit_id'])) { |
1750 | - DBStaticUnit::db_unit_set_by_id($this->captain['unit_id'], "`unit_location_type` = " . LOC_FLEET . ", `unit_location_id` = {$this->_dbId}"); |
|
1750 | + DBStaticUnit::db_unit_set_by_id($this->captain['unit_id'], "`unit_location_type` = ".LOC_FLEET.", `unit_location_id` = {$this->_dbId}"); |
|
1751 | 1751 | } |
1752 | 1752 | |
1753 | 1753 | // return $this->fleet->acs['ankunft'] - $this->fleet->time_launch >= $this->fleet->travelData['duration']; |
@@ -1759,7 +1759,7 @@ discard block |
||
1759 | 1759 | $template_result['.']['fleets'][] = $this->renderFleet(SN_TIME_NOW, $timeMissionJob); |
1760 | 1760 | |
1761 | 1761 | $template_result += array( |
1762 | - 'mission' => classLocale::$lang['type_mission'][$this->_mission_type] . ($this->_mission_type == MT_EXPLORE || $this->_mission_type == MT_HOLD ? ' ' . pretty_time($timeMissionJob) : ''), |
|
1762 | + 'mission' => classLocale::$lang['type_mission'][$this->_mission_type].($this->_mission_type == MT_EXPLORE || $this->_mission_type == MT_HOLD ? ' '.pretty_time($timeMissionJob) : ''), |
|
1763 | 1763 | 'dist' => pretty_number($this->travelData['distance']), |
1764 | 1764 | 'speed' => pretty_number($this->travelData['fleet_speed']), |
1765 | 1765 | 'deute_need' => pretty_number($this->travelData['consumption']), |
@@ -1803,7 +1803,7 @@ discard block |
||
1803 | 1803 | protected function resourcesSubstractConsumption($planetResources) { |
1804 | 1804 | !isset($planetResources[RES_DEUTERIUM]) ? $planetResources[RES_DEUTERIUM] = 0 : false; |
1805 | 1805 | |
1806 | - if($this->travelData['consumption'] >= 0) { |
|
1806 | + if ($this->travelData['consumption'] >= 0) { |
|
1807 | 1807 | $planetResources[RES_DEUTERIUM] -= ceil($this->travelData['consumption']); |
1808 | 1808 | } |
1809 | 1809 |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | define('SN_IN_FLEET', true); |
6 | 6 | define('SN_RENDER_NAVBAR_PLANET', true); |
7 | 7 | |
8 | -include('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
8 | +include('../common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
9 | 9 | |
10 | 10 | // TODO - Переместить это куда-нибудь |
11 | 11 | $fleet_page = sys_get_param_int('fleet_page', sys_get_param_int('mode')); |
@@ -162,17 +162,17 @@ discard block |
||
162 | 162 | // break; |
163 | 163 | } |
164 | 164 | |
165 | - if($exceptionCode !== null) { |
|
166 | - print('<span style="color: red; font-size: 200%;">FAILED! Expected Exception [' . $exceptionCode . ']: "' . classLocale::$lang['fl_attack_error'][$exceptionCode] . '" - FAILED!</span><br />'); |
|
165 | + if ($exceptionCode !== null) { |
|
166 | + print('<span style="color: red; font-size: 200%;">FAILED! Expected Exception ['.$exceptionCode.']: "'.classLocale::$lang['fl_attack_error'][$exceptionCode].'" - FAILED!</span><br />'); |
|
167 | 167 | } else { |
168 | 168 | print('Passed'); |
169 | 169 | } |
170 | 170 | } catch (Exception $e) { |
171 | 171 | if ($exceptionCode !== null && $e->getCode() === $exceptionCode) { |
172 | - print('<span style="color: darkgreen;">Exception [' . $exceptionCode . ']: "' . classLocale::$lang['fl_attack_error'][$exceptionCode] . '" - passed</span><br />'); |
|
172 | + print('<span style="color: darkgreen;">Exception ['.$exceptionCode.']: "'.classLocale::$lang['fl_attack_error'][$exceptionCode].'" - passed</span><br />'); |
|
173 | 173 | } else { |
174 | - print('<div style="color: red; font-size: 200%;">Expected Exception [' . $exceptionCode . ']: "' . classLocale::$lang['fl_attack_error'][$exceptionCode] . '" - FAILED!</div>'); |
|
175 | - print('<div style="color: red; font-size: 200%;">Got Exception [' . $e->getCode() . ']: "' . $e->getMessage() . '"/"' . classLocale::$lang['fl_attack_error'][$e->getCode()] . '" . "</div>'); |
|
174 | + print('<div style="color: red; font-size: 200%;">Expected Exception ['.$exceptionCode.']: "'.classLocale::$lang['fl_attack_error'][$exceptionCode].'" - FAILED!</div>'); |
|
175 | + print('<div style="color: red; font-size: 200%;">Got Exception ['.$e->getCode().']: "'.$e->getMessage().'"/"'.classLocale::$lang['fl_attack_error'][$e->getCode()].'" . "</div>'); |
|
176 | 176 | throw $e; |
177 | 177 | } |
178 | 178 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | |
219 | 219 | if (!empty($error_msg)) { |
220 | 220 | // TODO - Убрать позже |
221 | - print('<h1>СООБЩИТЕ ЭТО АДМИНУ: sn_db_transaction_check() - ' . $error_msg . '</h1>'); |
|
221 | + print('<h1>СООБЩИТЕ ЭТО АДМИНУ: sn_db_transaction_check() - '.$error_msg.'</h1>'); |
|
222 | 222 | $backtrace = debug_backtrace(); |
223 | 223 | array_shift($backtrace); |
224 | 224 | pdump($backtrace); |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | public static function db_transaction_start($level = '') { |
232 | 232 | static::db_transaction_check(null); |
233 | 233 | |
234 | - $level ? doquery('SET TRANSACTION ISOLATION LEVEL ' . $level) : false; |
|
234 | + $level ? doquery('SET TRANSACTION ISOLATION LEVEL '.$level) : false; |
|
235 | 235 | |
236 | 236 | static::$transaction_id++; |
237 | 237 | doquery('START TRANSACTION'); |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | public static function db_lock_tables($tables) { |
296 | 296 | $tables = is_array($tables) ? $tables : array($tables => ''); |
297 | 297 | foreach ($tables as $table_name => $condition) { |
298 | - self::$db->doquery("SELECT 1 FROM {{{$table_name}}}" . ($condition ? ' WHERE ' . $condition : '')); |
|
298 | + self::$db->doquery("SELECT 1 FROM {{{$table_name}}}".($condition ? ' WHERE '.$condition : '')); |
|
299 | 299 | } |
300 | 300 | } |
301 | 301 | |
@@ -355,8 +355,8 @@ discard block |
||
355 | 355 | $query = static::db_query( |
356 | 356 | "SELECT |
357 | 357 | distinct({{{$location_info[P_TABLE_NAME]}}}.{$owner_data[P_OWNER_FIELD]}) AS parent_id |
358 | - FROM {{{$location_info[P_TABLE_NAME]}}}" . |
|
359 | - ($filter ? ' WHERE ' . $filter : '') . |
|
358 | + FROM {{{$location_info[P_TABLE_NAME]}}}". |
|
359 | + ($filter ? ' WHERE '.$filter : ''). |
|
360 | 360 | ($fetch ? ' LIMIT 1' : ''), false, true); |
361 | 361 | |
362 | 362 | while ($row = db_fetch($query)) { |
@@ -369,13 +369,13 @@ discard block |
||
369 | 369 | if ($indexes_str = implode(',', $parent_id_list)) { |
370 | 370 | $parent_id_field = static::$location_info[$owner_location_type][P_ID]; |
371 | 371 | static::db_get_record_list($owner_location_type, |
372 | - $parent_id_field . (count($parent_id_list) > 1 ? " IN ({$indexes_str})" : " = {$indexes_str}"), $fetch, true); |
|
372 | + $parent_id_field.(count($parent_id_list) > 1 ? " IN ({$indexes_str})" : " = {$indexes_str}"), $fetch, true); |
|
373 | 373 | } |
374 | 374 | } |
375 | 375 | } |
376 | 376 | |
377 | 377 | $query = static::db_query( |
378 | - "SELECT * FROM {{{$location_info[P_TABLE_NAME]}}}" . |
|
378 | + "SELECT * FROM {{{$location_info[P_TABLE_NAME]}}}". |
|
379 | 379 | (($filter = trim($filter)) ? " WHERE {$filter}" : '') |
380 | 380 | ); |
381 | 381 | while ($row = db_fetch($query)) { |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | $condition = trim($condition); |
447 | 447 | $table_name = static::$location_info[$location_type][P_TABLE_NAME]; |
448 | 448 | |
449 | - if ($result = static::db_query("UPDATE {{{$table_name}}} SET " . $set . ($condition ? ' WHERE ' . $condition : ''))) { |
|
449 | + if ($result = static::db_query("UPDATE {{{$table_name}}} SET ".$set.($condition ? ' WHERE '.$condition : ''))) { |
|
450 | 450 | |
451 | 451 | if (static::$db->db_affected_rows()) { // Обновляем данные только если ряд был затронут |
452 | 452 | // Поскольку нам неизвестно, что и как обновилось - сбрасываем кэш этого типа полностью |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | $user = self::$db->selectRow( |
608 | 608 | DBStaticUser::buildSelect() |
609 | 609 | ->field('*') |
610 | - ->where(array("`username` " . ($like ? 'LIKE' : '=') . " '{$username_safe}'")) |
|
610 | + ->where(array("`username` ".($like ? 'LIKE' : '=')." '{$username_safe}'")) |
|
611 | 611 | ->setFetchOne() |
612 | 612 | ); |
613 | 613 | |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | } |
707 | 707 | |
708 | 708 | if (SnCache::isUnitLocatorNotSet($location_type, $location_id)) { |
709 | - $got_data = static::db_get_record_list(LOC_UNIT, "unit_location_type = {$location_type} AND unit_location_id = {$location_id} AND " . static::db_unit_time_restrictions()); |
|
709 | + $got_data = static::db_get_record_list(LOC_UNIT, "unit_location_type = {$location_type} AND unit_location_id = {$location_id} AND ".static::db_unit_time_restrictions()); |
|
710 | 710 | if (!empty($got_data) && is_array($got_data)) { |
711 | 711 | foreach ($got_data as $unit_id => $unit_data) { |
712 | 712 | SnCache::setUnitLocatorByLocationAndIDs($location_type, $location_id, $unit_data); |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | if ($que_type == QUE_RESEARCH || $planet_id === null) { |
766 | 766 | $query[] = "`que_planet_id` IS NULL"; |
767 | 767 | } elseif ($planet_id) { |
768 | - $query[] = "(`que_planet_id` = {$planet_id}" . ($que_type ? '' : ' OR que_planet_id IS NULL') . ")"; |
|
768 | + $query[] = "(`que_planet_id` = {$planet_id}".($que_type ? '' : ' OR que_planet_id IS NULL').")"; |
|
769 | 769 | } |
770 | 770 | if ($que_type) { |
771 | 771 | $query[] = "`que_type` = {$que_type}"; |
@@ -879,13 +879,13 @@ discard block |
||
879 | 879 | $condition = "`{$field_name}` = "; |
880 | 880 | $value = ''; |
881 | 881 | if ($field_data['delta']) { |
882 | - $value = "`{$field_name}`" . ($field_data['delta'] >= 0 ? '+' : '') . $field_data['delta']; |
|
882 | + $value = "`{$field_name}`".($field_data['delta'] >= 0 ? '+' : '').$field_data['delta']; |
|
883 | 883 | } elseif ($field_data['set']) { |
884 | 884 | $value = (is_string($field_data['set']) ? "'{$field_data['set']}'" : $field_data['set']); |
885 | 885 | } |
886 | 886 | |
887 | 887 | if ($value) { |
888 | - $fields[] = $condition . $value; |
|
888 | + $fields[] = $condition.$value; |
|
889 | 889 | } |
890 | 890 | } |
891 | 891 | $conditions[P_FIELDS_STR] = implode(',', $fields); |
@@ -899,9 +899,7 @@ discard block |
||
899 | 899 | // Простое условие - $field_id = $field_value |
900 | 900 | if (is_string($field_id)) { |
901 | 901 | $field_value = |
902 | - $field_value === null ? 'NULL' : |
|
903 | - (is_string($field_value) ? "'" . db_escape($field_value) . "'" : |
|
904 | - (is_bool($field_value) ? intval($field_value) : $field_value)); |
|
902 | + $field_value === null ? 'NULL' : (is_string($field_value) ? "'".db_escape($field_value)."'" : (is_bool($field_value) ? intval($field_value) : $field_value)); |
|
905 | 903 | $the_conditions[] = "`{$field_id}` = {$field_value}"; |
906 | 904 | } else { |
907 | 905 | die('Неподдерживаемый тип условия'); |
@@ -928,7 +926,7 @@ discard block |
||
928 | 926 | die('Неподдерживаемая операция в classSupernova::db_changeset_condition_compile'); |
929 | 927 | } |
930 | 928 | |
931 | - $conditions[P_QUERY_STR] = $conditions[P_ACTION_STR] . ' ' . $conditions[P_FIELDS_STR] . (' WHERE ' . $conditions[P_WHERE_STR]); |
|
929 | + $conditions[P_QUERY_STR] = $conditions[P_ACTION_STR].' '.$conditions[P_FIELDS_STR].(' WHERE '.$conditions[P_WHERE_STR]); |
|
932 | 930 | } |
933 | 931 | |
934 | 932 | public static function db_changeset_apply($db_changeset, $flush_delayed = false) { |
@@ -1026,7 +1024,7 @@ discard block |
||
1026 | 1024 | ini_get('magic_quotes_sybase') ? die('SN is incompatible with \'magic_quotes_sybase\' turned on. Disable it in php.ini or .htaccess...') : false; |
1027 | 1025 | if (@get_magic_quotes_gpc()) { |
1028 | 1026 | $gpcr = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); |
1029 | - array_walk_recursive($gpcr, function (&$value, $key) { |
|
1027 | + array_walk_recursive($gpcr, function(&$value, $key) { |
|
1030 | 1028 | $value = stripslashes($value); |
1031 | 1029 | }); |
1032 | 1030 | } |
@@ -1040,7 +1038,7 @@ discard block |
||
1040 | 1038 | public static function init_3_load_config_file() { |
1041 | 1039 | $dbsettings = array(); |
1042 | 1040 | |
1043 | - require(SN_ROOT_PHYSICAL . "config" . DOT_PHP_EX); |
|
1041 | + require(SN_ROOT_PHYSICAL."config".DOT_PHP_EX); |
|
1044 | 1042 | self::$cache_prefix = !empty($dbsettings['cache_prefix']) ? $dbsettings['cache_prefix'] : $dbsettings['prefix']; |
1045 | 1043 | self::$db_name = $dbsettings['name']; |
1046 | 1044 | self::$sn_secret_word = $dbsettings['secretword']; |
@@ -59,7 +59,7 @@ |
||
59 | 59 | if ($hard && !empty(static::$data[$location_type])) { |
60 | 60 | // Здесь нельзя делать unset - надо записывать NULL, что бы это отразилось на зависимых записях |
61 | 61 | // TODO - replace with setNull |
62 | - array_walk(static::$data[$location_type], function (&$item) { $item = null; }); |
|
62 | + array_walk(static::$data[$location_type], function(&$item) { $item = null; }); |
|
63 | 63 | } |
64 | 64 | static::$locator[$location_type] = array(); |
65 | 65 | static::$queries[$location_type] = array(); |