@@ -12,25 +12,25 @@ discard block |
||
12 | 12 | global $debug, $sn_mvc, $template_result, $user; |
13 | 13 | |
14 | 14 | // Напоминание для Администрации, что игра отключена |
15 | -if($template_result[F_GAME_DISABLE]) { |
|
15 | +if ($template_result[F_GAME_DISABLE]) { |
|
16 | 16 | // $disable_reason = sys_bbcodeParse($config->game_disable_reason); // Должна быть инициализирована выше по коду - в init.php |
17 | 17 | echo '<div class="global_admin_warning">', $template_result[F_GAME_DISABLE_REASON], '</div>'; |
18 | 18 | } |
19 | 19 | unset($disable_reason); |
20 | 20 | |
21 | 21 | |
22 | -if(defined('IN_ADMIN') && IN_ADMIN === true) { |
|
22 | +if (defined('IN_ADMIN') && IN_ADMIN === true) { |
|
23 | 23 | lng_include('admin'); |
24 | -} elseif($sys_user_logged_in) { |
|
24 | +} elseif ($sys_user_logged_in) { |
|
25 | 25 | sys_user_vacation($user); |
26 | 26 | |
27 | 27 | $planet_id = SetSelectedPlanet($user); |
28 | 28 | |
29 | 29 | // TODO НЕ НУЖНО АЛЬЯНС КАЖДЫЙ РАЗ ОБНОВЛЯТЬ!!! |
30 | - if($user['ally_id']) { |
|
30 | + if ($user['ally_id']) { |
|
31 | 31 | sn_db_transaction_start(); |
32 | 32 | sn_ali_fill_user_ally($user); |
33 | - if(!$user['ally']['player']['id']) { |
|
33 | + if (!$user['ally']['player']['id']) { |
|
34 | 34 | // sn_sys_logout(false, true); |
35 | 35 | // core_auth::logout(false); |
36 | 36 | classSupernova::$auth->logout(false); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | sn_db_transaction_commit(); |
50 | 50 | |
51 | 51 | $planetrow = $global_data['planet']; |
52 | - if(!($planetrow && isset($planetrow['id']) && $planetrow['id'])) { |
|
52 | + if (!($planetrow && isset($planetrow['id']) && $planetrow['id'])) { |
|
53 | 53 | // sn_sys_logout(false, true); |
54 | 54 | // core_auth::logout(false); |
55 | 55 | classSupernova::$auth->logout(false); |
@@ -20,7 +20,7 @@ |
||
20 | 20 | |
21 | 21 | $query = db_banned_list_select(); |
22 | 22 | $i = 0; |
23 | -while($ban_row = db_fetch($query)) { |
|
23 | +while ($ban_row = db_fetch($query)) { |
|
24 | 24 | $template->assign_block_vars('banlist', array( |
25 | 25 | 'USER_NAME' => $ban_row['ban_user_name'], |
26 | 26 | 'REASON' => $ban_row['ban_reason'], |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
13 | 13 | |
14 | 14 | // if ($user['authlevel'] < 2) |
15 | -if($user['authlevel'] < 3) { |
|
15 | +if ($user['authlevel'] < 3) { |
|
16 | 16 | AdminMessage($lang['adm_err_denied']); |
17 | 17 | } |
18 | 18 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | //while($CurrentFleet = db_fetch($FlyingFleets)) |
23 | 23 | |
24 | 24 | $all_flying_fleets = FleetList::dbGetFleetList(); |
25 | -foreach($all_flying_fleets->_container as $fleet_id => $objFleet) { |
|
25 | +foreach ($all_flying_fleets->_container as $fleet_id => $objFleet) { |
|
26 | 26 | $FleetOwner = db_user_by_id($objFleet->playerOwnerId); |
27 | 27 | $TargetOwner = db_user_by_id($objFleet->target_owner_id); |
28 | 28 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $fleet_data['fleet']['STAY_TIME_INT'] = $objFleet->time_mission_job_complete; |
34 | 34 | |
35 | 35 | $template->assign_block_vars('fleets', $fleet_data['fleet']); |
36 | - foreach($fleet_data['ships'] as $ship_data) { |
|
36 | + foreach ($fleet_data['ships'] as $ship_data) { |
|
37 | 37 | $template->assign_block_vars('fleets.ships', $ship_data); |
38 | 38 | } |
39 | 39 | } |
@@ -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); |
@@ -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); |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
3 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
4 | 4 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
5 | 5 | } |
6 | 6 | |
7 | -if(!$user_can_negotiate) { |
|
7 | +if (!$user_can_negotiate) { |
|
8 | 8 | message($lang['Denied_access'], $lang['ali_dip_title']); |
9 | 9 | } |
10 | 10 | |
@@ -15,24 +15,24 @@ discard block |
||
15 | 15 | |
16 | 16 | |
17 | 17 | |
18 | -if(sys_get_param_str('ali_dip_offer_make')) { |
|
18 | +if (sys_get_param_str('ali_dip_offer_make')) { |
|
19 | 19 | $alliance_negotiation_relation = sys_get_param_str('alliance_negotiation_relation'); |
20 | - if(!array_key_exists($alliance_negotiation_relation, $sn_diplomacy_relation_list)) { |
|
20 | + if (!array_key_exists($alliance_negotiation_relation, $sn_diplomacy_relation_list)) { |
|
21 | 21 | message($lang['ali_dip_err_wrong_offer'], $page_title); |
22 | 22 | } |
23 | 23 | |
24 | 24 | $alliance_negotiation_contr_ally_id = sys_get_param_id('alliance_negotiation_contr_ally_id'); |
25 | - if($alliance_negotiation_contr_ally_id == $user['ally_id']) { |
|
25 | + if ($alliance_negotiation_contr_ally_id == $user['ally_id']) { |
|
26 | 26 | message($lang['ali_dip_err_same_ally'], $page_title); |
27 | 27 | } |
28 | 28 | |
29 | 29 | $contr_ally_row = db_ally_get_by_id($alliance_negotiation_contr_ally_id); |
30 | - if(!$contr_ally_row) { |
|
30 | + if (!$contr_ally_row) { |
|
31 | 31 | message($lang['ali_dip_err_no_ally'], $page_title); |
32 | 32 | } |
33 | 33 | |
34 | 34 | $relation_current_id = ali_relation($user['ally_id'], $alliance_negotiation_contr_ally_id); |
35 | - if($alliance_negotiation_relation == $relation_current_id) { |
|
35 | + if ($alliance_negotiation_relation == $relation_current_id) { |
|
36 | 36 | message(sprintf($lang['ali_dip_err_offer_same'], $lang['ali_dip_relations'][$alliance_negotiation_relation]), $page_title); |
37 | 37 | } |
38 | 38 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | $relation_new = $sn_diplomacy_relation_list[$alliance_negotiation_relation]; |
45 | 45 | $relation_current = $sn_diplomacy_relation_list[$relation_current_id]; |
46 | - if($relation_new['enter_delay'] == -1 || $relation_current['exit_delay'] == -1) { |
|
46 | + if ($relation_new['enter_delay'] == -1 || $relation_current['exit_delay'] == -1) { |
|
47 | 47 | sn_db_perform('{{alliance_negotiation}}', |
48 | 48 | array( |
49 | 49 | 'alliance_negotiation_ally_id' => $user['ally_id'], |
@@ -70,33 +70,33 @@ discard block |
||
70 | 70 | } |
71 | 71 | } else { |
72 | 72 | $offer_id = sys_get_param_id('offer_id'); |
73 | - if($offer_id) { |
|
73 | + if ($offer_id) { |
|
74 | 74 | $offer_answer = sys_get_param_str('answer'); |
75 | 75 | |
76 | 76 | $negotiation = db_ally_negotiation_get_by_offer_id($offer_id); |
77 | - if(!$negotiation) { |
|
77 | + if (!$negotiation) { |
|
78 | 78 | message($lang['ali_dip_err_offer_none'], $page_title); |
79 | - } elseif($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id']) { |
|
79 | + } elseif ($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id']) { |
|
80 | 80 | // TODO: Add log of hack attempt |
81 | 81 | message($lang['ali_dip_err_offer_alien'], $page_title); |
82 | - } elseif($negotiation['alliance_negotiation_ally_id'] == $user['ally_id']) { |
|
83 | - if($offer_answer == 'accept') { |
|
82 | + } elseif ($negotiation['alliance_negotiation_ally_id'] == $user['ally_id']) { |
|
83 | + if ($offer_answer == 'accept') { |
|
84 | 84 | // TODO: Add log of hack attempt |
85 | 85 | message($lang['ali_dip_err_offer_accept_own'], $page_title); |
86 | - } elseif($offer_answer == 'deny') { |
|
86 | + } elseif ($offer_answer == 'deny') { |
|
87 | 87 | db_ally_negotiation_delete_by_offer_id($offer_id); |
88 | 88 | } |
89 | 89 | } else { |
90 | - if($offer_answer == 'accept') { |
|
90 | + if ($offer_answer == 'accept') { |
|
91 | 91 | $accept_offer = true; |
92 | - } elseif($offer_answer == 'deny') { |
|
92 | + } elseif ($offer_answer == 'deny') { |
|
93 | 93 | db_ally_negotiation_update_status_1($offer_id); |
94 | 94 | } |
95 | 95 | } |
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
99 | -if($accept_offer) { |
|
99 | +if ($accept_offer) { |
|
100 | 100 | sn_db_transaction_start(); |
101 | 101 | |
102 | 102 | // TODO: Make sn_db_perform() multirow |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | sn_db_transaction_commit(); |
126 | 126 | } |
127 | 127 | |
128 | -foreach($sn_diplomacy_relation_list as $diplomacy_relation_id => $diplomacy_relation) { |
|
128 | +foreach ($sn_diplomacy_relation_list as $diplomacy_relation_id => $diplomacy_relation) { |
|
129 | 129 | $template->assign_block_vars('relation', array( |
130 | 130 | 'ID' => $diplomacy_relation_id, |
131 | 131 | 'TEXT' => $lang['ali_dip_relations'][$diplomacy_relation_id], |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | |
136 | 136 | $query = db_ally_list_get_by_not_user_ally($user); |
137 | -while($alliance = db_fetch($query)) { |
|
137 | +while ($alliance = db_fetch($query)) { |
|
138 | 138 | $template->assign_block_vars('alliance', array( |
139 | 139 | 'ID' => $alliance['id'], |
140 | 140 | 'NAME' => js_safe_string($alliance['ally_name']), |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | $query = db_ally_negotiation_list($user); |
146 | -while($offer = db_fetch($query)) { |
|
146 | +while ($offer = db_fetch($query)) { |
|
147 | 147 | $template->assign_block_vars('offer', array( |
148 | 148 | 'ID' => $offer['alliance_negotiation_id'], |
149 | 149 | 'NAME' => $offer['ally_name'], |
@@ -1,17 +1,17 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
3 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
4 | 4 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
5 | 5 | } |
6 | 6 | |
7 | 7 | $template = gettemplate('ali_info', true); |
8 | 8 | |
9 | -if($mode == 'exit') { |
|
10 | - if($ally['ally_owner'] == $user['id']) { |
|
9 | +if ($mode == 'exit') { |
|
10 | + if ($ally['ally_owner'] == $user['id']) { |
|
11 | 11 | message($lang['Owner_cant_go_out'], $lang['Alliance']); |
12 | 12 | } |
13 | 13 | |
14 | - if(sys_get_param_int('ali_info_leave_confirm')) { |
|
14 | + if (sys_get_param_int('ali_info_leave_confirm')) { |
|
15 | 15 | sn_db_transaction_start(); |
16 | 16 | db_user_set_by_id($user['id'], "`ally_id` = null, `ally_name` = null, `ally_tag` = null, `ally_register_time` = 0, `ally_rank_id` = 0"); |
17 | 17 | db_ally_list_recalc_counts(); |
@@ -19,20 +19,20 @@ discard block |
||
19 | 19 | $lang['Go_out_welldone'] = str_replace("%s", $ally_name, $lang['Go_out_welldone']); |
20 | 20 | message(sprintf($lang['ali_info_leave_success'], $ally['ally_name']), $lang['sys_alliance']); |
21 | 21 | } |
22 | -} elseif($mode == 'ainfo') { |
|
22 | +} elseif ($mode == 'ainfo') { |
|
23 | 23 | $tag = sys_get_param_str('tag'); |
24 | 24 | $id_ally = sys_get_param_id('a'); |
25 | - if($tag) { |
|
25 | + if ($tag) { |
|
26 | 26 | $ally = db_ally_get_by_tag($tag); |
27 | - } elseif($id_ally) { |
|
27 | + } elseif ($id_ally) { |
|
28 | 28 | $ally = db_ally_get_by_id($id_ally); |
29 | 29 | } |
30 | 30 | |
31 | - if(!$ally) { |
|
31 | + if (!$ally) { |
|
32 | 32 | message($lang['ali_sys_notFound'], $lang['Ally_info_1']); |
33 | 33 | } |
34 | 34 | |
35 | - if(!$ally['ally_description']) { |
|
35 | + if (!$ally['ally_description']) { |
|
36 | 36 | $ally['ally_description'] = $lang['Ally_nodescription']; |
37 | 37 | } |
38 | 38 | |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | } else { |
45 | 45 | $page_header = $lang['your_alliance']; |
46 | 46 | |
47 | - if($ally['ally_owner'] == $user['id']) { |
|
47 | + if ($ally['ally_owner'] == $user['id']) { |
|
48 | 48 | $range = $ally['ally_owner_range'] ? $ally['ally_owner_range'] : $lang['Founder']; |
49 | - } elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) { |
|
49 | + } elseif ($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) { |
|
50 | 50 | $range = $ranks[$user['ally_rank_id']]['name']; |
51 | 51 | } else { |
52 | 52 | $range = $lang['member']; |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | )); |
88 | 88 | |
89 | 89 | $relations = ali_relations($ally['id']); |
90 | -foreach($relations as $relation) { |
|
91 | - if($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id']) { |
|
90 | +foreach ($relations as $relation) { |
|
91 | + if ($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id']) { |
|
92 | 92 | $template->assign_block_vars('relation', array( |
93 | 93 | 'NAME' => $relation['alliance_diplomacy_contr_ally_name'], |
94 | 94 | 'RELATION' => $lang['ali_dip_relations'][$relation['alliance_diplomacy_relation']], |
@@ -11,15 +11,15 @@ discard block |
||
11 | 11 | $announce_list = db_news_list_get_by_query($template, $query_where, $query_limit); |
12 | 12 | |
13 | 13 | $users = array(); |
14 | - while($announce = db_fetch($announce_list)) { |
|
15 | - if($announce['user_id'] && !isset($users[$announce['user_id']])) { |
|
14 | + while ($announce = db_fetch($announce_list)) { |
|
15 | + if ($announce['user_id'] && !isset($users[$announce['user_id']])) { |
|
16 | 16 | $users[$announce['user_id']] = db_user_by_id($announce['user_id']); |
17 | 17 | } |
18 | 18 | |
19 | 19 | $survey_vote = array('survey_vote_id' => 1); |
20 | 20 | $survey_complete = strtotime($announce['survey_until']) < SN_TIME_NOW; |
21 | 21 | |
22 | - if($announce['survey_id'] && !empty($user['id'])) { |
|
22 | + if ($announce['survey_id'] && !empty($user['id'])) { |
|
23 | 23 | $survey_vote = !$survey_complete ? db_survey_get_vote($announce, $user) : array(); |
24 | 24 | } |
25 | 25 | |
@@ -31,8 +31,7 @@ discard block |
||
31 | 31 | 'ANNOUNCE' => cht_message_parse($announce['strAnnounce'], false, intval($announce['authlevel'])), |
32 | 32 | 'DETAIL_URL' => $announce['detail_url'], |
33 | 33 | 'USER_NAME' => |
34 | - isset($users[$announce['user_id']]) && $users[$announce['user_id']] ? player_nick_render_to_html($users[$announce['user_id']], array('color' => true)) : |
|
35 | - js_safe_string($announce['user_name']), |
|
34 | + 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']), |
|
36 | 35 | 'NEW' => $announce['unix_time'] + $config->game_news_actual >= SN_TIME_NOW, |
37 | 36 | 'FUTURE' => $announce['unix_time'] > SN_TIME_NOW, |
38 | 37 | 'SURVEY_ID' => $announce['survey_id'], |
@@ -42,25 +41,25 @@ discard block |
||
42 | 41 | 'SURVEY_UNTIL' => $announce['survey_until'], |
43 | 42 | )); |
44 | 43 | |
45 | - foreach($announce_exploded as $announce_paragraph) { |
|
44 | + foreach ($announce_exploded as $announce_paragraph) { |
|
46 | 45 | $template->assign_block_vars('announces.paragraph', array( |
47 | 46 | 'TEXT' => $announce_paragraph, |
48 | 47 | )); |
49 | 48 | } |
50 | 49 | |
51 | - if($announce['survey_id']) { |
|
50 | + if ($announce['survey_id']) { |
|
52 | 51 | $survey_query = db_survey_get_answer_texts($announce); |
53 | 52 | $survey_vote_result = array(); |
54 | 53 | $total_votes = 0; |
55 | - while($row = db_fetch($survey_query)) { |
|
54 | + while ($row = db_fetch($survey_query)) { |
|
56 | 55 | $survey_vote_result[] = $row; |
57 | 56 | $total_votes += $row['VOTES']; |
58 | 57 | } |
59 | 58 | |
60 | - if(empty($survey_vote) && !$survey_complete) { |
|
59 | + if (empty($survey_vote) && !$survey_complete) { |
|
61 | 60 | // Can vote |
62 | 61 | $survey_query = db_survey_answers_get_list_by_parent($announce); |
63 | - while($row = db_fetch($survey_query)) { |
|
62 | + while ($row = db_fetch($survey_query)) { |
|
64 | 63 | $template->assign_block_vars('announces.survey_answers', array( |
65 | 64 | 'ID' => $row['survey_answer_id'], |
66 | 65 | 'TEXT' => $row['survey_answer_text'], |
@@ -68,7 +67,7 @@ discard block |
||
68 | 67 | } |
69 | 68 | } else { |
70 | 69 | // Show result |
71 | - foreach($survey_vote_result as &$vote_result) { |
|
70 | + foreach ($survey_vote_result as &$vote_result) { |
|
72 | 71 | $vote_percent = $total_votes ? $vote_result['VOTES'] / $total_votes * 100 : 0; |
73 | 72 | $vote_result['PERCENT'] = $vote_percent; |
74 | 73 | $vote_result['PERCENT_TEXT'] = round($vote_percent, 1); |
@@ -85,7 +84,7 @@ discard block |
||
85 | 84 | } |
86 | 85 | |
87 | 86 | function nws_mark_read(&$user) { |
88 | - if(isset($user['id'])) { |
|
87 | + if (isset($user['id'])) { |
|
89 | 88 | db_user_set_by_id($user['id'], '`news_lastread` = ' . SN_TIME_NOW); |
90 | 89 | $user['news_lastread'] = SN_TIME_NOW; |
91 | 90 | } |
@@ -94,17 +93,17 @@ discard block |
||
94 | 93 | } |
95 | 94 | |
96 | 95 | function survey_vote(&$user) { |
97 | - if(empty($user['id'])) { |
|
96 | + if (empty($user['id'])) { |
|
98 | 97 | return true; |
99 | 98 | } |
100 | 99 | |
101 | 100 | sn_db_transaction_start(); |
102 | 101 | $survey_id = sys_get_param_id('survey_id'); |
103 | 102 | $is_voted = db_survey_vote_get($user, $survey_id); |
104 | - if(empty($is_voted)) { |
|
103 | + if (empty($is_voted)) { |
|
105 | 104 | $survey_vote_id = sys_get_param_id('survey_vote'); |
106 | 105 | $is_answer_exists = db_survey_answer_get($survey_id, $survey_vote_id); |
107 | - if(!empty($is_answer_exists)) { |
|
106 | + if (!empty($is_answer_exists)) { |
|
108 | 107 | $user_name_safe = db_escape($user['username']); |
109 | 108 | db_survey_vote_insert($user, $survey_id, $survey_vote_id, $user_name_safe); |
110 | 109 | } |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | ), |
25 | 25 | ); |
26 | 26 | |
27 | - foreach($queries as &$query) { |
|
28 | - if(!empty($query['query'])) { |
|
27 | + foreach ($queries as &$query) { |
|
28 | + if (!empty($query['query'])) { |
|
29 | 29 | $query['result'] = doquery($query['query']); |
30 | - } elseif(!empty($query['callable']) && is_callable($query['callable'])) { |
|
30 | + } elseif (!empty($query['callable']) && is_callable($query['callable'])) { |
|
31 | 31 | call_user_func($query['callable']); |
32 | 32 | } |
33 | 33 | $query['error'] = classSupernova::$db->db_error(); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $today_array = array($today_array['seconds'], $today_array['minutes'], $today_array['hours'], $today_array['mday'], $today_array['mon'], $today_array['year']); |
72 | 72 | // pdump($prev_run_array); |
73 | 73 | $scheduleList = explode(',', $scheduleList); |
74 | - array_walk($scheduleList, function (&$schedule) use ($prev_run_array, $today_array, $date_part_names_reverse, &$possible_schedules) { |
|
74 | + array_walk($scheduleList, function(&$schedule) use ($prev_run_array, $today_array, $date_part_names_reverse, &$possible_schedules) { |
|
75 | 75 | // pdump($schedule); |
76 | 76 | $schedule = array('schedule_array' => array_reverse(explode(':', trim($schedule)))); |
77 | 77 | |
@@ -83,21 +83,21 @@ discard block |
||
83 | 83 | */ |
84 | 84 | // pdump($schedule); |
85 | 85 | |
86 | - foreach($prev_run_array as $index => $date_part) { |
|
86 | + foreach ($prev_run_array as $index => $date_part) { |
|
87 | 87 | $schedule['array']['recorded'][$index] = isset($schedule['schedule_array'][$index]) ? intval($schedule['schedule_array'][$index]) : $date_part; |
88 | 88 | $schedule['array']['now'][$index] = isset($schedule['schedule_array'][$index]) ? intval($schedule['schedule_array'][$index]) : $today_array[$index]; |
89 | 89 | } |
90 | - if($schedule['array']['recorded'] == $schedule['array']['now']) { |
|
90 | + if ($schedule['array']['recorded'] == $schedule['array']['now']) { |
|
91 | 91 | unset($schedule['array']['now']); |
92 | 92 | } |
93 | 93 | |
94 | - foreach($schedule['array'] as $name => $array) { |
|
94 | + foreach ($schedule['array'] as $name => $array) { |
|
95 | 95 | $schedule['string'][$name] = "{$array[5]}-{$array[4]}-{$array[3]} {$array[2]}:{$array[1]}:{$array[0]}"; |
96 | 96 | $schedule['string'][$name . '_next'] = $schedule['string'][$name] . ' +1 ' . $interval; |
97 | 97 | $schedule['string'][$name . '_prev'] = $schedule['string'][$name] . ' -1 ' . $interval; |
98 | 98 | } |
99 | 99 | |
100 | - foreach($schedule['string'] as $string) { |
|
100 | + foreach ($schedule['string'] as $string) { |
|
101 | 101 | $timestamp = strtotime($string); |
102 | 102 | $schedule['timestamp'][$timestamp] = $possible_schedules[$timestamp] = date(FMT_DATE_TIME_SQL, strtotime($string)); |
103 | 103 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | $prev_run = 0; |
131 | 131 | $next_run = 0; |
132 | - foreach($possible_schedules as $timestamp => $string_date) { |
|
132 | + foreach ($possible_schedules as $timestamp => $string_date) { |
|
133 | 133 | $prev_run = SN_TIME_NOW >= $timestamp ? $timestamp : $prev_run; |
134 | 134 | $next_run = SN_TIME_NOW < $timestamp && !$next_run ? $timestamp : $next_run; |
135 | 135 | // pdump($schedule, '$schedule ' . date(FMT_DATE_TIME_SQL, $schedule)); |