@@ -470,6 +470,12 @@ |
||
470 | 470 | {$StartRec}, 25;"); |
471 | 471 | } |
472 | 472 | |
473 | + /** |
|
474 | + * @param integer $message_type |
|
475 | + * @param string $from |
|
476 | + * @param string $subject |
|
477 | + * @param string $text |
|
478 | + */ |
|
473 | 479 | public static function db_message_insert_all($message_type, $from, $subject, $text) { |
474 | 480 | return doquery($QryInsertMessage = 'INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) ' . |
475 | 481 | "SELECT `id`, 0, unix_timestamp(now()), {$message_type}, '{$from}', '{$subject}', '{$text}' FROM {{users}}"); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $owners = array(); |
115 | 115 | } else { |
116 | 116 | $insert_values = array(); |
117 | - $insert_template = "('%u'," . str_replace('%', '%%', " '{$sender}', '{$timestamp}', '{$message_type}', '{$from}', '{$subject}', '{$text}')"); |
|
117 | + $insert_template = "('%u',".str_replace('%', '%%', " '{$sender}', '{$timestamp}', '{$message_type}', '{$from}', '{$subject}', '{$text}')"); |
|
118 | 118 | |
119 | 119 | foreach ($owners as $owner) { |
120 | 120 | if ($user['id'] != $owner) { |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $sendList = array(); |
156 | 156 | $list = ''; |
157 | 157 | $query = DBStaticUser::db_user_list( |
158 | - "ally_id = '{$ally_id}'" . ($ally_rank_id >= 0 ? " AND ally_rank_id = {$ally_rank_id}" : ''), |
|
158 | + "ally_id = '{$ally_id}'".($ally_rank_id >= 0 ? " AND ally_rank_id = {$ally_rank_id}" : ''), |
|
159 | 159 | false, 'id, username'); |
160 | 160 | foreach ($query as $u) { |
161 | 161 | $sendList[] = $u['id']; |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $subject_unsafe = substr($subject_unsafe, strlen(classLocale::$lang['msg_answer_prefix'])); |
247 | 247 | $re++; |
248 | 248 | } |
249 | - $re ? $subject_unsafe = classLocale::$lang['msg_answer_prefix'] . $subject_unsafe : false; |
|
249 | + $re ? $subject_unsafe = classLocale::$lang['msg_answer_prefix'].$subject_unsafe : false; |
|
250 | 250 | |
251 | 251 | $subject_unsafe = $subject_unsafe ? $subject_unsafe : classLocale::$lang['msg_subject_default']; |
252 | 252 | |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | return doquery( |
416 | 416 | "SELECT * FROM {{messages}} |
417 | 417 | WHERE |
418 | - `message_type` = '" . MSG_TYPE_PLAYER . "' AND |
|
418 | + `message_type` = '" . MSG_TYPE_PLAYER."' AND |
|
419 | 419 | ((`message_owner` = '{$user['id']}' AND `message_sender` = '{$recipient_id}') |
420 | 420 | OR |
421 | 421 | (`message_sender` = '{$user['id']}' AND `message_owner` = '{$recipient_id}')) ORDER BY `message_time` DESC LIMIT 20;"); |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | FROM |
464 | 464 | {{messages}} AS m |
465 | 465 | LEFT JOIN {{users}} AS u ON u.id = m.message_owner " . |
466 | - ($int_type_selected >= 0 ? "WHERE `message_type` = {$int_type_selected} " : '') . |
|
466 | + ($int_type_selected >= 0 ? "WHERE `message_type` = {$int_type_selected} " : ''). |
|
467 | 467 | "ORDER BY |
468 | 468 | `message_id` DESC |
469 | 469 | LIMIT |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | } |
472 | 472 | |
473 | 473 | public static function db_message_insert_all($message_type, $from, $subject, $text) { |
474 | - return doquery($QryInsertMessage = 'INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) ' . |
|
474 | + return doquery($QryInsertMessage = 'INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) '. |
|
475 | 475 | "SELECT `id`, 0, unix_timestamp(now()), {$message_type}, '{$from}', '{$subject}', '{$text}' FROM {{users}}"); |
476 | 476 | } |
477 | 477 | |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | * @return array|bool|mysqli_result|null |
482 | 482 | */ |
483 | 483 | public static function db_message_count_by_type($int_type_selected) { |
484 | - $page_max = doquery('SELECT COUNT(*) AS `max` FROM {{messages}}' . ($int_type_selected >= 0 ? " WHERE `message_type` = {$int_type_selected};" : ''), true); |
|
484 | + $page_max = doquery('SELECT COUNT(*) AS `max` FROM {{messages}}'.($int_type_selected >= 0 ? " WHERE `message_type` = {$int_type_selected};" : ''), true); |
|
485 | 485 | |
486 | 486 | return $page_max; |
487 | 487 | } |
@@ -498,15 +498,15 @@ discard block |
||
498 | 498 | * @param $int_type_selected |
499 | 499 | */ |
500 | 500 | public static function db_message_list_delete_by_date($delete_date, $int_type_selected) { |
501 | - doquery("DELETE FROM {{messages}} WHERE message_time <= UNIX_TIMESTAMP('{$delete_date}')" . ($int_type_selected >= 0 ? " AND `message_type` = {$int_type_selected}" : '')); |
|
501 | + doquery("DELETE FROM {{messages}} WHERE message_time <= UNIX_TIMESTAMP('{$delete_date}')".($int_type_selected >= 0 ? " AND `message_type` = {$int_type_selected}" : '')); |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | /** |
505 | 505 | * @param $insert_values |
506 | 506 | */ |
507 | 507 | public static function db_message_insert($insert_values) { |
508 | - doquery('INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) ' . |
|
509 | - 'VALUES ' . implode(',', $insert_values)); |
|
508 | + doquery('INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) '. |
|
509 | + 'VALUES '.implode(',', $insert_values)); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | } |
@@ -131,6 +131,9 @@ discard block |
||
131 | 131 | ); |
132 | 132 | } |
133 | 133 | |
134 | + /** |
|
135 | + * @param integer $config_user_birthday_range |
|
136 | + */ |
|
134 | 137 | public static function db_user_list_to_celebrate($config_user_birthday_range) { |
135 | 138 | // $query = "SELECT |
136 | 139 | // `id`, `username`, `user_birthday`, `user_birthday_celebrated`, |
@@ -208,6 +211,9 @@ discard block |
||
208 | 211 | } |
209 | 212 | |
210 | 213 | |
214 | + /** |
|
215 | + * @param string $username_unsafe |
|
216 | + */ |
|
211 | 217 | public static function db_user_by_username($username_unsafe, $for_update = false, $fields = '*', $player = null, $like = false) { |
212 | 218 | return classSupernova::db_get_user_by_username($username_unsafe, $for_update, $fields, $player, $like); |
213 | 219 | } |
@@ -220,6 +226,9 @@ discard block |
||
220 | 226 | return classSupernova::db_upd_record_by_id(LOC_USER, $user_id, $set); |
221 | 227 | } |
222 | 228 | |
229 | + /** |
|
230 | + * @param boolean $player |
|
231 | + */ |
|
223 | 232 | public static function db_user_by_id($user_id_unsafe, $for_update = false, $fields = '*', $player = null) { |
224 | 233 | return classSupernova::db_get_user_by_id($user_id_unsafe, $for_update, $fields, $player); |
225 | 234 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | ->orderBy(array('`id` DESC')) |
33 | 33 | ->setFetchOne(); |
34 | 34 | |
35 | - return (string)static::$dbStatic->selectValue($query); |
|
35 | + return (string) static::$dbStatic->selectValue($query); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | protected static function whereNotAlly() { |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | static::buildSelect() |
62 | 62 | ->field('id') |
63 | 63 | ->where("`user_as_ally` IS NULL") |
64 | - ->where("`user_bot` = " . USER_BOT_PLAYER) |
|
64 | + ->where("`user_bot` = ".USER_BOT_PLAYER) |
|
65 | 65 | ->setForUpdate(); |
66 | 66 | |
67 | 67 | return static::selectIterator($query); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | } |
220 | 220 | |
221 | 221 | public static function db_user_list_set_mass_mail(&$owners_list, $set) { |
222 | - return classSupernova::db_upd_record_list(LOC_USER, !empty($owners_list) ? '`id` IN (' . implode(',', $owners_list) . ');' : '', $set); |
|
222 | + return classSupernova::db_upd_record_list(LOC_USER, !empty($owners_list) ? '`id` IN ('.implode(',', $owners_list).');' : '', $set); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | public static function db_user_list_set_by_ally_and_rank($ally_id, $ally_rank_id, $set) { |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | $language_new = sys_get_param_str('langer', $user['lang']); |
14 | 14 | |
15 | - if($language_new != $user['lang']) { |
|
15 | + if ($language_new != $user['lang']) { |
|
16 | 16 | classLocale::$lang->lng_switch($language_new); |
17 | 17 | } |
18 | 18 | |
@@ -21,41 +21,41 @@ discard block |
||
21 | 21 | |
22 | 22 | $FMT_DATE = preg_replace(array('/d/', '/m/', '/Y/'), array('DD', 'MM', 'YYYY'), FMT_DATE); |
23 | 23 | |
24 | - if(sys_get_param_str('mode') == 'change') { |
|
25 | - if($user['authlevel'] > 0) { |
|
24 | + if (sys_get_param_str('mode') == 'change') { |
|
25 | + if ($user['authlevel'] > 0) { |
|
26 | 26 | $planet_protection = sys_get_param_int('adm_pl_prot') ? $user['authlevel'] : 0; |
27 | 27 | DBStaticPlanet::db_planet_set_by_owner($user['id'], "`id_level` = '{$planet_protection}'"); |
28 | 28 | DBStaticUser::db_user_set_by_id($user['id'], "`admin_protection` = '{$planet_protection}'"); |
29 | 29 | $user['admin_protection'] = $planet_protection; |
30 | 30 | } |
31 | 31 | |
32 | - if(sys_get_param_int('vacation') && !classSupernova::$config->user_vacation_disable) { |
|
32 | + if (sys_get_param_int('vacation') && !classSupernova::$config->user_vacation_disable) { |
|
33 | 33 | sn_db_transaction_start(); |
34 | - if($user['authlevel'] < 3) { |
|
35 | - if($user['vacation_next'] > SN_TIME_NOW) { |
|
34 | + if ($user['authlevel'] < 3) { |
|
35 | + if ($user['vacation_next'] > SN_TIME_NOW) { |
|
36 | 36 | message(classLocale::$lang['opt_vacation_err_timeout'], classLocale::$lang['Error'], 'index.php?page=options', 5); |
37 | 37 | die(); |
38 | 38 | } |
39 | 39 | |
40 | - if(FleetList::fleet_count_flying($user['id'])) { |
|
40 | + if (FleetList::fleet_count_flying($user['id'])) { |
|
41 | 41 | message(classLocale::$lang['opt_vacation_err_your_fleet'], classLocale::$lang['Error'], 'index.php?page=options', 5); |
42 | 42 | die(); |
43 | 43 | } |
44 | 44 | |
45 | 45 | $que = que_get($user['id'], false); |
46 | - if(!empty($que)) { |
|
46 | + if (!empty($que)) { |
|
47 | 47 | message(classLocale::$lang['opt_vacation_err_que'], classLocale::$lang['Error'], 'index.php?page=options', 5); |
48 | 48 | die(); |
49 | 49 | } |
50 | 50 | |
51 | 51 | $query = classSupernova::db_get_record_list(LOC_PLANET, "`id_owner` = {$user['id']}"); |
52 | - foreach($query as $planet) { |
|
52 | + foreach ($query as $planet) { |
|
53 | 53 | // $planet = sys_o_get_updated($user, $planet, SN_TIME_NOW); |
54 | 54 | // $planet = $planet['planet']; |
55 | 55 | |
56 | 56 | $classConfig = classSupernova::$config; |
57 | 57 | DBStaticPlanet::db_planet_set_by_id($planet['id'], |
58 | - "last_update = " . SN_TIME_NOW . ", energy_used = '0', energy_max = '0', |
|
58 | + "last_update = ".SN_TIME_NOW.", energy_used = '0', energy_max = '0', |
|
59 | 59 | metal_perhour = '{$classConfig->metal_basic_income}', crystal_perhour = '{$classConfig->crystal_basic_income}', deuterium_perhour = '{$classConfig->deuterium_basic_income}', |
60 | 60 | metal_mine_porcent = '0', crystal_mine_porcent = '0', deuterium_sintetizer_porcent = '0', solar_plant_porcent = '0', |
61 | 61 | fusion_plant_porcent = '0', solar_satelit_porcent = '0', ship_sattelite_sloth_porcent = 0" |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | sn_db_transaction_commit(); |
69 | 69 | } |
70 | 70 | |
71 | - foreach($user_option_list as $option_group_id => $option_group) { |
|
72 | - foreach($option_group as $option_name => $option_value) { |
|
73 | - if($user[$option_name] !== null) { |
|
71 | + foreach ($user_option_list as $option_group_id => $option_group) { |
|
72 | + foreach ($option_group as $option_name => $option_value) { |
|
73 | + if ($user[$option_name] !== null) { |
|
74 | 74 | $user[$option_name] = sys_get_param_str($option_name); |
75 | 75 | } else { |
76 | 76 | $user[$option_name] = $option_value; |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | |
82 | 82 | |
83 | 83 | $player_options = sys_get_param('options'); |
84 | - if(!empty($player_options)) { |
|
85 | - array_walk($player_options, function (&$value) { |
|
84 | + if (!empty($player_options)) { |
|
85 | + array_walk($player_options, function(&$value) { |
|
86 | 86 | // TODO - Когда будет больше параметров - сделать больше проверок |
87 | 87 | $value = intval($value); |
88 | 88 | }); |
@@ -93,15 +93,15 @@ discard block |
||
93 | 93 | |
94 | 94 | $username = substr(sys_get_param_str_unsafe('username'), 0, 32); |
95 | 95 | $username_safe = db_escape($username); |
96 | - if($username && $user['username'] != $username && classSupernova::$config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_NONE && sys_get_param_int('username_confirm') && !strpbrk($username, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) { |
|
96 | + if ($username && $user['username'] != $username && classSupernova::$config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_NONE && sys_get_param_int('username_confirm') && !strpbrk($username, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) { |
|
97 | 97 | // проверка на корректность |
98 | 98 | sn_db_transaction_start(); |
99 | 99 | $name_check = db_player_name_history_get_name_by_name($username_safe); |
100 | - if(!$name_check || $name_check['player_id'] == $user['id']) { |
|
100 | + if (!$name_check || $name_check['player_id'] == $user['id']) { |
|
101 | 101 | $user = DBStaticUser::db_user_by_id($user['id'], true); |
102 | - switch(classSupernova::$config->game_user_changename) { |
|
102 | + switch (classSupernova::$config->game_user_changename) { |
|
103 | 103 | case SERVER_PLAYER_NAME_CHANGE_PAY: |
104 | - if(mrc_get_level($user, $planetrow, RES_DARK_MATTER) < classSupernova::$config->game_user_changename_cost) { |
|
104 | + if (mrc_get_level($user, $planetrow, RES_DARK_MATTER) < classSupernova::$config->game_user_changename_cost) { |
|
105 | 105 | $template_result['.']['result'][] = array( |
106 | 106 | 'STATUS' => ERR_ERROR, |
107 | 107 | 'MESSAGE' => classLocale::$lang['opt_msg_name_change_err_no_dm'], |
@@ -131,18 +131,18 @@ discard block |
||
131 | 131 | sn_db_transaction_commit(); |
132 | 132 | } |
133 | 133 | |
134 | - if($new_password = sys_get_param('newpass1')) { |
|
134 | + if ($new_password = sys_get_param('newpass1')) { |
|
135 | 135 | try { |
136 | - if($new_password != sys_get_param('newpass2')) { |
|
136 | + if ($new_password != sys_get_param('newpass2')) { |
|
137 | 137 | throw new Exception(classLocale::$lang['opt_err_pass_unmatched'], ERR_WARNING); |
138 | 138 | } |
139 | 139 | |
140 | - if(!classSupernova::$auth->password_change(sys_get_param('db_password'), $new_password)) { |
|
140 | + if (!classSupernova::$auth->password_change(sys_get_param('db_password'), $new_password)) { |
|
141 | 141 | throw new Exception(classLocale::$lang['opt_err_pass_wrong'], ERR_WARNING); |
142 | 142 | } |
143 | 143 | |
144 | 144 | throw new Exception(classLocale::$lang['opt_msg_pass_changed'], ERR_NONE); |
145 | - } catch(Exception $e) { |
|
145 | + } catch (Exception $e) { |
|
146 | 146 | $template_result['.']['result'][] = array( |
147 | 147 | 'STATUS' => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR, |
148 | 148 | 'MESSAGE' => $e->getMessage() |
@@ -164,12 +164,12 @@ discard block |
||
164 | 164 | $user['gender'] = $user['gender'] == GENDER_UNKNOWN ? $gender : $user['gender']; |
165 | 165 | |
166 | 166 | try { |
167 | - if($user['birthday']) { |
|
167 | + if ($user['birthday']) { |
|
168 | 168 | throw new exception(); |
169 | 169 | } |
170 | 170 | |
171 | 171 | $user_birthday = sys_get_param_str_unsafe('user_birthday'); |
172 | - if(!$user_birthday || $user_birthday == $FMT_DATE) { |
|
172 | + if (!$user_birthday || $user_birthday == $FMT_DATE) { |
|
173 | 173 | throw new exception(); |
174 | 174 | } |
175 | 175 | |
@@ -179,16 +179,16 @@ discard block |
||
179 | 179 | $pos['Y'] = strpos(FMT_DATE, 'Y'); |
180 | 180 | asort($pos); |
181 | 181 | $i = 0; |
182 | - foreach($pos as &$position) { |
|
182 | + foreach ($pos as &$position) { |
|
183 | 183 | $position = ++$i; |
184 | 184 | } |
185 | 185 | |
186 | - $regexp = "/" . preg_replace(array('/\\\\/', '/\//', '/\./', '/\-/', '/d/', '/m/', '/Y/'), array('\\\\\\', '\/', '\.', '\-', '(\d?\d)', '(\d?\d)', '(\d{4})'), FMT_DATE) . "/"; |
|
187 | - if(!preg_match($regexp, $user_birthday, $match)) { |
|
186 | + $regexp = "/".preg_replace(array('/\\\\/', '/\//', '/\./', '/\-/', '/d/', '/m/', '/Y/'), array('\\\\\\', '\/', '\.', '\-', '(\d?\d)', '(\d?\d)', '(\d{4})'), FMT_DATE)."/"; |
|
187 | + if (!preg_match($regexp, $user_birthday, $match)) { |
|
188 | 188 | throw new exception(); |
189 | 189 | } |
190 | 190 | |
191 | - if(!checkdate($match[$pos['m']], $match[$pos['d']], $match[$pos['Y']])) { |
|
191 | + if (!checkdate($match[$pos['m']], $match[$pos['d']], $match[$pos['Y']])) { |
|
192 | 192 | throw new exception(); |
193 | 193 | } |
194 | 194 | |
@@ -196,13 +196,13 @@ discard block |
||
196 | 196 | // EOF black magic! Now we have valid SQL date in $user['user_birthday'] - independent of date format |
197 | 197 | |
198 | 198 | $year = date('Y', SN_TIME_NOW); |
199 | - if(mktime(0, 0, 0, $match[$pos['m']], $match[$pos['d']], $year) > SN_TIME_NOW) { |
|
199 | + if (mktime(0, 0, 0, $match[$pos['m']], $match[$pos['d']], $year) > SN_TIME_NOW) { |
|
200 | 200 | $year--; |
201 | 201 | } |
202 | 202 | $user['user_birthday_celebrated'] = db_escape("{$year}-{$match[$pos['m']]}-{$match[$pos['d']]}"); |
203 | 203 | |
204 | 204 | $user_birthday = ", `user_birthday` = '{$user['user_birthday']}', `user_birthday_celebrated` = '{$user['user_birthday_celebrated']}'"; |
205 | - } catch(exception $e) { |
|
205 | + } catch (exception $e) { |
|
206 | 206 | $user_birthday = ''; |
207 | 207 | } |
208 | 208 | |
@@ -212,14 +212,14 @@ discard block |
||
212 | 212 | $template_result['.']['result'][] = $avatar_upload_result; |
213 | 213 | |
214 | 214 | $user_time_diff = playerTimeDiff::user_time_diff_get(); |
215 | - if(sys_get_param_int('PLAYER_OPTION_TIME_DIFF_FORCED')) { |
|
215 | + if (sys_get_param_int('PLAYER_OPTION_TIME_DIFF_FORCED')) { |
|
216 | 216 | playerTimeDiff::user_time_diff_set(array( |
217 | 217 | PLAYER_OPTION_TIME_DIFF => sys_get_param_int('PLAYER_OPTION_TIME_DIFF'), |
218 | 218 | PLAYER_OPTION_TIME_DIFF_UTC_OFFSET => 0, |
219 | 219 | PLAYER_OPTION_TIME_DIFF_FORCED => 1, |
220 | 220 | PLAYER_OPTION_TIME_DIFF_MEASURE_TIME => SN_TIME_SQL, |
221 | 221 | )); |
222 | - } elseif(sys_get_param_int('opt_time_diff_clear') || $user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
222 | + } elseif (sys_get_param_int('opt_time_diff_clear') || $user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
223 | 223 | playerTimeDiff::user_time_diff_set(array( |
224 | 224 | PLAYER_OPTION_TIME_DIFF => '', |
225 | 225 | PLAYER_OPTION_TIME_DIFF_UTC_OFFSET => 0, |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | 'STATUS' => ERR_NONE, |
240 | 240 | 'MESSAGE' => classLocale::$lang['opt_msg_saved'] |
241 | 241 | ); |
242 | - } elseif(sys_get_param_str('result') == 'ok') { |
|
242 | + } elseif (sys_get_param_str('result') == 'ok') { |
|
243 | 243 | $template_result['.']['result'][] = array( |
244 | 244 | 'STATUS' => ERR_NONE, |
245 | 245 | 'MESSAGE' => classLocale::$lang['opt_msg_saved'] |
@@ -262,9 +262,9 @@ discard block |
||
262 | 262 | |
263 | 263 | $template = gettemplate('options', $template); |
264 | 264 | |
265 | - $dir = dir(SN_ROOT_PHYSICAL . 'skins'); |
|
266 | - while(($entry = $dir->read()) !== false) { |
|
267 | - if(is_dir("skins/{$entry}") && $entry[0] != '.') { |
|
265 | + $dir = dir(SN_ROOT_PHYSICAL.'skins'); |
|
266 | + while (($entry = $dir->read()) !== false) { |
|
267 | + if (is_dir("skins/{$entry}") && $entry[0] != '.') { |
|
268 | 268 | $template_result['.']['skin_list'][] = array( |
269 | 269 | 'VALUE' => $entry, |
270 | 270 | 'NAME' => $entry, |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | } |
275 | 275 | $dir->close(); |
276 | 276 | |
277 | - foreach(classLocale::$lang['opt_planet_sort_options'] as $key => &$value) { |
|
277 | + foreach (classLocale::$lang['opt_planet_sort_options'] as $key => &$value) { |
|
278 | 278 | $template_result['.']['planet_sort_options'][] = array( |
279 | 279 | 'VALUE' => $key, |
280 | 280 | 'NAME' => $value, |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | ); |
283 | 283 | } |
284 | 284 | |
285 | - foreach(classLocale::$lang['sys_gender_list'] as $key => $value) { |
|
285 | + foreach (classLocale::$lang['sys_gender_list'] as $key => $value) { |
|
286 | 286 | $template_result['.']['gender_list'][] = array( |
287 | 287 | 'VALUE' => $key, |
288 | 288 | 'NAME' => $value, |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | } |
292 | 292 | |
293 | 293 | $lang_list = lng_get_list(); |
294 | - foreach($lang_list as $lang_id => $lang_data) { |
|
294 | + foreach ($lang_list as $lang_id => $lang_data) { |
|
295 | 295 | $template_result['.']['languages'][] = array( |
296 | 296 | 'VALUE' => $lang_id, |
297 | 297 | 'NAME' => $lang_data['LANG_NAME_NATIVE'], |
@@ -300,8 +300,8 @@ discard block |
||
300 | 300 | } |
301 | 301 | |
302 | 302 | |
303 | - if(isset(classLocale::$lang['menu_customize_show_hide_button_state'])) { |
|
304 | - foreach(classLocale::$lang['menu_customize_show_hide_button_state'] as $key => $value) { |
|
303 | + if (isset(classLocale::$lang['menu_customize_show_hide_button_state'])) { |
|
304 | + foreach (classLocale::$lang['menu_customize_show_hide_button_state'] as $key => $value) { |
|
305 | 305 | $template->assign_block_vars('menu_customize_show_hide_button_state', array( |
306 | 306 | 'ID' => $key, |
307 | 307 | 'NAME' => $value, |
@@ -408,10 +408,10 @@ discard block |
||
408 | 408 | 'PAGE_HEADER' => classLocale::$lang['opt_header'], |
409 | 409 | )); |
410 | 410 | |
411 | - foreach($user_option_list as $option_group_id => $option_group) { |
|
412 | - if($option_group_id == OPT_MESSAGE) { |
|
413 | - foreach(DBStaticMessages::$snMessageClassList as $message_class_id => $message_class_data) { |
|
414 | - if($message_class_data['switchable'] || ($message_class_data['email'] && classSupernova::$config->game_email_pm)) { |
|
411 | + foreach ($user_option_list as $option_group_id => $option_group) { |
|
412 | + if ($option_group_id == OPT_MESSAGE) { |
|
413 | + foreach (DBStaticMessages::$snMessageClassList as $message_class_id => $message_class_data) { |
|
414 | + if ($message_class_data['switchable'] || ($message_class_data['email'] && classSupernova::$config->game_email_pm)) { |
|
415 | 415 | $option_name = $message_class_data['name']; |
416 | 416 | |
417 | 417 | $template->assign_block_vars("options_{$option_group_id}", array( |
@@ -423,8 +423,8 @@ discard block |
||
423 | 423 | } |
424 | 424 | } |
425 | 425 | } else { |
426 | - foreach($option_group as $option_name => $option_value) { |
|
427 | - if(array_key_exists($option_name, $user_option_types)) { |
|
426 | + foreach ($option_group as $option_name => $option_value) { |
|
427 | + if (array_key_exists($option_name, $user_option_types)) { |
|
428 | 428 | $option_type = $user_option_types[$option_name]; |
429 | 429 | } else { |
430 | 430 | $option_type = 'switch'; |
@@ -12,9 +12,9 @@ discard block |
||
12 | 12 | define('INSTALL', false); |
13 | 13 | define('IN_ADMIN', true); |
14 | 14 | |
15 | -require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
15 | +require('../common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
16 | 16 | |
17 | -if($user['authlevel'] < 3) { |
|
17 | +if ($user['authlevel'] < 3) { |
|
18 | 18 | AdminMessage(classLocale::$lang['adm_err_denied']); |
19 | 19 | } |
20 | 20 | |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | ), |
29 | 29 | ); |
30 | 30 | $template->assign_block_vars('int_type_selected', $allowed_types[-1]); |
31 | -foreach(DBStaticMessages::$snMessageClassList as $key => $value) { |
|
32 | - if($key == MSG_TYPE_NEW || $key == MSG_TYPE_OUTBOX) { |
|
31 | +foreach (DBStaticMessages::$snMessageClassList as $key => $value) { |
|
32 | + if ($key == MSG_TYPE_NEW || $key == MSG_TYPE_OUTBOX) { |
|
33 | 33 | continue; |
34 | 34 | } |
35 | 35 | |
@@ -41,17 +41,17 @@ discard block |
||
41 | 41 | |
42 | 42 | |
43 | 43 | $message_delete = sys_get_param_id('msg_del'); |
44 | -if(sys_get_param('str_delete_selected') && is_array($message_delete = sys_get_param('selected')) && !empty($message_delete)) { |
|
44 | +if (sys_get_param('str_delete_selected') && is_array($message_delete = sys_get_param('selected')) && !empty($message_delete)) { |
|
45 | 45 | $message_delete = implode(', ', $message_delete); |
46 | 46 | } |
47 | 47 | |
48 | -if($message_delete) { |
|
48 | +if ($message_delete) { |
|
49 | 49 | DBStaticMessages::db_message_list_delete_set($message_delete); |
50 | 50 | $template->assign_block_vars('result', array('MESSAGE' => sprintf(classLocale::$lang['mlst_messages_deleted'], $message_delete))); |
51 | 51 | } |
52 | 52 | |
53 | 53 | |
54 | -if(sys_get_param('str_delete_date') && checkdate($month = sys_get_param_id('delete_month'), $day = sys_get_param_id('delete_day'), $year = sys_get_param_id('delete_year'))) { |
|
54 | +if (sys_get_param('str_delete_date') && checkdate($month = sys_get_param_id('delete_month'), $day = sys_get_param_id('delete_day'), $year = sys_get_param_id('delete_year'))) { |
|
55 | 55 | $delete_date = "{$year}-{$month}-{$day}"; |
56 | 56 | DBStaticMessages::db_message_list_delete_by_date($delete_date, $int_type_selected); |
57 | 57 | $template->assign_block_vars('result', array('MESSAGE' => sprintf(classLocale::$lang['mlst_messages_deleted_date'], $allowed_types[$int_type_selected]['TEXT'], $delete_date))); |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | |
64 | 64 | $int_page_current = min(sys_get_param_id('int_page_current', 1), $page_max); |
65 | 65 | |
66 | -if(sys_get_param('page_prev') && $int_page_current > 1) { |
|
66 | +if (sys_get_param('page_prev') && $int_page_current > 1) { |
|
67 | 67 | $int_page_current--; |
68 | -} elseif(sys_get_param('page_next') && $int_page_current < $page_max) { |
|
68 | +} elseif (sys_get_param('page_next') && $int_page_current < $page_max) { |
|
69 | 69 | $int_page_current++; |
70 | 70 | } |
71 | 71 | |
72 | -for($i = 1; $i <= $page_max; $i++) { |
|
72 | +for ($i = 1; $i <= $page_max; $i++) { |
|
73 | 73 | $template->assign_block_vars('page', array('NUMBER' => $i)); |
74 | 74 | } |
75 | 75 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $StartRec = ($int_page_current - 1) * 25; |
78 | 78 | |
79 | 79 | $Messages = DBStaticMessages::db_message_list_admin_by_type($int_type_selected, $StartRec); |
80 | -while($row = db_fetch($Messages)) { |
|
80 | +while ($row = db_fetch($Messages)) { |
|
81 | 81 | $row['FROM'] = htmlentities($row['FROM'], ENT_COMPAT, 'UTF-8'); |
82 | 82 | $row['OWNER_NAME'] = htmlentities($row['OWNER_NAME'], ENT_COMPAT, 'UTF-8'); |
83 | 83 | $row['TEXT'] = nl2br($row['TEXT']); |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
3 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
4 | 4 | |
5 | 5 | $template = gettemplate('viewreport', true); |
6 | 6 | $template->assign_var('PAGE_HINT', classLocale::$lang['cr_view_hint']); |
@@ -119,10 +119,17 @@ |
||
119 | 119 | return $this; |
120 | 120 | } |
121 | 121 | |
122 | + /** |
|
123 | + * @param string $functionName |
|
124 | + * @param string $alias |
|
125 | + */ |
|
122 | 126 | public function fieldSingleFunction($functionName, $field = '*', $alias = DbSqlLiteral::SQL_LITERAL_ALIAS_NONE) { |
123 | 127 | return $this->field(DbSqlLiteral::build($this->db)->buildSingleArgument($functionName, $field, $alias)); |
124 | 128 | } |
125 | 129 | |
130 | + /** |
|
131 | + * @param string $alias |
|
132 | + */ |
|
126 | 133 | public function fieldCount($field = '*', $alias = DbSqlLiteral::SQL_LITERAL_ALIAS_NONE) { |
127 | 134 | return $this->field(DbSqlLiteral::build($this->db)->count($field, $alias)); |
128 | 135 | } |
@@ -346,9 +346,9 @@ discard block |
||
346 | 346 | } |
347 | 347 | |
348 | 348 | protected function compileFrom() { |
349 | - $this->_compiledQuery[] = 'FROM `{{' . $this->escapeString($this->table) . '}}`'; |
|
349 | + $this->_compiledQuery[] = 'FROM `{{'.$this->escapeString($this->table).'}}`'; |
|
350 | 350 | if (!empty($this->alias)) { |
351 | - $this->_compiledQuery[] = 'AS `' . $this->escapeString($this->alias) . '`'; |
|
351 | + $this->_compiledQuery[] = 'AS `'.$this->escapeString($this->alias).'`'; |
|
352 | 352 | } |
353 | 353 | } |
354 | 354 | |
@@ -358,29 +358,29 @@ discard block |
||
358 | 358 | |
359 | 359 | protected function compileWhere() { |
360 | 360 | // TODO - fields should be escaped !! |
361 | - !empty($this->where) ? $this->_compiledQuery[] = 'WHERE ' . implode(' AND ', $this->where) : false; |
|
361 | + !empty($this->where) ? $this->_compiledQuery[] = 'WHERE '.implode(' AND ', $this->where) : false; |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | protected function compileGroupBy() { |
365 | 365 | // TODO - fields should be escaped !! |
366 | 366 | // !empty($this->groupBy) ? $this->_compiledQuery[] = 'GROUP BY ' . implode(',', $this->arrayEscape($this->groupBy)) : false; |
367 | - !empty($this->groupBy) ? $this->_compiledQuery[] = 'GROUP BY ' . $this->selectFieldsToString($this->groupBy) : false; |
|
367 | + !empty($this->groupBy) ? $this->_compiledQuery[] = 'GROUP BY '.$this->selectFieldsToString($this->groupBy) : false; |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | protected function compileOrderBy() { |
371 | 371 | // TODO - fields should be escaped !! |
372 | - !empty($this->orderBy) ? $this->_compiledQuery[] = 'ORDER BY ' . implode(',', $this->arrayEscape($this->orderBy)) : false; |
|
372 | + !empty($this->orderBy) ? $this->_compiledQuery[] = 'ORDER BY '.implode(',', $this->arrayEscape($this->orderBy)) : false; |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | protected function compileHaving() { |
376 | 376 | // TODO - fields should be escaped !! |
377 | - !empty($this->having) ? $this->_compiledQuery[] = 'HAVING ' . implode(' AND ', $this->having) : false; |
|
377 | + !empty($this->having) ? $this->_compiledQuery[] = 'HAVING '.implode(' AND ', $this->having) : false; |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | protected function compileLimit() { |
381 | 381 | // TODO - fields should be escaped !! |
382 | 382 | if ($limit = $this->fetchOne ? 1 : $this->limit) { |
383 | - $this->_compiledQuery[] = 'LIMIT ' . $limit . (!empty($this->offset) ? ' OFFSET ' . $this->offset : ''); |
|
383 | + $this->_compiledQuery[] = 'LIMIT '.$limit.(!empty($this->offset) ? ' OFFSET '.$this->offset : ''); |
|
384 | 384 | } |
385 | 385 | } |
386 | 386 | |
@@ -424,14 +424,14 @@ discard block |
||
424 | 424 | */ |
425 | 425 | protected function processField($fieldName) { |
426 | 426 | if (is_bool($fieldName)) { |
427 | - $result = (string)intval($fieldName); |
|
427 | + $result = (string) intval($fieldName); |
|
428 | 428 | } elseif (is_numeric($fieldName)) { |
429 | 429 | $result = $fieldName; |
430 | 430 | } elseif (is_null($fieldName)) { |
431 | 431 | $result = 'NULL'; |
432 | 432 | } else { |
433 | 433 | // Field has other type - string or should be convertible to string |
434 | - $result = (string)$fieldName; |
|
434 | + $result = (string) $fieldName; |
|
435 | 435 | if (!$fieldName instanceof DbSqlLiteral) { |
436 | 436 | $result = $this->quoteField($fieldName); |
437 | 437 | } |
@@ -115,6 +115,9 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | |
118 | + /** |
|
119 | + * @param string $query |
|
120 | + */ |
|
118 | 121 | public function setQuery($query) { |
119 | 122 | $this->query = $query; |
120 | 123 | |
@@ -128,6 +131,9 @@ discard block |
||
128 | 131 | } |
129 | 132 | } |
130 | 133 | |
134 | + /** |
|
135 | + * @param string $comment |
|
136 | + */ |
|
131 | 137 | protected function commentAdd($comment) { |
132 | 138 | if (empty($this->values[static::COMMENT_PLACEHOLDER])) { |
133 | 139 | $this->query .= static::COMMENT_PLACEHOLDER; |
@@ -261,7 +267,7 @@ discard block |
||
261 | 267 | } |
262 | 268 | |
263 | 269 | /** |
264 | - * @return bool|mysqli_result |
|
270 | + * @return mysqli_result |
|
265 | 271 | */ |
266 | 272 | public function getResult() { |
267 | 273 | return $this->statement->get_result(); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | // Removing comment placeholder from statement |
165 | 165 | $this->queryPrepared = str_replace(static::COMMENT_PLACEHOLDER, DbSqlHelper::quoteComment($this->comment), $this->queryPrepared); |
166 | 166 | // Removing comment value from values list |
167 | - $this->paramsPrepared = array_filter($this->paramsPrepared, function ($value) { return $value != DbSqlPrepare::COMMENT_PLACEHOLDER; }); |
|
167 | + $this->paramsPrepared = array_filter($this->paramsPrepared, function($value) { return $value != DbSqlPrepare::COMMENT_PLACEHOLDER; }); |
|
168 | 168 | // TODO - Add comment value directly to statement |
169 | 169 | } |
170 | 170 | |
@@ -268,9 +268,9 @@ discard block |
||
268 | 268 | } |
269 | 269 | |
270 | 270 | public function getIterator() { |
271 | - if(DbSqlPrepare::$isUseGetResult) { |
|
271 | + if (DbSqlPrepare::$isUseGetResult) { |
|
272 | 272 | $mysqli_result = $this->statement->get_result(); |
273 | - if($mysqli_result instanceof mysqli_result) { |
|
273 | + if ($mysqli_result instanceof mysqli_result) { |
|
274 | 274 | $iterator = new DbMysqliResultIterator($this->statement->get_result()); |
275 | 275 | } else { |
276 | 276 | $iterator = new DbEmptyIterator(); |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
3 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
4 | 4 | |
5 | 5 | global $user; |
6 | 6 | |
7 | -if($user['authlevel'] < AUTH_LEVEL_DEVELOPER) { |
|
7 | +if ($user['authlevel'] < AUTH_LEVEL_DEVELOPER) { |
|
8 | 8 | $error_message = classSupernova::$config->game_mode == GAME_BLITZ ? 'sys_blitz_page_disabled' : ( |
9 | 9 | !classSupernova::$config->game_blitz_register ? 'sys_blitz_registration_disabled' : '' |
10 | 10 | ); |
11 | 11 | |
12 | - if($error_message) { |
|
12 | + if ($error_message) { |
|
13 | 13 | message(classLocale::$lang[$error_message], classLocale::$lang['sys_error'], 'overview.php', 10); |
14 | 14 | die(); |
15 | 15 | } |
@@ -18,16 +18,16 @@ discard block |
||
18 | 18 | $current_round = intval(classSupernova::$config->db_loadItem('game_blitz_register_round')); |
19 | 19 | $current_price = intval(classSupernova::$config->db_loadItem('game_blitz_register_price')); |
20 | 20 | |
21 | -if(classSupernova::$config->db_loadItem('game_blitz_register') == BLITZ_REGISTER_OPEN && (sys_get_param_str('register_me') || sys_get_param_str('register_me_not'))) { |
|
21 | +if (classSupernova::$config->db_loadItem('game_blitz_register') == BLITZ_REGISTER_OPEN && (sys_get_param_str('register_me') || sys_get_param_str('register_me_not'))) { |
|
22 | 22 | sn_db_transaction_start(); |
23 | 23 | $user = DBStaticUser::db_user_by_id($user['id'], true); |
24 | 24 | $is_registered = db_blitz_reg_get_id_by_player_and_round($user, $current_round); |
25 | - if(sys_get_param_str('register_me')) { |
|
26 | - if(empty($is_registered) && mrc_get_level($user, null, RES_METAMATTER) >= $current_price) { |
|
25 | + if (sys_get_param_str('register_me')) { |
|
26 | + if (empty($is_registered) && mrc_get_level($user, null, RES_METAMATTER) >= $current_price) { |
|
27 | 27 | db_blitz_reg_insert($user, $current_round); |
28 | 28 | classSupernova::$auth->account->metamatter_change(RPG_BLITZ_REGISTRATION, -$current_price, "Регистрация в раунде {$current_round} Блица"); |
29 | 29 | } |
30 | - } elseif(sys_get_param_str('register_me_not') && !empty($is_registered)) { |
|
30 | + } elseif (sys_get_param_str('register_me_not') && !empty($is_registered)) { |
|
31 | 31 | db_blitz_reg_delete($user, $current_round); |
32 | 32 | classSupernova::$auth->account->metamatter_change(RPG_BLITZ_REGISTRATION_CANCEL, $current_price, "Отмена регистрации в раунде {$current_round} Блица"); |
33 | 33 | } |
@@ -42,17 +42,17 @@ discard block |
||
42 | 42 | $blitz_players = 0; |
43 | 43 | $blitz_prize_dark_matter = 0; |
44 | 44 | $blitz_prize_places = 0; |
45 | -if($user['authlevel'] >= AUTH_LEVEL_DEVELOPER) { |
|
46 | - if(sys_get_param_str('generate')) { |
|
45 | +if ($user['authlevel'] >= AUTH_LEVEL_DEVELOPER) { |
|
46 | + if (sys_get_param_str('generate')) { |
|
47 | 47 | $next_id = 0; |
48 | 48 | $query = db_blitz_reg_get_random_id($current_round); |
49 | - while($row = db_fetch($query)) { |
|
49 | + while ($row = db_fetch($query)) { |
|
50 | 50 | $next_id++; |
51 | - $blitz_name = 'Игрок' . $next_id; |
|
51 | + $blitz_name = 'Игрок'.$next_id; |
|
52 | 52 | $blitz_password = sys_random_string(8); |
53 | 53 | db_blitz_reg_update_with_name_and_password($blitz_name, $blitz_password, $row, $current_round); |
54 | 54 | } |
55 | - } elseif(sys_get_param_str('import_generated')) { |
|
55 | + } elseif (sys_get_param_str('import_generated')) { |
|
56 | 56 | // ЭТО НА БЛИЦЕ!!! |
57 | 57 | DBStaticUser::db_player_list_blitz_delete_players(); |
58 | 58 | DBStaticPlanet::db_planets_purge(); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $system = $system_step; |
75 | 75 | $planet = round(Vector::$knownPlanets / 2); |
76 | 76 | |
77 | - foreach($imported_string as &$string_data) { |
|
77 | + foreach ($imported_string as &$string_data) { |
|
78 | 78 | $string_data = explode(',', $string_data); |
79 | 79 | $username_safe = $string_data[0]; |
80 | 80 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | $moon_row = uni_create_moon($galaxy, $system, $planet, $user_new['id'], 30, '', false); |
96 | 96 | |
97 | - if(($system += $system_step) >= Vector::$knownSystems) { |
|
97 | + if (($system += $system_step) >= Vector::$knownSystems) { |
|
98 | 98 | $galaxy++; |
99 | 99 | $system = $system_step; |
100 | 100 | } |
@@ -104,13 +104,13 @@ discard block |
||
104 | 104 | classSupernova::$config->db_saveItem('users_amount', classSupernova::$config->users_amount + $new_players); |
105 | 105 | // pdump($imported_string); |
106 | 106 | // generated_string |
107 | - } elseif(sys_get_param_str('import_result') && ($blitz_result_string = sys_get_param_str('blitz_result_string'))) { |
|
107 | + } elseif (sys_get_param_str('import_result') && ($blitz_result_string = sys_get_param_str('blitz_result_string'))) { |
|
108 | 108 | $blitz_result = explode(';', $blitz_result_string); |
109 | 109 | $blitz_last_update = $blitz_result[0]; // Пока не используется |
110 | 110 | unset($blitz_result[0]); |
111 | - foreach($blitz_result as $blitz_result_data) { |
|
111 | + foreach ($blitz_result as $blitz_result_data) { |
|
112 | 112 | $blitz_result_data = explode(',', $blitz_result_data); |
113 | - if(count($blitz_result_data) == 5) { |
|
113 | + if (count($blitz_result_data) == 5) { |
|
114 | 114 | $blitz_result_data[1] = db_escape($blitz_result_data[1]); |
115 | 115 | db_blitz_reg_update_results($blitz_result_data, $current_round); |
116 | 116 | } |
@@ -118,14 +118,14 @@ discard block |
||
118 | 118 | $blitz_result = array(); |
119 | 119 | } |
120 | 120 | |
121 | - if(classSupernova::$config->game_mode == GAME_BLITZ) { |
|
121 | + if (classSupernova::$config->game_mode == GAME_BLITZ) { |
|
122 | 122 | $blitz_result = array(classSupernova::$config->db_loadItem('var_stat_update')); |
123 | - foreach(DBStaticUser::db_player_list_export_blitz_info() as $row) { |
|
123 | + foreach (DBStaticUser::db_player_list_export_blitz_info() as $row) { |
|
124 | 124 | $blitz_result[] = "{$row['id']},{$row['username']},{$row['onlinetime']},{$row['total_rank']},{$row['total_points']}"; |
125 | 125 | } |
126 | 126 | } else { |
127 | 127 | $query = db_blitz_reg_get_player_list($current_round); |
128 | - while($row = db_fetch($query)) { |
|
128 | + while ($row = db_fetch($query)) { |
|
129 | 129 | $blitz_generated[] = "{$row['blitz_name']},{$row['blitz_password']}"; |
130 | 130 | $row['blitz_online'] ? $blitz_prize_players_active++ : false; |
131 | 131 | $blitz_players++; |
@@ -133,13 +133,13 @@ discard block |
||
133 | 133 | $blitz_prize_dark_matter = $blitz_prize_players_active * 20000; |
134 | 134 | $blitz_prize_places = ceil($blitz_prize_players_active / 5); |
135 | 135 | |
136 | - if(sys_get_param_str('prize_calculate') && $blitz_prize_players_active && ($blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'))) { |
|
136 | + if (sys_get_param_str('prize_calculate') && $blitz_prize_players_active && ($blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'))) { |
|
137 | 137 | // $blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'); |
138 | 138 | $blitz_prize_places_actual = sys_get_param_int('blitz_prize_places'); |
139 | 139 | sn_db_transaction_start(); |
140 | 140 | $query = db_blitz_reg_get_player_list_order_by_place($current_round); |
141 | - while($row = db_fetch($query)) { |
|
142 | - if(!$row['blitz_place']) { |
|
141 | + while ($row = db_fetch($query)) { |
|
142 | + if (!$row['blitz_place']) { |
|
143 | 143 | continue; |
144 | 144 | } |
145 | 145 | |
@@ -148,14 +148,14 @@ discard block |
||
148 | 148 | |
149 | 149 | $reward = $blitz_prize_dark_matter_actual - $row['blitz_reward_dark_matter']; |
150 | 150 | pdump("{{$row['id']}} {$row['blitz_name']}, Place {$row['blitz_place']}, Prize places {$blitz_prize_places_actual}, Prize {$reward}", $row['id']); |
151 | - if($reward) { |
|
151 | + if ($reward) { |
|
152 | 152 | rpg_points_change($row['user_id'], RPG_BLITZ, $reward, sprintf( |
153 | 153 | classLocale::$lang['sys_blitz_reward_log_message'], $row['blitz_place'], $row['blitz_name'] |
154 | 154 | )); |
155 | 155 | db_blitz_reg_update_apply_results($reward, $row, $current_round); |
156 | 156 | } |
157 | 157 | |
158 | - if(!$blitz_prize_places_actual || $blitz_prize_dark_matter_actual < 1000) { |
|
158 | + if (!$blitz_prize_places_actual || $blitz_prize_dark_matter_actual < 1000) { |
|
159 | 159 | break; |
160 | 160 | } |
161 | 161 | } |
@@ -170,12 +170,12 @@ discard block |
||
170 | 170 | |
171 | 171 | $player_registered = false; |
172 | 172 | $query = db_blitz_reg_get_player_list_and_users($current_round); |
173 | -while($row = db_fetch($query)) { |
|
173 | +while ($row = db_fetch($query)) { |
|
174 | 174 | $tpl_player_data = array( |
175 | 175 | 'NAME' => player_nick_render_to_html($row, array('icons' => true, 'color' => true, 'ally' => true)), |
176 | 176 | ); |
177 | 177 | |
178 | - if(classSupernova::$config->game_blitz_register == BLITZ_REGISTER_DISCLOSURE_NAMES) { |
|
178 | + if (classSupernova::$config->game_blitz_register == BLITZ_REGISTER_DISCLOSURE_NAMES) { |
|
179 | 179 | // Вот так хитро, что бы не было не единого шанса попадания на страницу данных об игроках Блиц-сервера до закрытия раунда |
180 | 180 | $tpl_player_data = array_merge($tpl_player_data, array( |
181 | 181 | 'ID' => $row['id'], |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | } |
189 | 189 | |
190 | 190 | $template->assign_block_vars('registrations', $tpl_player_data); |
191 | - if($row['id'] == $user['id']) { |
|
191 | + if ($row['id'] == $user['id']) { |
|
192 | 192 | $player_registered = $row; |
193 | 193 | } |
194 | 194 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | $fields[0] = &$this->_result; |
16 | 16 | |
17 | - while($field = mysqli_fetch_field($data)) { |
|
17 | + while ($field = mysqli_fetch_field($data)) { |
|
18 | 18 | $fields[] = &$out[$field->name]; |
19 | 19 | } |
20 | 20 |