@@ -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, |
@@ -1,12 +1,12 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
| 3 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
| 4 | 4 | |
| 5 | 5 | global $user, $planetrow; |
| 6 | 6 | |
| 7 | -if(!empty($_POST['return']) && is_array($_POST['return'])) { |
|
| 8 | - foreach($_POST['return'] as $fleet_id) { |
|
| 9 | - if($fleet_id = idval($fleet_id)) { |
|
| 7 | +if (!empty($_POST['return']) && is_array($_POST['return'])) { |
|
| 8 | + foreach ($_POST['return'] as $fleet_id) { |
|
| 9 | + if ($fleet_id = idval($fleet_id)) { |
|
| 10 | 10 | sn_db_transaction_start(); |
| 11 | 11 | $objFleet = new Fleet(); |
| 12 | 12 | $objFleet->dbLoad($fleet_id); |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | lng_include('overview'); |
| 31 | 31 | lng_include('fleet'); |
| 32 | 32 | |
| 33 | -if(!$planetrow) { |
|
| 33 | +if (!$planetrow) { |
|
| 34 | 34 | message(classLocale::$lang['fl_noplanetrow'], classLocale::$lang['fl_error']); |
| 35 | 35 | } |
| 36 | 36 | |
@@ -38,14 +38,14 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | $i = 0; |
| 40 | 40 | $objFleetList = FleetList::dbGetFleetListByOwnerId($user['id']); |
| 41 | -if(!empty($objFleetList)) { |
|
| 42 | - foreach($objFleetList->_container as $fleet_id => $objFleet) { |
|
| 41 | +if (!empty($objFleetList)) { |
|
| 42 | + foreach ($objFleetList->_container as $fleet_id => $objFleet) { |
|
| 43 | 43 | $i++; |
| 44 | 44 | $fleet_data = tplParseFleetObject($objFleet, $i, $user); |
| 45 | 45 | |
| 46 | 46 | $template->assign_block_vars('fleets', $fleet_data['fleet']); |
| 47 | 47 | |
| 48 | - foreach($fleet_data['ships'] as $ship_data) { |
|
| 48 | + foreach ($fleet_data['ships'] as $ship_data) { |
|
| 49 | 49 | $template->assign_block_vars('fleets.ships', $ship_data); |
| 50 | 50 | } |
| 51 | 51 | } |
@@ -2,9 +2,9 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | define('IN_ADMIN', true); |
| 4 | 4 | |
| 5 | -require('../includes/init.' . substr(strrchr(__FILE__, '.'), 1)); |
|
| 5 | +require('../includes/init.'.substr(strrchr(__FILE__, '.'), 1)); |
|
| 6 | 6 | |
| 7 | -if($user['authlevel'] < 3) |
|
| 7 | +if ($user['authlevel'] < 3) |
|
| 8 | 8 | { |
| 9 | 9 | message(classLocale::$lang['sys_noalloaw'], classLocale::$lang['sys_noaccess']); |
| 10 | 10 | die(); |
@@ -20,13 +20,13 @@ discard block |
||
| 20 | 20 | // [#] info_best_battles 1b0 |
| 21 | 21 | $best_reports = array(); |
| 22 | 22 | |
| 23 | -if(defined('MODULE_INFO_BEST_BATTLES_QUERY')) { |
|
| 23 | +if (defined('MODULE_INFO_BEST_BATTLES_QUERY')) { |
|
| 24 | 24 | $query = db_ube_report_get_best_battles(); |
| 25 | - while($row = db_fetch($query)) { |
|
| 25 | + while ($row = db_fetch($query)) { |
|
| 26 | 26 | $best_reports[] = $row['ube_report_id']; |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | -$best_reports = !empty($best_reports) ? ' AND ube_report_id NOT IN (' . implode(',', $best_reports) . ')' : ''; |
|
| 29 | +$best_reports = !empty($best_reports) ? ' AND ube_report_id NOT IN ('.implode(',', $best_reports).')' : ''; |
|
| 30 | 30 | |
| 31 | 31 | |
| 32 | 32 | $ques = array( |
@@ -90,14 +90,14 @@ discard block |
||
| 90 | 90 | // Удаляем юниты без планет |
| 91 | 91 | 'DELETE un FROM {{unit}} AS un |
| 92 | 92 | LEFT JOIN {{planets}} AS pl ON pl.id = un.unit_location_id |
| 93 | - WHERE unit_location_type = ' . LOC_PLANET . ' AND pl.id IS NULL;', |
|
| 93 | + WHERE unit_location_type = ' . LOC_PLANET.' AND pl.id IS NULL;', |
|
| 94 | 94 | // Удаляем пустые юниты с 0 уровнем (кроме Капитана) |
| 95 | - 'DELETE FROM {{unit}} WHERE unit_location_type = ' . LOC_PLANET . ' AND unit_level = 0 AND unit_type <> ' . UNIT_CAPTAIN, |
|
| 95 | + 'DELETE FROM {{unit}} WHERE unit_location_type = '.LOC_PLANET.' AND unit_level = 0 AND unit_type <> '.UNIT_CAPTAIN, |
|
| 96 | 96 | // Удаляем очереди на ничьих планетах |
| 97 | 97 | 'DELETE q FROM {{que}} AS q |
| 98 | 98 | LEFT JOIN {{planets}} AS p ON p.id = q.que_planet_id |
| 99 | 99 | WHERE |
| 100 | - que_type IN (' . QUE_STRUCTURES . ', ' . QUE_HANGAR . ', ' . SUBQUE_FLEET . ', ' . SUBQUE_DEFENSE . ') |
|
| 100 | + que_type IN (' . QUE_STRUCTURES.', '.QUE_HANGAR.', '.SUBQUE_FLEET.', '.SUBQUE_DEFENSE.') |
|
| 101 | 101 | AND |
| 102 | 102 | (p.id_owner = 0 OR p.id_owner IS NULL);', |
| 103 | 103 | |
@@ -112,12 +112,12 @@ discard block |
||
| 112 | 112 | // Удаляются сообщения, старше 4 недель, кроме личных и Альянсовских |
| 113 | 113 | 'DELETE FROM {{messages}} WHERE |
| 114 | 114 | UNIX_TIMESTAMP() - message_time > 4*7 * 24 * 60 * 60 AND |
| 115 | - message_type NOT IN (' . MSG_TYPE_PLAYER . ', ' . MSG_TYPE_ALLIANCE . ');', |
|
| 115 | + message_type NOT IN (' . MSG_TYPE_PLAYER.', '.MSG_TYPE_ALLIANCE.');', |
|
| 116 | 116 | // Удаляются сообщения у пользователей, которые неактивны больше 4 недель - кроме личных и Альянсовских |
| 117 | 117 | 'DELETE m FROM `{{users}}` AS u |
| 118 | 118 | JOIN {{messages}} AS m ON m.message_owner = u.id |
| 119 | 119 | WHERE |
| 120 | - message_type NOT IN (' . MSG_TYPE_PLAYER . ', ' . MSG_TYPE_ALLIANCE . ') AND |
|
| 120 | + message_type NOT IN (' . MSG_TYPE_PLAYER.', '.MSG_TYPE_ALLIANCE.') AND |
|
| 121 | 121 | authlevel = 0 AND user_as_ally IS NULL AND /* Не админы, Не Альянсы */ |
| 122 | 122 | UNIX_TIMESTAMP() - onlinetime > 4*7 *86400;', |
| 123 | 123 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | (log_dark_matter_timestamp, log_dark_matter_username, log_dark_matter_reason, log_dark_matter_amount, |
| 138 | 138 | log_dark_matter_comment, log_dark_matter_page, log_dark_matter_sender) |
| 139 | 139 | SELECT |
| 140 | - '{$pack_until}', IF(u.username IS NULL, ldm.log_dark_matter_username, u.username), " . RPG_CUMULATIVE . ", sum(ldm.log_dark_matter_amount), |
|
| 140 | + '{$pack_until}', IF(u.username IS NULL, ldm.log_dark_matter_username, u.username), ".RPG_CUMULATIVE.", sum(ldm.log_dark_matter_amount), |
|
| 141 | 141 | 'Баланс на {$pack_until}', 'admin/ajax_maintenance.php', ldm.log_dark_matter_sender |
| 142 | 142 | FROM |
| 143 | 143 | {{log_dark_matter}} AS ldm |
@@ -155,22 +155,22 @@ discard block |
||
| 155 | 155 | "REPLACE INTO `{{log_users_online}}` |
| 156 | 156 | (online_timestamp, online_count, online_aggregated) |
| 157 | 157 | SELECT |
| 158 | - FROM_UNIXTIME((UNIX_TIMESTAMP(online_timestamp) DIV " . PERIOD_MINUTE_10 . ") * (" . PERIOD_MINUTE_10 . ")), ceil(avg(online_count)), " . LOG_ONLIINE_AGGREGATE_PERIOD_MINUTE_10 . " |
|
| 158 | + FROM_UNIXTIME((UNIX_TIMESTAMP(online_timestamp) DIV " . PERIOD_MINUTE_10.") * (".PERIOD_MINUTE_10.")), ceil(avg(online_count)), ".LOG_ONLIINE_AGGREGATE_PERIOD_MINUTE_10." |
|
| 159 | 159 | FROM |
| 160 | 160 | `{{log_users_online}}` |
| 161 | 161 | WHERE |
| 162 | - online_timestamp < '{$pack_until}' AND online_aggregated = " . LOG_ONLIINE_AGGREGATE_NONE . " |
|
| 162 | + online_timestamp < '{$pack_until}' AND online_aggregated = ".LOG_ONLIINE_AGGREGATE_NONE." |
|
| 163 | 163 | GROUP BY |
| 164 | - (UNIX_TIMESTAMP(online_timestamp) DIV " . PERIOD_MINUTE_10 . ") * (" . PERIOD_MINUTE_10 . ");", |
|
| 164 | + (UNIX_TIMESTAMP(online_timestamp) DIV " . PERIOD_MINUTE_10.") * (".PERIOD_MINUTE_10.");", |
|
| 165 | 165 | |
| 166 | - "DELETE FROM {{log_users_online}} WHERE online_timestamp < '{$pack_until}' AND online_aggregated = " . LOG_ONLIINE_AGGREGATE_NONE, |
|
| 166 | + "DELETE FROM {{log_users_online}} WHERE online_timestamp < '{$pack_until}' AND online_aggregated = ".LOG_ONLIINE_AGGREGATE_NONE, |
|
| 167 | 167 | ), |
| 168 | 168 | |
| 169 | 169 | // Удаляем старые записи из логов |
| 170 | 170 | "DELETE FROM `{{logs}}` WHERE log_timestamp < '{$pack_until}';", |
| 171 | 171 | // Удаляем записи о маинтенансе, апдейте и пересчете статистики более чем недельной давности - они нам уже не нужны |
| 172 | 172 | 'DELETE FROM `{{logs}}` WHERE |
| 173 | - `log_code` IN (' . LOG_INFO_DB_CHANGE . ', ' . LOG_INFO_MAINTENANCE . ', ' . LOG_INFO_STAT_START . ', ' . LOG_INFO_STAT_PROCESS . ', ' . LOG_INFO_STAT_FINISH . ') |
|
| 173 | + `log_code` IN (' . LOG_INFO_DB_CHANGE.', '.LOG_INFO_MAINTENANCE.', '.LOG_INFO_STAT_START.', '.LOG_INFO_STAT_PROCESS.', '.LOG_INFO_STAT_FINISH.') |
|
| 174 | 174 | AND `log_timestamp` < DATE_SUB(NOW(),INTERVAL 7 DAY);', |
| 175 | 175 | |
| 176 | 176 | |
@@ -186,16 +186,16 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | function sn_maintenance_pack_user_list($user_list) { |
| 188 | 188 | $user_list = explode(',', $user_list); |
| 189 | - foreach($user_list as $key => $user_id) { |
|
| 190 | - if(!ceil(floatval($user_id))) { |
|
| 189 | + foreach ($user_list as $key => $user_id) { |
|
| 190 | + if (!ceil(floatval($user_id))) { |
|
| 191 | 191 | unset($user_list[$key]); |
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | $result = array(); |
| 196 | - if(!empty($user_list)) { |
|
| 196 | + if (!empty($user_list)) { |
|
| 197 | 197 | $query = db_user_list_get_by_id_array($user_list); |
| 198 | - while($row = db_fetch($query)) { |
|
| 198 | + while ($row = db_fetch($query)) { |
|
| 199 | 199 | $result[] = $row['id']; |
| 200 | 200 | } |
| 201 | 201 | } |
@@ -208,13 +208,13 @@ discard block |
||
| 208 | 208 | $old_server_status == GAME_DISABLE_NONE ? classSupernova::$config->db_saveItem('game_disable', GAME_DISABLE_MAINTENANCE) : false; |
| 209 | 209 | sn_db_transaction_commit(); |
| 210 | 210 | |
| 211 | -foreach($ques as $que_transaction) { |
|
| 211 | +foreach ($ques as $que_transaction) { |
|
| 212 | 212 | sn_db_transaction_start(); |
| 213 | 213 | |
| 214 | 214 | !is_array($que_transaction) ? $que_transaction = array($que_transaction) : false; |
| 215 | - foreach($que_transaction as $que) { |
|
| 215 | + foreach ($que_transaction as $que) { |
|
| 216 | 216 | set_time_limit(120); |
| 217 | - if(is_callable($que)) { |
|
| 217 | + if (is_callable($que)) { |
|
| 218 | 218 | $QryResult = call_user_func($que); |
| 219 | 219 | } else { |
| 220 | 220 | $QryResult = doquery($que); |
@@ -225,12 +225,12 @@ discard block |
||
| 225 | 225 | //$que = str_replace('}}', '', $que); |
| 226 | 226 | |
| 227 | 227 | $msg .= |
| 228 | - '<li>' . htmlspecialchars($que) . |
|
| 229 | - ' --- <span style="' . ($QryResult ? 'ok">OK' : 'error">FAILED!') . '</span> ' . |
|
| 230 | - classSupernova::$db->db_affected_rows() . ' ' . classLocale::$lang['adm_records'] . |
|
| 228 | + '<li>'.htmlspecialchars($que). |
|
| 229 | + ' --- <span style="'.($QryResult ? 'ok">OK' : 'error">FAILED!').'</span> '. |
|
| 230 | + classSupernova::$db->db_affected_rows().' '.classLocale::$lang['adm_records']. |
|
| 231 | 231 | "</li>"; |
| 232 | 232 | |
| 233 | - classSupernova::$debug->warning($que . ' --- ' . ($QryResult ? 'OK' : 'FAILED!') . ' ' . classSupernova::$db->db_affected_rows() . ' ' . classLocale::$lang['adm_records'], 'System maintenance', LOG_INFO_MAINTENANCE); |
|
| 233 | + classSupernova::$debug->warning($que.' --- '.($QryResult ? 'OK' : 'FAILED!').' '.classSupernova::$db->db_affected_rows().' '.classLocale::$lang['adm_records'], 'System maintenance', LOG_INFO_MAINTENANCE); |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | sn_db_transaction_commit(); |
@@ -256,5 +256,5 @@ discard block |
||
| 256 | 256 | |
| 257 | 257 | $adm_stat_title = classLocale::$lang['adm_stat_title']; |
| 258 | 258 | $result = $result ? "<li>{$adm_stat_title} - {$result}</li>" : ''; |
| 259 | -$result = '<div align="left"><ul>' . $msg . $result . '</ul></div>'; |
|
| 260 | -echo json_encode($result . ' ' . $totaltime); |
|
| 259 | +$result = '<div align="left"><ul>'.$msg.$result.'</ul></div>'; |
|
| 260 | +echo json_encode($result.' '.$totaltime); |
|
@@ -12,24 +12,24 @@ discard block |
||
| 12 | 12 | global $template_result, $user; |
| 13 | 13 | |
| 14 | 14 | // Напоминание для Администрации, что игра отключена |
| 15 | -if($template_result[F_GAME_DISABLE]) { |
|
| 15 | +if ($template_result[F_GAME_DISABLE]) { |
|
| 16 | 16 | echo '<div class="global_admin_warning">', $template_result[F_GAME_DISABLE_REASON], '</div>'; |
| 17 | 17 | } |
| 18 | 18 | unset($disable_reason); |
| 19 | 19 | |
| 20 | 20 | |
| 21 | -if(defined('IN_ADMIN') && IN_ADMIN === true) { |
|
| 21 | +if (defined('IN_ADMIN') && IN_ADMIN === true) { |
|
| 22 | 22 | lng_include('admin'); |
| 23 | -} elseif($sys_user_logged_in) { |
|
| 23 | +} elseif ($sys_user_logged_in) { |
|
| 24 | 24 | sys_user_vacation($user); |
| 25 | 25 | |
| 26 | 26 | $planet_id = SetSelectedPlanet($user); |
| 27 | 27 | |
| 28 | 28 | // TODO НЕ НУЖНО АЛЬЯНС КАЖДЫЙ РАЗ ОБНОВЛЯТЬ!!! |
| 29 | - if($user['ally_id']) { |
|
| 29 | + if ($user['ally_id']) { |
|
| 30 | 30 | sn_db_transaction_start(); |
| 31 | 31 | sn_ali_fill_user_ally($user); |
| 32 | - if(!$user['ally']['player']['id']) { |
|
| 32 | + if (!$user['ally']['player']['id']) { |
|
| 33 | 33 | // sn_sys_logout(false, true); |
| 34 | 34 | // core_auth::logout(false); |
| 35 | 35 | classSupernova::$auth->logout(false); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | // TODO UNCOMMENT |
| 39 | 39 | que_process($user['ally']['player']); |
| 40 | - db_user_set_by_id($user['ally']['player']['id'], '`onlinetime` = ' . SN_TIME_NOW); |
|
| 40 | + db_user_set_by_id($user['ally']['player']['id'], '`onlinetime` = '.SN_TIME_NOW); |
|
| 41 | 41 | sn_db_transaction_commit(); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | sn_db_transaction_commit(); |
| 49 | 49 | |
| 50 | 50 | $planetrow = $global_data['planet']; |
| 51 | - if(!($planetrow && isset($planetrow['id']) && $planetrow['id'])) { |
|
| 51 | + if (!($planetrow && isset($planetrow['id']) && $planetrow['id'])) { |
|
| 52 | 52 | // sn_sys_logout(false, true); |
| 53 | 53 | // core_auth::logout(false); |
| 54 | 54 | classSupernova::$auth->logout(false); |
@@ -3,13 +3,13 @@ discard block |
||
| 3 | 3 | define('SN_IN_FLEET', true); |
| 4 | 4 | define('SN_RENDER_NAVBAR_PLANET', true); |
| 5 | 5 | |
| 6 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
| 6 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
| 7 | 7 | |
| 8 | 8 | // TODO - Переместить это куда-нибудь |
| 9 | 9 | $fleet_page = sys_get_param_int('fleet_page', sys_get_param_int('mode')); |
| 10 | -if($fleet_ship_sort = sys_get_param_id('sort_elements') && $fleet_page == 0) { |
|
| 10 | +if ($fleet_ship_sort = sys_get_param_id('sort_elements') && $fleet_page == 0) { |
|
| 11 | 11 | define('IN_AJAX', true); |
| 12 | - if(!empty(classLocale::$lang['player_option_fleet_ship_sort'][$fleet_ship_sort])) { |
|
| 12 | + if (!empty(classLocale::$lang['player_option_fleet_ship_sort'][$fleet_ship_sort])) { |
|
| 13 | 13 | classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT] = $fleet_ship_sort; |
| 14 | 14 | classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT_INVERSE] = sys_get_param_id('sort_elements_inverse', 0); |
| 15 | 15 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $objFleet5->initDefaults($user, $planetrow, $targetVector, $target_mission, $ships, $fleet_group_mr, $speed_percent, 0, $captainId, $resources); |
| 46 | 46 | |
| 47 | 47 | |
| 48 | -switch($fleet_page) { |
|
| 48 | +switch ($fleet_page) { |
|
| 49 | 49 | case 1: |
| 50 | 50 | $objFleet5->fleetPage1(); |
| 51 | 51 | break; |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * |
| 23 | 23 | **/ |
| 24 | 24 | |
| 25 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
| 25 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * @param $resource_id |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $storage_fill = $caps_real['total_storage'][$resource_id] ? floor(mrc_get_level($user, $planetrow, $resource_id) / $caps_real['total_storage'][$resource_id] * 100) : 0; |
| 37 | 37 | |
| 38 | 38 | $template->assign_block_vars('resources', array( |
| 39 | - 'NAME' => classLocale::$lang["sys_" . pname_resource_name($resource_id)], |
|
| 39 | + 'NAME' => classLocale::$lang["sys_".pname_resource_name($resource_id)], |
|
| 40 | 40 | |
| 41 | 41 | 'HOURLY' => pretty_number($totalProduction, true, true), |
| 42 | 42 | 'WEEKLY' => pretty_number($totalProduction * 24 * 7, true, true), |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | //$SubQry .= "`{$field_name}` = '{$percent}',"; |
| 78 | 78 | $SubQry[] = "`{$field_name}` = '{$percent}'"; |
| 79 | 79 | } else { |
| 80 | - classSupernova::$debug->warning('Supplying wrong ID in production array - attempt to change some field - ID' . $prod_id, 'Resource Page', 301); |
|
| 80 | + classSupernova::$debug->warning('Supplying wrong ID in production array - attempt to change some field - ID'.$prod_id, 'Resource Page', 301); |
|
| 81 | 81 | continue; |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | [!] DB code updates |
| 22 | 22 | */ |
| 23 | 23 | |
| 24 | -if(!defined('INIT')) { |
|
| 24 | +if (!defined('INIT')) { |
|
| 25 | 25 | // include_once('init.php'); |
| 26 | 26 | die('Unauthorized access'); |
| 27 | 27 | } |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | classSupernova::$config->debug = 0; |
| 40 | 40 | |
| 41 | 41 | |
| 42 | -if(classSupernova::$config->db_version == DB_VERSION) { |
|
| 43 | -} elseif(classSupernova::$config->db_version > DB_VERSION) { |
|
| 42 | +if (classSupernova::$config->db_version == DB_VERSION) { |
|
| 43 | +} elseif (classSupernova::$config->db_version > DB_VERSION) { |
|
| 44 | 44 | classSupernova::$config->db_saveItem('var_db_update_end', SN_TIME_NOW); |
| 45 | 45 | die( |
| 46 | 46 | 'Internal error! Auotupdater detects DB version greater then can be handled!<br /> |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | ); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | -if(classSupernova::$config->db_version < 26) { |
|
| 52 | +if (classSupernova::$config->db_version < 26) { |
|
| 53 | 53 | $sys_log_disabled = true; |
| 54 | 54 | } |
| 55 | 55 | |
@@ -68,20 +68,20 @@ discard block |
||
| 68 | 68 | $update_tables = array(); |
| 69 | 69 | $update_indexes = array(); |
| 70 | 70 | $query = upd_do_query('SHOW TABLES;', true); |
| 71 | -while($row = db_fetch_row($query)) { |
|
| 71 | +while ($row = db_fetch_row($query)) { |
|
| 72 | 72 | upd_load_table_info($row[0]); |
| 73 | 73 | } |
| 74 | 74 | upd_log_message('Table info loaded. Now looking DB for upgrades...'); |
| 75 | 75 | |
| 76 | 76 | upd_do_query('SET FOREIGN_KEY_CHECKS=0;', true); |
| 77 | 77 | |
| 78 | -if($new_version < 37) { |
|
| 78 | +if ($new_version < 37) { |
|
| 79 | 79 | require_once('update_old.php'); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | ini_set('memory_limit', '1024M'); |
| 83 | 83 | |
| 84 | -switch($new_version) { |
|
| 84 | +switch ($new_version) { |
|
| 85 | 85 | case 37: |
| 86 | 86 | upd_log_version_update(); |
| 87 | 87 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | upd_check_key('payment_currency_exchange_mm_', 2500, !classSupernova::$config->payment_currency_exchange_mm_); |
| 98 | 98 | |
| 99 | - if(!$update_tables['log_metamatter']) { |
|
| 99 | + if (!$update_tables['log_metamatter']) { |
|
| 100 | 100 | upd_create_table('log_metamatter', |
| 101 | 101 | "( |
| 102 | 102 | `id` SERIAL, |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | "ADD `payment_test` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Is this a test payment?'", |
| 122 | 122 | ), !$update_tables['payment']['payment_test']); |
| 123 | 123 | |
| 124 | - if($update_tables['payment']['payment_test']['Default'] == 1) { |
|
| 124 | + if ($update_tables['payment']['payment_test']['Default'] == 1) { |
|
| 125 | 125 | upd_alter_table('payment', array( |
| 126 | 126 | "MODIFY COLUMN `payment_test` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Is this a test payment?'", |
| 127 | 127 | )); |
@@ -137,15 +137,15 @@ discard block |
||
| 137 | 137 | "MODIFY COLUMN `metamatter` BIGINT(20) NOT NULL DEFAULT 0 COMMENT 'Metamatter amount'", |
| 138 | 138 | ), $update_tables['users']['metamatter']['Type'] == 'int(20)'); |
| 139 | 139 | |
| 140 | - $query = upd_do_query("SELECT * FROM {{que}} WHERE `que_type` = " . QUE_RESEARCH . " AND que_unit_id IN (" . TECH_EXPEDITION . "," . TECH_COLONIZATION . ") FOR UPDATE"); |
|
| 141 | - while($row = db_fetch($query)) { |
|
| 140 | + $query = upd_do_query("SELECT * FROM {{que}} WHERE `que_type` = ".QUE_RESEARCH." AND que_unit_id IN (".TECH_EXPEDITION.",".TECH_COLONIZATION.") FOR UPDATE"); |
|
| 141 | + while ($row = db_fetch($query)) { |
|
| 142 | 142 | $planet_id = ($row['que_planet_id_origin'] ? $row['que_planet_id_origin'] : $row['que_planet_id']); |
| 143 | 143 | upd_do_query("SELECT id FROM {{planets}} WHERE id = {$planet_id} FOR UPDATE"); |
| 144 | 144 | $price = sys_unit_str2arr($row['que_unit_price']); |
| 145 | - upd_do_query("UPDATE {{planets}} SET " . |
|
| 146 | - "`metal` = `metal` + " . ($price[RES_METAL] ? $price[RES_METAL] : 0) . "," . |
|
| 147 | - "`crystal` = `crystal` + " . ($price[RES_CRYSTAL] ? $price[RES_CRYSTAL] : 0) . "," . |
|
| 148 | - "`deuterium` = `deuterium` + " . ($price[RES_DEUTERIUM] ? $price[RES_DEUTERIUM] : 0) . |
|
| 145 | + upd_do_query("UPDATE {{planets}} SET ". |
|
| 146 | + "`metal` = `metal` + ".($price[RES_METAL] ? $price[RES_METAL] : 0).",". |
|
| 147 | + "`crystal` = `crystal` + ".($price[RES_CRYSTAL] ? $price[RES_CRYSTAL] : 0).",". |
|
| 148 | + "`deuterium` = `deuterium` + ".($price[RES_DEUTERIUM] ? $price[RES_DEUTERIUM] : 0). |
|
| 149 | 149 | " WHERE id = {$planet_id}" |
| 150 | 150 | ); |
| 151 | 151 | upd_do_query("DELETE FROM {{que}} WHERE que_id = {$row['que_id']}"); |
@@ -154,10 +154,10 @@ discard block |
||
| 154 | 154 | $query = upd_do_query("SELECT unit_id, unit_snid, unit_level, id_planet FROM {{unit}} AS un |
| 155 | 155 | LEFT JOIN {{users}} AS u ON u.id = un.unit_player_id |
| 156 | 156 | LEFT JOIN {{planets}} AS p ON p.id = u.id_planet |
| 157 | - WHERE unit_snid IN (" . TECH_EXPEDITION . "," . TECH_COLONIZATION . ") |
|
| 157 | + WHERE unit_snid IN (" . TECH_EXPEDITION.",".TECH_COLONIZATION.") |
|
| 158 | 158 | FOR UPDATE"); |
| 159 | - while($row = db_fetch($query)) { |
|
| 160 | - if(!$row['id_planet']) { |
|
| 159 | + while ($row = db_fetch($query)) { |
|
| 160 | + if (!$row['id_planet']) { |
|
| 161 | 161 | continue; |
| 162 | 162 | } |
| 163 | 163 | |
@@ -165,14 +165,14 @@ discard block |
||
| 165 | 165 | $unit_level = $row['unit_level']; |
| 166 | 166 | $price = get_unit_param($unit_id, P_COST); |
| 167 | 167 | $factor = $price['factor']; |
| 168 | - foreach($price as $resource_id => &$resource_amount) { |
|
| 168 | + foreach ($price as $resource_id => &$resource_amount) { |
|
| 169 | 169 | $resource_amount = $resource_amount * (pow($factor, $unit_level) - 1) / ($factor - 1); |
| 170 | 170 | } |
| 171 | 171 | // upd_do_query |
| 172 | - upd_do_query($q = "UPDATE {{planets}} SET " . |
|
| 173 | - "`metal` = `metal` + " . ($price[RES_METAL] ? $price[RES_METAL] : 0) . "," . |
|
| 174 | - "`crystal` = `crystal` + " . ($price[RES_CRYSTAL] ? $price[RES_CRYSTAL] : 0) . "," . |
|
| 175 | - "`deuterium` = `deuterium` + " . ($price[RES_DEUTERIUM] ? $price[RES_DEUTERIUM] : 0) . |
|
| 172 | + upd_do_query($q = "UPDATE {{planets}} SET ". |
|
| 173 | + "`metal` = `metal` + ".($price[RES_METAL] ? $price[RES_METAL] : 0).",". |
|
| 174 | + "`crystal` = `crystal` + ".($price[RES_CRYSTAL] ? $price[RES_CRYSTAL] : 0).",". |
|
| 175 | + "`deuterium` = `deuterium` + ".($price[RES_DEUTERIUM] ? $price[RES_DEUTERIUM] : 0). |
|
| 176 | 176 | " WHERE id = {$row['id_planet']}" |
| 177 | 177 | ); |
| 178 | 178 | upd_do_query("DELETE FROM {{unit}} WHERE unit_id = {$row['unit_id']}"); |
@@ -184,14 +184,14 @@ discard block |
||
| 184 | 184 | // Вернуть ресы за уже исследованную Экспедиционную технологию |
| 185 | 185 | upd_check_key('player_max_colonies', -1, classSupernova::$config->player_max_colonies >= 0); |
| 186 | 186 | |
| 187 | - if(!isset($update_tables['users']['player_rpg_explore_xp'])) { |
|
| 187 | + if (!isset($update_tables['users']['player_rpg_explore_xp'])) { |
|
| 188 | 188 | upd_alter_table('users', array( |
| 189 | 189 | "ADD COLUMN `player_rpg_explore_level` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 AFTER `dark_matter`", |
| 190 | 190 | "ADD COLUMN `player_rpg_explore_xp` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 AFTER `dark_matter`", |
| 191 | 191 | ), !isset($update_tables['users']['player_rpg_explore_xp'])); |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - if(!$update_tables['log_users_online']) { |
|
| 194 | + if (!$update_tables['log_users_online']) { |
|
| 195 | 195 | upd_create_table('log_users_online', "( |
| 196 | 196 | `online_timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Measure time', |
| 197 | 197 | `online_count` SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Users online', |
@@ -206,11 +206,11 @@ discard block |
||
| 206 | 206 | "ADD `user_time_measured` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'When was time diff measured last time' AFTER `onlinetime`", |
| 207 | 207 | ), !$update_tables['users']['user_time_measured']); |
| 208 | 208 | |
| 209 | - if($update_tables['rw']) { |
|
| 209 | + if ($update_tables['rw']) { |
|
| 210 | 210 | upd_do_query("DROP TABLE IF EXISTS {{rw}};"); |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | - if(!$update_tables['player_award']) { |
|
| 213 | + if (!$update_tables['player_award']) { |
|
| 214 | 214 | upd_create_table('player_award', "( |
| 215 | 215 | `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
| 216 | 216 | `award_type_id` int(11) DEFAULT NULL COMMENT 'Award type i.e. order, medal, pennant, rank etc', |
@@ -252,14 +252,14 @@ discard block |
||
| 252 | 252 | upd_log_version_update(); |
| 253 | 253 | |
| 254 | 254 | |
| 255 | - if(!isset($update_tables['planets']['que_processed'])) { |
|
| 255 | + if (!isset($update_tables['planets']['que_processed'])) { |
|
| 256 | 256 | upd_alter_table('planets', array( |
| 257 | 257 | "ADD COLUMN `que_processed` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `last_update`", |
| 258 | 258 | ), true); |
| 259 | 259 | upd_do_query("UPDATE {{planets}} SET que_processed = last_update;"); |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | - if(!isset($update_tables['users']['que_processed'])) { |
|
| 262 | + if (!isset($update_tables['users']['que_processed'])) { |
|
| 263 | 263 | upd_alter_table('users', array( |
| 264 | 264 | "ADD COLUMN `que_processed` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `onlinetime`", |
| 265 | 265 | ), true); |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | |
| 270 | - if(isset($update_tables['planets']['que'])) { |
|
| 270 | + if (isset($update_tables['planets']['que'])) { |
|
| 271 | 271 | $sn_data_aux = array( |
| 272 | 272 | SHIP_SMALL_FIGHTER_WRATH => array( |
| 273 | 273 | 'name' => 'ship_fighter_wrath', |
@@ -352,20 +352,20 @@ discard block |
||
| 352 | 352 | $unit_data = array(); |
| 353 | 353 | $planets = array(); |
| 354 | 354 | |
| 355 | - foreach($planet_unit_list as $unit_id) { |
|
| 356 | - if(!($unit_name = get_unit_param($unit_id, P_NAME))) { |
|
| 355 | + foreach ($planet_unit_list as $unit_id) { |
|
| 356 | + if (!($unit_name = get_unit_param($unit_id, P_NAME))) { |
|
| 357 | 357 | $unit_name = $sn_data_aux[$unit_id][P_NAME]; |
| 358 | 358 | } |
| 359 | - if(isset($update_tables['planets'][$unit_name])) { |
|
| 359 | + if (isset($update_tables['planets'][$unit_name])) { |
|
| 360 | 360 | $drop[] = "DROP COLUMN `{$unit_name}`"; |
| 361 | 361 | |
| 362 | - if(isset($aux_group[$unit_id])) { |
|
| 362 | + if (isset($aux_group[$unit_id])) { |
|
| 363 | 363 | $units_info[$unit_id] = $sn_data_aux[$unit_id]; |
| 364 | 364 | $units_info[$unit_id]['que'] = QUE_HANGAR; |
| 365 | 365 | } else { |
| 366 | 366 | $units_info[$unit_id] = get_unit_param($unit_id); |
| 367 | - foreach($ques_info as $que_id => $que_data1) { |
|
| 368 | - if(in_array($unit_id, $que_data1['unit_list'])) { |
|
| 367 | + foreach ($ques_info as $que_id => $que_data1) { |
|
| 368 | + if (in_array($unit_id, $que_data1['unit_list'])) { |
|
| 369 | 369 | $units_info[$unit_id]['que'] = $que_id; |
| 370 | 370 | break; |
| 371 | 371 | } |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | $query = upd_do_query("SELECT * FROM {{planets}} FOR UPDATE"); |
| 378 | - while($row = db_fetch($query)) { |
|
| 378 | + while ($row = db_fetch($query)) { |
|
| 379 | 379 | $user_id = $row['id_owner']; |
| 380 | 380 | $planet_id = $row['id']; |
| 381 | 381 | |
@@ -383,25 +383,25 @@ discard block |
||
| 383 | 383 | |
| 384 | 384 | // Конвертируем юниты |
| 385 | 385 | $units_levels = array(); |
| 386 | - foreach($planet_unit_list as $unit_id) { |
|
| 386 | + foreach ($planet_unit_list as $unit_id) { |
|
| 387 | 387 | $unit_name = &$units_info[$unit_id][P_NAME]; |
| 388 | - if(!isset($row[$unit_name]) || !$row[$unit_name]) { |
|
| 388 | + if (!isset($row[$unit_name]) || !$row[$unit_name]) { |
|
| 389 | 389 | continue; |
| 390 | 390 | } |
| 391 | 391 | $units_levels[$unit_id] = $row[$unit_name]; |
| 392 | - $unit_data[] = "({$user_id}," . LOC_PLANET . ",{$planet_id},{$units_info[$unit_id][P_UNIT_TYPE]},{$unit_id},{$units_levels[$unit_id]})"; |
|
| 393 | - if(count($unit_data) > 30) { |
|
| 392 | + $unit_data[] = "({$user_id},".LOC_PLANET.",{$planet_id},{$units_info[$unit_id][P_UNIT_TYPE]},{$unit_id},{$units_levels[$unit_id]})"; |
|
| 393 | + if (count($unit_data) > 30) { |
|
| 394 | 394 | $unit_data_max = strlen(implode(',', $unit_data)) > $unit_data_max ? strlen(implode(',', $unit_data)) : $unit_data_max; |
| 395 | - 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) . ';'); |
|
| 395 | + 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).';'); |
|
| 396 | 396 | $unit_data = array(); |
| 397 | 397 | } |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | // Конвертируем очередь построек |
| 401 | - if($row['que']) { |
|
| 401 | + if ($row['que']) { |
|
| 402 | 402 | $que = explode(';', $row['que']); |
| 403 | - foreach($que as $que_item) { |
|
| 404 | - if(!$que_item) { |
|
| 403 | + foreach ($que as $que_item) { |
|
| 404 | + if (!$que_item) { |
|
| 405 | 405 | continue; |
| 406 | 406 | } |
| 407 | 407 | |
@@ -416,8 +416,8 @@ discard block |
||
| 416 | 416 | $unit_factor = $unit_cost[P_FACTOR] ? $unit_cost[P_FACTOR] : 1; |
| 417 | 417 | $price_increase = pow($unit_factor, $unit_level); |
| 418 | 418 | // $unit_time = 0; |
| 419 | - foreach($unit_cost as $resource_id => &$resource_amount) { |
|
| 420 | - if(!in_array($resource_id, $group_resource_loot)) { |
|
| 419 | + foreach ($unit_cost as $resource_id => &$resource_amount) { |
|
| 420 | + if (!in_array($resource_id, $group_resource_loot)) { |
|
| 421 | 421 | unset($unit_cost[$resource_id]); |
| 422 | 422 | continue; |
| 423 | 423 | } |
@@ -431,39 +431,39 @@ discard block |
||
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | // Конвертируем очередь верфи |
| 434 | - if($row['b_hangar_id']) { |
|
| 434 | + if ($row['b_hangar_id']) { |
|
| 435 | 435 | $return_resources = array(RES_METAL => 0, RES_CRYSTAL => 0, RES_DEUTERIUM => 0,); |
| 436 | 436 | $hangar_units = sys_unit_str2arr($row['b_hangar_id']); |
| 437 | - foreach($hangar_units as $unit_id => $unit_count) { |
|
| 438 | - if($unit_count <= 0) { |
|
| 437 | + foreach ($hangar_units as $unit_id => $unit_count) { |
|
| 438 | + if ($unit_count <= 0) { |
|
| 439 | 439 | continue; |
| 440 | 440 | } |
| 441 | - foreach($units_info[$unit_id][P_COST] as $resource_id => $resource_amount) { |
|
| 442 | - if(!in_array($resource_id, $group_resource_loot)) { |
|
| 441 | + foreach ($units_info[$unit_id][P_COST] as $resource_id => $resource_amount) { |
|
| 442 | + if (!in_array($resource_id, $group_resource_loot)) { |
|
| 443 | 443 | continue; |
| 444 | 444 | } |
| 445 | 445 | $return_resources[$resource_id] += $unit_count * $resource_amount; |
| 446 | 446 | } |
| 447 | 447 | } |
| 448 | - if(array_sum($return_resources) > 0) { |
|
| 448 | + if (array_sum($return_resources) > 0) { |
|
| 449 | 449 | 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"); |
| 450 | 450 | } |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | |
| 454 | - if(count($que_data) > 10) { |
|
| 454 | + if (count($que_data) > 10) { |
|
| 455 | 455 | $que_data_max = strlen(implode(',', $que_data)) > $que_data_max ? strlen(implode(',', $que_data)) : $que_data_max; |
| 456 | - 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) . ';'); |
|
| 456 | + 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).';'); |
|
| 457 | 457 | $que_data = array(); |
| 458 | 458 | } |
| 459 | 459 | } |
| 460 | 460 | |
| 461 | - if(!empty($unit_data)) { |
|
| 462 | - 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) . ';'); |
|
| 461 | + if (!empty($unit_data)) { |
|
| 462 | + 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 | 463 | } |
| 464 | 464 | |
| 465 | - if(!empty($que_data)) { |
|
| 466 | - 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) . ';'); |
|
| 465 | + if (!empty($que_data)) { |
|
| 466 | + 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 | 467 | } |
| 468 | 468 | |
| 469 | 469 | upd_alter_table('planets', $drop, true); |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | JOIN `{{users}}` AS u ON a.`id` = u.`user_as_ally` AND `user_as_ally` IS NOT NULL AND `username` = '' |
| 474 | 474 | SET u.`username` = CONCAT('[', a.`ally_tag`, ']');"); |
| 475 | 475 | |
| 476 | - if($update_indexes['statpoints']['I_stats_id_ally'] != 'id_ally,stat_type,stat_code,') { |
|
| 476 | + if ($update_indexes['statpoints']['I_stats_id_ally'] != 'id_ally,stat_type,stat_code,') { |
|
| 477 | 477 | upd_do_query("SET FOREIGN_KEY_CHECKS=0;"); |
| 478 | 478 | upd_alter_table('statpoints', "DROP FOREIGN KEY `FK_stats_id_ally`", $update_foreigns['statpoints']['FK_stats_id_ally']); |
| 479 | 479 | upd_alter_table('statpoints', "DROP KEY `I_stats_id_ally`", $update_indexes['statpoints']['I_stats_id_ally']); |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | "ADD CONSTRAINT `FK_users_browser_id` FOREIGN KEY (`user_last_browser_id`) REFERENCES `{{security_browser}}` (`browser_id`) ON DELETE SET NULL ON UPDATE CASCADE", |
| 570 | 570 | ), !isset($update_tables['users']['user_last_proxy'])); |
| 571 | 571 | |
| 572 | - if(!isset($update_tables['notes']['planet_type'])) { |
|
| 572 | + if (!isset($update_tables['notes']['planet_type'])) { |
|
| 573 | 573 | upd_alter_table('notes', array( |
| 574 | 574 | "ADD COLUMN `galaxy` SMALLINT(6) UNSIGNED NOT NULL DEFAULT 0 AFTER `title`", |
| 575 | 575 | "ADD COLUMN `system` SMALLINT(6) UNSIGNED NOT NULL DEFAULT 0 AFTER `galaxy`", |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | upd_alter_table('users', "ADD COLUMN `user_bot` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0", !isset($update_tables['users']['user_bot'])); |
| 588 | 588 | upd_alter_table('unit', "ADD KEY `I_unit_type_snid` (unit_type, unit_snid) USING BTREE", !$update_indexes['unit']['I_unit_type_snid']); |
| 589 | 589 | |
| 590 | - if($update_tables['users']['settings_tooltiptime']['Type'] != 'smallint(5) unsigned') { |
|
| 590 | + if ($update_tables['users']['settings_tooltiptime']['Type'] != 'smallint(5) unsigned') { |
|
| 591 | 591 | upd_alter_table('users', array( |
| 592 | 592 | "MODIFY COLUMN `settings_tooltiptime` smallint(5) unsigned NOT NULL DEFAULT '500'", |
| 593 | 593 | ), $update_tables['users']['settings_tooltiptime']['Type'] != 'smallint'); |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | upd_do_query("UPDATE `{{users}}` SET settings_tooltiptime = 500;"); |
| 596 | 596 | } |
| 597 | 597 | |
| 598 | - if(!isset($update_tables['log_users_online']['online_aggregated'])) { |
|
| 598 | + if (!isset($update_tables['log_users_online']['online_aggregated'])) { |
|
| 599 | 599 | 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'])); |
| 600 | 600 | upd_alter_table('log_users_online', array( |
| 601 | 601 | "DROP PRIMARY KEY", |
@@ -603,13 +603,13 @@ discard block |
||
| 603 | 603 | ), $update_indexes['log_users_online']['PRIMARY'] != 'online_timestamp,online_aggregated,'); |
| 604 | 604 | } |
| 605 | 605 | |
| 606 | - if(!isset($update_tables['users']['gender'])) { |
|
| 607 | - upd_alter_table('users', "ADD COLUMN `gender` TINYINT(1) UNSIGNED NOT NULL DEFAULT " . GENDER_UNKNOWN, !isset($update_tables['users']['gender'])); |
|
| 608 | - upd_do_query("UPDATE {{users}} SET `gender` = IF(UPPER(`sex`) = 'F', " . GENDER_FEMALE . ", IF(UPPER(`sex`) = 'M', " . GENDER_MALE . ", " . GENDER_UNKNOWN . "));"); |
|
| 606 | + if (!isset($update_tables['users']['gender'])) { |
|
| 607 | + upd_alter_table('users', "ADD COLUMN `gender` TINYINT(1) UNSIGNED NOT NULL DEFAULT ".GENDER_UNKNOWN, !isset($update_tables['users']['gender'])); |
|
| 608 | + upd_do_query("UPDATE {{users}} SET `gender` = IF(UPPER(`sex`) = 'F', ".GENDER_FEMALE.", IF(UPPER(`sex`) = 'M', ".GENDER_MALE.", ".GENDER_UNKNOWN."));"); |
|
| 609 | 609 | } |
| 610 | 610 | upd_alter_table('users', "DROP COLUMN `sex`", isset($update_tables['users']['sex'])); |
| 611 | 611 | |
| 612 | - if(!$update_tables['users']['dark_matter_total']) { |
|
| 612 | + if (!$update_tables['users']['dark_matter_total']) { |
|
| 613 | 613 | 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']); |
| 614 | 614 | upd_do_query( |
| 615 | 615 | "UPDATE `{{users}}` AS u |
@@ -622,7 +622,7 @@ discard block |
||
| 622 | 622 | } |
| 623 | 623 | |
| 624 | 624 | upd_check_key('player_metamatter_immortal', 100000, !isset(classSupernova::$config->player_metamatter_immortal)); |
| 625 | - if(!$update_tables['users']['metamatter_total']) { |
|
| 625 | + if (!$update_tables['users']['metamatter_total']) { |
|
| 626 | 626 | upd_alter_table('users', "ADD `metamatter_total` BIGINT(20) NOT NULL DEFAULT 0 COMMENT 'Total Metamatter amount ever bought'", !$update_tables['users']['metamatter_total']); |
| 627 | 627 | |
| 628 | 628 | upd_do_query( |
@@ -634,11 +634,11 @@ discard block |
||
| 634 | 634 | (SELECT IF(sum(amount) IS NULL, 0, sum(amount)) FROM {{log_metamatter}} AS mm WHERE mm.user_id = u.id AND mm.amount > 0) |
| 635 | 635 | );"); |
| 636 | 636 | } |
| 637 | - if(!isset($update_tables['users']['immortal'])) { |
|
| 637 | + if (!isset($update_tables['users']['immortal'])) { |
|
| 638 | 638 | upd_alter_table('users', "ADD COLUMN `immortal` TIMESTAMP NULL", !isset($update_tables['users']['immortal'])); |
| 639 | 639 | upd_do_query("UPDATE {{users}} SET `immortal` = NOW() WHERE `metamatter_total` > 0;"); |
| 640 | 640 | } |
| 641 | - if(isset($update_tables['player_award'])) { |
|
| 641 | + if (isset($update_tables['player_award'])) { |
|
| 642 | 642 | upd_do_query( |
| 643 | 643 | "UPDATE {{users}} AS u JOIN {{player_award}} AS pa ON u.id = pa.player_id |
| 644 | 644 | SET metamatter_total = 1, immortal = NOW() |
@@ -665,7 +665,7 @@ discard block |
||
| 665 | 665 | CONSTRAINT `FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `{{users}}` (`id`) ON DELETE CASCADE ON UPDATE CASCADE |
| 666 | 666 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"); |
| 667 | 667 | |
| 668 | - if(empty($update_tables['blitz_statpoints'])) { |
|
| 668 | + if (empty($update_tables['blitz_statpoints'])) { |
|
| 669 | 669 | upd_create_table('blitz_statpoints', " ( |
| 670 | 670 | `stat_date` int(11) NOT NULL DEFAULT '0', |
| 671 | 671 | `id_owner` bigint(20) unsigned DEFAULT NULL, |
@@ -733,7 +733,7 @@ discard block |
||
| 733 | 733 | CONSTRAINT `FK_survey_votes_survey_parent_id` FOREIGN KEY (`survey_parent_id`) REFERENCES `{{survey}}` (`survey_id`) ON DELETE CASCADE ON UPDATE CASCADE |
| 734 | 734 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;"); |
| 735 | 735 | |
| 736 | - if(empty($update_tables['security_url'])) { |
|
| 736 | + if (empty($update_tables['security_url'])) { |
|
| 737 | 737 | upd_create_table('security_url', " ( |
| 738 | 738 | `url_id` int unsigned NOT NULL AUTO_INCREMENT, |
| 739 | 739 | `url_string` VARCHAR(250) NOT NULL DEFAULT '', |
@@ -746,17 +746,17 @@ discard block |
||
| 746 | 746 | |
| 747 | 747 | $strings = array(); |
| 748 | 748 | $query = doquery($query); |
| 749 | - while($row = db_fetch($query)) { |
|
| 750 | - $strings[] = '("' . db_escape($row['url']) . '")'; |
|
| 751 | - if(count($strings) > 100) { |
|
| 752 | - doquery($query_string . implode(',', $strings)); |
|
| 749 | + while ($row = db_fetch($query)) { |
|
| 750 | + $strings[] = '("'.db_escape($row['url']).'")'; |
|
| 751 | + if (count($strings) > 100) { |
|
| 752 | + doquery($query_string.implode(',', $strings)); |
|
| 753 | 753 | $strings = array(); |
| 754 | 754 | } |
| 755 | 755 | } |
| 756 | - !empty($strings) ? doquery($query_string . implode(',', $strings)) : false; |
|
| 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'])) // TODO REMOVE |
|
| 760 | 760 | { |
| 761 | 761 | update_security_url("SELECT DISTINCT `page` AS url FROM {{counter}}"); |
| 762 | 762 | update_security_url("SELECT DISTINCT `url` AS url FROM {{counter}}"); |
@@ -781,7 +781,7 @@ discard block |
||
| 781 | 781 | "ADD CONSTRAINT `FK_counter_page_url_id` FOREIGN KEY (`page_url_id`) REFERENCES `{{security_url}}` (`url_id`) ON DELETE CASCADE ON UPDATE CASCADE", |
| 782 | 782 | "ADD CONSTRAINT `FK_counter_plain_url_id` FOREIGN KEY (`plain_url_id`) REFERENCES `{{security_url}}` (`url_id`) ON DELETE CASCADE ON UPDATE CASCADE", |
| 783 | 783 | ), !isset($update_tables['counter']['device_id'])); |
| 784 | - if(isset($update_tables['counter']['ip'])) { |
|
| 784 | + if (isset($update_tables['counter']['ip'])) { |
|
| 785 | 785 | // upd_do_query('UPDATE `{{counter}}` SET `user_ip` = INET_ATON(`ip`), `user_proxy` = `proxy`, `visit_time` = FROM_UNIXTIME(`time`)'); |
| 786 | 786 | upd_do_query('UPDATE `{{counter}}` SET `user_ip` = INET_ATON(`ip`), `visit_time` = FROM_UNIXTIME(`time`)'); |
| 787 | 787 | 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'); |
@@ -832,7 +832,7 @@ discard block |
||
| 832 | 832 | |
| 833 | 833 | upd_check_key('stats_history_days', 14, !classSupernova::$config->stats_history_days); |
| 834 | 834 | |
| 835 | - if(classSupernova::$config->payment_currency_default != 'USD') { |
|
| 835 | + if (classSupernova::$config->payment_currency_default != 'USD') { |
|
| 836 | 836 | upd_check_key('payment_currency_default', 'USD', true); |
| 837 | 837 | upd_check_key('payment_currency_exchange_dm_', 20000, true); |
| 838 | 838 | upd_check_key('payment_currency_exchange_mm_', 20000, true); |
@@ -889,7 +889,7 @@ discard block |
||
| 889 | 889 | |
| 890 | 890 | $virtual_exploded = explode('/', SN_ROOT_VIRTUAL_PARENT); |
| 891 | 891 | // TODO - переделать всё на db_loadItem... НАВЕРНОЕ |
| 892 | - upd_check_key('server_email', 'root@' . $virtual_exploded[2], !classSupernova::$config->db_loadItem('server_email')); |
|
| 892 | + upd_check_key('server_email', 'root@'.$virtual_exploded[2], !classSupernova::$config->db_loadItem('server_email')); |
|
| 893 | 893 | |
| 894 | 894 | upd_alter_table('survey_votes', array( |
| 895 | 895 | "DROP FOREIGN KEY `FK_survey_votes_user`", |
@@ -915,12 +915,12 @@ discard block |
||
| 915 | 915 | function propagade_player_options($old_option_name, $new_option_id) { |
| 916 | 916 | global $update_tables; |
| 917 | 917 | |
| 918 | - if(!empty($update_tables['users'][$old_option_name])) { |
|
| 918 | + if (!empty($update_tables['users'][$old_option_name])) { |
|
| 919 | 919 | upd_do_query( |
| 920 | 920 | "REPLACE INTO {{player_options}} (`player_id`, `option_id`, `value`) |
| 921 | 921 | SELECT `id`, {$new_option_id}, `{$old_option_name}` |
| 922 | 922 | FROM {{users}} |
| 923 | - WHERE `user_as_ally` is null and `user_bot` = " . USER_BOT_PLAYER); |
|
| 923 | + WHERE `user_as_ally` is null and `user_bot` = ".USER_BOT_PLAYER); |
|
| 924 | 924 | // TODO - UNCOMMENT !!! |
| 925 | 925 | upd_alter_table('users', array("DROP COLUMN `{$old_option_name}`",)); |
| 926 | 926 | } |
@@ -949,7 +949,7 @@ discard block |
||
| 949 | 949 | |
| 950 | 950 | |
| 951 | 951 | // 2015-08-03 15:05:26 40a6.0 |
| 952 | - if(empty($update_tables['planets']['position_original'])) { |
|
| 952 | + if (empty($update_tables['planets']['position_original'])) { |
|
| 953 | 953 | upd_alter_table('planets', array( |
| 954 | 954 | "ADD COLUMN `position_original` smallint NOT NULL DEFAULT 0", |
| 955 | 955 | "ADD COLUMN `field_max_original` smallint NOT NULL DEFAULT 0", |
@@ -964,7 +964,7 @@ discard block |
||
| 964 | 964 | upd_do_query('UPDATE {{planets}} SET `position_original` = `planet`, `field_max_original` = `field_max`, `temp_min_original` = `temp_min`, `temp_max_original` = `temp_max`;'); |
| 965 | 965 | |
| 966 | 966 | // Миграция тяжмета в оливин |
| 967 | - upd_do_query('UPDATE {{planets}} SET `density_index` = ' . PLANET_DENSITY_METAL_PERIDOT . ' WHERE `density_index` = 7'); // deprecated define('PLANET_DENSITY_METAL_HEAVY', 7); |
|
| 967 | + upd_do_query('UPDATE {{planets}} SET `density_index` = '.PLANET_DENSITY_METAL_PERIDOT.' WHERE `density_index` = 7'); // deprecated define('PLANET_DENSITY_METAL_HEAVY', 7); |
|
| 968 | 968 | |
| 969 | 969 | // Добавляем планету-странника |
| 970 | 970 | upd_check_key('game_maxPlanet', 16, Vector::$knownPlanets == 15); |
@@ -977,12 +977,12 @@ discard block |
||
| 977 | 977 | |
| 978 | 978 | // 2015-08-27 19:14:05 40a10.0 |
| 979 | 979 | // Старая версия таблицы |
| 980 | - if(!empty($update_tables['account']['account_is_global']) || empty($update_tables['account']['account_immortal'])) { |
|
| 980 | + if (!empty($update_tables['account']['account_is_global']) || empty($update_tables['account']['account_immortal'])) { |
|
| 981 | 981 | upd_drop_table('account'); |
| 982 | 982 | upd_drop_table('account_translate'); |
| 983 | 983 | } |
| 984 | 984 | |
| 985 | - if(empty($update_tables['account'])) { |
|
| 985 | + if (empty($update_tables['account'])) { |
|
| 986 | 986 | upd_create_table('account', " ( |
| 987 | 987 | `account_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
| 988 | 988 | `account_name` varchar(32) CHARACTER SET utf8 NOT NULL DEFAULT '', |
@@ -1001,7 +1001,7 @@ discard block |
||
| 1001 | 1001 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;"); |
| 1002 | 1002 | |
| 1003 | 1003 | upd_create_table('account_translate', " ( |
| 1004 | - `provider_id` tinyint unsigned NOT NULL DEFAULT " . ACCOUNT_PROVIDER_LOCAL . " COMMENT 'Account provider', |
|
| 1004 | + `provider_id` tinyint unsigned NOT NULL DEFAULT " . ACCOUNT_PROVIDER_LOCAL." COMMENT 'Account provider', |
|
| 1005 | 1005 | `provider_account_id` bigint(20) unsigned NOT NULL COMMENT 'Account ID on provider', |
| 1006 | 1006 | `user_id` bigint(20) unsigned NOT NULL COMMENT 'User ID', |
| 1007 | 1007 | `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, |
@@ -1016,12 +1016,12 @@ discard block |
||
| 1016 | 1016 | (`account_id`, `account_name`, `account_password`, `account_salt`, `account_email`, `account_register_time`, `account_language`, `account_metamatter`, `account_metamatter_total`, `account_immortal`) |
| 1017 | 1017 | SELECT |
| 1018 | 1018 | `id`, `username`, `password`, `salt`, `email_2`, FROM_UNIXTIME(register_time), `lang`, `metamatter`, `metamatter_total`, `immortal` |
| 1019 | - FROM {{users}} WHERE `user_as_ally` IS NULL AND `user_bot` = " . USER_BOT_PLAYER . ";" |
|
| 1019 | + FROM {{users}} WHERE `user_as_ally` IS NULL AND `user_bot` = " . USER_BOT_PLAYER.";" |
|
| 1020 | 1020 | ); |
| 1021 | 1021 | |
| 1022 | 1022 | upd_do_query( |
| 1023 | 1023 | "REPLACE INTO {{account_translate}} (`provider_id`, `provider_account_id`, `user_id`, `timestamp`) |
| 1024 | - SELECT " . ACCOUNT_PROVIDER_LOCAL . ", a.account_id, u.id, a.`account_register_time` |
|
| 1024 | + SELECT " . ACCOUNT_PROVIDER_LOCAL.", a.account_id, u.id, a.`account_register_time` |
|
| 1025 | 1025 | FROM {{users}} AS u |
| 1026 | 1026 | JOIN {{account}} AS a ON |
| 1027 | 1027 | a.account_name = u.username |
@@ -1036,7 +1036,7 @@ discard block |
||
| 1036 | 1036 | |
| 1037 | 1037 | |
| 1038 | 1038 | // 2015-09-05 17:07:15 40a10.17 |
| 1039 | - 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'])); |
|
| 1039 | + 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'])); |
|
| 1040 | 1040 | |
| 1041 | 1041 | |
| 1042 | 1042 | // 2015-09-07 21:11:48 40a10.19 |
@@ -1044,18 +1044,18 @@ discard block |
||
| 1044 | 1044 | |
| 1045 | 1045 | |
| 1046 | 1046 | // 2015-09-24 11:39:37 40a10.25 |
| 1047 | - if(empty($update_tables['log_metamatter']['provider_id'])) { |
|
| 1047 | + if (empty($update_tables['log_metamatter']['provider_id'])) { |
|
| 1048 | 1048 | upd_alter_table('log_metamatter', array( |
| 1049 | - "ADD COLUMN `provider_id` tinyint unsigned NOT NULL DEFAULT " . ACCOUNT_PROVIDER_LOCAL . " COMMENT 'Account provider'", |
|
| 1049 | + "ADD COLUMN `provider_id` tinyint unsigned NOT NULL DEFAULT ".ACCOUNT_PROVIDER_LOCAL." COMMENT 'Account provider'", |
|
| 1050 | 1050 | "ADD COLUMN `account_id` bigint(20) unsigned NOT NULL DEFAULT 0", |
| 1051 | 1051 | "ADD COLUMN `account_name` varchar(32) CHARACTER SET utf8 NOT NULL DEFAULT ''", |
| 1052 | - "ADD COLUMN `server_name` varchar(128) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '" . SN_ROOT_VIRTUAL . "'", |
|
| 1052 | + "ADD COLUMN `server_name` varchar(128) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '".SN_ROOT_VIRTUAL."'", |
|
| 1053 | 1053 | ), empty($update_tables['log_metamatter']['provider_id'])); |
| 1054 | 1054 | |
| 1055 | 1055 | upd_do_query("UPDATE {{log_metamatter}} SET `account_id` = `user_id`, `account_name` = `username`"); |
| 1056 | 1056 | |
| 1057 | 1057 | upd_alter_table('payment', array( |
| 1058 | - "ADD COLUMN `payment_provider_id` tinyint unsigned NOT NULL DEFAULT " . ACCOUNT_PROVIDER_LOCAL . " COMMENT 'Payment account provider'", |
|
| 1058 | + "ADD COLUMN `payment_provider_id` tinyint unsigned NOT NULL DEFAULT ".ACCOUNT_PROVIDER_LOCAL." COMMENT 'Payment account provider'", |
|
| 1059 | 1059 | "ADD COLUMN `payment_account_id` bigint(20) unsigned NOT NULL", |
| 1060 | 1060 | "ADD COLUMN `payment_account_name` varchar(32) CHARACTER SET utf8 NOT NULL DEFAULT ''", |
| 1061 | 1061 | ), !$update_tables['payment']['payment_account_id']); |
@@ -1096,7 +1096,7 @@ discard block |
||
| 1096 | 1096 | upd_check_key('event_halloween_2015_code', '', !isset(classSupernova::$config->event_halloween_2015_code)); |
| 1097 | 1097 | upd_check_key('event_halloween_2015_timestamp', SN_TIME_SQL, !isset(classSupernova::$config->event_halloween_2015_timestamp)); |
| 1098 | 1098 | upd_check_key('event_halloween_2015_units_used', serialize(array()), !isset(classSupernova::$config->event_halloween_2015_units_used)); |
| 1099 | - if(empty($update_tables['log_halloween_2015'])) { |
|
| 1099 | + if (empty($update_tables['log_halloween_2015'])) { |
|
| 1100 | 1100 | upd_create_table('log_halloween_2015', " ( |
| 1101 | 1101 | `log_hw2015_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
| 1102 | 1102 | `player_id` bigint(20) unsigned NOT NULL COMMENT 'User ID', |
@@ -1111,7 +1111,7 @@ discard block |
||
| 1111 | 1111 | |
| 1112 | 1112 | |
| 1113 | 1113 | // 2015-11-28 06:30:27 40a19.21 |
| 1114 | - if(!isset($update_tables['ube_report']['ube_report_debris_total_in_metal'])) { |
|
| 1114 | + if (!isset($update_tables['ube_report']['ube_report_debris_total_in_metal'])) { |
|
| 1115 | 1115 | upd_alter_table('ube_report', array( |
| 1116 | 1116 | "ADD COLUMN `ube_report_debris_total_in_metal` DECIMAL(65,0) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Total debris in metal'", |
| 1117 | 1117 | "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 |
@@ -1126,7 +1126,7 @@ discard block |
||
| 1126 | 1126 | |
| 1127 | 1127 | |
| 1128 | 1128 | // 2015-12-06 15:10:58 40b1.0 |
| 1129 | - if(!empty($update_indexes['planets']['I_metal_mine'])) { |
|
| 1129 | + if (!empty($update_indexes['planets']['I_metal_mine'])) { |
|
| 1130 | 1130 | upd_alter_table('planets', "DROP KEY `I_metal`", $update_indexes['planets']['I_metal']); |
| 1131 | 1131 | upd_alter_table('planets', "DROP KEY `I_ship_sattelite_sloth`", $update_indexes['planets']['I_ship_sattelite_sloth']); |
| 1132 | 1132 | upd_alter_table('planets', "DROP KEY `I_ship_bomber_envy`", $update_indexes['planets']['I_ship_bomber_envy']); |
@@ -1189,7 +1189,7 @@ discard block |
||
| 1189 | 1189 | case 40: |
| 1190 | 1190 | upd_log_version_update(); |
| 1191 | 1191 | |
| 1192 | - if(empty($update_tables['festival'])) { |
|
| 1192 | + if (empty($update_tables['festival'])) { |
|
| 1193 | 1193 | upd_create_table('festival', " ( |
| 1194 | 1194 | `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
| 1195 | 1195 | `start` datetime NOT NULL COMMENT 'Festival start datetime', |
@@ -1230,7 +1230,7 @@ discard block |
||
| 1230 | 1230 | ); |
| 1231 | 1231 | } |
| 1232 | 1232 | |
| 1233 | - if(empty($update_tables['festival_unit'])) { |
|
| 1233 | + if (empty($update_tables['festival_unit'])) { |
|
| 1234 | 1234 | upd_create_table('festival_unit', " ( |
| 1235 | 1235 | `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
| 1236 | 1236 | `highspot_id` int(10) unsigned DEFAULT NULL, |
@@ -1247,7 +1247,7 @@ discard block |
||
| 1247 | 1247 | } |
| 1248 | 1248 | |
| 1249 | 1249 | // 2015-12-21 06:06:09 41a0.12 |
| 1250 | - if(empty($update_tables['festival_unit_log'])) { |
|
| 1250 | + if (empty($update_tables['festival_unit_log'])) { |
|
| 1251 | 1251 | upd_create_table('festival_unit_log', " ( |
| 1252 | 1252 | `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
| 1253 | 1253 | `highspot_id` int(10) unsigned DEFAULT NULL, |
@@ -1277,19 +1277,19 @@ discard block |
||
| 1277 | 1277 | $update_tables['security_browser']['browser_user_agent']['Collation'] == 'latin1_bin' |
| 1278 | 1278 | ); |
| 1279 | 1279 | |
| 1280 | - if($update_indexes_full['security_browser']['I_browser_user_agent']['browser_user_agent']['Index_type'] == 'BTREE') { |
|
| 1280 | + if ($update_indexes_full['security_browser']['I_browser_user_agent']['browser_user_agent']['Index_type'] == 'BTREE') { |
|
| 1281 | 1281 | upd_alter_table('security_browser', "DROP KEY `I_browser_user_agent`", true); |
| 1282 | 1282 | upd_alter_table('security_browser', "ADD KEY `I_browser_user_agent` (`browser_user_agent`) USING HASH", true); |
| 1283 | 1283 | } |
| 1284 | 1284 | |
| 1285 | - if(!empty($update_tables['fleets']['fleet_array'])) { |
|
| 1285 | + if (!empty($update_tables['fleets']['fleet_array'])) { |
|
| 1286 | 1286 | $query = upd_do_query("SELECT * FROM {{fleets}}"); |
| 1287 | - while($row = db_fetch($query)) { |
|
| 1287 | + while ($row = db_fetch($query)) { |
|
| 1288 | 1288 | $unit_list = sys_unit_str2arr($row['fleet_array']); |
| 1289 | - foreach($unit_list as $unit_id => $unit_count) { |
|
| 1289 | + foreach ($unit_list as $unit_id => $unit_count) { |
|
| 1290 | 1290 | upd_do_query( |
| 1291 | 1291 | "REPLACE INTO {{unit}} (`unit_player_id`,`unit_location_type`,`unit_location_id`,`unit_type`,`unit_snid`,`unit_level`) VALUES |
| 1292 | - ({$row['fleet_owner']}, " . LOC_FLEET . ", {$row['fleet_id']}, " . get_unit_param($unit_id, P_UNIT_TYPE) . ", {$unit_id}, {$unit_count});", |
|
| 1292 | + ({$row['fleet_owner']}, ".LOC_FLEET.", {$row['fleet_id']}, ".get_unit_param($unit_id, P_UNIT_TYPE).", {$unit_id}, {$unit_count});", |
|
| 1293 | 1293 | true |
| 1294 | 1294 | ); |
| 1295 | 1295 | } |
@@ -1322,11 +1322,11 @@ discard block |
||
| 1322 | 1322 | |
| 1323 | 1323 | classSupernova::$cache->unset_by_prefix('lng_'); |
| 1324 | 1324 | |
| 1325 | -if($new_version) { |
|
| 1325 | +if ($new_version) { |
|
| 1326 | 1326 | classSupernova::$config->db_saveItem('db_version', $new_version); |
| 1327 | 1327 | upd_log_message("<font color=green>DB version is now {$new_version}</font>"); |
| 1328 | 1328 | } else { |
| 1329 | - upd_log_message("DB version didn't changed from " . classSupernova::$config->db_version); |
|
| 1329 | + upd_log_message("DB version didn't changed from ".classSupernova::$config->db_version); |
|
| 1330 | 1330 | } |
| 1331 | 1331 | |
| 1332 | 1332 | classSupernova::$config->db_loadAll(); |
@@ -38,8 +38,8 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | // Game type constants starts with GAME_ |
| 40 | 40 | define('GAME_SUPERNOVA', 0); |
| 41 | -define('GAME_OGAME' , 1); |
|
| 42 | -define('GAME_BLITZ' , 2); |
|
| 41 | +define('GAME_OGAME', 1); |
|
| 42 | +define('GAME_BLITZ', 2); |
|
| 43 | 43 | |
| 44 | 44 | // Date & time range constants |
| 45 | 45 | define('DATE_FOREVER', 2000000000); |
@@ -52,27 +52,27 @@ discard block |
||
| 52 | 52 | define('PERIOD_YEAR', PERIOD_DAY * 365); |
| 53 | 53 | define('PERIOD_FOREVER', PERIOD_YEAR * 100); |
| 54 | 54 | |
| 55 | -define('PERIOD_MINUTE_2' , PERIOD_MINUTE * 2); |
|
| 56 | -define('PERIOD_MINUTE_3' , PERIOD_MINUTE * 3); |
|
| 57 | -define('PERIOD_MINUTE_5' , PERIOD_MINUTE * 5); |
|
| 55 | +define('PERIOD_MINUTE_2', PERIOD_MINUTE * 2); |
|
| 56 | +define('PERIOD_MINUTE_3', PERIOD_MINUTE * 3); |
|
| 57 | +define('PERIOD_MINUTE_5', PERIOD_MINUTE * 5); |
|
| 58 | 58 | define('PERIOD_MINUTE_10', PERIOD_MINUTE * 10); |
| 59 | -define('PERIOD_DAY_3' , PERIOD_DAY * 3); |
|
| 60 | -define('PERIOD_WEEK_2' , PERIOD_WEEK * 2); |
|
| 61 | -define('PERIOD_MONTH_2' , PERIOD_MONTH * 2); |
|
| 62 | -define('PERIOD_MONTH_3' , PERIOD_MONTH * 3); |
|
| 59 | +define('PERIOD_DAY_3', PERIOD_DAY * 3); |
|
| 60 | +define('PERIOD_WEEK_2', PERIOD_WEEK * 2); |
|
| 61 | +define('PERIOD_MONTH_2', PERIOD_MONTH * 2); |
|
| 62 | +define('PERIOD_MONTH_3', PERIOD_MONTH * 3); |
|
| 63 | 63 | |
| 64 | 64 | define('FONT_SIZE_PERCENT_MIN', 56.25); |
| 65 | 65 | define('FONT_SIZE_PERCENT_DEFAULT', 68.75); |
| 66 | 66 | define('FONT_SIZE_PERCENT_MAX', 131.25); |
| 67 | 67 | define('FONT_SIZE_PERCENT_STEP', 12.5); |
| 68 | -define('FONT_SIZE_PERCENT_DEFAULT_STRING', FONT_SIZE_PERCENT_DEFAULT . '%'); |
|
| 68 | +define('FONT_SIZE_PERCENT_DEFAULT_STRING', FONT_SIZE_PERCENT_DEFAULT.'%'); |
|
| 69 | 69 | |
| 70 | 70 | define('FONT_SIZE_PIXELS_BROWSER_BASE', 16); |
| 71 | 71 | define('FONT_SIZE_PIXELS_MIN', 9); |
| 72 | 72 | define('FONT_SIZE_PIXELS_DEFAULT', 11); |
| 73 | 73 | define('FONT_SIZE_PIXELS_MAX', 21); |
| 74 | 74 | define('FONT_SIZE_PIXELS_STEP', 1); |
| 75 | -define('FONT_SIZE_PIXELS_DEFAULT_STRING', FONT_SIZE_PIXELS_DEFAULT . 'px'); |
|
| 75 | +define('FONT_SIZE_PIXELS_DEFAULT_STRING', FONT_SIZE_PIXELS_DEFAULT.'px'); |
|
| 76 | 76 | |
| 77 | 77 | define('DEFAULT_PICTURE_EXTENSION_DOTTED', '.jpg'); |
| 78 | 78 | |
@@ -115,100 +115,100 @@ discard block |
||
| 115 | 115 | define('SN_SYS_SEC_CHARS_ALLOWED', 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghkmnpqrstuvwxyz0123456789'); |
| 116 | 116 | |
| 117 | 117 | // Mot qui sont interdit a la saisie ! |
| 118 | -$ListCensure = array ( '/</', '/>/', '/script/i', '/doquery/i', '/http/i', '/javascript/i'); |
|
| 118 | +$ListCensure = array('/</', '/>/', '/script/i', '/doquery/i', '/http/i', '/javascript/i'); |
|
| 119 | 119 | |
| 120 | 120 | // Confirmation record types |
| 121 | -define('CONFIRM_REGISTRATION' , 1); |
|
| 121 | +define('CONFIRM_REGISTRATION', 1); |
|
| 122 | 122 | define('CONFIRM_PASSWORD_RESET', 2); |
| 123 | -define('CONFIRM_DELETE' , 3); |
|
| 123 | +define('CONFIRM_DELETE', 3); |
|
| 124 | 124 | |
| 125 | 125 | define('AFFILIATE_MM_TO_REFERRAL_DM', 2); |
| 126 | 126 | |
| 127 | 127 | // Ally diplomacy statuses |
| 128 | -define('ALLY_DIPLOMACY_SELF' , 'self'); |
|
| 129 | -define('ALLY_DIPLOMACY_NEUTRAL' , 'neutral'); |
|
| 130 | -define('ALLY_DIPLOMACY_WAR' , 'war'); |
|
| 131 | -define('ALLY_DIPLOMACY_PEACE' , 'peace'); |
|
| 128 | +define('ALLY_DIPLOMACY_SELF', 'self'); |
|
| 129 | +define('ALLY_DIPLOMACY_NEUTRAL', 'neutral'); |
|
| 130 | +define('ALLY_DIPLOMACY_WAR', 'war'); |
|
| 131 | +define('ALLY_DIPLOMACY_PEACE', 'peace'); |
|
| 132 | 132 | define('ALLY_DIPLOMACY_CONFEDERATION', 'confederation'); |
| 133 | -define('ALLY_DIPLOMACY_FEDERATION' , 'federation'); |
|
| 134 | -define('ALLY_DIPLOMACY_UNION' , 'union'); |
|
| 135 | -define('ALLY_DIPLOMACY_MASTER' , 'master'); |
|
| 136 | -define('ALLY_DIPLOMACY_SLAVE' , 'slave'); |
|
| 133 | +define('ALLY_DIPLOMACY_FEDERATION', 'federation'); |
|
| 134 | +define('ALLY_DIPLOMACY_UNION', 'union'); |
|
| 135 | +define('ALLY_DIPLOMACY_MASTER', 'master'); |
|
| 136 | +define('ALLY_DIPLOMACY_SLAVE', 'slave'); |
|
| 137 | 137 | |
| 138 | 138 | define('ALLY_PROPOSE_SEND', 0); |
| 139 | 139 | |
| 140 | 140 | // Quest types |
| 141 | -define('QUEST_TYPE_BUILD' , 1); |
|
| 141 | +define('QUEST_TYPE_BUILD', 1); |
|
| 142 | 142 | define('QUEST_TYPE_RESEARCH', 2); |
| 143 | -define('QUEST_TYPE_COMBAT' , 3); |
|
| 143 | +define('QUEST_TYPE_COMBAT', 3); |
|
| 144 | 144 | |
| 145 | -define('QUEST_STATUS_NOT_STARTED' , 0); |
|
| 146 | -define('QUEST_STATUS_STARTED' , 1); |
|
| 147 | -define('QUEST_STATUS_COMPLETE' , 2); |
|
| 145 | +define('QUEST_STATUS_NOT_STARTED', 0); |
|
| 146 | +define('QUEST_STATUS_STARTED', 1); |
|
| 147 | +define('QUEST_STATUS_COMPLETE', 2); |
|
| 148 | 148 | |
| 149 | 149 | // *** Combat-related constants |
| 150 | 150 | // *** Mission Type constants starts with MT_ |
| 151 | -define('MT_NONE' , 0); |
|
| 152 | -define('MT_ATTACK' , 1); |
|
| 153 | -define('MT_ACS' , 2); |
|
| 154 | -define('MT_TRANSPORT', 3); |
|
| 155 | -define('MT_RELOCATE' , 4); |
|
| 156 | -define('MT_HOLD' , 5); |
|
| 157 | -define('MT_SPY' , 6); |
|
| 158 | -define('MT_COLONIZE' , 7); |
|
| 159 | -define('MT_RECYCLE' , 8); |
|
| 160 | -define('MT_DESTROY' , 9); |
|
| 161 | -define('MT_MISSILE' , 10); |
|
| 162 | -define('MT_EXPLORE' , 15); |
|
| 151 | +define('MT_NONE', 0); |
|
| 152 | +define('MT_ATTACK', 1); |
|
| 153 | +define('MT_ACS', 2); |
|
| 154 | +define('MT_TRANSPORT', 3); |
|
| 155 | +define('MT_RELOCATE', 4); |
|
| 156 | +define('MT_HOLD', 5); |
|
| 157 | +define('MT_SPY', 6); |
|
| 158 | +define('MT_COLONIZE', 7); |
|
| 159 | +define('MT_RECYCLE', 8); |
|
| 160 | +define('MT_DESTROY', 9); |
|
| 161 | +define('MT_MISSILE', 10); |
|
| 162 | +define('MT_EXPLORE', 15); |
|
| 163 | 163 | |
| 164 | 164 | // *** Planet Target constants starts with PT_ |
| 165 | 165 | define('PT_NONE', 0); |
| 166 | 166 | define('PT_ALL', 0); |
| 167 | 167 | define('PT_PLANET', 1); |
| 168 | 168 | define('PT_DEBRIS', 2); |
| 169 | -define('PT_MOON' , 3); |
|
| 169 | +define('PT_MOON', 3); |
|
| 170 | 170 | |
| 171 | 171 | // *** Unit locations - shows db table where unit belong |
| 172 | 172 | // Also cache indexes |
| 173 | -define('LOC_NONE', -1); |
|
| 173 | +define('LOC_NONE', -1); |
|
| 174 | 174 | define('LOC_UNIVERSE', 0); |
| 175 | -define('LOC_PLANET', 1); |
|
| 176 | -define('LOC_DEBRIS', 2); // Translates to `planets` table planet_type = 1, `debris_*` fields |
|
| 177 | -define('LOC_MOON', 3); // Translates to `planets` table planet_type = 3 |
|
| 178 | -define('LOC_USER', 4); |
|
| 179 | -define('LOC_FLEET', 5); |
|
| 180 | -define('LOC_ALLY', 6); |
|
| 181 | -define('LOC_UNIT_NUMERIC', 7); |
|
| 182 | -define('LOC_UNIT_LIST', 8); |
|
| 175 | +define('LOC_PLANET', 1); |
|
| 176 | +define('LOC_DEBRIS', 2); // Translates to `planets` table planet_type = 1, `debris_*` fields |
|
| 177 | +define('LOC_MOON', 3); // Translates to `planets` table planet_type = 3 |
|
| 178 | +define('LOC_USER', 4); |
|
| 179 | +define('LOC_FLEET', 5); |
|
| 180 | +define('LOC_ALLY', 6); |
|
| 181 | +define('LOC_UNIT_NUMERIC', 7); |
|
| 182 | +define('LOC_UNIT_LIST', 8); |
|
| 183 | 183 | |
| 184 | 184 | // ТОЛЬКО ВНУТРЕНЕЕ!!! |
| 185 | -define('LOC_UNIT', 'LOC_UNIT'); |
|
| 186 | -define('LOC_QUE', 'LOC_QUE'); |
|
| 187 | -define('LOC_LOCATION','LOC_LOCATION'); |
|
| 188 | -define('LOC_LOCKS','LOC_LOCKS'); |
|
| 185 | +define('LOC_UNIT', 'LOC_UNIT'); |
|
| 186 | +define('LOC_QUE', 'LOC_QUE'); |
|
| 187 | +define('LOC_LOCATION', 'LOC_LOCATION'); |
|
| 188 | +define('LOC_LOCKS', 'LOC_LOCKS'); |
|
| 189 | 189 | |
| 190 | 190 | // *** Caching masks |
| 191 | -define('CACHE_NOTHING' , 0); |
|
| 192 | -define('CACHE_FLEET' , 1); |
|
| 193 | -define('CACHE_PLANET' , 2); |
|
| 194 | -define('CACHE_USER' , 4); |
|
| 195 | -define('CACHE_SOURCE' , 8); |
|
| 191 | +define('CACHE_NOTHING', 0); |
|
| 192 | +define('CACHE_FLEET', 1); |
|
| 193 | +define('CACHE_PLANET', 2); |
|
| 194 | +define('CACHE_USER', 4); |
|
| 195 | +define('CACHE_SOURCE', 8); |
|
| 196 | 196 | define('CACHE_DESTINATION', 16); |
| 197 | -define('CACHE_EVENT' , 32); |
|
| 197 | +define('CACHE_EVENT', 32); |
|
| 198 | 198 | |
| 199 | -define('CACHE_USER_SRC' , CACHE_USER | CACHE_SOURCE); |
|
| 200 | -define('CACHE_USER_DST' , CACHE_USER | CACHE_DESTINATION); |
|
| 199 | +define('CACHE_USER_SRC', CACHE_USER | CACHE_SOURCE); |
|
| 200 | +define('CACHE_USER_DST', CACHE_USER | CACHE_DESTINATION); |
|
| 201 | 201 | define('CACHE_PLANET_SRC', CACHE_PLANET | CACHE_SOURCE); |
| 202 | 202 | define('CACHE_PLANET_DST', CACHE_PLANET | CACHE_DESTINATION); |
| 203 | -define('CACHE_COMBAT' , CACHE_FLEET | CACHE_PLANET | CACHE_USER | CACHE_SOURCE | CACHE_DESTINATION); |
|
| 203 | +define('CACHE_COMBAT', CACHE_FLEET | CACHE_PLANET | CACHE_USER | CACHE_SOURCE | CACHE_DESTINATION); |
|
| 204 | 204 | |
| 205 | -define('CACHE_ALL' , CACHE_FLEET | CACHE_PLANET | CACHE_USER | CACHE_SOURCE | CACHE_DESTINATION | CACHE_EVENT); |
|
| 205 | +define('CACHE_ALL', CACHE_FLEET | CACHE_PLANET | CACHE_USER | CACHE_SOURCE | CACHE_DESTINATION | CACHE_EVENT); |
|
| 206 | 206 | |
| 207 | -define('CACHE_NONE' , CACHE_NOTHING); // Alias for me |
|
| 207 | +define('CACHE_NONE', CACHE_NOTHING); // Alias for me |
|
| 208 | 208 | |
| 209 | 209 | // *** Event types |
| 210 | 210 | define('EVENT_FLEET_ARRIVE', 1); |
| 211 | -define('EVENT_FLEET_STAY' , 2); |
|
| 211 | +define('EVENT_FLEET_STAY', 2); |
|
| 212 | 212 | define('EVENT_FLEET_RETURN', 3); |
| 213 | 213 | |
| 214 | 214 | // *** Constants for changing DM |
@@ -261,10 +261,10 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | |
| 263 | 263 | // Operation error status HARDCODE! |
| 264 | -define('ERR_NONE' , 0); // No error |
|
| 265 | -define('ERR_WARNING' , 1); // There is warning - something altering normal operation process |
|
| 266 | -define('ERR_ERROR' , 2); // There is error - something permits operation from process |
|
| 267 | -define('ERR_HACK' , 4); // Operation is qualified as hack attempt |
|
| 264 | +define('ERR_NONE', 0); // No error |
|
| 265 | +define('ERR_WARNING', 1); // There is warning - something altering normal operation process |
|
| 266 | +define('ERR_ERROR', 2); // There is error - something permits operation from process |
|
| 267 | +define('ERR_HACK', 4); // Operation is qualified as hack attempt |
|
| 268 | 268 | // New GLOBAL operation results |
| 269 | 269 | //define('RESULT_DEFAULT' , 0); // Default result - all went OK or result really doesn't matter |
| 270 | 270 | //define('RESULT_WARNING' , 1); |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | define('SN_PAYMENT_REQUEST_OK', 0); |
| 285 | 285 | define('SN_PAYMENT_REQUEST_ERROR_UNIT_AMOUNT', 1); |
| 286 | 286 | define('SN_PAYMENT_REQUEST_ERROR_PAYLINK_UNSUPPORTED', 2); |
| 287 | -define('SN_PAYMENT_REQUEST_IP_WRONG', 3); // Неправильный IP входящей системы - обычно хак |
|
| 287 | +define('SN_PAYMENT_REQUEST_IP_WRONG', 3); // Неправильный IP входящей системы - обычно хак |
|
| 288 | 288 | define('SN_PAYMENT_REQUEST_COMMAND_UNSUPPORTED', 4); // Неподдерживаемая команда - обычно хак |
| 289 | 289 | define('SN_PAYMENT_REQUEST_SIGNATURE_INVALID', 5); // Неправильная подпись или не сошлась контрольная сумма - обычно хак |
| 290 | 290 | define('SN_MODULE_DISABLED', 6); // Модуль отключен // УНИВЕРСАЛЬНЫЙ ОТВЕТ! |
@@ -557,16 +557,16 @@ discard block |
||
| 557 | 557 | //define('F_DEVICE_ID', 'F_DEVICE_ID'); |
| 558 | 558 | //define('F_DEVICE_CYPHER', 'F_DEVICE_CYPHER'); |
| 559 | 559 | |
| 560 | -define('F_PROVIDER_ID', 'F_PROVIDER_ID'); |
|
| 560 | +define('F_PROVIDER_ID', 'F_PROVIDER_ID'); |
|
| 561 | 561 | // define('F_PROVIDER_LIST', 'F_PROVIDER_LIST'); |
| 562 | 562 | |
| 563 | 563 | define('F_IMPERSONATE_STATUS', 'F_IMPERSONATE_STATUS'); |
| 564 | 564 | define('F_IMPERSONATE_OPERATOR', 'F_IMPERSONATE_OPERATOR'); |
| 565 | 565 | |
| 566 | -define('F_LOGIN_STATUS', 'F_LOGIN_STATUS'); |
|
| 566 | +define('F_LOGIN_STATUS', 'F_LOGIN_STATUS'); |
|
| 567 | 567 | define('F_LOGIN_MESSAGE', 'F_LOGIN_MESSAGE'); |
| 568 | 568 | |
| 569 | -define('F_PLAYER_REGISTER_STATUS', 'F_PLAYER_REGISTER_STATUS'); |
|
| 569 | +define('F_PLAYER_REGISTER_STATUS', 'F_PLAYER_REGISTER_STATUS'); |
|
| 570 | 570 | define('F_PLAYER_REGISTER_MESSAGE', 'F_PLAYER_REGISTER_MESSAGE'); |
| 571 | 571 | |
| 572 | 572 | define('F_USER_ID', 'F_USER_ID'); |
@@ -610,66 +610,66 @@ discard block |
||
| 610 | 610 | |
| 611 | 611 | |
| 612 | 612 | // Option groups |
| 613 | -define('OPT_ALL', 0); |
|
| 614 | -define('OPT_MESSAGE', 1); |
|
| 613 | +define('OPT_ALL', 0); |
|
| 614 | +define('OPT_MESSAGE', 1); |
|
| 615 | 615 | define('OPT_UNIVERSE', 2); |
| 616 | 616 | define('OPT_INTERFACE', 3); |
| 617 | 617 | |
| 618 | 618 | // Message classes |
| 619 | -define('MSG_TYPE_OUTBOX' , -1); |
|
| 620 | -define('MSG_TYPE_SPY' , 0); |
|
| 621 | -define('MSG_TYPE_PLAYER' , 1); |
|
| 622 | -define('MSG_TYPE_ALLIANCE' , 2); |
|
| 623 | -define('MSG_TYPE_COMBAT' , 3); |
|
| 624 | -define('MSG_TYPE_RECYCLE' , 4); |
|
| 625 | -define('MSG_TYPE_TRANSPORT', 5); |
|
| 626 | -define('MSG_TYPE_ADMIN' , 6); |
|
| 627 | -define('MSG_TYPE_EXPLORE' , 15); |
|
| 628 | -define('MSG_TYPE_QUE' , 99); |
|
| 629 | -define('MSG_TYPE_NEW' , 100); |
|
| 619 | +define('MSG_TYPE_OUTBOX', -1); |
|
| 620 | +define('MSG_TYPE_SPY', 0); |
|
| 621 | +define('MSG_TYPE_PLAYER', 1); |
|
| 622 | +define('MSG_TYPE_ALLIANCE', 2); |
|
| 623 | +define('MSG_TYPE_COMBAT', 3); |
|
| 624 | +define('MSG_TYPE_RECYCLE', 4); |
|
| 625 | +define('MSG_TYPE_TRANSPORT', 5); |
|
| 626 | +define('MSG_TYPE_ADMIN', 6); |
|
| 627 | +define('MSG_TYPE_EXPLORE', 15); |
|
| 628 | +define('MSG_TYPE_QUE', 99); |
|
| 629 | +define('MSG_TYPE_NEW', 100); |
|
| 630 | 630 | |
| 631 | 631 | // Attack verification statuses |
| 632 | -define('FLIGHT_ALLOWED' , 0); |
|
| 633 | -define('FLIGHT_VECTOR_NO_TARGET' , 1); |
|
| 634 | -define('FLIGHT_PLAYER_OWN' , 2); |
|
| 635 | -define('FLIGHT_MISSION_IMPOSSIBLE' , 3); |
|
| 636 | -define('FLIGHT_MISSION_HOLD_NO_ALLY_DEPOSIT' , 4); |
|
| 637 | -define('FLIGHT_MISSION_RECYCLE_NO_DEBRIS' , 5); |
|
| 638 | -define('FLIGHT_PLAYER_VACATION' , 6); |
|
| 639 | -define('FLIGHT_PLAYER_SAME_IP' , 7); |
|
| 640 | -define('FLIGHT_PLAYER_BUFFING' , 8); |
|
| 641 | -define('FLIGHT_PLAYER_ADMIN' , 9); |
|
| 642 | -define('FLIGHT_PLAYER_NOOB' , 10); |
|
| 643 | -define('FLIGHT_PLAYER_VACATION_OWN' , 11); |
|
| 644 | -define('FLIGHT_MISSION_MISSILE_NO_SILO' , 12); |
|
| 645 | -define('FLIGHT_MISSION_MISSILE_NO_MISSILES' , 13); |
|
| 646 | -define('FLIGHT_SHIPS_NO_SHIPS' , 14); |
|
| 647 | -define('FLIGHT_FLEET_NO_SLOTS' , 15); |
|
| 648 | -define('FLIGHT_SHIPS_NOT_ENOUGH_OR_RESOURCES' , 16); |
|
| 649 | -define('FLIGHT_SHIPS_NO_RECYCLERS' , 17); |
|
| 650 | -define('FLIGHT_MISSION_SPY_NO_SPIES' , 18); |
|
| 651 | -define('FLIGHT_SHIPS_NO_COLONIZER' , 19); |
|
| 652 | -define('FLIGHT_MISSION_MISSILE_TOO_FAR' , 20); |
|
| 653 | -define('FLIGHT_MISSION_MISSILE_WRONG_STRUCTURE' , 21); |
|
| 654 | -define('FLIGHT_RESOURCES_FUEL_NOT_ENOUGH' , 22); |
|
| 655 | -define('FLIGHT_RESOURCES_NOT_ENOUGH' , 23); |
|
| 656 | -define('FLIGHT_MISSION_ACS_NOT_EXISTS' , 24); |
|
| 657 | -define('FLIGHT_MISSION_ACS_MISSTARGET' , 25); |
|
| 658 | -define('FLIGHT_FLEET_SPEED_WRONG' , 26); |
|
| 659 | -define('FLIGHT_MISSION_ACS_TOO_LATE' , 27); |
|
| 660 | -define('FLIGHT_MISSION_ATTACK_BASHING' , 28); |
|
| 661 | -define('FLIGHT_MISSION_ATTACK_BASHING_WAR_DELAY' , 29); |
|
| 662 | -define('FLIGHT_MISSION_ACS_WRONG_TARGET' , 30); |
|
| 663 | -define('FLIGHT_VECTOR_SAME_SOURCE' , 31); |
|
| 632 | +define('FLIGHT_ALLOWED', 0); |
|
| 633 | +define('FLIGHT_VECTOR_NO_TARGET', 1); |
|
| 634 | +define('FLIGHT_PLAYER_OWN', 2); |
|
| 635 | +define('FLIGHT_MISSION_IMPOSSIBLE', 3); |
|
| 636 | +define('FLIGHT_MISSION_HOLD_NO_ALLY_DEPOSIT', 4); |
|
| 637 | +define('FLIGHT_MISSION_RECYCLE_NO_DEBRIS', 5); |
|
| 638 | +define('FLIGHT_PLAYER_VACATION', 6); |
|
| 639 | +define('FLIGHT_PLAYER_SAME_IP', 7); |
|
| 640 | +define('FLIGHT_PLAYER_BUFFING', 8); |
|
| 641 | +define('FLIGHT_PLAYER_ADMIN', 9); |
|
| 642 | +define('FLIGHT_PLAYER_NOOB', 10); |
|
| 643 | +define('FLIGHT_PLAYER_VACATION_OWN', 11); |
|
| 644 | +define('FLIGHT_MISSION_MISSILE_NO_SILO', 12); |
|
| 645 | +define('FLIGHT_MISSION_MISSILE_NO_MISSILES', 13); |
|
| 646 | +define('FLIGHT_SHIPS_NO_SHIPS', 14); |
|
| 647 | +define('FLIGHT_FLEET_NO_SLOTS', 15); |
|
| 648 | +define('FLIGHT_SHIPS_NOT_ENOUGH_OR_RESOURCES', 16); |
|
| 649 | +define('FLIGHT_SHIPS_NO_RECYCLERS', 17); |
|
| 650 | +define('FLIGHT_MISSION_SPY_NO_SPIES', 18); |
|
| 651 | +define('FLIGHT_SHIPS_NO_COLONIZER', 19); |
|
| 652 | +define('FLIGHT_MISSION_MISSILE_TOO_FAR', 20); |
|
| 653 | +define('FLIGHT_MISSION_MISSILE_WRONG_STRUCTURE', 21); |
|
| 654 | +define('FLIGHT_RESOURCES_FUEL_NOT_ENOUGH', 22); |
|
| 655 | +define('FLIGHT_RESOURCES_NOT_ENOUGH', 23); |
|
| 656 | +define('FLIGHT_MISSION_ACS_NOT_EXISTS', 24); |
|
| 657 | +define('FLIGHT_MISSION_ACS_MISSTARGET', 25); |
|
| 658 | +define('FLIGHT_FLEET_SPEED_WRONG', 26); |
|
| 659 | +define('FLIGHT_MISSION_ACS_TOO_LATE', 27); |
|
| 660 | +define('FLIGHT_MISSION_ATTACK_BASHING', 28); |
|
| 661 | +define('FLIGHT_MISSION_ATTACK_BASHING_WAR_DELAY', 29); |
|
| 662 | +define('FLIGHT_MISSION_ACS_WRONG_TARGET', 30); |
|
| 663 | +define('FLIGHT_VECTOR_SAME_SOURCE', 31); |
|
| 664 | 664 | define('FLIGHT_RESOURCES_FORBIDDEN', 32); |
| 665 | -define('FLIGHT_RESOURCES_EMPTY' , 33); |
|
| 666 | -define('FLIGHT_SHIPS_NOT_ONLY_SPIES' , 34); |
|
| 667 | -define('FLIGHT_FLEET_TOO_FAR' , 35); |
|
| 668 | -define('FLIGHT_FLEET_OVERLOAD' , 36); |
|
| 669 | -define('FLIGHT_MISSION_UNKNOWN' , 37); |
|
| 670 | -define('FLIGHT_SHIPS_UNIT_WRONG' , 38); |
|
| 671 | -define('FLIGHT_SHIPS_UNMOVABLE' , 39); |
|
| 672 | -define('FLIGHT_SHIPS_NEGATIVE' , 40); |
|
| 665 | +define('FLIGHT_RESOURCES_EMPTY', 33); |
|
| 666 | +define('FLIGHT_SHIPS_NOT_ONLY_SPIES', 34); |
|
| 667 | +define('FLIGHT_FLEET_TOO_FAR', 35); |
|
| 668 | +define('FLIGHT_FLEET_OVERLOAD', 36); |
|
| 669 | +define('FLIGHT_MISSION_UNKNOWN', 37); |
|
| 670 | +define('FLIGHT_SHIPS_UNIT_WRONG', 38); |
|
| 671 | +define('FLIGHT_SHIPS_UNMOVABLE', 39); |
|
| 672 | +define('FLIGHT_SHIPS_NEGATIVE', 40); |
|
| 673 | 673 | define('FLIGHT_RESOURCES_NEGATIVE', 41); |
| 674 | 674 | define('FLIGHT_MISSION_MORATORIUM', 42); |
| 675 | 675 | define('FLIGHT_PLAYER_CHILD_PROTECTION', 43); |
@@ -697,12 +697,12 @@ discard block |
||
| 697 | 697 | |
| 698 | 698 | |
| 699 | 699 | // *** Races - Homeworlds |
| 700 | -define('RACE_NONE' , 0); |
|
| 701 | -define('RACE_EARTH' , 1); |
|
| 702 | -define('RACE_MOON' , 2); |
|
| 703 | -define('RACE_MERCURY' , 3); |
|
| 704 | -define('RACE_VENUS' , 4); |
|
| 705 | -define('RACE_MARS' , 5); |
|
| 700 | +define('RACE_NONE', 0); |
|
| 701 | +define('RACE_EARTH', 1); |
|
| 702 | +define('RACE_MOON', 2); |
|
| 703 | +define('RACE_MERCURY', 3); |
|
| 704 | +define('RACE_VENUS', 4); |
|
| 705 | +define('RACE_MARS', 5); |
|
| 706 | 706 | define('RACE_ASTEROID', 6); |
| 707 | 707 | // define('MARKET_INFO' , 7); |
| 708 | 708 | |
@@ -710,114 +710,114 @@ discard block |
||
| 710 | 710 | |
| 711 | 711 | // *** Market variables |
| 712 | 712 | // === Market blocks |
| 713 | -define('MARKET_ENTRY' , 0); |
|
| 714 | -define('MARKET_RESOURCES' , 1); |
|
| 715 | -define('MARKET_SCRAPPER' , 2); |
|
| 716 | -define('MARKET_STOCKMAN' , 3); |
|
| 717 | -define('MARKET_EXCHANGE' , 4); |
|
| 718 | -define('MARKET_BANKER' , 5); |
|
| 719 | -define('MARKET_PAWNSHOP' , 6); |
|
| 720 | -define('MARKET_INFO' , 7); |
|
| 713 | +define('MARKET_ENTRY', 0); |
|
| 714 | +define('MARKET_RESOURCES', 1); |
|
| 715 | +define('MARKET_SCRAPPER', 2); |
|
| 716 | +define('MARKET_STOCKMAN', 3); |
|
| 717 | +define('MARKET_EXCHANGE', 4); |
|
| 718 | +define('MARKET_BANKER', 5); |
|
| 719 | +define('MARKET_PAWNSHOP', 6); |
|
| 720 | +define('MARKET_INFO', 7); |
|
| 721 | 721 | |
| 722 | 722 | // === Market error statuses |
| 723 | -define('MARKET_NOTHING' , 0); |
|
| 724 | -define('MARKET_DEAL' , 1); |
|
| 725 | -define('MARKET_DEAL_TRADE' , 2); |
|
| 726 | -define('MARKET_NO_DM' , 3); |
|
| 727 | -define('MARKET_NO_RESOURCES' , 4); |
|
| 728 | -define('MARKET_ZERO_DEAL' , 5); |
|
| 729 | -define('MARKET_NO_SHIPS' , 6); |
|
| 730 | -define('MARKET_NOT_A_SHIP' , 7); |
|
| 731 | -define('MARKET_NO_STOCK' , 8); |
|
| 732 | -define('MARKET_ZERO_RES_STOCK' , 9); |
|
| 733 | -define('MARKET_NEGATIVE_SHIPS' , 10); |
|
| 734 | - |
|
| 735 | -define('MARKET_INFO_PLAYER' , 12); |
|
| 736 | -define('MARKET_INFO_WRONG' , 11); |
|
| 723 | +define('MARKET_NOTHING', 0); |
|
| 724 | +define('MARKET_DEAL', 1); |
|
| 725 | +define('MARKET_DEAL_TRADE', 2); |
|
| 726 | +define('MARKET_NO_DM', 3); |
|
| 727 | +define('MARKET_NO_RESOURCES', 4); |
|
| 728 | +define('MARKET_ZERO_DEAL', 5); |
|
| 729 | +define('MARKET_NO_SHIPS', 6); |
|
| 730 | +define('MARKET_NOT_A_SHIP', 7); |
|
| 731 | +define('MARKET_NO_STOCK', 8); |
|
| 732 | +define('MARKET_ZERO_RES_STOCK', 9); |
|
| 733 | +define('MARKET_NEGATIVE_SHIPS', 10); |
|
| 734 | + |
|
| 735 | +define('MARKET_INFO_PLAYER', 12); |
|
| 736 | +define('MARKET_INFO_WRONG', 11); |
|
| 737 | 737 | define('MARKET_INFO_PLAYER_NOT_FOUND', 13); |
| 738 | -define('MARKET_INFO_PLAYER_WRONG' , 14); |
|
| 739 | -define('MARKET_INFO_PLAYER_SAME' , 15); |
|
| 738 | +define('MARKET_INFO_PLAYER_WRONG', 14); |
|
| 739 | +define('MARKET_INFO_PLAYER_SAME', 15); |
|
| 740 | 740 | |
| 741 | 741 | |
| 742 | 742 | |
| 743 | 743 | |
| 744 | 744 | // *** Mercenary/talent bonus types |
| 745 | -define('BONUS_NONE' , 0); // No bonus |
|
| 746 | -define('BONUS_PERCENT' , 1); // Percent on base value |
|
| 747 | -define('BONUS_ADD' , 2); // Add |
|
| 748 | -define('BONUS_ABILITY' , 3); // Some ability |
|
| 749 | -define('BONUS_MULTIPLY', 4); // Multiply by value |
|
| 750 | -define('BONUS_PERCENT_CUMULATIVE' , 5); // Cumulative percent on base value |
|
| 751 | -define('BONUS_PERCENT_DEGRADED' , 6); // Bonus amount degraded with increase as pow(bonus, level) (?) |
|
| 752 | -define('BONUS_SPEED', 7); // Speed bonus |
|
| 745 | +define('BONUS_NONE', 0); // No bonus |
|
| 746 | +define('BONUS_PERCENT', 1); // Percent on base value |
|
| 747 | +define('BONUS_ADD', 2); // Add |
|
| 748 | +define('BONUS_ABILITY', 3); // Some ability |
|
| 749 | +define('BONUS_MULTIPLY', 4); // Multiply by value |
|
| 750 | +define('BONUS_PERCENT_CUMULATIVE', 5); // Cumulative percent on base value |
|
| 751 | +define('BONUS_PERCENT_DEGRADED', 6); // Bonus amount degraded with increase as pow(bonus, level) (?) |
|
| 752 | +define('BONUS_SPEED', 7); // Speed bonus |
|
| 753 | 753 | |
| 754 | 754 | // *** Action constant (build should be replaced with ACTION) |
| 755 | -define('BUILD_CREATE' , 1); |
|
| 755 | +define('BUILD_CREATE', 1); |
|
| 756 | 756 | define('BUILD_DESTROY', -1); |
| 757 | 757 | define('BUILD_AUTOCONVERT', 2); |
| 758 | 758 | |
| 759 | -define('ACTION_SELL' , -1); |
|
| 760 | -define('ACTION_NOTHING' , 0); |
|
| 761 | -define('ACTION_BUY' , 1); |
|
| 762 | -define('ACTION_USE' , 2); |
|
| 763 | -define('ACTION_DELETE' , 3); |
|
| 759 | +define('ACTION_SELL', -1); |
|
| 760 | +define('ACTION_NOTHING', 0); |
|
| 761 | +define('ACTION_BUY', 1); |
|
| 762 | +define('ACTION_USE', 2); |
|
| 763 | +define('ACTION_DELETE', 3); |
|
| 764 | 764 | |
| 765 | 765 | // *** Check unit availability codes |
| 766 | -define('BUILD_ALLOWED' , 0); // HARDCODED! DO NOT CHANGE! |
|
| 766 | +define('BUILD_ALLOWED', 0); // HARDCODED! DO NOT CHANGE! |
|
| 767 | 767 | define('BUILD_REQUIRE_NOT_MEET', 1); |
| 768 | -define('BUILD_AMOUNT_WRONG' , 2); |
|
| 769 | -define('BUILD_QUE_WRONG' , 3); |
|
| 770 | -define('BUILD_QUE_UNIT_WRONG' , 4); |
|
| 771 | -define('BUILD_INDESTRUCTABLE' , 5); |
|
| 772 | -define('BUILD_NO_RESOURCES' , 6); |
|
| 773 | -define('BUILD_NO_UNITS' , 7); |
|
| 774 | -define('BUILD_UNIT_BUSY' , 8); |
|
| 775 | -define('BUILD_QUE_FULL' , 9); |
|
| 776 | -define('BUILD_SILO_FULL' ,10); |
|
| 777 | -define('BUILD_MAX_REACHED' ,11); |
|
| 778 | -define('BUILD_SECTORS_NONE' ,12); |
|
| 768 | +define('BUILD_AMOUNT_WRONG', 2); |
|
| 769 | +define('BUILD_QUE_WRONG', 3); |
|
| 770 | +define('BUILD_QUE_UNIT_WRONG', 4); |
|
| 771 | +define('BUILD_INDESTRUCTABLE', 5); |
|
| 772 | +define('BUILD_NO_RESOURCES', 6); |
|
| 773 | +define('BUILD_NO_UNITS', 7); |
|
| 774 | +define('BUILD_UNIT_BUSY', 8); |
|
| 775 | +define('BUILD_QUE_FULL', 9); |
|
| 776 | +define('BUILD_SILO_FULL', 10); |
|
| 777 | +define('BUILD_MAX_REACHED', 11); |
|
| 778 | +define('BUILD_SECTORS_NONE', 12); |
|
| 779 | 779 | define('BUILD_AUTOCONVERT_AVAILABLE', 13); |
| 780 | 780 | |
| 781 | 781 | |
| 782 | 782 | // *** Que types |
| 783 | 783 | define('QUE_STRUCTURES', 1); |
| 784 | -define('QUE_HANGAR' , 4); |
|
| 785 | -define('QUE_RESEARCH' , 7); |
|
| 786 | -define('QUE_MERCENARY' , 600); // UNIT_MERCENARIES |
|
| 784 | +define('QUE_HANGAR', 4); |
|
| 785 | +define('QUE_RESEARCH', 7); |
|
| 786 | +define('QUE_MERCENARY', 600); // UNIT_MERCENARIES |
|
| 787 | 787 | // *** Subque types |
| 788 | -define('SUBQUE_PLANET' , 1); |
|
| 789 | -define('SUBQUE_MOON' , 3); |
|
| 790 | -define('SUBQUE_FLEET' , 4); |
|
| 791 | -define('SUBQUE_DEFENSE' , 6); |
|
| 788 | +define('SUBQUE_PLANET', 1); |
|
| 789 | +define('SUBQUE_MOON', 3); |
|
| 790 | +define('SUBQUE_FLEET', 4); |
|
| 791 | +define('SUBQUE_DEFENSE', 6); |
|
| 792 | 792 | define('SUBQUE_RESEARCH', 7); |
| 793 | 793 | |
| 794 | 794 | // *** Que items |
| 795 | -define('QI_UNIT_ID' , 0); |
|
| 796 | -define('QI_AMOUNT' , 1); |
|
| 797 | -define('QI_TIME' , 2); |
|
| 798 | -define('QI_MODE' , 3); |
|
| 799 | -define('QI_QUE_ID' , 4); |
|
| 800 | -define('QI_QUE_TYPE' , 4); |
|
| 801 | -define('QI_PLANET_ID' , 5); |
|
| 795 | +define('QI_UNIT_ID', 0); |
|
| 796 | +define('QI_AMOUNT', 1); |
|
| 797 | +define('QI_TIME', 2); |
|
| 798 | +define('QI_MODE', 3); |
|
| 799 | +define('QI_QUE_ID', 4); |
|
| 800 | +define('QI_QUE_TYPE', 4); |
|
| 801 | +define('QI_PLANET_ID', 5); |
|
| 802 | 802 | |
| 803 | 803 | |
| 804 | 804 | // *** Units |
| 805 | 805 | |
| 806 | 806 | // *** Sort options |
| 807 | -define('SORT_ASCENDING' , 0); |
|
| 807 | +define('SORT_ASCENDING', 0); |
|
| 808 | 808 | define('SORT_DESCENDING', 1); |
| 809 | 809 | |
| 810 | -define('SORT_ID' , 0); |
|
| 811 | -define('SORT_LOCATION' , 1); |
|
| 812 | -define('SORT_NAME' , 2); |
|
| 813 | -define('SORT_SIZE' , 3); |
|
| 814 | -define('SORT_EMAIL' , 4); |
|
| 815 | -define('SORT_IP' , 5); |
|
| 810 | +define('SORT_ID', 0); |
|
| 811 | +define('SORT_LOCATION', 1); |
|
| 812 | +define('SORT_NAME', 2); |
|
| 813 | +define('SORT_SIZE', 3); |
|
| 814 | +define('SORT_EMAIL', 4); |
|
| 815 | +define('SORT_IP', 5); |
|
| 816 | 816 | define('SORT_TIME_REGISTERED', 6); |
| 817 | 817 | define('SORT_TIME_LAST_VISIT', 7); |
| 818 | -define('SORT_TIME_BAN_UNTIL' , 8); |
|
| 819 | -define('SORT_REFERRAL_COUNT' , 9); |
|
| 820 | -define('SORT_REFERRAL_DM' , 10); |
|
| 818 | +define('SORT_TIME_BAN_UNTIL', 8); |
|
| 819 | +define('SORT_REFERRAL_COUNT', 9); |
|
| 820 | +define('SORT_REFERRAL_DM', 10); |
|
| 821 | 821 | |
| 822 | 822 | |
| 823 | 823 | define('HULL_SIZE_TINY', 1); |
@@ -960,10 +960,10 @@ discard block |
||
| 960 | 960 | |
| 961 | 961 | // === Artifacts |
| 962 | 962 | define('UNIT_ARTIFACTS', 1000); |
| 963 | -define('ART_LHC', 1001); // Additional moon chance |
|
| 964 | -define('ART_RCD_SMALL', 1002); // Rapid Colony Deployment - Set of buildings up to 10th level - 10/14/ 3/0 - 405 DM |
|
| 965 | -define('ART_RCD_MEDIUM', 1003); // Rapid Colony Deployment - Set of buildings up to 15th level - 15/20/ 8/0 - 4704 DM |
|
| 966 | -define('ART_RCD_LARGE', 1004); // Rapid Colony Deployment - Set of buildings up to 20th level - 20/25/10/1 - 39790 DM |
|
| 963 | +define('ART_LHC', 1001); // Additional moon chance |
|
| 964 | +define('ART_RCD_SMALL', 1002); // Rapid Colony Deployment - Set of buildings up to 10th level - 10/14/ 3/0 - 405 DM |
|
| 965 | +define('ART_RCD_MEDIUM', 1003); // Rapid Colony Deployment - Set of buildings up to 15th level - 15/20/ 8/0 - 4704 DM |
|
| 966 | +define('ART_RCD_LARGE', 1004); // Rapid Colony Deployment - Set of buildings up to 20th level - 20/25/10/1 - 39790 DM |
|
| 967 | 967 | define('ART_HEURISTIC_CHIP', 1005); // Speed up research |
| 968 | 968 | define('ART_NANO_BUILDER', 1006); // Speed up building |
| 969 | 969 | define('ART_NANO_CONSTRUCTOR', 1007); // RESERVED Speed up hangar constructions |
@@ -1034,18 +1034,18 @@ discard block |
||
| 1034 | 1034 | define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE1', 2201); // Блиц-сервер, участник 0-го раунда, 1-е место |
| 1035 | 1035 | define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE2', 2202); // Блиц-сервер, участник 0-го раунда, 2-е место |
| 1036 | 1036 | define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE3', 2203); // Блиц-сервер, участник 0-го раунда, 3-е место |
| 1037 | -define('UNIT_AWARD_MEDAL_2016_WOMEN_DAY_BEST', 2204); // Медаль Лучшему Кавалеру за максимум потраченной ММ/максимум одаренных женщин Женщине от Мужчины во время ивента 8 марта 2016 года |
|
| 1037 | +define('UNIT_AWARD_MEDAL_2016_WOMEN_DAY_BEST', 2204); // Медаль Лучшему Кавалеру за максимум потраченной ММ/максимум одаренных женщин Женщине от Мужчины во время ивента 8 марта 2016 года |
|
| 1038 | 1038 | |
| 1039 | 1039 | define('UNIT_AWARD_MEMORY', 2300); // Памятные знаки за существование и участие - например "4 года в игре". "Был онлайн в новогоднюю ночь 2013". итд |
| 1040 | -define('UNIT_AWARD_MEMORY_IMMORTAL', 2301); // Бессмертный |
|
| 1041 | -define('UNIT_AWARD_MEMORY_2015_WOMEN_DAY', 2302); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2015 года |
|
| 1040 | +define('UNIT_AWARD_MEMORY_IMMORTAL', 2301); // Бессмертный |
|
| 1041 | +define('UNIT_AWARD_MEMORY_2015_WOMEN_DAY', 2302); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2015 года |
|
| 1042 | 1042 | define('UNIT_AWARD_MEMORY_BLITZ_R0', 2303); // Блиц-сервер, участник 0-го раунда |
| 1043 | 1043 | define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_SIMPLE', 2304); // День Рождения СН |
| 1044 | 1044 | define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_BRONZE', 2305); // День Рождения СН |
| 1045 | 1045 | define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_SILVER', 2306); // День Рождения СН |
| 1046 | 1046 | define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_GOLD', 2307); // День Рождения СН |
| 1047 | 1047 | define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_PLATINUM', 2308); // День Рождения СН |
| 1048 | -define('UNIT_AWARD_MEMORY_2016_WOMEN_DAY', 2309); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2016 года |
|
| 1048 | +define('UNIT_AWARD_MEMORY_2016_WOMEN_DAY', 2309); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2016 года |
|
| 1049 | 1049 | |
| 1050 | 1050 | define('UNIT_AWARD_PENNANT', 2400); // Переходящий вымпел - индикация статуса на сервере: "Топ-1", "Топ", "Сабтоп", "Самый большой флот" итд |
| 1051 | 1051 | define('UNIT_AWARD_BADGE', 2600); // Бейджики/значки за ачивки - например, "Построил 1000 кораблей" |
@@ -1142,7 +1142,7 @@ discard block |
||
| 1142 | 1142 | |
| 1143 | 1143 | define('UNIT_NEXT', 4000); // !!! Next unit start on 4000 !!! |
| 1144 | 1144 | |
| 1145 | -define('GROUP_PART', 800000); |
|
| 1145 | +define('GROUP_PART', 800000); |
|
| 1146 | 1146 | // Зарезервировано для запчастей: 800.001 - 899.999 |
| 1147 | 1147 | // define('GROUP_PART_HULL', 801000); // Корпуса - 1000 штук |
| 1148 | 1148 | // define('GROUP_PART_ARMOR', 802000); // Броня - 1000 штук |
@@ -1399,32 +1399,32 @@ discard block |
||
| 1399 | 1399 | |
| 1400 | 1400 | |
| 1401 | 1401 | // define('NICK_ID', -1); |
| 1402 | -define('NICK_HTML', 0); |
|
| 1403 | - |
|
| 1404 | -define('NICK_FIRST', 1); |
|
| 1405 | -define('NICK_RACE', 1000); |
|
| 1406 | -define('NICK_GENDER', 2000); |
|
| 1407 | -define('NICK_AWARD', 3000); |
|
| 1408 | -define('NICK_VACATION', 3500); |
|
| 1409 | -define('NICK_BIRTHSDAY', 4000); |
|
| 1410 | -define('NICK_PREMIUM', 5000); |
|
| 1411 | -define('NICK_AUTH_LEVEL', 6000); |
|
| 1412 | - |
|
| 1413 | -define('NICK_HIGHLIGHT', 6300); |
|
| 1414 | -define('NICK_CLASS', 6450); |
|
| 1415 | - |
|
| 1416 | -define('NICK_NICK_CLASS', 6600); |
|
| 1417 | -define('NICK_NICK', 7000); |
|
| 1402 | +define('NICK_HTML', 0); |
|
| 1403 | + |
|
| 1404 | +define('NICK_FIRST', 1); |
|
| 1405 | +define('NICK_RACE', 1000); |
|
| 1406 | +define('NICK_GENDER', 2000); |
|
| 1407 | +define('NICK_AWARD', 3000); |
|
| 1408 | +define('NICK_VACATION', 3500); |
|
| 1409 | +define('NICK_BIRTHSDAY', 4000); |
|
| 1410 | +define('NICK_PREMIUM', 5000); |
|
| 1411 | +define('NICK_AUTH_LEVEL', 6000); |
|
| 1412 | + |
|
| 1413 | +define('NICK_HIGHLIGHT', 6300); |
|
| 1414 | +define('NICK_CLASS', 6450); |
|
| 1415 | + |
|
| 1416 | +define('NICK_NICK_CLASS', 6600); |
|
| 1417 | +define('NICK_NICK', 7000); |
|
| 1418 | 1418 | define('NICK_NICK_CLASS_END', 7300); |
| 1419 | 1419 | |
| 1420 | -define('NICK_ALLY_CLASS', 7600); |
|
| 1421 | -define('NICK_ALLY', 8000); |
|
| 1420 | +define('NICK_ALLY_CLASS', 7600); |
|
| 1421 | +define('NICK_ALLY', 8000); |
|
| 1422 | 1422 | define('NICK_ALLY_CLASS_END', 8300); |
| 1423 | 1423 | |
| 1424 | -define('NICK_CLASS_END', 8450); |
|
| 1425 | -define('NICK_HIGHLIGHT_END', 8600); |
|
| 1424 | +define('NICK_CLASS_END', 8450); |
|
| 1425 | +define('NICK_HIGHLIGHT_END', 8600); |
|
| 1426 | 1426 | |
| 1427 | -define('NICK_LAST', 9999); |
|
| 1427 | +define('NICK_LAST', 9999); |
|
| 1428 | 1428 | |
| 1429 | 1429 | // Настройки игрока |
| 1430 | 1430 | define('PLAYER_OPTION_MENU_SORT', 1); |
@@ -1517,8 +1517,8 @@ discard block |
||
| 1517 | 1517 | define('LOG_ONLIINE_AGGREGATE_PERIOD_MINUTE_10', 1); |
| 1518 | 1518 | |
| 1519 | 1519 | define('BLITZ_REGISTER_DISABLED', 0); |
| 1520 | -define('BLITZ_REGISTER_OPEN' , 1); |
|
| 1521 | -define('BLITZ_REGISTER_CLOSED' , 2); |
|
| 1520 | +define('BLITZ_REGISTER_OPEN', 1); |
|
| 1521 | +define('BLITZ_REGISTER_CLOSED', 2); |
|
| 1522 | 1522 | define('BLITZ_REGISTER_SHOW_LOGIN', 3); |
| 1523 | 1523 | define('BLITZ_REGISTER_DISCLOSURE_NAMES', 4); |
| 1524 | 1524 | |
@@ -14,13 +14,13 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | $no_data = array('user' => false, 'planet' => false, 'que' => false); |
| 16 | 16 | |
| 17 | - if(!$planet) { |
|
| 17 | + if (!$planet) { |
|
| 18 | 18 | return $no_data; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - if(!$no_user_update) { |
|
| 21 | + if (!$no_user_update) { |
|
| 22 | 22 | $user = intval(is_array($user) && $user['id'] ? $user['id'] : $user); |
| 23 | - if(!$user) { |
|
| 23 | + if (!$user) { |
|
| 24 | 24 | // TODO - Убрать позже |
| 25 | 25 | print('<h1>СООБЩИТЕ ЭТО АДМИНУ: sys_o_get_updated() - USER пустой!</h1>'); |
| 26 | 26 | $backtrace = debug_backtrace(); |
@@ -32,17 +32,17 @@ discard block |
||
| 32 | 32 | $user = db_user_by_id($user, !$simulation, '*', true); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - if(empty($user['id'])) { |
|
| 35 | + if (empty($user['id'])) { |
|
| 36 | 36 | return $no_data; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - if(is_array($planet) && isset($planet['galaxy']) && $planet['galaxy']) { |
|
| 39 | + if (is_array($planet) && isset($planet['galaxy']) && $planet['galaxy']) { |
|
| 40 | 40 | $planet = db_planet_by_vector($planet, '', !$simulation); |
| 41 | 41 | } else { |
| 42 | 42 | $planet = intval(is_array($planet) && isset($planet['id']) ? $planet['id'] : $planet); |
| 43 | 43 | $planet = db_planet_by_id($planet, !$simulation); |
| 44 | 44 | } |
| 45 | - if(!is_array($planet) || !isset($planet['id'])) { |
|
| 45 | + if (!is_array($planet) || !isset($planet['id'])) { |
|
| 46 | 46 | return $no_data; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -65,19 +65,19 @@ discard block |
||
| 65 | 65 | RES_DEUTERIUM => 0, |
| 66 | 66 | ); |
| 67 | 67 | |
| 68 | - switch($planet['planet_type']) { |
|
| 68 | + switch ($planet['planet_type']) { |
|
| 69 | 69 | case PT_PLANET: |
| 70 | - foreach($resources_increase as $resource_id => &$increment) { |
|
| 70 | + foreach ($resources_increase as $resource_id => &$increment) { |
|
| 71 | 71 | $resource_name = pname_resource_name($resource_id); |
| 72 | 72 | $increment = $caps_real['total'][$resource_id] * $ProductionTime / 3600; |
| 73 | 73 | $store_free = $caps_real['total_storage'][$resource_id] - $planet[$resource_name]; |
| 74 | 74 | $increment = min($increment, max(0, $store_free)); |
| 75 | 75 | |
| 76 | - if($planet[$resource_name] + $increment < 0 && !$simulation) { |
|
| 76 | + if ($planet[$resource_name] + $increment < 0 && !$simulation) { |
|
| 77 | 77 | classSupernova::$debug->warning("Player ID {$user['id']} have negative resources on ID {$planet['id']}.{$planet['planet_type']} [{$planet['galaxy']}:{$planet['system']}:{$planet['planet']}]. Difference {$planet[$resource_name]} of {$resource_name}", 'Negative Resources', 501); |
| 78 | 78 | } |
| 79 | 79 | $planet[$resource_name] += $increment; |
| 80 | - $planet[$resource_name . '_perhour'] = $caps_real['total'][$resource_id]; |
|
| 80 | + $planet[$resource_name.'_perhour'] = $caps_real['total'][$resource_id]; |
|
| 81 | 81 | } |
| 82 | 82 | break; |
| 83 | 83 | |
@@ -94,13 +94,13 @@ discard block |
||
| 94 | 94 | // TODO пересчитывать размер планеты только при постройке чего-нибудь и при покупке сектора |
| 95 | 95 | $planet['field_current'] = 0; |
| 96 | 96 | $sn_group_build_allow = sn_get_groups('build_allow'); |
| 97 | - if(is_array($sn_group_build_allow[$planet['planet_type']])) { |
|
| 98 | - foreach($sn_group_build_allow[$planet['planet_type']] as $building_id) { |
|
| 97 | + if (is_array($sn_group_build_allow[$planet['planet_type']])) { |
|
| 98 | + foreach ($sn_group_build_allow[$planet['planet_type']] as $building_id) { |
|
| 99 | 99 | $planet['field_current'] += mrc_get_level($user, $planet, $building_id, !$simulation, true); |
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - if($simulation) { |
|
| 103 | + if ($simulation) { |
|
| 104 | 104 | return array('user' => $user, 'planet' => $planet, 'que' => $que); |
| 105 | 105 | } |
| 106 | 106 | |