@@ -8,7 +8,7 @@ |
||
| 8 | 8 | |
| 9 | 9 | $query = db_user_list_to_celebrate($config->user_birthday_range); |
| 10 | 10 | |
| 11 | - while($row = db_fetch($query)) |
|
| 11 | + while ($row = db_fetch($query)) |
|
| 12 | 12 | { |
| 13 | 13 | $row['username'] = db_escape($row['username']); |
| 14 | 14 | rpg_points_change($row['id'], RPG_BIRTHDAY, $config->user_birthday_gift, "Birthday gift for user {$row['username']} ID {$row['id']} on his birthday on {$row['user_birthday']}. Gift last gaved at {$row['user_birthday_celebrated']}"); |
@@ -1,7 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -function sn_user_birthday_celebrate() |
|
| 4 | -{ |
|
| 3 | +function sn_user_birthday_celebrate() { |
|
| 5 | 4 | global $config, $lang; |
| 6 | 5 | |
| 7 | 6 | sn_db_transaction_start(); |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | print($round); |
| 28 | 28 | print('<table border=1>'); |
| 29 | 29 | print('<tr align="left">'); |
| 30 | - foreach($header as $key => $value) |
|
| 30 | + foreach ($header as $key => $value) |
|
| 31 | 31 | { |
| 32 | - if(is_array($value)) |
|
| 32 | + if (is_array($value)) |
|
| 33 | 33 | { |
| 34 | 34 | continue; |
| 35 | 35 | } |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | ); |
| 62 | 62 | |
| 63 | 63 | print('<tr align="right">'); |
| 64 | - foreach($debug_unit_crossfire_result as $key => $value) |
|
| 64 | + foreach ($debug_unit_crossfire_result as $key => $value) |
|
| 65 | 65 | { |
| 66 | - if(is_array($value)) |
|
| 66 | + if (is_array($value)) |
|
| 67 | 67 | { |
| 68 | 68 | continue; |
| 69 | 69 | } |
@@ -1,7 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -function sn_ube_combat_helper_round_header($round) |
|
| 4 | -{ |
|
| 3 | +function sn_ube_combat_helper_round_header($round) { |
|
| 5 | 4 | $header = array( |
| 6 | 5 | 'ИД1', |
| 7 | 6 | 'ИД2', |
@@ -40,13 +39,11 @@ discard block |
||
| 40 | 39 | print('</tr>'); |
| 41 | 40 | } |
| 42 | 41 | |
| 43 | -function sn_ube_combat_helper_round_footer($round = 0) |
|
| 44 | -{ |
|
| 42 | +function sn_ube_combat_helper_round_footer($round = 0) { |
|
| 45 | 43 | print('</table>'); |
| 46 | 44 | } |
| 47 | 45 | |
| 48 | -function sn_ube_combat_helper_round_row(&$debug_unit_crossfire_result) |
|
| 49 | -{ |
|
| 46 | +function sn_ube_combat_helper_round_row(&$debug_unit_crossfire_result) { |
|
| 50 | 47 | $SN = array( |
| 51 | 48 | SHIP_CARGO_SMALL => 'МаТр', SHIP_CARGO_BIG => 'БоТр', SHIP_CARGO_SUPER => 'СуТр', SHIP_CARGO_HYPER => 'ГпТр', |
| 52 | 49 | SHIP_SATTELITE_SOLAR => 'СоСп', |
@@ -17,12 +17,12 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | global $lang; |
| 19 | 19 | |
| 20 | - $TargetAdress = sprintf ($lang['sys_adress_planet'], $fleet_row['fleet_end_galaxy'], $fleet_row['fleet_end_system'], $fleet_row['fleet_end_planet']); |
|
| 20 | + $TargetAdress = sprintf($lang['sys_adress_planet'], $fleet_row['fleet_end_galaxy'], $fleet_row['fleet_end_system'], $fleet_row['fleet_end_planet']); |
|
| 21 | 21 | |
| 22 | 22 | $fleet_array = sys_unit_str2arr($fleet_row['fleet_array']); |
| 23 | 23 | |
| 24 | 24 | $TheMessage = $lang['sys_colo_no_colonizer']; |
| 25 | - if($fleet_array[SHIP_COLONIZER] >= 1) |
|
| 25 | + if ($fleet_array[SHIP_COLONIZER] >= 1) |
|
| 26 | 26 | { |
| 27 | 27 | $TheMessage = $lang['sys_colo_notfree']; |
| 28 | 28 | if (!$mission_data['dst_planet'] || empty($mission_data['dst_planet'])) |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | // Can we colonize more planets? |
| 33 | 33 | $TheMessage = $lang['sys_colo_maxcolo']; |
| 34 | - if($iPlanetCount < get_player_max_colonies($src_user_row)) |
|
| 34 | + if ($iPlanetCount < get_player_max_colonies($src_user_row)) |
|
| 35 | 35 | { |
| 36 | 36 | // Yes, we can colonize |
| 37 | 37 | $TheMessage = $lang['sys_colo_badpos']; |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | if ($NewOwnerPlanet) |
| 43 | 43 | { |
| 44 | 44 | $TheMessage = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_allisok']; |
| 45 | - msg_send_simple_message ( $fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_SPY, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage); |
|
| 45 | + msg_send_simple_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_SPY, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage); |
|
| 46 | 46 | |
| 47 | 47 | $fleet_array[SHIP_COLONIZER]--; |
| 48 | 48 | $fleet_row['fleet_amount']--; |
@@ -10,8 +10,7 @@ |
||
| 10 | 10 | // ---------------------------------------------------------------------------------------------------------------- |
| 11 | 11 | // Mission Case 9: -> Coloniser |
| 12 | 12 | // |
| 13 | -function flt_mission_colonize(&$mission_data) |
|
| 14 | -{ |
|
| 13 | +function flt_mission_colonize(&$mission_data) { |
|
| 15 | 14 | $fleet_row = &$mission_data['fleet']; |
| 16 | 15 | $src_user_row = &$mission_data['src_user']; |
| 17 | 16 | |
@@ -9,28 +9,28 @@ discard block |
||
| 9 | 9 | $avatar_filename = $fullsize_filename = SN_ROOT_PHYSICAL . 'images/avatar/' . $prefix . '_' . $subject_id; |
| 10 | 10 | $avatar_filename .= '.png'; |
| 11 | 11 | $fullsize_filename .= '_full.png'; |
| 12 | - if(sys_get_param_int('avatar_remove')) |
|
| 12 | + if (sys_get_param_int('avatar_remove')) |
|
| 13 | 13 | { |
| 14 | - if(file_exists($avatar_filename) && !unlink($avatar_filename)) |
|
| 14 | + if (file_exists($avatar_filename) && !unlink($avatar_filename)) |
|
| 15 | 15 | { |
| 16 | 16 | throw new Exception($lang['opt_msg_avatar_error_delete'], ERR_ERROR); |
| 17 | 17 | } |
| 18 | 18 | $avatar_field = 0; |
| 19 | 19 | throw new Exception($lang['opt_msg_avatar_removed'], ERR_NONE); |
| 20 | 20 | } |
| 21 | - elseif($_FILES['avatar']['size']) |
|
| 21 | + elseif ($_FILES['avatar']['size']) |
|
| 22 | 22 | { |
| 23 | - if(!in_array($_FILES['avatar']['type'], array('image/gif', 'image/jpeg', 'image/jpg', 'image/pjpeg', 'image/png')) || $_FILES['avatar']['size'] > 204800) |
|
| 23 | + if (!in_array($_FILES['avatar']['type'], array('image/gif', 'image/jpeg', 'image/jpg', 'image/pjpeg', 'image/png')) || $_FILES['avatar']['size'] > 204800) |
|
| 24 | 24 | { |
| 25 | 25 | throw new Exception($lang['opt_msg_avatar_error_unsupported'], ERR_WARNING); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - if($_FILES['avatar']['error']) |
|
| 28 | + if ($_FILES['avatar']['error']) |
|
| 29 | 29 | { |
| 30 | 30 | throw new Exception(sprintf($lang['opt_msg_avatar_error_upload'], $_FILES['avatar']['error']), ERR_ERROR); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - if(!($avatar_image = imagecreatefromstring(file_get_contents($_FILES['avatar']['tmp_name'])))) |
|
| 33 | + if (!($avatar_image = imagecreatefromstring(file_get_contents($_FILES['avatar']['tmp_name'])))) |
|
| 34 | 34 | { |
| 35 | 35 | throw new Exception($lang['opt_msg_avatar_error_unsupported'], ERR_WARNING); |
| 36 | 36 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $avatar_size = getimagesize($_FILES['avatar']['tmp_name']); |
| 39 | 39 | $avatar_max_width = $config-> avatar_max_width; |
| 40 | 40 | $avatar_max_height = $config-> avatar_max_height; |
| 41 | - if($avatar_size[0] > $avatar_max_width || $avatar_size[1] > $avatar_max_height) |
|
| 41 | + if ($avatar_size[0] > $avatar_max_width || $avatar_size[1] > $avatar_max_height) |
|
| 42 | 42 | { |
| 43 | 43 | $aspect_ratio = min($avatar_max_width / $avatar_size[0], $avatar_max_height / $avatar_size[1]); |
| 44 | 44 | $avatar_image_new = imagecreatetruecolor($avatar_size[0] * $aspect_ratio, $avatar_size[0] * $aspect_ratio); |
@@ -47,12 +47,12 @@ discard block |
||
| 47 | 47 | $avatar_image = $avatar_image_new; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - if(file_exists($avatar_filename) && !unlink($avatar_filename)) |
|
| 50 | + if (file_exists($avatar_filename) && !unlink($avatar_filename)) |
|
| 51 | 51 | { |
| 52 | 52 | throw new Exception($lang['opt_msg_avatar_error_delete'], ERR_ERROR); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - if(!imagepng($avatar_image, $avatar_filename, 9)) |
|
| 55 | + if (!imagepng($avatar_image, $avatar_filename, 9)) |
|
| 56 | 56 | { |
| 57 | 57 | throw new Exception($lang['opt_msg_avatar_error_writing'], ERR_ERROR); |
| 58 | 58 | } |
@@ -1,7 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -function sys_avatar_upload($subject_id, &$avatar_field, $prefix = 'avatar') |
|
| 4 | -{ |
|
| 3 | +function sys_avatar_upload($subject_id, &$avatar_field, $prefix = 'avatar') { |
|
| 5 | 4 | global $config, $lang, $user; |
| 6 | 5 | |
| 7 | 6 | try |
@@ -17,8 +16,7 @@ discard block |
||
| 17 | 16 | } |
| 18 | 17 | $avatar_field = 0; |
| 19 | 18 | throw new Exception($lang['opt_msg_avatar_removed'], ERR_NONE); |
| 20 | - } |
|
| 21 | - elseif($_FILES['avatar']['size']) |
|
| 19 | + } elseif($_FILES['avatar']['size']) |
|
| 22 | 20 | { |
| 23 | 21 | if(!in_array($_FILES['avatar']['type'], array('image/gif', 'image/jpeg', 'image/jpg', 'image/pjpeg', 'image/png')) || $_FILES['avatar']['size'] > 204800) |
| 24 | 22 | { |
@@ -61,8 +59,7 @@ discard block |
||
| 61 | 59 | imagedestroy($avatar_image); |
| 62 | 60 | throw new Exception($lang['opt_msg_avatar_uploaded'], ERR_NONE); |
| 63 | 61 | } |
| 64 | - } |
|
| 65 | - catch (Exception $e) |
|
| 62 | + } catch (Exception $e) |
|
| 66 | 63 | { |
| 67 | 64 | return array( |
| 68 | 65 | 'STATUS' => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR, |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | |
| 10 | -function flt_planet_capture(&$fleet_row, &$combat_data) {return sn_function_call('flt_planet_capture', array(&$fleet_row, &$combat_data, &$result));} |
|
| 10 | +function flt_planet_capture(&$fleet_row, &$combat_data) {return sn_function_call('flt_planet_capture', array(&$fleet_row, &$combat_data, &$result)); } |
|
| 11 | 11 | function sn_flt_planet_capture(&$fleet_row, &$combat_data, &$result) { |
| 12 | 12 | return $result; |
| 13 | 13 | } |
@@ -17,11 +17,11 @@ discard block |
||
| 17 | 17 | $destination_user = $mission_data['dst_user']; |
| 18 | 18 | $destination_planet = $mission_data['dst_planet']; |
| 19 | 19 | |
| 20 | - if(!$fleet_row) { |
|
| 20 | + if (!$fleet_row) { |
|
| 21 | 21 | return null; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - if( |
|
| 24 | + if ( |
|
| 25 | 25 | // Нет данных о планете назначения или её владельце |
| 26 | 26 | empty($destination_user) || empty($destination_planet) || !is_array($destination_user) || !is_array($destination_planet) |
| 27 | 27 | || |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | |
| 16 | 16 | $combat_data = sn_ube_report_load(sys_get_param_str('cypher')); |
| 17 | 17 | |
| 18 | - if($combat_data != UBE_REPORT_NOT_FOUND) { |
|
| 18 | + if ($combat_data != UBE_REPORT_NOT_FOUND) { |
|
| 19 | 19 | sn_ube_report_generate($combat_data, $template_result); |
| 20 | 20 | $template = gettemplate('ube_combat_report', $template); |
| 21 | 21 | $template->assign_vars(array( |
@@ -14,14 +14,14 @@ |
||
| 14 | 14 | global $lang, $user, $planetrow; |
| 15 | 15 | |
| 16 | 16 | $tech_tree = array(); |
| 17 | - foreach(get_unit_param('techtree') as $unit_group_id => $unit_list) |
|
| 17 | + foreach (get_unit_param('techtree') as $unit_group_id => $unit_list) |
|
| 18 | 18 | { |
| 19 | 19 | $tech_tree[] = array( |
| 20 | 20 | 'NAME' => $lang['tech'][$unit_group_id], |
| 21 | 21 | 'GROUP_ID' => $unit_group_id, |
| 22 | 22 | ); |
| 23 | 23 | |
| 24 | - foreach($unit_list as $unit_id) |
|
| 24 | + foreach ($unit_list as $unit_id) |
|
| 25 | 25 | { |
| 26 | 26 | $sn_data_unit = get_unit_param($unit_id); |
| 27 | 27 | $level_basic = $sn_data_unit[P_STACKABLE] ? 0 : mrc_get_level($user, $planetrow, $unit_id, false, true); |
@@ -6,8 +6,7 @@ |
||
| 6 | 6 | * version 2.0 copyright (c) 2012 by Gorlum for http://supernova.ws |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -function sn_techtree_view($template = null) |
|
| 10 | -{ |
|
| 9 | +function sn_techtree_view($template = null) { |
|
| 11 | 10 | global $lang, $user, $planetrow; |
| 12 | 11 | |
| 13 | 12 | $tech_tree = array(); |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | $query = db_user_list("`authlevel` > 0 ORDER BY `authlevel` ASC"); |
| 19 | 19 | |
| 20 | 20 | // while($row = db_fetch($query)) |
| 21 | - foreach($query as $row) |
|
| 21 | + foreach ($query as $row) |
|
| 22 | 22 | { |
| 23 | 23 | $template_result['.']['contact'][] = array( |
| 24 | 24 | 'NAME' => $row['username'], |
@@ -4,8 +4,7 @@ |
||
| 4 | 4 | * List of authorities: admin, ops, moders |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | -function sn_contact_view($template = null) |
|
| 8 | -{ |
|
| 7 | +function sn_contact_view($template = null) { |
|
| 9 | 8 | global $template_result, $lang; |
| 10 | 9 | |
| 11 | 10 | $template = gettemplate('contact', $template); |
@@ -15,8 +15,8 @@ discard block |
||
| 15 | 15 | 'factor' => 1.5, |
| 16 | 16 | ), |
| 17 | 17 | P_UNIT_PRODUCTION => array( |
| 18 | - RES_METAL => function ($level, $production_factor, $user, $planet_row) {return 40 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
| 19 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) {return -13 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
| 18 | + RES_METAL => function($level, $production_factor, $user, $planet_row) {return 40 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
| 19 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return -13 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
| 20 | 20 | ), |
| 21 | 21 | P_MINING_IS_MANAGED => true, |
| 22 | 22 | ), |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | 'factor' => 1.6, |
| 34 | 34 | ), |
| 35 | 35 | P_UNIT_PRODUCTION => array( |
| 36 | - RES_CRYSTAL => function ($level, $production_factor, $user, $planet_row) {return 32 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
| 37 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) {return -16 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
| 36 | + RES_CRYSTAL => function($level, $production_factor, $user, $planet_row) {return 32 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
| 37 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return -16 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
| 38 | 38 | ), |
| 39 | 39 | P_MINING_IS_MANAGED => true, |
| 40 | 40 | ), |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | 'factor' => 1.5, |
| 52 | 52 | ), |
| 53 | 53 | P_UNIT_PRODUCTION => array( |
| 54 | - RES_DEUTERIUM => function ($level, $production_factor, $user, $planet_row) {return 10 * $level * pow(1.1, $level) * (0.1 * $production_factor) * (-0.002 * $planet_row["temp_max"] + 1.28);}, |
|
| 55 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) {return -20 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
| 54 | + RES_DEUTERIUM => function($level, $production_factor, $user, $planet_row) {return 10 * $level * pow(1.1, $level) * (0.1 * $production_factor) * (-0.002 * $planet_row["temp_max"] + 1.28); }, |
|
| 55 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return -20 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
| 56 | 56 | ), |
| 57 | 57 | P_MINING_IS_MANAGED => true, |
| 58 | 58 | ), |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | 'factor' => 1.5, |
| 70 | 70 | ), |
| 71 | 71 | P_UNIT_PRODUCTION => array( |
| 72 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) {return ($planet_row["temp_max"] / 5 + 15) * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
| 72 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return ($planet_row["temp_max"] / 5 + 15) * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
| 73 | 73 | ), |
| 74 | 74 | P_MINING_IS_MANAGED => true, |
| 75 | 75 | ), |
@@ -87,8 +87,8 @@ discard block |
||
| 87 | 87 | 'factor' => 1.8, |
| 88 | 88 | ), |
| 89 | 89 | P_UNIT_PRODUCTION => array( |
| 90 | - RES_DEUTERIUM => function ($level, $production_factor, $user, $planet_row) {return -10 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
| 91 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) {return 30 * $level * pow(1.05 + 0.01 * mrc_get_level($user, "", TECH_ENERGY), $level) * (0.1 * $production_factor);}, |
|
| 90 | + RES_DEUTERIUM => function($level, $production_factor, $user, $planet_row) {return -10 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
| 91 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return 30 * $level * pow(1.05 + 0.01 * mrc_get_level($user, "", TECH_ENERGY), $level) * (0.1 * $production_factor); }, |
|
| 92 | 92 | ), |
| 93 | 93 | P_MINING_IS_MANAGED => true, |
| 94 | 94 | ), |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | 'factor' => 2, |
| 106 | 106 | ), |
| 107 | 107 | 'storage' => array( |
| 108 | - RES_METAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level);}, |
|
| 108 | + RES_METAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level); }, |
|
| 109 | 109 | ), |
| 110 | 110 | ), |
| 111 | 111 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | 'factor' => 2, |
| 122 | 122 | ), |
| 123 | 123 | 'storage' => array( |
| 124 | - RES_CRYSTAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level);}, |
|
| 124 | + RES_CRYSTAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level); }, |
|
| 125 | 125 | ), |
| 126 | 126 | ), |
| 127 | 127 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | 'factor' => 2, |
| 138 | 138 | ), |
| 139 | 139 | 'storage' => array( |
| 140 | - RES_DEUTERIUM => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level);}, |
|
| 140 | + RES_DEUTERIUM => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level); }, |
|
| 141 | 141 | ), |
| 142 | 142 | ), |
| 143 | 143 | |