@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | "ally_id = '{$ally_id}'" . ($ally_rank_id >= 0 ? " AND ally_rank_id = {$ally_rank_id}" : ''), |
| 27 | 27 | false, 'id, username'); |
| 28 | 28 | // while ($u = db_fetch($query)) |
| 29 | - foreach($query as $u) |
|
| 29 | + foreach ($query as $u) |
|
| 30 | 30 | { |
| 31 | 31 | $sendList[] = $u['id']; |
| 32 | 32 | $list .= "<br>{$u['username']} "; |
@@ -41,19 +41,19 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | global $config, $user, $sn_message_class_list; |
| 43 | 43 | |
| 44 | - if(!$owners) |
|
| 44 | + if (!$owners) |
|
| 45 | 45 | { |
| 46 | 46 | return; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | $timestamp = $timestamp ? $timestamp : SN_TIME_NOW; |
| 50 | 50 | $sender = intval($sender); |
| 51 | - if(!is_array($owners)) |
|
| 51 | + if (!is_array($owners)) |
|
| 52 | 52 | { |
| 53 | 53 | $owners = array($owners); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - if(!$escaped) |
|
| 56 | + if (!$escaped) |
|
| 57 | 57 | { |
| 58 | 58 | $from = db_escape($from); |
| 59 | 59 | $subject = db_escape($subject); |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | $message_class_name_total = $sn_message_class_list[MSG_TYPE_NEW]['name']; |
| 71 | 71 | |
| 72 | - if($owners[0] == '*') |
|
| 72 | + if ($owners[0] == '*') |
|
| 73 | 73 | { |
| 74 | - if($user['authlevel'] < 3) |
|
| 74 | + if ($user['authlevel'] < 3) |
|
| 75 | 75 | { |
| 76 | 76 | return false; |
| 77 | 77 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | foreach ($owners as $owner) |
| 89 | 89 | { |
| 90 | - if($user['id'] != $owner) |
|
| 90 | + if ($user['id'] != $owner) |
|
| 91 | 91 | { |
| 92 | 92 | $owner_row = db_user_by_id($owner); |
| 93 | 93 | } |
@@ -97,18 +97,18 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | sys_user_options_unpack($owner_row); |
| 99 | 99 | |
| 100 | - if($force || !$message_class_switchable || $owner_row["opt_{$message_class_name}"]) |
|
| 100 | + if ($force || !$message_class_switchable || $owner_row["opt_{$message_class_name}"]) |
|
| 101 | 101 | { |
| 102 | 102 | $insert_values[] = sprintf($insert_template, $owner); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - if($message_class_email && $config->game_email_pm && $owner_row["opt_email_{$message_class_name}"]) |
|
| 105 | + if ($message_class_email && $config->game_email_pm && $owner_row["opt_email_{$message_class_name}"]) |
|
| 106 | 106 | { |
| 107 | 107 | @$result = mymail($owner_row['email'], $subject, $text_unescaped, '', true); |
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - if(empty($insert_values)) |
|
| 111 | + if (empty($insert_values)) |
|
| 112 | 112 | { |
| 113 | 113 | return; |
| 114 | 114 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | db_user_list_set_mass_mail($owners, "`{$message_class_name}` = `{$message_class_name}` + 1, `{$message_class_name_total}` = `{$message_class_name_total}` + 1"); |
| 120 | 120 | |
| 121 | - if(in_array($user['id'], $owners) || $owners[0] == '*') |
|
| 121 | + if (in_array($user['id'], $owners) || $owners[0] == '*') |
|
| 122 | 122 | { |
| 123 | 123 | $user[$message_class_name]++; |
| 124 | 124 | $user[$message_class_name_total]++; |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | function eco_get_planet_caps_modify_production(&$item, $key, $data) { |
| 4 | 4 | static $modifiers; |
| 5 | 5 | |
| 6 | - if(!$modifiers) { |
|
| 6 | + if (!$modifiers) { |
|
| 7 | 7 | $modifiers = sn_get_groups('modifiers'); |
| 8 | 8 | } |
| 9 | 9 | $item = floor(mrc_modify_value($data['user'], $data['planet'], $modifiers[MODIFIER_RESOURCE_PRODUCTION], $item)); |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | static $sn_group_modifiers, $config_resource_multiplier, $config_resource_multiplier_plain, $config_eco_scale_storage; |
| 17 | 17 | |
| 18 | - if(!$sn_group_modifiers) { |
|
| 18 | + if (!$sn_group_modifiers) { |
|
| 19 | 19 | $sn_group_modifiers = sn_get_groups('modifiers'); |
| 20 | 20 | $config_resource_multiplier = game_resource_multiplier(); |
| 21 | 21 | $config_resource_multiplier_plain = game_resource_multiplier(true); |
@@ -26,15 +26,15 @@ discard block |
||
| 26 | 26 | $caps['storage'][RES_METAL][0] = $config->eco_planet_storage_metal; |
| 27 | 27 | $caps['storage'][RES_CRYSTAL][0] = $config->eco_planet_storage_crystal; |
| 28 | 28 | $caps['storage'][RES_DEUTERIUM][0] = $config->eco_planet_storage_deuterium; |
| 29 | - foreach(sn_get_groups('storages') as $unit_id) { |
|
| 30 | - foreach(get_unit_param($unit_id, P_STORAGE) as $resource_id => $function) { |
|
| 29 | + foreach (sn_get_groups('storages') as $unit_id) { |
|
| 30 | + foreach (get_unit_param($unit_id, P_STORAGE) as $resource_id => $function) { |
|
| 31 | 31 | $caps['storage'][$resource_id][$unit_id] = floor($config_eco_scale_storage * |
| 32 | 32 | mrc_modify_value($user, $planet_row, $sn_group_modifiers[MODIFIER_RESOURCE_CAPACITY], $function(mrc_get_level($user, $planet_row, $unit_id))) |
| 33 | 33 | ); |
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - if($planet_row['planet_type'] == PT_MOON) { |
|
| 37 | + if ($planet_row['planet_type'] == PT_MOON) { |
|
| 38 | 38 | return $caps; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -46,12 +46,12 @@ discard block |
||
| 46 | 46 | $caps['production_full'][RES_DEUTERIUM][0] = floor($config->deuterium_basic_income * $config_resource_multiplier * (isset($planet_density[RES_DEUTERIUM]) ? $planet_density[RES_DEUTERIUM] : 1)); |
| 47 | 47 | $caps['production_full'][RES_ENERGY][0] = floor($config->energy_basic_income * $config_resource_multiplier_plain * (isset($planet_density[RES_ENERGY]) ? $planet_density[RES_ENERGY] : 1)); |
| 48 | 48 | |
| 49 | - foreach(sn_get_groups('factories') as $unit_id) { |
|
| 49 | + foreach (sn_get_groups('factories') as $unit_id) { |
|
| 50 | 50 | $unit_data = get_unit_param($unit_id); |
| 51 | 51 | $unit_level = mrc_get_level($user, $planet_row, $unit_id); |
| 52 | 52 | $unit_load = $planet_row[pname_factory_production_field_name($unit_id)]; |
| 53 | 53 | |
| 54 | - foreach($unit_data[P_UNIT_PRODUCTION] as $resource_id => $function) { |
|
| 54 | + foreach ($unit_data[P_UNIT_PRODUCTION] as $resource_id => $function) { |
|
| 55 | 55 | $caps['production_full'][$resource_id][$unit_id] = $function($unit_level, $unit_load, $user, $planet_row) |
| 56 | 56 | * ($resource_id == RES_ENERGY ? $config_resource_multiplier_plain : $config_resource_multiplier) |
| 57 | 57 | * (isset($planet_density[$resource_id]) ? $planet_density[$resource_id] : 1); |
@@ -60,21 +60,21 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | array_walk_recursive($caps['production_full'], 'eco_get_planet_caps_modify_production', array('user' => $user, 'planet' => $planet_row)); |
| 62 | 62 | |
| 63 | - foreach($caps['production_full'] as $resource_id => $resource_data) { |
|
| 63 | + foreach ($caps['production_full'] as $resource_id => $resource_data) { |
|
| 64 | 64 | $caps['total_production_full'][$resource_id] = array_sum($resource_data); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | $caps['production'] = $caps['production_full']; |
| 68 | 68 | |
| 69 | - if($caps['production'][RES_ENERGY][STRUC_MINE_FUSION]) { |
|
| 69 | + if ($caps['production'][RES_ENERGY][STRUC_MINE_FUSION]) { |
|
| 70 | 70 | $deuterium_balance = array_sum($caps['production'][RES_DEUTERIUM]); |
| 71 | 71 | $energy_balance = array_sum($caps['production'][RES_ENERGY]); |
| 72 | - if($deuterium_balance < 0 || $energy_balance < 0) { |
|
| 72 | + if ($deuterium_balance < 0 || $energy_balance < 0) { |
|
| 73 | 73 | $caps['production'][RES_DEUTERIUM][STRUC_MINE_FUSION] = $caps['production'][RES_ENERGY][STRUC_MINE_FUSION] = 0; |
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - foreach($caps['production'][RES_ENERGY] as $energy) { |
|
| 77 | + foreach ($caps['production'][RES_ENERGY] as $energy) { |
|
| 78 | 78 | $caps[RES_ENERGY][$energy >= 0 ? BUILD_CREATE : BUILD_DESTROY] += $energy; |
| 79 | 79 | } |
| 80 | 80 | |
@@ -84,10 +84,10 @@ discard block |
||
| 84 | 84 | ? $caps[RES_ENERGY][BUILD_CREATE] / $caps[RES_ENERGY][BUILD_DESTROY] |
| 85 | 85 | : 1; |
| 86 | 86 | |
| 87 | - foreach($caps['production'] as $resource_id => &$resource_data) { |
|
| 88 | - if($caps['efficiency'] != 1) { |
|
| 89 | - foreach($resource_data as $unit_id => &$resource_production) { |
|
| 90 | - if(!($unit_id == STRUC_MINE_FUSION && $resource_id == RES_DEUTERIUM) && $unit_id != 0 && !($resource_id == RES_ENERGY && $resource_production >= 0)) { |
|
| 87 | + foreach ($caps['production'] as $resource_id => &$resource_data) { |
|
| 88 | + if ($caps['efficiency'] != 1) { |
|
| 89 | + foreach ($resource_data as $unit_id => &$resource_production) { |
|
| 90 | + if (!($unit_id == STRUC_MINE_FUSION && $resource_id == RES_DEUTERIUM) && $unit_id != 0 && !($resource_id == RES_ENERGY && $resource_production >= 0)) { |
|
| 91 | 91 | $resource_production = $resource_production * $caps['efficiency']; |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $caps['total'][$resource_id] = $caps['total'][$resource_id] >= 0 ? floor($caps['total'][$resource_id]) : ceil($caps['total'][$resource_id]); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - foreach($caps['storage'] as $resource_id => &$resource_data) { |
|
| 99 | + foreach ($caps['storage'] as $resource_id => &$resource_data) { |
|
| 100 | 100 | $caps['total_storage'][$resource_id] = array_sum($resource_data); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -8,19 +8,19 @@ discard block |
||
| 8 | 8 | $ts_var_stat_update = strtotime($config->db_loadItem('var_stat_update')); |
| 9 | 9 | $ts_scheduled_update = sys_schedule_get_prev_run($config->db_loadItem('stats_schedule'), $config->var_stat_update); |
| 10 | 10 | |
| 11 | - if(sys_get_param_int('admin_update')) { |
|
| 11 | + if (sys_get_param_int('admin_update')) { |
|
| 12 | 12 | define('USER_LEVEL', isset($user['authlevel']) ? $user['authlevel'] : -1); |
| 13 | - if(USER_LEVEL > 0) { |
|
| 13 | + if (USER_LEVEL > 0) { |
|
| 14 | 14 | $is_admin_request = true; |
| 15 | 15 | $ts_scheduled_update = SN_TIME_NOW; |
| 16 | 16 | } |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - if($ts_scheduled_update > $ts_var_stat_update) { |
|
| 19 | + if ($ts_scheduled_update > $ts_var_stat_update) { |
|
| 20 | 20 | lng_include('admin'); |
| 21 | 21 | sn_db_transaction_start(); |
| 22 | 22 | $ts_var_stat_update_end = strtotime($config->db_loadItem('var_stat_update_end')); |
| 23 | - if(SN_TIME_NOW > $ts_var_stat_update_end) { |
|
| 23 | + if (SN_TIME_NOW > $ts_var_stat_update_end) { |
|
| 24 | 24 | $old_server_status = $config->db_loadItem('game_disable'); |
| 25 | 25 | $config->db_saveItem('game_disable', GAME_DISABLE_STAT); |
| 26 | 26 | |
@@ -56,13 +56,13 @@ discard block |
||
| 56 | 56 | $config->db_saveItem('var_stat_update_end', SN_TIME_SQL); |
| 57 | 57 | |
| 58 | 58 | $config->db_saveItem('game_disable', $old_server_status); |
| 59 | - } elseif($ts_scheduled_update > $ts_var_stat_update) { |
|
| 59 | + } elseif ($ts_scheduled_update > $ts_var_stat_update) { |
|
| 60 | 60 | $timeout = strtotime($config->db_loadItem('var_stat_update_end')) - SN_TIME_NOW; |
| 61 | 61 | $msg = $config->db_loadItem('var_stat_update_msg'); |
| 62 | 62 | $msg = "{$msg} ETA {$timeout} seconds. Please wait..."; |
| 63 | 63 | } |
| 64 | 64 | sn_db_transaction_rollback(); |
| 65 | - } elseif($is_admin_request) { |
|
| 65 | + } elseif ($is_admin_request) { |
|
| 66 | 66 | $msg = 'Stat is up to date'; |
| 67 | 67 | } |
| 68 | 68 | |
@@ -107,23 +107,23 @@ |
||
| 107 | 107 | |
| 108 | 108 | !empty($config->url_faq) ? $msg = str_replace('faq://', $config->url_faq, $msg) : false; |
| 109 | 109 | |
| 110 | - foreach($supernova->design['bbcodes'] as $auth_level => $replaces) { |
|
| 111 | - if($auth_level > $author_auth) { |
|
| 110 | + foreach ($supernova->design['bbcodes'] as $auth_level => $replaces) { |
|
| 111 | + if ($auth_level > $author_auth) { |
|
| 112 | 112 | continue; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - foreach($replaces as $key => $html) { |
|
| 116 | - $msg = preg_replace(''.$key.'', $html, $msg); |
|
| 115 | + foreach ($replaces as $key => $html) { |
|
| 116 | + $msg = preg_replace('' . $key . '', $html, $msg); |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - foreach($supernova->design['smiles'] as $auth_level => $replaces) { |
|
| 121 | - if($auth_level > $author_auth) { |
|
| 120 | + foreach ($supernova->design['smiles'] as $auth_level => $replaces) { |
|
| 121 | + if ($auth_level > $author_auth) { |
|
| 122 | 122 | continue; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - foreach($replaces as $key => $imgName) { |
|
| 126 | - $msg = preg_replace("#" . addcslashes($key, '()[]{}') . "#isU","<img src=\"design/images/smileys/".$imgName.".gif\" align=\"absmiddle\" title=\"".$key."\" alt=\"".$key."\">",$msg); |
|
| 125 | + foreach ($replaces as $key => $imgName) { |
|
| 126 | + $msg = preg_replace("#" . addcslashes($key, '()[]{}') . "#isU", "<img src=\"design/images/smileys/" . $imgName . ".gif\" align=\"absmiddle\" title=\"" . $key . "\" alt=\"" . $key . "\">", $msg); |
|
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | |
@@ -2,16 +2,16 @@ |
||
| 2 | 2 | // Captcha code for registration - really didn't work alot :( |
| 3 | 3 | |
| 4 | 4 | session_start(); |
| 5 | -$en=100; |
|
| 6 | -$boy=25; |
|
| 7 | -$sayi = mt_rand(0,9999999); |
|
| 5 | +$en = 100; |
|
| 6 | +$boy = 25; |
|
| 7 | +$sayi = mt_rand(0, 9999999); |
|
| 8 | 8 | $_SESSION['captcha'] = $sayi; |
| 9 | -$tuval = imagecreatetruecolor($en,$boy); |
|
| 10 | -$b = imagecolorallocate($tuval,175,238,238); |
|
| 11 | -$s = imagecolorallocate($tuval,0,0,0); |
|
| 12 | -imagefill($tuval,0,0,$s); |
|
| 13 | -imageline($tuval,20,50,$en,$boy,$b); |
|
| 14 | -imagestring($tuval,3,27,7,$sayi,$b); |
|
| 9 | +$tuval = imagecreatetruecolor($en, $boy); |
|
| 10 | +$b = imagecolorallocate($tuval, 175, 238, 238); |
|
| 11 | +$s = imagecolorallocate($tuval, 0, 0, 0); |
|
| 12 | +imagefill($tuval, 0, 0, $s); |
|
| 13 | +imageline($tuval, 20, 50, $en, $boy, $b); |
|
| 14 | +imagestring($tuval, 3, 27, 7, $sayi, $b); |
|
| 15 | 15 | Header("content-type:image/gif"); |
| 16 | 16 | imagegif($tuval); |
| 17 | 17 | imagedestroy($tuval); |
@@ -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 | |
@@ -20,12 +20,12 @@ discard block |
||
| 20 | 20 | . '&key=' . urlencode($config->server_updater_key) |
| 21 | 21 | . '&id=' . urlencode($config->server_updater_id); |
| 22 | 22 | */ |
| 23 | -switch($mode) |
|
| 23 | +switch ($mode) |
|
| 24 | 24 | { |
| 25 | 25 | case SNC_MODE_REGISTER: |
| 26 | - if($config->server_updater_key || $config->server_updater_id) |
|
| 26 | + if ($config->server_updater_key || $config->server_updater_id) |
|
| 27 | 27 | { |
| 28 | - if($ajax) |
|
| 28 | + if ($ajax) |
|
| 29 | 29 | { |
| 30 | 30 | print(SNC_VER_REGISTER_ERROR_REGISTERED); |
| 31 | 31 | } |
@@ -38,11 +38,11 @@ discard block |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | $check_result = sn_get_url_contents($url); |
| 41 | -if(!$check_result) |
|
| 41 | +if (!$check_result) |
|
| 42 | 42 | { |
| 43 | 43 | $version_check = SNC_VER_ERROR_CONNECT; |
| 44 | 44 | } |
| 45 | -elseif(($version_check = intval($check_result)) && $version_check == $check_result) |
|
| 45 | +elseif (($version_check = intval($check_result)) && $version_check == $check_result) |
|
| 46 | 46 | { |
| 47 | 47 | $version_check = $check_result; |
| 48 | 48 | } |
@@ -52,10 +52,10 @@ discard block |
||
| 52 | 52 | $check_result = json_decode($check_result, true); |
| 53 | 53 | $version_check = $check_result === null ? SNC_VER_UNKNOWN_RESPONSE : $check_result['version_check']; |
| 54 | 54 | |
| 55 | - switch($mode) |
|
| 55 | + switch ($mode) |
|
| 56 | 56 | { |
| 57 | 57 | case SNC_MODE_REGISTER: |
| 58 | - if($check_result['site']['site_key'] && $check_result['site']['site_id'] && $check_result['site']['result'] == SNC_VER_REGISTER_REGISTERED) |
|
| 58 | + if ($check_result['site']['site_key'] && $check_result['site']['site_id'] && $check_result['site']['result'] == SNC_VER_REGISTER_REGISTERED) |
|
| 59 | 59 | { |
| 60 | 60 | $config->db_saveItem('server_updater_key', $check_result['site']['site_key']); |
| 61 | 61 | $config->db_saveItem('server_updater_id', $check_result['site']['site_id']); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $config->db_saveItem('server_updater_check_last', SN_TIME_NOW); |
| 70 | 70 | $config->db_saveItem('server_updater_check_result', $version_check); |
| 71 | 71 | |
| 72 | -if($ajax) |
|
| 72 | +if ($ajax) |
|
| 73 | 73 | { |
| 74 | 74 | define('IN_AJAX', true); |
| 75 | 75 | print($version_check); |
@@ -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 | } |