@@ -16,7 +16,7 @@ |
||
| 16 | 16 | $query = db_user_list("`authlevel` > 0 ORDER BY `authlevel` ASC"); |
| 17 | 17 | |
| 18 | 18 | // while($row = db_fetch($query)) |
| 19 | - foreach($query as $row) { |
|
| 19 | + foreach ($query as $row) { |
|
| 20 | 20 | $template_result['.']['contact'][] = array( |
| 21 | 21 | 'NAME' => $row['username'], |
| 22 | 22 | 'LEVEL' => classLocale::$lang['user_level'][$row['authlevel']], |
@@ -756,9 +756,11 @@ |
||
| 756 | 756 | !empty($strings) ? doquery($query_string . implode(',', $strings)) : false; |
| 757 | 757 | } |
| 758 | 758 | |
| 759 | - if(isset($update_tables['counter']['page'])) // TODO REMOVE |
|
| 759 | + if(isset($update_tables['counter']['page'])) { |
|
| 760 | + // TODO REMOVE |
|
| 760 | 761 | { |
| 761 | 762 | update_security_url("SELECT DISTINCT `page` AS url FROM {{counter}}"); |
| 763 | + } |
|
| 762 | 764 | update_security_url("SELECT DISTINCT `url` AS url FROM {{counter}}"); |
| 763 | 765 | } |
| 764 | 766 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | use Vector\Vector; |
| 25 | 25 | |
| 26 | -if(!defined('INIT')) { |
|
| 26 | +if (!defined('INIT')) { |
|
| 27 | 27 | // include_once('init.php'); |
| 28 | 28 | die('Unauthorized access'); |
| 29 | 29 | } |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | classSupernova::$config->debug = 0; |
| 42 | 42 | |
| 43 | 43 | |
| 44 | -if(classSupernova::$config->db_version == DB_VERSION) { |
|
| 45 | -} elseif(classSupernova::$config->db_version > DB_VERSION) { |
|
| 44 | +if (classSupernova::$config->db_version == DB_VERSION) { |
|
| 45 | +} elseif (classSupernova::$config->db_version > DB_VERSION) { |
|
| 46 | 46 | classSupernova::$config->db_saveItem('var_db_update_end', SN_TIME_NOW); |
| 47 | 47 | die( |
| 48 | 48 | 'Internal error! Auotupdater detects DB version greater then can be handled!<br /> |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | ); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | -if(classSupernova::$config->db_version < 26) { |
|
| 54 | +if (classSupernova::$config->db_version < 26) { |
|
| 55 | 55 | $sys_log_disabled = true; |
| 56 | 56 | } |
| 57 | 57 | |
@@ -70,20 +70,20 @@ discard block |
||
| 70 | 70 | $update_tables = array(); |
| 71 | 71 | $update_indexes = array(); |
| 72 | 72 | $query = upd_do_query('SHOW TABLES;', true); |
| 73 | -while($row = classSupernova::$db->db_fetch_row($query)) { |
|
| 73 | +while ($row = classSupernova::$db->db_fetch_row($query)) { |
|
| 74 | 74 | upd_load_table_info($row[0]); |
| 75 | 75 | } |
| 76 | 76 | upd_log_message('Table info loaded. Now looking DB for upgrades...'); |
| 77 | 77 | |
| 78 | 78 | upd_do_query('SET FOREIGN_KEY_CHECKS=0;', true); |
| 79 | 79 | |
| 80 | -if($new_version < 37) { |
|
| 80 | +if ($new_version < 37) { |
|
| 81 | 81 | require_once('update_old.php'); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | ini_set('memory_limit', '1024M'); |
| 85 | 85 | |
| 86 | -switch($new_version) { |
|
| 86 | +switch ($new_version) { |
|
| 87 | 87 | case 37: |
| 88 | 88 | upd_log_version_update(); |
| 89 | 89 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | upd_check_key('payment_currency_exchange_mm_', 2500, !classSupernova::$config->payment_currency_exchange_mm_); |
| 100 | 100 | |
| 101 | - if(!$update_tables['log_metamatter']) { |
|
| 101 | + if (!$update_tables['log_metamatter']) { |
|
| 102 | 102 | upd_create_table('log_metamatter', |
| 103 | 103 | "( |
| 104 | 104 | `id` SERIAL, |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | "ADD `payment_test` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Is this a test payment?'", |
| 124 | 124 | ), !$update_tables['payment']['payment_test']); |
| 125 | 125 | |
| 126 | - if($update_tables['payment']['payment_test']['Default'] == 1) { |
|
| 126 | + if ($update_tables['payment']['payment_test']['Default'] == 1) { |
|
| 127 | 127 | upd_alter_table('payment', array( |
| 128 | 128 | "MODIFY COLUMN `payment_test` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Is this a test payment?'", |
| 129 | 129 | )); |
@@ -139,15 +139,15 @@ discard block |
||
| 139 | 139 | "MODIFY COLUMN `metamatter` BIGINT(20) NOT NULL DEFAULT 0 COMMENT 'Metamatter amount'", |
| 140 | 140 | ), $update_tables['users']['metamatter']['Type'] == 'int(20)'); |
| 141 | 141 | |
| 142 | - $query = upd_do_query("SELECT * FROM {{que}} WHERE `que_type` = " . QUE_RESEARCH . " AND que_unit_id IN (" . TECH_EXPEDITION . "," . TECH_COLONIZATION . ") FOR UPDATE"); |
|
| 143 | - while($row = db_fetch($query)) { |
|
| 142 | + $query = upd_do_query("SELECT * FROM {{que}} WHERE `que_type` = ".QUE_RESEARCH." AND que_unit_id IN (".TECH_EXPEDITION.",".TECH_COLONIZATION.") FOR UPDATE"); |
|
| 143 | + while ($row = db_fetch($query)) { |
|
| 144 | 144 | $planet_id = ($row['que_planet_id_origin'] ? $row['que_planet_id_origin'] : $row['que_planet_id']); |
| 145 | 145 | upd_do_query("SELECT id FROM {{planets}} WHERE id = {$planet_id} FOR UPDATE"); |
| 146 | 146 | $price = sys_unit_str2arr($row['que_unit_price']); |
| 147 | - upd_do_query("UPDATE {{planets}} SET " . |
|
| 148 | - "`metal` = `metal` + " . ($price[RES_METAL] ? $price[RES_METAL] : 0) . "," . |
|
| 149 | - "`crystal` = `crystal` + " . ($price[RES_CRYSTAL] ? $price[RES_CRYSTAL] : 0) . "," . |
|
| 150 | - "`deuterium` = `deuterium` + " . ($price[RES_DEUTERIUM] ? $price[RES_DEUTERIUM] : 0) . |
|
| 147 | + upd_do_query("UPDATE {{planets}} SET ". |
|
| 148 | + "`metal` = `metal` + ".($price[RES_METAL] ? $price[RES_METAL] : 0).",". |
|
| 149 | + "`crystal` = `crystal` + ".($price[RES_CRYSTAL] ? $price[RES_CRYSTAL] : 0).",". |
|
| 150 | + "`deuterium` = `deuterium` + ".($price[RES_DEUTERIUM] ? $price[RES_DEUTERIUM] : 0). |
|
| 151 | 151 | " WHERE id = {$planet_id}" |
| 152 | 152 | ); |
| 153 | 153 | upd_do_query("DELETE FROM {{que}} WHERE que_id = {$row['que_id']}"); |
@@ -156,10 +156,10 @@ discard block |
||
| 156 | 156 | $query = upd_do_query("SELECT unit_id, unit_snid, unit_level, id_planet FROM {{unit}} AS un |
| 157 | 157 | LEFT JOIN {{users}} AS u ON u.id = un.unit_player_id |
| 158 | 158 | LEFT JOIN {{planets}} AS p ON p.id = u.id_planet |
| 159 | - WHERE unit_snid IN (" . TECH_EXPEDITION . "," . TECH_COLONIZATION . ") |
|
| 159 | + WHERE unit_snid IN (" . TECH_EXPEDITION.",".TECH_COLONIZATION.") |
|
| 160 | 160 | FOR UPDATE"); |
| 161 | - while($row = db_fetch($query)) { |
|
| 162 | - if(!$row['id_planet']) { |
|
| 161 | + while ($row = db_fetch($query)) { |
|
| 162 | + if (!$row['id_planet']) { |
|
| 163 | 163 | continue; |
| 164 | 164 | } |
| 165 | 165 | |
@@ -167,14 +167,14 @@ discard block |
||
| 167 | 167 | $unit_level = $row['unit_level']; |
| 168 | 168 | $price = get_unit_param($unit_id, P_COST); |
| 169 | 169 | $factor = $price['factor']; |
| 170 | - foreach($price as $resource_id => &$resource_amount) { |
|
| 170 | + foreach ($price as $resource_id => &$resource_amount) { |
|
| 171 | 171 | $resource_amount = $resource_amount * (pow($factor, $unit_level) - 1) / ($factor - 1); |
| 172 | 172 | } |
| 173 | 173 | // upd_do_query |
| 174 | - upd_do_query($q = "UPDATE {{planets}} SET " . |
|
| 175 | - "`metal` = `metal` + " . ($price[RES_METAL] ? $price[RES_METAL] : 0) . "," . |
|
| 176 | - "`crystal` = `crystal` + " . ($price[RES_CRYSTAL] ? $price[RES_CRYSTAL] : 0) . "," . |
|
| 177 | - "`deuterium` = `deuterium` + " . ($price[RES_DEUTERIUM] ? $price[RES_DEUTERIUM] : 0) . |
|
| 174 | + upd_do_query($q = "UPDATE {{planets}} SET ". |
|
| 175 | + "`metal` = `metal` + ".($price[RES_METAL] ? $price[RES_METAL] : 0).",". |
|
| 176 | + "`crystal` = `crystal` + ".($price[RES_CRYSTAL] ? $price[RES_CRYSTAL] : 0).",". |
|
| 177 | + "`deuterium` = `deuterium` + ".($price[RES_DEUTERIUM] ? $price[RES_DEUTERIUM] : 0). |
|
| 178 | 178 | " WHERE id = {$row['id_planet']}" |
| 179 | 179 | ); |
| 180 | 180 | upd_do_query("DELETE FROM {{unit}} WHERE unit_id = {$row['unit_id']}"); |
@@ -186,14 +186,14 @@ discard block |
||
| 186 | 186 | // Вернуть ресы за уже исследованную Экспедиционную технологию |
| 187 | 187 | upd_check_key('player_max_colonies', -1, classSupernova::$config->player_max_colonies >= 0); |
| 188 | 188 | |
| 189 | - if(!isset($update_tables['users']['player_rpg_explore_xp'])) { |
|
| 189 | + if (!isset($update_tables['users']['player_rpg_explore_xp'])) { |
|
| 190 | 190 | upd_alter_table('users', array( |
| 191 | 191 | "ADD COLUMN `player_rpg_explore_level` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 AFTER `dark_matter`", |
| 192 | 192 | "ADD COLUMN `player_rpg_explore_xp` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 AFTER `dark_matter`", |
| 193 | 193 | ), !isset($update_tables['users']['player_rpg_explore_xp'])); |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - if(!$update_tables['log_users_online']) { |
|
| 196 | + if (!$update_tables['log_users_online']) { |
|
| 197 | 197 | upd_create_table('log_users_online', "( |
| 198 | 198 | `online_timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Measure time', |
| 199 | 199 | `online_count` SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Users online', |
@@ -208,11 +208,11 @@ discard block |
||
| 208 | 208 | "ADD `user_time_measured` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'When was time diff measured last time' AFTER `onlinetime`", |
| 209 | 209 | ), !$update_tables['users']['user_time_measured']); |
| 210 | 210 | |
| 211 | - if($update_tables['rw']) { |
|
| 211 | + if ($update_tables['rw']) { |
|
| 212 | 212 | upd_do_query("DROP TABLE IF EXISTS {{rw}};"); |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - if(!$update_tables['player_award']) { |
|
| 215 | + if (!$update_tables['player_award']) { |
|
| 216 | 216 | upd_create_table('player_award', "( |
| 217 | 217 | `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
| 218 | 218 | `award_type_id` int(11) DEFAULT NULL COMMENT 'Award type i.e. order, medal, pennant, rank etc', |
@@ -254,14 +254,14 @@ discard block |
||
| 254 | 254 | upd_log_version_update(); |
| 255 | 255 | |
| 256 | 256 | |
| 257 | - if(!isset($update_tables['planets']['que_processed'])) { |
|
| 257 | + if (!isset($update_tables['planets']['que_processed'])) { |
|
| 258 | 258 | upd_alter_table('planets', array( |
| 259 | 259 | "ADD COLUMN `que_processed` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `last_update`", |
| 260 | 260 | ), true); |
| 261 | 261 | upd_do_query("UPDATE {{planets}} SET que_processed = last_update;"); |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | - if(!isset($update_tables['users']['que_processed'])) { |
|
| 264 | + if (!isset($update_tables['users']['que_processed'])) { |
|
| 265 | 265 | upd_alter_table('users', array( |
| 266 | 266 | "ADD COLUMN `que_processed` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `onlinetime`", |
| 267 | 267 | ), true); |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | |
| 272 | - if(isset($update_tables['planets']['que'])) { |
|
| 272 | + if (isset($update_tables['planets']['que'])) { |
|
| 273 | 273 | $sn_data_aux = array( |
| 274 | 274 | SHIP_SMALL_FIGHTER_WRATH => array( |
| 275 | 275 | 'name' => 'ship_fighter_wrath', |
@@ -354,20 +354,20 @@ discard block |
||
| 354 | 354 | $unit_data = array(); |
| 355 | 355 | $planets = array(); |
| 356 | 356 | |
| 357 | - foreach($planet_unit_list as $unit_id) { |
|
| 358 | - if(!($unit_name = get_unit_param($unit_id, P_NAME))) { |
|
| 357 | + foreach ($planet_unit_list as $unit_id) { |
|
| 358 | + if (!($unit_name = get_unit_param($unit_id, P_NAME))) { |
|
| 359 | 359 | $unit_name = $sn_data_aux[$unit_id][P_NAME]; |
| 360 | 360 | } |
| 361 | - if(isset($update_tables['planets'][$unit_name])) { |
|
| 361 | + if (isset($update_tables['planets'][$unit_name])) { |
|
| 362 | 362 | $drop[] = "DROP COLUMN `{$unit_name}`"; |
| 363 | 363 | |
| 364 | - if(isset($aux_group[$unit_id])) { |
|
| 364 | + if (isset($aux_group[$unit_id])) { |
|
| 365 | 365 | $units_info[$unit_id] = $sn_data_aux[$unit_id]; |
| 366 | 366 | $units_info[$unit_id]['que'] = QUE_HANGAR; |
| 367 | 367 | } else { |
| 368 | 368 | $units_info[$unit_id] = get_unit_param($unit_id); |
| 369 | - foreach($ques_info as $que_id => $que_data1) { |
|
| 370 | - if(in_array($unit_id, $que_data1['unit_list'])) { |
|
| 369 | + foreach ($ques_info as $que_id => $que_data1) { |
|
| 370 | + if (in_array($unit_id, $que_data1['unit_list'])) { |
|
| 371 | 371 | $units_info[$unit_id]['que'] = $que_id; |
| 372 | 372 | break; |
| 373 | 373 | } |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | $query = upd_do_query("SELECT * FROM {{planets}} FOR UPDATE"); |
| 380 | - while($row = db_fetch($query)) { |
|
| 380 | + while ($row = db_fetch($query)) { |
|
| 381 | 381 | $user_id = $row['id_owner']; |
| 382 | 382 | $planet_id = $row['id']; |
| 383 | 383 | |
@@ -385,25 +385,25 @@ discard block |
||
| 385 | 385 | |
| 386 | 386 | // Конвертируем юниты |
| 387 | 387 | $units_levels = array(); |
| 388 | - foreach($planet_unit_list as $unit_id) { |
|
| 388 | + foreach ($planet_unit_list as $unit_id) { |
|
| 389 | 389 | $unit_name = &$units_info[$unit_id][P_NAME]; |
| 390 | - if(!isset($row[$unit_name]) || !$row[$unit_name]) { |
|
| 390 | + if (!isset($row[$unit_name]) || !$row[$unit_name]) { |
|
| 391 | 391 | continue; |
| 392 | 392 | } |
| 393 | 393 | $units_levels[$unit_id] = $row[$unit_name]; |
| 394 | - $unit_data[] = "({$user_id}," . LOC_PLANET . ",{$planet_id},{$units_info[$unit_id][P_UNIT_TYPE]},{$unit_id},{$units_levels[$unit_id]})"; |
|
| 395 | - if(count($unit_data) > 30) { |
|
| 394 | + $unit_data[] = "({$user_id},".LOC_PLANET.",{$planet_id},{$units_info[$unit_id][P_UNIT_TYPE]},{$unit_id},{$units_levels[$unit_id]})"; |
|
| 395 | + if (count($unit_data) > 30) { |
|
| 396 | 396 | $unit_data_max = strlen(implode(',', $unit_data)) > $unit_data_max ? strlen(implode(',', $unit_data)) : $unit_data_max; |
| 397 | - upd_do_query('REPLACE INTO {{unit}} (`unit_player_id`, `unit_location_type`, `unit_location_id`, `unit_type`, `unit_snid`, `unit_level`) VALUES ' . implode(',', $unit_data) . ';'); |
|
| 397 | + upd_do_query('REPLACE INTO {{unit}} (`unit_player_id`, `unit_location_type`, `unit_location_id`, `unit_type`, `unit_snid`, `unit_level`) VALUES '.implode(',', $unit_data).';'); |
|
| 398 | 398 | $unit_data = array(); |
| 399 | 399 | } |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | // Конвертируем очередь построек |
| 403 | - if($row['que']) { |
|
| 403 | + if ($row['que']) { |
|
| 404 | 404 | $que = explode(';', $row['que']); |
| 405 | - foreach($que as $que_item) { |
|
| 406 | - if(!$que_item) { |
|
| 405 | + foreach ($que as $que_item) { |
|
| 406 | + if (!$que_item) { |
|
| 407 | 407 | continue; |
| 408 | 408 | } |
| 409 | 409 | |
@@ -418,8 +418,8 @@ discard block |
||
| 418 | 418 | $unit_factor = $unit_cost[P_FACTOR] ? $unit_cost[P_FACTOR] : 1; |
| 419 | 419 | $price_increase = pow($unit_factor, $unit_level); |
| 420 | 420 | // $unit_time = 0; |
| 421 | - foreach($unit_cost as $resource_id => &$resource_amount) { |
|
| 422 | - if(!in_array($resource_id, $group_resource_loot)) { |
|
| 421 | + foreach ($unit_cost as $resource_id => &$resource_amount) { |
|
| 422 | + if (!in_array($resource_id, $group_resource_loot)) { |
|
| 423 | 423 | unset($unit_cost[$resource_id]); |
| 424 | 424 | continue; |
| 425 | 425 | } |
@@ -433,39 +433,39 @@ discard block |
||
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | // Конвертируем очередь верфи |
| 436 | - if($row['b_hangar_id']) { |
|
| 436 | + if ($row['b_hangar_id']) { |
|
| 437 | 437 | $return_resources = array(RES_METAL => 0, RES_CRYSTAL => 0, RES_DEUTERIUM => 0,); |
| 438 | 438 | $hangar_units = sys_unit_str2arr($row['b_hangar_id']); |
| 439 | - foreach($hangar_units as $unit_id => $unit_count) { |
|
| 440 | - if($unit_count <= 0) { |
|
| 439 | + foreach ($hangar_units as $unit_id => $unit_count) { |
|
| 440 | + if ($unit_count <= 0) { |
|
| 441 | 441 | continue; |
| 442 | 442 | } |
| 443 | - foreach($units_info[$unit_id][P_COST] as $resource_id => $resource_amount) { |
|
| 444 | - if(!in_array($resource_id, $group_resource_loot)) { |
|
| 443 | + foreach ($units_info[$unit_id][P_COST] as $resource_id => $resource_amount) { |
|
| 444 | + if (!in_array($resource_id, $group_resource_loot)) { |
|
| 445 | 445 | continue; |
| 446 | 446 | } |
| 447 | 447 | $return_resources[$resource_id] += $unit_count * $resource_amount; |
| 448 | 448 | } |
| 449 | 449 | } |
| 450 | - if(array_sum($return_resources) > 0) { |
|
| 450 | + if (array_sum($return_resources) > 0) { |
|
| 451 | 451 | upd_do_query("UPDATE {{planets}} SET `metal` = `metal` + {$return_resources[RES_METAL]}, `crystal` = `crystal` + {$return_resources[RES_CRYSTAL]}, `deuterium` = `deuterium` + {$return_resources[RES_DEUTERIUM]} WHERE `id` = {$planet_id} LIMIT 1"); |
| 452 | 452 | } |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | |
| 456 | - if(count($que_data) > 10) { |
|
| 456 | + if (count($que_data) > 10) { |
|
| 457 | 457 | $que_data_max = strlen(implode(',', $que_data)) > $que_data_max ? strlen(implode(',', $que_data)) : $que_data_max; |
| 458 | - upd_do_query('INSERT INTO {{que}} (`que_player_id`, `que_planet_id`, `que_planet_id_origin`, `que_type`, `que_time_left`, `que_unit_id`, `que_unit_amount`, `que_unit_mode`, `que_unit_level`, `que_unit_time`, `que_unit_price`) VALUES ' . implode(',', $que_data) . ';'); |
|
| 458 | + upd_do_query('INSERT INTO {{que}} (`que_player_id`, `que_planet_id`, `que_planet_id_origin`, `que_type`, `que_time_left`, `que_unit_id`, `que_unit_amount`, `que_unit_mode`, `que_unit_level`, `que_unit_time`, `que_unit_price`) VALUES '.implode(',', $que_data).';'); |
|
| 459 | 459 | $que_data = array(); |
| 460 | 460 | } |
| 461 | 461 | } |
| 462 | 462 | |
| 463 | - if(!empty($unit_data)) { |
|
| 464 | - upd_do_query('REPLACE INTO {{unit}} (`unit_player_id`, `unit_location_type`, `unit_location_id`, `unit_type`, `unit_snid`, `unit_level`) VALUES ' . implode(',', $unit_data) . ';'); |
|
| 463 | + if (!empty($unit_data)) { |
|
| 464 | + upd_do_query('REPLACE INTO {{unit}} (`unit_player_id`, `unit_location_type`, `unit_location_id`, `unit_type`, `unit_snid`, `unit_level`) VALUES '.implode(',', $unit_data).';'); |
|
| 465 | 465 | } |
| 466 | 466 | |
| 467 | - if(!empty($que_data)) { |
|
| 468 | - upd_do_query('INSERT INTO {{que}} (`que_player_id`, `que_planet_id`, `que_planet_id_origin`, `que_type`, `que_time_left`, `que_unit_id`, `que_unit_amount`, `que_unit_mode`, `que_unit_level`, `que_unit_time`, `que_unit_price`) VALUES ' . implode(',', $que_data) . ';'); |
|
| 467 | + if (!empty($que_data)) { |
|
| 468 | + upd_do_query('INSERT INTO {{que}} (`que_player_id`, `que_planet_id`, `que_planet_id_origin`, `que_type`, `que_time_left`, `que_unit_id`, `que_unit_amount`, `que_unit_mode`, `que_unit_level`, `que_unit_time`, `que_unit_price`) VALUES '.implode(',', $que_data).';'); |
|
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | upd_alter_table('planets', $drop, true); |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | JOIN `{{users}}` AS u ON a.`id` = u.`user_as_ally` AND `user_as_ally` IS NOT NULL AND `username` = '' |
| 476 | 476 | SET u.`username` = CONCAT('[', a.`ally_tag`, ']');"); |
| 477 | 477 | |
| 478 | - if($update_indexes['statpoints']['I_stats_id_ally'] != 'id_ally,stat_type,stat_code,') { |
|
| 478 | + if ($update_indexes['statpoints']['I_stats_id_ally'] != 'id_ally,stat_type,stat_code,') { |
|
| 479 | 479 | upd_do_query("SET FOREIGN_KEY_CHECKS=0;"); |
| 480 | 480 | upd_alter_table('statpoints', "DROP FOREIGN KEY `FK_stats_id_ally`", $update_foreigns['statpoints']['FK_stats_id_ally']); |
| 481 | 481 | upd_alter_table('statpoints', "DROP KEY `I_stats_id_ally`", $update_indexes['statpoints']['I_stats_id_ally']); |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | "ADD CONSTRAINT `FK_users_browser_id` FOREIGN KEY (`user_last_browser_id`) REFERENCES `{{security_browser}}` (`browser_id`) ON DELETE SET NULL ON UPDATE CASCADE", |
| 572 | 572 | ), !isset($update_tables['users']['user_last_proxy'])); |
| 573 | 573 | |
| 574 | - if(!isset($update_tables['notes']['planet_type'])) { |
|
| 574 | + if (!isset($update_tables['notes']['planet_type'])) { |
|
| 575 | 575 | upd_alter_table('notes', array( |
| 576 | 576 | "ADD COLUMN `galaxy` SMALLINT(6) UNSIGNED NOT NULL DEFAULT 0 AFTER `title`", |
| 577 | 577 | "ADD COLUMN `system` SMALLINT(6) UNSIGNED NOT NULL DEFAULT 0 AFTER `galaxy`", |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | upd_alter_table('users', "ADD COLUMN `user_bot` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0", !isset($update_tables['users']['user_bot'])); |
| 590 | 590 | upd_alter_table('unit', "ADD KEY `I_unit_type_snid` (unit_type, unit_snid) USING BTREE", !$update_indexes['unit']['I_unit_type_snid']); |
| 591 | 591 | |
| 592 | - if($update_tables['users']['settings_tooltiptime']['Type'] != 'smallint(5) unsigned') { |
|
| 592 | + if ($update_tables['users']['settings_tooltiptime']['Type'] != 'smallint(5) unsigned') { |
|
| 593 | 593 | upd_alter_table('users', array( |
| 594 | 594 | "MODIFY COLUMN `settings_tooltiptime` smallint(5) unsigned NOT NULL DEFAULT '500'", |
| 595 | 595 | ), $update_tables['users']['settings_tooltiptime']['Type'] != 'smallint'); |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | upd_do_query("UPDATE `{{users}}` SET settings_tooltiptime = 500;"); |
| 598 | 598 | } |
| 599 | 599 | |
| 600 | - if(!isset($update_tables['log_users_online']['online_aggregated'])) { |
|
| 600 | + if (!isset($update_tables['log_users_online']['online_aggregated'])) { |
|
| 601 | 601 | upd_alter_table('log_users_online', "ADD COLUMN `online_aggregated` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0", !isset($update_tables['log_users_online']['online_aggregated'])); |
| 602 | 602 | upd_alter_table('log_users_online', array( |
| 603 | 603 | "DROP PRIMARY KEY", |
@@ -605,13 +605,13 @@ discard block |
||
| 605 | 605 | ), $update_indexes['log_users_online']['PRIMARY'] != 'online_timestamp,online_aggregated,'); |
| 606 | 606 | } |
| 607 | 607 | |
| 608 | - if(!isset($update_tables['users']['gender'])) { |
|
| 609 | - upd_alter_table('users', "ADD COLUMN `gender` TINYINT(1) UNSIGNED NOT NULL DEFAULT " . GENDER_UNKNOWN, !isset($update_tables['users']['gender'])); |
|
| 610 | - upd_do_query("UPDATE {{users}} SET `gender` = IF(UPPER(`sex`) = 'F', " . GENDER_FEMALE . ", IF(UPPER(`sex`) = 'M', " . GENDER_MALE . ", " . GENDER_UNKNOWN . "));"); |
|
| 608 | + if (!isset($update_tables['users']['gender'])) { |
|
| 609 | + upd_alter_table('users', "ADD COLUMN `gender` TINYINT(1) UNSIGNED NOT NULL DEFAULT ".GENDER_UNKNOWN, !isset($update_tables['users']['gender'])); |
|
| 610 | + upd_do_query("UPDATE {{users}} SET `gender` = IF(UPPER(`sex`) = 'F', ".GENDER_FEMALE.", IF(UPPER(`sex`) = 'M', ".GENDER_MALE.", ".GENDER_UNKNOWN."));"); |
|
| 611 | 611 | } |
| 612 | 612 | upd_alter_table('users', "DROP COLUMN `sex`", isset($update_tables['users']['sex'])); |
| 613 | 613 | |
| 614 | - if(!$update_tables['users']['dark_matter_total']) { |
|
| 614 | + if (!$update_tables['users']['dark_matter_total']) { |
|
| 615 | 615 | upd_alter_table('users', "ADD `dark_matter_total` BIGINT(20) NOT NULL DEFAULT 0 COMMENT 'Total Dark Matter amount ever gained' AFTER `dark_matter`", !$update_tables['users']['dark_matter_total']); |
| 616 | 616 | upd_do_query( |
| 617 | 617 | "UPDATE `{{users}}` AS u |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | } |
| 625 | 625 | |
| 626 | 626 | upd_check_key('player_metamatter_immortal', 100000, !isset(classSupernova::$config->player_metamatter_immortal)); |
| 627 | - if(!$update_tables['users']['metamatter_total']) { |
|
| 627 | + if (!$update_tables['users']['metamatter_total']) { |
|
| 628 | 628 | upd_alter_table('users', "ADD `metamatter_total` BIGINT(20) NOT NULL DEFAULT 0 COMMENT 'Total Metamatter amount ever bought'", !$update_tables['users']['metamatter_total']); |
| 629 | 629 | |
| 630 | 630 | upd_do_query( |
@@ -636,11 +636,11 @@ discard block |
||
| 636 | 636 | (SELECT IF(sum(amount) IS NULL, 0, sum(amount)) FROM {{log_metamatter}} AS mm WHERE mm.user_id = u.id AND mm.amount > 0) |
| 637 | 637 | );"); |
| 638 | 638 | } |
| 639 | - if(!isset($update_tables['users']['immortal'])) { |
|
| 639 | + if (!isset($update_tables['users']['immortal'])) { |
|
| 640 | 640 | upd_alter_table('users', "ADD COLUMN `immortal` TIMESTAMP NULL", !isset($update_tables['users']['immortal'])); |
| 641 | 641 | upd_do_query("UPDATE {{users}} SET `immortal` = NOW() WHERE `metamatter_total` > 0;"); |
| 642 | 642 | } |
| 643 | - if(isset($update_tables['player_award'])) { |
|
| 643 | + if (isset($update_tables['player_award'])) { |
|
| 644 | 644 | upd_do_query( |
| 645 | 645 | "UPDATE {{users}} AS u JOIN {{player_award}} AS pa ON u.id = pa.player_id |
| 646 | 646 | SET metamatter_total = 1, immortal = NOW() |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | CONSTRAINT `FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `{{users}}` (`id`) ON DELETE CASCADE ON UPDATE CASCADE |
| 668 | 668 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"); |
| 669 | 669 | |
| 670 | - if(empty($update_tables['blitz_statpoints'])) { |
|
| 670 | + if (empty($update_tables['blitz_statpoints'])) { |
|
| 671 | 671 | upd_create_table('blitz_statpoints', " ( |
| 672 | 672 | `stat_date` int(11) NOT NULL DEFAULT '0', |
| 673 | 673 | `id_owner` bigint(20) unsigned DEFAULT NULL, |
@@ -735,7 +735,7 @@ discard block |
||
| 735 | 735 | CONSTRAINT `FK_survey_votes_survey_parent_id` FOREIGN KEY (`survey_parent_id`) REFERENCES `{{survey}}` (`survey_id`) ON DELETE CASCADE ON UPDATE CASCADE |
| 736 | 736 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;"); |
| 737 | 737 | |
| 738 | - if(empty($update_tables['security_url'])) { |
|
| 738 | + if (empty($update_tables['security_url'])) { |
|
| 739 | 739 | upd_create_table('security_url', " ( |
| 740 | 740 | `url_id` int unsigned NOT NULL AUTO_INCREMENT, |
| 741 | 741 | `url_string` VARCHAR(250) NOT NULL DEFAULT '', |
@@ -748,17 +748,17 @@ discard block |
||
| 748 | 748 | |
| 749 | 749 | $strings = array(); |
| 750 | 750 | $query = classSupernova::$db->doSql($query); |
| 751 | - while($row = db_fetch($query)) { |
|
| 752 | - $strings[] = '("' . db_escape($row['url']) . '")'; |
|
| 753 | - if(count($strings) > 100) { |
|
| 754 | - classSupernova::$db->doSql($query_string . implode(',', $strings)); |
|
| 751 | + while ($row = db_fetch($query)) { |
|
| 752 | + $strings[] = '("'.db_escape($row['url']).'")'; |
|
| 753 | + if (count($strings) > 100) { |
|
| 754 | + classSupernova::$db->doSql($query_string.implode(',', $strings)); |
|
| 755 | 755 | $strings = array(); |
| 756 | 756 | } |
| 757 | 757 | } |
| 758 | - !empty($strings) ? classSupernova::$db->doSql($query_string . implode(',', $strings)) : false; |
|
| 758 | + !empty($strings) ? classSupernova::$db->doSql($query_string.implode(',', $strings)) : false; |
|
| 759 | 759 | } |
| 760 | 760 | |
| 761 | - if(isset($update_tables['counter']['page'])) // TODO REMOVE |
|
| 761 | + if (isset($update_tables['counter']['page'])) // TODO REMOVE |
|
| 762 | 762 | { |
| 763 | 763 | update_security_url("SELECT DISTINCT `page` AS url FROM {{counter}}"); |
| 764 | 764 | update_security_url("SELECT DISTINCT `url` AS url FROM {{counter}}"); |
@@ -783,7 +783,7 @@ discard block |
||
| 783 | 783 | "ADD CONSTRAINT `FK_counter_page_url_id` FOREIGN KEY (`page_url_id`) REFERENCES `{{security_url}}` (`url_id`) ON DELETE CASCADE ON UPDATE CASCADE", |
| 784 | 784 | "ADD CONSTRAINT `FK_counter_plain_url_id` FOREIGN KEY (`plain_url_id`) REFERENCES `{{security_url}}` (`url_id`) ON DELETE CASCADE ON UPDATE CASCADE", |
| 785 | 785 | ), !isset($update_tables['counter']['device_id'])); |
| 786 | - if(isset($update_tables['counter']['ip'])) { |
|
| 786 | + if (isset($update_tables['counter']['ip'])) { |
|
| 787 | 787 | // upd_do_query('UPDATE `{{counter}}` SET `user_ip` = INET_ATON(`ip`), `user_proxy` = `proxy`, `visit_time` = FROM_UNIXTIME(`time`)'); |
| 788 | 788 | upd_do_query('UPDATE `{{counter}}` SET `user_ip` = INET_ATON(`ip`), `visit_time` = FROM_UNIXTIME(`time`)'); |
| 789 | 789 | upd_do_query('UPDATE `{{counter}}` AS c JOIN {{security_url}} AS u ON u.url_string = c.page SET c.page_url_id = u.url_id'); |
@@ -834,7 +834,7 @@ discard block |
||
| 834 | 834 | |
| 835 | 835 | upd_check_key('stats_history_days', 14, !classSupernova::$config->stats_history_days); |
| 836 | 836 | |
| 837 | - if(classSupernova::$config->payment_currency_default != 'USD') { |
|
| 837 | + if (classSupernova::$config->payment_currency_default != 'USD') { |
|
| 838 | 838 | upd_check_key('payment_currency_default', 'USD', true); |
| 839 | 839 | upd_check_key('payment_currency_exchange_dm_', 20000, true); |
| 840 | 840 | upd_check_key('payment_currency_exchange_mm_', 20000, true); |
@@ -891,7 +891,7 @@ discard block |
||
| 891 | 891 | |
| 892 | 892 | $virtual_exploded = explode('/', SN_ROOT_VIRTUAL_PARENT); |
| 893 | 893 | // TODO - переделать всё на db_loadItem... НАВЕРНОЕ |
| 894 | - upd_check_key('server_email', 'root@' . $virtual_exploded[2], !classSupernova::$config->db_loadItem('server_email')); |
|
| 894 | + upd_check_key('server_email', 'root@'.$virtual_exploded[2], !classSupernova::$config->db_loadItem('server_email')); |
|
| 895 | 895 | |
| 896 | 896 | upd_alter_table('survey_votes', array( |
| 897 | 897 | "DROP FOREIGN KEY `FK_survey_votes_user`", |
@@ -917,12 +917,12 @@ discard block |
||
| 917 | 917 | function propagade_player_options($old_option_name, $new_option_id) { |
| 918 | 918 | global $update_tables; |
| 919 | 919 | |
| 920 | - if(!empty($update_tables['users'][$old_option_name])) { |
|
| 920 | + if (!empty($update_tables['users'][$old_option_name])) { |
|
| 921 | 921 | upd_do_query( |
| 922 | 922 | "REPLACE INTO {{player_options}} (`player_id`, `option_id`, `value`) |
| 923 | 923 | SELECT `id`, {$new_option_id}, `{$old_option_name}` |
| 924 | 924 | FROM {{users}} |
| 925 | - WHERE `user_as_ally` is null and `user_bot` = " . USER_BOT_PLAYER); |
|
| 925 | + WHERE `user_as_ally` is null and `user_bot` = ".USER_BOT_PLAYER); |
|
| 926 | 926 | // TODO - UNCOMMENT !!! |
| 927 | 927 | upd_alter_table('users', array("DROP COLUMN `{$old_option_name}`",)); |
| 928 | 928 | } |
@@ -951,7 +951,7 @@ discard block |
||
| 951 | 951 | |
| 952 | 952 | |
| 953 | 953 | // 2015-08-03 15:05:26 40a6.0 |
| 954 | - if(empty($update_tables['planets']['position_original'])) { |
|
| 954 | + if (empty($update_tables['planets']['position_original'])) { |
|
| 955 | 955 | upd_alter_table('planets', array( |
| 956 | 956 | "ADD COLUMN `position_original` smallint NOT NULL DEFAULT 0", |
| 957 | 957 | "ADD COLUMN `field_max_original` smallint NOT NULL DEFAULT 0", |
@@ -966,7 +966,7 @@ discard block |
||
| 966 | 966 | upd_do_query('UPDATE {{planets}} SET `position_original` = `planet`, `field_max_original` = `field_max`, `temp_min_original` = `temp_min`, `temp_max_original` = `temp_max`;'); |
| 967 | 967 | |
| 968 | 968 | // Миграция тяжмета в оливин |
| 969 | - upd_do_query('UPDATE {{planets}} SET `density_index` = ' . PLANET_DENSITY_METAL_PERIDOT . ' WHERE `density_index` = 7'); // deprecated define('PLANET_DENSITY_METAL_HEAVY', 7); |
|
| 969 | + upd_do_query('UPDATE {{planets}} SET `density_index` = '.PLANET_DENSITY_METAL_PERIDOT.' WHERE `density_index` = 7'); // deprecated define('PLANET_DENSITY_METAL_HEAVY', 7); |
|
| 970 | 970 | |
| 971 | 971 | // Добавляем планету-странника |
| 972 | 972 | upd_check_key('game_maxPlanet', 16, Vector::$knownPlanets == 15); |
@@ -979,12 +979,12 @@ discard block |
||
| 979 | 979 | |
| 980 | 980 | // 2015-08-27 19:14:05 40a10.0 |
| 981 | 981 | // Старая версия таблицы |
| 982 | - if(!empty($update_tables['account']['account_is_global']) || empty($update_tables['account']['account_immortal'])) { |
|
| 982 | + if (!empty($update_tables['account']['account_is_global']) || empty($update_tables['account']['account_immortal'])) { |
|
| 983 | 983 | upd_drop_table('account'); |
| 984 | 984 | upd_drop_table('account_translate'); |
| 985 | 985 | } |
| 986 | 986 | |
| 987 | - if(empty($update_tables['account'])) { |
|
| 987 | + if (empty($update_tables['account'])) { |
|
| 988 | 988 | upd_create_table('account', " ( |
| 989 | 989 | `account_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
| 990 | 990 | `account_name` varchar(32) CHARACTER SET utf8 NOT NULL DEFAULT '', |
@@ -1003,7 +1003,7 @@ discard block |
||
| 1003 | 1003 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;"); |
| 1004 | 1004 | |
| 1005 | 1005 | upd_create_table('account_translate', " ( |
| 1006 | - `provider_id` tinyint unsigned NOT NULL DEFAULT " . ACCOUNT_PROVIDER_LOCAL . " COMMENT 'Account provider', |
|
| 1006 | + `provider_id` tinyint unsigned NOT NULL DEFAULT " . ACCOUNT_PROVIDER_LOCAL." COMMENT 'Account provider', |
|
| 1007 | 1007 | `provider_account_id` bigint(20) unsigned NOT NULL COMMENT 'Account ID on provider', |
| 1008 | 1008 | `user_id` bigint(20) unsigned NOT NULL COMMENT 'User ID', |
| 1009 | 1009 | `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, |
@@ -1018,12 +1018,12 @@ discard block |
||
| 1018 | 1018 | (`account_id`, `account_name`, `account_password`, `account_salt`, `account_email`, `account_register_time`, `account_language`, `account_metamatter`, `account_metamatter_total`, `account_immortal`) |
| 1019 | 1019 | SELECT |
| 1020 | 1020 | `id`, `username`, `password`, `salt`, `email_2`, FROM_UNIXTIME(register_time), `lang`, `metamatter`, `metamatter_total`, `immortal` |
| 1021 | - FROM {{users}} WHERE `user_as_ally` IS NULL AND `user_bot` = " . USER_BOT_PLAYER . ";" |
|
| 1021 | + FROM {{users}} WHERE `user_as_ally` IS NULL AND `user_bot` = " . USER_BOT_PLAYER.";" |
|
| 1022 | 1022 | ); |
| 1023 | 1023 | |
| 1024 | 1024 | upd_do_query( |
| 1025 | 1025 | "REPLACE INTO {{account_translate}} (`provider_id`, `provider_account_id`, `user_id`, `timestamp`) |
| 1026 | - SELECT " . ACCOUNT_PROVIDER_LOCAL . ", a.account_id, u.id, a.`account_register_time` |
|
| 1026 | + SELECT " . ACCOUNT_PROVIDER_LOCAL.", a.account_id, u.id, a.`account_register_time` |
|
| 1027 | 1027 | FROM {{users}} AS u |
| 1028 | 1028 | JOIN {{account}} AS a ON |
| 1029 | 1029 | a.account_name = u.username |
@@ -1038,7 +1038,7 @@ discard block |
||
| 1038 | 1038 | |
| 1039 | 1039 | |
| 1040 | 1040 | // 2015-09-05 17:07:15 40a10.17 |
| 1041 | - upd_alter_table('ube_report', "ADD COLUMN `ube_report_capture_result` tinyint unsigned NOT NULL DEFAULT " . UBE_CAPTURE_DISABLED, empty($update_tables['ube_report']['ube_report_capture_result'])); |
|
| 1041 | + upd_alter_table('ube_report', "ADD COLUMN `ube_report_capture_result` tinyint unsigned NOT NULL DEFAULT ".UBE_CAPTURE_DISABLED, empty($update_tables['ube_report']['ube_report_capture_result'])); |
|
| 1042 | 1042 | |
| 1043 | 1043 | |
| 1044 | 1044 | // 2015-09-07 21:11:48 40a10.19 |
@@ -1046,18 +1046,18 @@ discard block |
||
| 1046 | 1046 | |
| 1047 | 1047 | |
| 1048 | 1048 | // 2015-09-24 11:39:37 40a10.25 |
| 1049 | - if(empty($update_tables['log_metamatter']['provider_id'])) { |
|
| 1049 | + if (empty($update_tables['log_metamatter']['provider_id'])) { |
|
| 1050 | 1050 | upd_alter_table('log_metamatter', array( |
| 1051 | - "ADD COLUMN `provider_id` tinyint unsigned NOT NULL DEFAULT " . ACCOUNT_PROVIDER_LOCAL . " COMMENT 'Account provider'", |
|
| 1051 | + "ADD COLUMN `provider_id` tinyint unsigned NOT NULL DEFAULT ".ACCOUNT_PROVIDER_LOCAL." COMMENT 'Account provider'", |
|
| 1052 | 1052 | "ADD COLUMN `account_id` bigint(20) unsigned NOT NULL DEFAULT 0", |
| 1053 | 1053 | "ADD COLUMN `account_name` varchar(32) CHARACTER SET utf8 NOT NULL DEFAULT ''", |
| 1054 | - "ADD COLUMN `server_name` varchar(128) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '" . SN_ROOT_VIRTUAL . "'", |
|
| 1054 | + "ADD COLUMN `server_name` varchar(128) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '".SN_ROOT_VIRTUAL."'", |
|
| 1055 | 1055 | ), empty($update_tables['log_metamatter']['provider_id'])); |
| 1056 | 1056 | |
| 1057 | 1057 | upd_do_query("UPDATE {{log_metamatter}} SET `account_id` = `user_id`, `account_name` = `username`"); |
| 1058 | 1058 | |
| 1059 | 1059 | upd_alter_table('payment', array( |
| 1060 | - "ADD COLUMN `payment_provider_id` tinyint unsigned NOT NULL DEFAULT " . ACCOUNT_PROVIDER_LOCAL . " COMMENT 'Payment account provider'", |
|
| 1060 | + "ADD COLUMN `payment_provider_id` tinyint unsigned NOT NULL DEFAULT ".ACCOUNT_PROVIDER_LOCAL." COMMENT 'Payment account provider'", |
|
| 1061 | 1061 | "ADD COLUMN `payment_account_id` bigint(20) unsigned NOT NULL", |
| 1062 | 1062 | "ADD COLUMN `payment_account_name` varchar(32) CHARACTER SET utf8 NOT NULL DEFAULT ''", |
| 1063 | 1063 | ), !$update_tables['payment']['payment_account_id']); |
@@ -1098,7 +1098,7 @@ discard block |
||
| 1098 | 1098 | upd_check_key('event_halloween_2015_code', '', !isset(classSupernova::$config->event_halloween_2015_code)); |
| 1099 | 1099 | upd_check_key('event_halloween_2015_timestamp', SN_TIME_SQL, !isset(classSupernova::$config->event_halloween_2015_timestamp)); |
| 1100 | 1100 | upd_check_key('event_halloween_2015_units_used', serialize(array()), !isset(classSupernova::$config->event_halloween_2015_units_used)); |
| 1101 | - if(empty($update_tables['log_halloween_2015'])) { |
|
| 1101 | + if (empty($update_tables['log_halloween_2015'])) { |
|
| 1102 | 1102 | upd_create_table('log_halloween_2015', " ( |
| 1103 | 1103 | `log_hw2015_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
| 1104 | 1104 | `player_id` bigint(20) unsigned NOT NULL COMMENT 'User ID', |
@@ -1113,7 +1113,7 @@ discard block |
||
| 1113 | 1113 | |
| 1114 | 1114 | |
| 1115 | 1115 | // 2015-11-28 06:30:27 40a19.21 |
| 1116 | - if(!isset($update_tables['ube_report']['ube_report_debris_total_in_metal'])) { |
|
| 1116 | + if (!isset($update_tables['ube_report']['ube_report_debris_total_in_metal'])) { |
|
| 1117 | 1117 | upd_alter_table('ube_report', array( |
| 1118 | 1118 | "ADD COLUMN `ube_report_debris_total_in_metal` DECIMAL(65,0) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Total debris in metal'", |
| 1119 | 1119 | "ADD KEY `I_ube_report_time_debris_id` (`ube_report_time_process` DESC, `ube_report_debris_total_in_metal` DESC, `ube_report_id` ASC)", // For Best Battles module |
@@ -1128,7 +1128,7 @@ discard block |
||
| 1128 | 1128 | |
| 1129 | 1129 | |
| 1130 | 1130 | // 2015-12-06 15:10:58 40b1.0 |
| 1131 | - if(!empty($update_indexes['planets']['I_metal_mine'])) { |
|
| 1131 | + if (!empty($update_indexes['planets']['I_metal_mine'])) { |
|
| 1132 | 1132 | upd_alter_table('planets', "DROP KEY `I_metal`", $update_indexes['planets']['I_metal']); |
| 1133 | 1133 | upd_alter_table('planets', "DROP KEY `I_ship_sattelite_sloth`", $update_indexes['planets']['I_ship_sattelite_sloth']); |
| 1134 | 1134 | upd_alter_table('planets', "DROP KEY `I_ship_bomber_envy`", $update_indexes['planets']['I_ship_bomber_envy']); |
@@ -1191,7 +1191,7 @@ discard block |
||
| 1191 | 1191 | case 40: |
| 1192 | 1192 | upd_log_version_update(); |
| 1193 | 1193 | |
| 1194 | - if(empty($update_tables['festival'])) { |
|
| 1194 | + if (empty($update_tables['festival'])) { |
|
| 1195 | 1195 | upd_create_table('festival', " ( |
| 1196 | 1196 | `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
| 1197 | 1197 | `start` datetime NOT NULL COMMENT 'Festival start datetime', |
@@ -1232,7 +1232,7 @@ discard block |
||
| 1232 | 1232 | ); |
| 1233 | 1233 | } |
| 1234 | 1234 | |
| 1235 | - if(empty($update_tables['festival_unit'])) { |
|
| 1235 | + if (empty($update_tables['festival_unit'])) { |
|
| 1236 | 1236 | upd_create_table('festival_unit', " ( |
| 1237 | 1237 | `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
| 1238 | 1238 | `highspot_id` int(10) unsigned DEFAULT NULL, |
@@ -1249,7 +1249,7 @@ discard block |
||
| 1249 | 1249 | } |
| 1250 | 1250 | |
| 1251 | 1251 | // 2015-12-21 06:06:09 41a0.12 |
| 1252 | - if(empty($update_tables['festival_unit_log'])) { |
|
| 1252 | + if (empty($update_tables['festival_unit_log'])) { |
|
| 1253 | 1253 | upd_create_table('festival_unit_log', " ( |
| 1254 | 1254 | `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
| 1255 | 1255 | `highspot_id` int(10) unsigned DEFAULT NULL, |
@@ -1279,19 +1279,19 @@ discard block |
||
| 1279 | 1279 | $update_tables['security_browser']['browser_user_agent']['Collation'] == 'latin1_bin' |
| 1280 | 1280 | ); |
| 1281 | 1281 | |
| 1282 | - if($update_indexes_full['security_browser']['I_browser_user_agent']['browser_user_agent']['Index_type'] == 'BTREE') { |
|
| 1282 | + if ($update_indexes_full['security_browser']['I_browser_user_agent']['browser_user_agent']['Index_type'] == 'BTREE') { |
|
| 1283 | 1283 | upd_alter_table('security_browser', "DROP KEY `I_browser_user_agent`", true); |
| 1284 | 1284 | upd_alter_table('security_browser', "ADD KEY `I_browser_user_agent` (`browser_user_agent`) USING HASH", true); |
| 1285 | 1285 | } |
| 1286 | 1286 | |
| 1287 | - if(!empty($update_tables['fleets']['fleet_array'])) { |
|
| 1287 | + if (!empty($update_tables['fleets']['fleet_array'])) { |
|
| 1288 | 1288 | $query = upd_do_query("SELECT * FROM {{fleets}}"); |
| 1289 | - while($row = db_fetch($query)) { |
|
| 1289 | + while ($row = db_fetch($query)) { |
|
| 1290 | 1290 | $unit_list = sys_unit_str2arr($row['fleet_array']); |
| 1291 | - foreach($unit_list as $unit_id => $unit_count) { |
|
| 1291 | + foreach ($unit_list as $unit_id => $unit_count) { |
|
| 1292 | 1292 | upd_do_query( |
| 1293 | 1293 | "REPLACE INTO {{unit}} (`unit_player_id`,`unit_location_type`,`unit_location_id`,`unit_type`,`unit_snid`,`unit_level`) VALUES |
| 1294 | - ({$row['fleet_owner']}, " . LOC_FLEET . ", {$row['fleet_id']}, 200, {$unit_id}, {$unit_count});", |
|
| 1294 | + ({$row['fleet_owner']}, ".LOC_FLEET.", {$row['fleet_id']}, 200, {$unit_id}, {$unit_count});", |
|
| 1295 | 1295 | // ({$row['fleet_owner']}, " . LOC_FLEET . ", {$row['fleet_id']}, " . get_unit_param($unit_id, P_UNIT_TYPE) . ", {$unit_id}, {$unit_count});", |
| 1296 | 1296 | true |
| 1297 | 1297 | ); |
@@ -1325,11 +1325,11 @@ discard block |
||
| 1325 | 1325 | |
| 1326 | 1326 | classSupernova::$cache->unset_by_prefix('lng_'); |
| 1327 | 1327 | |
| 1328 | -if($new_version) { |
|
| 1328 | +if ($new_version) { |
|
| 1329 | 1329 | classSupernova::$config->db_saveItem('db_version', $new_version); |
| 1330 | 1330 | upd_log_message("<font color=green>DB version is now {$new_version}</font>"); |
| 1331 | 1331 | } else { |
| 1332 | - upd_log_message("DB version didn't changed from " . classSupernova::$config->db_version); |
|
| 1332 | + upd_log_message("DB version didn't changed from ".classSupernova::$config->db_version); |
|
| 1333 | 1333 | } |
| 1334 | 1334 | |
| 1335 | 1335 | classSupernova::$config->db_loadAll(); |
@@ -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); |
@@ -1,42 +1,42 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require_once('includes/init.' . substr(strrchr(__FILE__, '.'), 1)); |
|
| 3 | +require_once('includes/init.'.substr(strrchr(__FILE__, '.'), 1)); |
|
| 4 | 4 | |
| 5 | 5 | $mode = sys_get_param_int('mode'); |
| 6 | 6 | $ajax = sys_get_param_int('ajax'); |
| 7 | 7 | |
| 8 | -$url = 'http://supernova.ws/version_check.php?mode=' . $mode |
|
| 9 | - . '&db=' . DB_VERSION |
|
| 10 | - . '&release=' . SN_RELEASE |
|
| 11 | - . '&version=' . SN_VERSION |
|
| 12 | - . '&key=' . urlencode(classSupernova::$config->server_updater_key) |
|
| 13 | - . '&id=' . urlencode(classSupernova::$config->server_updater_id); |
|
| 8 | +$url = 'http://supernova.ws/version_check.php?mode='.$mode |
|
| 9 | + . '&db='.DB_VERSION |
|
| 10 | + . '&release='.SN_RELEASE |
|
| 11 | + . '&version='.SN_VERSION |
|
| 12 | + . '&key='.urlencode(classSupernova::$config->server_updater_key) |
|
| 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(); |
| 22 | 22 | } |
| 23 | - $url .= "&name=" . urlencode(classSupernova::$config->game_name) . "&url=" . urlencode(SN_ROOT_VIRTUAL); |
|
| 23 | + $url .= "&name=".urlencode(classSupernova::$config->game_name)."&url=".urlencode(SN_ROOT_VIRTUAL); |
|
| 24 | 24 | break; |
| 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 | |
@@ -9,10 +9,10 @@ discard block |
||
| 9 | 9 | define('INSIDE', true); |
| 10 | 10 | define('INSTALL', false); |
| 11 | 11 | define('IN_ADMIN', true); |
| 12 | -require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
| 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); |
@@ -228,8 +228,8 @@ discard block |
||
| 228 | 228 | * @return int|mixed |
| 229 | 229 | */ |
| 230 | 230 | public function calcColonyMaxCount($astrotech = -1) { |
| 231 | - if($astrotech == -1) { |
|
| 232 | - if(!isset($this->_dbRow[UNIT_PLAYER_COLONIES_MAX])) { |
|
| 231 | + if ($astrotech == -1) { |
|
| 232 | + if (!isset($this->_dbRow[UNIT_PLAYER_COLONIES_MAX])) { |
|
| 233 | 233 | |
| 234 | 234 | $expeditions = get_player_max_expeditons($this->_dbRow); |
| 235 | 235 | $astrotech = mrc_get_level($this->_dbRow, null, TECH_ASTROTECH); |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | |
| 303 | 303 | |
| 304 | 304 | public function expeditionsMax() { |
| 305 | - if($this->expeditionsMax === null) { |
|
| 305 | + if ($this->expeditionsMax === null) { |
|
| 306 | 306 | $this->expeditionsMax = get_player_max_expeditons($this->_dbRow); |
| 307 | 307 | } |
| 308 | 308 | |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | public function expeditionsFlying() { |
| 313 | - if($this->expeditionsFlying === null) { |
|
| 313 | + if ($this->expeditionsFlying === null) { |
|
| 314 | 314 | $this->expeditionsFlying = FleetList::fleet_count_flying($this->_dbId, MT_EXPLORE); |
| 315 | 315 | } |
| 316 | 316 | |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | |
| 321 | 321 | public function fleetsMax() { |
| 322 | - if($this->fleetMax === null) { |
|
| 322 | + if ($this->fleetMax === null) { |
|
| 323 | 323 | $this->fleetMax = GetMaxFleets($this->_dbRow); |
| 324 | 324 | } |
| 325 | 325 | |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | public function fleetsFlying() { |
| 330 | - if($this->fleetFlying === null) { |
|
| 330 | + if ($this->fleetFlying === null) { |
|
| 331 | 331 | $this->fleetFlying = FleetList::fleet_count_flying($this->_dbId); |
| 332 | 332 | } |
| 333 | 333 | |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | |
| 337 | 337 | |
| 338 | 338 | public function coloniesMax() { |
| 339 | - if($this->coloniesMax === null) { |
|
| 339 | + if ($this->coloniesMax === null) { |
|
| 340 | 340 | $this->coloniesMax = get_player_max_colonies($this->_dbRow); |
| 341 | 341 | } |
| 342 | 342 | |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | public function coloniesCurrent() { |
| 347 | - if($this->coloniesCurrent === null) { |
|
| 347 | + if ($this->coloniesCurrent === null) { |
|
| 348 | 348 | $this->coloniesCurrent = get_player_current_colonies($this->_dbRow); |
| 349 | 349 | } |
| 350 | 350 | |
@@ -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 | } |
@@ -324,6 +324,10 @@ |
||
| 324 | 324 | * @return int|mixed |
| 325 | 325 | */ |
| 326 | 326 | // TODO - REDO!!!! |
| 327 | + |
|
| 328 | + /** |
|
| 329 | + * @return double |
|
| 330 | + */ |
|
| 327 | 331 | function flt_fleet_speed($user) { |
| 328 | 332 | $speeds = array(); |
| 329 | 333 | if(!empty($this->mapUnitIdToDb)) { |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function offsetSet($offset, $value) { |
| 91 | 91 | if (isset($this->mapUnitIdToDb[$value->unitId])) { |
| 92 | - classSupernova::$debug->error('UnitList::offsetSet: Unit with UnitId ' . $value->unitId . ' already exists'); |
|
| 92 | + classSupernova::$debug->error('UnitList::offsetSet: Unit with UnitId '.$value->unitId.' already exists'); |
|
| 93 | 93 | } |
| 94 | 94 | $this->mapUnitIdToDb[$value->unitId] = $value; |
| 95 | 95 | parent::offsetSet($offset, $value); |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | |
| 203 | 203 | public function unitGetCount($unit_id) { |
| 204 | 204 | if (empty($this->mapUnitIdToDb[$unit_id])) { |
| 205 | - throw new Exception('Unit [' . $unit_id . '] is not exists in UnitList'); |
|
| 205 | + throw new Exception('Unit ['.$unit_id.'] is not exists in UnitList'); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | return $this->mapUnitIdToDb[$unit_id]->count; |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | public function unitsCostInMetal($shipCostInMetalPerPiece) { |
| 249 | 249 | $shipsCostInMetal = array(); |
| 250 | - foreach($this->mapUnitIdToDb as $ship_id => $ship) { |
|
| 250 | + foreach ($this->mapUnitIdToDb as $ship_id => $ship) { |
|
| 251 | 251 | $shipsCostInMetal[$ship_id] = $ship->count * $shipCostInMetalPerPiece[$ship_id]; |
| 252 | 252 | } |
| 253 | 253 | |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | */ |
| 330 | 330 | $objFleet = $this->getLocatedAt(); |
| 331 | 331 | if (empty($objFleet)) { |
| 332 | - throw new Exception('No fleet owner on UnitList::unitsRender() in ' . __FILE__ . '@' . __LINE__); |
|
| 332 | + throw new Exception('No fleet owner on UnitList::unitsRender() in '.__FILE__.'@'.__LINE__); |
|
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | $tplShips = array(); |
@@ -472,8 +472,8 @@ discard block |
||
| 472 | 472 | |
| 473 | 473 | // TODO - DEBUG - REMOVE ============================================================================================= |
| 474 | 474 | public function _dump() { |
| 475 | - print(__FILE__ . ':' . __LINE__ . "<br />"); |
|
| 476 | - print("Located at " . $this->getLocationDbId() . " type " . $this->getLocationType() . "<br />"); |
|
| 475 | + print(__FILE__.':'.__LINE__."<br />"); |
|
| 476 | + print("Located at ".$this->getLocationDbId()." type ".$this->getLocationType()."<br />"); |
|
| 477 | 477 | |
| 478 | 478 | print('<table border="1">'); |
| 479 | 479 | print('<tr>'); |
@@ -529,11 +529,11 @@ discard block |
||
| 529 | 529 | |
| 530 | 530 | print('<td>'); |
| 531 | 531 | $type = $unit->getType(); |
| 532 | - print("[{$type}] " . classLocale::$lang['tech'][$type]); |
|
| 532 | + print("[{$type}] ".classLocale::$lang['tech'][$type]); |
|
| 533 | 533 | print('</td>'); |
| 534 | 534 | |
| 535 | 535 | print('<td>'); |
| 536 | - print("[{$unit->unitId}] " . classLocale::$lang['tech'][$unit->unitId]); |
|
| 536 | + print("[{$unit->unitId}] ".classLocale::$lang['tech'][$unit->unitId]); |
|
| 537 | 537 | print('</td>'); |
| 538 | 538 | |
| 539 | 539 | print('<td>'); |
@@ -972,7 +972,7 @@ discard block |
||
| 972 | 972 | /** |
| 973 | 973 | * Set current resource list from array of units |
| 974 | 974 | * |
| 975 | - * @param array $resource_list |
|
| 975 | + * @param integer[] $resource_list |
|
| 976 | 976 | */ |
| 977 | 977 | public function resourcesSet($resource_list) { |
| 978 | 978 | if (!empty($this->propertiesAdjusted['resource_list'])) { |
@@ -1020,7 +1020,7 @@ discard block |
||
| 1020 | 1020 | } |
| 1021 | 1021 | |
| 1022 | 1022 | /** |
| 1023 | - * @param array $rate |
|
| 1023 | + * @param integer[] $rate |
|
| 1024 | 1024 | * |
| 1025 | 1025 | * @return float |
| 1026 | 1026 | */ |
@@ -1051,7 +1051,6 @@ discard block |
||
| 1051 | 1051 | * Restores fleet or resources to planet |
| 1052 | 1052 | * |
| 1053 | 1053 | * @param bool $start |
| 1054 | - * @param bool $only_resources |
|
| 1055 | 1054 | * @param int $result |
| 1056 | 1055 | * |
| 1057 | 1056 | * @return int |
@@ -1205,6 +1204,9 @@ discard block |
||
| 1205 | 1204 | } |
| 1206 | 1205 | |
| 1207 | 1206 | |
| 1207 | + /** |
|
| 1208 | + * @param integer $missionStartTimeStamp |
|
| 1209 | + */ |
|
| 1208 | 1210 | protected function renderFleetCoordinates($missionStartTimeStamp = SN_TIME_NOW, $timeMissionJob = 0) { |
| 1209 | 1211 | $timeToReturn = $this->travelData['duration'] * 2 + $timeMissionJob; |
| 1210 | 1212 | |
@@ -408,31 +408,31 @@ discard block |
||
| 408 | 408 | |
| 409 | 409 | return classSupernova::$db->doSelect( |
| 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 | classSupernova::$db->doSelect( |
| 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 | } |
@@ -805,7 +805,7 @@ discard block |
||
| 805 | 805 | * @param int $unit_count |
| 806 | 806 | */ |
| 807 | 807 | public function shipSetCount($unit_id, $unit_count = 0) { |
| 808 | - pdump(__CLASS__ . '->' . __FUNCTION__); |
|
| 808 | + pdump(__CLASS__.'->'.__FUNCTION__); |
|
| 809 | 809 | $this->shipAdjustCount($unit_id, $unit_count, true); |
| 810 | 810 | } |
| 811 | 811 | |
@@ -1005,7 +1005,7 @@ discard block |
||
| 1005 | 1005 | */ |
| 1006 | 1006 | public function resourcesSet($resource_list) { |
| 1007 | 1007 | if (!empty($this->propertiesAdjusted['resource_list'])) { |
| 1008 | - throw new PropertyAccessException('Property "resource_list" already was adjusted so no SET is possible until dbSave in ' . get_called_class() . '::unitSetResourceList', ERR_ERROR); |
|
| 1008 | + throw new PropertyAccessException('Property "resource_list" already was adjusted so no SET is possible until dbSave in '.get_called_class().'::unitSetResourceList', ERR_ERROR); |
|
| 1009 | 1009 | } |
| 1010 | 1010 | $this->resourcesAdjust($resource_list, true); |
| 1011 | 1011 | } |
@@ -1039,7 +1039,7 @@ discard block |
||
| 1039 | 1039 | // Check for negative unit value |
| 1040 | 1040 | if ($this->resource_list[$resource_id] < 0) { |
| 1041 | 1041 | // TODO |
| 1042 | - throw new Exception('Resource ' . $resource_id . ' will become negative in ' . get_called_class() . '::unitAdjustResourceList', ERR_ERROR); |
|
| 1042 | + throw new Exception('Resource '.$resource_id.' will become negative in '.get_called_class().'::unitAdjustResourceList', ERR_ERROR); |
|
| 1043 | 1043 | } |
| 1044 | 1044 | } |
| 1045 | 1045 | } |
@@ -1220,7 +1220,7 @@ discard block |
||
| 1220 | 1220 | |
| 1221 | 1221 | protected function printErrorIfNoShips() { |
| 1222 | 1222 | if ($this->unitList->unitsCount() <= 0) { |
| 1223 | - message(classLocale::$lang['fl_err_no_ships'], classLocale::$lang['fl_error'], 'fleet' . DOT_PHP_EX, 5); |
|
| 1223 | + message(classLocale::$lang['fl_err_no_ships'], classLocale::$lang['fl_error'], 'fleet'.DOT_PHP_EX, 5); |
|
| 1224 | 1224 | } |
| 1225 | 1225 | } |
| 1226 | 1226 | |
@@ -1608,14 +1608,14 @@ discard block |
||
| 1608 | 1608 | if (FLIGHT_ALLOWED == $validateResult[$missionType]) { |
| 1609 | 1609 | $this->allowed_missions[$missionType] = $mission; |
| 1610 | 1610 | } else { |
| 1611 | - if($missionType == $this->mission_type) { |
|
| 1611 | + if ($missionType == $this->mission_type) { |
|
| 1612 | 1612 | } |
| 1613 | 1613 | unset($this->allowed_missions[$missionType]); |
| 1614 | 1614 | } |
| 1615 | 1615 | } |
| 1616 | 1616 | |
| 1617 | - if(empty($this->allowed_missions)) { |
|
| 1618 | - if($this->mission_type != MT_NONE && isset($validateResult[$this->mission_type])) { |
|
| 1617 | + if (empty($this->allowed_missions)) { |
|
| 1618 | + if ($this->mission_type != MT_NONE && isset($validateResult[$this->mission_type])) { |
|
| 1619 | 1619 | throw new ExceptionFleetInvalid($validateResult[$this->mission_type], $validateResult[$this->mission_type]); |
| 1620 | 1620 | } else { |
| 1621 | 1621 | throw new ExceptionFleetInvalid(FLIGHT_MISSION_IMPOSSIBLE, FLIGHT_MISSION_IMPOSSIBLE); |
@@ -1844,7 +1844,7 @@ discard block |
||
| 1844 | 1844 | $template_result['.']['fleets'][] = $this->renderFleet(SN_TIME_NOW, $timeMissionJob); |
| 1845 | 1845 | |
| 1846 | 1846 | $template_result += array( |
| 1847 | - 'mission' => classLocale::$lang['type_mission'][$this->_mission_type] . ($this->_mission_type == MT_EXPLORE || $this->_mission_type == MT_HOLD ? ' ' . pretty_time($timeMissionJob) : ''), |
|
| 1847 | + 'mission' => classLocale::$lang['type_mission'][$this->_mission_type].($this->_mission_type == MT_EXPLORE || $this->_mission_type == MT_HOLD ? ' '.pretty_time($timeMissionJob) : ''), |
|
| 1848 | 1848 | 'dist' => pretty_number($this->travelData['distance']), |
| 1849 | 1849 | 'speed' => pretty_number($this->travelData['fleet_speed']), |
| 1850 | 1850 | 'deute_need' => pretty_number($this->travelData['consumption']), |
@@ -4,9 +4,9 @@ discard block |
||
| 4 | 4 | // Может добавить спецстатус "Ответ системы платежа" и парсить дальше getMessage |
| 5 | 5 | // см constants.php |
| 6 | 6 | |
| 7 | -include_once('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
| 7 | +include_once('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
| 8 | 8 | |
| 9 | -if(!sn_module_get_active_count('payment')) { |
|
| 9 | +if (!sn_module_get_active_count('payment')) { |
|
| 10 | 10 | sys_redirect('dark_matter.php'); |
| 11 | 11 | die(); |
| 12 | 12 | } |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | // Таблица скидок |
| 25 | 25 | $prev_discount = 0; |
| 26 | -if(isset(sn_module_payment::$bonus_table) && is_array(sn_module_payment::$bonus_table)) { |
|
| 27 | - foreach(sn_module_payment::$bonus_table as $sum => $discount) { |
|
| 28 | - if($discount && $discount != $prev_discount) { |
|
| 26 | +if (isset(sn_module_payment::$bonus_table) && is_array(sn_module_payment::$bonus_table)) { |
|
| 27 | + foreach (sn_module_payment::$bonus_table as $sum => $discount) { |
|
| 28 | + if ($discount && $discount != $prev_discount) { |
|
| 29 | 29 | $template->assign_block_vars('discount', array( |
| 30 | 30 | 'SUM' => $sum, |
| 31 | 31 | 'DISCOUNT' => $discount * 100, |
@@ -38,19 +38,19 @@ discard block |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | // Результат платежа |
| 41 | -if($payment_id = sys_get_param_id('payment_id')) { |
|
| 41 | +if ($payment_id = sys_get_param_id('payment_id')) { |
|
| 42 | 42 | $payment = db_payment_get($payment_id); |
| 43 | - if($payment && $payment['payment_user_id'] == $user['id']) { |
|
| 44 | - if($payment['payment_status'] == PAYMENT_STATUS_COMPLETE) { |
|
| 43 | + if ($payment && $payment['payment_user_id'] == $user['id']) { |
|
| 44 | + if ($payment['payment_status'] == PAYMENT_STATUS_COMPLETE) { |
|
| 45 | 45 | $template->assign_block_vars('result', array('MESSAGE' => sprintf(classLocale::$lang['pay_msg_mm_purchase_complete'], $payment['payment_dark_matter_paid'], $payment['payment_module_name'], $payment['payment_dark_matter_gained']))); |
| 46 | 46 | } |
| 47 | - if($payment['payment_status'] == PAYMENT_STATUS_NONE) { |
|
| 47 | + if ($payment['payment_status'] == PAYMENT_STATUS_NONE) { |
|
| 48 | 48 | $template->assign_block_vars('result', array( |
| 49 | 49 | 'MESSAGE' => sprintf(classLocale::$lang['pay_msg_mm_purchase_incomplete'], $payment['payment_dark_matter_paid'], $payment['payment_module_name']), |
| 50 | 50 | 'STATUS' => 1, |
| 51 | 51 | )); |
| 52 | 52 | } |
| 53 | - if($payment['payment_test']) { |
|
| 53 | + if ($payment['payment_test']) { |
|
| 54 | 54 | $template->assign_block_vars('result', array( |
| 55 | 55 | 'MESSAGE' => sprintf(classLocale::$lang['pay_msg_mm_purchase_test']), |
| 56 | 56 | 'STATUS' => -1, |
@@ -65,28 +65,28 @@ discard block |
||
| 65 | 65 | 'metamatter' => sys_get_param_float('metamatter'), |
| 66 | 66 | ); |
| 67 | 67 | |
| 68 | -if(!$request['metamatter']) { |
|
| 68 | +if (!$request['metamatter']) { |
|
| 69 | 69 | unset($_POST); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | $payment_methods_available = array_combine(array_keys(sn_module_payment::$payment_methods), array_fill(0, count(sn_module_payment::$payment_methods), null)); |
| 73 | -array_walk($payment_methods_available, function (&$value, $index) { |
|
| 73 | +array_walk($payment_methods_available, function(&$value, $index) { |
|
| 74 | 74 | $value = !empty(sn_module_payment::$payment_methods[$index]) ? array_combine(array_keys(sn_module_payment::$payment_methods[$index]), array_fill(0, count(sn_module_payment::$payment_methods[$index]), null)) : $value; |
| 75 | 75 | }); |
| 76 | 76 | |
| 77 | 77 | // pdump($payment_methods_available); |
| 78 | 78 | $payment_module_valid = false; |
| 79 | 79 | $payment_module = sys_get_param_str('payment_module'); |
| 80 | -foreach(sn_module::$sn_module_list['payment'] as $module_name => $module) { |
|
| 81 | - if(!is_object($module) || !$module->manifest['active']) { |
|
| 80 | +foreach (sn_module::$sn_module_list['payment'] as $module_name => $module) { |
|
| 81 | + if (!is_object($module) || !$module->manifest['active']) { |
|
| 82 | 82 | continue; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | lng_include($module_name, $module->manifest['root_relative']); |
| 86 | 86 | |
| 87 | - foreach(sn_module_payment::$payment_methods as $payment_type_id => $available_methods) { |
|
| 88 | - foreach($available_methods as $payment_method => $payment_currency) { |
|
| 89 | - if(isset($module->manifest['payment_method'][$payment_method])) { |
|
| 87 | + foreach (sn_module_payment::$payment_methods as $payment_type_id => $available_methods) { |
|
| 88 | + foreach ($available_methods as $payment_method => $payment_currency) { |
|
| 89 | + if (isset($module->manifest['payment_method'][$payment_method])) { |
|
| 90 | 90 | $payment_methods_available[$payment_type_id][$payment_method][$module_name] = $module->manifest['payment_method'][$payment_method]; |
| 91 | 91 | } |
| 92 | 92 | } |
@@ -97,8 +97,8 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | global $template_result; |
| 99 | 99 | // Доступные платежные методы |
| 100 | -foreach($payment_methods_available as $payment_type_id => $payment_methods) { |
|
| 101 | - if(empty($payment_methods)) { |
|
| 100 | +foreach ($payment_methods_available as $payment_type_id => $payment_methods) { |
|
| 101 | + if (empty($payment_methods)) { |
|
| 102 | 102 | continue; |
| 103 | 103 | } |
| 104 | 104 | |
@@ -106,8 +106,8 @@ discard block |
||
| 106 | 106 | 'ID' => $payment_type_id, |
| 107 | 107 | 'NAME' => classLocale::$lang['pay_methods'][$payment_type_id], |
| 108 | 108 | ); |
| 109 | - foreach($payment_methods as $payment_method_id => $module_list) { |
|
| 110 | - if(empty($module_list)) { |
|
| 109 | + foreach ($payment_methods as $payment_method_id => $module_list) { |
|
| 110 | + if (empty($module_list)) { |
|
| 111 | 111 | continue; |
| 112 | 112 | } |
| 113 | 113 | $template_result['.']['payment'][$payment_type_id]['.']['method'][$payment_method_id] = array( |
@@ -118,14 +118,14 @@ discard block |
||
| 118 | 118 | 'NAME_FORCE' => isset(sn_module_payment::$payment_methods[$payment_type_id][$payment_method_id]['name']), |
| 119 | 119 | 'BUTTON' => isset(sn_module_payment::$payment_methods[$payment_type_id][$payment_method_id]['button']), |
| 120 | 120 | ); |
| 121 | - foreach($module_list as $payment_module_name => $payment_module_method_details) { |
|
| 121 | + foreach ($module_list as $payment_module_name => $payment_module_method_details) { |
|
| 122 | 122 | $template_result['.']['payment'][$payment_type_id]['.']['method'][$payment_method_id]['.']['module'][] = array( |
| 123 | 123 | 'MODULE' => $payment_module_name, |
| 124 | 124 | ); |
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - if(empty($template_result['.']['payment'][$payment_type_id]['.'])) { |
|
| 128 | + if (empty($template_result['.']['payment'][$payment_type_id]['.'])) { |
|
| 129 | 129 | unset($template_result['.']['payment'][$payment_type_id]); |
| 130 | 130 | } |
| 131 | 131 | } |
@@ -138,19 +138,19 @@ discard block |
||
| 138 | 138 | $payment_module_valid = $payment_module_valid && (!$payment_method_selected || isset($payment_methods_available[$payment_type_selected][$payment_method_selected][$module_name])); |
| 139 | 139 | |
| 140 | 140 | // If payment_module invalid - making it empty OR if there is only one payment_module - selecting it |
| 141 | -if($payment_module_valid) { |
|
| 141 | +if ($payment_module_valid) { |
|
| 142 | 142 | // $payment_module = $payment_module; // Really - do nothing |
| 143 | -} elseif($payment_type_selected && count($payment_methods_available[$payment_type_selected][$payment_method_selected]) == 1) { |
|
| 143 | +} elseif ($payment_type_selected && count($payment_methods_available[$payment_type_selected][$payment_method_selected]) == 1) { |
|
| 144 | 144 | reset($payment_methods_available[$payment_type_selected][$payment_method_selected]); |
| 145 | 145 | $payment_module = key($payment_methods_available[$payment_type_selected][$payment_method_selected]); |
| 146 | -} elseif(count(sn_module::$sn_module_list['payment']) == 1) { |
|
| 146 | +} elseif (count(sn_module::$sn_module_list['payment']) == 1) { |
|
| 147 | 147 | $payment_module = $module_name; |
| 148 | 148 | } else { |
| 149 | 149 | $payment_module = ''; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | -if($payment_type_selected && $payment_method_selected) { |
|
| 153 | - foreach($payment_methods_available[$payment_type_selected][$payment_method_selected] as $module_name => $temp) { |
|
| 152 | +if ($payment_type_selected && $payment_method_selected) { |
|
| 153 | + foreach ($payment_methods_available[$payment_type_selected][$payment_method_selected] as $module_name => $temp) { |
|
| 154 | 154 | $template->assign_block_vars('payment_module', array( |
| 155 | 155 | 'ID' => $module_name, |
| 156 | 156 | 'NAME' => classLocale::$lang["module_{$module_name}_name"], |
@@ -159,9 +159,9 @@ discard block |
||
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | -foreach(classLocale::$lang['pay_currency_list'] as $key => $value) { |
|
| 162 | +foreach (classLocale::$lang['pay_currency_list'] as $key => $value) { |
|
| 163 | 163 | $course = get_exchange_rate($key); |
| 164 | - if(!$course) { |
|
| 164 | + if (!$course) { |
|
| 165 | 165 | continue; |
| 166 | 166 | } |
| 167 | 167 | $template->assign_block_vars('exchange', array( |
@@ -176,17 +176,17 @@ discard block |
||
| 176 | 176 | )); |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | -if($request['metamatter'] && $payment_module) { |
|
| 179 | +if ($request['metamatter'] && $payment_module) { |
|
| 180 | 180 | try { |
| 181 | 181 | // Any possible errors about generating paylink should be raised in module! |
| 182 | 182 | $pay_link = sn_module::$sn_module[$payment_module]->compile_request($request); |
| 183 | 183 | |
| 184 | 184 | // Поддержка дополнительной информации |
| 185 | - if(is_array($pay_link['RENDER'])) { |
|
| 186 | - foreach($pay_link['RENDER'] as $html_data) { |
|
| 185 | + if (is_array($pay_link['RENDER'])) { |
|
| 186 | + foreach ($pay_link['RENDER'] as $html_data) { |
|
| 187 | 187 | $template->assign_block_vars('render', $html_data); |
| 188 | - if(isset($html_data['VALUE']) && is_array($html_data['VALUE'])) { |
|
| 189 | - foreach($html_data['VALUE'] as $value_id => $value_value) { |
|
| 188 | + if (isset($html_data['VALUE']) && is_array($html_data['VALUE'])) { |
|
| 189 | + foreach ($html_data['VALUE'] as $value_id => $value_value) { |
|
| 190 | 190 | $template->assign_block_vars('render.value', array( |
| 191 | 191 | 'FIELD' => $value_id, |
| 192 | 192 | 'VALUE' => $value_value, |
@@ -197,8 +197,8 @@ discard block |
||
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | // Поддержка передачи данных для многошаговых платежных систем |
| 200 | - if(is_array($pay_link['DATA'])) { |
|
| 201 | - foreach($pay_link['DATA'] as $key => $value) { |
|
| 200 | + if (is_array($pay_link['DATA'])) { |
|
| 201 | + foreach ($pay_link['DATA'] as $key => $value) { |
|
| 202 | 202 | $template->assign_block_vars('pay_link_data', array( |
| 203 | 203 | 'FIELD' => $key, |
| 204 | 204 | 'VALUE' => $value, |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - if(is_array($pay_link) && in_array($pay_link['PAY_LINK_METHOD'], array('POST', 'GET', 'LINK', 'STEP'))) { |
|
| 209 | + if (is_array($pay_link) && in_array($pay_link['PAY_LINK_METHOD'], array('POST', 'GET', 'LINK', 'STEP'))) { |
|
| 210 | 210 | // TODO Переделать это под assign_vars_recursive и возвращать пустые строки если нет платежного метода - для унификации формы в темплейте |
| 211 | 211 | $template->assign_vars(array( |
| 212 | 212 | 'PAY_LINK_METHOD' => $pay_link['PAY_LINK_METHOD'], |
@@ -215,17 +215,17 @@ discard block |
||
| 215 | 215 | } else { |
| 216 | 216 | throw new exception(classLocale::$lang['pay_msg_request_paylink_unsupported'], ERR_ERROR); |
| 217 | 217 | } |
| 218 | - } catch(exception $e) { |
|
| 218 | + } catch (exception $e) { |
|
| 219 | 219 | $template->assign_block_vars('result', $response = array( |
| 220 | 220 | 'STATUS' => $e->getCode(), |
| 221 | 221 | 'MESSAGE' => $e->getMessage(), |
| 222 | 222 | )); |
| 223 | - classSupernova::$debug->warning('Результат операции: код ' . $e->getCode() . ' сообщение "' . $e->getMessage() . '"', 'Ошибка платежа', LOG_INFO_PAYMENT); |
|
| 223 | + classSupernova::$debug->warning('Результат операции: код '.$e->getCode().' сообщение "'.$e->getMessage().'"', 'Ошибка платежа', LOG_INFO_PAYMENT); |
|
| 224 | 224 | } |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | // Прегенерированные пакеты |
| 228 | -foreach($unit_available_amount_list as $unit_amount => $discount) { |
|
| 228 | +foreach ($unit_available_amount_list as $unit_amount => $discount) { |
|
| 229 | 229 | $temp = sn_module_payment::currency_convert($unit_amount, 'MM_', $player_currency); |
| 230 | 230 | $template->assign_block_vars('mm_amount', array( |
| 231 | 231 | 'VALUE' => $unit_amount, |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | 'PLAYER_CURRENCY' => $player_currency, |
| 261 | 261 | 'PLAYER_CURRENCY_PRICE_PER_MM' => sn_module_payment::currency_convert(1, $player_currency, 'MM_', 10), |
| 262 | 262 | |
| 263 | - 'UNIT_AMOUNT' => (float)$request['metamatter'], |
|
| 263 | + 'UNIT_AMOUNT' => (float) $request['metamatter'], |
|
| 264 | 264 | 'UNIT_AMOUNT_TEXT' => pretty_number($request['metamatter']), |
| 265 | 265 | 'UNIT_AMOUNT_BONUS_PERCENT' => $bonus_percent, |
| 266 | 266 | 'UNIT_AMOUNT_TEXT_DISCOUNTED' => $income_metamatter_text, |