@@ -24,7 +24,9 @@ |
||
24 | 24 | * DO NOT CHANGE |
25 | 25 | */ |
26 | 26 | |
27 | -if (!defined('INSIDE')) die(); |
|
27 | +if (!defined('INSIDE')) { |
|
28 | + die(); |
|
29 | +} |
|
28 | 30 | |
29 | 31 | $a_lang_array = [ |
30 | 32 | 'opt_account' => 'Профиль', |
@@ -23,7 +23,9 @@ |
||
23 | 23 | * DO NOT CHANGE |
24 | 24 | */ |
25 | 25 | |
26 | -if (!defined('INSIDE')) die(); |
|
26 | +if (!defined('INSIDE')) { |
|
27 | + die(); |
|
28 | +} |
|
27 | 29 | |
28 | 30 | $a_lang_array = [ |
29 | 31 | 'msg_page_header' => 'Личные сообщения', |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | // $same_user = false; |
48 | 48 | // } |
49 | 49 | |
50 | - if(!$user_data) { |
|
50 | + if (!$user_data) { |
|
51 | 51 | SnTemplate::messageBox($lang['imp_imperator_none'], $lang['sys_error'], 'index.php', 10); |
52 | 52 | die(); |
53 | 53 | } |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | $stat_array = array(); |
59 | 59 | $query = doquery("SELECT * FROM {{statpoints}} WHERE `stat_type` = 1 AND `id_owner` = {$user_id} ORDER BY `stat_code` DESC;"); |
60 | 60 | $stat_count = SN::$db->db_affected_rows(); |
61 | - while($row = db_fetch($query)) { |
|
62 | - foreach($stat_fields as $field_db_name => $field_template_name) { |
|
61 | + while ($row = db_fetch($query)) { |
|
62 | + foreach ($stat_fields as $field_db_name => $field_template_name) { |
|
63 | 63 | // $stat_count - $row['stat_code'] - для реверсирования ID статы в JS |
64 | 64 | $stat_array[$field_template_name]['DATA'][$stat_count - $row['stat_code']] = $row[$field_db_name]; |
65 | 65 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | $stat_array_date = $stat_array['STAT_DATE']; |
69 | 69 | empty($stat_array_date['DATA']) ? $stat_array_date['DATA'] = array() : false; |
70 | - foreach($stat_array_date['DATA'] as $key => $value) { |
|
70 | + foreach ($stat_array_date['DATA'] as $key => $value) { |
|
71 | 71 | $template->assign_block_vars('stat_date', array( |
72 | 72 | 'ID' => $key, |
73 | 73 | 'VALUE' => $value, |
@@ -77,21 +77,21 @@ discard block |
||
77 | 77 | |
78 | 78 | unset($stat_array['STAT_DATE']); |
79 | 79 | $template_data = array(); |
80 | - foreach($stat_array as $stat_type => &$stat_type_data) { |
|
80 | + foreach ($stat_array as $stat_type => &$stat_type_data) { |
|
81 | 81 | $reverse_min_max = strpos($stat_type, '_RANK') !== false; |
82 | 82 | $stat_type_data['MIN'] = $reverse_min_max ? max($stat_type_data['DATA']) : min($stat_type_data['DATA']); |
83 | 83 | $stat_type_data['MAX'] = $reverse_min_max ? min($stat_type_data['DATA']) : max($stat_type_data['DATA']); |
84 | 84 | $stat_type_data['AVG'] = avg($stat_type_data['DATA']); |
85 | - foreach($stat_type_data['DATA'] as $key => $value) { |
|
85 | + foreach ($stat_type_data['DATA'] as $key => $value) { |
|
86 | 86 | $stat_type_data['PERCENT'][$key] = ($stat_type_data['MAX'] - $value ? ($value - $stat_type_data['MIN']) / ($stat_type_data['MAX'] - $stat_type_data['MIN']) : 1) * 100; |
87 | 87 | $template_data[$stat_type][$key]['ID'] = $key; |
88 | 88 | $template_data[$stat_type][$key]['VALUE'] = $value; |
89 | - $template_data[$stat_type][$key]['DELTA'] = ($reverse_min_max ? $stat_type_data['MIN'] - $value : $value - $stat_type_data['MAX']); |
|
89 | + $template_data[$stat_type][$key]['DELTA'] = ($reverse_min_max ? $stat_type_data['MIN'] - $value : $value - $stat_type_data['MAX']); |
|
90 | 90 | $template_data[$stat_type][$key]['PERCENT'] = $stat_type_data['PERCENT'][$key]; |
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
94 | - foreach($template_data as $stat_type => $stat_type_data) { |
|
94 | + foreach ($template_data as $stat_type => $stat_type_data) { |
|
95 | 95 | $template->assign_block_vars('stat', array( |
96 | 96 | 'TYPE' => $stat_type, |
97 | 97 | 'TEXT' => $lang['imp_stat_types'][$stat_type], |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | 'MAX' => $stat_array[$stat_type]['MAX'], |
100 | 100 | 'AVG' => $stat_array[$stat_type]['AVG'], |
101 | 101 | )); |
102 | - foreach($stat_type_data as $stat_entry) { |
|
102 | + foreach ($stat_type_data as $stat_entry) { |
|
103 | 103 | $template->assign_block_vars('stat.entry', $stat_entry); |
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
107 | 107 | |
108 | - if($same_user) { |
|
108 | + if ($same_user) { |
|
109 | 109 | rpg_level_up($user, RPG_STRUCTURE); |
110 | 110 | rpg_level_up($user, RPG_RAID); |
111 | 111 | rpg_level_up($user, RPG_TECH); |
@@ -142,29 +142,29 @@ discard block |
||
142 | 142 | 'builder_xp' => HelperString::numberFloorAndFormat($user_data['xpminier']), |
143 | 143 | 'builder_lvl' => HelperString::numberFloorAndFormat($user_data['lvl_minier']), |
144 | 144 | 'builder_lvl_st' => HelperString::numberFloorAndFormat(rpg_get_miner_xp($user_data['lvl_minier'])), |
145 | - 'builder_lvl_up' => HelperString::numberFloorAndFormat(rpg_get_miner_xp($user_data['lvl_minier']+1)), |
|
145 | + 'builder_lvl_up' => HelperString::numberFloorAndFormat(rpg_get_miner_xp($user_data['lvl_minier'] + 1)), |
|
146 | 146 | 'raid_xp' => HelperString::numberFloorAndFormat($user_data['xpraid']), |
147 | 147 | 'raid_lvl' => HelperString::numberFloorAndFormat($user_data['lvl_raid']), |
148 | - 'raid_lvl_up' => HelperString::numberFloorAndFormat(rpg_get_raider_xp($user_data['lvl_raid']+1)), |
|
148 | + 'raid_lvl_up' => HelperString::numberFloorAndFormat(rpg_get_raider_xp($user_data['lvl_raid'] + 1)), |
|
149 | 149 | 'raids' => HelperString::numberFloorAndFormat($user_data['raids']), |
150 | 150 | 'raidswin' => HelperString::numberFloorAndFormat($user_data['raidswin']), |
151 | 151 | 'raidsloose' => HelperString::numberFloorAndFormat($user_data['raidsloose']), |
152 | 152 | 'tech_xp' => HelperString::numberFloorAndFormat($user_data['player_rpg_tech_xp']), |
153 | 153 | 'tech_lvl' => HelperString::numberFloorAndFormat($user_data['player_rpg_tech_level']), |
154 | 154 | 'tech_lvl_st' => HelperString::numberFloorAndFormat(rpg_get_tech_xp($user_data['player_rpg_tech_level'])), |
155 | - 'tech_lvl_up' => HelperString::numberFloorAndFormat(rpg_get_tech_xp($user_data['player_rpg_tech_level']+1)), |
|
155 | + 'tech_lvl_up' => HelperString::numberFloorAndFormat(rpg_get_tech_xp($user_data['player_rpg_tech_level'] + 1)), |
|
156 | 156 | |
157 | 157 | 'explore_xp' => HelperString::numberFloorAndFormat($user_data['player_rpg_explore_xp']), |
158 | 158 | 'explore_lvl' => HelperString::numberFloorAndFormat($user_data['player_rpg_explore_level']), |
159 | 159 | 'explore_lvl_st' => HelperString::numberFloorAndFormat(rpg_get_explore_xp($user_data['player_rpg_explore_level'])), |
160 | - 'explore_lvl_up' => HelperString::numberFloorAndFormat(rpg_get_explore_xp($user_data['player_rpg_explore_level']+1)), |
|
161 | - |
|
162 | - 'build_points' => HelperString::numberFloorAndFormat( $StatRecord['build_points'] ), |
|
163 | - 'tech_points' => HelperString::numberFloorAndFormat( $StatRecord['tech_points'] ), |
|
164 | - 'fleet_points' => HelperString::numberFloorAndFormat( $StatRecord['fleet_points'] ), |
|
165 | - 'defs_points' => HelperString::numberFloorAndFormat( $StatRecord['defs_points'] ), |
|
166 | - 'res_points' => HelperString::numberFloorAndFormat( $StatRecord['res_points'] ), |
|
167 | - 'total_points' => HelperString::numberFloorAndFormat( $StatRecord['total_points'] ), |
|
160 | + 'explore_lvl_up' => HelperString::numberFloorAndFormat(rpg_get_explore_xp($user_data['player_rpg_explore_level'] + 1)), |
|
161 | + |
|
162 | + 'build_points' => HelperString::numberFloorAndFormat($StatRecord['build_points']), |
|
163 | + 'tech_points' => HelperString::numberFloorAndFormat($StatRecord['tech_points']), |
|
164 | + 'fleet_points' => HelperString::numberFloorAndFormat($StatRecord['fleet_points']), |
|
165 | + 'defs_points' => HelperString::numberFloorAndFormat($StatRecord['defs_points']), |
|
166 | + 'res_points' => HelperString::numberFloorAndFormat($StatRecord['res_points']), |
|
167 | + 'total_points' => HelperString::numberFloorAndFormat($StatRecord['total_points']), |
|
168 | 168 | 'user_rank' => $StatRecord['total_rank'], |
169 | 169 | 'RANK_DIFF' => $StatRecord['total_old_rank'] - $StatRecord['total_rank'], |
170 | 170 |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | $combat_data = sn_ube_report_load(sys_get_param_str('cypher')); |
14 | 14 | |
15 | - if($combat_data != UBE_REPORT_NOT_FOUND) { |
|
15 | + if ($combat_data != UBE_REPORT_NOT_FOUND) { |
|
16 | 16 | sn_ube_report_generate($combat_data, $template_result); |
17 | 17 | $template = SnTemplate::gettemplate('ube_combat_report', $template); |
18 | 18 | $template->assign_vars(array( |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | global $lang, $debug; |
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 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | if ($new_rank_name = sys_get_param_str('newRankName')) |
17 | 17 | { |
18 | - foreach($ally_rights as $fieldName) |
|
18 | + foreach ($ally_rights as $fieldName) |
|
19 | 19 | { |
20 | 20 | $newRank[$fieldName] = 0; |
21 | 21 | } |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | { |
29 | 29 | unset($ranks); |
30 | 30 | |
31 | - foreach($rankListInput as $rankID => $rank) |
|
31 | + foreach ($rankListInput as $rankID => $rank) |
|
32 | 32 | { |
33 | - foreach($ally_rights as $rightName) |
|
33 | + foreach ($ally_rights as $rightName) |
|
34 | 34 | { |
35 | 35 | $ranks[$rankID][$rightName] = $rank[$rightName] ? 1 : 0; |
36 | 36 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $d = sys_get_param_int('d'); |
42 | 42 | if ($d && isset($ranks[$d])) |
43 | 43 | { |
44 | - if(count($ranks) == 1) |
|
44 | + if (count($ranks) == 1) |
|
45 | 45 | { |
46 | 46 | SnTemplate::messageBox($lang['ali_adm_lastRank'], $lang['ali_adm_rights_title']); |
47 | 47 | } |
@@ -53,16 +53,16 @@ discard block |
||
53 | 53 | |
54 | 54 | if (count($ranks)) |
55 | 55 | { |
56 | - foreach($ranks as $rankID => $rank) |
|
56 | + foreach ($ranks as $rankID => $rank) |
|
57 | 57 | { |
58 | 58 | $rank_data = array( |
59 | 59 | 'ID' => $rankID, |
60 | 60 | 'NAME' => $rank['name'], |
61 | 61 | ); |
62 | 62 | |
63 | - for($i = 1; $i < count($rank); $i++) |
|
63 | + for ($i = 1; $i < count($rank); $i++) |
|
64 | 64 | { |
65 | - $rank_data['R' . $i] = (($rank[$ally_rights[$i]] == 1) ? ' checked' : '') ; |
|
65 | + $rank_data['R' . $i] = (($rank[$ally_rights[$i]] == 1) ? ' checked' : ''); |
|
66 | 66 | $rank_data['N' . $i] = $ally_rights[$i]; |
67 | 67 | } |
68 | 68 |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | global $lang; |
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 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $page = SnTemplate::gettemplate('ali_admin_mail', true); |
21 | 21 | |
22 | 22 | if ($ranks) { |
23 | - foreach($ranks as $id => $array) { |
|
23 | + foreach ($ranks as $id => $array) { |
|
24 | 24 | $page->assign_block_vars('ranks', array( |
25 | 25 | 'NAME' => $array['name'], |
26 | 26 | 'VALUE' => $id, |
@@ -26,16 +26,14 @@ discard block |
||
26 | 26 | $lang['Go_out_welldone'] = str_replace("%s", $ally_name, $lang['Go_out_welldone']); |
27 | 27 | SnTemplate::messageBox(sprintf($lang['ali_info_leave_success'], $ally['ally_name']), $lang['sys_alliance']); |
28 | 28 | } |
29 | -} |
|
30 | -elseif($mode == 'ainfo') |
|
29 | +} elseif($mode == 'ainfo') |
|
31 | 30 | { |
32 | 31 | $tag = sys_get_param_str('tag'); |
33 | 32 | $id_ally = sys_get_param_id('a'); |
34 | 33 | if($tag) |
35 | 34 | { |
36 | 35 | $ally = doquery("SELECT * FROM {{alliance}} WHERE ally_tag='{$tag}' LIMIT 1;", '', true); |
37 | - } |
|
38 | - elseif($id_ally) |
|
36 | + } elseif($id_ally) |
|
39 | 37 | { |
40 | 38 | $ally = doquery("SELECT * FROM {{alliance}} WHERE id='{$id_ally}' LIMIT 1;", '', true); |
41 | 39 | } |
@@ -55,20 +53,17 @@ discard block |
||
55 | 53 | 'USER_ALLY_ID' => $user['ally_id'], |
56 | 54 | )); |
57 | 55 | $page_header = $lang['sys_alliance']; |
58 | -} |
|
59 | -else |
|
56 | +} else |
|
60 | 57 | { |
61 | 58 | $page_header = $lang['your_alliance']; |
62 | 59 | |
63 | 60 | if($ally['ally_owner'] == $user['id']) |
64 | 61 | { |
65 | 62 | $range = $ally['ally_owner_range'] ? $ally['ally_owner_range'] : $lang['Founder']; |
66 | - } |
|
67 | - elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) |
|
63 | + } elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) |
|
68 | 64 | { |
69 | 65 | $range = $ranks[$user['ally_rank_id']]['name']; |
70 | - } |
|
71 | - else |
|
66 | + } else |
|
72 | 67 | { |
73 | 68 | $range = $lang['member']; |
74 | 69 | } |
@@ -4,14 +4,14 @@ discard block |
||
4 | 4 | use Alliance\DBStaticAlly; |
5 | 5 | use DBAL\db_mysql; |
6 | 6 | |
7 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
7 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
8 | 8 | { |
9 | 9 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
10 | 10 | } |
11 | 11 | |
12 | 12 | $template = SnTemplate::gettemplate('ali_info', true); |
13 | 13 | |
14 | -if($mode == 'exit') |
|
14 | +if ($mode == 'exit') |
|
15 | 15 | { |
16 | 16 | if ($ally['ally_owner'] == $user['id']) |
17 | 17 | { |
@@ -28,25 +28,25 @@ discard block |
||
28 | 28 | SnTemplate::messageBox(sprintf($lang['ali_info_leave_success'], $ally['ally_name']), $lang['sys_alliance']); |
29 | 29 | } |
30 | 30 | } |
31 | -elseif($mode == 'ainfo') |
|
31 | +elseif ($mode == 'ainfo') |
|
32 | 32 | { |
33 | 33 | $tag = sys_get_param_str('tag'); |
34 | 34 | $id_ally = sys_get_param_id('a'); |
35 | - if($tag) |
|
35 | + if ($tag) |
|
36 | 36 | { |
37 | 37 | $ally = doquery("SELECT * FROM {{alliance}} WHERE ally_tag='{$tag}' LIMIT 1;", '', true); |
38 | 38 | } |
39 | - elseif($id_ally) |
|
39 | + elseif ($id_ally) |
|
40 | 40 | { |
41 | 41 | $ally = doquery("SELECT * FROM {{alliance}} WHERE id='{$id_ally}' LIMIT 1;", '', true); |
42 | 42 | } |
43 | 43 | |
44 | - if(!$ally) |
|
44 | + if (!$ally) |
|
45 | 45 | { |
46 | 46 | SnTemplate::messageBox($lang['ali_sys_notFound'], $lang['Ally_info_1']); |
47 | 47 | } |
48 | 48 | |
49 | - if(!$ally['ally_description']) |
|
49 | + if (!$ally['ally_description']) |
|
50 | 50 | { |
51 | 51 | $ally['ally_description'] = $lang['Ally_nodescription']; |
52 | 52 | } |
@@ -55,17 +55,17 @@ discard block |
||
55 | 55 | 'EXTERNAL' => true, |
56 | 56 | 'USER_ALLY_ID' => $user['ally_id'], |
57 | 57 | )); |
58 | - $page_header = $lang['sys_alliance']; |
|
58 | + $page_header = $lang['sys_alliance']; |
|
59 | 59 | } |
60 | 60 | else |
61 | 61 | { |
62 | 62 | $page_header = $lang['your_alliance']; |
63 | 63 | |
64 | - if($ally['ally_owner'] == $user['id']) |
|
64 | + if ($ally['ally_owner'] == $user['id']) |
|
65 | 65 | { |
66 | 66 | $range = $ally['ally_owner_range'] ? $ally['ally_owner_range'] : $lang['Founder']; |
67 | 67 | } |
68 | - elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) |
|
68 | + elseif ($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) |
|
69 | 69 | { |
70 | 70 | $range = $ranks[$user['ally_rank_id']]['name']; |
71 | 71 | } |
@@ -100,9 +100,9 @@ discard block |
||
100 | 100 | ]); |
101 | 101 | |
102 | 102 | $relations = ali_relations($ally['id']); |
103 | -foreach($relations as $relation) |
|
103 | +foreach ($relations as $relation) |
|
104 | 104 | { |
105 | - if($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id']) |
|
105 | + if ($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id']) |
|
106 | 106 | { |
107 | 107 | $template->assign_block_vars('relation', array( |
108 | 108 | 'NAME' => $relation['alliance_diplomacy_contr_ally_name'], |
@@ -68,8 +68,7 @@ discard block |
||
68 | 68 | ->doInsert(); |
69 | 69 | |
70 | 70 | $accept_offer = false; |
71 | - } |
|
72 | - else |
|
71 | + } else |
|
73 | 72 | { |
74 | 73 | $accept_offer = true; |
75 | 74 | $autoAccept = true; |
@@ -81,8 +80,7 @@ discard block |
||
81 | 80 | 'alliance_negotiation_relation' => $alliance_negotiation_relation, |
82 | 81 | ); |
83 | 82 | } |
84 | -} |
|
85 | -else |
|
83 | +} else |
|
86 | 84 | { |
87 | 85 | $offer_id = sys_get_param_id('offer_id'); |
88 | 86 | if($offer_id) |
@@ -93,31 +91,26 @@ discard block |
||
93 | 91 | if(!$negotiation) |
94 | 92 | { |
95 | 93 | SnTemplate::messageBox($lang['ali_dip_err_offer_none'], $page_title); |
96 | - } |
|
97 | - elseif($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id']) |
|
94 | + } elseif($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id']) |
|
98 | 95 | { |
99 | 96 | // TODO: Add log of hack attempt |
100 | 97 | SnTemplate::messageBox($lang['ali_dip_err_offer_alien'], $page_title); |
101 | - } |
|
102 | - elseif($negotiation['alliance_negotiation_ally_id'] == $user['ally_id']) |
|
98 | + } elseif($negotiation['alliance_negotiation_ally_id'] == $user['ally_id']) |
|
103 | 99 | { |
104 | 100 | if($offer_answer == 'accept') |
105 | 101 | { |
106 | 102 | // TODO: Add log of hack attempt |
107 | 103 | SnTemplate::messageBox($lang['ali_dip_err_offer_accept_own'], $page_title); |
108 | - } |
|
109 | - elseif($offer_answer == 'deny') |
|
104 | + } elseif($offer_answer == 'deny') |
|
110 | 105 | { |
111 | 106 | doquery("DELETE FROM {{alliance_negotiation}} WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;"); |
112 | 107 | } |
113 | - } |
|
114 | - else |
|
108 | + } else |
|
115 | 109 | { |
116 | 110 | if($offer_answer == 'accept') |
117 | 111 | { |
118 | 112 | $accept_offer = true; |
119 | - } |
|
120 | - elseif($offer_answer == 'deny') |
|
113 | + } elseif($offer_answer == 'deny') |
|
121 | 114 | { |
122 | 115 | DBStaticAlly::db_ally_negotiation_update_status_1($offer_id); |
123 | 116 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | use DBAL\db_mysql; |
5 | 5 | use \DBAL\DbQuery; |
6 | 6 | |
7 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
7 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
8 | 8 | { |
9 | 9 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
10 | 10 | } |
@@ -19,28 +19,28 @@ discard block |
||
19 | 19 | $ally_name_safe = SN::$db->db_escape($user['ally_name']); |
20 | 20 | |
21 | 21 | $autoAccept = false; |
22 | -if(sys_get_param_str('ali_dip_offer_make')) |
|
22 | +if (sys_get_param_str('ali_dip_offer_make')) |
|
23 | 23 | { |
24 | 24 | $alliance_negotiation_relation = sys_get_param_str('alliance_negotiation_relation'); |
25 | - if(!array_key_exists($alliance_negotiation_relation, $sn_diplomacy_relation_list)) |
|
25 | + if (!array_key_exists($alliance_negotiation_relation, $sn_diplomacy_relation_list)) |
|
26 | 26 | { |
27 | 27 | SnTemplate::messageBox($lang['ali_dip_err_wrong_offer'], $page_title); |
28 | 28 | } |
29 | 29 | |
30 | 30 | $alliance_negotiation_contr_ally_id = sys_get_param_id('alliance_negotiation_contr_ally_id'); |
31 | - if($alliance_negotiation_contr_ally_id == $user['ally_id']) |
|
31 | + if ($alliance_negotiation_contr_ally_id == $user['ally_id']) |
|
32 | 32 | { |
33 | 33 | SnTemplate::messageBox($lang['ali_dip_err_same_ally'], $page_title); |
34 | 34 | } |
35 | 35 | |
36 | 36 | $contr_ally_row = doquery("SELECT `ally_name` FROM {{alliance}} WHERE `id` = {$alliance_negotiation_contr_ally_id} LIMIT 1;", '', true); |
37 | - if(!$contr_ally_row) |
|
37 | + if (!$contr_ally_row) |
|
38 | 38 | { |
39 | 39 | SnTemplate::messageBox($lang['ali_dip_err_no_ally'], $page_title); |
40 | 40 | } |
41 | 41 | |
42 | 42 | $relation_current_id = ali_relation($user['ally_id'], $alliance_negotiation_contr_ally_id); |
43 | - if($alliance_negotiation_relation == $relation_current_id) |
|
43 | + if ($alliance_negotiation_relation == $relation_current_id) |
|
44 | 44 | { |
45 | 45 | SnTemplate::messageBox(sprintf($lang['ali_dip_err_offer_same'], $lang['ali_dip_relations'][$alliance_negotiation_relation]), $page_title); |
46 | 46 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | $relation_new = $sn_diplomacy_relation_list[$alliance_negotiation_relation]; |
54 | 54 | $relation_current = $sn_diplomacy_relation_list[$relation_current_id]; |
55 | - if($relation_new['enter_delay'] == -1 || $relation_current['exit_delay'] == -1) |
|
55 | + if ($relation_new['enter_delay'] == -1 || $relation_current['exit_delay'] == -1) |
|
56 | 56 | { |
57 | 57 | DbQuery::build() |
58 | 58 | ->setTable('alliance_negotiation') |
@@ -86,39 +86,39 @@ discard block |
||
86 | 86 | else |
87 | 87 | { |
88 | 88 | $offer_id = sys_get_param_id('offer_id'); |
89 | - if($offer_id) |
|
89 | + if ($offer_id) |
|
90 | 90 | { |
91 | 91 | $offer_answer = sys_get_param_str('answer'); |
92 | 92 | |
93 | 93 | $negotiation = doquery("SELECT * FROM {{alliance_negotiation}} WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;", '', true); |
94 | - if(!$negotiation) |
|
94 | + if (!$negotiation) |
|
95 | 95 | { |
96 | 96 | SnTemplate::messageBox($lang['ali_dip_err_offer_none'], $page_title); |
97 | 97 | } |
98 | - elseif($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id']) |
|
98 | + elseif ($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id']) |
|
99 | 99 | { |
100 | 100 | // TODO: Add log of hack attempt |
101 | 101 | SnTemplate::messageBox($lang['ali_dip_err_offer_alien'], $page_title); |
102 | 102 | } |
103 | - elseif($negotiation['alliance_negotiation_ally_id'] == $user['ally_id']) |
|
103 | + elseif ($negotiation['alliance_negotiation_ally_id'] == $user['ally_id']) |
|
104 | 104 | { |
105 | - if($offer_answer == 'accept') |
|
105 | + if ($offer_answer == 'accept') |
|
106 | 106 | { |
107 | 107 | // TODO: Add log of hack attempt |
108 | 108 | SnTemplate::messageBox($lang['ali_dip_err_offer_accept_own'], $page_title); |
109 | 109 | } |
110 | - elseif($offer_answer == 'deny') |
|
110 | + elseif ($offer_answer == 'deny') |
|
111 | 111 | { |
112 | 112 | doquery("DELETE FROM {{alliance_negotiation}} WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;"); |
113 | 113 | } |
114 | 114 | } |
115 | 115 | else |
116 | 116 | { |
117 | - if($offer_answer == 'accept') |
|
117 | + if ($offer_answer == 'accept') |
|
118 | 118 | { |
119 | 119 | $accept_offer = true; |
120 | 120 | } |
121 | - elseif($offer_answer == 'deny') |
|
121 | + elseif ($offer_answer == 'deny') |
|
122 | 122 | { |
123 | 123 | DBStaticAlly::db_ally_negotiation_update_status_1($offer_id); |
124 | 124 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
129 | -if($accept_offer) |
|
129 | +if ($accept_offer) |
|
130 | 130 | { |
131 | 131 | db_mysql::db_transaction_start(); |
132 | 132 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | db_mysql::db_transaction_commit(); |
187 | 187 | } |
188 | 188 | |
189 | -foreach($sn_diplomacy_relation_list as $diplomacy_relation_id => $diplomacy_relation) |
|
189 | +foreach ($sn_diplomacy_relation_list as $diplomacy_relation_id => $diplomacy_relation) |
|
190 | 190 | { |
191 | 191 | $template->assign_block_vars('relation', array( |
192 | 192 | 'ID' => $diplomacy_relation_id, |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | } |
196 | 196 | |
197 | 197 | $query = doquery("SELECT id, ally_name, ally_tag FROM {{alliance}} WHERE `id` != {$user['ally_id']} ORDER BY ally_name;"); |
198 | -while($alliance = db_fetch($query)) |
|
198 | +while ($alliance = db_fetch($query)) |
|
199 | 199 | { |
200 | 200 | $template->assign_block_vars('alliance', array( |
201 | 201 | 'ID' => $alliance['id'], |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | WHERE |
215 | 215 | alliance_negotiation_ally_id = {$user['ally_id']} OR alliance_negotiation_contr_ally_id = {$user['ally_id']};" |
216 | 216 | ); |
217 | -while($offer = db_fetch($query)) |
|
217 | +while ($offer = db_fetch($query)) |
|
218 | 218 | { |
219 | 219 | $template->assign_block_vars('offer', array( |
220 | 220 | 'ID' => $offer['alliance_negotiation_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 | SN::$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 | SnTemplate::messageBox($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++, |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | |
53 | 53 | $fleet_ship_sort = SN::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT]; |
54 | 54 | $fleet_ship_sort_inverse = SN::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT_INVERSE]; |
55 | -if($fleet_ship_sort || $fleet_ship_sort_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) { |
|
56 | - switch($fleet_ship_sort) { |
|
55 | +if ($fleet_ship_sort || $fleet_ship_sort_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) { |
|
56 | + switch ($fleet_ship_sort) { |
|
57 | 57 | case PLAYER_OPTION_SORT_NAME: $fleet_ship_sort_field = 'NAME'; break; |
58 | 58 | case PLAYER_OPTION_SORT_SPEED: $fleet_ship_sort_field = 'SPEED'; break; |
59 | 59 | case PLAYER_OPTION_SORT_COUNT: $fleet_ship_sort_field = 'AMOUNT'; break; |
@@ -68,11 +68,11 @@ discard block |
||
68 | 68 | }); |
69 | 69 | } |
70 | 70 | |
71 | -foreach($ship_list as $ship_data) { |
|
71 | +foreach ($ship_list as $ship_data) { |
|
72 | 72 | $template->assign_block_vars('ships', $ship_data); |
73 | 73 | } |
74 | 74 | |
75 | -foreach($lang['player_option_fleet_ship_sort'] as $sort_id => $sort_text) { |
|
75 | +foreach ($lang['player_option_fleet_ship_sort'] as $sort_id => $sort_text) { |
|
76 | 76 | $template->assign_block_vars('ship_sort_list', array( |
77 | 77 | 'VALUE' => $sort_id, |
78 | 78 | 'TEXT' => $sort_text, |