@@ -7,9 +7,9 @@ |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -define('INSIDE' , true); |
|
11 | -define('INSTALL' , false); |
|
12 | -define('IN_ADMIN' , true); |
|
10 | +define('INSIDE', true); |
|
11 | +define('INSTALL', false); |
|
12 | +define('IN_ADMIN', true); |
|
13 | 13 | |
14 | 14 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
15 | 15 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | global $config, $lang, $user; |
19 | 19 | |
20 | -if($user['authlevel'] < 3) { |
|
20 | +if ($user['authlevel'] < 3) { |
|
21 | 21 | sys_redirect(SN_ROOT_VIRTUAL . 'admin/banned.php'); |
22 | 22 | } |
23 | 23 | |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | $sort = sys_get_param_int('sort', SORT_ID); |
42 | 42 | $sort = $sort_fields[$sort] ? $sort : SORT_ID; |
43 | 43 | |
44 | -if(($action = sys_get_param_int('action')) && ($user_id = sys_get_param_id('uid')) && ($user_selected = db_user_by_id($user_id, false, 'id, username, authlevel'))) { |
|
45 | - if($user_selected['authlevel'] < $user['authlevel'] && $user['authlevel'] >= 3) { |
|
46 | - switch($action) { |
|
44 | +if (($action = sys_get_param_int('action')) && ($user_id = sys_get_param_id('uid')) && ($user_selected = db_user_by_id($user_id, false, 'id, username, authlevel'))) { |
|
45 | + if ($user_selected['authlevel'] < $user['authlevel'] && $user['authlevel'] >= 3) { |
|
46 | + switch ($action) { |
|
47 | 47 | case ACTION_DELETE: |
48 | 48 | DeleteSelectedUser($user_id); |
49 | 49 | sys_redirect("{$_SERVER['SCRIPT_NAME']}?sort={$sort}"); |
@@ -64,20 +64,20 @@ discard block |
||
64 | 64 | |
65 | 65 | $multi_ip = array(); |
66 | 66 | $ip_query = db_user_list_admin_multiaccounts(); |
67 | -while($ip = db_fetch($ip_query)) { |
|
67 | +while ($ip = db_fetch($ip_query)) { |
|
68 | 68 | $multi_ip[$ip['user_lastip']] = $ip['ip_count']; |
69 | 69 | } |
70 | 70 | |
71 | 71 | $geoip = geoip_status(); |
72 | 72 | |
73 | 73 | $query = db_user_list_admin_sorted($sort_fields[$sort], $is_players_online_page); |
74 | -while($user_row = db_fetch($query)) { |
|
75 | - if($user_row['banaday']) { |
|
74 | +while ($user_row = db_fetch($query)) { |
|
75 | + if ($user_row['banaday']) { |
|
76 | 76 | $ban_details = doquery("SELECT * FROM {{banned}} WHERE `ban_user_id` = {$user_row['id']} ORDER BY ban_id DESC LIMIT 1", true); |
77 | 77 | } |
78 | 78 | |
79 | 79 | $geoip_info = $geoip ? geoip_ip_info(ip2longu($user_row['user_lastip'])) : array(); |
80 | - foreach($geoip_info as $key => $value) { |
|
80 | + foreach ($geoip_info as $key => $value) { |
|
81 | 81 | $geoip_info[strtoupper($key)] = $value; |
82 | 82 | unset($geoip_info[$key]); |
83 | 83 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -define('INSIDE' , true); |
|
3 | -define('INSTALL' , false); |
|
2 | +define('INSIDE', true); |
|
3 | +define('INSTALL', false); |
|
4 | 4 | define('IN_ADMIN', true); |
5 | 5 | |
6 | 6 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | $username_unsafe = sys_get_param_str_unsafe('username'); |
25 | 25 | $username = sys_get_param_escaped('username'); |
26 | 26 | |
27 | -if($galaxy_src) |
|
27 | +if ($galaxy_src) |
|
28 | 28 | { |
29 | 29 | sn_db_transaction_start(); |
30 | 30 | $errors = array(); |
@@ -34,41 +34,41 @@ discard block |
||
34 | 34 | $planet = sys_o_get_updated($owner, array('galaxy' => $galaxy_src, 'system' => $system_src, 'planet' => $planet_src, 'planet_type' => 1), SN_TIME_NOW); |
35 | 35 | $que = $planet['que']; |
36 | 36 | $planet = $planet['planet']; |
37 | - if(!$planet) |
|
37 | + if (!$planet) |
|
38 | 38 | { |
39 | 39 | $errors[] = $lang['adm_pl_comp_err_0']; |
40 | 40 | } |
41 | 41 | |
42 | - if($planet['destruyed']) |
|
42 | + if ($planet['destruyed']) |
|
43 | 43 | { |
44 | 44 | $errors[] = $lang['adm_pl_comp_err_1']; |
45 | 45 | } |
46 | 46 | |
47 | - if($planet['id_owner'] != $owner['id'] || !$username) |
|
47 | + if ($planet['id_owner'] != $owner['id'] || !$username) |
|
48 | 48 | { |
49 | 49 | $errors[] = $lang['adm_pl_comp_err_4']; |
50 | 50 | } |
51 | 51 | |
52 | 52 | $destination = sys_o_get_updated($owner, array('galaxy' => $galaxy_dst, 'system' => $system_dst, 'planet' => $planet_dst, 'planet_type' => 1), SN_TIME_NOW); |
53 | 53 | $destination = $destination['planet']; |
54 | - if(!$destination) |
|
54 | + if (!$destination) |
|
55 | 55 | { |
56 | 56 | $errors[] = $lang['adm_pl_comp_err_2']; |
57 | 57 | } |
58 | 58 | |
59 | - if($planet['id'] == $destination['id']) |
|
59 | + if ($planet['id'] == $destination['id']) |
|
60 | 60 | { |
61 | 61 | $errors[] = $lang['adm_pl_comp_err_5']; |
62 | 62 | } |
63 | 63 | |
64 | - if($planet['id_owner'] != $destination['id_owner']) |
|
64 | + if ($planet['id_owner'] != $destination['id_owner']) |
|
65 | 65 | { |
66 | 66 | $errors[] = $lang['adm_pl_comp_err_3']; |
67 | 67 | } |
68 | 68 | |
69 | - if(!empty($errors)) |
|
69 | + if (!empty($errors)) |
|
70 | 70 | { |
71 | - foreach($errors as $error) |
|
71 | + foreach ($errors as $error) |
|
72 | 72 | { |
73 | 73 | $template->assign_block_vars('error', array( |
74 | 74 | 'TEXT' => $error, |
@@ -82,14 +82,14 @@ discard block |
||
82 | 82 | killer_add_planet($planet); |
83 | 83 | |
84 | 84 | $moon = DBStaticPlanet::db_planet_by_gspt($galaxy_src, $system_src, $planet_src, PT_MOON, true); |
85 | - if($moon) |
|
85 | + if ($moon) |
|
86 | 86 | { |
87 | 87 | $moon = sys_o_get_updated($owner, $moon, SN_TIME_NOW); |
88 | 88 | $moon = $moon['planet']; |
89 | 89 | killer_add_planet($moon); |
90 | 90 | } |
91 | 91 | |
92 | - foreach(sn_get_groups('resources_loot') as $resource_id) |
|
92 | + foreach (sn_get_groups('resources_loot') as $resource_id) |
|
93 | 93 | { |
94 | 94 | $resource_name = pname_resource_name($resource_id); |
95 | 95 | $template->assign_var("{$resource_name}_cost", $final_cost[$resource_id]); |
@@ -97,13 +97,13 @@ discard block |
||
97 | 97 | $template->assign_var("{$resource_name}_bonus", $final_cost[$resource_id]); |
98 | 98 | } |
99 | 99 | |
100 | - if($_GET['btn_confirm']) |
|
100 | + if ($_GET['btn_confirm']) |
|
101 | 101 | { |
102 | 102 | $time = SN_TIME_NOW + PERIOD_DAY; |
103 | 103 | |
104 | 104 | DBStaticUnit::db_unit_list_delete($planet['id_owner'], LOC_PLANET, $planet['id']); |
105 | 105 | DBStaticPlanet::db_planet_set_by_id($planet['id'], "id_owner = 0, destruyed = {$time}"); |
106 | - if($moon) |
|
106 | + if ($moon) |
|
107 | 107 | { |
108 | 108 | DBStaticUnit::db_unit_list_delete($planet['id_owner'], LOC_PLANET, $moon['id']); |
109 | 109 | DBStaticPlanet::db_planet_set_by_id($moon['id'], "id_owner = 0, destruyed = {$time}"); |
@@ -145,34 +145,34 @@ discard block |
||
145 | 145 | } |
146 | 146 | */ |
147 | 147 | |
148 | - foreach(sn_get_groups('structures') as $unit_id) |
|
148 | + foreach (sn_get_groups('structures') as $unit_id) |
|
149 | 149 | { |
150 | 150 | $build_level = mrc_get_level($user, $planet, $unit_id, true, true); |
151 | - if($build_level > 0) |
|
151 | + if ($build_level > 0) |
|
152 | 152 | { |
153 | 153 | $unit_cost = get_unit_param($unit_id, 'cost'); |
154 | 154 | $build_factor = $unit_cost['factor'] != 1 ? (1 - pow($unit_cost['factor'], $build_level)) / (1 - $unit_cost['factor']) : $unit_cost['factor']; |
155 | - foreach($sn_group_resources_loot as $resource_id) |
|
155 | + foreach ($sn_group_resources_loot as $resource_id) |
|
156 | 156 | { |
157 | 157 | $final_cost[$resource_id] += isset($unit_cost[$resource_id]) && $unit_cost[$resource_id] > 0 ? floor($unit_cost[$resource_id] * $build_factor) : 0; |
158 | 158 | } |
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
162 | - foreach(sn_get_groups(array('defense', 'fleet')) as $unit_id) |
|
162 | + foreach (sn_get_groups(array('defense', 'fleet')) as $unit_id) |
|
163 | 163 | { |
164 | 164 | $unit_count = mrc_get_level($user, $planet, $unit_id, true, true); |
165 | - if($unit_count > 0) |
|
165 | + if ($unit_count > 0) |
|
166 | 166 | { |
167 | 167 | $unit_cost = get_unit_param($unit_id, 'cost'); |
168 | - foreach($sn_group_resources_loot as $resource_id) |
|
168 | + foreach ($sn_group_resources_loot as $resource_id) |
|
169 | 169 | { |
170 | 170 | $final_cost[$resource_id] += isset($unit_cost[$resource_id]) && $unit_cost[$resource_id] > 0 ? floor($unit_cost[$resource_id] * $unit_count) : 0; |
171 | 171 | } |
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
175 | - foreach($sn_group_resources_loot as $resource_id) |
|
175 | + foreach ($sn_group_resources_loot as $resource_id) |
|
176 | 176 | { |
177 | 177 | $final_cost[$resource_id] += floor(mrc_get_level($user, $planet, $resource_id, true, true)); |
178 | 178 | } |
@@ -74,8 +74,7 @@ discard block |
||
74 | 74 | 'TEXT' => $error, |
75 | 75 | )); |
76 | 76 | } |
77 | - } |
|
78 | - else |
|
77 | + } else |
|
79 | 78 | { |
80 | 79 | $template->assign_var('CHECK', 1); |
81 | 80 | |
@@ -132,8 +131,7 @@ discard block |
||
132 | 131 | |
133 | 132 | display($template, $lang['adm_pl_comp_title']); |
134 | 133 | |
135 | -function killer_add_planet($planet) |
|
136 | -{ |
|
134 | +function killer_add_planet($planet) { |
|
137 | 135 | global $final_cost; |
138 | 136 | |
139 | 137 | $final_cost = array(); |
@@ -20,30 +20,30 @@ |
||
20 | 20 | $planet_id = sys_get_param_id('planet_id'); |
21 | 21 | |
22 | 22 | $unit_list = sys_get_param('unit_list'); |
23 | -if(sys_get_param('change_data') && !empty($unit_list)) |
|
23 | +if (sys_get_param('change_data') && !empty($unit_list)) |
|
24 | 24 | { |
25 | 25 | $query_string = array(); |
26 | - foreach($unit_list as $unit_id => $unit_amount) |
|
26 | + foreach ($unit_list as $unit_id => $unit_amount) |
|
27 | 27 | { |
28 | - if($unit_query_string = admin_planet_edit_query_string($unit_id, $unit_amount, $mode)) |
|
28 | + if ($unit_query_string = admin_planet_edit_query_string($unit_id, $unit_amount, $mode)) |
|
29 | 29 | { |
30 | 30 | $query_string[] = $unit_query_string; |
31 | 31 | } |
32 | 32 | } |
33 | 33 | |
34 | - if(!empty($query_string)) |
|
34 | + if (!empty($query_string)) |
|
35 | 35 | { |
36 | 36 | DBStaticPlanet::db_planet_set_by_id($planet_id, implode(', ', $query_string)); |
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
40 | -if($planet_id) |
|
40 | +if ($planet_id) |
|
41 | 41 | { |
42 | 42 | $edit_planet_row = DBStaticPlanet::db_planet_by_id($planet_id); |
43 | 43 | admin_planet_edit_template($template, $edit_planet_row, $mode); |
44 | 44 | } |
45 | 45 | |
46 | -foreach($admin_planet_edit_mode_list as $page_mode => $mode_locale) |
|
46 | +foreach ($admin_planet_edit_mode_list as $page_mode => $mode_locale) |
|
47 | 47 | { |
48 | 48 | $template->assign_block_vars('page_menu', array( |
49 | 49 | 'ID' => $page_mode, |
@@ -19,7 +19,7 @@ |
||
19 | 19 | |
20 | 20 | $template = gettemplate("admin/add_moon", true); |
21 | 21 | |
22 | -if(sys_get_param_str('mode') == 'addit') |
|
22 | +if (sys_get_param_str('mode') == 'addit') |
|
23 | 23 | { |
24 | 24 | $PlanetID = sys_get_param_id('user'); |
25 | 25 | $MoonName = sys_get_param_str('name'); |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | |
16 | 16 | $constants = get_defined_constants(true); |
17 | 17 | $rpgConstants = array(); |
18 | -foreach($constants['user'] as $constantName => $constantValue) { |
|
19 | - if(substr($constantName, 0, 4) == 'RPG_') { |
|
18 | +foreach ($constants['user'] as $constantName => $constantValue) { |
|
19 | + if (substr($constantName, 0, 4) == 'RPG_') { |
|
20 | 20 | $rpgConstants[$constantValue] = $constantName; |
21 | 21 | } |
22 | 22 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | GROUP BY log_dark_matter_reason, IF(sign((log_dark_matter_amount)) > 0, 1, -1) ORDER BY sum(log_dark_matter_amount) DESC; |
34 | 34 | "); |
35 | 35 | |
36 | -while($row = classSupernova::$db->db_fetch($result)) { |
|
36 | +while ($row = classSupernova::$db->db_fetch($result)) { |
|
37 | 37 | $row['CONSTANT'] = $rpgConstants[$row['REASON']]; |
38 | 38 | |
39 | 39 | $row['DM_AMOUNT_TEXT'] = pretty_number($row['DM_AMOUNT']); |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | GROUP BY reason, if(sign((amount)) > 0, 1, -1) ORDER BY sum(amount) DESC; |
56 | 56 | "); |
57 | 57 | |
58 | -while($row = classSupernova::$db->db_fetch($result)) { |
|
59 | - if(empty($spent[$row['BALANCE']])) { |
|
58 | +while ($row = classSupernova::$db->db_fetch($result)) { |
|
59 | + if (empty($spent[$row['BALANCE']])) { |
|
60 | 60 | $spent[$row['BALANCE']] = array(); |
61 | 61 | } |
62 | 62 | |
@@ -66,16 +66,15 @@ discard block |
||
66 | 66 | $spent[$row['BALANCE']] = array_merge_recursive_numeric($spent[$row['BALANCE']], $row); |
67 | 67 | } |
68 | 68 | |
69 | -foreach($spent as &$row) { |
|
69 | +foreach ($spent as &$row) { |
|
70 | 70 | @$row['TOTAL_COUNT'] = $row['MM_COUNT'] + $row['DM_COUNT']; |
71 | 71 | @$row['TOTAL_AMOUNT'] = $row['MM_AMOUNT'] + $row['DM_AMOUNT']; |
72 | 72 | @$row['TOTAL_AMOUNT_TEXT'] = pretty_number($row['TOTAL_AMOUNT']); |
73 | 73 | @$row['TOTAL_COUNT_TEXT'] = pretty_number($row['TOTAL_COUNT']); |
74 | 74 | } |
75 | 75 | |
76 | -usort($spent, function ($a, $b) { |
|
77 | - return $a['TOTAL_AMOUNT'] < $b['TOTAL_AMOUNT'] ? -1 : |
|
78 | - ($a['TOTAL_AMOUNT'] > $b['TOTAL_AMOUNT'] ? 1 : 0); |
|
76 | +usort($spent, function($a, $b) { |
|
77 | + return $a['TOTAL_AMOUNT'] < $b['TOTAL_AMOUNT'] ? -1 : ($a['TOTAL_AMOUNT'] > $b['TOTAL_AMOUNT'] ? 1 : 0); |
|
79 | 78 | }); |
80 | 79 | |
81 | 80 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | //while($CurrentFleet = db_fetch($FlyingFleets)) |
22 | 22 | |
23 | 23 | $all_flying_fleets = db_fleet_list('', DB_SELECT_PLAIN); |
24 | -foreach($all_flying_fleets as $fleet_id => $CurrentFleet) { |
|
24 | +foreach ($all_flying_fleets as $fleet_id => $CurrentFleet) { |
|
25 | 25 | $FleetOwner = db_user_by_id($CurrentFleet['fleet_owner']); |
26 | 26 | $TargetOwner = db_user_by_id($CurrentFleet['fleet_target_owner']); |
27 | 27 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $fleet_data['fleet']['STAY_TIME_INT'] = $CurrentFleet['fleet_end_stay']; |
33 | 33 | |
34 | 34 | $template->assign_block_vars('fleets', $fleet_data['fleet']); |
35 | - foreach($fleet_data['ships'] as $ship_data) { |
|
35 | + foreach ($fleet_data['ships'] as $ship_data) { |
|
36 | 36 | $template->assign_block_vars('fleets.ships', $ship_data); |
37 | 37 | } |
38 | 38 | } |
@@ -14,34 +14,34 @@ discard block |
||
14 | 14 | |
15 | 15 | $in_admin = defined('IN_ADMIN') && IN_ADMIN === true; |
16 | 16 | |
17 | - if($in_admin) |
|
17 | + if ($in_admin) |
|
18 | 18 | { |
19 | 19 | $quest_id = sys_get_param_id('id'); |
20 | 20 | $quest_name = sys_get_param_str_unsafe('QUEST_NAME'); |
21 | - if(!empty($quest_name)) |
|
21 | + if (!empty($quest_name)) |
|
22 | 22 | { |
23 | 23 | $quest_description = sys_get_param_str_unsafe('QUEST_DESCRIPTION'); |
24 | 24 | try |
25 | 25 | { |
26 | 26 | $quest_rewards_list = sys_get_param('QUEST_REWARDS_LIST'); |
27 | 27 | $quest_rewards = array(); |
28 | - foreach($quest_rewards_list as $quest_rewards_id => $quest_rewards_amount) |
|
28 | + foreach ($quest_rewards_list as $quest_rewards_id => $quest_rewards_amount) |
|
29 | 29 | { |
30 | - if(!in_array($quest_rewards_id, $quest_reward_allowed)) |
|
30 | + if (!in_array($quest_rewards_id, $quest_reward_allowed)) |
|
31 | 31 | { |
32 | 32 | throw new Exception($lang['qst_adm_err_reward_type']); |
33 | 33 | } |
34 | 34 | |
35 | - if($quest_rewards_amount < 0) |
|
35 | + if ($quest_rewards_amount < 0) |
|
36 | 36 | { |
37 | 37 | throw new Exception($lang['qst_adm_err_reward_amount']); |
38 | 38 | } |
39 | - elseif($quest_rewards_amount > 0) |
|
39 | + elseif ($quest_rewards_amount > 0) |
|
40 | 40 | { |
41 | 41 | $quest_rewards[] = "{$quest_rewards_id},{$quest_rewards_amount}"; |
42 | 42 | } |
43 | 43 | } |
44 | - if(empty($quest_rewards)) |
|
44 | + if (empty($quest_rewards)) |
|
45 | 45 | { |
46 | 46 | throw new Exception($lang['qst_adm_err_reward_empty']); |
47 | 47 | } |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | $quest_rewards = implode(';', $quest_rewards); |
50 | 50 | |
51 | 51 | $quest_unit_id = sys_get_param_int('QUEST_UNIT_ID'); |
52 | - if(!in_array($quest_unit_id, $quest_units_allowed)) |
|
52 | + if (!in_array($quest_unit_id, $quest_units_allowed)) |
|
53 | 53 | { |
54 | 54 | throw new Exception($lang['qst_adm_err_unit_id']); |
55 | 55 | } |
56 | 56 | |
57 | 57 | $quest_unit_amount = sys_get_param_float('QUEST_UNIT_AMOUNT'); |
58 | - if($quest_unit_amount <= 0) |
|
58 | + if ($quest_unit_amount <= 0) |
|
59 | 59 | { |
60 | 60 | throw new Exception($lang['qst_adm_err_unit_amount']); |
61 | 61 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | // TODO: Change quest type |
65 | 65 | $quest_type = 0; |
66 | 66 | |
67 | - if($mode == 'edit') |
|
67 | + if ($mode == 'edit') |
|
68 | 68 | { |
69 | 69 | DbQuery::build() |
70 | 70 | ->setTable('quest') |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $mode = ''; |
110 | 110 | }; |
111 | 111 | |
112 | - switch($mode) |
|
112 | + switch ($mode) |
|
113 | 113 | { |
114 | 114 | case 'del': |
115 | 115 | doquery("DELETE FROM {{quest}} WHERE `quest_id` = {$quest_id} LIMIT 1;"); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $query = doquery("SELECT count(*) AS count FROM `{{quest}}`;", '', true); |
127 | 127 | $config->db_saveItem('quest_total', $query['count']); |
128 | 128 | } |
129 | - elseif(!$user_id) |
|
129 | + elseif (!$user_id) |
|
130 | 130 | { |
131 | 131 | $user_id = $user['id']; |
132 | 132 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | )); |
154 | 154 | } |
155 | 155 | |
156 | - if($quest) |
|
156 | + if ($quest) |
|
157 | 157 | { |
158 | 158 | $quest_templatized = qst_templatize(qst_quest_parse($quest, false)); |
159 | 159 | } |
@@ -162,19 +162,19 @@ discard block |
||
162 | 162 | $quest_templatized['quest_rewards_list'] = array(); |
163 | 163 | } |
164 | 164 | |
165 | - foreach($quest_reward_allowed as $unit_id) |
|
165 | + foreach ($quest_reward_allowed as $unit_id) |
|
166 | 166 | { |
167 | 167 | $found = false; |
168 | - foreach($quest_templatized['quest_rewards_list'] as $quest_templatized_reward) |
|
168 | + foreach ($quest_templatized['quest_rewards_list'] as $quest_templatized_reward) |
|
169 | 169 | { |
170 | - if($quest_templatized_reward['ID'] == $unit_id) |
|
170 | + if ($quest_templatized_reward['ID'] == $unit_id) |
|
171 | 171 | { |
172 | 172 | $found = true; |
173 | 173 | break; |
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
177 | - if(!$found) |
|
177 | + if (!$found) |
|
178 | 178 | { |
179 | 179 | $quest_templatized['quest_rewards_list'][$unit_id] = array( |
180 | 180 | 'ID' => $unit_id, |
@@ -186,12 +186,12 @@ discard block |
||
186 | 186 | |
187 | 187 | qst_assign_to_template($template, $quest_templatized); |
188 | 188 | |
189 | - foreach($quest_list as $quest_data) |
|
189 | + foreach ($quest_list as $quest_data) |
|
190 | 190 | { |
191 | 191 | qst_assign_to_template($template, qst_templatize($quest_data, true), 'quest'); |
192 | 192 | } |
193 | 193 | |
194 | - foreach($quest_units_allowed as $unit_id) |
|
194 | + foreach ($quest_units_allowed as $unit_id) |
|
195 | 195 | { |
196 | 196 | $template->assign_block_vars('allowed_unit', array( |
197 | 197 | 'ID' => $unit_id, |
@@ -204,12 +204,12 @@ discard block |
||
204 | 204 | { |
205 | 205 | $quest_list = array(); |
206 | 206 | |
207 | - if($user_id) |
|
207 | + if ($user_id) |
|
208 | 208 | { |
209 | - if($status !== QUEST_STATUS_ALL) |
|
209 | + if ($status !== QUEST_STATUS_ALL) |
|
210 | 210 | { |
211 | 211 | $query_add_where = ""; |
212 | - if($status == null || $status == QUEST_STATUS_NOT_STARTED) |
|
212 | + if ($status == null || $status == QUEST_STATUS_NOT_STARTED) |
|
213 | 213 | { |
214 | 214 | $query_add_where .= "AND qs.quest_status_status IS NULL"; |
215 | 215 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | ;" |
234 | 234 | ); |
235 | 235 | |
236 | - while($quest = db_fetch($query)) |
|
236 | + while ($quest = db_fetch($query)) |
|
237 | 237 | { |
238 | 238 | $quest_list[$quest['quest_id']] = qst_quest_parse($quest); |
239 | 239 | } |
@@ -243,16 +243,16 @@ discard block |
||
243 | 243 | |
244 | 244 | function qst_assign_to_template(&$template, $quest_templatized, $block_name = false) |
245 | 245 | { |
246 | - if($block_name) |
|
246 | + if ($block_name) |
|
247 | 247 | { |
248 | 248 | $template->assign_block_vars($block_name, $quest_templatized); |
249 | 249 | } |
250 | 250 | else |
251 | 251 | { |
252 | 252 | $template->assign_vars($quest_templatized); |
253 | - if(!empty($quest_templatized['quest_rewards_list'])) |
|
253 | + if (!empty($quest_templatized['quest_rewards_list'])) |
|
254 | 254 | { |
255 | - foreach($quest_templatized['quest_rewards_list'] as $quest_reward) |
|
255 | + foreach ($quest_templatized['quest_rewards_list'] as $quest_reward) |
|
256 | 256 | { |
257 | 257 | $template->assign_block_vars(($block_name ? $block_name . '.' : '') . 'quest_rewards_list', $quest_reward); |
258 | 258 | } |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | global $lang; |
275 | 275 | |
276 | 276 | $tmp = array(); |
277 | - foreach($quest['quest_rewards_list'] as $quest_reward_id => $quest_reward_amount) |
|
277 | + foreach ($quest['quest_rewards_list'] as $quest_reward_id => $quest_reward_amount) |
|
278 | 278 | { |
279 | 279 | $tmp[] = array( |
280 | 280 | 'ID' => $quest_reward_id, |
@@ -301,9 +301,9 @@ discard block |
||
301 | 301 | function qst_active_triggers($quest_list) |
302 | 302 | { |
303 | 303 | $quest_triggers = array(); |
304 | - foreach($quest_list as $quest_id => $quest) |
|
304 | + foreach ($quest_list as $quest_id => $quest) |
|
305 | 305 | { |
306 | - if($quest['quest_status_status'] != QUEST_STATUS_COMPLETE) |
|
306 | + if ($quest['quest_status_status'] != QUEST_STATUS_COMPLETE) |
|
307 | 307 | { |
308 | 308 | list($quest_unit_id, $quest_unit_amount) = explode(',', $quest['quest_conditions']); |
309 | 309 | $quest_triggers[$quest_id] = $quest_unit_id; |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | */ |
322 | 322 | function qst_reward(&$user, &$rewards, &$quest_list, &$quest_statuses) |
323 | 323 | { |
324 | - if(empty($quest_statuses)) return; |
|
324 | + if (empty($quest_statuses)) return; |
|
325 | 325 | |
326 | 326 | global $lang; |
327 | 327 | |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | 'quest_status_status' => $quest_status |
346 | 346 | )) |
347 | 347 | ->doInsert(); |
348 | - } elseif($questStatus['quest_status_status'] != $quest_status) { |
|
348 | + } elseif ($questStatus['quest_status_status'] != $quest_status) { |
|
349 | 349 | DbQuery::build() |
350 | 350 | ->setTable('quest_status') |
351 | 351 | ->setWhereArray(array( |
@@ -359,20 +359,20 @@ discard block |
||
359 | 359 | } |
360 | 360 | } |
361 | 361 | |
362 | - if(empty($rewards)) return; |
|
362 | + if (empty($rewards)) return; |
|
363 | 363 | |
364 | 364 | $db_changeset = array(); |
365 | 365 | $total_rewards = array(); |
366 | 366 | $comment_dm = ''; |
367 | 367 | |
368 | - foreach($rewards as $quest_id => $user_data) { |
|
369 | - foreach($user_data as $user_id => $planet_data) { |
|
370 | - foreach($planet_data as $planet_id => $reward_list) { |
|
368 | + foreach ($rewards as $quest_id => $user_data) { |
|
369 | + foreach ($user_data as $user_id => $planet_data) { |
|
370 | + foreach ($planet_data as $planet_id => $reward_list) { |
|
371 | 371 | $comment = sprintf($lang['qst_msg_complete_body'], $quest_list[$quest_id]['quest_name']); |
372 | 372 | $comment_dm .= isset($reward_list[RES_DARK_MATTER]) ? $comment : ''; |
373 | 373 | |
374 | 374 | $comment_reward = array(); |
375 | - foreach($reward_list as $unit_id => $unit_amount) |
|
375 | + foreach ($reward_list as $unit_id => $unit_amount) |
|
376 | 376 | { |
377 | 377 | $comment_reward[] = $unit_amount . ' ' . $lang['tech'][$unit_id]; |
378 | 378 | $total_rewards[$user_id][$planet_id][$unit_id] += $unit_amount; |
@@ -395,23 +395,23 @@ discard block |
||
395 | 395 | |
396 | 396 | $group_resources = sn_get_groups('resources_loot'); |
397 | 397 | $quest_rewards_allowed = sn_get_groups('quest_rewards'); |
398 | - if(!empty($total_rewards)) |
|
398 | + if (!empty($total_rewards)) |
|
399 | 399 | { |
400 | - foreach($total_rewards as $user_id => $planet_data) |
|
400 | + foreach ($total_rewards as $user_id => $planet_data) |
|
401 | 401 | { |
402 | 402 | $user_row = classSupernova::db_get_record_by_id(LOC_USER, $user_id); |
403 | - foreach($planet_data as $planet_id => $unit_data) |
|
403 | + foreach ($planet_data as $planet_id => $unit_data) |
|
404 | 404 | { |
405 | 405 | $local_changeset = array(); |
406 | - foreach($unit_data as $unit_id => $unit_amount) |
|
406 | + foreach ($unit_data as $unit_id => $unit_amount) |
|
407 | 407 | { |
408 | - if(!isset($quest_rewards_allowed[$unit_id])) continue; |
|
408 | + if (!isset($quest_rewards_allowed[$unit_id])) continue; |
|
409 | 409 | |
410 | - if($unit_id == RES_DARK_MATTER) |
|
410 | + if ($unit_id == RES_DARK_MATTER) |
|
411 | 411 | { |
412 | 412 | rpg_points_change($user['id'], RPG_QUEST, $unit_amount, $comment_dm); |
413 | 413 | } |
414 | - elseif(isset($group_resources[$unit_id])) |
|
414 | + elseif (isset($group_resources[$unit_id])) |
|
415 | 415 | { |
416 | 416 | $local_changeset[pname_resource_name($unit_id)] = array('delta' => $unit_amount); |
417 | 417 | } |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | } |
422 | 422 | } |
423 | 423 | |
424 | - if(!empty($local_changeset)) |
|
424 | + if (!empty($local_changeset)) |
|
425 | 425 | { |
426 | 426 | $planet_id = $planet_id == 0 && isset($user_row['id_planet']) ? $user_row['id_planet'] : $planet_id; |
427 | 427 | $db_changeset[$planet_id ? 'planets' : 'users'][] = array( |
@@ -2,8 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | use \DBAL\DbQuery; |
4 | 4 | |
5 | -function qst_render_page() |
|
6 | -{ |
|
5 | +function qst_render_page() { |
|
7 | 6 | global $lang, $user, $template, $config; |
8 | 7 | |
9 | 8 | $user_id = sys_get_param_id('user_id', false); |
@@ -35,8 +34,7 @@ discard block |
||
35 | 34 | if($quest_rewards_amount < 0) |
36 | 35 | { |
37 | 36 | throw new Exception($lang['qst_adm_err_reward_amount']); |
38 | - } |
|
39 | - elseif($quest_rewards_amount > 0) |
|
37 | + } elseif($quest_rewards_amount > 0) |
|
40 | 38 | { |
41 | 39 | $quest_rewards[] = "{$quest_rewards_id},{$quest_rewards_amount}"; |
42 | 40 | } |
@@ -78,8 +76,7 @@ discard block |
||
78 | 76 | ->setWhereArray(array('quest_id' => $quest_id)) |
79 | 77 | ->setOneRow() |
80 | 78 | ->doUpdate(); |
81 | - } |
|
82 | - else |
|
79 | + } else |
|
83 | 80 | { |
84 | 81 | DbQuery::build() |
85 | 82 | ->setTable('quest') |
@@ -100,8 +97,7 @@ discard block |
||
100 | 97 | msg_send_simple_message('*', 0, 0, MSG_TYPE_PLAYER, $lang['sys_administration'], $lang['news_title'], $text); |
101 | 98 | } |
102 | 99 | */ |
103 | - } |
|
104 | - catch (Exception $e) |
|
100 | + } catch (Exception $e) |
|
105 | 101 | { |
106 | 102 | messageBox($e->getMessage(), $lang['sys_error']); |
107 | 103 | } |
@@ -125,8 +121,7 @@ discard block |
||
125 | 121 | } |
126 | 122 | $query = doquery("SELECT count(*) AS count FROM `{{quest}}`;", '', true); |
127 | 123 | $config->db_saveItem('quest_total', $query['count']); |
128 | - } |
|
129 | - elseif(!$user_id) |
|
124 | + } elseif(!$user_id) |
|
130 | 125 | { |
131 | 126 | $user_id = $user['id']; |
132 | 127 | } |
@@ -156,8 +151,7 @@ discard block |
||
156 | 151 | if($quest) |
157 | 152 | { |
158 | 153 | $quest_templatized = qst_templatize(qst_quest_parse($quest, false)); |
159 | - } |
|
160 | - else |
|
154 | + } else |
|
161 | 155 | { |
162 | 156 | $quest_templatized['quest_rewards_list'] = array(); |
163 | 157 | } |
@@ -200,8 +194,7 @@ discard block |
||
200 | 194 | } |
201 | 195 | } |
202 | 196 | |
203 | -function qst_get_quests($user_id = false, $status = QUEST_STATUS_ALL) |
|
204 | -{ |
|
197 | +function qst_get_quests($user_id = false, $status = QUEST_STATUS_ALL) { |
|
205 | 198 | $quest_list = array(); |
206 | 199 | |
207 | 200 | if($user_id) |
@@ -212,12 +205,10 @@ discard block |
||
212 | 205 | if($status == null || $status == QUEST_STATUS_NOT_STARTED) |
213 | 206 | { |
214 | 207 | $query_add_where .= "AND qs.quest_status_status IS NULL"; |
215 | - } |
|
216 | - elseif ($status == QUEST_STATUS_EXCEPT_COMPLETE) |
|
208 | + } elseif ($status == QUEST_STATUS_EXCEPT_COMPLETE) |
|
217 | 209 | { |
218 | 210 | $query_add_where .= "AND (qs.quest_status_status IS NULL OR qs.quest_status_status = " . QUEST_STATUS_STARTED . ")"; |
219 | - } |
|
220 | - else |
|
211 | + } else |
|
221 | 212 | { |
222 | 213 | $query_add_where .= "AND qs.quest_status_status = {$status}"; |
223 | 214 | } |
@@ -241,13 +232,11 @@ discard block |
||
241 | 232 | return $quest_list; |
242 | 233 | } |
243 | 234 | |
244 | -function qst_assign_to_template(&$template, $quest_templatized, $block_name = false) |
|
245 | -{ |
|
235 | +function qst_assign_to_template(&$template, $quest_templatized, $block_name = false) { |
|
246 | 236 | if($block_name) |
247 | 237 | { |
248 | 238 | $template->assign_block_vars($block_name, $quest_templatized); |
249 | - } |
|
250 | - else |
|
239 | + } else |
|
251 | 240 | { |
252 | 241 | $template->assign_vars($quest_templatized); |
253 | 242 | if(!empty($quest_templatized['quest_rewards_list'])) |
@@ -260,8 +249,7 @@ discard block |
||
260 | 249 | } |
261 | 250 | } |
262 | 251 | |
263 | -function qst_quest_parse($quest) |
|
264 | -{ |
|
252 | +function qst_quest_parse($quest) { |
|
265 | 253 | list($quest['quest_unit_id'], $quest['quest_unit_amount']) = explode(',', $quest['quest_conditions']); |
266 | 254 | |
267 | 255 | $quest['quest_rewards_list'] = sys_unit_str2arr($quest['quest_rewards']); |
@@ -269,8 +257,7 @@ discard block |
||
269 | 257 | return $quest; |
270 | 258 | } |
271 | 259 | |
272 | -function qst_templatize($quest, $for_display = true) |
|
273 | -{ |
|
260 | +function qst_templatize($quest, $for_display = true) { |
|
274 | 261 | global $lang; |
275 | 262 | |
276 | 263 | $tmp = array(); |
@@ -298,8 +285,7 @@ discard block |
||
298 | 285 | ); |
299 | 286 | } |
300 | 287 | |
301 | -function qst_active_triggers($quest_list) |
|
302 | -{ |
|
288 | +function qst_active_triggers($quest_list) { |
|
303 | 289 | $quest_triggers = array(); |
304 | 290 | foreach($quest_list as $quest_id => $quest) |
305 | 291 | { |
@@ -319,9 +305,10 @@ discard block |
||
319 | 305 | * @param $quest_list |
320 | 306 | * @param integer[] $quest_statuses |
321 | 307 | */ |
322 | -function qst_reward(&$user, &$rewards, &$quest_list, &$quest_statuses) |
|
323 | -{ |
|
324 | - if(empty($quest_statuses)) return; |
|
308 | +function qst_reward(&$user, &$rewards, &$quest_list, &$quest_statuses) { |
|
309 | + if(empty($quest_statuses)) { |
|
310 | + return; |
|
311 | + } |
|
325 | 312 | |
326 | 313 | global $lang; |
327 | 314 | |
@@ -359,7 +346,9 @@ discard block |
||
359 | 346 | } |
360 | 347 | } |
361 | 348 | |
362 | - if(empty($rewards)) return; |
|
349 | + if(empty($rewards)) { |
|
350 | + return; |
|
351 | + } |
|
363 | 352 | |
364 | 353 | $db_changeset = array(); |
365 | 354 | $total_rewards = array(); |
@@ -405,17 +394,17 @@ discard block |
||
405 | 394 | $local_changeset = array(); |
406 | 395 | foreach($unit_data as $unit_id => $unit_amount) |
407 | 396 | { |
408 | - if(!isset($quest_rewards_allowed[$unit_id])) continue; |
|
397 | + if(!isset($quest_rewards_allowed[$unit_id])) { |
|
398 | + continue; |
|
399 | + } |
|
409 | 400 | |
410 | 401 | if($unit_id == RES_DARK_MATTER) |
411 | 402 | { |
412 | 403 | rpg_points_change($user['id'], RPG_QUEST, $unit_amount, $comment_dm); |
413 | - } |
|
414 | - elseif(isset($group_resources[$unit_id])) |
|
404 | + } elseif(isset($group_resources[$unit_id])) |
|
415 | 405 | { |
416 | 406 | $local_changeset[pname_resource_name($unit_id)] = array('delta' => $unit_amount); |
417 | - } |
|
418 | - else // Проверим на юниты |
|
407 | + } else // Проверим на юниты |
|
419 | 408 | { |
420 | 409 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, $unit_amount, $user_row, $planet_id); |
421 | 410 | } |
@@ -440,12 +429,10 @@ discard block |
||
440 | 429 | } |
441 | 430 | } |
442 | 431 | |
443 | -function get_quest_amount_complete($user_id) |
|
444 | -{ |
|
432 | +function get_quest_amount_complete($user_id) { |
|
445 | 433 | return count(qst_get_quests($user_id, QUEST_STATUS_COMPLETE)); |
446 | 434 | } |
447 | 435 | |
448 | -function get_quest_amount_in_progress($user_id) |
|
449 | -{ |
|
436 | +function get_quest_amount_in_progress($user_id) { |
|
450 | 437 | return count(qst_get_quests($user_id, QUEST_STATUS_STARTED)); |
451 | 438 | } |
@@ -23,15 +23,15 @@ discard block |
||
23 | 23 | $template->assign_var('NEWS_COUNT', db_num_rows($announce_list)); |
24 | 24 | |
25 | 25 | $users = array(); |
26 | - while($announce = db_fetch($announce_list)) { |
|
27 | - if($announce['user_id'] && !isset($users[$announce['user_id']])) { |
|
26 | + while ($announce = db_fetch($announce_list)) { |
|
27 | + if ($announce['user_id'] && !isset($users[$announce['user_id']])) { |
|
28 | 28 | $users[$announce['user_id']] = db_user_by_id($announce['user_id']); |
29 | 29 | } |
30 | 30 | |
31 | 31 | $survey_vote = array('survey_vote_id' => 1); |
32 | 32 | $survey_complete = strtotime($announce['survey_until']) < SN_TIME_NOW; |
33 | 33 | |
34 | - if($announce['survey_id'] && !empty($user['id'])) { |
|
34 | + if ($announce['survey_id'] && !empty($user['id'])) { |
|
35 | 35 | $survey_vote = !$survey_complete ? $survey_vote = doquery("SELECT `survey_vote_id` FROM `{{survey_votes}}` WHERE survey_parent_id = {$announce['survey_id']} AND survey_vote_user_id = {$user['id']} LIMIT 1;", true) : array(); |
36 | 36 | } |
37 | 37 | |
@@ -43,8 +43,7 @@ discard block |
||
43 | 43 | 'ANNOUNCE' => classSupernova::$gc->bbCodeParser->expandBbCode($announce['strAnnounce'], intval($announce['authlevel'])), |
44 | 44 | 'DETAIL_URL' => $announce['detail_url'], |
45 | 45 | 'USER_NAME' => |
46 | - isset($users[$announce['user_id']]) && $users[$announce['user_id']] ? player_nick_render_to_html($users[$announce['user_id']], array('color' => true)): |
|
47 | - js_safe_string($announce['user_name']), |
|
46 | + isset($users[$announce['user_id']]) && $users[$announce['user_id']] ? player_nick_render_to_html($users[$announce['user_id']], array('color' => true)) : js_safe_string($announce['user_name']), |
|
48 | 47 | 'NEW' => $announce['unix_time'] + $config->game_news_actual >= SN_TIME_NOW, |
49 | 48 | 'FUTURE' => $announce['unix_time'] > SN_TIME_NOW, |
50 | 49 | 'SURVEY_ID' => $announce['survey_id'], |
@@ -54,13 +53,13 @@ discard block |
||
54 | 53 | 'SURVEY_UNTIL' => $announce['survey_until'], |
55 | 54 | )); |
56 | 55 | |
57 | - foreach($announce_exploded as $announce_paragraph) { |
|
56 | + foreach ($announce_exploded as $announce_paragraph) { |
|
58 | 57 | $template->assign_block_vars('announces.paragraph', array( |
59 | 58 | 'TEXT' => $announce_paragraph, |
60 | 59 | )); |
61 | 60 | } |
62 | 61 | |
63 | - if($announce['survey_id']) { |
|
62 | + if ($announce['survey_id']) { |
|
64 | 63 | $survey_query = doquery( |
65 | 64 | "SELECT survey_answer_text AS `TEXT`, count(DISTINCT survey_vote_id) AS `VOTES` |
66 | 65 | FROM `{{survey_answers}}` AS sa |
@@ -71,15 +70,15 @@ discard block |
||
71 | 70 | ); |
72 | 71 | $survey_vote_result = array(); |
73 | 72 | $total_votes = 0; |
74 | - while($row = db_fetch($survey_query)) { |
|
73 | + while ($row = db_fetch($survey_query)) { |
|
75 | 74 | $survey_vote_result[] = $row; |
76 | 75 | $total_votes += $row['VOTES']; |
77 | 76 | } |
78 | 77 | |
79 | - if(empty($survey_vote) && !$survey_complete) { |
|
78 | + if (empty($survey_vote) && !$survey_complete) { |
|
80 | 79 | // Can vote |
81 | 80 | $survey_query = doquery("SELECT * FROM {{survey_answers}} WHERE survey_parent_id = {$announce['survey_id']} ORDER BY survey_answer_id;"); |
82 | - while($row = db_fetch($survey_query)) { |
|
81 | + while ($row = db_fetch($survey_query)) { |
|
83 | 82 | $template->assign_block_vars('announces.survey_answers', array( |
84 | 83 | 'ID' => $row['survey_answer_id'], |
85 | 84 | 'TEXT' => $row['survey_answer_text'], |
@@ -87,7 +86,7 @@ discard block |
||
87 | 86 | } |
88 | 87 | } else { |
89 | 88 | // Show result |
90 | - foreach($survey_vote_result as &$vote_result) { |
|
89 | + foreach ($survey_vote_result as &$vote_result) { |
|
91 | 90 | $vote_percent = $total_votes ? $vote_result['VOTES'] / $total_votes * 100 : 0; |
92 | 91 | $vote_result['PERCENT'] = $vote_percent; |
93 | 92 | $vote_result['PERCENT_TEXT'] = round($vote_percent, 1); |
@@ -104,7 +103,7 @@ discard block |
||
104 | 103 | } |
105 | 104 | |
106 | 105 | function nws_mark_read(&$user) { |
107 | - if(isset($user['id'])) { |
|
106 | + if (isset($user['id'])) { |
|
108 | 107 | db_user_set_by_id($user['id'], '`news_lastread` = ' . SN_TIME_NOW); |
109 | 108 | $user['news_lastread'] = SN_TIME_NOW; |
110 | 109 | } |
@@ -112,17 +111,17 @@ discard block |
||
112 | 111 | } |
113 | 112 | |
114 | 113 | function survey_vote(&$user) { |
115 | - if(empty($user['id'])) { |
|
114 | + if (empty($user['id'])) { |
|
116 | 115 | return true; |
117 | 116 | } |
118 | 117 | |
119 | 118 | sn_db_transaction_start(); |
120 | 119 | $survey_id = sys_get_param_id('survey_id'); |
121 | 120 | $is_voted = doquery("SELECT `survey_vote_id` FROM `{{survey_votes}}` WHERE survey_parent_id = {$survey_id} AND survey_vote_user_id = {$user['id']} FOR UPDATE;", true); |
122 | - if(empty($is_voted)) { |
|
121 | + if (empty($is_voted)) { |
|
123 | 122 | $survey_vote_id = sys_get_param_id('survey_vote'); |
124 | 123 | $is_answer_exists = doquery("SELECT `survey_answer_id` FROM `{{survey_answers}}` WHERE survey_parent_id = {$survey_id} AND survey_answer_id = {$survey_vote_id};", true); |
125 | - if(!empty($is_answer_exists)) { |
|
124 | + if (!empty($is_answer_exists)) { |
|
126 | 125 | $user_name_safe = db_escape($user['username']); |
127 | 126 | doquery("INSERT INTO {{survey_votes}} SET `survey_parent_id` = {$survey_id}, `survey_parent_answer_id` = {$survey_vote_id}, `survey_vote_user_id` = {$user['id']}, `survey_vote_user_name` = '{$user_name_safe}';"); |
128 | 127 | } |