@@ -14,14 +14,14 @@ |
||
14 | 14 | global $lang, $user, $planetrow; |
15 | 15 | |
16 | 16 | $tech_tree = array(); |
17 | - foreach(get_unit_param('techtree') as $unit_group_id => $unit_list) |
|
17 | + foreach (get_unit_param('techtree') as $unit_group_id => $unit_list) |
|
18 | 18 | { |
19 | 19 | $tech_tree[] = array( |
20 | 20 | 'NAME' => $lang['tech'][$unit_group_id], |
21 | 21 | 'GROUP_ID' => $unit_group_id, |
22 | 22 | ); |
23 | 23 | |
24 | - foreach($unit_list as $unit_id) |
|
24 | + foreach ($unit_list as $unit_id) |
|
25 | 25 | { |
26 | 26 | $sn_data_unit = get_unit_param($unit_id); |
27 | 27 | $level_basic = $sn_data_unit[P_STACKABLE] ? 0 : mrc_get_level($user, $planetrow, $unit_id, false, true); |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -function geoip_status(){return sn_function_call('geoip_status', array(&$result));} |
|
3 | +function geoip_status() {return sn_function_call('geoip_status', array(&$result)); } |
|
4 | 4 | function sn_geoip_status(&$result) { |
5 | 5 | return $result = false; |
6 | 6 | } |
7 | 7 | |
8 | -function geoip_ip_info($ip){return sn_function_call('geoip_ip_info', array($ip, &$result));} |
|
8 | +function geoip_ip_info($ip) {return sn_function_call('geoip_ip_info', array($ip, &$result)); } |
|
9 | 9 | function sn_geoip_ip_info($ip, &$result) { |
10 | 10 | return $result = false; |
11 | 11 | } |
@@ -7,8 +7,8 @@ |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -define('INSIDE' , true); |
|
11 | -define('INSTALL' , false); |
|
10 | +define('INSIDE', true); |
|
11 | +define('INSTALL', false); |
|
12 | 12 | |
13 | 13 | require('common.' . substr(strrchr(__FILE__, '.'), 1)); |
14 | 14 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | |
16 | 16 | include('includes/init.' . substr(strrchr(__FILE__, '.'), 1)); |
17 | 17 | // die(); |
18 | -if($template_result[F_USER_IS_AUTHORIZED]) { |
|
18 | +if ($template_result[F_USER_IS_AUTHORIZED]) { |
|
19 | 19 | sys_redirect('index' . DOT_PHP_EX); |
20 | 20 | } |
21 | 21 | lng_include('login'); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $newstock = $stock; |
27 | 27 | $intError = MARKET_DEAL; |
28 | 28 | |
29 | -switch($mode) |
|
29 | +switch ($mode) |
|
30 | 30 | { |
31 | 31 | case MARKET_RESOURCES: // Resource trader |
32 | 32 | require('includes/includes/market_trader.inc'); |
@@ -82,12 +82,12 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | $message_id = sys_get_param_int('message'); |
85 | -if($message_id != MARKET_NOTHING) |
|
85 | +if ($message_id != MARKET_NOTHING) |
|
86 | 86 | { |
87 | 87 | $template->assign_block_vars('result', array('MESSAGE' => $lang['eco_mrk_errors'][$message_id])); |
88 | 88 | } |
89 | 89 | |
90 | -if($message) |
|
90 | +if ($message) |
|
91 | 91 | { |
92 | 92 | $template->assign_block_vars('result', array('MESSAGE' => $message)); |
93 | 93 | } |
@@ -41,7 +41,7 @@ |
||
41 | 41 | // $query = static::$db->doquery("SELECT `id` FROM {{confirmations}} WHERE `code` = '{$confirm_code_safe}' AND `type` = {$confirmation_type_safe} FOR UPDATE", true); |
42 | 42 | // Тип не нужен для проверки - код подтверждения должен быть уникален от слова "совсем" |
43 | 43 | $query = $this->db->doquery("SELECT `id` FROM {{confirmations}} WHERE `code` = '{$confirm_code_safe}' FOR UPDATE", true); |
44 | - } while($query); |
|
44 | + } while ($query); |
|
45 | 45 | |
46 | 46 | $this->db->doquery( |
47 | 47 | "REPLACE INTO {{confirmations}} |
@@ -89,15 +89,15 @@ discard block |
||
89 | 89 | // Инфа об устройстве и браузере - общая для всех |
90 | 90 | sn_db_transaction_start(); |
91 | 91 | $this->device_cypher = $_COOKIE[SN_COOKIE_D]; |
92 | - if($this->device_cypher) { |
|
92 | + if ($this->device_cypher) { |
|
93 | 93 | $cypher_safe = db_escape($this->device_cypher); |
94 | 94 | $device_id = doquery("SELECT `device_id` FROM {{security_device}} WHERE `device_cypher` = '{$cypher_safe}' LIMIT 1 FOR UPDATE", true); |
95 | - if(!empty($device_id['device_id'])) { |
|
95 | + if (!empty($device_id['device_id'])) { |
|
96 | 96 | $this->device_id = $device_id['device_id']; |
97 | 97 | } |
98 | 98 | } |
99 | 99 | |
100 | - if($this->device_id <= 0) { |
|
100 | + if ($this->device_id <= 0) { |
|
101 | 101 | do { |
102 | 102 | $cypher_safe = db_escape($this->device_cypher = sys_random_string()); |
103 | 103 | $row = doquery("SELECT `device_id` FROM {{security_device}} WHERE `device_cypher` = '{$cypher_safe}' LIMIT 1 FOR UPDATE", true); |
@@ -118,10 +118,10 @@ discard block |
||
118 | 118 | $this->page_address_id = db_get_set_unique_id_value($this->page_address, 'url_id', 'security_url', 'url_string'); |
119 | 119 | sn_db_transaction_commit(); |
120 | 120 | |
121 | - if($this->write_full_url) { |
|
121 | + if ($this->write_full_url) { |
|
122 | 122 | sn_db_transaction_start(); |
123 | 123 | $this->page_url = substr($_SERVER['REQUEST_URI'], strlen(SN_ROOT_RELATIVE)); |
124 | - if(strpos($_SERVER['REQUEST_URI'], '/simulator.php') === 0) { |
|
124 | + if (strpos($_SERVER['REQUEST_URI'], '/simulator.php') === 0) { |
|
125 | 125 | $this->page_url = '/simulator.php'; |
126 | 126 | } |
127 | 127 | $this->page_url_id = db_get_set_unique_id_value($this->page_url, 'url_id', 'security_url', 'url_string'); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function db_security_entry_insert($user_id_unsafe) { |
146 | 146 | // TODO $user_id = !empty(self::$user['id']) ? self::$user['id'] : 'NULL'; |
147 | - if(empty($user_id_unsafe)) { |
|
147 | + if (empty($user_id_unsafe)) { |
|
148 | 148 | // self::flog('Нет ИД пользователя'); |
149 | 149 | return true; |
150 | 150 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | public function db_counter_insert($user_id_unsafe) { |
168 | 168 | global $config, $sys_stop_log_hit, $is_watching; |
169 | 169 | |
170 | - if($sys_stop_log_hit || !$config->game_counter) { |
|
170 | + if ($sys_stop_log_hit || !$config->game_counter) { |
|
171 | 171 | return; |
172 | 172 | } |
173 | 173 | |
@@ -183,14 +183,14 @@ discard block |
||
183 | 183 | // $this->ip_v4_int . ", '{$proxy_safe}', " . $this->page_address_id . ", " . $this->page_url_id . ");"); |
184 | 184 | doquery( |
185 | 185 | "INSERT INTO {{counter}} SET |
186 | - `visit_time` = '" . SN_TIME_SQL. "', |
|
186 | + `visit_time` = '" . SN_TIME_SQL . "', |
|
187 | 187 | `user_id` = {$user_id_safe}, |
188 | 188 | `device_id` = {$this->device_id}, |
189 | 189 | `browser_id` = {$this->browser_id}, |
190 | 190 | `user_ip` = {$this->ip_v4_int}, |
191 | 191 | `user_proxy` = '{$proxy_safe}', |
192 | 192 | `page_url_id` = {$this->page_address_id}" . |
193 | - ($this->write_full_url ? ", `plain_url_id` = {$this->page_url_id}" : '' ). |
|
193 | + ($this->write_full_url ? ", `plain_url_id` = {$this->page_url_id}" : '') . |
|
194 | 194 | ";"); |
195 | 195 | |
196 | 196 | $is_watching = false; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | function db_unit_records_sum($unit_id, $user_skip_list_unit) |
105 | 105 | { |
106 | - return doquery ( |
|
106 | + return doquery( |
|
107 | 107 | "SELECT unit_player_id, username, sum(unit_level) as unit_level |
108 | 108 | FROM {{unit}} JOIN {{users}} AS u ON u.id = unit_player_id |
109 | 109 | WHERE unit_player_id != 0 AND unit_snid = {$unit_id} {$user_skip_list_unit} |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | function db_unit_records_plain($unit_id, $user_skip_list_unit) |
117 | 117 | { |
118 | - return doquery ( |
|
118 | + return doquery( |
|
119 | 119 | "SELECT unit_player_id, username, unit_level |
120 | 120 | FROM {{unit}} JOIN {{users}} AS u ON u.id = unit_player_id |
121 | 121 | WHERE unit_player_id != 0 AND unit_snid = {$unit_id} {$user_skip_list_unit} |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | function db_stat_list_statistic($who, $is_common_stat, $Rank, $start, $source = false) { |
128 | - if(!$source) { |
|
128 | + if (!$source) { |
|
129 | 129 | $source = array( |
130 | 130 | 'statpoints' => 'statpoints', |
131 | 131 | 'users' => 'users', |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | ); |
147 | 147 | } |
148 | 148 | |
149 | - if($who == 1) { |
|
150 | - if($is_common_stat) { // , UNIX_TIMESTAMP(CONCAT(YEAR(CURRENT_DATE), DATE_FORMAT(`user_birthday`, '-%m-%d'))) AS `nearest_birthday` |
|
149 | + if ($who == 1) { |
|
150 | + if ($is_common_stat) { // , UNIX_TIMESTAMP(CONCAT(YEAR(CURRENT_DATE), DATE_FORMAT(`user_birthday`, '-%m-%d'))) AS `nearest_birthday` |
|
151 | 151 | $query_str = |
152 | 152 | "SELECT |
153 | 153 | @rownum:=@rownum+1 rownum, subject.{$source['id']} as `id`, sp.{$Rank}_rank as rank, sp.{$Rank}_old_rank as rank_old, sp.{$Rank}_points as points, subject.{$source['username']} as `name`, subject.* |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | ORDER BY |
162 | 162 | sp.`{$Rank}_rank`, subject.{$source['id']} |
163 | 163 | LIMIT |
164 | - ". $start .",100;"; |
|
164 | + " . $start . ",100;"; |
|
165 | 165 | } else { // , UNIX_TIMESTAMP(CONCAT(YEAR(CURRENT_DATE), DATE_FORMAT(`user_birthday`, '-%m-%d'))) AS `nearest_birthday` |
166 | 166 | $query_str = |
167 | 167 | "SELECT |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | ORDER BY |
175 | 175 | subject.{$Rank} DESC, subject.{$source['id']} |
176 | 176 | LIMIT |
177 | - ". $start .",100;"; |
|
177 | + " . $start . ",100;"; |
|
178 | 178 | } |
179 | 179 | } else { |
180 | 180 | // TODO |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | ORDER BY |
192 | 192 | sp.`{$Rank}_rank`, subject.id |
193 | 193 | LIMIT |
194 | - ". $start .",100;"; |
|
194 | + " . $start . ",100;"; |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | return doquery($query_str); |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | function db_get_set_unique_id_value($current_value_unsafe, $db_id_field_name, $db_table_name, $db_value_field_name) { |
278 | 278 | $current_value_safe = db_escape($current_value_unsafe); |
279 | 279 | $value_id = doquery("SELECT `{$db_id_field_name}` AS id_field FROM {{{$db_table_name}}} WHERE `{$db_value_field_name}` = '{$current_value_safe}' LIMIT 1 FOR UPDATE", true); |
280 | - if(!isset($value_id['id_field']) || !$value_id['id_field']) { |
|
280 | + if (!isset($value_id['id_field']) || !$value_id['id_field']) { |
|
281 | 281 | doquery("INSERT INTO {{{$db_table_name}}} (`{$db_value_field_name}`) VALUES ('{$current_value_safe}');"); |
282 | 282 | $variable_id = db_insert_id(); |
283 | 283 | } else { |
@@ -27,19 +27,19 @@ discard block |
||
27 | 27 | */ |
28 | 28 | function db_set_make_safe_string($set, $delta = false) { |
29 | 29 | $set_safe = array(); |
30 | - foreach($set as $field => $value) { |
|
31 | - if(empty($field)) { |
|
30 | + foreach ($set as $field => $value) { |
|
31 | + if (empty($field)) { |
|
32 | 32 | continue; |
33 | 33 | } |
34 | 34 | |
35 | 35 | $field = '`' . db_escape($field) . '`'; |
36 | 36 | $new_value = $value; |
37 | - if($value === null) { |
|
37 | + if ($value === null) { |
|
38 | 38 | $new_value = 'NULL'; |
39 | - } elseif(is_string($value) && (string)($new_value = floatval($value)) != (string)$value) { |
|
39 | + } elseif (is_string($value) && (string) ($new_value = floatval($value)) != (string) $value) { |
|
40 | 40 | // non-float |
41 | 41 | $new_value = '"' . db_escape($value) . '"'; |
42 | - } elseif($delta) { |
|
42 | + } elseif ($delta) { |
|
43 | 43 | // float and DELTA-set |
44 | 44 | $new_value = "{$field} + ({$new_value})"; |
45 | 45 | } |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | */ |
60 | 60 | function missile_list_convert_to_fleet(&$missile_db_list, &$fleet_db_list) { |
61 | 61 | // Missile attack |
62 | - foreach($missile_db_list as $irak) { |
|
63 | - if($irak['fleet_end_time'] >= SN_TIME_NOW) { |
|
62 | + foreach ($missile_db_list as $irak) { |
|
63 | + if ($irak['fleet_end_time'] >= SN_TIME_NOW) { |
|
64 | 64 | $irak['fleet_start_type'] = PT_PLANET; |
65 | 65 | $planet_start = DBStaticPlanet::db_planet_by_vector($irak, 'fleet_start_', false, 'name'); |
66 | 66 | $irak['fleet_id'] = -$irak['id']; |