@@ -1,13 +1,13 @@ 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 | } |
7 | 7 | |
8 | 8 | $template = gettemplate('ali_info', true); |
9 | 9 | |
10 | -if($mode == 'exit') |
|
10 | +if ($mode == 'exit') |
|
11 | 11 | { |
12 | 12 | if ($ally['ally_owner'] == $user['id']) |
13 | 13 | { |
@@ -24,25 +24,25 @@ discard block |
||
24 | 24 | message(sprintf($lang['ali_info_leave_success'], $ally['ally_name']), $lang['sys_alliance']); |
25 | 25 | } |
26 | 26 | } |
27 | -elseif($mode == 'ainfo') |
|
27 | +elseif ($mode == 'ainfo') |
|
28 | 28 | { |
29 | 29 | $tag = sys_get_param_str('tag'); |
30 | 30 | $id_ally = sys_get_param_id('a'); |
31 | - if($tag) |
|
31 | + if ($tag) |
|
32 | 32 | { |
33 | 33 | $ally = doquery("SELECT * FROM {{alliance}} WHERE ally_tag='{$tag}' LIMIT 1;", '', true); |
34 | 34 | } |
35 | - elseif($id_ally) |
|
35 | + elseif ($id_ally) |
|
36 | 36 | { |
37 | 37 | $ally = doquery("SELECT * FROM {{alliance}} WHERE id='{$id_ally}' LIMIT 1;", '', true); |
38 | 38 | } |
39 | 39 | |
40 | - if(!$ally) |
|
40 | + if (!$ally) |
|
41 | 41 | { |
42 | 42 | message($lang['ali_sys_notFound'], $lang['Ally_info_1']); |
43 | 43 | } |
44 | 44 | |
45 | - if(!$ally['ally_description']) |
|
45 | + if (!$ally['ally_description']) |
|
46 | 46 | { |
47 | 47 | $ally['ally_description'] = $lang['Ally_nodescription']; |
48 | 48 | } |
@@ -51,17 +51,17 @@ discard block |
||
51 | 51 | 'EXTERNAL' => true, |
52 | 52 | 'USER_ALLY_ID' => $user['ally_id'], |
53 | 53 | )); |
54 | - $page_header = $lang['sys_alliance']; |
|
54 | + $page_header = $lang['sys_alliance']; |
|
55 | 55 | } |
56 | 56 | else |
57 | 57 | { |
58 | 58 | $page_header = $lang['your_alliance']; |
59 | 59 | |
60 | - if($ally['ally_owner'] == $user['id']) |
|
60 | + if ($ally['ally_owner'] == $user['id']) |
|
61 | 61 | { |
62 | 62 | $range = $ally['ally_owner_range'] ? $ally['ally_owner_range'] : $lang['Founder']; |
63 | 63 | } |
64 | - elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) |
|
64 | + elseif ($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) |
|
65 | 65 | { |
66 | 66 | $range = $ranks[$user['ally_rank_id']]['name']; |
67 | 67 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | )); |
106 | 106 | |
107 | 107 | $relations = ali_relations($ally['id']); |
108 | -foreach($relations as $relation) |
|
108 | +foreach ($relations as $relation) |
|
109 | 109 | { |
110 | 110 | /* |
111 | 111 | if($relation['alliance_diplomacy_contr_ally_id'] == $user['ally_id']) |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $relation['alliance_diplomacy_contr_ally_name'] = $contr_ally['ally_name']; |
115 | 115 | } |
116 | 116 | */ |
117 | - if($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id']) |
|
117 | + if ($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id']) |
|
118 | 118 | { |
119 | 119 | $template->assign_block_vars('relation', array( |
120 | 120 | 'NAME' => $relation['alliance_diplomacy_contr_ally_name'], |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | $template = parsetemplate($template, $lang); |
128 | 128 | |
129 | -function ali_render(){$func_args = func_get_args();return sn_function_call(__FUNCTION__, $func_args);} |
|
129 | +function ali_render() {$func_args = func_get_args(); return sn_function_call(__FUNCTION__, $func_args); } |
|
130 | 130 | ali_render(); |
131 | 131 | |
132 | 132 | display($template, "{$lang['your_alliance']} [{$ally['ally_name']}]"); |
@@ -23,16 +23,14 @@ discard block |
||
23 | 23 | $lang['Go_out_welldone'] = str_replace("%s", $ally_name, $lang['Go_out_welldone']); |
24 | 24 | message(sprintf($lang['ali_info_leave_success'], $ally['ally_name']), $lang['sys_alliance']); |
25 | 25 | } |
26 | -} |
|
27 | -elseif($mode == 'ainfo') |
|
26 | +} elseif($mode == 'ainfo') |
|
28 | 27 | { |
29 | 28 | $tag = sys_get_param_str('tag'); |
30 | 29 | $id_ally = sys_get_param_id('a'); |
31 | 30 | if($tag) |
32 | 31 | { |
33 | 32 | $ally = doquery("SELECT * FROM {{alliance}} WHERE ally_tag='{$tag}' LIMIT 1;", '', true); |
34 | - } |
|
35 | - elseif($id_ally) |
|
33 | + } elseif($id_ally) |
|
36 | 34 | { |
37 | 35 | $ally = doquery("SELECT * FROM {{alliance}} WHERE id='{$id_ally}' LIMIT 1;", '', true); |
38 | 36 | } |
@@ -52,20 +50,17 @@ discard block |
||
52 | 50 | 'USER_ALLY_ID' => $user['ally_id'], |
53 | 51 | )); |
54 | 52 | $page_header = $lang['sys_alliance']; |
55 | -} |
|
56 | -else |
|
53 | +} else |
|
57 | 54 | { |
58 | 55 | $page_header = $lang['your_alliance']; |
59 | 56 | |
60 | 57 | if($ally['ally_owner'] == $user['id']) |
61 | 58 | { |
62 | 59 | $range = $ally['ally_owner_range'] ? $ally['ally_owner_range'] : $lang['Founder']; |
63 | - } |
|
64 | - elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) |
|
60 | + } elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) |
|
65 | 61 | { |
66 | 62 | $range = $ranks[$user['ally_rank_id']]['name']; |
67 | - } |
|
68 | - else |
|
63 | + } else |
|
69 | 64 | { |
70 | 65 | $range = $lang['member']; |
71 | 66 | } |
@@ -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>-"; |
@@ -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 | header('Location: 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 | } |
@@ -42,12 +42,12 @@ discard block |
||
42 | 42 | |
43 | 43 | $ally = doquery("SELECT * FROM {{alliance}} WHERE `id` ='{$id_ally}'", true); |
44 | 44 | |
45 | -if(!$ally) |
|
45 | +if (!$ally) |
|
46 | 46 | { |
47 | 47 | message($lang['ali_sys_notFound'], $lang['ali_req_title']); |
48 | 48 | } |
49 | 49 | |
50 | -if($ally['ally_request_notallow']) |
|
50 | +if ($ally['ally_request_notallow']) |
|
51 | 51 | { |
52 | 52 | message($lang['ali_req_not_allowed'], $lang['ali_req_title']); |
53 | 53 | } |
@@ -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 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
5 | 5 | } |
6 | 6 | |
@@ -9,12 +9,12 @@ discard block |
||
9 | 9 | } |
10 | 10 | |
11 | 11 | $d = sys_get_param_id('d'); |
12 | -if($d) { |
|
12 | +if ($d) { |
|
13 | 13 | doquery("UPDATE {{alliance_requests}} SET `request_denied` = 1, `request_text` = '{$lang['ali_req_deny_reason']}' WHERE `id_user`= {$d} LIMIT 1;"); |
14 | 14 | } |
15 | 15 | |
16 | 16 | $id_user = sys_get_param_id('id_user'); |
17 | -if($id_user) { |
|
17 | +if ($id_user) { |
|
18 | 18 | $ally_name_safe = db_escape($ally['ally_name']); |
19 | 19 | $ally_tag_safe = db_escape($ally['ally_tag']); |
20 | 20 | db_user_set_by_id($id_user, "`ally_id` = '{$ally['id']}', `ally_name` = '{$ally_name_safe}', `ally_tag` = '{$ally_tag_safe}', `ally_register_time` = " . SN_TIME_NOW . ", `ally_rank_id` = 0"); |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | // Pretty Safe |
3 | 3 | // TODO: Add ally_tag to usertable |
4 | 4 | |
5 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
5 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
6 | 6 | { |
7 | 7 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
8 | 8 | } |
@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | $ally_name_raw = sys_get_param_str_unsafe('name'); |
13 | 13 | $ally_name = db_escape($ally_name_raw); |
14 | 14 | |
15 | -if($ally_tag) |
|
15 | +if ($ally_tag) |
|
16 | 16 | { |
17 | - if(!$ally_name_raw || !$ally_tag_raw) |
|
17 | + if (!$ally_name_raw || !$ally_tag_raw) |
|
18 | 18 | { |
19 | 19 | message($lang['have_not_name'], $lang['make_alliance']); |
20 | 20 | } |
21 | 21 | |
22 | 22 | $query = doquery("SELECT ally_tag FROM {{alliance}} WHERE `ally_tag` = '{$ally_tag}' or `ally_name` = '{$ally_name}' LIMIT 1;", true); |
23 | - if($query) |
|
23 | + if ($query) |
|
24 | 24 | { |
25 | 25 | message(str_replace('%s', $query['ally_tag'] == $ally_tag_raw ? $ally_tag_raw : $ally_name_raw, $lang['always_exist']), $lang['make_alliance']); |
26 | 26 | } |
@@ -43,8 +43,7 @@ |
||
43 | 43 | doquery("UPDATE {{alliance}} SET ally_user_id = {$ally_user_id} WHERE id = {$ally_id} LIMIT 1;"); |
44 | 44 | |
45 | 45 | message(str_replace('%s', $ally_tag_raw, $lang['ally_been_maked']), str_replace('%s', $ally_tag_raw, $lang['ally_maked'])); |
46 | -} |
|
47 | -else |
|
46 | +} else |
|
48 | 47 | { |
49 | 48 | $page .= parsetemplate(gettemplate('ali_external_make'), $lang); |
50 | 49 | } |
@@ -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 | } |
@@ -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 | $debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403); |
5 | 5 | } |
6 | 6 | |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | 'rpg_cost' => $rpg_cost, |
13 | 13 | )); |
14 | 14 | |
15 | -if(is_array($shipList)) { |
|
16 | - if(mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) { |
|
15 | +if (is_array($shipList)) { |
|
16 | + if (mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) { |
|
17 | 17 | $intError = MARKET_NO_DM; |
18 | 18 | } |
19 | 19 | |
@@ -30,30 +30,30 @@ discard block |
||
30 | 30 | $qry = array(); |
31 | 31 | $total = array(); |
32 | 32 | $db_changeset = array(); |
33 | - foreach($shipList as $shipID => &$shipCount) { |
|
33 | + foreach ($shipList as $shipID => &$shipCount) { |
|
34 | 34 | $shipCount = ceil(floatval($shipCount)); |
35 | - if(!$shipCount) { |
|
35 | + if (!$shipCount) { |
|
36 | 36 | continue; |
37 | 37 | } |
38 | 38 | |
39 | - if($shipCount < 0) { |
|
39 | + if ($shipCount < 0) { |
|
40 | 40 | $debug->warning('User supplied negative ship count on Black Market page', 'Hack Attempt', 307); |
41 | 41 | $intError = MARKET_NEGATIVE_SHIPS; |
42 | 42 | break; |
43 | 43 | } |
44 | 44 | |
45 | - if($mode == MARKET_SCRAPPER) { |
|
45 | + if ($mode == MARKET_SCRAPPER) { |
|
46 | 46 | $amount = mrc_get_level($user, $planetrow, $shipID, true, true); // $planetrow[get_unit_param($shipID, P_NAME)]; |
47 | - } elseif($mode == MARKET_STOCKMAN) { |
|
47 | + } elseif ($mode == MARKET_STOCKMAN) { |
|
48 | 48 | $amount = $stock[$shipID]; |
49 | 49 | } |
50 | 50 | |
51 | - if($amount < $shipCount) { |
|
51 | + if ($amount < $shipCount) { |
|
52 | 52 | $intError = $error_no_stock; |
53 | 53 | break; |
54 | 54 | } |
55 | 55 | |
56 | - if(!in_array($shipID, sn_get_groups('fleet'))) { |
|
56 | + if (!in_array($shipID, sn_get_groups('fleet'))) { |
|
57 | 57 | $debug->warning('Hack Attempt', 'User supplied non-ship unit ID on Black Market page', 306); |
58 | 58 | $intError = MARKET_NOT_A_SHIP; |
59 | 59 | break; |
@@ -69,16 +69,16 @@ discard block |
||
69 | 69 | $resTemp[RES_CRYSTAL] = floor($build_data[BUILD_CREATE][RES_CRYSTAL] * $shipCount * $config_rpg_scrape_crystal * (-$multiplier)); |
70 | 70 | $resTemp[RES_DEUTERIUM] = floor($build_data[BUILD_CREATE][RES_DEUTERIUM] * $shipCount * $config_rpg_scrape_deuterium * (-$multiplier)); |
71 | 71 | |
72 | - foreach($resTemp as $resID => $resCount) { |
|
72 | + foreach ($resTemp as $resID => $resCount) { |
|
73 | 73 | $total[$resID] += $resCount; |
74 | 74 | } |
75 | 75 | |
76 | 76 | $message .= "<li>{$lang['tech'][$shipID]}: " . pretty_number($shipCount); |
77 | 77 | } |
78 | 78 | |
79 | - if($mode == MARKET_STOCKMAN && $intError == MARKET_DEAL) { |
|
80 | - foreach($total as $resID => $resCount) { |
|
81 | - if(mrc_get_level($user, $planetrow, $resID, true, true) < -$resCount) { |
|
79 | + if ($mode == MARKET_STOCKMAN && $intError == MARKET_DEAL) { |
|
80 | + foreach ($total as $resID => $resCount) { |
|
81 | + if (mrc_get_level($user, $planetrow, $resID, true, true) < -$resCount) { |
|
82 | 82 | $intError = MARKET_NO_RESOURCES; |
83 | 83 | $debug->warning('Trying to use bug in s/h market', 'S/H Ship Market', 301); |
84 | 84 | break; |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | |
89 | 89 | $intError = ($intError == MARKET_DEAL) && (array_sum($total) == 0) ? $error_zero_res : $intError; |
90 | 90 | |
91 | - if($intError == MARKET_DEAL) { |
|
91 | + if ($intError == MARKET_DEAL) { |
|
92 | 92 | $message .= '</ul>' . $lang["eco_mrk_{$submode}_res"] . '<ul>'; |
93 | - foreach($total as $resID => $resCount) { |
|
94 | - if(!$resCount) { |
|
93 | + foreach ($total as $resID => $resCount) { |
|
94 | + if (!$resCount) { |
|
95 | 95 | continue; |
96 | 96 | } |
97 | 97 | |
@@ -125,38 +125,38 @@ discard block |
||
125 | 125 | 'MESSAGE' => $lang['eco_mrk_errors'][$intError], |
126 | 126 | )); |
127 | 127 | |
128 | - foreach($shipList as $shipID => $shipCount) { |
|
128 | + foreach ($shipList as $shipID => $shipCount) { |
|
129 | 129 | $data['ships'][$shipID] = max(0, intval($shipCount)); |
130 | 130 | } |
131 | 131 | } |
132 | 132 | } |
133 | 133 | $message = ''; |
134 | 134 | |
135 | -if(!$config->eco_stockman_fleet && $config->eco_stockman_fleet_populate) { |
|
136 | - $config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item){return mt_rand(1, 1000);}, sn_get_groups('fleet')))); |
|
135 | +if (!$config->eco_stockman_fleet && $config->eco_stockman_fleet_populate) { |
|
136 | + $config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item) {return mt_rand(1, 1000); }, sn_get_groups('fleet')))); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | tpl_set_resource_info($template, $planetrow, array()); |
140 | 140 | |
141 | -if(!$array) { |
|
141 | +if (!$array) { |
|
142 | 142 | $array = array(); |
143 | 143 | } |
144 | 144 | |
145 | 145 | $group_fleet = sn_get_groups('fleet'); |
146 | -foreach($array as $key => $value) { |
|
147 | - if($mode == MARKET_SCRAPPER) { |
|
146 | +foreach ($array as $key => $value) { |
|
147 | + if ($mode == MARKET_SCRAPPER) { |
|
148 | 148 | $shipID = $value; |
149 | 149 | $amount = mrc_get_level($user, $planetrow, $shipID, false, true); // $planetrow[get_unit_param($shipID, P_NAME)]; |
150 | - } elseif($mode == MARKET_STOCKMAN) { |
|
150 | + } elseif ($mode == MARKET_STOCKMAN) { |
|
151 | 151 | $shipID = $key; |
152 | 152 | $amount = $value; |
153 | 153 | } |
154 | 154 | |
155 | - if(!in_array($shipID, $group_fleet)) { |
|
155 | + if (!in_array($shipID, $group_fleet)) { |
|
156 | 156 | continue; |
157 | 157 | } |
158 | 158 | |
159 | - if($amount > 0) { |
|
159 | + if ($amount > 0) { |
|
160 | 160 | $build_data = eco_get_build_data($user, $planetrow, $shipID); |
161 | 161 | $template->assign_block_vars('ships', array( |
162 | 162 | 'ID' => $shipID, |
@@ -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']; |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | // @version 1.0 |
4 | 4 | // @copyright 2008 by Chlorel for XNova |
5 | 5 | |
6 | -if(SN_IN_FLEET !== true) { |
|
6 | +if (SN_IN_FLEET !== true) { |
|
7 | 7 | $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403); |
8 | 8 | } |
9 | 9 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $errorlist .= $lang['fl_limit_galaxy']; |
23 | 23 | if (!$system || $system > $config->game_maxSystem || $system < 1) |
24 | 24 | $errorlist .= $lang['fl_limit_system']; |
25 | - if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE )) |
|
25 | + if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE)) |
|
26 | 26 | $errorlist .= $lang['fl_limit_planet']; |
27 | 27 | if ($planetrow['galaxy'] == $galaxy && $planetrow['system'] == $system && $planetrow['planet'] == $planet && $planetrow['planet_type'] == $planet_type) |
28 | 28 | $errorlist .= $lang['fl_ownpl_err']; |
@@ -49,35 +49,35 @@ discard block |
||
49 | 49 | $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true); |
50 | 50 | |
51 | 51 | if ($target_mission == MT_EXPLORE) { |
52 | - if ($MaxExpeditions == 0 ) { |
|
52 | + if ($MaxExpeditions == 0) { |
|
53 | 53 | $errorlist .= $lang['fl_expe_notech']; |
54 | - } elseif ($FlyingExpeditions >= $MaxExpeditions ) { |
|
54 | + } elseif ($FlyingExpeditions >= $MaxExpeditions) { |
|
55 | 55 | $errorlist .= $lang['fl_expe_max']; |
56 | 56 | } |
57 | 57 | } else { |
58 | - if ($TargetPlanet['id_owner']){ |
|
58 | + if ($TargetPlanet['id_owner']) { |
|
59 | 59 | if ($target_mission == MT_COLONIZE) |
60 | 60 | $errorlist .= $lang['fl_colonized']; |
61 | 61 | |
62 | - if ($TargetPlanet['id_owner'] == $planetrow['id_owner']){ |
|
62 | + if ($TargetPlanet['id_owner'] == $planetrow['id_owner']) { |
|
63 | 63 | if ($target_mission == MT_ATTACK) |
64 | 64 | $errorlist .= $lang['fl_no_self_attack']; |
65 | 65 | |
66 | 66 | if ($target_mission == MT_SPY) |
67 | 67 | $errorlist .= $lang['fl_no_self_spy']; |
68 | - }else{ |
|
68 | + } else { |
|
69 | 69 | if ($target_mission == MT_RELOCATE) |
70 | 70 | $errorlist .= $lang['fl_only_stay_at_home']; |
71 | 71 | } |
72 | - }else{ |
|
73 | - if ($target_mission < MT_COLONIZE){ |
|
72 | + } else { |
|
73 | + if ($target_mission < MT_COLONIZE) { |
|
74 | 74 | $errorlist .= $lang['fl_unknow_target']; |
75 | - }else{ |
|
75 | + } else { |
|
76 | 76 | if ($target_mission == MT_DESTROY) |
77 | 77 | $errorlist .= $lang['fl_nomoon']; |
78 | 78 | |
79 | - if ($target_mission == MT_RECYCLE){ |
|
80 | - if($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0) |
|
79 | + if ($target_mission == MT_RECYCLE) { |
|
80 | + if ($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0) |
|
81 | 81 | $errorlist .= $lang['fl_nodebris']; |
82 | 82 | } |
83 | 83 | } |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | |
88 | - if($sn_module['unit_captain']->manifest['active'] && $captain_id = sys_get_param_id('captain_id')) { |
|
88 | + if ($sn_module['unit_captain']->manifest['active'] && $captain_id = sys_get_param_id('captain_id')) { |
|
89 | 89 | $captain = $sn_module['unit_captain']->unit_captain_get($planetrow['id']); |
90 | 90 | // mrc_get_level($user, $planetrow, UNIT_CAPTAIN, true); |
91 | - if(!$captain) { |
|
91 | + if (!$captain) { |
|
92 | 92 | $errorlist .= $lang['module_unit_captain_error_no_captain']; |
93 | - } elseif($captain['unit_location_type'] == LOC_PLANET) { |
|
94 | - if($target_mission == MT_RELOCATE && ($arriving_captain = mrc_get_level($user, $TargetPlanet, UNIT_CAPTAIN, true))) { |
|
93 | + } elseif ($captain['unit_location_type'] == LOC_PLANET) { |
|
94 | + if ($target_mission == MT_RELOCATE && ($arriving_captain = mrc_get_level($user, $TargetPlanet, UNIT_CAPTAIN, true))) { |
|
95 | 95 | $errorlist .= $lang['module_unit_captain_error_captain_already_bound']; |
96 | 96 | } |
97 | 97 | } else { |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | |
102 | 102 | if ($errorlist) { |
103 | 103 | sn_db_transaction_rollback(); |
104 | - message ("<span class='error'><ul>{$errorlist}</ul></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, false); |
|
104 | + message("<span class='error'><ul>{$errorlist}</ul></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, false); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | // On verifie s'il y a assez de vaisseaux sur la planete ! |
108 | 108 | foreach ($fleetarray as $Ship => $Count) { |
109 | 109 | if ($Count > mrc_get_level($user, $planetrow, $Ship)) { |
110 | - message ("<span class='error'><b>{$lang['fl_fleet_err']}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
110 | + message("<span class='error'><b>{$lang['fl_fleet_err']}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | |
@@ -115,13 +115,13 @@ discard block |
||
115 | 115 | $fleet_group = max(0, intval($_POST['fleet_group'])); |
116 | 116 | //But is it acs?? |
117 | 117 | //Well all acs fleets must have a fleet code. |
118 | - if($fleet_group) { |
|
118 | + if ($fleet_group) { |
|
119 | 119 | //Also it must be mission type 2 |
120 | 120 | $target_mission = MT_AKS; |
121 | 121 | |
122 | 122 | //The co-ords must be the same as where the acs fleet is going. |
123 | 123 | $target = "g{$galaxy}s{$system}p{$planet}t{$planet_type}"; |
124 | - if($_POST['acs_target_mr'] == $target) { |
|
124 | + if ($_POST['acs_target_mr'] == $target) { |
|
125 | 125 | //ACS attack must exist (if acs fleet has arrived this will also return false (2 checks in 1!!!) |
126 | 126 | $aks = doquery("SELECT * FROM {{aks}} WHERE id = '{$fleet_group}' LIMIT 1;", true); |
127 | 127 | if (!$aks) { |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | } |
138 | 138 | } |
139 | 139 | //Check that a failed acs attack isn't being sent, if it is, make it an attack fleet. |
140 | - if(!$fleet_group && $target_mission == MT_AKS) { |
|
140 | + if (!$fleet_group && $target_mission == MT_AKS) { |
|
141 | 141 | $target_mission = MT_ATTACK; |
142 | 142 | } |
143 | 143 | |
@@ -147,22 +147,21 @@ discard block |
||
147 | 147 | $options = array('fleet_speed_percent' => $speed_percent, 'fleet_group' => $fleet_group, 'resources' => $StorageNeeded); |
148 | 148 | $cant_attack = flt_can_attack($planetrow, $TargetPlanet, $fleetarray, $target_mission, $options); |
149 | 149 | |
150 | - if($cant_attack !== ATTACK_ALLOWED) { |
|
150 | + if ($cant_attack !== ATTACK_ALLOWED) { |
|
151 | 151 | message("<span class='error'><b>{$lang['fl_attack_error'][$cant_attack]}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 99); |
152 | 152 | } |
153 | 153 | |
154 | 154 | $speed_possible = array(10, 9, 8, 7, 6, 5, 4, 3, 2, 1); |
155 | 155 | if (!in_array($speed_percent, $speed_possible)) { |
156 | - message ("<span class='error'><b>". $lang['fl_cheat_speed'] ."</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
156 | + message("<span class='error'><b>" . $lang['fl_cheat_speed'] . "</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | $fleet['start_time'] = $duration + SN_TIME_NOW; |
160 | 160 | |
161 | - $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) : |
|
162 | - ($target_mission == MT_HOLD ? 12 : 0); |
|
163 | - if($max_duration) { |
|
161 | + $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) : ($target_mission == MT_HOLD ? 12 : 0); |
|
162 | + if ($max_duration) { |
|
164 | 163 | $StayDuration = sys_get_param_id('missiontime'); |
165 | - if($StayDuration > $max_duration || $StayDuration < 1) { |
|
164 | + if ($StayDuration > $max_duration || $StayDuration < 1) { |
|
166 | 165 | $debug->warning('Supplying wrong mission time', 'Hack attempt', 302, array('base_dump' => true)); |
167 | 166 | die(); |
168 | 167 | } |
@@ -172,11 +171,11 @@ discard block |
||
172 | 171 | $StayDuration = 0; |
173 | 172 | $StayTime = 0; |
174 | 173 | } |
175 | - $fleet['end_time'] = $StayDuration + (2 * $duration) + SN_TIME_NOW; |
|
174 | + $fleet['end_time'] = $StayDuration + (2 * $duration) + SN_TIME_NOW; |
|
176 | 175 | |
177 | - if($aks && $target_mission == MT_AKS) { |
|
178 | - if ($fleet['start_time']>$aks['ankunft']) { |
|
179 | - message ($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']); |
|
176 | + if ($aks && $target_mission == MT_AKS) { |
|
177 | + if ($fleet['start_time'] > $aks['ankunft']) { |
|
178 | + message($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']); |
|
180 | 179 | } |
181 | 180 | $fleet['start_time'] = $aks['ankunft']; |
182 | 181 | $fleet['end_time'] = $aks['ankunft'] + $duration; |
@@ -186,21 +185,21 @@ discard block |
||
186 | 185 | $FleetShipCount = 0; |
187 | 186 | $db_changeset = array(); |
188 | 187 | foreach ($fleetarray as $Ship => $Count) { |
189 | - $FleetStorage += get_unit_param($Ship, P_CAPACITY) * $Count; |
|
188 | + $FleetStorage += get_unit_param($Ship, P_CAPACITY) * $Count; |
|
190 | 189 | $db_changeset['unit'][] = sn_db_unit_changeset_prepare($Ship, -$Count, $user, $planetrow['id']); |
191 | 190 | } |
192 | 191 | $fleet_array = sys_unit_arr2str($fleetarray); |
193 | - $FleetShipCount += array_sum($fleetarray); |
|
194 | - $FleetStorage -= $consumption; |
|
192 | + $FleetShipCount += array_sum($fleetarray); |
|
193 | + $FleetStorage -= $consumption; |
|
195 | 194 | |
196 | - if ( $StorageNeeded > $FleetStorage) { |
|
197 | - message ("<span class='error'><b>". $lang['fl_nostoragespa'] . pretty_number($StorageNeeded - $FleetStorage) ."</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
195 | + if ($StorageNeeded > $FleetStorage) { |
|
196 | + message("<span class='error'><b>" . $lang['fl_nostoragespa'] . pretty_number($StorageNeeded - $FleetStorage) . "</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
198 | 197 | } |
199 | 198 | if ($planetrow['deuterium'] < $TransDeuterium + $consumption) { |
200 | - message ("<font color=\"red\"><b>". $lang['fl_no_deuterium'] . pretty_number($TransDeuterium + $consumption - $planetrow['deuterium']) ."</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
199 | + message("<font color=\"red\"><b>" . $lang['fl_no_deuterium'] . pretty_number($TransDeuterium + $consumption - $planetrow['deuterium']) . "</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
201 | 200 | } |
202 | 201 | if (($planetrow['metal'] < $TransMetal) || ($planetrow['crystal'] < $TransCrystal)) { |
203 | - message ("<font color=\"red\"><b>". $lang['fl_no_resources'] ."</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
202 | + message("<font color=\"red\"><b>" . $lang['fl_no_resources'] . "</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
204 | 203 | } |
205 | 204 | |
206 | 205 | $fleet_set = array( |
@@ -242,7 +241,7 @@ discard block |
||
242 | 241 | // )); |
243 | 242 | // } |
244 | 243 | |
245 | - if(is_array($captain)) { |
|
244 | + if (is_array($captain)) { |
|
246 | 245 | DBStaticUnit::db_unit_set_by_id($captain['unit_id'], "`unit_location_type` = " . LOC_FLEET . ", `unit_location_id` = {$fleet_id}"); |
247 | 246 | } |
248 | 247 | |
@@ -255,7 +254,7 @@ discard block |
||
255 | 254 | 'START_LEFT' => floor($fleet['end_time'] + 1 - SN_TIME_NOW), |
256 | 255 | ); |
257 | 256 | |
258 | - if(!empty($TargetPlanet)) { |
|
257 | + if (!empty($TargetPlanet)) { |
|
259 | 258 | $template_route += array( |
260 | 259 | 'END_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$TargetPlanet['planet_type']], |
261 | 260 | 'END_COORDS' => uni_render_coordinates($TargetPlanet), |
@@ -268,8 +267,8 @@ discard block |
||
268 | 267 | $template->assign_block_vars('fleets', $template_route); |
269 | 268 | |
270 | 269 | $sn_groups_fleet = sn_get_groups('fleet'); |
271 | - foreach($fleetarray as $ship_id => $ship_count) { |
|
272 | - if(in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
270 | + foreach ($fleetarray as $ship_id => $ship_count) { |
|
271 | + if (in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
273 | 272 | // $ship_base_data = get_ship_data($ship_id, $user); |
274 | 273 | $template->assign_block_vars('fleets.ships', array( |
275 | 274 | 'ID' => $ship_id, |
@@ -5,9 +5,9 @@ discard block |
||
5 | 5 | // @version 1.0 |
6 | 6 | // @copyright 2008 by Chlorel for XNova |
7 | 7 | |
8 | -if($fleet_ship_sort = sys_get_param_id('sort_elements')) { |
|
8 | +if ($fleet_ship_sort = sys_get_param_id('sort_elements')) { |
|
9 | 9 | define('IN_AJAX', true); |
10 | - if(!empty($lang['player_option_fleet_ship_sort'][$fleet_ship_sort])) { |
|
10 | + if (!empty($lang['player_option_fleet_ship_sort'][$fleet_ship_sort])) { |
|
11 | 11 | // player_save_option($user, PLAYER_OPTION_FLEET_SHIP_SORT, $fleet_ship_sort); |
12 | 12 | // player_save_option($user, PLAYER_OPTION_FLEET_SHIP_SORT_INVERSE, sys_get_param_id('fleet_ship_sort_inverse', 0)); |
13 | 13 | classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT] = $fleet_ship_sort; |
@@ -16,13 +16,13 @@ discard block |
||
16 | 16 | die(); |
17 | 17 | } |
18 | 18 | |
19 | -if(SN_IN_FLEET !== true) { |
|
19 | +if (SN_IN_FLEET !== true) { |
|
20 | 20 | $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403); |
21 | 21 | } |
22 | 22 | |
23 | 23 | lng_include('overview'); |
24 | 24 | |
25 | -if(!$planetrow) { |
|
25 | +if (!$planetrow) { |
|
26 | 26 | message($lang['fl_noplanetrow'], $lang['fl_error']); |
27 | 27 | } |
28 | 28 | |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | |
31 | 31 | $record_index = 0; |
32 | 32 | $ship_list = array(); |
33 | -foreach(sn_get_groups('fleet') as $n => $unit_id) { |
|
33 | +foreach (sn_get_groups('fleet') as $n => $unit_id) { |
|
34 | 34 | $unit_level = mrc_get_level($user, $planetrow, $unit_id, false, true); |
35 | - if($unit_level > 0) { |
|
35 | + if ($unit_level > 0) { |
|
36 | 36 | $ship_data = get_ship_data($unit_id, $user); |
37 | 37 | $ship_list[$unit_id] = array( |
38 | 38 | '__INDEX' => $record_index++, |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | |
51 | 51 | $fleet_ship_sort = classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT]; |
52 | 52 | $fleet_ship_sort_inverse = classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT_INVERSE]; |
53 | -if($fleet_ship_sort || $fleet_ship_sort_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) { |
|
54 | - switch($fleet_ship_sort) { |
|
53 | +if ($fleet_ship_sort || $fleet_ship_sort_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) { |
|
54 | + switch ($fleet_ship_sort) { |
|
55 | 55 | case PLAYER_OPTION_SORT_NAME: $fleet_ship_sort_field = 'NAME'; break; |
56 | 56 | case PLAYER_OPTION_SORT_SPEED: $fleet_ship_sort_field = 'SPEED'; break; |
57 | 57 | case PLAYER_OPTION_SORT_COUNT: $fleet_ship_sort_field = 'AMOUNT'; break; |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | }); |
67 | 67 | } |
68 | 68 | |
69 | -foreach($ship_list as $ship_data) { |
|
69 | +foreach ($ship_list as $ship_data) { |
|
70 | 70 | $template->assign_block_vars('ships', $ship_data); |
71 | 71 | } |
72 | 72 | |
73 | -foreach($lang['player_option_fleet_ship_sort'] as $sort_id => $sort_text) { |
|
73 | +foreach ($lang['player_option_fleet_ship_sort'] as $sort_id => $sort_text) { |
|
74 | 74 | $template->assign_block_vars('ship_sort_list', array( |
75 | 75 | 'VALUE' => $sort_id, |
76 | 76 | 'TEXT' => $sort_text, |