@@ -28,13 +28,13 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | $this->container = array(); |
| 30 | 30 | |
| 31 | - if(classSupernova::$cache->_MODE != CACHER_NO_CACHE && !classSupernova::$config->locale_cache_disable) { |
|
| 31 | + if (classSupernova::$cache->_MODE != CACHER_NO_CACHE && !classSupernova::$config->locale_cache_disable) { |
|
| 32 | 32 | $this->cache = classSupernova::$cache; |
| 33 | 33 | classSupernova::log_file('locale.__constructor: Cache is present'); |
| 34 | 34 | //$this->cache->unset_by_prefix($this->cache_prefix); // TODO - remove? 'cause debug! |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - if($enable_stat_usage && empty($this->stat_usage)) { |
|
| 37 | + if ($enable_stat_usage && empty($this->stat_usage)) { |
|
| 38 | 38 | $this->enable_stat_usage = $enable_stat_usage; |
| 39 | 39 | $this->usage_stat_load(); |
| 40 | 40 | // TODO shutdown function |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | unset($fallback[$this->active]); |
| 61 | 61 | |
| 62 | 62 | // Проходим по оставшимся локалям |
| 63 | - foreach($fallback as $try_language) { |
|
| 63 | + foreach ($fallback as $try_language) { |
|
| 64 | 64 | // Если нет такой строки - пытаемся вытащить из кэша |
| 65 | - if(!isset($this->container[$try_language][$offset]) && $this->cache) { |
|
| 65 | + if (!isset($this->container[$try_language][$offset]) && $this->cache) { |
|
| 66 | 66 | $this->container[$try_language][$offset] = $this->cache->__get($this->cache_prefix . $try_language . '_' . $offset); |
| 67 | 67 | // Записываем результат работы кэша |
| 68 | 68 | $locale_cache_statistic['queries']++; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // Если мы как-то где-то нашли строку... |
| 74 | - if(isset($this->container[$try_language][$offset])) { |
|
| 74 | + if (isset($this->container[$try_language][$offset])) { |
|
| 75 | 75 | // ...значит она получена в результате фоллбэка и записываем её в кэш и контейнер |
| 76 | 76 | $this[$offset] = $this->container[$try_language][$offset]; |
| 77 | 77 | $locale_cache_statistic['fallbacks']++; |
@@ -87,16 +87,16 @@ discard block |
||
| 87 | 87 | $this->container[$this->active][] = $value; |
| 88 | 88 | } else { |
| 89 | 89 | $this->container[$this->active][$offset] = $value; |
| 90 | - if($this->cache) { |
|
| 90 | + if ($this->cache) { |
|
| 91 | 91 | $this->cache->__set($this->cache_prefix_lang . $offset, $value); |
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | public function offsetExists($offset) { |
| 96 | 96 | // Шорткат если у нас уже есть строка в памяти PHP |
| 97 | - if(!isset($this->container[$this->active][$offset])) { |
|
| 97 | + if (!isset($this->container[$this->active][$offset])) { |
|
| 98 | 98 | // pdump($this->cache_prefix_lang . $offset); |
| 99 | - if(!$this->cache || !($this->container[$this->active][$offset] = $this->cache->__get($this->cache_prefix_lang . $offset))) { |
|
| 99 | + if (!$this->cache || !($this->container[$this->active][$offset] = $this->cache->__get($this->cache_prefix_lang . $offset))) { |
|
| 100 | 100 | // pdump($this->cache_prefix_lang . $offset); |
| 101 | 101 | // Если нету такой строки - делаем фоллбэк |
| 102 | 102 | $this->locale_string_fallback($offset); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | public function offsetGet($offset) { |
| 114 | 114 | $value = $this->offsetExists($offset) ? $this->container[$this->active][$offset] : null; |
| 115 | - if($this->enable_stat_usage) { |
|
| 115 | + if ($this->enable_stat_usage) { |
|
| 116 | 116 | $this->usage_stat_log($offset, $value); |
| 117 | 117 | } |
| 118 | 118 | return $value; |
@@ -129,24 +129,24 @@ discard block |
||
| 129 | 129 | public function usage_stat_load() { |
| 130 | 130 | global $sn_cache; |
| 131 | 131 | |
| 132 | - $this->stat_usage = $sn_cache->lng_stat_usage = array(); // TODO for debug |
|
| 133 | - if(empty($this->stat_usage)) { |
|
| 132 | + $this->stat_usage = $sn_cache->lng_stat_usage = array(); // TODO for debug |
|
| 133 | + if (empty($this->stat_usage)) { |
|
| 134 | 134 | $query = doquery("SELECT * FROM {{lng_usage_stat}}"); |
| 135 | - while($row = db_fetch($query)) { |
|
| 135 | + while ($row = db_fetch($query)) { |
|
| 136 | 136 | $this->stat_usage[$row['lang_code'] . ':' . $row['string_id'] . ':' . $row['file'] . ':' . $row['line']] = $row['is_empty']; |
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | public function usage_stat_save() { |
| 141 | - if(!empty($this->stat_usage_new)) { |
|
| 141 | + if (!empty($this->stat_usage_new)) { |
|
| 142 | 142 | global $sn_cache; |
| 143 | 143 | $sn_cache->lng_stat_usage = $this->stat_usage; |
| 144 | 144 | doquery("SELECT 1 FROM {{lng_usage_stat}} LIMIT 1"); |
| 145 | - foreach($this->stat_usage_new as &$value) { |
|
| 146 | - foreach($value as &$value2) { |
|
| 145 | + foreach ($this->stat_usage_new as &$value) { |
|
| 146 | + foreach ($value as &$value2) { |
|
| 147 | 147 | $value2 = '"' . db_escape($value2) . '"'; |
| 148 | 148 | } |
| 149 | - $value = '(' . implode(',', $value) .')'; |
|
| 149 | + $value = '(' . implode(',', $value) . ')'; |
|
| 150 | 150 | } |
| 151 | 151 | doquery("REPLACE INTO {{lng_usage_stat}} (lang_code,string_id,`file`,line,is_empty,locale) VALUES " . implode(',', $this->stat_usage_new)); |
| 152 | 152 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $file = str_replace('\\', '/', substr($trace[1]['file'], strlen(SN_ROOT_PHYSICAL) - 1)); |
| 160 | 160 | |
| 161 | 161 | $string_id = $this->active . ':' . $offset . ':' . $file . ':' . $trace[1]['line']; |
| 162 | - if(!isset($this->stat_usage[$string_id]) || $this->stat_usage[$string_id] != $empty) { |
|
| 162 | + if (!isset($this->stat_usage[$string_id]) || $this->stat_usage[$string_id] != $empty) { |
|
| 163 | 163 | $this->stat_usage[$string_id] = empty($value); |
| 164 | 164 | $this->stat_usage_new[] = array( |
| 165 | 165 | 'lang_code' => $this->active, |
@@ -199,11 +199,11 @@ discard block |
||
| 199 | 199 | $cache_file_key = $this->cache_prefix_lang . '__' . $filename; |
| 200 | 200 | |
| 201 | 201 | // Подключен ли внешний кэш? |
| 202 | - if($this->cache) { |
|
| 202 | + if ($this->cache) { |
|
| 203 | 203 | // Загружен ли уже данный файл? |
| 204 | 204 | $cache_file_status = $this->cache->__get($cache_file_key); |
| 205 | 205 | classSupernova::log_file("locale.include: Cache - '{$filename}' has key '{$cache_file_key}' and is " . ($cache_file_status ? 'already loaded - EXIT' : 'EMPTY'), $cache_file_status ? -1 : 0); |
| 206 | - if($cache_file_status) { |
|
| 206 | + if ($cache_file_status) { |
|
| 207 | 207 | // Если да - повторять загрузку нет смысла |
| 208 | 208 | return null; |
| 209 | 209 | } |
@@ -217,35 +217,35 @@ discard block |
||
| 217 | 217 | $this->make_fallback($language); |
| 218 | 218 | |
| 219 | 219 | $file_path = ''; |
| 220 | - foreach($this->fallback as $lang_try) { |
|
| 221 | - if(!$lang_try /* || isset($language_tried[$lang_try]) */) { |
|
| 220 | + foreach ($this->fallback as $lang_try) { |
|
| 221 | + if (!$lang_try /* || isset($language_tried[$lang_try]) */) { |
|
| 222 | 222 | continue; |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - if($file_path = $this->lng_try_filepath($path, "language/{$lang_try}/{$filename_ext}")) { |
|
| 225 | + if ($file_path = $this->lng_try_filepath($path, "language/{$lang_try}/{$filename_ext}")) { |
|
| 226 | 226 | break; |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | - if($file_path = $this->lng_try_filepath($path, "language/{$filename}_{$lang_try}{$ext}")) { |
|
| 229 | + if ($file_path = $this->lng_try_filepath($path, "language/{$filename}_{$lang_try}{$ext}")) { |
|
| 230 | 230 | break; |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | $file_path = ''; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | - if($file_path) { |
|
| 236 | + if ($file_path) { |
|
| 237 | 237 | include($file_path); |
| 238 | 238 | |
| 239 | - if(!empty($a_lang_array)) { |
|
| 239 | + if (!empty($a_lang_array)) { |
|
| 240 | 240 | $this->merge($a_lang_array); |
| 241 | 241 | |
| 242 | 242 | // Загрузка данных из файла в кэш |
| 243 | - if($this->cache) { |
|
| 243 | + if ($this->cache) { |
|
| 244 | 244 | classSupernova::log_file("Locale: loading '{$filename}' into cache"); |
| 245 | - foreach($a_lang_array as $key => $value) { |
|
| 245 | + foreach ($a_lang_array as $key => $value) { |
|
| 246 | 246 | $value_cache_key = $this->cache_prefix_lang . $key; |
| 247 | - if($this->cache->__isset($value_cache_key)) { |
|
| 248 | - if(is_array($value)) { |
|
| 247 | + if ($this->cache->__isset($value_cache_key)) { |
|
| 248 | + if (is_array($value)) { |
|
| 249 | 249 | $alt_value = $this->cache->__get($value_cache_key); |
| 250 | 250 | $value = array_replace_recursive($alt_value, $value); |
| 251 | 251 | // pdump($alt_value, $alt_value); |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | } |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - if($this->cache) { |
|
| 259 | + if ($this->cache) { |
|
| 260 | 260 | $this->cache->__set($cache_file_key, true); |
| 261 | 261 | } |
| 262 | 262 | |
@@ -269,14 +269,14 @@ discard block |
||
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | public function lng_load_i18n($i18n) { |
| 272 | - if(!isset($i18n)) { |
|
| 272 | + if (!isset($i18n)) { |
|
| 273 | 273 | return; |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | - foreach($i18n as $i18n_data) { |
|
| 277 | - if(is_string($i18n_data)) { |
|
| 276 | + foreach ($i18n as $i18n_data) { |
|
| 277 | + if (is_string($i18n_data)) { |
|
| 278 | 278 | $this->lng_include($i18n_data); |
| 279 | - } elseif(is_array($i18n_data)) { |
|
| 279 | + } elseif (is_array($i18n_data)) { |
|
| 280 | 280 | $this->lng_include($i18n_data['file'], $i18n_data['path']); |
| 281 | 281 | } |
| 282 | 282 | } |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | |
| 295 | 295 | classSupernova::log_file("locale.switch: Trying to switch language to '{$language_new}'"); |
| 296 | 296 | |
| 297 | - if($language_new == $this->active) { |
|
| 297 | + if ($language_new == $this->active) { |
|
| 298 | 298 | classSupernova::log_file("locale.switch: New language '{$language_new}' is equal to current language '{$this->active}' - EXIT", -1); |
| 299 | 299 | return false; |
| 300 | 300 | } |
@@ -305,10 +305,10 @@ discard block |
||
| 305 | 305 | $this['LANG_INFO'] = $this->lng_get_info($this->active); |
| 306 | 306 | $this->make_fallback($this->active); |
| 307 | 307 | |
| 308 | - if($this->cache) { |
|
| 308 | + if ($this->cache) { |
|
| 309 | 309 | $cache_lang_init_status = $this->cache->__get($this->cache_prefix_lang . '__INIT'); |
| 310 | 310 | classSupernova::log_file("locale.switch: Cache for '{$this->active}' prefixed '{$this->cache_prefix_lang}' is " . ($cache_lang_init_status ? 'already loaded. Doing nothing - EXIT' : 'EMPTY'), $cache_lang_init_status ? -1 : 0); |
| 311 | - if($cache_lang_init_status) { |
|
| 311 | + if ($cache_lang_init_status) { |
|
| 312 | 312 | return false; |
| 313 | 313 | } |
| 314 | 314 | |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | // Loading global language files |
| 325 | 325 | $this->lng_load_i18n($sn_mvc['i18n']['']); |
| 326 | 326 | |
| 327 | - if($this->cache) { |
|
| 327 | + if ($this->cache) { |
|
| 328 | 328 | classSupernova::log_file("locale.switch: Cache - setting flag " . $this->cache_prefix_lang . '__INIT'); |
| 329 | 329 | $this->cache->__set($this->cache_prefix_lang . '__INIT', true); |
| 330 | 330 | } |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | public function lng_get_info($entry) { |
| 339 | 339 | $file_name = SN_ROOT_PHYSICAL . 'language/' . $entry . '/language.mo.php'; |
| 340 | 340 | $lang_info = array(); |
| 341 | - if(file_exists($file_name)) { |
|
| 341 | + if (file_exists($file_name)) { |
|
| 342 | 342 | include($file_name); |
| 343 | 343 | } |
| 344 | 344 | |
@@ -346,15 +346,15 @@ discard block |
||
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | public function lng_get_list() { |
| 349 | - if(empty($this->lang_list)) { |
|
| 349 | + if (empty($this->lang_list)) { |
|
| 350 | 350 | $this->lang_list = array(); |
| 351 | 351 | |
| 352 | 352 | $path = SN_ROOT_PHYSICAL . 'language/'; |
| 353 | 353 | $dir = dir($path); |
| 354 | - while(false !== ($entry = $dir->read())) { |
|
| 355 | - if(is_dir($path . $entry) && $entry[0] != '.') { |
|
| 354 | + while (false !== ($entry = $dir->read())) { |
|
| 355 | + if (is_dir($path . $entry) && $entry[0] != '.') { |
|
| 356 | 356 | $lang_info = $this->lng_get_info($entry); |
| 357 | - if($lang_info['LANG_NAME_ISO2'] == $entry) { |
|
| 357 | + if ($lang_info['LANG_NAME_ISO2'] == $entry) { |
|
| 358 | 358 | $this->lang_list[$lang_info['LANG_NAME_ISO2']] = $lang_info; |
| 359 | 359 | } |
| 360 | 360 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | protected static $is_init = false; |
| 20 | 20 | |
| 21 | 21 | protected static function init() { |
| 22 | - if(!empty(static::$db)) { |
|
| 22 | + if (!empty(static::$db)) { |
|
| 23 | 23 | return; |
| 24 | 24 | } |
| 25 | 25 | static::$db = classSupernova::$db; |
@@ -66,12 +66,12 @@ discard block |
||
| 66 | 66 | $provider_id_safe = intval($provider_id_unsafe); |
| 67 | 67 | !is_array($account_list) ? $account_list = array($account_list) : false; |
| 68 | 68 | |
| 69 | - foreach($account_list as $provider_account_id_unsafe) { |
|
| 69 | + foreach ($account_list as $provider_account_id_unsafe) { |
|
| 70 | 70 | $provider_account_id_safe = intval($provider_account_id_unsafe); |
| 71 | 71 | |
| 72 | 72 | // TODO - Здесь могут отсутствовать аккаунты - проверять провайдером |
| 73 | 73 | $query = static::$db->doquery("SELECT `user_id` FROM {{account_translate}} WHERE `provider_id` = {$provider_id_safe} AND `provider_account_id` = {$provider_account_id_safe} FOR UPDATE"); |
| 74 | - while($row = static::$db->db_fetch($query)) { |
|
| 74 | + while ($row = static::$db->db_fetch($query)) { |
|
| 75 | 75 | $account_translation[$row['user_id']][$provider_id_unsafe][$provider_account_id_unsafe] = true; |
| 76 | 76 | } |
| 77 | 77 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | "SELECT * FROM {{account_translate}} WHERE `user_id` = {$user_id_safe} " . |
| 92 | 92 | ($provider_id_unsafe ? "AND `provider_id` = {$provider_id_safe} " : '') . |
| 93 | 93 | "ORDER BY `timestamp` FOR UPDATE"); |
| 94 | - while($row = static::$db->db_fetch($query)) { |
|
| 94 | + while ($row = static::$db->db_fetch($query)) { |
|
| 95 | 95 | $account_translation[$row['user_id']][$row['provider_id']][$row['provider_account_id']] = $row; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -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}} |
@@ -30,17 +30,17 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | static $need_keys = array('server', 'user', 'pass', 'name', 'prefix'); |
| 32 | 32 | |
| 33 | - if($this->connected) { |
|
| 33 | + if ($this->connected) { |
|
| 34 | 34 | return true; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - if(empty($settings) || !is_array($settings) || array_intersect($need_keys, array_keys($settings)) != $need_keys) { |
|
| 37 | + if (empty($settings) || !is_array($settings) || array_intersect($need_keys, array_keys($settings)) != $need_keys) { |
|
| 38 | 38 | $debug->error_fatal('There is missconfiguration in your config.php. Check it again', $this->mysql_error()); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | // TODO !!!!!! DEBUG -> error!!!! |
| 42 | 42 | @$this->link = mysql_connect($settings['server'], $settings['user'], $settings['pass']); |
| 43 | - if(!is_resource($this->link)) { |
|
| 43 | + if (!is_resource($this->link)) { |
|
| 44 | 44 | $debug->error_fatal('DB Error - cannot connect to server', $this->mysql_error()); |
| 45 | 45 | } |
| 46 | 46 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | return mysql_real_escape_string($unescaped_string, $this->link); |
| 69 | 69 | } |
| 70 | 70 | function mysql_close_link() { |
| 71 | - if($this->connected) { |
|
| 71 | + if ($this->connected) { |
|
| 72 | 72 | $this->connected = false; |
| 73 | 73 | mysql_close($this->link); |
| 74 | 74 | unset($this->link); |
@@ -116,8 +116,8 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | $update_cache = false; |
| 118 | 118 | |
| 119 | - if(!empty($this->to_write)) { |
|
| 120 | - foreach($this->to_write as $key => $cork) { |
|
| 119 | + if (!empty($this->to_write)) { |
|
| 120 | + foreach ($this->to_write as $key => $cork) { |
|
| 121 | 121 | $value = is_array($this->data[$key]) ? serialize($this->data[$key]) : $this->data[$key]; // Сериализация для массивов при сохранении в БД |
| 122 | 122 | $this->to_write[$key] = "({$this->user_id}, '" . db_escape($key) . "', '" . db_escape($value) . "')"; |
| 123 | 123 | } |
@@ -128,19 +128,19 @@ discard block |
||
| 128 | 128 | $update_cache = true; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - if(!empty($this->to_delete)) { |
|
| 132 | - foreach($this->to_delete as $key => &$value) { |
|
| 133 | - $value = is_string($key) ? "'". db_escape($key) . "'" : $key; |
|
| 131 | + if (!empty($this->to_delete)) { |
|
| 132 | + foreach ($this->to_delete as $key => &$value) { |
|
| 133 | + $value = is_string($key) ? "'" . db_escape($key) . "'" : $key; |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - doquery("DELETE FROM {{player_options}} WHERE `player_id` = {$this->user_id} AND `option_id` IN (". implode(',', $this->to_delete) . ") "); |
|
| 136 | + doquery("DELETE FROM {{player_options}} WHERE `player_id` = {$this->user_id} AND `option_id` IN (" . implode(',', $this->to_delete) . ") "); |
|
| 137 | 137 | // pdump("DELETE FROM {{player_options}} WHERE `player_id` = {$this->user_id} AND `option_id` IN (". implode(',', $this->to_delete) . ") "); |
| 138 | 138 | |
| 139 | 139 | $this->to_delete = array(); |
| 140 | 140 | $update_cache = true; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - if($update_cache) { |
|
| 143 | + if ($update_cache) { |
|
| 144 | 144 | global $sn_cache; |
| 145 | 145 | |
| 146 | 146 | $field_name = $this->cached_name(); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | protected function load() { |
| 168 | 168 | global $sn_cache; |
| 169 | 169 | |
| 170 | - if($this->loaded) { |
|
| 170 | + if ($this->loaded) { |
|
| 171 | 171 | return; |
| 172 | 172 | } |
| 173 | 173 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $this->to_write = array(); |
| 176 | 176 | $this->to_delete = array(); |
| 177 | 177 | |
| 178 | - if(!$this->user_id) { |
|
| 178 | + if (!$this->user_id) { |
|
| 179 | 179 | $this->loaded = true; |
| 180 | 180 | return; |
| 181 | 181 | } |
@@ -183,13 +183,13 @@ discard block |
||
| 183 | 183 | $field_name = $this->cached_name(); |
| 184 | 184 | $a_data = $sn_cache->$field_name; |
| 185 | 185 | |
| 186 | - if(!empty($a_data)) { |
|
| 186 | + if (!empty($a_data)) { |
|
| 187 | 187 | $this->data = array_replace_recursive($this->data, $a_data); |
| 188 | 188 | return; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | $query = doquery("SELECT * FROM `{{player_options}}` WHERE `player_id` = {$this->user_id} FOR UPDATE"); |
| 192 | - while($row = db_fetch($query)) { |
|
| 192 | + while ($row = db_fetch($query)) { |
|
| 193 | 193 | // $this->data[$row['option_id']] = $row['value']; |
| 194 | 194 | $this->data[$row['option_id']] = is_string($row['value']) && ($temp = unserialize($row['value'])) !== false ? $temp : $row['value']; // Десериализация |
| 195 | 195 | } |
@@ -269,14 +269,14 @@ discard block |
||
| 269 | 269 | // Если в массиве индекса только один элемент - значит это просто индекс |
| 270 | 270 | is_array($option_id) && count($option_id) == 1 ? $option_id = reset($option_id) : false; |
| 271 | 271 | |
| 272 | - if(!isset($this->data[is_array($option_id) ? reset($option_id) : $option_id])) { |
|
| 272 | + if (!isset($this->data[is_array($option_id) ? reset($option_id) : $option_id])) { |
|
| 273 | 273 | $this->load(); |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | - if(is_array($option_id)) { |
|
| 276 | + if (is_array($option_id)) { |
|
| 277 | 277 | $result = $this->data; |
| 278 | - foreach($option_id as $sub_key) { |
|
| 279 | - if(!isset($result) || !isset($result[$sub_key])) { |
|
| 278 | + foreach ($option_id as $sub_key) { |
|
| 279 | + if (!isset($result) || !isset($result[$sub_key])) { |
|
| 280 | 280 | $result = null; |
| 281 | 281 | break; |
| 282 | 282 | } |
@@ -296,12 +296,12 @@ discard block |
||
| 296 | 296 | public function __set($option, $value = null) { |
| 297 | 297 | global $sn_cache; |
| 298 | 298 | |
| 299 | - if(empty($option) || !$this->user_id) { |
|
| 299 | + if (empty($option) || !$this->user_id) { |
|
| 300 | 300 | return; |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | // Если в массиве индекса только один элемент - значит это просто индекс |
| 304 | - if(is_array($option) && count($option) == 1) { |
|
| 304 | + if (is_array($option) && count($option) == 1) { |
|
| 305 | 305 | // Разворачиваем его в индекс |
| 306 | 306 | $option = array(reset($option) => $value); |
| 307 | 307 | unset($value); |
@@ -310,13 +310,13 @@ discard block |
||
| 310 | 310 | |
| 311 | 311 | $to_write = array(); |
| 312 | 312 | // Адресация многомерного массива через массив индексов в $option |
| 313 | - if(is_array($option) && isset($value)) { |
|
| 313 | + if (is_array($option) && isset($value)) { |
|
| 314 | 314 | $a_data = &$this->data; |
| 315 | - foreach($option as $option_id) { |
|
| 315 | + foreach ($option as $option_id) { |
|
| 316 | 316 | !is_array($a_data[$option_id]) ? $a_data[$option_id] = array() : false; |
| 317 | 317 | $a_data = &$a_data[$option_id]; |
| 318 | 318 | } |
| 319 | - if($a_data != $value) { |
|
| 319 | + if ($a_data != $value) { |
|
| 320 | 320 | $a_data = $value; |
| 321 | 321 | $to_write[reset($option)] = null; |
| 322 | 322 | } |
@@ -324,10 +324,10 @@ discard block |
||
| 324 | 324 | // Пакетная запись из массива ключ -> значение |
| 325 | 325 | !is_array($option) ? $option = array($option => $value) : false; |
| 326 | 326 | |
| 327 | - foreach($option as $option_id => $option_value) { |
|
| 328 | - if($this->data[$option_id] !== $option_value) { |
|
| 327 | + foreach ($option as $option_id => $option_value) { |
|
| 328 | + if ($this->data[$option_id] !== $option_value) { |
|
| 329 | 329 | // TODO - вынести отдельно в обработчик |
| 330 | - if($option_id == PLAYER_OPTION_MENU_HIDE_SHOW_BUTTON && $option_value == PLAYER_OPTION_MENU_HIDE_SHOW_BUTTON_HIDDEN) { |
|
| 330 | + if ($option_id == PLAYER_OPTION_MENU_HIDE_SHOW_BUTTON && $option_value == PLAYER_OPTION_MENU_HIDE_SHOW_BUTTON_HIDDEN) { |
|
| 331 | 331 | sn_setcookie(SN_COOKIE . '_menu_hidden', '0', time() - PERIOD_WEEK, SN_ROOT_RELATIVE); |
| 332 | 332 | } |
| 333 | 333 | |
@@ -337,11 +337,11 @@ discard block |
||
| 337 | 337 | } |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | - if(!empty($to_write)) { |
|
| 340 | + if (!empty($to_write)) { |
|
| 341 | 341 | $field_name = $this->cached_name(); |
| 342 | 342 | $sn_cache->$field_name = $this->data; |
| 343 | 343 | |
| 344 | - foreach($to_write as $option_id => &$option_value) { |
|
| 344 | + foreach ($to_write as $option_id => &$option_value) { |
|
| 345 | 345 | $option_value = is_array($this->data[$option_id]) ? serialize($this->data[$option_id]) : $this->data[$option_id]; // Сериализация для массивов при сохранении в БД |
| 346 | 346 | $to_write[$option_id] = "({$this->user_id}, '" . db_escape($option_id) . "', '" . db_escape($option_value) . "')"; |
| 347 | 347 | } |
@@ -353,26 +353,26 @@ discard block |
||
| 353 | 353 | protected function load() { |
| 354 | 354 | global $sn_cache; |
| 355 | 355 | |
| 356 | - if($this->loaded) { |
|
| 356 | + if ($this->loaded) { |
|
| 357 | 357 | return; |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | $this->data = $this->defaults; |
| 361 | 361 | |
| 362 | - if(!$this->user_id) { |
|
| 362 | + if (!$this->user_id) { |
|
| 363 | 363 | return; |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | $field_name = $this->cached_name(); |
| 367 | 367 | $a_data = $sn_cache->$field_name; |
| 368 | 368 | |
| 369 | - if(!empty($a_data)) { |
|
| 369 | + if (!empty($a_data)) { |
|
| 370 | 370 | $this->data = array_replace($this->data, $a_data); |
| 371 | 371 | return; |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | $query = doquery("SELECT * FROM `{{player_options}}` WHERE `player_id` = {$this->user_id} FOR UPDATE"); |
| 375 | - while($row = db_fetch($query)) { |
|
| 375 | + while ($row = db_fetch($query)) { |
|
| 376 | 376 | // $this->data[$row['option_id']] = $row['value']; |
| 377 | 377 | $this->data[$row['option_id']] = is_string($row['value']) && ($temp = unserialize($row['value'])) !== false ? $temp : $row['value']; // Десериализация |
| 378 | 378 | } |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | return $this->__get($offset); |
| 389 | 389 | } |
| 390 | 390 | public function offsetSet($offset, $value) { |
| 391 | - if(!is_null($offset)) { |
|
| 391 | + if (!is_null($offset)) { |
|
| 392 | 392 | // $this->data[$offset] = $value; |
| 393 | 393 | $this->__set($offset, $value); |
| 394 | 394 | } else { |
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | // Re-position template blocks |
| 629 | 629 | for ($i = sizeof($this->_tpldata[$blockname]); $i > $key; $i--) |
| 630 | 630 | { |
| 631 | - $this->_tpldata[$blockname][$i] = $this->_tpldata[$blockname][$i-1]; |
|
| 631 | + $this->_tpldata[$blockname][$i] = $this->_tpldata[$blockname][$i - 1]; |
|
| 632 | 632 | $this->_tpldata[$blockname][$i]['S_ROW_COUNT'] = $i; |
| 633 | 633 | } |
| 634 | 634 | |
@@ -710,13 +710,13 @@ discard block |
||
| 710 | 710 | */ |
| 711 | 711 | function assign_recursive($values, $name = '') |
| 712 | 712 | { |
| 713 | - if(isset($values['.'])) |
|
| 713 | + if (isset($values['.'])) |
|
| 714 | 714 | { |
| 715 | 715 | $values_extra = $values['.']; |
| 716 | 716 | unset($values['.']); |
| 717 | 717 | } |
| 718 | 718 | |
| 719 | - if(!$name) |
|
| 719 | + if (!$name) |
|
| 720 | 720 | { |
| 721 | 721 | $this->assign_vars($values); |
| 722 | 722 | } |
@@ -725,12 +725,12 @@ discard block |
||
| 725 | 725 | $this->assign_block_vars($name, $values); |
| 726 | 726 | } |
| 727 | 727 | |
| 728 | - if(isset($values_extra)) |
|
| 728 | + if (isset($values_extra)) |
|
| 729 | 729 | { |
| 730 | - foreach($values_extra as $sub_array_name => $sub_array) |
|
| 730 | + foreach ($values_extra as $sub_array_name => $sub_array) |
|
| 731 | 731 | { |
| 732 | 732 | $new_name = $name . ($name ? '.' : '') . $sub_array_name; |
| 733 | - foreach($sub_array as $sub_element) |
|
| 733 | + foreach ($sub_array as $sub_element) |
|
| 734 | 734 | { |
| 735 | 735 | $this->assign_recursive($sub_element, $new_name); |
| 736 | 736 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | // OK 4.9 |
| 37 | 37 | public function __construct($filename = __FILE__) { |
| 38 | - if($this->provider_id == ACCOUNT_PROVIDER_NONE) { |
|
| 38 | + if ($this->provider_id == ACCOUNT_PROVIDER_NONE) { |
|
| 39 | 39 | die('У всех провайдеров должен быть $provider_id!'); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | // OK 4.6 |
| 134 | 134 | public function player_name_suggest() { |
| 135 | 135 | $name = ''; |
| 136 | - if(is_object($this->account) && !empty($this->account->account_email)) { |
|
| 136 | + if (is_object($this->account) && !empty($this->account->account_email)) { |
|
| 137 | 137 | list($name) = explode('@', $this->account->account_email); |
| 138 | 138 | } |
| 139 | 139 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | * Инициализация харнилища скинов |
| 153 | 153 | */ |
| 154 | 154 | protected static function init() { |
| 155 | - if(static::$is_init) { |
|
| 155 | + if (static::$is_init) { |
|
| 156 | 156 | return; |
| 157 | 157 | } |
| 158 | 158 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | // Загружены ли уже данные по текущему скину? |
| 167 | 167 | //pdump(static::$skin_list[$ini_path], 'static'); |
| 168 | - if(empty(static::$skin_list[$skin_path])) { |
|
| 168 | + if (empty(static::$skin_list[$skin_path])) { |
|
| 169 | 169 | // Прогружаем текущий скин |
| 170 | 170 | static::$skin_list[$skin_path] = new skin($skin_path); |
| 171 | 171 | static::$active = static::$skin_list[$skin_path]; |
@@ -201,22 +201,22 @@ discard block |
||
| 201 | 201 | |
| 202 | 202 | $this->is_ini_present = false; |
| 203 | 203 | // Проверка на корректность и существование пути |
| 204 | - if(is_file($this->root_physical_absolute . 'skin.ini')) { |
|
| 204 | + if (is_file($this->root_physical_absolute . 'skin.ini')) { |
|
| 205 | 205 | // Пытаемся распарсить файл |
| 206 | 206 | |
| 207 | 207 | // По секциям? images и config? Что бы не копировать конфигурацию? Или просто unset(__inherit) а затем заново записать |
| 208 | 208 | $this->config = parse_ini_file($this->root_physical_absolute . 'skin.ini'); |
| 209 | - if(!empty($this->config)) { |
|
| 209 | + if (!empty($this->config)) { |
|
| 210 | 210 | |
| 211 | 211 | $this->is_ini_present = true; |
| 212 | 212 | |
| 213 | - if(!empty($this->config['_inherit'])) { |
|
| 213 | + if (!empty($this->config['_inherit'])) { |
|
| 214 | 214 | // Если скин наследует себя... |
| 215 | - if($this->config['_inherit'] == $skin_path) { |
|
| 215 | + if ($this->config['_inherit'] == $skin_path) { |
|
| 216 | 216 | // TODO - определять более сложные случаи циклических ссылок в _inherit |
| 217 | 217 | die('">circular skin inheritance!'); |
| 218 | 218 | } |
| 219 | - if(empty(static::$skin_list[$this->config['_inherit']])) { |
|
| 219 | + if (empty(static::$skin_list[$this->config['_inherit']])) { |
|
| 220 | 220 | static::$skin_list[$this->config['_inherit']] = new skin($this->config['_inherit']); |
| 221 | 221 | } |
| 222 | 222 | $this->parent = static::$skin_list[$this->config['_inherit']]; |
@@ -232,12 +232,12 @@ discard block |
||
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | // Пытаемся скомпилировать _no_image заранее |
| 235 | - if(!empty($this->config[SKIN_IMAGE_MISSED_FIELD])) { |
|
| 235 | + if (!empty($this->config[SKIN_IMAGE_MISSED_FIELD])) { |
|
| 236 | 236 | $this->container[SKIN_IMAGE_MISSED_FIELD] = $this->compile_try_path(SKIN_IMAGE_MISSED_FIELD, $this->config[SKIN_IMAGE_MISSED_FIELD]); |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | // Если нет заглушки |
| 240 | - if(empty($this->container[SKIN_IMAGE_MISSED_FIELD])) { |
|
| 240 | + if (empty($this->container[SKIN_IMAGE_MISSED_FIELD])) { |
|
| 241 | 241 | $this->container[SKIN_IMAGE_MISSED_FIELD] = empty($this->parent) |
| 242 | 242 | // Если нет парента - берем хардкод |
| 243 | 243 | ? $this->container[SKIN_IMAGE_MISSED_FIELD] = SN_ROOT_VIRTUAL . SKIN_IMAGE_MISSED_FILE_PATH |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | $image_tag = $this->image_tag_parse($image_tag, $template); |
| 268 | 268 | |
| 269 | 269 | // Проверяем наличие ключа RIT в хранилища. В нём не может быть несуществующих файлов по построению |
| 270 | - if(!empty($this->container[$image_tag[SKIN_IMAGE_TAG_RESOLVED]])) { |
|
| 270 | + if (!empty($this->container[$image_tag[SKIN_IMAGE_TAG_RESOLVED]])) { |
|
| 271 | 271 | return $this->container[$image_tag[SKIN_IMAGE_TAG_RESOLVED]]; |
| 272 | 272 | } |
| 273 | 273 | |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | // Нет - image ID не является путём к файлу. Пора обратиться к предкам за помощью... |
| 286 | 286 | // Пытаемся вытащить путь из родителя и применить к нему свои параметры |
| 287 | 287 | // Тащим по ID изображения, а не по ТЭГУ - мало ли что там делает с путём родитель и как преобразовывает его в строку? |
| 288 | - if(empty($this->container[$image_id]) && !empty($this->parent)) { |
|
| 288 | + if (empty($this->container[$image_id]) && !empty($this->parent)) { |
|
| 289 | 289 | $this->container[$image_id] = $this->parent->compile_image($image_id, $template); |
| 290 | 290 | |
| 291 | 291 | // Если у родителя нет картинки - он вернет пустую строку. Тогда нам надо использовать заглушку - свою или родительскую |
@@ -306,18 +306,18 @@ discard block |
||
| 306 | 306 | protected function image_tag_parse($image_tag, $template) { |
| 307 | 307 | $image_tag_ptl_resolved = $image_tag; |
| 308 | 308 | // Есть переменные из темплейта ? |
| 309 | - if(strpos($image_tag_ptl_resolved, '[') !== false && is_object($template)) { |
|
| 309 | + if (strpos($image_tag_ptl_resolved, '[') !== false && is_object($template)) { |
|
| 310 | 310 | // Что бы лишний раз не запускать регексп |
| 311 | 311 | // TODO - многоуровневые вложения ?! Надо ли и где их можно применить |
| 312 | 312 | preg_match_all('#(\[.+?\])#', $image_tag_ptl_resolved, $matches); |
| 313 | - foreach($matches[0] as &$match) { |
|
| 313 | + foreach ($matches[0] as &$match) { |
|
| 314 | 314 | $var_name = str_replace(array('[', ']'), '', $match); |
| 315 | - if(strpos($var_name, '.') !== false) { |
|
| 315 | + if (strpos($var_name, '.') !== false) { |
|
| 316 | 316 | // Вложенная переменная темплейта - на текущем уровне |
| 317 | 317 | // TODO Вложенная переменная из корня через "!" |
| 318 | 318 | list($block_name, $block_var) = explode('.', $var_name); |
| 319 | 319 | isset($template->_block_value[$block_name][$block_var]) ? $image_tag_ptl_resolved = str_replace($match, $template->_block_value[$block_name][$block_var], $image_tag_ptl_resolved) : false; |
| 320 | - } elseif(strpos($var_name, '$') !== false) { |
|
| 320 | + } elseif (strpos($var_name, '$') !== false) { |
|
| 321 | 321 | // Корневой DEFINE |
| 322 | 322 | $define_name = substr($var_name, 1); |
| 323 | 323 | isset($template->_tpldata['DEFINE']['.'][$define_name]) ? $image_tag_ptl_resolved = str_replace($match, $template->_tpldata['DEFINE']['.'][$define_name], $image_tag_ptl_resolved) : false; |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | } |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | - if(strpos($image_tag_ptl_resolved, '|') !== false) { |
|
| 331 | + if (strpos($image_tag_ptl_resolved, '|') !== false) { |
|
| 332 | 332 | $params = explode('|', $image_tag_ptl_resolved); |
| 333 | 333 | $image_id = $params[0]; |
| 334 | 334 | unset($params[0]); |
@@ -392,11 +392,11 @@ discard block |
||
| 392 | 392 | $image_string = $this->container[$image_tag]; |
| 393 | 393 | |
| 394 | 394 | // Нет параметров - просто возвращаем значение по $image_name из контейнера |
| 395 | - if(!empty($params) && is_array($params)) { |
|
| 395 | + if (!empty($params) && is_array($params)) { |
|
| 396 | 396 | // Здесь автоматически произойдёт упорядочивание параметров |
| 397 | 397 | |
| 398 | 398 | // Параметр 'html' - выводить изображение в виде HTML-тэга |
| 399 | - if(in_array('html', $params)) { |
|
| 399 | + if (in_array('html', $params)) { |
|
| 400 | 400 | $image_tag = $image_tag . '|html'; |
| 401 | 401 | $image_string = '<img src="' . $image_string . '" />'; |
| 402 | 402 | $this->container[$image_tag] = $image_string; |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | // $same_user = false; |
| 54 | 54 | // } |
| 55 | 55 | |
| 56 | - if(!$user_data) { |
|
| 56 | + if (!$user_data) { |
|
| 57 | 57 | message($lang['imp_imperator_none'], $lang['sys_error'], 'index.php', 10); |
| 58 | 58 | die(); |
| 59 | 59 | } |
@@ -64,15 +64,15 @@ discard block |
||
| 64 | 64 | $stat_array = array(); |
| 65 | 65 | $query = doquery("SELECT * FROM {{statpoints}} WHERE `stat_type` = 1 AND `id_owner` = {$user_id} ORDER BY `stat_code` DESC;"); |
| 66 | 66 | $stat_count = classSupernova::$db->db_affected_rows(); |
| 67 | - while($row = db_fetch($query)) { |
|
| 68 | - foreach($stat_fields as $field_db_name => $field_template_name) { |
|
| 67 | + while ($row = db_fetch($query)) { |
|
| 68 | + foreach ($stat_fields as $field_db_name => $field_template_name) { |
|
| 69 | 69 | // $stat_count - $row['stat_code'] - для реверсирования ID статы в JS |
| 70 | 70 | $stat_array[$field_template_name]['DATA'][$stat_count - $row['stat_code']] = $row[$field_db_name]; |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | $stat_array_date = $stat_array['STAT_DATE']; |
| 75 | - foreach($stat_array_date['DATA'] as $key => $value) { |
|
| 75 | + foreach ($stat_array_date['DATA'] as $key => $value) { |
|
| 76 | 76 | $template->assign_block_vars('stat_date', array( |
| 77 | 77 | 'ID' => $key, |
| 78 | 78 | 'VALUE' => $value, |
@@ -85,17 +85,17 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | unset($stat_array['STAT_DATE']); |
| 87 | 87 | $template_data = array(); |
| 88 | - foreach($stat_array as $stat_type => &$stat_type_data) { |
|
| 88 | + foreach ($stat_array as $stat_type => &$stat_type_data) { |
|
| 89 | 89 | $reverse_min_max = strpos($stat_type, '_RANK') !== false; |
| 90 | 90 | $stat_type_data['MIN'] = $reverse_min_max ? max($stat_type_data['DATA']) : min($stat_type_data['DATA']); |
| 91 | 91 | $stat_type_data['MAX'] = $reverse_min_max ? min($stat_type_data['DATA']) : max($stat_type_data['DATA']); |
| 92 | 92 | $stat_type_data['AVG'] = average($stat_type_data['DATA']); |
| 93 | - foreach($stat_type_data['DATA'] as $key => $value) { |
|
| 93 | + foreach ($stat_type_data['DATA'] as $key => $value) { |
|
| 94 | 94 | // $stat_type_data['PERCENT'][$key] = $stat_type_data['MAX'] - $value ? ($stat_type_data['MAX'] - $stat_type_data['MIN']) / ($stat_type_data['MAX'] - $value) : 100; |
| 95 | 95 | $stat_type_data['PERCENT'][$key] = ($stat_type_data['MAX'] - $value ? ($value - $stat_type_data['MIN']) / ($stat_type_data['MAX'] - $stat_type_data['MIN']) : 1) * 100; |
| 96 | 96 | $template_data[$stat_type][$key]['ID'] = $key; |
| 97 | 97 | $template_data[$stat_type][$key]['VALUE'] = $value; |
| 98 | - $template_data[$stat_type][$key]['DELTA'] = ($reverse_min_max ? $stat_type_data['MIN'] - $value : $value - $stat_type_data['MAX']); |
|
| 98 | + $template_data[$stat_type][$key]['DELTA'] = ($reverse_min_max ? $stat_type_data['MIN'] - $value : $value - $stat_type_data['MAX']); |
|
| 99 | 99 | $template_data[$stat_type][$key]['PERCENT'] = $stat_type_data['PERCENT'][$key]; |
| 100 | 100 | |
| 101 | 101 | //$template_data[$stat_type][$key]['PERCENT'] = $key ? $stat_type_data['PERCENT'][$key] : 50; // TODO DEBUG |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | } |
| 104 | 104 | // pdump($stat_array['RES_POINTS']); |
| 105 | 105 | |
| 106 | - foreach($template_data as $stat_type => $stat_type_data) { |
|
| 106 | + foreach ($template_data as $stat_type => $stat_type_data) { |
|
| 107 | 107 | $template->assign_block_vars('stat', array( |
| 108 | 108 | 'TYPE' => $stat_type, |
| 109 | 109 | 'TEXT' => $lang['imp_stat_types'][$stat_type], |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | 'MAX' => $stat_array[$stat_type]['MAX'], |
| 112 | 112 | 'AVG' => $stat_array[$stat_type]['AVG'], |
| 113 | 113 | )); |
| 114 | - foreach($stat_type_data as $stat_entry) { |
|
| 114 | + foreach ($stat_type_data as $stat_entry) { |
|
| 115 | 115 | $template->assign_block_vars('stat.entry', $stat_entry); |
| 116 | 116 | } |
| 117 | 117 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | // pdump($template_data); |
| 121 | 121 | |
| 122 | - if($same_user) { |
|
| 122 | + if ($same_user) { |
|
| 123 | 123 | rpg_level_up($user, RPG_STRUCTURE); |
| 124 | 124 | rpg_level_up($user, RPG_RAID); |
| 125 | 125 | rpg_level_up($user, RPG_TECH); |
@@ -153,29 +153,29 @@ discard block |
||
| 153 | 153 | 'builder_xp' => pretty_number($user_data['xpminier']), |
| 154 | 154 | 'builder_lvl' => pretty_number($user_data['lvl_minier']), |
| 155 | 155 | 'builder_lvl_st' => pretty_number(rpg_get_miner_xp($user_data['lvl_minier'])), |
| 156 | - 'builder_lvl_up' => pretty_number(rpg_get_miner_xp($user_data['lvl_minier']+1)), |
|
| 156 | + 'builder_lvl_up' => pretty_number(rpg_get_miner_xp($user_data['lvl_minier'] + 1)), |
|
| 157 | 157 | 'raid_xp' => pretty_number($user_data['xpraid']), |
| 158 | 158 | 'raid_lvl' => pretty_number($user_data['lvl_raid']), |
| 159 | - 'raid_lvl_up' => pretty_number(rpg_get_raider_xp($user_data['lvl_raid']+1)), |
|
| 159 | + 'raid_lvl_up' => pretty_number(rpg_get_raider_xp($user_data['lvl_raid'] + 1)), |
|
| 160 | 160 | 'raids' => pretty_number($user_data['raids']), |
| 161 | 161 | 'raidswin' => pretty_number($user_data['raidswin']), |
| 162 | 162 | 'raidsloose' => pretty_number($user_data['raidsloose']), |
| 163 | 163 | 'tech_xp' => pretty_number($user_data['player_rpg_tech_xp']), |
| 164 | 164 | 'tech_lvl' => pretty_number($user_data['player_rpg_tech_level']), |
| 165 | 165 | 'tech_lvl_st' => pretty_number(rpg_get_tech_xp($user_data['player_rpg_tech_level'])), |
| 166 | - 'tech_lvl_up' => pretty_number(rpg_get_tech_xp($user_data['player_rpg_tech_level']+1)), |
|
| 166 | + 'tech_lvl_up' => pretty_number(rpg_get_tech_xp($user_data['player_rpg_tech_level'] + 1)), |
|
| 167 | 167 | |
| 168 | 168 | 'explore_xp' => pretty_number($user_data['player_rpg_explore_xp']), |
| 169 | 169 | 'explore_lvl' => pretty_number($user_data['player_rpg_explore_level']), |
| 170 | 170 | 'explore_lvl_st' => pretty_number(rpg_get_explore_xp($user_data['player_rpg_explore_level'])), |
| 171 | - 'explore_lvl_up' => pretty_number(rpg_get_explore_xp($user_data['player_rpg_explore_level']+1)), |
|
| 172 | - |
|
| 173 | - 'build_points' => pretty_number( $StatRecord['build_points'] ), |
|
| 174 | - 'tech_points' => pretty_number( $StatRecord['tech_points'] ), |
|
| 175 | - 'fleet_points' => pretty_number( $StatRecord['fleet_points'] ), |
|
| 176 | - 'defs_points' => pretty_number( $StatRecord['defs_points'] ), |
|
| 177 | - 'res_points' => pretty_number( $StatRecord['res_points'] ), |
|
| 178 | - 'total_points' => pretty_number( $StatRecord['total_points'] ), |
|
| 171 | + 'explore_lvl_up' => pretty_number(rpg_get_explore_xp($user_data['player_rpg_explore_level'] + 1)), |
|
| 172 | + |
|
| 173 | + 'build_points' => pretty_number($StatRecord['build_points']), |
|
| 174 | + 'tech_points' => pretty_number($StatRecord['tech_points']), |
|
| 175 | + 'fleet_points' => pretty_number($StatRecord['fleet_points']), |
|
| 176 | + 'defs_points' => pretty_number($StatRecord['defs_points']), |
|
| 177 | + 'res_points' => pretty_number($StatRecord['res_points']), |
|
| 178 | + 'total_points' => pretty_number($StatRecord['total_points']), |
|
| 179 | 179 | 'user_rank' => $StatRecord['total_rank'], |
| 180 | 180 | 'RANK_DIFF' => $StatRecord['total_old_rank'] - $StatRecord['total_rank'], |
| 181 | 181 | |