@@ -10,11 +10,11 @@ discard block |
||
| 10 | 10 | $time_server = $time_local - $time_diff |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | -if($font_size = sys_get_param_str('font_size')) { |
|
| 14 | - if(strpos($font_size, '%') !== false) { |
|
| 13 | +if ($font_size = sys_get_param_str('font_size')) { |
|
| 14 | + if (strpos($font_size, '%') !== false) { |
|
| 15 | 15 | // Размер шрифта в процентах |
| 16 | 16 | $font_size = min(max(floatval($font_size), FONT_SIZE_PERCENT_MIN), FONT_SIZE_PERCENT_MAX) . '%'; |
| 17 | - } elseif(strpos($font_size, 'px') !== false) { |
|
| 17 | + } elseif (strpos($font_size, 'px') !== false) { |
|
| 18 | 18 | // Размер шрифта в пикселях |
| 19 | 19 | $font_size = min(max(floatval($font_size), FONT_SIZE_PIXELS_MIN), FONT_SIZE_PIXELS_MAX) . 'px'; |
| 20 | 20 | } else { |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | SN::$user_options[PLAYER_OPTION_BASE_FONT_SIZE] = $font_size; |
| 27 | 27 | } else { |
| 28 | 28 | $user_time_diff = playerTimeDiff::user_time_diff_get(); |
| 29 | - if($user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
| 29 | + if ($user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
| 30 | 30 | $time_diff = intval($user_time_diff[PLAYER_OPTION_TIME_DIFF]); |
| 31 | 31 | } else { |
| 32 | 32 | $user_time_diff = playerTimeDiff::user_time_diff_probe(); |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
| 14 | 14 | |
| 15 | -if(SN::$config->game_mode == GAME_BLITZ) { |
|
| 15 | +if (SN::$config->game_mode == GAME_BLITZ) { |
|
| 16 | 16 | messageBox($lang['sys_blitz_page_disabled'], $lang['sys_error'], 'overview.php', 10); |
| 17 | 17 | die(); |
| 18 | 18 | } |
@@ -25,9 +25,9 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | $template = gettemplate('search', true); |
| 27 | 27 | |
| 28 | -if($searchtext && $type) |
|
| 28 | +if ($searchtext && $type) |
|
| 29 | 29 | { |
| 30 | - switch($type) |
|
| 30 | + switch ($type) |
|
| 31 | 31 | { |
| 32 | 32 | case "planetname": |
| 33 | 33 | // $search = db_planet_list_search($searchtext); |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | break; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - while($row = db_fetch($search)) |
|
| 46 | + while ($row = db_fetch($search)) |
|
| 47 | 47 | { |
| 48 | - if($type=='playername' || $type=='planetname') |
|
| 48 | + if ($type == 'playername' || $type == 'planetname') |
|
| 49 | 49 | { |
| 50 | 50 | $template->assign_block_vars('search_result', array( |
| 51 | 51 | 'PLAYER_ID' => $row['uid'], |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | 'ALLY_TAG' => htmlentities($row['ally_tag'], ENT_COMPAT, 'UTF-8'), |
| 63 | 63 | )); |
| 64 | 64 | } |
| 65 | - elseif($type=='ally') |
|
| 65 | + elseif ($type == 'ally') |
|
| 66 | 66 | { |
| 67 | 67 | $template->assign_block_vars('search_result', array( |
| 68 | 68 | 'ALLY_NAME' => htmlentities($row['ally_name'], ENT_COMPAT, 'UTF-8'), |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | 'ally' => 'sys_alliance', |
| 82 | 82 | ); |
| 83 | 83 | |
| 84 | -foreach($search_type as $type_id => $type_lang) |
|
| 84 | +foreach ($search_type as $type_id => $type_lang) |
|
| 85 | 85 | { |
| 86 | 86 | $template->assign_block_vars('type', array( |
| 87 | 87 | 'ID' => $type_id, |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | require('../includes/init.' . substr(strrchr(__FILE__, '.'), 1)); |
| 6 | 6 | |
| 7 | -if($user['authlevel'] < 3) |
|
| 7 | +if ($user['authlevel'] < 3) |
|
| 8 | 8 | { |
| 9 | 9 | messageBox($lang['sys_noalloaw'], $lang['sys_noaccess']); |
| 10 | 10 | die(); |
@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | // [#] info_best_battles 1b0 |
| 21 | 21 | $best_reports = array(); |
| 22 | -if(defined('MODULE_INFO_BEST_BATTLES_QUERY')) { |
|
| 22 | +if (defined('MODULE_INFO_BEST_BATTLES_QUERY')) { |
|
| 23 | 23 | $query = doquery(MODULE_INFO_BEST_BATTLES_QUERY); |
| 24 | - while($row = db_fetch($query)) { |
|
| 24 | + while ($row = db_fetch($query)) { |
|
| 25 | 25 | $best_reports[] = $row['ube_report_id']; |
| 26 | 26 | } |
| 27 | 27 | } |
@@ -188,16 +188,16 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | function sn_maintenance_pack_user_list($user_list) { |
| 190 | 190 | $user_list = explode(',', $user_list); |
| 191 | - foreach($user_list as $key => $user_id) { |
|
| 192 | - if(!ceil(floatval($user_id))) { |
|
| 191 | + foreach ($user_list as $key => $user_id) { |
|
| 192 | + if (!ceil(floatval($user_id))) { |
|
| 193 | 193 | unset($user_list[$key]); |
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | $result = array(); |
| 198 | - if(!empty($user_list)) { |
|
| 198 | + if (!empty($user_list)) { |
|
| 199 | 199 | $query = doquery("SELECT `id` FROM {{users}} WHERE `id` in (" . implode(',', $user_list) . ")"); |
| 200 | - while($row = db_fetch($query)) { |
|
| 200 | + while ($row = db_fetch($query)) { |
|
| 201 | 201 | $result[] = $row['id']; |
| 202 | 202 | } |
| 203 | 203 | } |
@@ -212,11 +212,11 @@ discard block |
||
| 212 | 212 | $old_server_status == GAME_DISABLE_NONE ? SN::$config->db_saveItem('game_disable', GAME_DISABLE_MAINTENANCE) : false; |
| 213 | 213 | sn_db_transaction_commit(); |
| 214 | 214 | |
| 215 | -foreach($ques as $que_transaction) { |
|
| 215 | +foreach ($ques as $que_transaction) { |
|
| 216 | 216 | sn_db_transaction_start(); |
| 217 | 217 | |
| 218 | 218 | !is_array($que_transaction) ? $que_transaction = array($que_transaction) : false; |
| 219 | - foreach($que_transaction as $que) { |
|
| 219 | + foreach ($que_transaction as $que) { |
|
| 220 | 220 | set_time_limit(120); |
| 221 | 221 | $QryResult = doquery($que); |
| 222 | 222 | //$msg .= '<hr>' . $que . '<hr>'; |
@@ -8,8 +8,8 @@ discard block |
||
| 8 | 8 | * @copyright 2008 by ??????? for XNova |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -define('INSIDE' , true); |
|
| 12 | -define('INSTALL' , false); |
|
| 11 | +define('INSIDE', true); |
|
| 12 | +define('INSTALL', false); |
|
| 13 | 13 | define('IN_ADMIN', true); |
| 14 | 14 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
| 15 | 15 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | $template = gettemplate('admin/settings', true); |
| 21 | 21 | |
| 22 | -if(sys_get_param('save')) { |
|
| 22 | +if (sys_get_param('save')) { |
|
| 23 | 23 | SN::$config->game_name = sys_get_param_str_unsafe('game_name'); |
| 24 | 24 | SN::$config->game_mode = sys_get_param_int('game_mode'); |
| 25 | 25 | SN::$config->game_speed = sys_get_param_float('game_speed', 1); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | SN::$config->url_faq = sys_get_param_str_unsafe('url_faq'); |
| 30 | 30 | SN::$config->url_forum = sys_get_param_str_unsafe('url_forum'); |
| 31 | 31 | SN::$config->url_rules = sys_get_param_str_unsafe('url_rules'); |
| 32 | - SN::$config->url_purchase_metamatter = sys_get_param_str_unsafe('url_purchase_metamatter'); |
|
| 32 | + SN::$config->url_purchase_metamatter = sys_get_param_str_unsafe('url_purchase_metamatter'); |
|
| 33 | 33 | SN::$config->game_disable = sys_get_param_int('game_disable'); |
| 34 | 34 | SN::$config->game_disable_reason = sys_get_param_str_unsafe('game_disable_reason'); |
| 35 | 35 | SN::$config->server_updater_check_auto = sys_get_param_int('server_updater_check_auto'); |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | SN::$config->stats_schedule = sys_get_param_str('stats_schedule'); |
| 97 | 97 | |
| 98 | 98 | SN::$config->empire_mercenary_base_period = sys_get_param_int('empire_mercenary_base_period'); |
| 99 | - if(SN::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) { |
|
| 100 | - if(SN::$config->empire_mercenary_temporary) { |
|
| 99 | + if (SN::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) { |
|
| 100 | + if (SN::$config->empire_mercenary_temporary) { |
|
| 101 | 101 | DBStaticUnit::db_unit_list_admin_delete_mercenaries_finished(); |
| 102 | 102 | } else { |
| 103 | 103 | DBStaticUnit::db_unit_list_admin_set_mercenaries_expire_time(SN::$config->empire_mercenary_base_period); |
@@ -138,21 +138,21 @@ discard block |
||
| 138 | 138 | 'STATS_HIDE_PM_LINK' => SN::$config->stats_hide_pm_link, |
| 139 | 139 | )); |
| 140 | 140 | |
| 141 | -foreach($lang['sys_game_disable_reason'] as $id => $name) { |
|
| 141 | +foreach ($lang['sys_game_disable_reason'] as $id => $name) { |
|
| 142 | 142 | $template->assign_block_vars('sys_game_disable_reason', array( |
| 143 | 143 | 'ID' => $id, |
| 144 | 144 | 'NAME' => $name, |
| 145 | 145 | )); |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | -foreach($lang['sys_game_mode'] as $mode_id => $mode_name) { |
|
| 148 | +foreach ($lang['sys_game_mode'] as $mode_id => $mode_name) { |
|
| 149 | 149 | $template->assign_block_vars('game_modes', array( |
| 150 | 150 | 'ID' => $mode_id, |
| 151 | 151 | 'NAME' => $mode_name, |
| 152 | 152 | )); |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | -foreach($lang['adm_opt_ver_response'] as $ver_id => $ver_response) { |
|
| 155 | +foreach ($lang['adm_opt_ver_response'] as $ver_id => $ver_response) { |
|
| 156 | 156 | $template->assign_block_vars('ver_response', array( |
| 157 | 157 | 'ID' => $ver_id, |
| 158 | 158 | 'NAME' => js_safe_string($ver_response), |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | $lang_list = lng_get_list(); |
| 163 | -foreach($lang_list as $lang_id => $lang_data) { |
|
| 163 | +foreach ($lang_list as $lang_id => $lang_data) { |
|
| 164 | 164 | $template->assign_block_vars('game_languages', array( |
| 165 | 165 | 'ID' => $lang_id, |
| 166 | 166 | 'NAME' => "{$lang_data['LANG_NAME_NATIVE']} ({$lang_data['LANG_NAME_ENGLISH']})", |
@@ -9,8 +9,8 @@ discard block |
||
| 9 | 9 | * @copyright 2008 by Chlorel for XNova |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -define('INSIDE' , true); |
|
| 13 | -define('INSTALL' , false); |
|
| 12 | +define('INSIDE', true); |
|
| 13 | +define('INSTALL', false); |
|
| 14 | 14 | define('IN_ADMIN', true); |
| 15 | 15 | require_once('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
| 16 | 16 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | messageBoxAdminAccessDenied(AUTH_LEVEL_ADMINISTRATOR); |
| 20 | 20 | |
| 21 | -if(SN_TIME_NOW >= SN::$config->db_loadItem('var_stat_update_admin_forced') && SN_TIME_NOW >= SN::$config->db_loadItem('var_stat_update_end')) |
|
| 21 | +if (SN_TIME_NOW >= SN::$config->db_loadItem('var_stat_update_admin_forced') && SN_TIME_NOW >= SN::$config->db_loadItem('var_stat_update_end')) |
|
| 22 | 22 | { |
| 23 | 23 | SN::$config->db_saveItem('var_stat_update_admin_forced', SN_TIME_NOW + 120); |
| 24 | 24 | |
@@ -15,8 +15,8 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | $constants = get_defined_constants(true); |
| 17 | 17 | $rpgConstants = array(); |
| 18 | -foreach($constants['user'] as $constantName => $constantValue) { |
|
| 19 | - if(substr($constantName, 0, 4) == 'RPG_') { |
|
| 18 | +foreach ($constants['user'] as $constantName => $constantValue) { |
|
| 19 | + if (substr($constantName, 0, 4) == 'RPG_') { |
|
| 20 | 20 | $rpgConstants[$constantValue] = $constantName; |
| 21 | 21 | } |
| 22 | 22 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | GROUP BY log_dark_matter_reason, IF(sign((log_dark_matter_amount)) > 0, 1, -1) ORDER BY sum(log_dark_matter_amount) DESC; |
| 34 | 34 | "); |
| 35 | 35 | |
| 36 | -while($row = SN::$db->db_fetch($result)) { |
|
| 36 | +while ($row = SN::$db->db_fetch($result)) { |
|
| 37 | 37 | $row['CONSTANT'] = $rpgConstants[$row['REASON']]; |
| 38 | 38 | |
| 39 | 39 | $row['DM_AMOUNT_TEXT'] = HelperString::numberFloorAndFormat($row['DM_AMOUNT']); |
@@ -55,8 +55,8 @@ discard block |
||
| 55 | 55 | GROUP BY reason, if(sign((amount)) > 0, 1, -1) ORDER BY sum(amount) DESC; |
| 56 | 56 | "); |
| 57 | 57 | |
| 58 | -while($row = SN::$db->db_fetch($result)) { |
|
| 59 | - if(empty($spent[$row['BALANCE']])) { |
|
| 58 | +while ($row = SN::$db->db_fetch($result)) { |
|
| 59 | + if (empty($spent[$row['BALANCE']])) { |
|
| 60 | 60 | $spent[$row['BALANCE']] = array(); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -66,16 +66,15 @@ discard block |
||
| 66 | 66 | $spent[$row['BALANCE']] = array_merge_recursive_numeric($spent[$row['BALANCE']], $row); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | -foreach($spent as &$row) { |
|
| 69 | +foreach ($spent as &$row) { |
|
| 70 | 70 | @$row['TOTAL_COUNT'] = $row['MM_COUNT'] + $row['DM_COUNT']; |
| 71 | 71 | @$row['TOTAL_AMOUNT'] = $row['MM_AMOUNT'] + $row['DM_AMOUNT']; |
| 72 | 72 | @$row['TOTAL_AMOUNT_TEXT'] = HelperString::numberFloorAndFormat($row['TOTAL_AMOUNT']); |
| 73 | 73 | @$row['TOTAL_COUNT_TEXT'] = HelperString::numberFloorAndFormat($row['TOTAL_COUNT']); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | -usort($spent, function ($a, $b) { |
|
| 77 | - return $a['TOTAL_AMOUNT'] < $b['TOTAL_AMOUNT'] ? -1 : |
|
| 78 | - ($a['TOTAL_AMOUNT'] > $b['TOTAL_AMOUNT'] ? 1 : 0); |
|
| 76 | +usort($spent, function($a, $b) { |
|
| 77 | + return $a['TOTAL_AMOUNT'] < $b['TOTAL_AMOUNT'] ? -1 : ($a['TOTAL_AMOUNT'] > $b['TOTAL_AMOUNT'] ? 1 : 0); |
|
| 79 | 78 | }); |
| 80 | 79 | |
| 81 | 80 | |
@@ -49,8 +49,7 @@ discard block |
||
| 49 | 49 | $galaxy = isset($vector[$prefix . 'galaxy']) ? intval($vector[$prefix . 'galaxy']) : 0; |
| 50 | 50 | $system = isset($vector[$prefix . 'system']) ? intval($vector[$prefix . 'system']) : 0; |
| 51 | 51 | $planet = isset($vector[$prefix . 'planet']) ? intval($vector[$prefix . 'planet']) : 0; |
| 52 | - $planet_type = isset($vector[$prefix . 'planet_type']) ? intval($vector[$prefix . 'planet_type']) : |
|
| 53 | - (isset($vector[$prefix . 'type']) ? intval($vector[$prefix . 'type']) : 0); |
|
| 52 | + $planet_type = isset($vector[$prefix . 'planet_type']) ? intval($vector[$prefix . 'planet_type']) : (isset($vector[$prefix . 'type']) ? intval($vector[$prefix . 'type']) : 0); |
|
| 54 | 53 | $planet_type = $planet_type == PT_DEBRIS ? PT_PLANET : $planet_type; |
| 55 | 54 | |
| 56 | 55 | return DBStaticPlanet::db_planet_by_gspt_safe($galaxy, $system, $planet, $planet_type, $for_update, $fields); |
@@ -71,7 +70,7 @@ discard block |
||
| 71 | 70 | // } |
| 72 | 71 | |
| 73 | 72 | public static function db_planet_by_parent($parent_id, $for_update = false, $fields = '*') { |
| 74 | - if(!($parent_id = idval($parent_id))) { |
|
| 73 | + if (!($parent_id = idval($parent_id))) { |
|
| 75 | 74 | return false; |
| 76 | 75 | } |
| 77 | 76 | |
@@ -80,7 +79,7 @@ discard block |
||
| 80 | 79 | } |
| 81 | 80 | |
| 82 | 81 | public static function db_planet_by_id_and_owner($planet_id, $owner_id, $for_update = false, $fields = '*') { |
| 83 | - if(!($planet_id = idval($planet_id)) || !($owner_id = idval($owner_id))) { |
|
| 82 | + if (!($planet_id = idval($planet_id)) || !($owner_id = idval($owner_id))) { |
|
| 84 | 83 | return false; |
| 85 | 84 | } |
| 86 | 85 | return SN::db_get_record_list(LOC_PLANET, |
@@ -89,7 +88,7 @@ discard block |
||
| 89 | 88 | |
| 90 | 89 | |
| 91 | 90 | public static function db_planet_list_moon_other($user_id, $this_moon_id) { |
| 92 | - if(!($user_id = idval($user_id)) || !($this_moon_id = idval($this_moon_id))) { |
|
| 91 | + if (!($user_id = idval($user_id)) || !($this_moon_id = idval($this_moon_id))) { |
|
| 93 | 92 | return false; |
| 94 | 93 | } |
| 95 | 94 | return SN::db_get_record_list(LOC_PLANET, |
@@ -104,7 +103,7 @@ discard block |
||
| 104 | 103 | } |
| 105 | 104 | |
| 106 | 105 | public static function db_planet_list_sorted($user_row, $skip_planet_id = false, $field_list = '', $conditions = '') { |
| 107 | - if(!is_array($user_row)) { |
|
| 106 | + if (!is_array($user_row)) { |
|
| 108 | 107 | return false; |
| 109 | 108 | } |
| 110 | 109 | $conditions .= $skip_planet_id ? " AND `id` <> {$skip_planet_id} " : ''; |
@@ -125,7 +124,7 @@ discard block |
||
| 125 | 124 | } |
| 126 | 125 | |
| 127 | 126 | public static function db_planet_list_by_user_or_planet($user_id, $planet_id) { |
| 128 | - if(!($user_id = idval($user_id)) && !($planet_id = idval($planet_id))) { |
|
| 127 | + if (!($user_id = idval($user_id)) && !($planet_id = idval($planet_id))) { |
|
| 129 | 128 | return false; |
| 130 | 129 | } |
| 131 | 130 | |
@@ -134,14 +133,14 @@ discard block |
||
| 134 | 133 | } |
| 135 | 134 | |
| 136 | 135 | public static function db_planet_set_by_id($planet_id, $set) { |
| 137 | - if(!($planet_id = idval($planet_id))) { |
|
| 136 | + if (!($planet_id = idval($planet_id))) { |
|
| 138 | 137 | return false; |
| 139 | 138 | } |
| 140 | 139 | return SN::db_upd_record_by_id(LOC_PLANET, $planet_id, $set); |
| 141 | 140 | } |
| 142 | 141 | |
| 143 | 142 | public static function db_planet_set_by_gspt($ui_galaxy, $ui_system, $ui_planet, $ui_planet_type = PT_ALL, $set) { |
| 144 | - if(!($set = trim($set))) { |
|
| 143 | + if (!($set = trim($set))) { |
|
| 145 | 144 | return false; |
| 146 | 145 | } |
| 147 | 146 | |
@@ -154,14 +153,14 @@ discard block |
||
| 154 | 153 | } |
| 155 | 154 | |
| 156 | 155 | public static function db_planet_set_by_parent($ui_parent_id, $ss_set) { |
| 157 | - if(!($si_parent_id = idval($ui_parent_id)) || !($ss_set = trim($ss_set))) { |
|
| 156 | + if (!($si_parent_id = idval($ui_parent_id)) || !($ss_set = trim($ss_set))) { |
|
| 158 | 157 | return false; |
| 159 | 158 | } |
| 160 | 159 | return SN::db_upd_record_list(LOC_PLANET, "`parent_planet` = {$si_parent_id}", $ss_set); |
| 161 | 160 | } |
| 162 | 161 | |
| 163 | 162 | public static function db_planet_set_by_owner($ui_owner_id, $ss_set) { |
| 164 | - if(!($si_owner_id = idval($ui_owner_id)) || !($ss_set = trim($ss_set))) { |
|
| 163 | + if (!($si_owner_id = idval($ui_owner_id)) || !($ss_set = trim($ss_set))) { |
|
| 165 | 164 | return false; |
| 166 | 165 | } |
| 167 | 166 | return SN::db_upd_record_list(LOC_PLANET, "`id_owner` = {$si_owner_id}", $ss_set); |
@@ -169,7 +168,7 @@ discard block |
||
| 169 | 168 | |
| 170 | 169 | |
| 171 | 170 | public static function db_planet_delete_by_id($planet_id) { |
| 172 | - if(!($planet_id = idval($planet_id))) { |
|
| 171 | + if (!($planet_id = idval($planet_id))) { |
|
| 173 | 172 | return false; |
| 174 | 173 | } |
| 175 | 174 | SN::db_del_record_by_id(LOC_PLANET, $planet_id); |
@@ -179,7 +178,7 @@ discard block |
||
| 179 | 178 | } |
| 180 | 179 | |
| 181 | 180 | public static function db_planet_list_delete_by_owner($ui_owner_id) { |
| 182 | - if(!($si_owner_id = idval($ui_owner_id))) { |
|
| 181 | + if (!($si_owner_id = idval($ui_owner_id))) { |
|
| 183 | 182 | return false; |
| 184 | 183 | } |
| 185 | 184 | SN::db_del_record_list(LOC_PLANET, "`id_owner` = {$si_owner_id}"); |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | public function compile_request($request) { |
| 451 | 451 | global $config, $lang, $user; |
| 452 | 452 | |
| 453 | - if(!(SN::$auth->account instanceof Account)) { |
|
| 453 | + if (!(SN::$auth->account instanceof Account)) { |
|
| 454 | 454 | // TODO - throw new Exception($lang['pay_msg_mm_request_amount_invalid'], SN_PAYMENT_REQUEST_ERROR_UNIT_AMOUNT); |
| 455 | 455 | } |
| 456 | 456 | $this->account = SN::$auth->account; |
@@ -470,15 +470,15 @@ discard block |
||
| 470 | 470 | $this->payment_currency = $config->payment_currency_default; |
| 471 | 471 | $this->payment_amount = self::currency_convert($this->payment_dark_matter_paid, 'MM_', $this->payment_currency); |
| 472 | 472 | |
| 473 | - if(empty($this->payment_external_currency) && !empty($this->config['currency'])) { |
|
| 473 | + if (empty($this->payment_external_currency) && !empty($this->config['currency'])) { |
|
| 474 | 474 | $this->payment_external_currency = $this->config['currency']; |
| 475 | 475 | } |
| 476 | - if(empty($this->payment_external_currency)) { |
|
| 476 | + if (empty($this->payment_external_currency)) { |
|
| 477 | 477 | throw new Exception($lang['pay_error_internal_no_external_currency_set'], SN_PAYMENT_ERROR_INTERNAL_NO_EXTERNAL_CURRENCY_SET); |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | $this->payment_external_amount = self::currency_convert($this->payment_dark_matter_paid, 'MM_', $this->payment_external_currency); |
| 481 | - if($this->payment_external_amount < 0.01) { |
|
| 481 | + if ($this->payment_external_amount < 0.01) { |
|
| 482 | 482 | throw new Exception($lang['pay_msg_mm_request_amount_invalid'], SN_PAYMENT_REQUEST_ERROR_UNIT_AMOUNT); |
| 483 | 483 | } |
| 484 | 484 | |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | $this->generate_description(); |
| 488 | 488 | |
| 489 | 489 | $this->db_insert(); |
| 490 | - if(!$this->is_exists) { |
|
| 490 | + if (!$this->is_exists) { |
|
| 491 | 491 | throw new Exception($lang['pay_msg_request_error_db_payment_create'], SN_PAYMENT_REQUEST_DB_ERROR_PAYMENT_CREATE); |
| 492 | 492 | } |
| 493 | 493 | } |
@@ -502,24 +502,24 @@ discard block |
||
| 502 | 502 | protected function payment_request_process($options = array()) { |
| 503 | 503 | global $lang, $config; |
| 504 | 504 | |
| 505 | - if(!$this->manifest['active']) { |
|
| 505 | + if (!$this->manifest['active']) { |
|
| 506 | 506 | throw new Exception($lang['pay_msg_module_disabled'], SN_MODULE_DISABLED); |
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | // Если есть payment_id - загружаем под него данные |
| 510 | - if(!empty($this->payment_params['payment_id'])) { |
|
| 510 | + if (!empty($this->payment_params['payment_id'])) { |
|
| 511 | 511 | $this->request_payment_id = sys_get_param_id($this->payment_params['payment_id']); |
| 512 | - if(!$this->request_payment_id) { |
|
| 512 | + if (!$this->request_payment_id) { |
|
| 513 | 513 | throw new Exception($lang['pay_msg_request_payment_id_invalid'], SN_PAYMENT_REQUEST_INTERNAL_ID_WRONG); |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | - if(!$this->db_get_by_id($this->request_payment_id)) { |
|
| 516 | + if (!$this->db_get_by_id($this->request_payment_id)) { |
|
| 517 | 517 | throw new Exception($lang['pay_msg_request_payment_id_invalid'], SN_PAYMENT_REQUEST_INTERNAL_ID_WRONG); |
| 518 | 518 | } |
| 519 | 519 | |
| 520 | 520 | // Проверяем - был ли этот платеж обработан? |
| 521 | 521 | // TODO - Статусы бывают разные. Нужен спецфлаг payment_processed |
| 522 | - if($this->payment_status != PAYMENT_STATUS_NONE) { |
|
| 522 | + if ($this->payment_status != PAYMENT_STATUS_NONE) { |
|
| 523 | 523 | sn_db_transaction_rollback(); |
| 524 | 524 | sys_redirect(SN_ROOT_VIRTUAL . 'metamatter.php?payment_id=' . $this->payment_id); |
| 525 | 525 | die(); |
@@ -529,89 +529,89 @@ discard block |
||
| 529 | 529 | // Пытаемся получить из запроса ИД аккаунта |
| 530 | 530 | $request_account_id = !empty($this->payment_params['account_id']) ? sys_get_param_id($this->payment_params['account_id']) : 0; |
| 531 | 531 | // Если в запросе нет ИД аккаунта - пытаемся использовать payment_account_id |
| 532 | - if(empty($request_account_id) && !empty($this->payment_account_id)) { |
|
| 532 | + if (empty($request_account_id) && !empty($this->payment_account_id)) { |
|
| 533 | 533 | $request_account_id = $this->payment_account_id; |
| 534 | 534 | } |
| 535 | 535 | // Если теперь у нас нету ИД аккаунта ни в запросе, ни в записи таблицы - можно паниковать |
| 536 | - if(empty($request_account_id)) { |
|
| 536 | + if (empty($request_account_id)) { |
|
| 537 | 537 | // TODO - аккаунт |
| 538 | 538 | throw new Exception($lang['pay_msg_request_user_invalid'], $this->retranslate_error(SN_PAYMENT_REQUEST_USER_NOT_FOUND, $options)); |
| 539 | 539 | } |
| 540 | 540 | // Если нет записи в таблице - тогда берем payment_account_id из запроса |
| 541 | - if(empty($this->payment_account_id)) { |
|
| 541 | + if (empty($this->payment_account_id)) { |
|
| 542 | 542 | $this->payment_account_id = $request_account_id; |
| 543 | 543 | } |
| 544 | 544 | // Если у нас отличаются ИД аккаунта в запросе и ИД аккаунта в записи - тоже можно паниковать |
| 545 | - if($this->payment_account_id != $request_account_id) { |
|
| 545 | + if ($this->payment_account_id != $request_account_id) { |
|
| 546 | 546 | // TODO - Поменять сообщение об ошибке |
| 547 | 547 | throw new Exception($lang['pay_msg_request_user_invalid'], $this->retranslate_error(SN_PAYMENT_REQUEST_USER_NOT_FOUND, $options)); |
| 548 | 548 | } |
| 549 | 549 | // Проверяем существование аккаунта с данным ИД |
| 550 | - if(!$this->account->db_get_by_id($this->payment_account_id)) { |
|
| 550 | + if (!$this->account->db_get_by_id($this->payment_account_id)) { |
|
| 551 | 551 | throw new Exception($lang['pay_msg_request_user_invalid'] . ' ID ' . $this->payment_account_id, $this->retranslate_error(SN_PAYMENT_REQUEST_USER_NOT_FOUND, $options)); |
| 552 | 552 | } |
| 553 | 553 | |
| 554 | 554 | // TODO Проверка на сервер_ид - как бы и не нужна, наверное? |
| 555 | - if(!empty($this->payment_params['server_id'])) { |
|
| 555 | + if (!empty($this->payment_params['server_id'])) { |
|
| 556 | 556 | $this->request_server_id = sys_get_param_str($this->payment_params['server_id']); |
| 557 | - if(SN_ROOT_VIRTUAL != $this->request_server_id) { |
|
| 557 | + if (SN_ROOT_VIRTUAL != $this->request_server_id) { |
|
| 558 | 558 | throw new Exception($lang['pay_msg_request_server_wrong'] . " {$this->request_server_id} вместо " . SN_ROOT_VIRTUAL, SN_PAYMENT_REQUEST_SERVER_WRONG); |
| 559 | 559 | } |
| 560 | 560 | } |
| 561 | 561 | |
| 562 | 562 | // Сверка количества оплаченной ММ с учётом бонусов |
| 563 | - if(!empty($this->payment_params['payment_dark_matter_gained'])) { |
|
| 563 | + if (!empty($this->payment_params['payment_dark_matter_gained'])) { |
|
| 564 | 564 | $request_mm_amount = sys_get_param_id($this->payment_params['payment_dark_matter_gained']); |
| 565 | - if($request_mm_amount != $this->payment_dark_matter_gained && $this->is_loaded) { |
|
| 565 | + if ($request_mm_amount != $this->payment_dark_matter_gained && $this->is_loaded) { |
|
| 566 | 566 | throw new Exception($lang['pay_msg_mm_request_amount_invalid'] . " пришло {$request_mm_amount} ММ вместо {$this->payment_dark_matter_gained} ММ", SN_PAYMENT_REQUEST_MM_AMOUNT_INVALID); |
| 567 | 567 | } |
| 568 | 568 | empty($this->payment_dark_matter_gained) ? $this->payment_dark_matter_gained = $request_mm_amount : false; |
| 569 | 569 | } |
| 570 | - if(empty($this->payment_dark_matter_paid)) { |
|
| 570 | + if (empty($this->payment_dark_matter_paid)) { |
|
| 571 | 571 | // TODO - обратный расчёт из gained |
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | // Проверка наличия внешнего ИД платежа |
| 575 | - if(!empty($this->payment_params['payment_external_id'])) { |
|
| 575 | + if (!empty($this->payment_params['payment_external_id'])) { |
|
| 576 | 576 | $request_payment_external_id = sys_get_param_id($this->payment_params['payment_external_id']); |
| 577 | - if(empty($request_payment_external_id)) { |
|
| 577 | + if (empty($request_payment_external_id)) { |
|
| 578 | 578 | throw new exception($lang['pay_msg_request_payment_id_invalid'], SN_PAYMENT_REQUEST_EXTERNAL_ID_WRONG); |
| 579 | - } elseif(!empty($this->payment_external_id) && $this->payment_external_id != $request_payment_external_id) { |
|
| 579 | + } elseif (!empty($this->payment_external_id) && $this->payment_external_id != $request_payment_external_id) { |
|
| 580 | 580 | // TODO - Может быть поменять сообщение |
| 581 | 581 | throw new exception($lang['pay_msg_request_payment_id_invalid'], SN_PAYMENT_REQUEST_EXTERNAL_ID_WRONG); |
| 582 | 582 | } |
| 583 | 583 | $this->payment_external_id = $request_payment_external_id; |
| 584 | 584 | } |
| 585 | 585 | // Сверка суммы, запрошенной СН к оплате |
| 586 | - if(!empty($this->payment_params['payment_external_money'])) { |
|
| 586 | + if (!empty($this->payment_params['payment_external_money'])) { |
|
| 587 | 587 | $request_money_out = sys_get_param_float($this->payment_params['payment_external_money']); |
| 588 | - if($request_money_out != $this->payment_external_amount && $this->is_loaded) { |
|
| 588 | + if ($request_money_out != $this->payment_external_amount && $this->is_loaded) { |
|
| 589 | 589 | throw new Exception($lang['pay_msg_request_payment_amount_invalid'] . " пришло {$request_money_out} денег вместо {$this->payment_external_amount} денег", SN_PAYMENT_REQUEST_CURRENCY_AMOUNT_INVALID); |
| 590 | 590 | } |
| 591 | 591 | empty($this->payment_external_amount) ? $this->payment_external_amount = $request_money_out : false; |
| 592 | 592 | } |
| 593 | 593 | // Заполняем поле валюты платёжной системы |
| 594 | - if(!empty($this->payment_params['payment_external_currency'])) { |
|
| 594 | + if (!empty($this->payment_params['payment_external_currency'])) { |
|
| 595 | 595 | $this->payment_external_currency = sys_get_param_str($this->payment_params['payment_external_currency']); |
| 596 | - if(empty($this->payment_external_currency)) { |
|
| 596 | + if (empty($this->payment_external_currency)) { |
|
| 597 | 597 | // TODO - поменять сообщение |
| 598 | 598 | throw new Exception($lang['pay_msg_request_payment_amount_invalid'] . " {$this->payment_external_currency}", SN_PAYMENT_REQUEST_CURRENCY_AMOUNT_INVALID); |
| 599 | 599 | } |
| 600 | 600 | } |
| 601 | - if(empty($this->payment_external_currency)) { |
|
| 601 | + if (empty($this->payment_external_currency)) { |
|
| 602 | 602 | $this->payment_external_currency = $this->config['currency']; |
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | // Заполнение внутренней суммы и валюты из внешних данных |
| 606 | - if(empty($this->payment_currency)) { |
|
| 606 | + if (empty($this->payment_currency)) { |
|
| 607 | 607 | $this->payment_currency = $config->payment_currency_default; |
| 608 | 608 | } |
| 609 | - if(empty($this->payment_amount) && !empty($this->payment_external_currency)) { |
|
| 609 | + if (empty($this->payment_amount) && !empty($this->payment_external_currency)) { |
|
| 610 | 610 | $this->payment_amount = self::currency_convert($this->payment_external_amount, $this->payment_external_currency, $this->payment_currency); |
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | // TODO - Тестовый режим |
| 614 | - if(!empty($this->payment_params['test'])) { |
|
| 614 | + if (!empty($this->payment_params['test'])) { |
|
| 615 | 615 | $this->payment_test = $this->config['test'] || sys_get_param_int($this->payment_params['test']); |
| 616 | 616 | } |
| 617 | 617 | |
@@ -640,12 +640,12 @@ discard block |
||
| 640 | 640 | sn_db_transaction_start(); |
| 641 | 641 | try { |
| 642 | 642 | $response = $this->payment_request_process(); |
| 643 | - } catch(Exception $e) { |
|
| 643 | + } catch (Exception $e) { |
|
| 644 | 644 | $response['result'] = $e->getCode(); |
| 645 | 645 | $response['message'] = $e->getMessage(); |
| 646 | 646 | } |
| 647 | 647 | |
| 648 | - if($response['result'] == SN_PAYMENT_REQUEST_OK) { |
|
| 648 | + if ($response['result'] == SN_PAYMENT_REQUEST_OK) { |
|
| 649 | 649 | sn_db_transaction_commit(); |
| 650 | 650 | $debug->warning('Результат операции: код ' . $response['result'] . ' сообщение "' . $response['message'] . '"', 'Успешный платёж', LOG_INFO_PAYMENT); |
| 651 | 651 | } else { |
@@ -654,7 +654,7 @@ discard block |
||
| 654 | 654 | } |
| 655 | 655 | |
| 656 | 656 | // Переводим код результата из СН в код платежной системы |
| 657 | - if(is_array($this->result_translations) && !empty($this->result_translations)) { |
|
| 657 | + if (is_array($this->result_translations) && !empty($this->result_translations)) { |
|
| 658 | 658 | $response['result'] = isset($this->result_translations[$response['result']]) ? $this->result_translations[$response['result']] : $this->result_translations[SN_PAYMENT_REQUEST_UNDEFINED_ERROR]; |
| 659 | 659 | } |
| 660 | 660 | |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | $currency_from = strtolower($currency_from); |
| 680 | 680 | $currency_to = strtolower($currency_to); |
| 681 | 681 | |
| 682 | - if($currency_from != $currency_to) { |
|
| 682 | + if ($currency_from != $currency_to) { |
|
| 683 | 683 | // $config_currency_from_name = 'payment_currency_exchange_' . $currency_from; |
| 684 | 684 | // $config_currency_to_name = 'payment_currency_exchange_' . $currency_to; |
| 685 | 685 | |
@@ -709,10 +709,10 @@ discard block |
||
| 709 | 709 | public static function bonus_calculate($dark_matter, $direct = true, $return_bonus = false) { |
| 710 | 710 | $bonus = 0; |
| 711 | 711 | $dark_matter_new = $dark_matter; |
| 712 | - if(!empty(self::$bonus_table) && $dark_matter >= self::$bonus_table[0]) { |
|
| 713 | - if($direct) { |
|
| 714 | - foreach(self::$bonus_table as $dm_for_bonus => $multiplier) { |
|
| 715 | - if($dm_for_bonus <= $dark_matter) { |
|
| 712 | + if (!empty(self::$bonus_table) && $dark_matter >= self::$bonus_table[0]) { |
|
| 713 | + if ($direct) { |
|
| 714 | + foreach (self::$bonus_table as $dm_for_bonus => $multiplier) { |
|
| 715 | + if ($dm_for_bonus <= $dark_matter) { |
|
| 716 | 716 | $dark_matter_new = $dark_matter * (1 + $multiplier); |
| 717 | 717 | $bonus = $multiplier; |
| 718 | 718 | } else { |
@@ -720,9 +720,9 @@ discard block |
||
| 720 | 720 | } |
| 721 | 721 | } |
| 722 | 722 | } else { |
| 723 | - foreach(self::$bonus_table as $dm_for_bonus => $multiplier) { |
|
| 723 | + foreach (self::$bonus_table as $dm_for_bonus => $multiplier) { |
|
| 724 | 724 | $temp = $dm_for_bonus * (1 + $multiplier); |
| 725 | - if($dark_matter >= $temp) { |
|
| 725 | + if ($dark_matter >= $temp) { |
|
| 726 | 726 | $dark_matter_new = round($dark_matter / (1 + $multiplier)); |
| 727 | 727 | $bonus = $multiplier; |
| 728 | 728 | } else { |
@@ -778,13 +778,13 @@ discard block |
||
| 778 | 778 | ); |
| 779 | 779 | |
| 780 | 780 | $replace = false; |
| 781 | - if($this->payment_id) { |
|
| 781 | + if ($this->payment_id) { |
|
| 782 | 782 | $payment['payment_id'] = $this->payment_id; |
| 783 | 783 | $replace = true; |
| 784 | 784 | } |
| 785 | 785 | |
| 786 | 786 | $query = array(); |
| 787 | - foreach($payment as $key => $value) { |
|
| 787 | + foreach ($payment as $key => $value) { |
|
| 788 | 788 | $value = is_string($value) ? '"' . db_escape($value) . '"' : $value; |
| 789 | 789 | $query[] = "`{$key}` = {$value}"; |
| 790 | 790 | } |
@@ -796,12 +796,12 @@ discard block |
||
| 796 | 796 | |
| 797 | 797 | |
| 798 | 798 | function payment_adjust_mm_new() { |
| 799 | - if(!$this->payment_test) { |
|
| 799 | + if (!$this->payment_test) { |
|
| 800 | 800 | // Not a test payment. Adding DM to account |
| 801 | 801 | $this->account = new Account($this->db); |
| 802 | 802 | $this->account->db_get_by_id($this->payment_account_id); |
| 803 | 803 | $result = $this->account->metamatter_change(RPG_PURCHASE, $this->payment_dark_matter_gained, $this->payment_comment); |
| 804 | - if(!$result) { |
|
| 804 | + if (!$result) { |
|
| 805 | 805 | throw new Exception('Ошибка начисления ММ', SN_METAMATTER_ERROR_ADJUST); |
| 806 | 806 | } |
| 807 | 807 | } |
@@ -811,25 +811,25 @@ discard block |
||
| 811 | 811 | die('{НЕ РАБОТАЕТ! СООБЩИТЕ АДМИНИСТРАЦИИ!}'); |
| 812 | 812 | global $lang; |
| 813 | 813 | |
| 814 | - if(!isset($payment['payment_status'])) { |
|
| 814 | + if (!isset($payment['payment_status'])) { |
|
| 815 | 815 | throw new exception($lang['pay_msg_request_payment_not_found'], SN_PAYMENT_REQUEST_ORDER_NOT_FOUND); |
| 816 | 816 | } |
| 817 | 817 | |
| 818 | - if($payment['payment_status'] == PAYMENT_STATUS_COMPLETE) { |
|
| 819 | - $safe_comment = db_escape($payment['payment_comment'] = $lang['pay_msg_request_payment_cancelled'] .' ' . $payment['payment_comment']); |
|
| 818 | + if ($payment['payment_status'] == PAYMENT_STATUS_COMPLETE) { |
|
| 819 | + $safe_comment = db_escape($payment['payment_comment'] = $lang['pay_msg_request_payment_cancelled'] . ' ' . $payment['payment_comment']); |
|
| 820 | 820 | |
| 821 | - if(!$payment['payment_test']) { |
|
| 821 | + if (!$payment['payment_test']) { |
|
| 822 | 822 | $result = $this->account->metamatter_change(RPG_PURCHASE_CANCEL, -$payment['payment_dark_matter_gained'], $payment['payment_comment']); |
| 823 | - if(!$result) { |
|
| 823 | + if (!$result) { |
|
| 824 | 824 | throw new exception('Ошибка начисления ММ', SN_METAMATTER_ERROR_ADJUST); |
| 825 | 825 | } |
| 826 | 826 | } |
| 827 | 827 | $payment['payment_status'] = PAYMENT_STATUS_CANCELED; |
| 828 | 828 | doquery("UPDATE {{payment}} SET payment_status = {$payment['payment_status']}, payment_comment = '{$safe_comment}' WHERE payment_id = {$payment['payment_id']};"); |
| 829 | 829 | throw new exception($lang['pay_msg_request_payment_cancel_complete'], SN_PAYMENT_REQUEST_OK); |
| 830 | - } elseif($payment['payment_status'] == PAYMENT_STATUS_CANCELED) { |
|
| 830 | + } elseif ($payment['payment_status'] == PAYMENT_STATUS_CANCELED) { |
|
| 831 | 831 | throw new exception($lang['pay_msg_request_payment_cancelled_already'], SN_PAYMENT_REQUEST_OK); |
| 832 | - } elseif($payment['payment_status'] == PAYMENT_STATUS_NONE) { |
|
| 832 | + } elseif ($payment['payment_status'] == PAYMENT_STATUS_NONE) { |
|
| 833 | 833 | throw new exception($lang['pay_msg_request_payment_cancel_not_complete'], SN_PAYMENT_REQUEST_PAYMENT_NOT_COMPLETE); |
| 834 | 834 | } |
| 835 | 835 | } |
@@ -843,8 +843,8 @@ discard block |
||
| 843 | 843 | |
| 844 | 844 | protected function db_complete_payment() { |
| 845 | 845 | // TODO - поле payment_processed |
| 846 | - if($this->payment_status == PAYMENT_STATUS_NONE) { |
|
| 847 | - if(!defined('PAYMENT_EXPIRE_TIME') || PAYMENT_EXPIRE_TIME == 0 || empty($this->payment_date) || strtotime($this->payment_date) + PAYMENT_EXPIRE_TIME <= SN_TIME_NOW) { |
|
| 846 | + if ($this->payment_status == PAYMENT_STATUS_NONE) { |
|
| 847 | + if (!defined('PAYMENT_EXPIRE_TIME') || PAYMENT_EXPIRE_TIME == 0 || empty($this->payment_date) || strtotime($this->payment_date) + PAYMENT_EXPIRE_TIME <= SN_TIME_NOW) { |
|
| 848 | 848 | $this->payment_adjust_mm_new(); |
| 849 | 849 | $this->payment_status = PAYMENT_STATUS_COMPLETE; |
| 850 | 850 | } else { |
@@ -891,7 +891,7 @@ discard block |
||
| 891 | 891 | protected function db_assign_payment($payment = null) { |
| 892 | 892 | $this->payment_reset(); |
| 893 | 893 | |
| 894 | - if(is_array($payment) && isset($payment['payment_id'])) { |
|
| 894 | + if (is_array($payment) && isset($payment['payment_id'])) { |
|
| 895 | 895 | $this->payment_id = $payment['payment_id']; |
| 896 | 896 | $this->payment_status = $payment['payment_status']; |
| 897 | 897 | $this->payment_date = $payment['payment_date']; |
@@ -86,87 +86,87 @@ |
||
| 86 | 86 | |
| 87 | 87 | // Services -------------------------------------------------------------------------------------------------------- |
| 88 | 88 | // Default db |
| 89 | - $gc->db = function (GlobalContainer $c) { |
|
| 89 | + $gc->db = function(GlobalContainer $c) { |
|
| 90 | 90 | SN::$db = new \db_mysql($c); |
| 91 | 91 | |
| 92 | 92 | return SN::$db; |
| 93 | 93 | }; |
| 94 | 94 | |
| 95 | - $gc->debug = function (/** @noinspection PhpUnusedParameterInspection */ |
|
| 95 | + $gc->debug = function(/** @noinspection PhpUnusedParameterInspection */ |
|
| 96 | 96 | GlobalContainer $c) { |
| 97 | 97 | return new \debug(); |
| 98 | 98 | }; |
| 99 | 99 | |
| 100 | - $gc->cache = function (GlobalContainer $gc) { |
|
| 100 | + $gc->cache = function(GlobalContainer $gc) { |
|
| 101 | 101 | return new \classCache($gc->cachePrefix); |
| 102 | 102 | }; |
| 103 | 103 | |
| 104 | - $gc->config = function (GlobalContainer $gc) { |
|
| 104 | + $gc->config = function(GlobalContainer $gc) { |
|
| 105 | 105 | return new \classConfig($gc->cachePrefix); |
| 106 | 106 | }; |
| 107 | 107 | |
| 108 | 108 | |
| 109 | - $gc->repository = function (GlobalContainer $gc) { |
|
| 109 | + $gc->repository = function(GlobalContainer $gc) { |
|
| 110 | 110 | return new Repository($gc); |
| 111 | 111 | }; |
| 112 | 112 | |
| 113 | - $gc->storage = function (GlobalContainer $gc) { |
|
| 113 | + $gc->storage = function(GlobalContainer $gc) { |
|
| 114 | 114 | return new \Storage($gc); |
| 115 | 115 | }; |
| 116 | 116 | |
| 117 | - $gc->design = function (GlobalContainer $gc) { |
|
| 117 | + $gc->design = function(GlobalContainer $gc) { |
|
| 118 | 118 | return new \Design($gc); |
| 119 | 119 | }; |
| 120 | 120 | |
| 121 | - $gc->bbCodeParser = function (GlobalContainer $gc) { |
|
| 121 | + $gc->bbCodeParser = function(GlobalContainer $gc) { |
|
| 122 | 122 | return new \BBCodeParser($gc); |
| 123 | 123 | }; |
| 124 | 124 | |
| 125 | - $gc->fleetDispatcher = function (GlobalContainer $gc) { |
|
| 125 | + $gc->fleetDispatcher = function(GlobalContainer $gc) { |
|
| 126 | 126 | return new \FleetDispatcher($gc); |
| 127 | 127 | }; |
| 128 | 128 | |
| 129 | - $gc->watchdog = function (GlobalContainer $gc) { |
|
| 129 | + $gc->watchdog = function(GlobalContainer $gc) { |
|
| 130 | 130 | return new Watchdog($gc); |
| 131 | 131 | }; |
| 132 | 132 | |
| 133 | - $gc->eventBus = function (GlobalContainer $gc) { |
|
| 133 | + $gc->eventBus = function(GlobalContainer $gc) { |
|
| 134 | 134 | return new EventBus($gc); |
| 135 | 135 | }; |
| 136 | 136 | |
| 137 | - $gc->valueStorage = function (GlobalContainer $gc) { |
|
| 137 | + $gc->valueStorage = function(GlobalContainer $gc) { |
|
| 138 | 138 | return new ValueStorage([]); |
| 139 | 139 | }; |
| 140 | 140 | |
| 141 | - $gc->bonusCatalog = function (GlobalContainer $gc) { |
|
| 141 | + $gc->bonusCatalog = function(GlobalContainer $gc) { |
|
| 142 | 142 | return new BonusCatalog($gc); |
| 143 | 143 | }; |
| 144 | 144 | |
| 145 | - $gc->general = function (GlobalContainer $gc) { |
|
| 145 | + $gc->general = function(GlobalContainer $gc) { |
|
| 146 | 146 | return new General($gc); |
| 147 | 147 | }; |
| 148 | 148 | |
| 149 | - $gc->economicHelper = function (GlobalContainer $gc) { |
|
| 149 | + $gc->economicHelper = function(GlobalContainer $gc) { |
|
| 150 | 150 | return new EconomicHelper($gc); |
| 151 | 151 | }; |
| 152 | 152 | |
| 153 | - $gc->playerLevelHelper = function (GlobalContainer $gc) { |
|
| 153 | + $gc->playerLevelHelper = function(GlobalContainer $gc) { |
|
| 154 | 154 | return new PlayerLevelHelper($gc); |
| 155 | 155 | }; |
| 156 | 156 | |
| 157 | 157 | // Dummy objects --------------------------------------------------------------------------------------------------- |
| 158 | - $gc->theUser = function (GlobalContainer $gc) { |
|
| 158 | + $gc->theUser = function(GlobalContainer $gc) { |
|
| 159 | 159 | return new \TheUser($gc); |
| 160 | 160 | }; |
| 161 | 161 | |
| 162 | 162 | |
| 163 | 163 | // Models ---------------------------------------------------------------------------------------------------------- |
| 164 | 164 | $gc->skinEntityClass = \SkinV2::class; |
| 165 | - $gc->skinModel = function (GlobalContainer $gc) { |
|
| 165 | + $gc->skinModel = function(GlobalContainer $gc) { |
|
| 166 | 166 | return new \SkinModel($gc); |
| 167 | 167 | }; |
| 168 | 168 | |
| 169 | - $gc->textModel = function (GlobalContainer $gc) { |
|
| 169 | + $gc->textModel = function(GlobalContainer $gc) { |
|
| 170 | 170 | return new \TextModel($gc); |
| 171 | 171 | }; |
| 172 | 172 | |