@@ -85,28 +85,28 @@ discard block |
||
| 85 | 85 | function rpg_points_change($user_id, $change_type, $dark_matter, $comment = false, $already_changed = false) { |
| 86 | 86 | global $debug, $config, $dm_change_legit, $user; |
| 87 | 87 | |
| 88 | - if(!$user_id) { |
|
| 88 | + if (!$user_id) { |
|
| 89 | 89 | return false; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | $dm_change_legit = true; |
| 93 | 93 | $sn_data_dark_matter_db_name = pname_resource_name(RES_DARK_MATTER); |
| 94 | 94 | |
| 95 | - if($already_changed) { |
|
| 95 | + if ($already_changed) { |
|
| 96 | 96 | $rows_affected = 1; |
| 97 | 97 | } else { |
| 98 | 98 | $changeset = array(); |
| 99 | 99 | $a_user = db_user_by_id($user_id, true); |
| 100 | - if($dark_matter < 0) { |
|
| 100 | + if ($dark_matter < 0) { |
|
| 101 | 101 | $dark_matter_exists = mrc_get_level($a_user, null, RES_DARK_MATTER, false, true); |
| 102 | 102 | $dark_matter_exists < 0 ? $dark_matter_exists = 0 : false; |
| 103 | 103 | $metamatter_to_reduce = -$dark_matter - $dark_matter_exists; |
| 104 | - if($metamatter_to_reduce > 0) { |
|
| 104 | + if ($metamatter_to_reduce > 0) { |
|
| 105 | 105 | $metamatter_exists = mrc_get_level($a_user, null, RES_METAMATTER); |
| 106 | - if($metamatter_exists < $metamatter_to_reduce) { |
|
| 106 | + if ($metamatter_exists < $metamatter_to_reduce) { |
|
| 107 | 107 | $debug->error('Ошибка снятия ТМ - ММ+ТМ меньше, чем сумма для снятия!', 'Ошибка снятия ТМ', LOG_ERR_INT_NOT_ENOUGH_DARK_MATTER); |
| 108 | 108 | } |
| 109 | - if(is_array($comment)) { |
|
| 109 | + if (is_array($comment)) { |
|
| 110 | 110 | $comment = call_user_func_array('sprintf', $comment); |
| 111 | 111 | } |
| 112 | 112 | // mm_points_change($user_id, $change_type, -$metamatter_to_reduce, 'ММ в ТМ: ' . (-$dark_matter) . ' ТМ = ' . $dark_matter_exists . ' ТМ + ' . $metamatter_to_reduce . ' ММ. ' . $comment); |
@@ -121,9 +121,9 @@ discard block |
||
| 121 | 121 | $rows_affected = classSupernova::$db->db_affected_rows(); |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - if($rows_affected || !$dark_matter) { |
|
| 124 | + if ($rows_affected || !$dark_matter) { |
|
| 125 | 125 | $page_url = db_escape($_SERVER['SCRIPT_NAME']); |
| 126 | - if(is_array($comment)) { |
|
| 126 | + if (is_array($comment)) { |
|
| 127 | 127 | $comment = call_user_func_array('sprintf', $comment); |
| 128 | 128 | } |
| 129 | 129 | $comment = db_escape($comment); |
@@ -137,18 +137,18 @@ discard block |
||
| 137 | 137 | {$dark_matter}, '{$comment}', '{$page_url}', {$user_id} |
| 138 | 138 | );"); |
| 139 | 139 | |
| 140 | - if($user['id'] == $user_id) { |
|
| 140 | + if ($user['id'] == $user_id) { |
|
| 141 | 141 | $user['dark_matter'] += $dark_matter; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - if($dark_matter > 0) { |
|
| 144 | + if ($dark_matter > 0) { |
|
| 145 | 145 | $old_referral = doquery("SELECT * FROM {{referrals}} WHERE `id` = {$user_id} LIMIT 1 FOR UPDATE;", '', true); |
| 146 | - if($old_referral['id']) { |
|
| 146 | + if ($old_referral['id']) { |
|
| 147 | 147 | doquery("UPDATE {{referrals}} SET dark_matter = dark_matter + '{$dark_matter}' WHERE `id` = {$user_id} LIMIT 1;"); |
| 148 | 148 | $new_referral = doquery("SELECT * FROM {{referrals}} WHERE `id` = {$user_id} LIMIT 1;", '', true); |
| 149 | 149 | |
| 150 | 150 | $partner_bonus = floor($new_referral['dark_matter'] / $config->rpg_bonus_divisor) - ($old_referral['dark_matter'] >= $config->rpg_bonus_minimum ? floor($old_referral['dark_matter'] / $config->rpg_bonus_divisor) : 0); |
| 151 | - if($partner_bonus > 0 && $new_referral['dark_matter'] >= $config->rpg_bonus_minimum) { |
|
| 151 | + if ($partner_bonus > 0 && $new_referral['dark_matter'] >= $config->rpg_bonus_minimum) { |
|
| 152 | 152 | rpg_points_change($new_referral['id_partner'], RPG_REFERRAL, $partner_bonus, "Incoming From Referral ID {$user_id}"); |
| 153 | 153 | } |
| 154 | 154 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | { |
| 166 | 166 | $q = 1.03; |
| 167 | 167 | |
| 168 | - switch($type) |
|
| 168 | + switch ($type) |
|
| 169 | 169 | { |
| 170 | 170 | case RPG_STRUCTURE: |
| 171 | 171 | $field_level = 'lvl_minier'; |
@@ -203,19 +203,19 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | $xp = &$user[$field_xp]; |
| 205 | 205 | |
| 206 | - if($xp_to_add) |
|
| 206 | + if ($xp_to_add) |
|
| 207 | 207 | { |
| 208 | 208 | $xp += $xp_to_add; |
| 209 | 209 | db_user_set_by_id($user['id'], "`{$field_xp}` = `{$field_xp}` + '{$xp_to_add}'"); |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | $level = $user[$field_level]; |
| 213 | - while($xp > rpg_xp_for_level($level + 1, $b1, $q)) |
|
| 213 | + while ($xp > rpg_xp_for_level($level + 1, $b1, $q)) |
|
| 214 | 214 | { |
| 215 | 215 | $level++; |
| 216 | 216 | } |
| 217 | 217 | $level -= $user[$field_level]; |
| 218 | - if($level > 0) |
|
| 218 | + if ($level > 0) |
|
| 219 | 219 | { |
| 220 | 220 | db_user_set_by_id($user['id'], "`{$field_level}` = `{$field_level}` + '{$level}'"); |
| 221 | 221 | rpg_points_change($user['id'], $type, $level * 1000, $comment); |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | |
| 226 | 226 | function rpg_xp_for_level($level, $b1, $q) |
| 227 | 227 | { |
| 228 | - return floor($b1 * (pow($q, $level) - 1)/($q - 1)); |
|
| 228 | + return floor($b1 * (pow($q, $level) - 1) / ($q - 1)); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | function rpg_get_miner_xp($level) |
@@ -161,8 +161,7 @@ discard block |
||
| 161 | 161 | return $rows_affected; |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | -function rpg_level_up(&$user, $type, $xp_to_add = 0) |
|
| 165 | -{ |
|
| 164 | +function rpg_level_up(&$user, $type, $xp_to_add = 0) { |
|
| 166 | 165 | $q = 1.03; |
| 167 | 166 | |
| 168 | 167 | switch($type) |
@@ -223,27 +222,22 @@ discard block |
||
| 223 | 222 | } |
| 224 | 223 | } |
| 225 | 224 | |
| 226 | -function rpg_xp_for_level($level, $b1, $q) |
|
| 227 | -{ |
|
| 225 | +function rpg_xp_for_level($level, $b1, $q) { |
|
| 228 | 226 | return floor($b1 * (pow($q, $level) - 1)/($q - 1)); |
| 229 | 227 | } |
| 230 | 228 | |
| 231 | -function rpg_get_miner_xp($level) |
|
| 232 | -{ |
|
| 229 | +function rpg_get_miner_xp($level) { |
|
| 233 | 230 | return rpg_xp_for_level($level, 50, 1.03); |
| 234 | 231 | } |
| 235 | 232 | |
| 236 | -function RPG_get_raider_xp($level) |
|
| 237 | -{ |
|
| 233 | +function RPG_get_raider_xp($level) { |
|
| 238 | 234 | return rpg_xp_for_level($level, 10, 1.03); |
| 239 | 235 | } |
| 240 | 236 | |
| 241 | -function rpg_get_tech_xp($level) |
|
| 242 | -{ |
|
| 237 | +function rpg_get_tech_xp($level) { |
|
| 243 | 238 | return rpg_xp_for_level($level, 50, 1.03); |
| 244 | 239 | } |
| 245 | 240 | |
| 246 | -function rpg_get_explore_xp($level) |
|
| 247 | -{ |
|
| 241 | +function rpg_get_explore_xp($level) { |
|
| 248 | 242 | return rpg_xp_for_level($level, 10, 1.05); |
| 249 | 243 | } |
@@ -61,8 +61,7 @@ |
||
| 61 | 61 | 'ALLY_NAME' => htmlentities($row['ally_name'], ENT_COMPAT, 'UTF-8'), |
| 62 | 62 | 'ALLY_TAG' => htmlentities($row['ally_tag'], ENT_COMPAT, 'UTF-8'), |
| 63 | 63 | )); |
| 64 | - } |
|
| 65 | - elseif($type=='ally') |
|
| 64 | + } elseif($type=='ally') |
|
| 66 | 65 | { |
| 67 | 66 | $template->assign_block_vars('search_result', array( |
| 68 | 67 | 'ALLY_NAME' => htmlentities($row['ally_name'], ENT_COMPAT, 'UTF-8'), |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
| 14 | 14 | |
| 15 | -if(classSupernova::$config->game_mode == GAME_BLITZ) { |
|
| 15 | +if (classSupernova::$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, |
@@ -7,8 +7,8 @@ |
||
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -define('INSIDE' , true); |
|
| 11 | -define('INSTALL' , false); |
|
| 10 | +define('INSIDE', true); |
|
| 11 | +define('INSTALL', false); |
|
| 12 | 12 | |
| 13 | 13 | require('common.' . substr(strrchr(__FILE__, '.'), 1)); |
| 14 | 14 | |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
| 4 | 4 | |
| 5 | -if(sys_get_param_int('BE_DEBUG') && !defined('BE_DEBUG')) |
|
| 5 | +if (sys_get_param_int('BE_DEBUG') && !defined('BE_DEBUG')) |
|
| 6 | 6 | { |
| 7 | 7 | define('BE_DEBUG', true); |
| 8 | 8 | } |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | $sym_defender = $_POST['defender'] ? $_POST['defender'] : array(); |
| 16 | 16 | $sym_attacker = $_POST['attacker'] ? $_POST['attacker'] : array(); |
| 17 | 17 | |
| 18 | -if($replay) |
|
| 18 | +if ($replay) |
|
| 19 | 19 | { |
| 20 | 20 | $unpacked = sn_ube_simulator_decode_replay($replay); |
| 21 | 21 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | $sym_attacker = array(1 => $sym_attacker); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | -if($_POST['submit'] || $execute) |
|
| 31 | +if ($_POST['submit'] || $execute) |
|
| 32 | 32 | { |
| 33 | 33 | $replay = sn_ube_simulator_encode_replay($sym_defender, 'D'); |
| 34 | 34 | $replay .= sn_ube_simulator_encode_replay($sym_attacker, 'A'); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | // sn_ube_report_save($combat_data); |
| 43 | 43 | // } |
| 44 | 44 | |
| 45 | - if(sys_get_param_str('reload')) |
|
| 45 | + if (sys_get_param_str('reload')) |
|
| 46 | 46 | { |
| 47 | 47 | $combat_data = sn_ube_report_load($combat_data[UBE_REPORT_CYPHER]); |
| 48 | 48 | } |
@@ -62,9 +62,9 @@ discard block |
||
| 62 | 62 | $template = gettemplate('simulator', true); |
| 63 | 63 | $techs_and_officers = array(TECH_WEAPON, TECH_SHIELD, TECH_ARMOR, MRC_ADMIRAL); |
| 64 | 64 | |
| 65 | - foreach($techs_and_officers as $tech_id) |
|
| 65 | + foreach ($techs_and_officers as $tech_id) |
|
| 66 | 66 | { |
| 67 | - if(!$sym_attacker[1][$tech_id]) |
|
| 67 | + if (!$sym_attacker[1][$tech_id]) |
|
| 68 | 68 | { |
| 69 | 69 | $sym_attacker[1][$tech_id] = mrc_get_level($user, false, $tech_id); |
| 70 | 70 | } |
@@ -78,14 +78,14 @@ discard block |
||
| 78 | 78 | UNIT_GOVERNORS => array(MRC_FORTIFIER), |
| 79 | 79 | UNIT_DEFENCE => sn_get_groups('defense_active'), |
| 80 | 80 | ); |
| 81 | - foreach($show_groups as $unit_group_id => $unit_group) |
|
| 81 | + foreach ($show_groups as $unit_group_id => $unit_group) |
|
| 82 | 82 | { |
| 83 | 83 | $template->assign_block_vars('simulator', array( |
| 84 | 84 | 'GROUP' => $unit_group_id, |
| 85 | 85 | 'NAME' => $lang['tech'][$unit_group_id], |
| 86 | 86 | )); |
| 87 | 87 | |
| 88 | - foreach($unit_group as $unit_id) |
|
| 88 | + foreach ($unit_group as $unit_id) |
|
| 89 | 89 | { |
| 90 | 90 | $tab++; |
| 91 | 91 | |
@@ -21,8 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | $sym_defender = $unpacked['D']; |
| 23 | 23 | $sym_attacker = $unpacked['A']; |
| 24 | -} |
|
| 25 | -else |
|
| 24 | +} else |
|
| 26 | 25 | { |
| 27 | 26 | $sym_defender = array(0 => $sym_defender); |
| 28 | 27 | $sym_attacker = array(1 => $sym_attacker); |
@@ -62,8 +61,7 @@ discard block |
||
| 62 | 61 | )); |
| 63 | 62 | |
| 64 | 63 | display($template); |
| 65 | -} |
|
| 66 | -else |
|
| 64 | +} else |
|
| 67 | 65 | { |
| 68 | 66 | $template = gettemplate('simulator', true); |
| 69 | 67 | $techs_and_officers = array(TECH_WEAPON, TECH_SHIELD, TECH_ARMOR, MRC_ADMIRAL); |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | |
| 16 | 16 | include('includes/init.' . substr(strrchr(__FILE__, '.'), 1)); |
| 17 | 17 | // die(); |
| 18 | -if($template_result[F_USER_IS_AUTHORIZED]) { |
|
| 18 | +if ($template_result[F_USER_IS_AUTHORIZED]) { |
|
| 19 | 19 | sys_redirect('index' . DOT_PHP_EX); |
| 20 | 20 | } |
| 21 | 21 | lng_include('login'); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | $newstock = $stock; |
| 27 | 27 | $intError = MARKET_DEAL; |
| 28 | 28 | |
| 29 | -switch($mode) |
|
| 29 | +switch ($mode) |
|
| 30 | 30 | { |
| 31 | 31 | case MARKET_RESOURCES: // Resource trader |
| 32 | 32 | require('includes/includes/market_trader.inc'); |
@@ -82,12 +82,12 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | $message_id = sys_get_param_int('message'); |
| 85 | -if($message_id != MARKET_NOTHING) |
|
| 85 | +if ($message_id != MARKET_NOTHING) |
|
| 86 | 86 | { |
| 87 | 87 | $template->assign_block_vars('result', array('MESSAGE' => $lang['eco_mrk_errors'][$message_id])); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | -if($message) |
|
| 90 | +if ($message) |
|
| 91 | 91 | { |
| 92 | 92 | $template->assign_block_vars('result', array('MESSAGE' => $message)); |
| 93 | 93 | } |
@@ -140,7 +140,9 @@ |
||
| 140 | 140 | global $template_result; |
| 141 | 141 | // Доступные платежные методы |
| 142 | 142 | foreach($payment_methods_available as $payment_type_id => $payment_methods) { |
| 143 | - if(empty($payment_methods)) continue; |
|
| 143 | + if(empty($payment_methods)) { |
|
| 144 | + continue; |
|
| 145 | + } |
|
| 144 | 146 | |
| 145 | 147 | $template_result['.']['payment'][$payment_type_id] =array( |
| 146 | 148 | 'ID' => $payment_type_id, |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | include_once('common.' . substr(strrchr(__FILE__, '.'), 1)); |
| 10 | 10 | |
| 11 | -if(!sn_module_get_active_count('payment')) { |
|
| 11 | +if (!sn_module_get_active_count('payment')) { |
|
| 12 | 12 | sys_redirect('dark_matter.php'); |
| 13 | 13 | die(); |
| 14 | 14 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | // $player_currency_default = player_load_option($user, PLAYER_OPTION_CURRENCY_DEFAULT); |
| 24 | 24 | $player_currency_default = classSupernova::$user_options[PLAYER_OPTION_CURRENCY_DEFAULT]; |
| 25 | 25 | $player_currency = sys_get_param_str('player_currency', $player_currency_default); |
| 26 | -empty(classSupernova::$lang['pay_currency_list'][$player_currency]) ? ($player_currency = $player_currency_default ? $player_currency_default : classSupernova::$config->payment_currency_default) : false; |
|
| 26 | +empty(classSupernova::$lang['pay_currency_list'][$player_currency]) ? ($player_currency = $player_currency_default ? $player_currency_default : classSupernova::$config->payment_currency_default) : false; |
|
| 27 | 27 | // $player_currency_default != $player_currency ? player_save_option($user, PLAYER_OPTION_CURRENCY_DEFAULT, $player_currency) : false; |
| 28 | 28 | $player_currency_default != $player_currency ? classSupernova::$user_options[PLAYER_OPTION_CURRENCY_DEFAULT] = $player_currency : false; |
| 29 | 29 | |
@@ -65,9 +65,9 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | // Таблица скидок |
| 67 | 67 | $prev_discount = 0; |
| 68 | -if(isset(sn_module_payment::$bonus_table) && is_array(sn_module_payment::$bonus_table)) { |
|
| 69 | - foreach(sn_module_payment::$bonus_table as $sum => $discount) { |
|
| 70 | - if($discount && $discount != $prev_discount) { |
|
| 68 | +if (isset(sn_module_payment::$bonus_table) && is_array(sn_module_payment::$bonus_table)) { |
|
| 69 | + foreach (sn_module_payment::$bonus_table as $sum => $discount) { |
|
| 70 | + if ($discount && $discount != $prev_discount) { |
|
| 71 | 71 | $template->assign_block_vars('discount', array( |
| 72 | 72 | 'SUM' => $sum, |
| 73 | 73 | 'DISCOUNT' => $discount * 100, |
@@ -80,19 +80,19 @@ discard block |
||
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | // Результат платежа |
| 83 | -if($payment_id = sys_get_param_id('payment_id')) { |
|
| 83 | +if ($payment_id = sys_get_param_id('payment_id')) { |
|
| 84 | 84 | $payment = doquery("SELECT * FROM {{payment}} WHERE `payment_id` = {$payment_id} LIMIT 1;", true); |
| 85 | - if($payment && $payment['payment_user_id'] == $user['id']) { |
|
| 86 | - if($payment['payment_status'] == PAYMENT_STATUS_COMPLETE) { |
|
| 85 | + if ($payment && $payment['payment_user_id'] == $user['id']) { |
|
| 86 | + if ($payment['payment_status'] == PAYMENT_STATUS_COMPLETE) { |
|
| 87 | 87 | $template->assign_block_vars('result', array('MESSAGE' => sprintf(classSupernova::$lang['pay_msg_mm_purchase_complete'], $payment['payment_dark_matter_paid'], $payment['payment_module_name'], $payment['payment_dark_matter_gained']))); |
| 88 | 88 | } |
| 89 | - if($payment['payment_status'] == PAYMENT_STATUS_NONE) { |
|
| 89 | + if ($payment['payment_status'] == PAYMENT_STATUS_NONE) { |
|
| 90 | 90 | $template->assign_block_vars('result', array( |
| 91 | 91 | 'MESSAGE' => sprintf(classSupernova::$lang['pay_msg_mm_purchase_incomplete'], $payment['payment_dark_matter_paid'], $payment['payment_module_name']), |
| 92 | 92 | 'STATUS' => 1, |
| 93 | 93 | )); |
| 94 | 94 | } |
| 95 | - if($payment['payment_test']) { |
|
| 95 | + if ($payment['payment_test']) { |
|
| 96 | 96 | $template->assign_block_vars('result', array( |
| 97 | 97 | 'MESSAGE' => sprintf(classSupernova::$lang['pay_msg_mm_purchase_test']), |
| 98 | 98 | 'STATUS' => -1, |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | 'metamatter' => sys_get_param_float('metamatter'), |
| 108 | 108 | ); |
| 109 | 109 | |
| 110 | -if(!$request['metamatter']) { |
|
| 110 | +if (!$request['metamatter']) { |
|
| 111 | 111 | unset($_POST); |
| 112 | 112 | } |
| 113 | 113 | |
@@ -118,16 +118,16 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | $payment_module_valid = false; |
| 120 | 120 | $payment_module = sys_get_param_str('payment_module'); |
| 121 | -foreach($sn_module_list['payment'] as $module_name => $module) { |
|
| 122 | - if(!is_object($module) || !$module->manifest['active']) { |
|
| 121 | +foreach ($sn_module_list['payment'] as $module_name => $module) { |
|
| 122 | + if (!is_object($module) || !$module->manifest['active']) { |
|
| 123 | 123 | continue; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | lng_include($module_name, $module->manifest['root_relative']); |
| 127 | 127 | |
| 128 | - foreach(sn_module_payment::$payment_methods as $payment_type_id => $available_methods) { |
|
| 129 | - foreach($available_methods as $payment_method => $payment_currency) { |
|
| 130 | - if(isset($module->manifest['payment_method'][$payment_method])) { |
|
| 128 | + foreach (sn_module_payment::$payment_methods as $payment_type_id => $available_methods) { |
|
| 129 | + foreach ($available_methods as $payment_method => $payment_currency) { |
|
| 130 | + if (isset($module->manifest['payment_method'][$payment_method])) { |
|
| 131 | 131 | $payment_methods_available[$payment_type_id][$payment_method][$module_name] = $module->manifest['payment_method'][$payment_method]; |
| 132 | 132 | } |
| 133 | 133 | } |
@@ -138,15 +138,15 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | global $template_result; |
| 140 | 140 | // Доступные платежные методы |
| 141 | -foreach($payment_methods_available as $payment_type_id => $payment_methods) { |
|
| 142 | - if(empty($payment_methods)) continue; |
|
| 141 | +foreach ($payment_methods_available as $payment_type_id => $payment_methods) { |
|
| 142 | + if (empty($payment_methods)) continue; |
|
| 143 | 143 | |
| 144 | - $template_result['.']['payment'][$payment_type_id] =array( |
|
| 144 | + $template_result['.']['payment'][$payment_type_id] = array( |
|
| 145 | 145 | 'ID' => $payment_type_id, |
| 146 | 146 | 'NAME' => classSupernova::$lang['pay_methods'][$payment_type_id], |
| 147 | 147 | ); |
| 148 | - foreach($payment_methods as $payment_method_id => $module_list) { |
|
| 149 | - if(empty($module_list)) { |
|
| 148 | + foreach ($payment_methods as $payment_method_id => $module_list) { |
|
| 149 | + if (empty($module_list)) { |
|
| 150 | 150 | continue; |
| 151 | 151 | } |
| 152 | 152 | $template_result['.']['payment'][$payment_type_id]['.']['method'][$payment_method_id] = array( |
@@ -157,14 +157,14 @@ discard block |
||
| 157 | 157 | 'NAME_FORCE' => isset(sn_module_payment::$payment_methods[$payment_type_id][$payment_method_id]['name']), |
| 158 | 158 | 'BUTTON' => isset(sn_module_payment::$payment_methods[$payment_type_id][$payment_method_id]['button']), |
| 159 | 159 | ); |
| 160 | - foreach($module_list as $payment_module_name => $payment_module_method_details) { |
|
| 160 | + foreach ($module_list as $payment_module_name => $payment_module_method_details) { |
|
| 161 | 161 | $template_result['.']['payment'][$payment_type_id]['.']['method'][$payment_method_id]['.']['module'][] = array( |
| 162 | 162 | 'MODULE' => $payment_module_name, |
| 163 | 163 | ); |
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - if(empty($template_result['.']['payment'][$payment_type_id]['.'])) { |
|
| 167 | + if (empty($template_result['.']['payment'][$payment_type_id]['.'])) { |
|
| 168 | 168 | unset($template_result['.']['payment'][$payment_type_id]); |
| 169 | 169 | } |
| 170 | 170 | } |
@@ -177,19 +177,19 @@ discard block |
||
| 177 | 177 | $payment_module_valid = $payment_module_valid && (!$payment_method_selected || isset($payment_methods_available[$payment_type_selected][$payment_method_selected][$module_name])); |
| 178 | 178 | |
| 179 | 179 | // If payment_module invalid - making it empty OR if there is only one payment_module - selecting it |
| 180 | -if($payment_module_valid) { |
|
| 180 | +if ($payment_module_valid) { |
|
| 181 | 181 | // $payment_module = $payment_module; // Really - do nothing |
| 182 | -} elseif($payment_type_selected && count($payment_methods_available[$payment_type_selected][$payment_method_selected]) == 1) { |
|
| 182 | +} elseif ($payment_type_selected && count($payment_methods_available[$payment_type_selected][$payment_method_selected]) == 1) { |
|
| 183 | 183 | reset($payment_methods_available[$payment_type_selected][$payment_method_selected]); |
| 184 | 184 | $payment_module = key($payment_methods_available[$payment_type_selected][$payment_method_selected]); |
| 185 | -} elseif(count($sn_module_list['payment']) == 1) { |
|
| 185 | +} elseif (count($sn_module_list['payment']) == 1) { |
|
| 186 | 186 | $payment_module = $module_name; |
| 187 | 187 | } else { |
| 188 | 188 | $payment_module = ''; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | -if($payment_type_selected && $payment_method_selected) { |
|
| 192 | - foreach($payment_methods_available[$payment_type_selected][$payment_method_selected] as $module_name => $temp) { |
|
| 191 | +if ($payment_type_selected && $payment_method_selected) { |
|
| 192 | + foreach ($payment_methods_available[$payment_type_selected][$payment_method_selected] as $module_name => $temp) { |
|
| 193 | 193 | $template->assign_block_vars('payment_module', array( |
| 194 | 194 | 'ID' => $module_name, |
| 195 | 195 | 'NAME' => classSupernova::$lang["module_{$module_name}_name"], |
@@ -198,9 +198,9 @@ discard block |
||
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | -foreach(classSupernova::$lang['pay_currency_list'] as $key => $value) { |
|
| 201 | +foreach (classSupernova::$lang['pay_currency_list'] as $key => $value) { |
|
| 202 | 202 | $course = get_exchange_rate($key); |
| 203 | - if(!$course) { |
|
| 203 | + if (!$course) { |
|
| 204 | 204 | continue; |
| 205 | 205 | } |
| 206 | 206 | $template->assign_block_vars('exchange', array( |
@@ -214,17 +214,17 @@ discard block |
||
| 214 | 214 | )); |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | -if($request['metamatter'] && $payment_module) { |
|
| 217 | +if ($request['metamatter'] && $payment_module) { |
|
| 218 | 218 | try { |
| 219 | 219 | // Any possible errors about generating paylink should be raised in module! |
| 220 | 220 | $pay_link = $sn_module[$payment_module]->compile_request($request); |
| 221 | 221 | |
| 222 | 222 | // Поддержка дополнительной информации |
| 223 | - if(is_array($pay_link['RENDER'])) { |
|
| 224 | - foreach($pay_link['RENDER'] as $html_data) { |
|
| 223 | + if (is_array($pay_link['RENDER'])) { |
|
| 224 | + foreach ($pay_link['RENDER'] as $html_data) { |
|
| 225 | 225 | $template->assign_block_vars('render', $html_data); |
| 226 | - if(isset($html_data['VALUE']) && is_array($html_data['VALUE'])) { |
|
| 227 | - foreach($html_data['VALUE'] as $value_id => $value_value) { |
|
| 226 | + if (isset($html_data['VALUE']) && is_array($html_data['VALUE'])) { |
|
| 227 | + foreach ($html_data['VALUE'] as $value_id => $value_value) { |
|
| 228 | 228 | $template->assign_block_vars('render.value', array( |
| 229 | 229 | 'FIELD' => $value_id, |
| 230 | 230 | 'VALUE' => $value_value, |
@@ -235,8 +235,8 @@ discard block |
||
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | // Поддержка передачи данных для многошаговых платежных систем |
| 238 | - if(is_array($pay_link['DATA'])) { |
|
| 239 | - foreach($pay_link['DATA'] as $key => $value) { |
|
| 238 | + if (is_array($pay_link['DATA'])) { |
|
| 239 | + foreach ($pay_link['DATA'] as $key => $value) { |
|
| 240 | 240 | $template->assign_block_vars('pay_link_data', array( |
| 241 | 241 | 'FIELD' => $key, |
| 242 | 242 | 'VALUE' => $value, |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - if(is_array($pay_link) && in_array($pay_link['PAY_LINK_METHOD'], array('POST', 'GET', 'LINK', 'STEP'))) { |
|
| 247 | + if (is_array($pay_link) && in_array($pay_link['PAY_LINK_METHOD'], array('POST', 'GET', 'LINK', 'STEP'))) { |
|
| 248 | 248 | // TODO Переделать это под assign_vars_recursive и возвращать пустые строки если нет платежного метода - для унификации формы в темплейте |
| 249 | 249 | $template->assign_vars(array( |
| 250 | 250 | 'PAY_LINK_METHOD' => $pay_link['PAY_LINK_METHOD'], |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | } else { |
| 254 | 254 | throw new exception(classSupernova::$lang['pay_msg_request_paylink_unsupported'], ERR_ERROR); |
| 255 | 255 | } |
| 256 | - } catch(exception $e) { |
|
| 256 | + } catch (exception $e) { |
|
| 257 | 257 | $template->assign_block_vars('result', $response = array( |
| 258 | 258 | 'STATUS' => $e->getCode(), |
| 259 | 259 | 'MESSAGE' => $e->getMessage(), |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | // Прегенерированные пакеты |
| 266 | -foreach($unit_available_amount_list as $unit_amount => $discount) { |
|
| 266 | +foreach ($unit_available_amount_list as $unit_amount => $discount) { |
|
| 267 | 267 | $temp = sn_module_payment::currency_convert($unit_amount, 'MM_', $player_currency); |
| 268 | 268 | $template->assign_block_vars('mm_amount', array( |
| 269 | 269 | 'VALUE' => $unit_amount, |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | 'PLAYER_CURRENCY' => $player_currency, |
| 299 | 299 | 'PLAYER_CURRENCY_PRICE_PER_MM' => sn_module_payment::currency_convert(1, $player_currency, 'MM_', 10), |
| 300 | 300 | |
| 301 | - 'UNIT_AMOUNT' => (float)$request['metamatter'], |
|
| 301 | + 'UNIT_AMOUNT' => (float) $request['metamatter'], |
|
| 302 | 302 | 'UNIT_AMOUNT_TEXT' => HelperString::numberFloorAndFormat($request['metamatter']), |
| 303 | 303 | 'UNIT_AMOUNT_BONUS_PERCENT' => $bonus_percent, |
| 304 | 304 | 'UNIT_AMOUNT_TEXT_DISCOUNTED' => $income_metamatter_text, |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | // OK 4.9 |
| 37 | 37 | public function __construct($filename = __FILE__) { |
| 38 | - if($this->provider_id == ACCOUNT_PROVIDER_NONE) { |
|
| 38 | + if ($this->provider_id == ACCOUNT_PROVIDER_NONE) { |
|
| 39 | 39 | die('У всех провайдеров должен быть $provider_id!'); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | // OK 4.6 |
| 134 | 134 | public function player_name_suggest() { |
| 135 | 135 | $name = ''; |
| 136 | - if(is_object($this->account) && !empty($this->account->account_email)) { |
|
| 136 | + if (is_object($this->account) && !empty($this->account->account_email)) { |
|
| 137 | 137 | list($name) = explode('@', $this->account->account_email); |
| 138 | 138 | } |
| 139 | 139 | |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | // $query = static::$db->doquery("SELECT `id` FROM {{confirmations}} WHERE `code` = '{$confirm_code_safe}' AND `type` = {$confirmation_type_safe} FOR UPDATE", true); |
| 42 | 42 | // Тип не нужен для проверки - код подтверждения должен быть уникален от слова "совсем" |
| 43 | 43 | $query = $this->db->doquery("SELECT `id` FROM {{confirmations}} WHERE `code` = '{$confirm_code_safe}' FOR UPDATE", true); |
| 44 | - } while($query); |
|
| 44 | + } while ($query); |
|
| 45 | 45 | |
| 46 | 46 | $this->db->doquery( |
| 47 | 47 | "REPLACE INTO {{confirmations}} |