@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
3 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
4 | 4 | { |
5 | 5 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
6 | 6 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
3 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
4 | 4 | { |
5 | 5 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
6 | 6 | } |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | */ |
11 | 11 | // Changing rank for single user |
12 | 12 | $id_user = sys_get_param_id('id_user'); |
13 | -if(isset($_GET['id_rank'])) |
|
13 | +if (isset($_GET['id_rank'])) |
|
14 | 14 | { |
15 | 15 | $id_rank = sys_get_param_int('id_rank'); |
16 | 16 | } |
17 | -if($id_user && isset($id_rank) && $user_admin){ |
|
17 | +if ($id_user && isset($id_rank) && $user_admin) { |
|
18 | 18 | db_user_set_by_id($id_user, "`ally_rank_id` = {$id_rank}"); |
19 | 19 | } |
20 | 20 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | $sort1 = sys_get_param_int('sort1'); |
45 | -if($sort1>5 || $sort1<0) $sort1 = 0; |
|
45 | +if ($sort1 > 5 || $sort1 < 0) $sort1 = 0; |
|
46 | 46 | $sort1s = array( |
47 | 47 | 0 => '`ally_rank_id` %1$s;', |
48 | 48 | 1 => '`username` %1$s;', |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | 'id, username, galaxy, system, planet, onlinetime, ally_rank_id, ally_register_time, total_points'); |
59 | 59 | |
60 | 60 | // while ($userRow = db_fetch($userList)) |
61 | -foreach($userList as $userRow) |
|
61 | +foreach ($userList as $userRow) |
|
62 | 62 | { |
63 | 63 | $i++; |
64 | 64 | if (!isset($ranks[$userRow['ally_rank_id']])) |
@@ -68,17 +68,17 @@ discard block |
||
68 | 68 | |
69 | 69 | if ($ally['ally_owner'] == $userRow['id']) |
70 | 70 | { |
71 | - $ally_range = ($ally['ally_owner_range'])?$ally['ally_owner_range']:$lang['Founder']; |
|
71 | + $ally_range = ($ally['ally_owner_range']) ? $ally['ally_owner_range'] : $lang['Founder']; |
|
72 | 72 | } |
73 | 73 | else |
74 | 74 | { |
75 | - if($user_admin) |
|
75 | + if ($user_admin) |
|
76 | 76 | { |
77 | 77 | $ally_range = '<select onchange="window.location=\'alliance.php?mode=admin&edit=members&id_user=' . $userRow['id'] . '&id_rank=\' + this.value">'; |
78 | 78 | |
79 | - foreach($ranks as $rankID => $rankArray){ |
|
79 | + foreach ($ranks as $rankID => $rankArray) { |
|
80 | 80 | $ally_range .= '<option value="' . $rankID . '"'; |
81 | - if($rankID == $userRow['ally_rank_id']) |
|
81 | + if ($rankID == $userRow['ally_rank_id']) |
|
82 | 82 | $ally_range .= " selected"; |
83 | 83 | $ally_range .= '>' . $rankArray['name']; |
84 | 84 | $ally_range .= '</option>'; |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | } |
93 | 93 | |
94 | 94 | $last_active = time() - $userRow["onlinetime"]; |
95 | - if($user_admin) |
|
95 | + if ($user_admin) |
|
96 | 96 | { |
97 | - if ( $last_active < 60 ) |
|
97 | + if ($last_active < 60) |
|
98 | 98 | { |
99 | 99 | $tmp = "lime>{$lang['On']}"; |
100 | 100 | } |
@@ -105,12 +105,12 @@ discard block |
||
105 | 105 | } |
106 | 106 | elseif ($last_active < 60 * 60 * 24) |
107 | 107 | { |
108 | - $last_active = round( $last_active / (60 * 60)); |
|
108 | + $last_active = round($last_active / (60 * 60)); |
|
109 | 109 | $tmp = "green>{$last_active} {$lang['sys_hrs_short']}"; |
110 | 110 | } |
111 | 111 | else |
112 | 112 | { |
113 | - $last_active = round( $last_active / (60 * 60 * 24)); |
|
113 | + $last_active = round($last_active / (60 * 60 * 24)); |
|
114 | 114 | if ($last_active < 7) |
115 | 115 | { |
116 | 116 | $tmp = "yellow"; |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | } |
129 | 129 | else |
130 | 130 | { |
131 | - if($user_onlinestatus) |
|
131 | + if ($user_onlinestatus) |
|
132 | 132 | { |
133 | - if ( $last_active < 60 * 5 ) |
|
133 | + if ($last_active < 60 * 5) |
|
134 | 134 | { |
135 | 135 | $tmp = "lime>{$lang['On']}"; |
136 | 136 | } |
@@ -34,15 +34,16 @@ discard block |
||
34 | 34 | { |
35 | 35 | $sort2s = "DESC"; |
36 | 36 | $sort2 = 0; |
37 | -} |
|
38 | -else |
|
37 | +} else |
|
39 | 38 | { |
40 | 39 | $sort2s = "ASC"; |
41 | 40 | $sort2 = 1; |
42 | 41 | } |
43 | 42 | |
44 | 43 | $sort1 = sys_get_param_int('sort1'); |
45 | -if($sort1>5 || $sort1<0) $sort1 = 0; |
|
44 | +if($sort1>5 || $sort1<0) { |
|
45 | + $sort1 = 0; |
|
46 | +} |
|
46 | 47 | $sort1s = array( |
47 | 48 | 0 => '`ally_rank_id` %1$s;', |
48 | 49 | 1 => '`username` %1$s;', |
@@ -69,8 +70,7 @@ discard block |
||
69 | 70 | if ($ally['ally_owner'] == $userRow['id']) |
70 | 71 | { |
71 | 72 | $ally_range = ($ally['ally_owner_range'])?$ally['ally_owner_range']:$lang['Founder']; |
72 | - } |
|
73 | - else |
|
73 | + } else |
|
74 | 74 | { |
75 | 75 | if($user_admin) |
76 | 76 | { |
@@ -78,14 +78,14 @@ discard block |
||
78 | 78 | |
79 | 79 | foreach($ranks as $rankID => $rankArray){ |
80 | 80 | $ally_range .= '<option value="' . $rankID . '"'; |
81 | - if($rankID == $userRow['ally_rank_id']) |
|
82 | - $ally_range .= " selected"; |
|
81 | + if($rankID == $userRow['ally_rank_id']) { |
|
82 | + $ally_range .= " selected"; |
|
83 | + } |
|
83 | 84 | $ally_range .= '>' . $rankArray['name']; |
84 | 85 | $ally_range .= '</option>'; |
85 | 86 | } |
86 | 87 | $ally_range .= '</select>'; |
87 | - } |
|
88 | - else |
|
88 | + } else |
|
89 | 89 | { |
90 | 90 | $ally_range = $ranks[$userRow['ally_rank_id']]['name']; |
91 | 91 | } |
@@ -97,53 +97,44 @@ discard block |
||
97 | 97 | if ( $last_active < 60 ) |
98 | 98 | { |
99 | 99 | $tmp = "lime>{$lang['On']}"; |
100 | - } |
|
101 | - elseif ($last_active < 60 * 60) |
|
100 | + } elseif ($last_active < 60 * 60) |
|
102 | 101 | { |
103 | 102 | $last_active = round($last_active / 60); |
104 | 103 | $tmp = "lime>{$last_active} {$lang['sys_min_short']}"; |
105 | - } |
|
106 | - elseif ($last_active < 60 * 60 * 24) |
|
104 | + } elseif ($last_active < 60 * 60 * 24) |
|
107 | 105 | { |
108 | 106 | $last_active = round( $last_active / (60 * 60)); |
109 | 107 | $tmp = "green>{$last_active} {$lang['sys_hrs_short']}"; |
110 | - } |
|
111 | - else |
|
108 | + } else |
|
112 | 109 | { |
113 | 110 | $last_active = round( $last_active / (60 * 60 * 24)); |
114 | 111 | if ($last_active < 7) |
115 | 112 | { |
116 | 113 | $tmp = "yellow"; |
117 | - } |
|
118 | - elseif ($last_active < 30) |
|
114 | + } elseif ($last_active < 30) |
|
119 | 115 | { |
120 | 116 | $tmp = "orange"; |
121 | - } |
|
122 | - else |
|
117 | + } else |
|
123 | 118 | { |
124 | 119 | $tmp = "red"; |
125 | 120 | } |
126 | 121 | $tmp .= ">{$last_active} {$lang['sys_day_short']}"; |
127 | 122 | } |
128 | - } |
|
129 | - else |
|
123 | + } else |
|
130 | 124 | { |
131 | 125 | if($user_onlinestatus) |
132 | 126 | { |
133 | 127 | if ( $last_active < 60 * 5 ) |
134 | 128 | { |
135 | 129 | $tmp = "lime>{$lang['On']}"; |
136 | - } |
|
137 | - elseif ($last_active < 60 * 15) |
|
130 | + } elseif ($last_active < 60 * 15) |
|
138 | 131 | { |
139 | 132 | $tmp = "yellow>{$lang['ali_lessThen15min']}"; |
140 | - } |
|
141 | - else |
|
133 | + } else |
|
142 | 134 | { |
143 | 135 | $tmp = "red>{$lang['Off']}"; |
144 | 136 | } |
145 | - } |
|
146 | - else |
|
137 | + } else |
|
147 | 138 | { |
148 | 139 | $sort1 = max($sort1, 4); |
149 | 140 | $tmp = "orange>-"; |
@@ -23,8 +23,7 @@ |
||
23 | 23 | if($user_request['request_denied']) |
24 | 24 | { |
25 | 25 | $lang['request_text'] = sprintf($lang['ali_req_deny_msg'], $ally['ally_tag'], $user_request['request_text']); |
26 | - } |
|
27 | - else |
|
26 | + } else |
|
28 | 27 | { |
29 | 28 | $lang['request_text'] = sprintf($lang['ali_req_waiting'], $ally['ally_tag']); |
30 | 29 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
3 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
4 | 4 | { |
5 | 5 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
6 | 6 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | sys_redirect('alliance.php'); |
21 | 21 | } |
22 | 22 | |
23 | - if($user_request['request_denied']) |
|
23 | + if ($user_request['request_denied']) |
|
24 | 24 | { |
25 | 25 | $lang['request_text'] = sprintf($lang['ali_req_deny_msg'], $ally['ally_tag'], $user_request['request_text']); |
26 | 26 | } |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | |
44 | 44 | $ally = doquery("SELECT * FROM {{alliance}} WHERE `id` ='{$id_ally}'", true); |
45 | 45 | |
46 | -if(!$ally) |
|
46 | +if (!$ally) |
|
47 | 47 | { |
48 | 48 | messageBox($lang['ali_sys_notFound'], $lang['ali_req_title']); |
49 | 49 | } |
50 | 50 | |
51 | -if($ally['ally_request_notallow']) |
|
51 | +if ($ally['ally_request_notallow']) |
|
52 | 52 | { |
53 | 53 | messageBox($lang['ali_req_not_allowed'], $lang['ali_req_title']); |
54 | 54 | } |
@@ -46,8 +46,7 @@ |
||
46 | 46 | sn_db_transaction_commit(); |
47 | 47 | sys_redirect("galaxy.php?mode=name&galaxy={$uni_galaxy}&system={$uni_system}"); |
48 | 48 | } |
49 | - } |
|
50 | - catch (exception $e) |
|
49 | + } catch (exception $e) |
|
51 | 50 | { |
52 | 51 | sn_db_transaction_rollback(); |
53 | 52 | $template->assign_block_vars('result', array( |
@@ -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 | } |
@@ -18,18 +18,24 @@ discard block |
||
18 | 18 | |
19 | 19 | // Test de coherance de la destination (voir si elle se trouve dans les limites de l'univers connu |
20 | 20 | $errorlist = ''; |
21 | - if (!$galaxy || $galaxy > $config->game_maxGalaxy || $galaxy < 1) |
|
22 | - $errorlist .= $lang['fl_limit_galaxy']; |
|
23 | - if (!$system || $system > $config->game_maxSystem || $system < 1) |
|
24 | - $errorlist .= $lang['fl_limit_system']; |
|
25 | - if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE )) |
|
26 | - $errorlist .= $lang['fl_limit_planet']; |
|
27 | - if ($planetrow['galaxy'] == $galaxy && $planetrow['system'] == $system && $planetrow['planet'] == $planet && $planetrow['planet_type'] == $planet_type) |
|
28 | - $errorlist .= $lang['fl_ownpl_err']; |
|
29 | - if (!$planet_type) |
|
30 | - $errorlist .= $lang['fl_no_planettype']; |
|
31 | - if ($planet_type != PT_PLANET && $planet_type != PT_DEBRIS && $planet_type != PT_MOON) |
|
32 | - $errorlist .= $lang['fl_fleet_err_pl']; |
|
21 | + if (!$galaxy || $galaxy > $config->game_maxGalaxy || $galaxy < 1) { |
|
22 | + $errorlist .= $lang['fl_limit_galaxy']; |
|
23 | + } |
|
24 | + if (!$system || $system > $config->game_maxSystem || $system < 1) { |
|
25 | + $errorlist .= $lang['fl_limit_system']; |
|
26 | + } |
|
27 | + if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE )) { |
|
28 | + $errorlist .= $lang['fl_limit_planet']; |
|
29 | + } |
|
30 | + if ($planetrow['galaxy'] == $galaxy && $planetrow['system'] == $system && $planetrow['planet'] == $planet && $planetrow['planet_type'] == $planet_type) { |
|
31 | + $errorlist .= $lang['fl_ownpl_err']; |
|
32 | + } |
|
33 | + if (!$planet_type) { |
|
34 | + $errorlist .= $lang['fl_no_planettype']; |
|
35 | + } |
|
36 | + if ($planet_type != PT_PLANET && $planet_type != PT_DEBRIS && $planet_type != PT_MOON) { |
|
37 | + $errorlist .= $lang['fl_fleet_err_pl']; |
|
38 | + } |
|
33 | 39 | if (empty($missiontype[$target_mission])) { |
34 | 40 | $errorlist .= $lang['fl_bad_mission']; |
35 | 41 | } |
@@ -56,29 +62,35 @@ discard block |
||
56 | 62 | } |
57 | 63 | } else { |
58 | 64 | if ($TargetPlanet['id_owner']){ |
59 | - if ($target_mission == MT_COLONIZE) |
|
60 | - $errorlist .= $lang['fl_colonized']; |
|
65 | + if ($target_mission == MT_COLONIZE) { |
|
66 | + $errorlist .= $lang['fl_colonized']; |
|
67 | + } |
|
61 | 68 | |
62 | 69 | if ($TargetPlanet['id_owner'] == $planetrow['id_owner']){ |
63 | - if ($target_mission == MT_ATTACK) |
|
64 | - $errorlist .= $lang['fl_no_self_attack']; |
|
65 | - |
|
66 | - if ($target_mission == MT_SPY) |
|
67 | - $errorlist .= $lang['fl_no_self_spy']; |
|
68 | - }else{ |
|
69 | - if ($target_mission == MT_RELOCATE) |
|
70 | - $errorlist .= $lang['fl_only_stay_at_home']; |
|
70 | + if ($target_mission == MT_ATTACK) { |
|
71 | + $errorlist .= $lang['fl_no_self_attack']; |
|
72 | + } |
|
73 | + |
|
74 | + if ($target_mission == MT_SPY) { |
|
75 | + $errorlist .= $lang['fl_no_self_spy']; |
|
76 | + } |
|
77 | + } else{ |
|
78 | + if ($target_mission == MT_RELOCATE) { |
|
79 | + $errorlist .= $lang['fl_only_stay_at_home']; |
|
80 | + } |
|
71 | 81 | } |
72 | - }else{ |
|
82 | + } else{ |
|
73 | 83 | if ($target_mission < MT_COLONIZE){ |
74 | 84 | $errorlist .= $lang['fl_unknow_target']; |
75 | - }else{ |
|
76 | - if ($target_mission == MT_DESTROY) |
|
77 | - $errorlist .= $lang['fl_nomoon']; |
|
85 | + } else{ |
|
86 | + if ($target_mission == MT_DESTROY) { |
|
87 | + $errorlist .= $lang['fl_nomoon']; |
|
88 | + } |
|
78 | 89 | |
79 | 90 | if ($target_mission == MT_RECYCLE){ |
80 | - if($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0) |
|
81 | - $errorlist .= $lang['fl_nodebris']; |
|
91 | + if($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0) { |
|
92 | + $errorlist .= $lang['fl_nodebris']; |
|
93 | + } |
|
82 | 94 | } |
83 | 95 | } |
84 | 96 | } |
@@ -126,8 +138,7 @@ discard block |
||
126 | 138 | $aks = doquery("SELECT * FROM {{aks}} WHERE id = '{$fleet_group}' LIMIT 1;", true); |
127 | 139 | if (!$aks) { |
128 | 140 | $fleet_group = 0; |
129 | - } |
|
130 | - else |
|
141 | + } else |
|
131 | 142 | { |
132 | 143 | $galaxy = $aks['galaxy']; |
133 | 144 | $system = $aks['system']; |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | use Planet\DBStaticPlanet; |
9 | 9 | use Unit\DBStaticUnit; |
10 | 10 | |
11 | -if(SN_IN_FLEET !== true) { |
|
11 | +if (SN_IN_FLEET !== true) { |
|
12 | 12 | $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403); |
13 | 13 | } |
14 | 14 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $errorlist .= $lang['fl_limit_galaxy']; |
28 | 28 | if (!$system || $system > $config->game_maxSystem || $system < 1) |
29 | 29 | $errorlist .= $lang['fl_limit_system']; |
30 | - if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE )) |
|
30 | + if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE)) |
|
31 | 31 | $errorlist .= $lang['fl_limit_planet']; |
32 | 32 | if ($planetrow['galaxy'] == $galaxy && $planetrow['system'] == $system && $planetrow['planet'] == $planet && $planetrow['planet_type'] == $planet_type) |
33 | 33 | $errorlist .= $lang['fl_ownpl_err']; |
@@ -54,35 +54,35 @@ discard block |
||
54 | 54 | $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true); |
55 | 55 | |
56 | 56 | if ($target_mission == MT_EXPLORE) { |
57 | - if ($MaxExpeditions == 0 ) { |
|
57 | + if ($MaxExpeditions == 0) { |
|
58 | 58 | $errorlist .= $lang['fl_expe_notech']; |
59 | - } elseif ($FlyingExpeditions >= $MaxExpeditions ) { |
|
59 | + } elseif ($FlyingExpeditions >= $MaxExpeditions) { |
|
60 | 60 | $errorlist .= $lang['fl_expe_max']; |
61 | 61 | } |
62 | 62 | } else { |
63 | - if ($TargetPlanet['id_owner']){ |
|
63 | + if ($TargetPlanet['id_owner']) { |
|
64 | 64 | if ($target_mission == MT_COLONIZE) |
65 | 65 | $errorlist .= $lang['fl_colonized']; |
66 | 66 | |
67 | - if ($TargetPlanet['id_owner'] == $planetrow['id_owner']){ |
|
67 | + if ($TargetPlanet['id_owner'] == $planetrow['id_owner']) { |
|
68 | 68 | if ($target_mission == MT_ATTACK) |
69 | 69 | $errorlist .= $lang['fl_no_self_attack']; |
70 | 70 | |
71 | 71 | if ($target_mission == MT_SPY) |
72 | 72 | $errorlist .= $lang['fl_no_self_spy']; |
73 | - }else{ |
|
73 | + } else { |
|
74 | 74 | if ($target_mission == MT_RELOCATE) |
75 | 75 | $errorlist .= $lang['fl_only_stay_at_home']; |
76 | 76 | } |
77 | - }else{ |
|
78 | - if ($target_mission < MT_COLONIZE){ |
|
77 | + } else { |
|
78 | + if ($target_mission < MT_COLONIZE) { |
|
79 | 79 | $errorlist .= $lang['fl_unknow_target']; |
80 | - }else{ |
|
80 | + } else { |
|
81 | 81 | if ($target_mission == MT_DESTROY) |
82 | 82 | $errorlist .= $lang['fl_nomoon']; |
83 | 83 | |
84 | - if ($target_mission == MT_RECYCLE){ |
|
85 | - if($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0) |
|
84 | + if ($target_mission == MT_RECYCLE) { |
|
85 | + if ($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0) |
|
86 | 86 | $errorlist .= $lang['fl_nodebris']; |
87 | 87 | } |
88 | 88 | } |
@@ -90,13 +90,13 @@ discard block |
||
90 | 90 | } |
91 | 91 | |
92 | 92 | |
93 | - if(is_object($captainModule = moduleCaptain()) && $captain_id = sys_get_param_id('captain_id')) { |
|
93 | + if (is_object($captainModule = moduleCaptain()) && $captain_id = sys_get_param_id('captain_id')) { |
|
94 | 94 | $captain = $captainModule->unit_captain_get($planetrow['id']); |
95 | 95 | // mrc_get_level($user, $planetrow, UNIT_CAPTAIN, true); |
96 | - if(!$captain) { |
|
96 | + if (!$captain) { |
|
97 | 97 | $errorlist .= $lang['module_unit_captain_error_no_captain']; |
98 | - } elseif($captain['unit_location_type'] == LOC_PLANET) { |
|
99 | - if($target_mission == MT_RELOCATE && ($arriving_captain = mrc_get_level($user, $TargetPlanet, UNIT_CAPTAIN, true))) { |
|
98 | + } elseif ($captain['unit_location_type'] == LOC_PLANET) { |
|
99 | + if ($target_mission == MT_RELOCATE && ($arriving_captain = mrc_get_level($user, $TargetPlanet, UNIT_CAPTAIN, true))) { |
|
100 | 100 | $errorlist .= $lang['module_unit_captain_error_captain_already_bound']; |
101 | 101 | } |
102 | 102 | } else { |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | |
107 | 107 | if ($errorlist) { |
108 | 108 | sn_db_transaction_rollback(); |
109 | - messageBox ("<span class='error'><ul>{$errorlist}</ul></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, false); |
|
109 | + messageBox("<span class='error'><ul>{$errorlist}</ul></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, false); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | // On verifie s'il y a assez de vaisseaux sur la planete ! |
113 | 113 | foreach ($fleetarray as $Ship => $Count) { |
114 | 114 | if ($Count > mrc_get_level($user, $planetrow, $Ship)) { |
115 | - messageBox ("<span class='error'><b>{$lang['fl_fleet_err']}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
115 | + messageBox("<span class='error'><b>{$lang['fl_fleet_err']}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
@@ -120,13 +120,13 @@ discard block |
||
120 | 120 | $fleet_group = max(0, intval($_POST['fleet_group'])); |
121 | 121 | //But is it acs?? |
122 | 122 | //Well all acs fleets must have a fleet code. |
123 | - if($fleet_group) { |
|
123 | + if ($fleet_group) { |
|
124 | 124 | //Also it must be mission type 2 |
125 | 125 | $target_mission = MT_AKS; |
126 | 126 | |
127 | 127 | //The co-ords must be the same as where the acs fleet is going. |
128 | 128 | $target = "g{$galaxy}s{$system}p{$planet}t{$planet_type}"; |
129 | - if($_POST['acs_target_mr'] == $target) { |
|
129 | + if ($_POST['acs_target_mr'] == $target) { |
|
130 | 130 | //ACS attack must exist (if acs fleet has arrived this will also return false (2 checks in 1!!!) |
131 | 131 | $aks = doquery("SELECT * FROM {{aks}} WHERE id = '{$fleet_group}' LIMIT 1;", true); |
132 | 132 | if (!$aks) { |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | } |
143 | 143 | } |
144 | 144 | //Check that a failed acs attack isn't being sent, if it is, make it an attack fleet. |
145 | - if(!$fleet_group && $target_mission == MT_AKS) { |
|
145 | + if (!$fleet_group && $target_mission == MT_AKS) { |
|
146 | 146 | $target_mission = MT_ATTACK; |
147 | 147 | } |
148 | 148 | |
@@ -152,22 +152,21 @@ discard block |
||
152 | 152 | $options = [P_FLEET_ATTACK_SPEED_PERCENT_TENTH => $speed_percent, P_FLEET_ATTACK_FLEET_GROUP => $fleet_group, P_FLEET_ATTACK_RESOURCES_SUM => $StorageNeeded]; |
153 | 153 | $cant_attack = flt_can_attack($planetrow, $TargetPlanet, $fleetarray, $target_mission, $options); |
154 | 154 | |
155 | - if($cant_attack !== ATTACK_ALLOWED) { |
|
155 | + if ($cant_attack !== ATTACK_ALLOWED) { |
|
156 | 156 | messageBox("<span class='error'><b>{$lang['fl_attack_error'][$cant_attack]}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 99); |
157 | 157 | } |
158 | 158 | |
159 | 159 | $speed_possible = array(10, 9, 8, 7, 6, 5, 4, 3, 2, 1); |
160 | 160 | if (!in_array($speed_percent, $speed_possible)) { |
161 | - messageBox ("<span class='error'><b>". $lang['fl_cheat_speed'] ."</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
161 | + messageBox("<span class='error'><b>" . $lang['fl_cheat_speed'] . "</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | $fleet['start_time'] = $duration + SN_TIME_NOW; |
165 | 165 | |
166 | - $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) : |
|
167 | - ($target_mission == MT_HOLD ? 12 : 0); |
|
168 | - if($max_duration) { |
|
166 | + $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) : ($target_mission == MT_HOLD ? 12 : 0); |
|
167 | + if ($max_duration) { |
|
169 | 168 | $StayDuration = sys_get_param_id('missiontime'); |
170 | - if($StayDuration > $max_duration || $StayDuration < 1) { |
|
169 | + if ($StayDuration > $max_duration || $StayDuration < 1) { |
|
171 | 170 | $debug->warning('Supplying wrong mission time', 'Hack attempt', 302, array('base_dump' => true)); |
172 | 171 | die(); |
173 | 172 | } |
@@ -177,11 +176,11 @@ discard block |
||
177 | 176 | $StayDuration = 0; |
178 | 177 | $StayTime = 0; |
179 | 178 | } |
180 | - $fleet['end_time'] = $StayDuration + (2 * $duration) + SN_TIME_NOW; |
|
179 | + $fleet['end_time'] = $StayDuration + (2 * $duration) + SN_TIME_NOW; |
|
181 | 180 | |
182 | - if($aks && $target_mission == MT_AKS) { |
|
183 | - if ($fleet['start_time']>$aks['ankunft']) { |
|
184 | - messageBox ($lang['fl_aks_too_slow'] . 'Fleet arrival: ' . date(FMT_DATE_TIME,$fleet['start_time']) . " AKS arrival: " .date(FMT_DATE_TIME,$aks['ankunft']), $lang['fl_error']); |
|
181 | + if ($aks && $target_mission == MT_AKS) { |
|
182 | + if ($fleet['start_time'] > $aks['ankunft']) { |
|
183 | + messageBox($lang['fl_aks_too_slow'] . 'Fleet arrival: ' . date(FMT_DATE_TIME, $fleet['start_time']) . " AKS arrival: " . date(FMT_DATE_TIME, $aks['ankunft']), $lang['fl_error']); |
|
185 | 184 | } |
186 | 185 | $fleet['start_time'] = $aks['ankunft']; |
187 | 186 | $fleet['end_time'] = $aks['ankunft'] + $duration; |
@@ -191,21 +190,21 @@ discard block |
||
191 | 190 | $FleetShipCount = 0; |
192 | 191 | $db_changeset = array(); |
193 | 192 | foreach ($fleetarray as $Ship => $Count) { |
194 | - $FleetStorage += get_unit_param($Ship, P_CAPACITY) * $Count; |
|
193 | + $FleetStorage += get_unit_param($Ship, P_CAPACITY) * $Count; |
|
195 | 194 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($Ship, -$Count, $user, $planetrow['id']); |
196 | 195 | } |
197 | 196 | $fleet_array = sys_unit_arr2str($fleetarray); |
198 | - $FleetShipCount += array_sum($fleetarray); |
|
199 | - $FleetStorage -= $consumption; |
|
197 | + $FleetShipCount += array_sum($fleetarray); |
|
198 | + $FleetStorage -= $consumption; |
|
200 | 199 | |
201 | - if ( $StorageNeeded > $FleetStorage) { |
|
202 | - messageBox ("<span class='error'><b>". $lang['fl_nostoragespa'] . HelperString::numberFloorAndFormat($StorageNeeded - $FleetStorage) ."</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
200 | + if ($StorageNeeded > $FleetStorage) { |
|
201 | + messageBox("<span class='error'><b>" . $lang['fl_nostoragespa'] . HelperString::numberFloorAndFormat($StorageNeeded - $FleetStorage) . "</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
203 | 202 | } |
204 | 203 | if ($planetrow['deuterium'] < $TransDeuterium + $consumption) { |
205 | - messageBox ("<font color=\"red\"><b>". $lang['fl_no_deuterium'] . HelperString::numberFloorAndFormat($TransDeuterium + $consumption - $planetrow['deuterium']) ."</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
204 | + messageBox("<font color=\"red\"><b>" . $lang['fl_no_deuterium'] . HelperString::numberFloorAndFormat($TransDeuterium + $consumption - $planetrow['deuterium']) . "</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
206 | 205 | } |
207 | 206 | if (($planetrow['metal'] < $TransMetal) || ($planetrow['crystal'] < $TransCrystal)) { |
208 | - messageBox ("<font color=\"red\"><b>". $lang['fl_no_resources'] ."</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
207 | + messageBox("<font color=\"red\"><b>" . $lang['fl_no_resources'] . "</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
209 | 208 | } |
210 | 209 | |
211 | 210 | $fleet_set = array( |
@@ -247,7 +246,7 @@ discard block |
||
247 | 246 | // )); |
248 | 247 | // } |
249 | 248 | |
250 | - if(is_array($captain)) { |
|
249 | + if (is_array($captain)) { |
|
251 | 250 | DBStaticUnit::db_unit_set_by_id($captain['unit_id'], "`unit_location_type` = " . LOC_FLEET . ", `unit_location_id` = {$fleet_id}"); |
252 | 251 | } |
253 | 252 | |
@@ -260,7 +259,7 @@ discard block |
||
260 | 259 | 'START_LEFT' => floor($fleet['end_time'] + 1 - SN_TIME_NOW), |
261 | 260 | ); |
262 | 261 | |
263 | - if(!empty($TargetPlanet)) { |
|
262 | + if (!empty($TargetPlanet)) { |
|
264 | 263 | $template_route += array( |
265 | 264 | 'END_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$TargetPlanet['planet_type']], |
266 | 265 | 'END_COORDS' => uni_render_coordinates($TargetPlanet), |
@@ -273,8 +272,8 @@ discard block |
||
273 | 272 | $template->assign_block_vars('fleets', $template_route); |
274 | 273 | |
275 | 274 | $sn_groups_fleet = sn_get_groups('fleet'); |
276 | - foreach($fleetarray as $ship_id => $ship_count) { |
|
277 | - if(in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
275 | + foreach ($fleetarray as $ship_id => $ship_count) { |
|
276 | + if (in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
278 | 277 | // $ship_base_data = get_ship_data($ship_id, $user); |
279 | 278 | $template->assign_block_vars('fleets.ships', array( |
280 | 279 | 'ID' => $ship_id, |
@@ -79,8 +79,7 @@ |
||
79 | 79 | |
80 | 80 | sn_db_transaction_commit(); |
81 | 81 | throw new Exception($info_action, ERR_NONE); |
82 | - } |
|
83 | - catch (Exception $e) |
|
82 | + } catch (Exception $e) |
|
84 | 83 | { |
85 | 84 | sn_db_transaction_rollback(); |
86 | 85 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) |
|
3 | +if (!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) |
|
4 | 4 | { |
5 | 5 | $debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403); |
6 | 6 | } |
@@ -15,50 +15,50 @@ discard block |
||
15 | 15 | )); |
16 | 16 | |
17 | 17 | $info_action = sys_get_param_int('action'); |
18 | -if($info_action) |
|
18 | +if ($info_action) |
|
19 | 19 | { |
20 | 20 | try |
21 | 21 | { |
22 | 22 | sn_db_transaction_start(); |
23 | 23 | |
24 | 24 | $user = db_user_by_id($user['id'], true); |
25 | - if(mrc_get_level($user, null, RES_DARK_MATTER) < $config->rpg_cost_info) |
|
25 | + if (mrc_get_level($user, null, RES_DARK_MATTER) < $config->rpg_cost_info) |
|
26 | 26 | { |
27 | 27 | throw new Exception(MARKET_NO_DM, ERR_ERROR); |
28 | 28 | } |
29 | 29 | |
30 | - switch($info_action) |
|
30 | + switch ($info_action) |
|
31 | 31 | { |
32 | 32 | case MARKET_INFO_PLAYER: |
33 | 33 | $user_info_name_unsafe = sys_get_param_str_unsafe('user_info_name'); |
34 | - if(!$user_info_name_unsafe) |
|
34 | + if (!$user_info_name_unsafe) |
|
35 | 35 | { |
36 | 36 | throw new Exception(MARKET_INFO_PLAYER_WRONG, ERR_ERROR); |
37 | 37 | } |
38 | 38 | |
39 | - if(is_id($user_info_name_unsafe)) |
|
39 | + if (is_id($user_info_name_unsafe)) |
|
40 | 40 | { |
41 | 41 | $user_info = db_user_by_id($user_info_name_unsafe, true, '`id`, `username`', true); |
42 | 42 | } |
43 | - if(!is_array($user_info)) |
|
43 | + if (!is_array($user_info)) |
|
44 | 44 | { |
45 | 45 | $user_info = db_user_by_username($user_info_name_unsafe, true); |
46 | 46 | } |
47 | - if(!is_array($user_info)) |
|
47 | + if (!is_array($user_info)) |
|
48 | 48 | { |
49 | 49 | throw new Exception(MARKET_INFO_PLAYER_NOT_FOUND, ERR_ERROR); |
50 | 50 | } |
51 | - if($user_info['id'] == $user['id']) |
|
51 | + if ($user_info['id'] == $user['id']) |
|
52 | 52 | { |
53 | 53 | throw new Exception(MARKET_INFO_PLAYER_SAME, ERR_ERROR); |
54 | 54 | } |
55 | 55 | |
56 | 56 | $msg_text = array(); |
57 | - foreach(sn_get_groups('mercenaries') as $mercenary_id) |
|
57 | + foreach (sn_get_groups('mercenaries') as $mercenary_id) |
|
58 | 58 | { |
59 | 59 | $msg_text[] = "{$lang['tech'][$mercenary_id]} - " . (($mercenary_level = mrc_get_level($user_info, false, $mercenary_id)) ? "{$lang['sys_level']} {$mercenary_level}" : $lang['eco_mrk_info_not_hired']); |
60 | 60 | } |
61 | - if($mercenary_level = mrc_get_level($user_info, false, UNIT_PREMIUM)) |
|
61 | + if ($mercenary_level = mrc_get_level($user_info, false, UNIT_PREMIUM)) |
|
62 | 62 | { |
63 | 63 | $msg_text[] = "{$lang['tech'][UNIT_PREMIUM]} - {$mercenary_level} {$lang['sys_level']}"; |
64 | 64 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | break; |
73 | 73 | } |
74 | 74 | |
75 | - if(!rpg_points_change($user['id'], RPG_MARKET_INFO_MERCENARY, -$config->rpg_cost_info, "Using Black Market page {$lang['eco_mrk_info']} - getting info about user ID {$user_info['id']}")) |
|
75 | + if (!rpg_points_change($user['id'], RPG_MARKET_INFO_MERCENARY, -$config->rpg_cost_info, "Using Black Market page {$lang['eco_mrk_info']} - getting info about user ID {$user_info['id']}")) |
|
76 | 76 | { |
77 | 77 | // TODO: throw new Exception(MARKET_INFO_PLAYER_SAME, ERR_ERROR); |
78 | 78 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if((!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) && (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)) { |
|
3 | +if ((!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) && (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)) { |
|
4 | 4 | $debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403); |
5 | 5 | } |
6 | 6 | |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | |
28 | 28 | // $dm_db_name = pname_resource_name(RES_DARK_MATTER); |
29 | 29 | $exchangeTo = in_array($exchangeTo = sys_get_param_int('exchangeTo'), sn_get_groups('resources_trader')) ? $exchangeTo : 0; |
30 | - if($exchangeTo && is_array($tradeList = $_POST['spend'])) { |
|
30 | + if ($exchangeTo && is_array($tradeList = $_POST['spend'])) { |
|
31 | 31 | $value = 0; |
32 | 32 | $qry = array(); |
33 | 33 | |
34 | 34 | sn_db_transaction_start(); |
35 | - if($planetrow['id_owner']) { |
|
35 | + if ($planetrow['id_owner']) { |
|
36 | 36 | $global_data = sys_o_get_updated($user, $planetrow, SN_TIME_NOW); |
37 | 37 | $planetrow = $global_data['planet']; |
38 | 38 | } |
@@ -41,27 +41,27 @@ discard block |
||
41 | 41 | $user = db_user_by_id($user['id'], true); |
42 | 42 | } |
43 | 43 | |
44 | - foreach(sn_get_groups('resources_trader') as $resource_id) { |
|
44 | + foreach (sn_get_groups('resources_trader') as $resource_id) { |
|
45 | 45 | $amount = floatval($tradeList[$resource_id]); |
46 | - if($amount < 0) { |
|
46 | + if ($amount < 0) { |
|
47 | 47 | $debug->error('Trying to supply negative resource amount on Black Market Page', 'Hack Attempt', 305); |
48 | 48 | } |
49 | 49 | |
50 | - if($resource_id == RES_DARK_MATTER && $exchangeTo == RES_DARK_MATTER) { |
|
50 | + if ($resource_id == RES_DARK_MATTER && $exchangeTo == RES_DARK_MATTER) { |
|
51 | 51 | continue; |
52 | 52 | } |
53 | 53 | |
54 | 54 | $resource_db_name = pname_resource_name($resource_id); |
55 | - if($exchangeTo == RES_DARK_MATTER) { |
|
55 | + if ($exchangeTo == RES_DARK_MATTER) { |
|
56 | 56 | $sign = '+'; |
57 | 57 | $amount = floor($tradeList[RES_DARK_MATTER] / 3 * $rates[RES_DARK_MATTER] / $rates[$resource_id]); |
58 | 58 | $value += $amount; |
59 | 59 | } else { |
60 | 60 | $value += floor($amount * $rates[$resource_id] / $rates[$exchangeTo]); |
61 | - if($resource_id == RES_DARK_MATTER) { |
|
61 | + if ($resource_id == RES_DARK_MATTER) { |
|
62 | 62 | $amount = 0; |
63 | 63 | } else { |
64 | - if(mrc_get_level($user, $planetrow, $resource_id, true) < $amount) { |
|
64 | + if (mrc_get_level($user, $planetrow, $resource_id, true) < $amount) { |
|
65 | 65 | $intError = MARKET_NO_RESOURCES; |
66 | 66 | break; |
67 | 67 | } |
@@ -70,12 +70,12 @@ discard block |
||
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
73 | - if($amount) { |
|
73 | + if ($amount) { |
|
74 | 74 | $qry[] = "`{$resource_db_name}` = `{$resource_db_name}` {$sign} {$amount}"; |
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
78 | - if($exchangeTo != RES_DARK_MATTER) { |
|
78 | + if ($exchangeTo != RES_DARK_MATTER) { |
|
79 | 79 | $amount = floor($value); |
80 | 80 | $exchange_to_db_name = pname_resource_name($exchangeTo); |
81 | 81 | $qry[] = "`{$exchange_to_db_name}` = `{$exchange_to_db_name}` + {$amount}"; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $intError = $value <= 0 ? MARKET_ZERO_DEAL : $intError; |
87 | 87 | $intError = mrc_get_level($user, null, RES_DARK_MATTER) < $operation_cost ? MARKET_NO_DM : $intError; |
88 | 88 | |
89 | - if($intError == MARKET_DEAL) { |
|
89 | + if ($intError == MARKET_DEAL) { |
|
90 | 90 | $qry = implode(', ', $qry); |
91 | 91 | $table = $planetrow['id_owner'] ? 'planets' : 'users'; |
92 | 92 | |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | 'EXCHANGE_TO_RESOURCE_ID' => $exchangeTo, |
112 | 112 | )); |
113 | 113 | |
114 | - foreach(sn_get_groups('resources_trader') as $resource_id) { |
|
115 | - if($resource_id == RES_DARK_MATTER) { |
|
114 | + foreach (sn_get_groups('resources_trader') as $resource_id) { |
|
115 | + if ($resource_id == RES_DARK_MATTER) { |
|
116 | 116 | $amount = floor(mrc_get_level($user, null, RES_DARK_MATTER) - $config->rpg_cost_trader); |
117 | 117 | } else { |
118 | 118 | $amount = floor(mrc_get_level($user, $planetrow, $resource_id)); |
@@ -35,8 +35,7 @@ |
||
35 | 35 | if($planetrow['id_owner']) { |
36 | 36 | $global_data = sys_o_get_updated($user, $planetrow, SN_TIME_NOW); |
37 | 37 | $planetrow = $global_data['planet']; |
38 | - } |
|
39 | - else { |
|
38 | + } else { |
|
40 | 39 | // Locking user record |
41 | 40 | $user = db_user_by_id($user['id'], true); |
42 | 41 | } |
@@ -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(); |
@@ -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 |