@@ -43,23 +43,23 @@ discard block |
||
43 | 43 | |
44 | 44 | $sta_update_msg = db_escape($sta_update_msg); |
45 | 45 | |
46 | - if($next_step) { |
|
46 | + if ($next_step) { |
|
47 | 47 | $sta_update_step++; |
48 | 48 | } |
49 | 49 | $sta_update_msg = "Update in progress. Step {$sta_update_step}/14: {$sta_update_msg}."; |
50 | 50 | |
51 | 51 | classSupernova::$config->db_saveItem('var_stat_update_msg', $sta_update_msg); |
52 | - if($next_step) { |
|
52 | + if ($next_step) { |
|
53 | 53 | classSupernova::$debug->warning($sta_update_msg, 'Stat update', LOG_INFO_STAT_PROCESS); |
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
57 | 57 | function sys_stat_calculate_flush(&$data, $force = false) { |
58 | - if(count($data) < 25 && !$force) { |
|
58 | + if (count($data) < 25 && !$force) { |
|
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
62 | - if(!empty($data)) { |
|
62 | + if (!empty($data)) { |
|
63 | 63 | classSupernova::$gc->db->doInsertBatch( |
64 | 64 | TABLE_STAT_POINTS, $data, array( |
65 | 65 | 'id_owner', |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | classSupernova::$gc->cacheOperator->db_lock_tables('users'); |
115 | 115 | $user_list = DBStaticUser::db_user_list('', true, 'id, dark_matter, metal, crystal, deuterium, user_as_ally, ally_id'); |
116 | 116 | $row_num = count($user_list); |
117 | - foreach($user_list as $player) { |
|
118 | - if($i++ % 100 == 0) { |
|
117 | + foreach ($user_list as $player) { |
|
118 | + if ($i++ % 100 == 0) { |
|
119 | 119 | sta_set_time_limit("calculating players stats (player {$i}/{$row_num})", false); |
120 | 120 | } |
121 | - if(array_key_exists($user_id = $player['id'], $user_skip_list)) { |
|
121 | + if (array_key_exists($user_id = $player['id'], $user_skip_list)) { |
|
122 | 122 | continue; |
123 | 123 | } |
124 | 124 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $counts[$user_id][UNIT_RESOURCES] += $resources; |
128 | 128 | |
129 | 129 | // А здесь мы фильтруем пользователей по $user_skip_list - далее не нужно этого делать, потому что |
130 | - if(!isset($user_skip_list[$user_id])) { |
|
130 | + if (!isset($user_skip_list[$user_id])) { |
|
131 | 131 | $user_allies[$user_id] = $player['ally_id']; |
132 | 132 | } |
133 | 133 | } |
@@ -139,11 +139,11 @@ discard block |
||
139 | 139 | $i = 0; |
140 | 140 | $query = DBStaticPlanet::db_planet_list_resources_by_owner(); |
141 | 141 | $row_num = classSupernova::$db->db_num_rows($query); |
142 | - while($planet = db_fetch($query)) { |
|
143 | - if($i++ % 100 == 0) { |
|
142 | + while ($planet = db_fetch($query)) { |
|
143 | + if ($i++ % 100 == 0) { |
|
144 | 144 | sta_set_time_limit("calculating planets stats (planet {$i}/{$row_num})", false); |
145 | 145 | } |
146 | - if(array_key_exists($user_id = $planet['id_owner'], $user_skip_list)) { |
|
146 | + if (array_key_exists($user_id = $planet['id_owner'], $user_skip_list)) { |
|
147 | 147 | continue; |
148 | 148 | } |
149 | 149 | |
@@ -157,22 +157,22 @@ discard block |
||
157 | 157 | $i = 0; |
158 | 158 | $query = FleetList::dbQueryAllId(); |
159 | 159 | $row_num = classSupernova::$db->db_num_rows($query); |
160 | - while($fleet_row = db_fetch($query)) { |
|
161 | - if($i++ % 100 == 0) { |
|
160 | + while ($fleet_row = db_fetch($query)) { |
|
161 | + if ($i++ % 100 == 0) { |
|
162 | 162 | sta_set_time_limit("calculating flying fleets stats (fleet {$i}/{$row_num})", false); |
163 | 163 | } |
164 | 164 | $objFleet = new Fleet(); |
165 | 165 | // TODO - без дополнительной инициализации и перераспределений памяти на каждый new Fleet()/unset($fleet) |
166 | 166 | // К тому же при включённом кэшировании это быстро забъёт кэш холодными данными |
167 | 167 | $objFleet->dbRowParse($fleet_row); |
168 | - if(array_key_exists($user_id = $objFleet->playerOwnerId, $user_skip_list)) { |
|
168 | + if (array_key_exists($user_id = $objFleet->playerOwnerId, $user_skip_list)) { |
|
169 | 169 | continue; |
170 | 170 | } |
171 | 171 | |
172 | - foreach($objFleet->shipsIterator() as $unit_id => $unit) { |
|
172 | + foreach ($objFleet->shipsIterator() as $unit_id => $unit) { |
|
173 | 173 | $counts[$user_id][UNIT_SHIPS] += $unit->count; |
174 | 174 | |
175 | - if(!isset($unit_cost_cache[$unit_id][0])) { |
|
175 | + if (!isset($unit_cost_cache[$unit_id][0])) { |
|
176 | 176 | $unit_cost_cache[$unit_id][0] = get_unit_param($unit_id, P_COST); |
177 | 177 | } |
178 | 178 | $unit_cost_data = &$unit_cost_cache[$unit_id][0]; |
@@ -191,11 +191,11 @@ discard block |
||
191 | 191 | $i = 0; |
192 | 192 | $query = DBStaticUnit::db_unit_list_stat_calculate(); |
193 | 193 | $row_num = classSupernova::$db->db_num_rows($query); |
194 | - while($unit = db_fetch($query)) { |
|
195 | - if($i++ % 100 == 0) { |
|
194 | + while ($unit = db_fetch($query)) { |
|
195 | + if ($i++ % 100 == 0) { |
|
196 | 196 | sta_set_time_limit("calculating unit stats (unit {$i}/{$row_num})", false); |
197 | 197 | } |
198 | - if(array_key_exists($user_id = $unit['unit_player_id'], $user_skip_list)) { |
|
198 | + if (array_key_exists($user_id = $unit['unit_player_id'], $user_skip_list)) { |
|
199 | 199 | continue; |
200 | 200 | } |
201 | 201 | |
@@ -209,11 +209,11 @@ discard block |
||
209 | 209 | $i = 0; |
210 | 210 | $query = DBStaticQue::db_que_list_stat(); |
211 | 211 | $row_num = classSupernova::$db->db_num_rows($query); |
212 | - while($que_item = db_fetch($query)) { |
|
213 | - if($i++ % 100 == 0) { |
|
212 | + while ($que_item = db_fetch($query)) { |
|
213 | + if ($i++ % 100 == 0) { |
|
214 | 214 | sta_set_time_limit("calculating ques stats (que item {$i}/{$row_num})", false); |
215 | 215 | } |
216 | - if(array_key_exists($user_id = $que_item['que_player_id'], $user_skip_list)) { |
|
216 | + if (array_key_exists($user_id = $que_item['que_player_id'], $user_skip_list)) { |
|
217 | 217 | continue; |
218 | 218 | } |
219 | 219 | $que_unit_amount = $que_item['que_unit_amount']; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | sta_set_time_limit('posting new user stats to DB'); |
242 | 242 | $data = array(); |
243 | - foreach($user_allies as $user_id => $ally_id) { |
|
243 | + foreach ($user_allies as $user_id => $ally_id) { |
|
244 | 244 | $points[$user_id][UNIT_RESOURCES] = $counts[$user_id][UNIT_RESOURCES] / 1000; |
245 | 245 | $points[$user_id] = array_map('floor', $points[$user_id]); |
246 | 246 | $counts[$user_id] = array_map('floor', $counts[$user_id]); |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | |
315 | 315 | // Updating player's ranks |
316 | 316 | sta_set_time_limit("updating ranks for players"); |
317 | - foreach($rankNames as $rankName) { |
|
317 | + foreach ($rankNames as $rankName) { |
|
318 | 318 | sta_set_time_limit("updating player rank '{$rankName}'", false); |
319 | 319 | classSupernova::$db->doSql($qryResetRowNum); |
320 | 320 | classSupernova::$db->doUpdateReallyComplex(sprintf($qryFormat, $rankName, 1)); |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | |
323 | 323 | sta_set_time_limit("updating ranks for Alliances"); |
324 | 324 | // Updating Allie's ranks |
325 | - foreach($rankNames as $rankName) { |
|
325 | + foreach ($rankNames as $rankName) { |
|
326 | 326 | sta_set_time_limit("updating Alliances rank '{$rankName}'", false); |
327 | 327 | classSupernova::$db->doSql($qryResetRowNum); |
328 | 328 | classSupernova::$db->doUpdateReallyComplex(sprintf($qryFormat, $rankName, 2)); |
@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | $unit_level = $artifact_level_old = mrc_get_level($user, null, $unit_id, true); |
20 | 20 | if ($unit_level > 0) { |
21 | - switch($unit_id) { |
|
21 | + switch ($unit_id) { |
|
22 | 22 | case ART_LHC: |
23 | 23 | case ART_HOOK_SMALL: |
24 | 24 | case ART_HOOK_MEDIUM: |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | function flt_mission_relocate($mission_data) { |
13 | 13 | $objFleet = $mission_data->fleet; |
14 | 14 | $destination_planet = &$mission_data->dst_planet; |
15 | - if($objFleet->playerOwnerId != $destination_planet['id_owner']) { |
|
15 | + if ($objFleet->playerOwnerId != $destination_planet['id_owner']) { |
|
16 | 16 | $objFleet->markReturnedAndSave(); |
17 | 17 | |
18 | 18 | return; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $fleet_resources[RES_CRYSTAL], classLocale::$lang['Crystal'], |
27 | 27 | $fleet_resources[RES_DEUTERIUM], classLocale::$lang['Deuterium'] |
28 | 28 | ) . '<br />' . classLocale::$lang['sys_relocate_mess_user']; |
29 | - foreach($objFleet->shipsIterator() as $ship_id => $ship) { |
|
29 | + foreach ($objFleet->shipsIterator() as $ship_id => $ship) { |
|
30 | 30 | $Message .= classLocale::$lang['tech'][$ship_id] . ' - ' . $ship->count . '<br />'; |
31 | 31 | } |
32 | 32 | DBStaticMessages::msg_send_simple_message( |
@@ -4,19 +4,19 @@ discard block |
||
4 | 4 | |
5 | 5 | $classLocale = classLocale::$lang; |
6 | 6 | |
7 | -if(classSupernova::$config->server_updater_check_auto && classSupernova::$config->server_updater_check_last + classSupernova::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
7 | +if (classSupernova::$config->server_updater_check_auto && classSupernova::$config->server_updater_check_last + classSupernova::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
8 | 8 | include(SN_ROOT_PHYSICAL . 'ajax_version_check' . DOT_PHP_EX); |
9 | 9 | } |
10 | 10 | |
11 | -if(classSupernova::$config->user_birthday_gift && SN_TIME_NOW - classSupernova::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
11 | +if (classSupernova::$config->user_birthday_gift && SN_TIME_NOW - classSupernova::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
12 | 12 | require_once(SN_ROOT_PHYSICAL . "includes/includes/user_birthday_celebrate" . DOT_PHP_EX); |
13 | 13 | sn_user_birthday_celebrate(); |
14 | 14 | } |
15 | 15 | |
16 | -if(!classSupernova::$config->var_online_user_count || classSupernova::$config->var_online_user_time + 30 < SN_TIME_NOW) { |
|
16 | +if (!classSupernova::$config->var_online_user_count || classSupernova::$config->var_online_user_time + 30 < SN_TIME_NOW) { |
|
17 | 17 | classSupernova::$config->db_saveItem('var_online_user_count', DBStaticUser::db_user_count(true)); |
18 | 18 | classSupernova::$config->db_saveItem('var_online_user_time', SN_TIME_NOW); |
19 | - if(classSupernova::$config->server_log_online) { |
|
19 | + if (classSupernova::$config->server_log_online) { |
|
20 | 20 | db_log_online_insert(); |
21 | 21 | } |
22 | 22 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $template_result[F_ACCOUNT_IS_AUTHORIZED] = $sys_user_logged_in = !empty($user) && isset($user['id']) && $user['id']; |
44 | 44 | //pdump($template_result[F_ACCOUNT_IS_AUTHORIZED]);die(); |
45 | 45 | |
46 | -if(!empty($user['id'])) { |
|
46 | +if (!empty($user['id'])) { |
|
47 | 47 | classSupernova::$user_options->user_change($user['id']); |
48 | 48 | } |
49 | 49 | |
@@ -56,15 +56,15 @@ discard block |
||
56 | 56 | : false |
57 | 57 | ); |
58 | 58 | |
59 | -if($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
60 | - $prohibited_characters = array_map(function ($value) { |
|
59 | +if ($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
60 | + $prohibited_characters = array_map(function($value) { |
|
61 | 61 | return "'" . htmlentities($value, ENT_QUOTES, 'UTF-8') . "'"; |
62 | 62 | }, str_split(LOGIN_REGISTER_CHARACTERS_PROHIBITED)); |
63 | 63 | $template_result[F_LOGIN_MESSAGE] .= implode(', ', $prohibited_characters); |
64 | 64 | } |
65 | 65 | |
66 | 66 | |
67 | -if(defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
67 | +if (defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
68 | 68 | pdump("Отключи отладку перед продакшном!"); |
69 | 69 | } |
70 | 70 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | ? define('INSTALL_MODE', GAME_DISABLE_INSTALL) |
79 | 79 | : false; |
80 | 80 | |
81 | -if( |
|
81 | +if ( |
|
82 | 82 | classSupernova::$config->game_disable == GAME_DISABLE_STAT |
83 | 83 | && |
84 | 84 | SN_TIME_NOW - strtotime(classSupernova::$config->db_loadItem('var_stat_update_end')) > 600 |
@@ -91,17 +91,17 @@ discard block |
||
91 | 91 | classSupernova::$debug->warning('Stat worked too long - watchdog unlocked', 'Stat WARNING'); |
92 | 92 | } |
93 | 93 | |
94 | -if($template_result[F_GAME_DISABLE] = classSupernova::$config->game_disable) { |
|
94 | +if ($template_result[F_GAME_DISABLE] = classSupernova::$config->game_disable) { |
|
95 | 95 | $template_result[F_GAME_DISABLE_REASON] = sys_bbcodeParse( |
96 | 96 | classSupernova::$config->game_disable == GAME_DISABLE_REASON |
97 | 97 | ? classSupernova::$config->game_disable_reason |
98 | 98 | : classLocale::$lang['sys_game_disable_reason'][classSupernova::$config->game_disable] |
99 | 99 | ); |
100 | - if(defined('IN_API')) { |
|
100 | + if (defined('IN_API')) { |
|
101 | 101 | return; |
102 | 102 | } |
103 | 103 | |
104 | - if( |
|
104 | + if ( |
|
105 | 105 | ($user['authlevel'] < 1 || !(defined('IN_ADMIN') && IN_ADMIN)) |
106 | 106 | && |
107 | 107 | !(defined('INSTALL_MODE') && defined('LOGIN_LOGOUT')) |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | |
116 | 116 | // TODO ban |
117 | 117 | // TODO $skip_ban_check |
118 | -if($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
119 | - if(defined('IN_API')) { |
|
118 | +if ($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
119 | + if (defined('IN_API')) { |
|
120 | 120 | return; |
121 | 121 | } |
122 | 122 | |
@@ -134,13 +134,13 @@ discard block |
||
134 | 134 | // pdump($allow_anonymous, '$allow_anonymous'); |
135 | 135 | // pdump($sys_user_logged_in, '$sys_user_logged_in'); |
136 | 136 | |
137 | -if($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
137 | +if ($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
138 | 138 | sys_redirect(SN_ROOT_VIRTUAL . 'overview.php'); |
139 | -} elseif($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
139 | +} elseif ($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
140 | 140 | // pdump($sn_page_name); |
141 | 141 | // pdump(INITIAL_PAGE); |
142 | 142 | // die('{Тут должна быть ваша реклама. Точнее - ввод имени игрока}'); |
143 | -} elseif(!$allow_anonymous && !$sys_user_logged_in) { |
|
143 | +} elseif (!$allow_anonymous && !$sys_user_logged_in) { |
|
144 | 144 | // sn_setcookie(SN_COOKIE, '', time() - PERIOD_WEEK, SN_ROOT_RELATIVE); |
145 | 145 | sys_redirect(SN_ROOT_VIRTUAL . 'login.php'); |
146 | 146 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | |
162 | 162 | global $skip_fleet_update; |
163 | 163 | $skip_fleet_update = $skip_fleet_update || classSupernova::$options['fleet_update_skip'] || defined('IN_ADMIN'); |
164 | -if( |
|
164 | +if ( |
|
165 | 165 | !$skip_fleet_update |
166 | 166 | && !(defined('IN_AJAX') && IN_AJAX === true) |
167 | 167 | && SN_TIME_NOW - strtotime(classSupernova::$config->fleet_update_last) > classSupernova::$config->fleet_update_interval |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | flt_flying_fleet_handler($skip_fleet_update); |
171 | 171 | } |
172 | 172 | |
173 | -if(!defined('IN_AJAX')) { |
|
173 | +if (!defined('IN_AJAX')) { |
|
174 | 174 | pdump("Scheduled processes is disabled"); |
175 | 175 | } |
176 | 176 | // scheduler_process(); |
@@ -298,7 +298,7 @@ |
||
298 | 298 | |
299 | 299 | if (!empty($resourcesChange)) { |
300 | 300 | $planet_id = $planet_id == 0 && isset($user_row['id_planet']) ? $user_row['id_planet'] : $planet_id; |
301 | - if($planet_id) { |
|
301 | + if ($planet_id) { |
|
302 | 302 | // update planet |
303 | 303 | DBStaticPlanet::db_planet_update_resources($resourcesChange, $planet_id); |
304 | 304 | } else { |
@@ -9,19 +9,19 @@ discard block |
||
9 | 9 | $ts_var_stat_update = strtotime(classSupernova::$config->db_loadItem('var_stat_update')); |
10 | 10 | $ts_scheduled_update = sys_schedule_get_prev_run(classSupernova::$config->db_loadItem('stats_schedule'), classSupernova::$config->var_stat_update); |
11 | 11 | |
12 | - if(sys_get_param_int('admin_update')) { |
|
12 | + if (sys_get_param_int('admin_update')) { |
|
13 | 13 | define('USER_LEVEL', isset($user['authlevel']) ? $user['authlevel'] : -1); |
14 | - if(USER_LEVEL > 0) { |
|
14 | + if (USER_LEVEL > 0) { |
|
15 | 15 | $is_admin_request = true; |
16 | 16 | $ts_scheduled_update = SN_TIME_NOW; |
17 | 17 | } |
18 | 18 | } |
19 | 19 | |
20 | - if($ts_scheduled_update > $ts_var_stat_update) { |
|
20 | + if ($ts_scheduled_update > $ts_var_stat_update) { |
|
21 | 21 | lng_include('admin'); |
22 | 22 | sn_db_transaction_start(); |
23 | 23 | $ts_var_stat_update_end = strtotime(classSupernova::$config->db_loadItem('var_stat_update_end')); |
24 | - if(SN_TIME_NOW > $ts_var_stat_update_end) { |
|
24 | + if (SN_TIME_NOW > $ts_var_stat_update_end) { |
|
25 | 25 | $old_server_status = classSupernova::$config->db_loadItem('game_disable'); |
26 | 26 | classSupernova::$config->db_saveItem('game_disable', GAME_DISABLE_STAT); |
27 | 27 | |
@@ -56,17 +56,17 @@ discard block |
||
56 | 56 | classSupernova::$config->db_saveItem('var_stat_update_admin_forced', SN_TIME_SQL); |
57 | 57 | classSupernova::$config->db_saveItem('var_stat_update_end', SN_TIME_SQL); |
58 | 58 | |
59 | - if($old_server_status == GAME_DISABLE_STAT) { |
|
59 | + if ($old_server_status == GAME_DISABLE_STAT) { |
|
60 | 60 | $old_server_status = GAME_DISABLE_NONE; |
61 | 61 | } |
62 | 62 | classSupernova::$config->db_saveItem('game_disable', $old_server_status); |
63 | - } elseif($ts_scheduled_update > $ts_var_stat_update) { |
|
63 | + } elseif ($ts_scheduled_update > $ts_var_stat_update) { |
|
64 | 64 | $timeout = strtotime(classSupernova::$config->db_loadItem('var_stat_update_end')) - SN_TIME_NOW; |
65 | 65 | $msg = classSupernova::$config->db_loadItem('var_stat_update_msg'); |
66 | 66 | $msg = "{$msg} ETA {$timeout} seconds. Please wait..."; |
67 | 67 | } |
68 | 68 | sn_db_transaction_rollback(); |
69 | - } elseif($is_admin_request) { |
|
69 | + } elseif ($is_admin_request) { |
|
70 | 70 | $msg = 'Stat is up to date'; |
71 | 71 | } |
72 | 72 |
@@ -83,8 +83,8 @@ |
||
83 | 83 | $crystal += $destroyed * $unit_info[P_COST][RES_CRYSTAL] / 4; |
84 | 84 | } |
85 | 85 | |
86 | - $return['structures'] = $structures; // Structures left after attack |
|
87 | - $return['metal'] = floor($metal); // Metal scraps |
|
86 | + $return['structures'] = $structures; // Structures left after attack |
|
87 | + $return['metal'] = floor($metal); // Metal scraps |
|
88 | 88 | $return['crystal'] = floor($crystal); // Crystal scraps |
89 | 89 | |
90 | 90 | return $return; |
@@ -103,23 +103,23 @@ |
||
103 | 103 | |
104 | 104 | !empty(classSupernova::$config->url_faq) ? $msg = str_replace('faq://', classSupernova::$config->url_faq, $msg) : false; |
105 | 105 | |
106 | - foreach(classSupernova::$design['bbcodes'] as $auth_level => $replaces) { |
|
107 | - if($auth_level > $author_auth) { |
|
106 | + foreach (classSupernova::$design['bbcodes'] as $auth_level => $replaces) { |
|
107 | + if ($auth_level > $author_auth) { |
|
108 | 108 | continue; |
109 | 109 | } |
110 | 110 | |
111 | - foreach($replaces as $key => $html) { |
|
112 | - $msg = preg_replace(''.$key.'', $html, $msg); |
|
111 | + foreach ($replaces as $key => $html) { |
|
112 | + $msg = preg_replace('' . $key . '', $html, $msg); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
116 | - foreach(classSupernova::$design['smiles'] as $auth_level => $replaces) { |
|
117 | - if($auth_level > $author_auth) { |
|
116 | + foreach (classSupernova::$design['smiles'] as $auth_level => $replaces) { |
|
117 | + if ($auth_level > $author_auth) { |
|
118 | 118 | continue; |
119 | 119 | } |
120 | 120 | |
121 | - foreach($replaces as $key => $imgName) { |
|
122 | - $msg = preg_replace("#" . addcslashes($key, '()[]{}') . "#isU","<img src=\"design/images/smileys/".$imgName.".gif\" align=\"absmiddle\" title=\"".$key."\" alt=\"".$key."\">",$msg); |
|
121 | + foreach ($replaces as $key => $imgName) { |
|
122 | + $msg = preg_replace("#" . addcslashes($key, '()[]{}') . "#isU", "<img src=\"design/images/smileys/" . $imgName . ".gif\" align=\"absmiddle\" title=\"" . $key . "\" alt=\"" . $key . "\">", $msg); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 |
@@ -131,7 +131,6 @@ |
||
131 | 131 | // return cht_message_parse($text, $escaped, $author_auth); |
132 | 132 | } |
133 | 133 | |
134 | -function sys_bbcodeUnParse($text, $escaped = false, $author_auth = 0) |
|
135 | -{ |
|
134 | +function sys_bbcodeUnParse($text, $escaped = false, $author_auth = 0) { |
|
136 | 135 | return str_replace('<br />', $escaped ? '\r\n' : "\r\n", $text); |
137 | 136 | } |
@@ -61,10 +61,10 @@ |
||
61 | 61 | } else { |
62 | 62 | $changeset['dark_matter_total'] = +$dark_matter; |
63 | 63 | } |
64 | - if($dark_matter) { |
|
64 | + if ($dark_matter) { |
|
65 | 65 | $changeset[$sn_data_dark_matter_db_name] = +$dark_matter; |
66 | 66 | } |
67 | - if(!empty($changeset)) { |
|
67 | + if (!empty($changeset)) { |
|
68 | 68 | DBStaticUser::db_user_adjust_by_id($user_id, $changeset); |
69 | 69 | } |
70 | 70 | $rows_affected = classSupernova::$db->db_affected_rows(); |