@@ -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 | } |
@@ -27,19 +27,19 @@ discard block |
||
27 | 27 | */ |
28 | 28 | function db_set_make_safe_string($set, $delta = false) { |
29 | 29 | $set_safe = array(); |
30 | - foreach($set as $field => $value) { |
|
31 | - if(empty($field)) { |
|
30 | + foreach ($set as $field => $value) { |
|
31 | + if (empty($field)) { |
|
32 | 32 | continue; |
33 | 33 | } |
34 | 34 | |
35 | 35 | $field = '`' . db_escape($field) . '`'; |
36 | 36 | $new_value = $value; |
37 | - if($value === null) { |
|
37 | + if ($value === null) { |
|
38 | 38 | $new_value = 'NULL'; |
39 | - } elseif(is_string($value) && (string)($new_value = floatval($value)) != (string)$value) { |
|
39 | + } elseif (is_string($value) && (string) ($new_value = floatval($value)) != (string) $value) { |
|
40 | 40 | // non-float |
41 | 41 | $new_value = '"' . db_escape($value) . '"'; |
42 | - } elseif($delta) { |
|
42 | + } elseif ($delta) { |
|
43 | 43 | // float and DELTA-set |
44 | 44 | $new_value = "{$field} + ({$new_value})"; |
45 | 45 | } |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | */ |
60 | 60 | function missile_list_convert_to_fleet(&$missile_db_list, &$fleet_db_list) { |
61 | 61 | // Missile attack |
62 | - foreach($missile_db_list as $irak) { |
|
63 | - if($irak['fleet_end_time'] >= SN_TIME_NOW) { |
|
62 | + foreach ($missile_db_list as $irak) { |
|
63 | + if ($irak['fleet_end_time'] >= SN_TIME_NOW) { |
|
64 | 64 | $irak['fleet_start_type'] = PT_PLANET; |
65 | 65 | $planet_start = DBStaticPlanet::db_planet_by_vector($irak, 'fleet_start_', false, 'name'); |
66 | 66 | $irak['fleet_id'] = -$irak['id']; |
@@ -8,23 +8,23 @@ discard block |
||
8 | 8 | $fleet_events = array(); |
9 | 9 | $fleet_number = 0; |
10 | 10 | |
11 | - if(empty($fleet_list)) |
|
11 | + if (empty($fleet_list)) |
|
12 | 12 | { |
13 | 13 | return; |
14 | 14 | } |
15 | 15 | |
16 | - foreach($fleet_list as $fleet) |
|
16 | + foreach ($fleet_list as $fleet) |
|
17 | 17 | { |
18 | 18 | $planet_start_type = $fleet['fleet_start_type'] == PT_MOON ? PT_MOON : PT_PLANET; |
19 | 19 | $planet_start = DBStaticPlanet::db_planet_by_gspt($fleet['fleet_start_galaxy'], $fleet['fleet_start_system'], $fleet['fleet_start_planet'], $planet_start_type, false, 'name'); |
20 | 20 | $fleet['fleet_start_name'] = $planet_start['name']; |
21 | 21 | |
22 | 22 | $planet_end_type = $fleet['fleet_end_type'] == PT_MOON ? PT_MOON : PT_PLANET; |
23 | - if($fleet['fleet_end_planet'] > $config->game_maxPlanet) |
|
23 | + if ($fleet['fleet_end_planet'] > $config->game_maxPlanet) |
|
24 | 24 | { |
25 | 25 | $fleet['fleet_end_name'] = $lang['ov_fleet_exploration']; |
26 | 26 | } |
27 | - elseif($fleet['fleet_mission'] == MT_COLONIZE) |
|
27 | + elseif ($fleet['fleet_mission'] == MT_COLONIZE) |
|
28 | 28 | { |
29 | 29 | $fleet['fleet_end_name'] = $lang['ov_fleet_colonization']; |
30 | 30 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $fleet['fleet_end_name'] = $planet_end['name']; |
35 | 35 | } |
36 | 36 | |
37 | - if($fleet['fleet_start_time'] > SN_TIME_NOW && $fleet['fleet_mess'] == 0 && $fleet['fleet_mission'] != MT_MISSILE && |
|
37 | + if ($fleet['fleet_start_time'] > SN_TIME_NOW && $fleet['fleet_mess'] == 0 && $fleet['fleet_mission'] != MT_MISSILE && |
|
38 | 38 | ($planet_scanned === false |
39 | 39 | || |
40 | 40 | ( |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | $fleet_events[] = flt_register_fleet_event($fleet, 0, $planet_end_type); |
50 | 50 | } |
51 | 51 | |
52 | - if($fleet['fleet_end_stay'] > SN_TIME_NOW && $fleet['fleet_mess'] == 0 && $planet_scanned === false && $fleet['fleet_mission'] != MT_MISSILE) |
|
52 | + if ($fleet['fleet_end_stay'] > SN_TIME_NOW && $fleet['fleet_mess'] == 0 && $planet_scanned === false && $fleet['fleet_mission'] != MT_MISSILE) |
|
53 | 53 | { |
54 | 54 | $fleet_events[] = flt_register_fleet_event($fleet, 1, $planet_end_type); |
55 | 55 | } |
56 | 56 | |
57 | - if( |
|
57 | + if ( |
|
58 | 58 | $fleet['fleet_end_time'] > SN_TIME_NOW && $fleet['fleet_mission'] != MT_MISSILE && ($fleet['fleet_mess'] == 1 || ($fleet['fleet_mission'] != MT_RELOCATE && $fleet['fleet_mission'] != MT_COLONIZE)) && |
59 | 59 | ( |
60 | 60 | ($planet_scanned === false && $fleet['fleet_owner'] == $user['id']) |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $fleet_events[] = flt_register_fleet_event($fleet, 2, $planet_end_type); |
72 | 72 | } |
73 | 73 | |
74 | - if($fleet['fleet_mission'] == MT_MISSILE) |
|
74 | + if ($fleet['fleet_mission'] == MT_MISSILE) |
|
75 | 75 | { |
76 | 76 | $fleet_events[] = flt_register_fleet_event($fleet, 3, $planet_end_type); |
77 | 77 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | { |
85 | 85 | global $user, $planetrow, $fleet_number; |
86 | 86 | |
87 | - switch($fleet['ov_label'] = $ov_label) |
|
87 | + switch ($fleet['ov_label'] = $ov_label) |
|
88 | 88 | { |
89 | 89 | case 0: |
90 | 90 | $fleet['event_time'] = $fleet['fleet_start_time']; |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | |
117 | 117 | } |
118 | 118 | |
119 | - $fleet['ov_this_planet'] = $is_this_planet;// || $planet_scanned != false; |
|
119 | + $fleet['ov_this_planet'] = $is_this_planet; // || $planet_scanned != false; |
|
120 | 120 | |
121 | - if($fleet['fleet_owner'] == $user['id']) |
|
121 | + if ($fleet['fleet_owner'] == $user['id']) |
|
122 | 122 | { |
123 | 123 | $user_data = $user; |
124 | 124 | } |
@@ -6,12 +6,12 @@ discard block |
||
6 | 6 | $uni_galaxy = sys_get_param_int('galaxy', $planetrow['galaxy']); |
7 | 7 | $uni_system = sys_get_param_int('system'); |
8 | 8 | |
9 | - if($uni_galaxy < 1 || $uni_galaxy > $config->game_maxGalaxy) |
|
9 | + if ($uni_galaxy < 1 || $uni_galaxy > $config->game_maxGalaxy) |
|
10 | 10 | { |
11 | 11 | throw new exception($lang['uni_msg_error_wrong_galaxy'], ERR_ERROR); |
12 | 12 | } |
13 | 13 | |
14 | - if($uni_system < 0 || $uni_system > $config->game_maxSystem) |
|
14 | + if ($uni_system < 0 || $uni_system > $config->game_maxSystem) |
|
15 | 15 | { |
16 | 16 | throw new exception($lang['uni_msg_error_wrong_system'], ERR_ERROR); |
17 | 17 | } |
@@ -20,12 +20,12 @@ discard block |
||
20 | 20 | $uni_row['universe_price'] += $uni_system ? $config->uni_price_system : $config->uni_price_galaxy; |
21 | 21 | $uni_row['universe_name'] = strip_tags($uni_row['universe_name'] ? $uni_row['universe_name'] : ($uni_system ? "{$lang['sys_system']} [{$uni_galaxy}:{$uni_system}]" : "{$lang['sys_galaxy']} {$uni_galaxy}")); |
22 | 22 | |
23 | - if(sys_get_param_str('uni_name_submit')) |
|
23 | + if (sys_get_param_str('uni_name_submit')) |
|
24 | 24 | { |
25 | 25 | $uni_row['universe_name'] = strip_tags(sys_get_param_str('uni_name')); |
26 | 26 | |
27 | 27 | $uni_price = sys_get_param_float('uni_price'); |
28 | - if($uni_price < $uni_row['universe_price']) |
|
28 | + if ($uni_price < $uni_row['universe_price']) |
|
29 | 29 | { |
30 | 30 | throw new exception($lang['uni_msg_error_low_price'], ERR_ERROR); |
31 | 31 | } |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | sn_db_transaction_start(); |
35 | 35 | $user = db_user_by_id($user['id'], true); |
36 | 36 | // if($user[get_unit_param(RES_DARK_MATTER, P_NAME)] < $uni_price) |
37 | - if(mrc_get_level($user, null, RES_DARK_MATTER) < $uni_price) |
|
37 | + if (mrc_get_level($user, null, RES_DARK_MATTER) < $uni_price) |
|
38 | 38 | { |
39 | 39 | throw new exception($lang['uni_msg_error_no_dm'], ERR_ERROR); |
40 | 40 | } |
41 | 41 | |
42 | - if(!rpg_points_change($user['id'], RPG_RENAME, -$uni_price, "Renaming [{$uni_galaxy}:{$uni_system}] to " . sys_get_param_str_unsafe('uni_name'))) |
|
42 | + if (!rpg_points_change($user['id'], RPG_RENAME, -$uni_price, "Renaming [{$uni_galaxy}:{$uni_system}] to " . sys_get_param_str_unsafe('uni_name'))) |
|
43 | 43 | { |
44 | 44 | throw new exception($lang['sys_msg_err_update_dm'], ERR_ERROR); |
45 | 45 | } |
@@ -29,14 +29,14 @@ discard block |
||
29 | 29 | 'planet' => $target_planet = sys_get_param_int('planet'), |
30 | 30 | ); |
31 | 31 | |
32 | -if(!uni_coordinates_valid($target_coord)) |
|
32 | +if (!uni_coordinates_valid($target_coord)) |
|
33 | 33 | { |
34 | 34 | die($lang['gs_c02']); |
35 | 35 | } |
36 | 36 | |
37 | 37 | $target_mission = sys_get_param_int('mission'); |
38 | 38 | $sn_group_missions = sn_get_groups('missions'); |
39 | -if(!isset($sn_group_missions[$target_mission]['AJAX']) || !$sn_group_missions[$target_mission]['AJAX']) |
|
39 | +if (!isset($sn_group_missions[$target_mission]['AJAX']) || !$sn_group_missions[$target_mission]['AJAX']) |
|
40 | 40 | { |
41 | 41 | die($lang['gs_c00']); |
42 | 42 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $target_coord['planet_type'] = $target_planet_check; |
53 | 53 | $target_row = DBStaticPlanet::db_planet_by_vector($target_coord); |
54 | 54 | |
55 | -if(empty($target_row)) |
|
55 | +if (empty($target_row)) |
|
56 | 56 | { |
57 | 57 | $target_row = array( |
58 | 58 | 'galaxy' => $target_coord['galaxy'], |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | } |
65 | 65 | |
66 | 66 | $fleet_array = array(); |
67 | -switch($target_mission) |
|
67 | +switch ($target_mission) |
|
68 | 68 | { |
69 | 69 | case MT_SPY: |
70 | 70 | // $fleet_array[SHIP_SPY] = min(mrc_get_level($user, $planetrow, SHIP_SPY), abs($user['spio_anz'])); |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | break; |
74 | 74 | |
75 | 75 | case MT_RECYCLE: |
76 | - foreach(sn_get_groups('flt_recyclers') as $unit_id) |
|
76 | + foreach (sn_get_groups('flt_recyclers') as $unit_id) |
|
77 | 77 | { |
78 | - if($unit_count = mrc_get_level($user, $planetrow, $unit_id)) |
|
78 | + if ($unit_count = mrc_get_level($user, $planetrow, $unit_id)) |
|
79 | 79 | { |
80 | 80 | $fleet_array[$unit_id] = $unit_count; |
81 | 81 | } |
@@ -96,14 +96,14 @@ discard block |
||
96 | 96 | $cant_attack = flt_can_attack($planetrow, $target_row, $fleet_array, $target_mission, $options); |
97 | 97 | |
98 | 98 | |
99 | -if($cant_attack != ATTACK_ALLOWED) |
|
99 | +if ($cant_attack != ATTACK_ALLOWED) |
|
100 | 100 | { |
101 | 101 | die($lang['fl_attack_error'][$cant_attack]); |
102 | 102 | } |
103 | 103 | |
104 | -$FleetDBArray = array(); |
|
104 | +$FleetDBArray = array(); |
|
105 | 105 | $db_changeset = array(); |
106 | -foreach($fleet_array as $unit_id => $unit_count) |
|
106 | +foreach ($fleet_array as $unit_id => $unit_count) |
|
107 | 107 | { |
108 | 108 | $FleetDBArray[] = "{$unit_id},{$unit_count}"; |
109 | 109 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, -$unit_count, $user, $planetrow); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | $fleet_ship_count = array_sum($fleet_array); |
114 | 114 | |
115 | -if($target_mission == MT_MISSILE) |
|
115 | +if ($target_mission == MT_MISSILE) |
|
116 | 116 | { |
117 | 117 | $distance = abs($target_coord['system'] - $planetrow['system']); |
118 | 118 | $duration = round((30 + (60 * $distance)) / flt_server_flight_speed_multiplier()); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | { |
131 | 131 | $travel_data = flt_travel_data($user, $planetrow, $target_coord, $fleet_array, 10); |
132 | 132 | |
133 | - if($planetrow['deuterium'] < $travel_data['consumption']) |
|
133 | + if ($planetrow['deuterium'] < $travel_data['consumption']) |
|
134 | 134 | { |
135 | 135 | die($lang['gs_c13']); |
136 | 136 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | $ships_sent = array(); |
190 | 190 | //$ships_sent_js = array(); |
191 | 191 | $ships_sent_js = 0; |
192 | -foreach($fleet_array as $unit_id => $unit_count) |
|
192 | +foreach ($fleet_array as $unit_id => $unit_count) |
|
193 | 193 | { |
194 | 194 | $ships_sent[] = "{$unit_count} {$lang['tech'][$unit_id]}"; |
195 | 195 | $ships_sent_js += mrc_get_level($user, $planetrow, $unit_id, false, true); |
@@ -198,6 +198,6 @@ discard block |
||
198 | 198 | //$ships_sent_js = implode(',', $ships_sent_js); |
199 | 199 | $ships_sent_js = "{$unit_group}={$ships_sent_js}"; |
200 | 200 | |
201 | -$ResultMessage = "{$lang['gs_sending']} {$ships_sent} {$lang['gs_to']} {$target_coord['galaxy']}:{$target_coord['system']}:{$target_coord['planet']}|{$ships_sent_js}"; |
|
201 | +$ResultMessage = "{$lang['gs_sending']} {$ships_sent} {$lang['gs_to']} {$target_coord['galaxy']}:{$target_coord['system']}:{$target_coord['planet']}|{$ships_sent_js}"; |
|
202 | 202 | |
203 | 203 | die($ResultMessage); |
@@ -31,7 +31,7 @@ |
||
31 | 31 | QUEST_STATUS_COMPLETE => '', |
32 | 32 | ); |
33 | 33 | |
34 | - if(!isset($statuses[$this->filterQuestStatus])) { |
|
34 | + if (!isset($statuses[$this->filterQuestStatus])) { |
|
35 | 35 | $this->filterQuestStatus = QUEST_STATUS_ALL; |
36 | 36 | } |
37 | 37 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | - if(!isset($next)) { |
|
104 | + if (!isset($next)) { |
|
105 | 105 | $next = new TextEntity(); |
106 | 106 | } |
107 | 107 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $prev = $this->getById($currentText->prev); |
120 | 120 | } |
121 | 121 | |
122 | - if(!isset($prev)) { |
|
122 | + if (!isset($prev)) { |
|
123 | 123 | $prev = new TextEntity(); |
124 | 124 | } |
125 | 125 |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | { |
87 | 87 | global $user; |
88 | 88 | |
89 | - if (file_exists($this->rootPhysical. 'styles/' . $user->theme['template_path'] . '/template')) |
|
89 | + if (file_exists($this->rootPhysical . 'styles/' . $user->theme['template_path'] . '/template')) |
|
90 | 90 | { |
91 | 91 | $this->root = $this->rootPhysical . 'styles/' . $user->theme['template_path'] . '/template'; |
92 | 92 | $this->cachepath = $this->rootPhysical . 'cache/tpl_' . str_replace('_', '-', $user->theme['template_path']) . '_'; |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | // Re-position template blocks |
646 | 646 | for ($i = sizeof($this->_tpldata[$blockname]); $i > $key; $i--) |
647 | 647 | { |
648 | - $this->_tpldata[$blockname][$i] = $this->_tpldata[$blockname][$i-1]; |
|
648 | + $this->_tpldata[$blockname][$i] = $this->_tpldata[$blockname][$i - 1]; |
|
649 | 649 | $this->_tpldata[$blockname][$i]['S_ROW_COUNT'] = $i; |
650 | 650 | } |
651 | 651 | |
@@ -725,13 +725,13 @@ discard block |
||
725 | 725 | */ |
726 | 726 | function assign_recursive($values, $name = '') |
727 | 727 | { |
728 | - if(isset($values['.'])) |
|
728 | + if (isset($values['.'])) |
|
729 | 729 | { |
730 | 730 | $values_extra = $values['.']; |
731 | 731 | unset($values['.']); |
732 | 732 | } |
733 | 733 | |
734 | - if(!$name) |
|
734 | + if (!$name) |
|
735 | 735 | { |
736 | 736 | $this->assign_vars($values); |
737 | 737 | } |
@@ -740,12 +740,12 @@ discard block |
||
740 | 740 | $this->assign_block_vars($name, $values); |
741 | 741 | } |
742 | 742 | |
743 | - if(isset($values_extra)) |
|
743 | + if (isset($values_extra)) |
|
744 | 744 | { |
745 | - foreach($values_extra as $sub_array_name => $sub_array) |
|
745 | + foreach ($values_extra as $sub_array_name => $sub_array) |
|
746 | 746 | { |
747 | 747 | $new_name = $name . ($name ? '.' : '') . $sub_array_name; |
748 | - foreach($sub_array as $sub_element) |
|
748 | + foreach ($sub_array as $sub_element) |
|
749 | 749 | { |
750 | 750 | $this->assign_recursive($sub_element, $new_name); |
751 | 751 | } |