@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
16 | 16 | |
17 | -if($user['authlevel'] < 3) { |
|
17 | +if ($user['authlevel'] < 3) { |
|
18 | 18 | AdminMessage($lang['adm_err_denied']); |
19 | 19 | } |
20 | 20 | |
@@ -24,15 +24,15 @@ discard block |
||
24 | 24 | $deleteall = sys_get_param_str('deleteall'); |
25 | 25 | |
26 | 26 | |
27 | -if($delete) { |
|
27 | +if ($delete) { |
|
28 | 28 | db_chat_message_delete($delete); |
29 | -} elseif($deleteall == 'yes') { |
|
29 | +} elseif ($deleteall == 'yes') { |
|
30 | 30 | db_chat_message_purge(); |
31 | 31 | } |
32 | 32 | |
33 | 33 | $query = db_chat_message_get_last_25(); |
34 | 34 | $i = 0; |
35 | -while($e = db_fetch($query)) { |
|
35 | +while ($e = db_fetch($query)) { |
|
36 | 36 | $i++; |
37 | 37 | $parse['msg_list'] .= stripslashes("<tr>" . |
38 | 38 | "<td class=n>{$e['messageid']}</td>" . |
@@ -14,25 +14,25 @@ discard block |
||
14 | 14 | |
15 | 15 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
16 | 16 | |
17 | -if($user['authlevel'] < 3) { |
|
17 | +if ($user['authlevel'] < 3) { |
|
18 | 18 | AdminMessage($lang['adm_err_denied']); |
19 | 19 | } |
20 | 20 | |
21 | -if($delete = sys_get_param_id('delete')) { |
|
21 | +if ($delete = sys_get_param_id('delete')) { |
|
22 | 22 | db_log_delete_by_id($delete); |
23 | -} elseif(sys_get_param_str('delete_update_info')) { |
|
23 | +} elseif (sys_get_param_str('delete_update_info')) { |
|
24 | 24 | db_log_delete_update_and_stat_calc(); |
25 | -} elseif(sys_get_param_str('deleteall') == 'yes') { |
|
25 | +} elseif (sys_get_param_str('deleteall') == 'yes') { |
|
26 | 26 | // doquery("TRUNCATE TABLE `{{logs}}`"); |
27 | 27 | } |
28 | 28 | |
29 | -if($detail = sys_get_param_id('detail')) { |
|
29 | +if ($detail = sys_get_param_id('detail')) { |
|
30 | 30 | $template = gettemplate('admin/adm_log_main_detail', true); |
31 | 31 | |
32 | 32 | $errorInfo = db_log_get_by_id($detail); |
33 | 33 | $error_dump = unserialize($errorInfo['log_dump']); |
34 | - if(is_array($error_dump)) { |
|
35 | - foreach($error_dump as $key => $value) { |
|
34 | + if (is_array($error_dump)) { |
|
35 | + foreach ($error_dump as $key => $value) { |
|
36 | 36 | $v = array( |
37 | 37 | 'VAR_NAME' => $key, |
38 | 38 | 'VAR_VALUE' => $key == 'query_log' ? $value : dump($value, $key) |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | |
48 | 48 | $i = 0; |
49 | 49 | $query = db_log_list_get_last_100(); |
50 | - while($u = db_fetch($query)) { |
|
50 | + while ($u = db_fetch($query)) { |
|
51 | 51 | $i++; |
52 | 52 | $v = array(); |
53 | - foreach($u as $key => $value) { |
|
53 | + foreach ($u as $key => $value) { |
|
54 | 54 | $v[strtoupper($key)] = $value; |
55 | 55 | } |
56 | 56 | $template->assign_block_vars('error', $v); |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | require('../includes/init.' . substr(strrchr(__FILE__, '.'), 1)); |
6 | 6 | |
7 | -if($user['authlevel'] < 3) |
|
7 | +if ($user['authlevel'] < 3) |
|
8 | 8 | { |
9 | 9 | message($lang['sys_noalloaw'], $lang['sys_noaccess']); |
10 | 10 | die(); |
@@ -20,9 +20,9 @@ discard block |
||
20 | 20 | // [#] info_best_battles 1b0 |
21 | 21 | $best_reports = array(); |
22 | 22 | |
23 | -if(defined('MODULE_INFO_BEST_BATTLES_QUERY')) { |
|
23 | +if (defined('MODULE_INFO_BEST_BATTLES_QUERY')) { |
|
24 | 24 | $query = db_ube_report_get_best_battles(); |
25 | - while($row = db_fetch($query)) { |
|
25 | + while ($row = db_fetch($query)) { |
|
26 | 26 | $best_reports[] = $row['ube_report_id']; |
27 | 27 | } |
28 | 28 | } |
@@ -186,16 +186,16 @@ discard block |
||
186 | 186 | |
187 | 187 | function sn_maintenance_pack_user_list($user_list) { |
188 | 188 | $user_list = explode(',', $user_list); |
189 | - foreach($user_list as $key => $user_id) { |
|
190 | - if(!ceil(floatval($user_id))) { |
|
189 | + foreach ($user_list as $key => $user_id) { |
|
190 | + if (!ceil(floatval($user_id))) { |
|
191 | 191 | unset($user_list[$key]); |
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
195 | 195 | $result = array(); |
196 | - if(!empty($user_list)) { |
|
196 | + if (!empty($user_list)) { |
|
197 | 197 | $query = db_user_list_get_by_id_array($user_list); |
198 | - while($row = db_fetch($query)) { |
|
198 | + while ($row = db_fetch($query)) { |
|
199 | 199 | $result[] = $row['id']; |
200 | 200 | } |
201 | 201 | } |
@@ -210,13 +210,13 @@ discard block |
||
210 | 210 | $old_server_status == GAME_DISABLE_NONE ? $config->db_saveItem('game_disable', GAME_DISABLE_MAINTENANCE) : false; |
211 | 211 | sn_db_transaction_commit(); |
212 | 212 | |
213 | -foreach($ques as $que_transaction) { |
|
213 | +foreach ($ques as $que_transaction) { |
|
214 | 214 | sn_db_transaction_start(); |
215 | 215 | |
216 | 216 | !is_array($que_transaction) ? $que_transaction = array($que_transaction) : false; |
217 | - foreach($que_transaction as $que) { |
|
217 | + foreach ($que_transaction as $que) { |
|
218 | 218 | set_time_limit(120); |
219 | - if(is_callable($que)) { |
|
219 | + if (is_callable($que)) { |
|
220 | 220 | $QryResult = call_user_func($que); |
221 | 221 | } else { |
222 | 222 | $QryResult = doquery($que); |
@@ -12,19 +12,19 @@ discard block |
||
12 | 12 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
13 | 13 | |
14 | 14 | // if($user['authlevel'] < 1) |
15 | -if($user['authlevel'] < 3) { |
|
15 | +if ($user['authlevel'] < 3) { |
|
16 | 16 | AdminMessage($lang['adm_err_denied']); |
17 | 17 | } |
18 | 18 | |
19 | 19 | $mode = sys_get_param_int('mode'); |
20 | 20 | |
21 | -switch($mode) { |
|
21 | +switch ($mode) { |
|
22 | 22 | case ADM_TOOL_CONFIG_RELOAD: |
23 | 23 | $config->db_loadAll(); |
24 | 24 | sys_refresh_tablelist(); |
25 | 25 | |
26 | 26 | $config->db_loadItem('game_watchlist'); |
27 | - if($config->game_watchlist) { |
|
27 | + if ($config->game_watchlist) { |
|
28 | 28 | $config->game_watchlist_array = explode(';', $config->game_watchlist); |
29 | 29 | } else { |
30 | 30 | unset($config->game_watchlist_array); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $lang['adm_tool_sql_client_version'] => db_get_client_info(), |
70 | 70 | $lang['adm_tool_sql_host_info'] => db_get_host_info(), |
71 | 71 | ); |
72 | - foreach($status as $key => $value) { |
|
72 | + foreach ($status as $key => $value) { |
|
73 | 73 | $template->assign_block_vars('table.row', array( |
74 | 74 | 'VALUE_1' => $key, |
75 | 75 | 'VALUE_2' => $value, |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $template->assign_block_vars('table', $lang['adm_tool_sql_table']['status']); |
80 | 80 | $status = explode(' ', db_server_stat()); |
81 | - foreach($status as $value) { |
|
81 | + foreach ($status as $value) { |
|
82 | 82 | $row = explode(': ', $value); |
83 | 83 | $template->assign_block_vars('table.row', array( |
84 | 84 | 'VALUE_1' => $row[0], |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | $template->assign_block_vars('table', $lang['adm_tool_sql_table']['params']); |
91 | 91 | $result = db_core_show_status(); |
92 | - while($row = db_fetch($result)) { |
|
92 | + while ($row = db_fetch($result)) { |
|
93 | 93 | $template->assign_block_vars('table.row', array( |
94 | 94 | 'VALUE_1' => $row['Variable_name'], |
95 | 95 | 'VALUE_2' => $row['Value'], |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
16 | 16 | |
17 | -if($user['authlevel'] < 3) { |
|
17 | +if ($user['authlevel'] < 3) { |
|
18 | 18 | AdminMessage($lang['adm_err_denied']); |
19 | 19 | } |
20 | 20 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | ); |
26 | 26 | |
27 | 27 | $query = db_payment_list_payers(); |
28 | -while($row = db_fetch($query)) { |
|
28 | +while ($row = db_fetch($query)) { |
|
29 | 29 | $payer_list[$row['payment_user_id']] = '[' . $row['payment_user_id'] . '] ' . $row['payment_user_name']; |
30 | 30 | } |
31 | 31 | tpl_assign_select($template, 'payer', $payer_list); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | ); |
36 | 36 | |
37 | 37 | $query = db_payment_list_modules(); |
38 | -while($row = db_fetch($query)) { |
|
38 | +while ($row = db_fetch($query)) { |
|
39 | 39 | $module_list[$row['payment_module_name']] = $row['payment_module_name']; |
40 | 40 | } |
41 | 41 | tpl_assign_select($template, 'module', $module_list); |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | |
51 | 51 | $query = db_payment_list_get($flt_payer, $flt_status, $flt_test, $flt_module); |
52 | 52 | |
53 | -while($row = db_fetch($query)) { |
|
53 | +while ($row = db_fetch($query)) { |
|
54 | 54 | $row2 = array(); |
55 | - foreach($row as $key => $value) { |
|
55 | + foreach ($row as $key => $value) { |
|
56 | 56 | $row2[strtoupper($key)] = $value; |
57 | 57 | } |
58 | 58 | $template->assign_block_vars('payment', $row2); |
@@ -15,34 +15,34 @@ discard block |
||
15 | 15 | $template = gettemplate('notes', true); |
16 | 16 | |
17 | 17 | $result = array(); |
18 | -if(($result_message = sys_get_param_str('MESSAGE')) && isset($lang[$result_message])) { |
|
18 | +if (($result_message = sys_get_param_str('MESSAGE')) && isset($lang[$result_message])) { |
|
19 | 19 | $result[] = array('STATUS' => sys_get_param_int('STATUS'), 'MESSAGE' => $lang[$result_message]); |
20 | 20 | } |
21 | 21 | |
22 | 22 | $note_id_edit = sys_get_param_id('note_id_edit'); |
23 | -if(sys_get_param('note_delete')) { |
|
23 | +if (sys_get_param('note_delete')) { |
|
24 | 24 | try { |
25 | 25 | $not = ''; |
26 | 26 | $query_where = ''; |
27 | - switch(sys_get_param_str('note_delete_range')) { |
|
27 | + switch (sys_get_param_str('note_delete_range')) { |
|
28 | 28 | case 'all': |
29 | 29 | break; |
30 | 30 | |
31 | 31 | case 'marked_not': |
32 | 32 | $not = 'NOT'; |
33 | 33 | case 'marked': |
34 | - if(!is_array($notes_marked = sys_get_param('note'))) { |
|
34 | + if (!is_array($notes_marked = sys_get_param('note'))) { |
|
35 | 35 | throw new Exception('note_err_none_selected', ERR_WARNING); |
36 | 36 | } |
37 | 37 | |
38 | 38 | $notes_marked_filtered = array(); |
39 | - foreach($notes_marked as $note_id => $note_select) { |
|
40 | - if($note_select == 'on' && $note_id = idval($note_id)) { |
|
39 | + foreach ($notes_marked as $note_id => $note_select) { |
|
40 | + if ($note_select == 'on' && $note_id = idval($note_id)) { |
|
41 | 41 | $notes_marked_filtered[] = $note_id; |
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
45 | - if(empty($notes_marked_filtered)) { |
|
45 | + if (empty($notes_marked_filtered)) { |
|
46 | 46 | throw new Exception('note_err_none_selected', ERR_WARNING); |
47 | 47 | } |
48 | 48 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | db_note_list_delete($user, $query_where); |
60 | 60 | sn_db_transaction_commit(); |
61 | 61 | throw new Exception($note_id_edit ? 'note_err_none_changed' : 'note_err_none_added', ERR_NONE); |
62 | - } catch(Exception $e) { |
|
62 | + } catch (Exception $e) { |
|
63 | 63 | $note_id_edit = 0; |
64 | 64 | sn_db_transaction_rollback(); |
65 | 65 | $result[] = array( |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | 'MESSAGE' => $lang[$e->getMessage()], |
68 | 68 | ); |
69 | 69 | } |
70 | -} elseif(($note_title = sys_get_param_str('note_title')) || ($note_text = sys_get_param_str('note_text'))) { |
|
70 | +} elseif (($note_title = sys_get_param_str('note_title')) || ($note_text = sys_get_param_str('note_text'))) { |
|
71 | 71 | $note_title == db_escape($lang['note_new_title']) ? $note_title = '' : false; |
72 | 72 | ($note_text = sys_get_param_str('note_text')) == db_escape($lang['note_new_text']) ? $note_text = '' : false; |
73 | 73 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $note_system = max(0, min(sys_get_param_id('note_system'), $config->game_maxSystem)); |
77 | 77 | $note_planet = max(0, min(sys_get_param_id('note_planet'), $config->game_maxPlanet + 1)); |
78 | 78 | |
79 | - if(!$note_text && !$note_title && !$note_galaxy && !$note_system && !$note_planet) { |
|
79 | + if (!$note_text && !$note_title && !$note_galaxy && !$note_system && !$note_planet) { |
|
80 | 80 | throw new exception('note_err_note_empty', ERR_WARNING); |
81 | 81 | } |
82 | 82 | |
@@ -85,15 +85,15 @@ discard block |
||
85 | 85 | $note_sticky = intval(sys_get_param_id('note_sticky')) ? 1 : 0; |
86 | 86 | |
87 | 87 | sn_db_transaction_start(); |
88 | - if($note_id_edit) { |
|
88 | + if ($note_id_edit) { |
|
89 | 89 | $check_note_id = db_note_get_id_and_owner($note_id_edit); |
90 | - if(!$check_note_id) { |
|
90 | + if (!$check_note_id) { |
|
91 | 91 | throw new Exception('note_err_note_not_found', ERR_ERROR); |
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
95 | - if($note_id_edit) { |
|
96 | - if($check_note_id['owner'] != $user['id']) { |
|
95 | + if ($note_id_edit) { |
|
96 | + if ($check_note_id['owner'] != $user['id']) { |
|
97 | 97 | throw new Exception('note_err_owner_wrong', ERR_ERROR); |
98 | 98 | } |
99 | 99 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | sn_db_transaction_commit(); |
106 | 106 | sys_redirect('notes.php?STATUS=' . ERR_NONE . '&MESSAGE=' . ($note_id_edit ? 'note_err_none_changed' : 'note_err_none_added')); |
107 | 107 | // throw new exception($note_id_edit ? 'note_err_none_changed' : 'note_err_none_added', ERR_NONE); |
108 | - } catch(Exception $e) { |
|
108 | + } catch (Exception $e) { |
|
109 | 109 | $note_id_edit = 0; |
110 | 110 | sn_db_transaction_rollback(); |
111 | 111 | $result[] = array( |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
118 | -if(!$note_id_edit) { |
|
118 | +if (!$note_id_edit) { |
|
119 | 119 | note_assign($template, array( |
120 | 120 | 'id' => 0, |
121 | 121 | 'time' => SN_TIME_NOW, |
@@ -128,13 +128,13 @@ discard block |
||
128 | 128 | |
129 | 129 | $note_exist = false; |
130 | 130 | $notes_query = db_note_list_by_owner($user['id']); |
131 | -while($note_row = db_fetch($notes_query)) { |
|
131 | +while ($note_row = db_fetch($notes_query)) { |
|
132 | 132 | note_assign($template, $note_row); |
133 | 133 | $note_exist = $note_exist || $note_row['id'] == $note_id_edit; |
134 | 134 | } |
135 | 135 | $note_id_edit = $note_exist ? $note_id_edit : 0; |
136 | 136 | |
137 | -foreach($note_priority_classes as $note_priority_id => $note_priority_class) { |
|
137 | +foreach ($note_priority_classes as $note_priority_id => $note_priority_class) { |
|
138 | 138 | $template->assign_block_vars('note_priority', array( |
139 | 139 | 'ID' => $note_priority_id, |
140 | 140 | 'CLASS' => $note_priority_classes[$note_priority_id], |
@@ -142,14 +142,14 @@ discard block |
||
142 | 142 | )); |
143 | 143 | } |
144 | 144 | |
145 | -foreach($lang['sys_planet_type'] as $planet_type_id => $planet_type_string) { |
|
145 | +foreach ($lang['sys_planet_type'] as $planet_type_id => $planet_type_string) { |
|
146 | 146 | $template->assign_block_vars('planet_type', array( |
147 | 147 | 'ID' => $planet_type_id, |
148 | 148 | 'TEXT' => $planet_type_string, |
149 | 149 | )); |
150 | 150 | } |
151 | 151 | |
152 | -foreach($result as $result_data) { |
|
152 | +foreach ($result as $result_data) { |
|
153 | 153 | $template->assign_block_vars('result', $result_data); |
154 | 154 | } |
155 | 155 |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | $target_mission = sys_get_param_int('mission'); |
38 | 38 | $sn_group_missions = sn_get_groups('missions'); |
39 | - if(empty($sn_group_missions[$target_mission]['AJAX'])) { |
|
39 | + if (empty($sn_group_missions[$target_mission]['AJAX'])) { |
|
40 | 40 | die($lang['gs_c00']); |
41 | 41 | } |
42 | 42 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | ); |
52 | 52 | // fleet_ajax now can send fleets only to existing planets/moons |
53 | 53 | // TODO - sending colonization and expeditions in 1 click |
54 | - if(!uni_coordinates_valid($target_coord)) { |
|
54 | + if (!uni_coordinates_valid($target_coord)) { |
|
55 | 55 | die($lang['gs_c02']); |
56 | 56 | } |
57 | 57 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | // TODO - DEADLOCK CAN BE HERE!!!! We should lock SOURCE and TARGET owners in one query |
64 | 64 | $target_row = db_planet_by_vector($target_coord); |
65 | - if(empty($target_row)) { |
|
65 | + if (empty($target_row)) { |
|
66 | 66 | $target_row = $target_coord; |
67 | 67 | $target_row['id_owner'] = 0; |
68 | 68 | // If fleet destination is PT_DEBRIS - then it's actually destination is PT_PLANET // TODO - REMOVE! Debris should be valid DESTINATION planet_type! |
@@ -73,15 +73,15 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | $fleet_array = array(); |
76 | - switch($target_mission) { |
|
76 | + switch ($target_mission) { |
|
77 | 77 | case MT_SPY: |
78 | 78 | $fleet_array[SHIP_SPY] = min(mrc_get_level($user, $planetrow, SHIP_SPY), abs(classSupernova::$user_options[PLAYER_OPTION_FLEET_SPY_DEFAULT])); |
79 | 79 | $unit_group = 'flt_spies'; |
80 | 80 | break; |
81 | 81 | |
82 | 82 | case MT_RECYCLE: |
83 | - foreach(sn_get_groups('flt_recyclers') as $unit_id) { |
|
84 | - if($unit_count = mrc_get_level($user, $planetrow, $unit_id)) { |
|
83 | + foreach (sn_get_groups('flt_recyclers') as $unit_id) { |
|
84 | + if ($unit_count = mrc_get_level($user, $planetrow, $unit_id)) { |
|
85 | 85 | $fleet_array[$unit_id] = $unit_count; |
86 | 86 | } |
87 | 87 | } |
@@ -106,16 +106,16 @@ discard block |
||
106 | 106 | 'target_structure' => $target_structure = sys_get_param_int('structures'), |
107 | 107 | ) |
108 | 108 | ); |
109 | - if($isAttackAllowed != ATTACK_ALLOWED) { |
|
109 | + if ($isAttackAllowed != ATTACK_ALLOWED) { |
|
110 | 110 | die($lang['fl_attack_error'][$isAttackAllowed]); |
111 | 111 | } |
112 | 112 | |
113 | 113 | $db_changeset = array(); |
114 | - foreach($fleet_array as $unit_id => $unit_count) { |
|
114 | + foreach ($fleet_array as $unit_id => $unit_count) { |
|
115 | 115 | $db_changeset['unit'][] = sn_db_unit_changeset_prepare($unit_id, -$unit_count, $user, $planetrow); |
116 | 116 | } |
117 | 117 | |
118 | - if($target_mission == MT_MISSILE) { |
|
118 | + if ($target_mission == MT_MISSILE) { |
|
119 | 119 | $distance = abs($target_coord['system'] - $planetrow['system']); |
120 | 120 | $duration = round((30 + (60 * $distance)) / flt_server_flight_speed_multiplier()); |
121 | 121 | $arrival = SN_TIME_NOW + $duration; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } else { |
126 | 126 | $travel_data = flt_travel_data($user, $planetrow, $target_coord, $fleet_array, 10); |
127 | 127 | |
128 | - if($planetrow['deuterium'] < $travel_data['consumption']) { |
|
128 | + if ($planetrow['deuterium'] < $travel_data['consumption']) { |
|
129 | 129 | die($lang['gs_c13']); |
130 | 130 | } |
131 | 131 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | $ships_sent = array(); |
148 | 148 | $ships_sent_js = 0; |
149 | - foreach($fleet_array as $unit_id => $unit_count) { |
|
149 | + foreach ($fleet_array as $unit_id => $unit_count) { |
|
150 | 150 | $ships_sent[] = "{$unit_count} {$lang['tech'][$unit_id]}"; |
151 | 151 | $ships_sent_js += mrc_get_level($user, $planetrow, $unit_id, false, true); |
152 | 152 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | include_once('common.' . substr(strrchr(__FILE__, '.'), 1)); |
10 | 10 | |
11 | -if(!sn_module_get_active_count('payment')) { |
|
11 | +if (!sn_module_get_active_count('payment')) { |
|
12 | 12 | sys_redirect('dark_matter.php'); |
13 | 13 | die(); |
14 | 14 | } |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | |
66 | 66 | // Таблица скидок |
67 | 67 | $prev_discount = 0; |
68 | -if(isset(sn_module_payment::$bonus_table) && is_array(sn_module_payment::$bonus_table)) { |
|
69 | - foreach(sn_module_payment::$bonus_table as $sum => $discount) { |
|
70 | - if($discount && $discount != $prev_discount) { |
|
68 | +if (isset(sn_module_payment::$bonus_table) && is_array(sn_module_payment::$bonus_table)) { |
|
69 | + foreach (sn_module_payment::$bonus_table as $sum => $discount) { |
|
70 | + if ($discount && $discount != $prev_discount) { |
|
71 | 71 | $template->assign_block_vars('discount', array( |
72 | 72 | 'SUM' => $sum, |
73 | 73 | 'DISCOUNT' => $discount * 100, |
@@ -80,19 +80,19 @@ discard block |
||
80 | 80 | } |
81 | 81 | |
82 | 82 | // Результат платежа |
83 | -if($payment_id = sys_get_param_id('payment_id')) { |
|
83 | +if ($payment_id = sys_get_param_id('payment_id')) { |
|
84 | 84 | $payment = db_payment_get($payment_id); |
85 | - if($payment && $payment['payment_user_id'] == $user['id']) { |
|
86 | - if($payment['payment_status'] == PAYMENT_STATUS_COMPLETE) { |
|
85 | + if ($payment && $payment['payment_user_id'] == $user['id']) { |
|
86 | + if ($payment['payment_status'] == PAYMENT_STATUS_COMPLETE) { |
|
87 | 87 | $template->assign_block_vars('result', array('MESSAGE' => sprintf($lang['pay_msg_mm_purchase_complete'], $payment['payment_dark_matter_paid'], $payment['payment_module_name'], $payment['payment_dark_matter_gained']))); |
88 | 88 | } |
89 | - if($payment['payment_status'] == PAYMENT_STATUS_NONE) { |
|
89 | + if ($payment['payment_status'] == PAYMENT_STATUS_NONE) { |
|
90 | 90 | $template->assign_block_vars('result', array( |
91 | 91 | 'MESSAGE' => sprintf($lang['pay_msg_mm_purchase_incomplete'], $payment['payment_dark_matter_paid'], $payment['payment_module_name']), |
92 | 92 | 'STATUS' => 1, |
93 | 93 | )); |
94 | 94 | } |
95 | - if($payment['payment_test']) { |
|
95 | + if ($payment['payment_test']) { |
|
96 | 96 | $template->assign_block_vars('result', array( |
97 | 97 | 'MESSAGE' => sprintf($lang['pay_msg_mm_purchase_test']), |
98 | 98 | 'STATUS' => -1, |
@@ -107,28 +107,28 @@ discard block |
||
107 | 107 | 'metamatter' => sys_get_param_float('metamatter'), |
108 | 108 | ); |
109 | 109 | |
110 | -if(!$request['metamatter']) { |
|
110 | +if (!$request['metamatter']) { |
|
111 | 111 | unset($_POST); |
112 | 112 | } |
113 | 113 | |
114 | 114 | $payment_methods_available = array_combine(array_keys(sn_module_payment::$payment_methods), array_fill(0, count(sn_module_payment::$payment_methods), null)); |
115 | -array_walk($payment_methods_available, function (&$value, $index) { |
|
115 | +array_walk($payment_methods_available, function(&$value, $index) { |
|
116 | 116 | $value = !empty(sn_module_payment::$payment_methods[$index]) ? array_combine(array_keys(sn_module_payment::$payment_methods[$index]), array_fill(0, count(sn_module_payment::$payment_methods[$index]), null)) : $value; |
117 | 117 | }); |
118 | 118 | |
119 | 119 | // pdump($payment_methods_available); |
120 | 120 | $payment_module_valid = false; |
121 | 121 | $payment_module = sys_get_param_str('payment_module'); |
122 | -foreach($sn_module_list['payment'] as $module_name => $module) { |
|
123 | - if(!is_object($module) || !$module->manifest['active']) { |
|
122 | +foreach ($sn_module_list['payment'] as $module_name => $module) { |
|
123 | + if (!is_object($module) || !$module->manifest['active']) { |
|
124 | 124 | continue; |
125 | 125 | } |
126 | 126 | |
127 | 127 | lng_include($module_name, $module->manifest['root_relative']); |
128 | 128 | |
129 | - foreach(sn_module_payment::$payment_methods as $payment_type_id => $available_methods) { |
|
130 | - foreach($available_methods as $payment_method => $payment_currency) { |
|
131 | - if(isset($module->manifest['payment_method'][$payment_method])) { |
|
129 | + foreach (sn_module_payment::$payment_methods as $payment_type_id => $available_methods) { |
|
130 | + foreach ($available_methods as $payment_method => $payment_currency) { |
|
131 | + if (isset($module->manifest['payment_method'][$payment_method])) { |
|
132 | 132 | $payment_methods_available[$payment_type_id][$payment_method][$module_name] = $module->manifest['payment_method'][$payment_method]; |
133 | 133 | } |
134 | 134 | } |
@@ -139,8 +139,8 @@ discard block |
||
139 | 139 | |
140 | 140 | global $template_result; |
141 | 141 | // Доступные платежные методы |
142 | -foreach($payment_methods_available as $payment_type_id => $payment_methods) { |
|
143 | - if(empty($payment_methods)) { |
|
142 | +foreach ($payment_methods_available as $payment_type_id => $payment_methods) { |
|
143 | + if (empty($payment_methods)) { |
|
144 | 144 | continue; |
145 | 145 | } |
146 | 146 | |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | 'ID' => $payment_type_id, |
149 | 149 | 'NAME' => $lang['pay_methods'][$payment_type_id], |
150 | 150 | ); |
151 | - foreach($payment_methods as $payment_method_id => $module_list) { |
|
152 | - if(empty($module_list)) { |
|
151 | + foreach ($payment_methods as $payment_method_id => $module_list) { |
|
152 | + if (empty($module_list)) { |
|
153 | 153 | continue; |
154 | 154 | } |
155 | 155 | $template_result['.']['payment'][$payment_type_id]['.']['method'][$payment_method_id] = array( |
@@ -160,14 +160,14 @@ discard block |
||
160 | 160 | 'NAME_FORCE' => isset(sn_module_payment::$payment_methods[$payment_type_id][$payment_method_id]['name']), |
161 | 161 | 'BUTTON' => isset(sn_module_payment::$payment_methods[$payment_type_id][$payment_method_id]['button']), |
162 | 162 | ); |
163 | - foreach($module_list as $payment_module_name => $payment_module_method_details) { |
|
163 | + foreach ($module_list as $payment_module_name => $payment_module_method_details) { |
|
164 | 164 | $template_result['.']['payment'][$payment_type_id]['.']['method'][$payment_method_id]['.']['module'][] = array( |
165 | 165 | 'MODULE' => $payment_module_name, |
166 | 166 | ); |
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
170 | - if(empty($template_result['.']['payment'][$payment_type_id]['.'])) { |
|
170 | + if (empty($template_result['.']['payment'][$payment_type_id]['.'])) { |
|
171 | 171 | unset($template_result['.']['payment'][$payment_type_id]); |
172 | 172 | } |
173 | 173 | } |
@@ -180,19 +180,19 @@ discard block |
||
180 | 180 | $payment_module_valid = $payment_module_valid && (!$payment_method_selected || isset($payment_methods_available[$payment_type_selected][$payment_method_selected][$module_name])); |
181 | 181 | |
182 | 182 | // If payment_module invalid - making it empty OR if there is only one payment_module - selecting it |
183 | -if($payment_module_valid) { |
|
183 | +if ($payment_module_valid) { |
|
184 | 184 | // $payment_module = $payment_module; // Really - do nothing |
185 | -} elseif($payment_type_selected && count($payment_methods_available[$payment_type_selected][$payment_method_selected]) == 1) { |
|
185 | +} elseif ($payment_type_selected && count($payment_methods_available[$payment_type_selected][$payment_method_selected]) == 1) { |
|
186 | 186 | reset($payment_methods_available[$payment_type_selected][$payment_method_selected]); |
187 | 187 | $payment_module = key($payment_methods_available[$payment_type_selected][$payment_method_selected]); |
188 | -} elseif(count($sn_module_list['payment']) == 1) { |
|
188 | +} elseif (count($sn_module_list['payment']) == 1) { |
|
189 | 189 | $payment_module = $module_name; |
190 | 190 | } else { |
191 | 191 | $payment_module = ''; |
192 | 192 | } |
193 | 193 | |
194 | -if($payment_type_selected && $payment_method_selected) { |
|
195 | - foreach($payment_methods_available[$payment_type_selected][$payment_method_selected] as $module_name => $temp) { |
|
194 | +if ($payment_type_selected && $payment_method_selected) { |
|
195 | + foreach ($payment_methods_available[$payment_type_selected][$payment_method_selected] as $module_name => $temp) { |
|
196 | 196 | $template->assign_block_vars('payment_module', array( |
197 | 197 | 'ID' => $module_name, |
198 | 198 | 'NAME' => $lang["module_{$module_name}_name"], |
@@ -201,10 +201,10 @@ discard block |
||
201 | 201 | } |
202 | 202 | } |
203 | 203 | |
204 | -foreach($lang['pay_currency_list'] as $key => $value) { |
|
204 | +foreach ($lang['pay_currency_list'] as $key => $value) { |
|
205 | 205 | $course = get_exchange_rate($key); |
206 | 206 | // if(!$course || $key == $config->payment_currency_default) { |
207 | - if(!$course) { |
|
207 | + if (!$course) { |
|
208 | 208 | continue; |
209 | 209 | } |
210 | 210 | $template->assign_block_vars('exchange', array( |
@@ -219,17 +219,17 @@ discard block |
||
219 | 219 | )); |
220 | 220 | } |
221 | 221 | |
222 | -if($request['metamatter'] && $payment_module) { |
|
222 | +if ($request['metamatter'] && $payment_module) { |
|
223 | 223 | try { |
224 | 224 | // Any possible errors about generating paylink should be raised in module! |
225 | 225 | $pay_link = $sn_module[$payment_module]->compile_request($request); |
226 | 226 | |
227 | 227 | // Поддержка дополнительной информации |
228 | - if(is_array($pay_link['RENDER'])) { |
|
229 | - foreach($pay_link['RENDER'] as $html_data) { |
|
228 | + if (is_array($pay_link['RENDER'])) { |
|
229 | + foreach ($pay_link['RENDER'] as $html_data) { |
|
230 | 230 | $template->assign_block_vars('render', $html_data); |
231 | - if(isset($html_data['VALUE']) && is_array($html_data['VALUE'])) { |
|
232 | - foreach($html_data['VALUE'] as $value_id => $value_value) { |
|
231 | + if (isset($html_data['VALUE']) && is_array($html_data['VALUE'])) { |
|
232 | + foreach ($html_data['VALUE'] as $value_id => $value_value) { |
|
233 | 233 | $template->assign_block_vars('render.value', array( |
234 | 234 | 'FIELD' => $value_id, |
235 | 235 | 'VALUE' => $value_value, |
@@ -240,8 +240,8 @@ discard block |
||
240 | 240 | } |
241 | 241 | |
242 | 242 | // Поддержка передачи данных для многошаговых платежных систем |
243 | - if(is_array($pay_link['DATA'])) { |
|
244 | - foreach($pay_link['DATA'] as $key => $value) { |
|
243 | + if (is_array($pay_link['DATA'])) { |
|
244 | + foreach ($pay_link['DATA'] as $key => $value) { |
|
245 | 245 | $template->assign_block_vars('pay_link_data', array( |
246 | 246 | 'FIELD' => $key, |
247 | 247 | 'VALUE' => $value, |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | } |
250 | 250 | } |
251 | 251 | |
252 | - if(is_array($pay_link) && in_array($pay_link['PAY_LINK_METHOD'], array('POST', 'GET', 'LINK', 'STEP'))) { |
|
252 | + if (is_array($pay_link) && in_array($pay_link['PAY_LINK_METHOD'], array('POST', 'GET', 'LINK', 'STEP'))) { |
|
253 | 253 | // TODO Переделать это под assign_vars_recursive и возвращать пустые строки если нет платежного метода - для унификации формы в темплейте |
254 | 254 | $template->assign_vars(array( |
255 | 255 | 'PAY_LINK_METHOD' => $pay_link['PAY_LINK_METHOD'], |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | } else { |
259 | 259 | throw new exception($lang['pay_msg_request_paylink_unsupported'], ERR_ERROR); |
260 | 260 | } |
261 | - } catch(exception $e) { |
|
261 | + } catch (exception $e) { |
|
262 | 262 | $template->assign_block_vars('result', $response = array( |
263 | 263 | 'STATUS' => $e->getCode(), |
264 | 264 | 'MESSAGE' => $e->getMessage(), |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | } |
269 | 269 | |
270 | 270 | // Прегенерированные пакеты |
271 | -foreach($unit_available_amount_list as $unit_amount => $discount) { |
|
271 | +foreach ($unit_available_amount_list as $unit_amount => $discount) { |
|
272 | 272 | $temp = sn_module_payment::currency_convert($unit_amount, 'MM_', $player_currency); |
273 | 273 | $template->assign_block_vars('mm_amount', array( |
274 | 274 | 'VALUE' => $unit_amount, |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | 'PLAYER_CURRENCY' => $player_currency, |
304 | 304 | 'PLAYER_CURRENCY_PRICE_PER_MM' => sn_module_payment::currency_convert(1, $player_currency, 'MM_', 10), |
305 | 305 | |
306 | - 'UNIT_AMOUNT' => (float)$request['metamatter'], |
|
306 | + 'UNIT_AMOUNT' => (float) $request['metamatter'], |
|
307 | 307 | 'UNIT_AMOUNT_TEXT' => pretty_number($request['metamatter']), |
308 | 308 | 'UNIT_AMOUNT_BONUS_PERCENT' => $bonus_percent, |
309 | 309 | 'UNIT_AMOUNT_TEXT_DISCOUNTED' => $income_metamatter_text, |
@@ -23,39 +23,39 @@ discard block |
||
23 | 23 | $mode = sys_get_param_str('mode'); |
24 | 24 | |
25 | 25 | $announce = array(); |
26 | -if($user['authlevel'] >= 3) { |
|
27 | - if(!empty($text)) { |
|
26 | +if ($user['authlevel'] >= 3) { |
|
27 | + if (!empty($text)) { |
|
28 | 28 | $announce_time = strtotime($announce_time, SN_TIME_NOW); |
29 | 29 | $announce_time = $announce_time ? $announce_time : SN_TIME_NOW; |
30 | 30 | |
31 | - if($mode == 'edit') { |
|
31 | + if ($mode == 'edit') { |
|
32 | 32 | db_news_update_set($announce_time, $text, $detail_url, $announce_id); |
33 | 33 | db_survey_delete_by_id($announce_id); |
34 | 34 | } else { |
35 | 35 | db_news_insert_set($announce_time, $text, $detail_url, $user); |
36 | 36 | $announce_id = db_insert_id(); |
37 | 37 | } |
38 | - if(($survey_question = sys_get_param_str('survey_question')) && ($survey_answers = sys_get_param('survey_answers'))) { |
|
38 | + if (($survey_question = sys_get_param_str('survey_question')) && ($survey_answers = sys_get_param('survey_answers'))) { |
|
39 | 39 | $survey_answers = explode("\r\n", $survey_answers); |
40 | 40 | $survey_until = strtotime($survey_until = sys_get_param_str('survey_until'), SN_TIME_NOW); |
41 | 41 | $survey_until = date(FMT_DATE_TIME_SQL, $survey_until ? $survey_until : SN_TIME_NOW + PERIOD_DAY * 1); |
42 | 42 | db_survey_insert($announce_id, $survey_question, $survey_until); |
43 | 43 | $survey_id = db_insert_id(); |
44 | - foreach($survey_answers as $survey_answer) { |
|
44 | + foreach ($survey_answers as $survey_answer) { |
|
45 | 45 | $survey_answer = db_escape(trim($survey_answer)); |
46 | - if(empty($survey_answer)) { |
|
46 | + if (empty($survey_answer)) { |
|
47 | 47 | continue; |
48 | 48 | } |
49 | 49 | db_survey_answer_insert($survey_id, $survey_answer); |
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | - if($announce_time <= SN_TIME_NOW) { |
|
54 | - if($announce_time > $config->var_news_last && $announce_time == SN_TIME_NOW) { |
|
53 | + if ($announce_time <= SN_TIME_NOW) { |
|
54 | + if ($announce_time > $config->var_news_last && $announce_time == SN_TIME_NOW) { |
|
55 | 55 | $config->db_saveItem('var_news_last', $announce_time); |
56 | 56 | } |
57 | 57 | |
58 | - if(sys_get_param_int('news_mass_mail')) { |
|
58 | + if (sys_get_param_int('news_mass_mail')) { |
|
59 | 59 | $text = sys_get_param('text') . ($detail_url ? " <a href=\"{$detail_url}\"><span class=\"positive\">{$lang['news_more']}</span></a>" : ''); |
60 | 60 | msg_send_simple_message('*', 0, 0, MSG_TYPE_ADMIN, $lang['sys_administration'], $lang['news_title'], $text); |
61 | 61 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | $survey_answers = ''; |
69 | - switch($mode) { |
|
69 | + switch ($mode) { |
|
70 | 70 | case 'del': |
71 | 71 | db_news_delete_by_id($announce_id); |
72 | 72 | $mode = ''; |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | $template->assign_var('ID', $announce_id); |
77 | 77 | case 'copy': |
78 | 78 | $announce = db_news_with_survey_select_by_id($announce_id); |
79 | - if($announce['survey_id']) { |
|
79 | + if ($announce['survey_id']) { |
|
80 | 80 | $query = db_survey_answer_text_select_by_news($announce); |
81 | - while($row = db_fetch($query)) { |
|
81 | + while ($row = db_fetch($query)) { |
|
82 | 82 | $survey_answers[] = $row['survey_answer_text']; |
83 | 83 | } |
84 | 84 | $survey_answers = implode("\r\n", $survey_answers); |