@@ -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 | // 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 | SnTemplate::messageBox($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 | SnTemplate::messageBox(str_replace('%s', $query['ally_tag'] == $ally_tag_raw ? $ally_tag_raw : $ally_name_raw, $lang['always_exist']), $lang['make_alliance']); |
26 | 26 | } |
@@ -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 | SnTemplate::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 | SnTemplate::messageBox($lang['ali_req_not_allowed'], $lang['ali_req_title']); |
54 | 54 | } |
@@ -3,26 +3,26 @@ discard block |
||
3 | 3 | use Alliance\DBStaticAlly; |
4 | 4 | use Old\Avatar; |
5 | 5 | |
6 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
6 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
7 | 7 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
8 | 8 | } |
9 | 9 | |
10 | -if(!$user_admin) { |
|
10 | +if (!$user_admin) { |
|
11 | 11 | SnTemplate::messageBox($lang['Denied_access'], $lang['ally_admin']); |
12 | 12 | } |
13 | 13 | |
14 | 14 | $template = SnTemplate::gettemplate('ali_admin', $template); |
15 | 15 | |
16 | 16 | $text_list = array( |
17 | - 1 => array ('db_field' => 'ally_description', 'text_type' => 'Public_text_of_alliance'), |
|
18 | - 2 => array ('db_field' => 'ally_text', 'text_type' => 'Internal_text'), |
|
19 | - 3 => array ('db_field' => 'ally_request', 'text_type' => 'Show_of_request_text'), |
|
17 | + 1 => array('db_field' => 'ally_description', 'text_type' => 'Public_text_of_alliance'), |
|
18 | + 2 => array('db_field' => 'ally_text', 'text_type' => 'Internal_text'), |
|
19 | + 3 => array('db_field' => 'ally_request', 'text_type' => 'Show_of_request_text'), |
|
20 | 20 | ); |
21 | 21 | |
22 | 22 | $allyTextID = sys_get_param_int('t', 1); |
23 | -$allyTextID = ($allyTextID<1 || $allyTextID>3) ? 1 : $allyTextID; |
|
23 | +$allyTextID = ($allyTextID < 1 || $allyTextID > 3) ? 1 : $allyTextID; |
|
24 | 24 | |
25 | -if(sys_get_param_str('isSaveOptions')) { |
|
25 | +if (sys_get_param_str('isSaveOptions')) { |
|
26 | 26 | $new_image = $ally['ally_image']; |
27 | 27 | $avatar_upload_result = Avatar::sys_avatar_upload($ally['id'], $new_image, 'ally'); |
28 | 28 | $template->assign_vars([ |
@@ -31,32 +31,32 @@ discard block |
||
31 | 31 | ]); |
32 | 32 | |
33 | 33 | $ally_changeset = array(); |
34 | - if(($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) && $new_tag != $ally['ally_tag']) { |
|
34 | + if (($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) && $new_tag != $ally['ally_tag']) { |
|
35 | 35 | $new_tag_unsafe = $new_tag; |
36 | 36 | $new_tag = db_escape($new_tag); |
37 | 37 | $isTaggedAllyExists = DBStaticAlly::db_ally_get_by_tag($new_tag); |
38 | - if(!empty($isTaggedAllyExists)) { |
|
38 | + if (!empty($isTaggedAllyExists)) { |
|
39 | 39 | SnTemplate::messageBox(sprintf($lang['ally_message_tag_exists'], $new_tag_unsafe), '', 'alliance.php?mode=admin&edit=ally'); |
40 | 40 | } |
41 | 41 | $ally_changeset[] = "`ally_tag`='{$new_tag}'"; |
42 | 42 | db_user_set_by_id($ally['ally_user_id'], "`username`='[{$new_tag}]'"); |
43 | 43 | } |
44 | 44 | |
45 | - if(($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) && $new_name != $ally['ally_name']) { |
|
45 | + if (($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) && $new_name != $ally['ally_name']) { |
|
46 | 46 | $new_name_unsafe = $new_name; |
47 | 47 | $new_name = db_escape($new_name); |
48 | 48 | $isTaggedAllyExists = DBStaticAlly::db_ally_get_by_name($new_name); |
49 | - if(!empty($isTaggedAllyExists)) { |
|
49 | + if (!empty($isTaggedAllyExists)) { |
|
50 | 50 | SnTemplate::messageBox(sprintf($lang['ally_message_name_exists'], $new_name_unsafe), '', 'alliance.php?mode=admin&edit=ally'); |
51 | 51 | } |
52 | 52 | $ally_changeset[] = "`ally_name`='{$new_name}'"; |
53 | 53 | } |
54 | 54 | |
55 | - if(($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) && $new_owner_rank != $ally['ally_owner_range']) { |
|
55 | + if (($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) && $new_owner_rank != $ally['ally_owner_range']) { |
|
56 | 56 | $new_owner_rank = db_escape($new_owner_rank); |
57 | 57 | $ally_changeset[] = "`ally_owner_range` = '{$new_owner_rank}'"; |
58 | 58 | } |
59 | - if(($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) && $new_web != $ally['ally_web']) { |
|
59 | + if (($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) && $new_web != $ally['ally_web']) { |
|
60 | 60 | $new_web = db_escape($new_web); |
61 | 61 | $ally_changeset[] = "`ally_web` = '{$new_web}'"; |
62 | 62 | } |
@@ -65,31 +65,31 @@ discard block |
||
65 | 65 | // if(($new_request = sys_get_param_int('request_notallow', $ally['ally_request_notallow'])) && $new_request != $ally['ally_request_notallow']) { |
66 | 66 | // $ally_changeset[] = "`ally_request_notallow` = '{$new_request}'"; |
67 | 67 | // } |
68 | - if($new_image != $ally['ally_image']) { |
|
68 | + if ($new_image != $ally['ally_image']) { |
|
69 | 69 | $new_image = intval($new_image); |
70 | 70 | $ally_changeset[] = "`ally_image` = '{$new_image}'"; |
71 | 71 | } |
72 | 72 | |
73 | - if(!empty($ally_changeset)) { |
|
73 | + if (!empty($ally_changeset)) { |
|
74 | 74 | doquery("UPDATE {{alliance}} SET " . implode(',', $ally_changeset) . " WHERE `id`='{$ally['id']}' LIMIT 1;"); |
75 | 75 | sys_redirect('alliance.php?mode=admin&edit=ally'); |
76 | 76 | } |
77 | 77 | } |
78 | -elseif(sys_get_param_str('isSaveText')) |
|
78 | +elseif (sys_get_param_str('isSaveText')) |
|
79 | 79 | { |
80 | 80 | $text = sys_get_param_str_both('text'); |
81 | 81 | doquery("UPDATE {{alliance}} SET `{$text_list[$allyTextID]['db_field']}`='{$text['safe']}' WHERE `id`='{$ally['id']}';"); |
82 | 82 | $ally[$text_list[$allyTextID]['db_field']] = $text['unsafe']; |
83 | 83 | } |
84 | -elseif(sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) |
|
84 | +elseif (sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) |
|
85 | 85 | { |
86 | - if(!$isAllyOwner) |
|
86 | + if (!$isAllyOwner) |
|
87 | 87 | { |
88 | 88 | SnTemplate::messageBox($lang['Denied_access'], $lang['ally_admin']); |
89 | 89 | } |
90 | 90 | |
91 | 91 | $newLeader = db_user_by_id($idNewLeader, false, `ally_id`); |
92 | - if($newLeader['ally_id'] == $user['ally_id']) |
|
92 | + if ($newLeader['ally_id'] == $user['ally_id']) |
|
93 | 93 | { |
94 | 94 | sn_db_transaction_start(); |
95 | 95 | db_user_set_by_id($user['id'], "`ally_rank_id`='0'"); |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | sys_redirect('alliance.php'); |
100 | 100 | } |
101 | 101 | } |
102 | -elseif(sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) |
|
102 | +elseif (sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) |
|
103 | 103 | { |
104 | - if(!$isAllyOwner) |
|
104 | + if (!$isAllyOwner) |
|
105 | 105 | { |
106 | 106 | SnTemplate::messageBox($lang['Denied_access'], $lang['ally_admin']); |
107 | 107 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | 'ally_name' => htmlspecialchars($ally['ally_name']), |
125 | 125 | 'ally_tag' => htmlspecialchars($ally['ally_tag']), |
126 | 126 | 'ally_web' => htmlspecialchars($ally['ally_web']), |
127 | - 'ally_request_notallow_0' => (( $ally['ally_request_notallow']) ? ' SELECTED' : ''), |
|
127 | + 'ally_request_notallow_0' => (($ally['ally_request_notallow']) ? ' SELECTED' : ''), |
|
128 | 128 | 'ally_request_notallow_1' => ((!$ally['ally_request_notallow']) ? ' SELECTED' : ''), |
129 | 129 | 'ally_owner_range' => htmlspecialchars($ally['ally_owner_range']), |
130 | 130 | 'hideNotOwner' => $ally['ally_owner'] != $user['id'] ? 'display: hide;' : '', |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | { |
134 | 134 | $userAllyAdmins = db_user_list("`ally_id`= {$ally['id']}", false, '`id`, `username`'); |
135 | 135 | unset($tmp); |
136 | - foreach($userAllyAdmins as $userAllyAdmin) |
|
136 | + foreach ($userAllyAdmins as $userAllyAdmin) |
|
137 | 137 | { |
138 | 138 | $tmp .= "<option value={$userAllyAdmin['id']}>{$userAllyAdmin['username']}</option>"; |
139 | 139 | } |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | $template->assign_var('adminMembers', $tmp); |
142 | 142 | } |
143 | 143 | |
144 | -foreach($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) |
|
144 | +foreach ($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) |
|
145 | 145 | { |
146 | - if(!$sn_ali_admin_action_locale['title']) |
|
146 | + if (!$sn_ali_admin_action_locale['title']) |
|
147 | 147 | { |
148 | 148 | continue; |
149 | 149 | } |
@@ -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, |
@@ -3,14 +3,14 @@ discard block |
||
3 | 3 | use Alliance\AllianceHelper; |
4 | 4 | use Alliance\DBStaticAlly; |
5 | 5 | |
6 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
6 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
7 | 7 | { |
8 | 8 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
9 | 9 | } |
10 | 10 | |
11 | 11 | $template = SnTemplate::gettemplate('ali_info', true); |
12 | 12 | |
13 | -if($mode == 'exit') |
|
13 | +if ($mode == 'exit') |
|
14 | 14 | { |
15 | 15 | if ($ally['ally_owner'] == $user['id']) |
16 | 16 | { |
@@ -27,25 +27,25 @@ discard block |
||
27 | 27 | SnTemplate::messageBox(sprintf($lang['ali_info_leave_success'], $ally['ally_name']), $lang['sys_alliance']); |
28 | 28 | } |
29 | 29 | } |
30 | -elseif($mode == 'ainfo') |
|
30 | +elseif ($mode == 'ainfo') |
|
31 | 31 | { |
32 | 32 | $tag = sys_get_param_str('tag'); |
33 | 33 | $id_ally = sys_get_param_id('a'); |
34 | - if($tag) |
|
34 | + if ($tag) |
|
35 | 35 | { |
36 | 36 | $ally = doquery("SELECT * FROM {{alliance}} WHERE ally_tag='{$tag}' LIMIT 1;", '', true); |
37 | 37 | } |
38 | - elseif($id_ally) |
|
38 | + elseif ($id_ally) |
|
39 | 39 | { |
40 | 40 | $ally = doquery("SELECT * FROM {{alliance}} WHERE id='{$id_ally}' LIMIT 1;", '', true); |
41 | 41 | } |
42 | 42 | |
43 | - if(!$ally) |
|
43 | + if (!$ally) |
|
44 | 44 | { |
45 | 45 | SnTemplate::messageBox($lang['ali_sys_notFound'], $lang['Ally_info_1']); |
46 | 46 | } |
47 | 47 | |
48 | - if(!$ally['ally_description']) |
|
48 | + if (!$ally['ally_description']) |
|
49 | 49 | { |
50 | 50 | $ally['ally_description'] = $lang['Ally_nodescription']; |
51 | 51 | } |
@@ -54,17 +54,17 @@ discard block |
||
54 | 54 | 'EXTERNAL' => true, |
55 | 55 | 'USER_ALLY_ID' => $user['ally_id'], |
56 | 56 | )); |
57 | - $page_header = $lang['sys_alliance']; |
|
57 | + $page_header = $lang['sys_alliance']; |
|
58 | 58 | } |
59 | 59 | else |
60 | 60 | { |
61 | 61 | $page_header = $lang['your_alliance']; |
62 | 62 | |
63 | - if($ally['ally_owner'] == $user['id']) |
|
63 | + if ($ally['ally_owner'] == $user['id']) |
|
64 | 64 | { |
65 | 65 | $range = $ally['ally_owner_range'] ? $ally['ally_owner_range'] : $lang['Founder']; |
66 | 66 | } |
67 | - elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) |
|
67 | + elseif ($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) |
|
68 | 68 | { |
69 | 69 | $range = $ranks[$user['ally_rank_id']]['name']; |
70 | 70 | } |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | ]); |
100 | 100 | |
101 | 101 | $relations = ali_relations($ally['id']); |
102 | -foreach($relations as $relation) |
|
102 | +foreach ($relations as $relation) |
|
103 | 103 | { |
104 | - if($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id']) |
|
104 | + if ($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id']) |
|
105 | 105 | { |
106 | 106 | $template->assign_block_vars('relation', array( |
107 | 107 | 'NAME' => $relation['alliance_diplomacy_contr_ally_name'], |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | use Alliance\DBStaticAlly; |
4 | 4 | use \DBAL\DbQuery; |
5 | 5 | |
6 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
6 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
7 | 7 | { |
8 | 8 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
9 | 9 | } |
@@ -18,28 +18,28 @@ discard block |
||
18 | 18 | $ally_name_safe = db_escape($user['ally_name']); |
19 | 19 | |
20 | 20 | $autoAccept = false; |
21 | -if(sys_get_param_str('ali_dip_offer_make')) |
|
21 | +if (sys_get_param_str('ali_dip_offer_make')) |
|
22 | 22 | { |
23 | 23 | $alliance_negotiation_relation = sys_get_param_str('alliance_negotiation_relation'); |
24 | - if(!array_key_exists($alliance_negotiation_relation, $sn_diplomacy_relation_list)) |
|
24 | + if (!array_key_exists($alliance_negotiation_relation, $sn_diplomacy_relation_list)) |
|
25 | 25 | { |
26 | 26 | SnTemplate::messageBox($lang['ali_dip_err_wrong_offer'], $page_title); |
27 | 27 | } |
28 | 28 | |
29 | 29 | $alliance_negotiation_contr_ally_id = sys_get_param_id('alliance_negotiation_contr_ally_id'); |
30 | - if($alliance_negotiation_contr_ally_id == $user['ally_id']) |
|
30 | + if ($alliance_negotiation_contr_ally_id == $user['ally_id']) |
|
31 | 31 | { |
32 | 32 | SnTemplate::messageBox($lang['ali_dip_err_same_ally'], $page_title); |
33 | 33 | } |
34 | 34 | |
35 | 35 | $contr_ally_row = doquery("SELECT `ally_name` FROM {{alliance}} WHERE `id` = {$alliance_negotiation_contr_ally_id} LIMIT 1;", '', true); |
36 | - if(!$contr_ally_row) |
|
36 | + if (!$contr_ally_row) |
|
37 | 37 | { |
38 | 38 | SnTemplate::messageBox($lang['ali_dip_err_no_ally'], $page_title); |
39 | 39 | } |
40 | 40 | |
41 | 41 | $relation_current_id = ali_relation($user['ally_id'], $alliance_negotiation_contr_ally_id); |
42 | - if($alliance_negotiation_relation == $relation_current_id) |
|
42 | + if ($alliance_negotiation_relation == $relation_current_id) |
|
43 | 43 | { |
44 | 44 | SnTemplate::messageBox(sprintf($lang['ali_dip_err_offer_same'], $lang['ali_dip_relations'][$alliance_negotiation_relation]), $page_title); |
45 | 45 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | $relation_new = $sn_diplomacy_relation_list[$alliance_negotiation_relation]; |
53 | 53 | $relation_current = $sn_diplomacy_relation_list[$relation_current_id]; |
54 | - if($relation_new['enter_delay'] == -1 || $relation_current['exit_delay'] == -1) |
|
54 | + if ($relation_new['enter_delay'] == -1 || $relation_current['exit_delay'] == -1) |
|
55 | 55 | { |
56 | 56 | DbQuery::build() |
57 | 57 | ->setTable('alliance_negotiation') |
@@ -85,39 +85,39 @@ discard block |
||
85 | 85 | else |
86 | 86 | { |
87 | 87 | $offer_id = sys_get_param_id('offer_id'); |
88 | - if($offer_id) |
|
88 | + if ($offer_id) |
|
89 | 89 | { |
90 | 90 | $offer_answer = sys_get_param_str('answer'); |
91 | 91 | |
92 | 92 | $negotiation = doquery("SELECT * FROM {{alliance_negotiation}} WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;", '', true); |
93 | - if(!$negotiation) |
|
93 | + if (!$negotiation) |
|
94 | 94 | { |
95 | 95 | SnTemplate::messageBox($lang['ali_dip_err_offer_none'], $page_title); |
96 | 96 | } |
97 | - elseif($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id']) |
|
97 | + elseif ($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id']) |
|
98 | 98 | { |
99 | 99 | // TODO: Add log of hack attempt |
100 | 100 | SnTemplate::messageBox($lang['ali_dip_err_offer_alien'], $page_title); |
101 | 101 | } |
102 | - elseif($negotiation['alliance_negotiation_ally_id'] == $user['ally_id']) |
|
102 | + elseif ($negotiation['alliance_negotiation_ally_id'] == $user['ally_id']) |
|
103 | 103 | { |
104 | - if($offer_answer == 'accept') |
|
104 | + if ($offer_answer == 'accept') |
|
105 | 105 | { |
106 | 106 | // TODO: Add log of hack attempt |
107 | 107 | SnTemplate::messageBox($lang['ali_dip_err_offer_accept_own'], $page_title); |
108 | 108 | } |
109 | - elseif($offer_answer == 'deny') |
|
109 | + elseif ($offer_answer == 'deny') |
|
110 | 110 | { |
111 | 111 | doquery("DELETE FROM {{alliance_negotiation}} WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;"); |
112 | 112 | } |
113 | 113 | } |
114 | 114 | else |
115 | 115 | { |
116 | - if($offer_answer == 'accept') |
|
116 | + if ($offer_answer == 'accept') |
|
117 | 117 | { |
118 | 118 | $accept_offer = true; |
119 | 119 | } |
120 | - elseif($offer_answer == 'deny') |
|
120 | + elseif ($offer_answer == 'deny') |
|
121 | 121 | { |
122 | 122 | DBStaticAlly::db_ally_negotiation_update_status_1($offer_id); |
123 | 123 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | } |
127 | 127 | |
128 | -if($accept_offer) |
|
128 | +if ($accept_offer) |
|
129 | 129 | { |
130 | 130 | sn_db_transaction_start(); |
131 | 131 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | sn_db_transaction_commit(); |
186 | 186 | } |
187 | 187 | |
188 | -foreach($sn_diplomacy_relation_list as $diplomacy_relation_id => $diplomacy_relation) |
|
188 | +foreach ($sn_diplomacy_relation_list as $diplomacy_relation_id => $diplomacy_relation) |
|
189 | 189 | { |
190 | 190 | $template->assign_block_vars('relation', array( |
191 | 191 | 'ID' => $diplomacy_relation_id, |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | } |
195 | 195 | |
196 | 196 | $query = doquery("SELECT id, ally_name, ally_tag FROM {{alliance}} WHERE `id` != {$user['ally_id']} ORDER BY ally_name;"); |
197 | -while($alliance = db_fetch($query)) |
|
197 | +while ($alliance = db_fetch($query)) |
|
198 | 198 | { |
199 | 199 | $template->assign_block_vars('alliance', array( |
200 | 200 | 'ID' => $alliance['id'], |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | WHERE |
214 | 214 | alliance_negotiation_ally_id = {$user['ally_id']} OR alliance_negotiation_contr_ally_id = {$user['ally_id']};" |
215 | 215 | ); |
216 | -while($offer = db_fetch($query)) |
|
216 | +while ($offer = db_fetch($query)) |
|
217 | 217 | { |
218 | 218 | $template->assign_block_vars('offer', array( |
219 | 219 | 'ID' => $offer['alliance_negotiation_id'], |