@@ -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]; |
@@ -191,9 +191,9 @@ discard block |
||
191 | 191 | strpos($skin_path, 'skins/') !== false ? $skin_path = substr($skin_path, 6) : false; |
192 | 192 | strpos($skin_path, '/') !== false ? $skin_path = str_replace('/', '', $skin_path) : false; |
193 | 193 | |
194 | - $this->root_http_relative = 'skins/' . $skin_path . '/'; // Пока стоит base="" в body SN_ROOT_VIRTUAL - не нужен |
|
194 | + $this->root_http_relative = 'skins/'.$skin_path.'/'; // Пока стоит base="" в body SN_ROOT_VIRTUAL - не нужен |
|
195 | 195 | // $this->root_http = SN_ROOT_VIRTUAL . 'skins/' . $skin_path . '/'; // Всегда абсолютный путь от корня сайта |
196 | - $this->root_physical_absolute = SN_ROOT_PHYSICAL . 'skins/' . $skin_path . '/'; |
|
196 | + $this->root_physical_absolute = SN_ROOT_PHYSICAL.'skins/'.$skin_path.'/'; |
|
197 | 197 | $this->name = $skin_path; |
198 | 198 | // pdump($this->root_folder); |
199 | 199 | // Искать скин среди пользовательских - когда будет конструктор скинов |
@@ -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 | - $this->config = parse_ini_file($this->root_physical_absolute . 'skin.ini'); |
|
209 | - if(!empty($this->config)) { |
|
208 | + $this->config = parse_ini_file($this->root_physical_absolute.'skin.ini'); |
|
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,15 +232,15 @@ 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 | - ? $this->container[SKIN_IMAGE_MISSED_FIELD] = SN_ROOT_VIRTUAL . SKIN_IMAGE_MISSED_FILE_PATH |
|
243 | + ? $this->container[SKIN_IMAGE_MISSED_FIELD] = SN_ROOT_VIRTUAL.SKIN_IMAGE_MISSED_FILE_PATH |
|
244 | 244 | // Если есть парент - берем у парента. У предков всегда всё есть |
245 | 245 | : $this->parent->compile_image(SKIN_IMAGE_MISSED_FIELD, null); |
246 | 246 | } |
@@ -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]); |
@@ -358,9 +358,9 @@ discard block |
||
358 | 358 | protected function compile_try_path($image_id, $file_path) { |
359 | 359 | // Если первый символ пути '/' - значит это путь от HTTP-корня |
360 | 360 | // Откусываем его и пользуем остальное |
361 | - $relative_path = strpos($file_path, '/') !== 0 ? $this->root_http_relative . $file_path : substr($file_path, 1); |
|
361 | + $relative_path = strpos($file_path, '/') !== 0 ? $this->root_http_relative.$file_path : substr($file_path, 1); |
|
362 | 362 | |
363 | - return is_file(SN_ROOT_PHYSICAL . $relative_path) ? $this->container[$image_id] = SN_ROOT_VIRTUAL . $relative_path : ''; |
|
363 | + return is_file(SN_ROOT_PHYSICAL.$relative_path) ? $this->container[$image_id] = SN_ROOT_VIRTUAL.$relative_path : ''; |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | |
@@ -392,13 +392,13 @@ 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)) { |
|
400 | - $image_tag = $image_tag . '|html'; |
|
401 | - $image_string = '<img src="' . $image_string . '" />'; |
|
399 | + if (in_array('html', $params)) { |
|
400 | + $image_tag = $image_tag.'|html'; |
|
401 | + $image_string = '<img src="'.$image_string.'" />'; |
|
402 | 402 | $this->container[$image_tag] = $image_string; |
403 | 403 | } |
404 | 404 | } |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | 'advGoogleLeftMenuCode' => '(Place here code for banner)', |
191 | 191 | |
192 | 192 | // Alliance bonus calculations |
193 | - 'ali_bonus_algorithm' => 0, // Bonus calculation algorithm |
|
193 | + 'ali_bonus_algorithm' => 0, // Bonus calculation algorithm |
|
194 | 194 | 'ali_bonus_brackets' => 10, // Brackets count for ALI_BONUS_BY_RANK |
195 | - 'ali_bonus_brackets_divisor' => 10,// Bonus divisor for ALI_BONUS_BY_RANK |
|
195 | + 'ali_bonus_brackets_divisor' => 10, // Bonus divisor for ALI_BONUS_BY_RANK |
|
196 | 196 | 'ali_bonus_divisor' => 10000000, // Rank divisor for ALI_BONUS_BY_POINTS |
197 | 197 | 'ali_bonus_members' => 10, // Minumum alliace size to start using bonus |
198 | 198 | |
@@ -223,25 +223,25 @@ discard block |
||
223 | 223 | 'deuterium_basic_income' => 0, |
224 | 224 | 'eco_scale_storage' => 1, |
225 | 225 | 'eco_stockman_fleet' => '', // Black Market - Starting amount of s/h ship merchant to sell |
226 | - 'eco_stockman_fleet_populate' => 1, // Populate empty Stockman fleet with ships or not |
|
226 | + 'eco_stockman_fleet_populate' => 1, // Populate empty Stockman fleet with ships or not |
|
227 | 227 | 'empire_mercenary_base_period' => PERIOD_MONTH, // Base |
228 | 228 | 'empire_mercenary_temporary' => 0, // Temporary empire-wide mercenaries |
229 | 229 | 'energy_basic_income' => 0, |
230 | 230 | |
231 | 231 | // Bashing protection settings |
232 | - 'fleet_bashing_attacks' => 3, // Max amount of attack per wave - 3 by default |
|
233 | - 'fleet_bashing_interval' => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default |
|
234 | - 'fleet_bashing_scope' => 86400, // Interval on which bashing waves counts - 24h by default |
|
235 | - 'fleet_bashing_war_delay' => 43200, // Delay before start bashing after declaring war to alliance - 12h by default |
|
236 | - 'fleet_bashing_waves' => 3, // Max amount of waves per day - 3 by default |
|
232 | + 'fleet_bashing_attacks' => 3, // Max amount of attack per wave - 3 by default |
|
233 | + 'fleet_bashing_interval' => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default |
|
234 | + 'fleet_bashing_scope' => 86400, // Interval on which bashing waves counts - 24h by default |
|
235 | + 'fleet_bashing_war_delay' => 43200, // Delay before start bashing after declaring war to alliance - 12h by default |
|
236 | + 'fleet_bashing_waves' => 3, // Max amount of waves per day - 3 by default |
|
237 | 237 | |
238 | 238 | 'Fleet_Cdr' => 30, |
239 | 239 | 'fleet_speed' => 1, |
240 | 240 | |
241 | 241 | 'fleet_update_interval' => 4, |
242 | 242 | |
243 | - 'game_adminEmail' => 'root@localhost', // Admin's email to show to users |
|
244 | - 'game_counter' => 0, // Does built-in page hit counter is on? |
|
243 | + 'game_adminEmail' => 'root@localhost', // Admin's email to show to users |
|
244 | + 'game_counter' => 0, // Does built-in page hit counter is on? |
|
245 | 245 | // Defaults |
246 | 246 | 'game_default_language' => 'ru', |
247 | 247 | 'game_default_skin' => 'skins/EpicBlue/', |
@@ -255,13 +255,13 @@ discard block |
||
255 | 255 | 'game_maxSystem' => 199, |
256 | 256 | 'game_maxPlanet' => 15, |
257 | 257 | // Game global settings |
258 | - 'game_mode' => 0, // 0 - SuperNova, 1 - oGame |
|
258 | + 'game_mode' => 0, // 0 - SuperNova, 1 - oGame |
|
259 | 259 | 'game_name' => 'SuperNova', // Server name (would be on banners and on top of left menu) |
260 | 260 | |
261 | 261 | 'game_news_actual' => 259200, // How long announcement would be marked as "New". In seconds. Default - 3 days |
262 | - 'game_news_overview' => 3, // How much last news to show in Overview page |
|
262 | + 'game_news_overview' => 3, // How much last news to show in Overview page |
|
263 | 263 | // Noob protection |
264 | - 'game_noob_factor' => 5, // Multiplier to divide "stronger" and "weaker" users |
|
264 | + 'game_noob_factor' => 5, // Multiplier to divide "stronger" and "weaker" users |
|
265 | 265 | 'game_noob_points' => 5000, // Below this point user threated as noob. 0 to disable |
266 | 266 | |
267 | 267 | 'game_multiaccount_enabled' => 0, // 1 - allow interactions for players with same IP (multiaccounts) |
@@ -311,8 +311,8 @@ discard block |
||
311 | 311 | 'payment_currency_exchange_wmu' => 30, |
312 | 312 | 'payment_currency_exchange_wmz' => 1, |
313 | 313 | |
314 | - 'payment_lot_price' => 1, // Lot price in default currency |
|
315 | - 'payment_lot_size' => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction |
|
314 | + 'payment_lot_price' => 1, // Lot price in default currency |
|
315 | + 'payment_lot_size' => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction |
|
316 | 316 | |
317 | 317 | 'planet_teleport_cost' => 50000, // |
318 | 318 | 'planet_teleport_timeout' => 86400, // |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | 'resource_multiplier' => 1, |
331 | 331 | |
332 | 332 | //Roleplay system |
333 | - 'rpg_bonus_divisor' => 10, // Amount of DM referral shoud get for partner have 1 DM bonus |
|
333 | + 'rpg_bonus_divisor' => 10, // Amount of DM referral shoud get for partner have 1 DM bonus |
|
334 | 334 | 'rpg_bonus_minimum' => 10000, // Minimum DM ammount for starting paying bonuses to affiliate |
335 | 335 | |
336 | 336 | // Black Market - General |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public static function _init($group_name = '') { |
27 | 27 | parent::_init($group_name); |
28 | 28 | |
29 | - foreach(static::$_group_unit_id_list as $resource_id) { |
|
29 | + foreach (static::$_group_unit_id_list as $resource_id) { |
|
30 | 30 | static::$_group_pnames[$resource_id] = pname_resource_name($resource_id); |
31 | 31 | } |
32 | 32 | |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | |
49 | 49 | !is_array($resource_array) ? $resource_array = array() : false; |
50 | 50 | |
51 | - foreach($resource_array as $resource_id => $resource_actual_delta) { |
|
52 | - if(!$resource_actual_delta) { |
|
51 | + foreach ($resource_array as $resource_id => $resource_actual_delta) { |
|
52 | + if (!$resource_actual_delta) { |
|
53 | 53 | // No delta - no changes |
54 | 54 | continue; |
55 | 55 | } |
56 | 56 | |
57 | - $result[$prefix . static::$_group_pnames[$resource_id]] = $resource_actual_delta; |
|
57 | + $result[$prefix.static::$_group_pnames[$resource_id]] = $resource_actual_delta; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | return $result; |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | public function __set($name, $value) { |
97 | 97 | switch (self::$mode) { |
98 | 98 | case CACHER_NO_CACHE: |
99 | - self::$data[$this->prefix . $name] = $value; |
|
99 | + self::$data[$this->prefix.$name] = $value; |
|
100 | 100 | break; |
101 | 101 | |
102 | 102 | case CACHER_XCACHE: |
103 | - xcache_set($this->prefix . $name, $value); |
|
103 | + xcache_set($this->prefix.$name, $value); |
|
104 | 104 | break; |
105 | 105 | } |
106 | 106 | } |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | public function __get($name) { |
109 | 109 | switch (self::$mode) { |
110 | 110 | case CACHER_NO_CACHE: |
111 | - return self::$data[$this->prefix . $name]; |
|
111 | + return self::$data[$this->prefix.$name]; |
|
112 | 112 | break; |
113 | 113 | |
114 | 114 | case CACHER_XCACHE: |
115 | - return xcache_get($this->prefix . $name); |
|
115 | + return xcache_get($this->prefix.$name); |
|
116 | 116 | break; |
117 | 117 | } |
118 | 118 | |
@@ -122,11 +122,11 @@ discard block |
||
122 | 122 | public function __isset($name) { |
123 | 123 | switch (self::$mode) { |
124 | 124 | case CACHER_NO_CACHE: |
125 | - return isset(self::$data[$this->prefix . $name]); |
|
125 | + return isset(self::$data[$this->prefix.$name]); |
|
126 | 126 | break; |
127 | 127 | |
128 | 128 | case CACHER_XCACHE: |
129 | - return xcache_isset($this->prefix . $name) && ($this->__get($name) !== null); |
|
129 | + return xcache_isset($this->prefix.$name) && ($this->__get($name) !== null); |
|
130 | 130 | break; |
131 | 131 | } |
132 | 132 | |
@@ -136,25 +136,25 @@ discard block |
||
136 | 136 | public function __unset($name) { |
137 | 137 | switch (self::$mode) { |
138 | 138 | case CACHER_NO_CACHE: |
139 | - unset(self::$data[$this->prefix . $name]); |
|
139 | + unset(self::$data[$this->prefix.$name]); |
|
140 | 140 | break; |
141 | 141 | |
142 | 142 | case CACHER_XCACHE: |
143 | - xcache_unset($this->prefix . $name); |
|
143 | + xcache_unset($this->prefix.$name); |
|
144 | 144 | break; |
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
148 | 148 | public function unset_by_prefix($prefix_unset = '') { |
149 | 149 | static $array_clear; |
150 | - !$array_clear ? $array_clear = function (&$v, $k, $p) { |
|
150 | + !$array_clear ? $array_clear = function(&$v, $k, $p) { |
|
151 | 151 | strpos($k, $p) === 0 ? $v = null : false; |
152 | 152 | } : false; |
153 | 153 | |
154 | 154 | switch (self::$mode) { |
155 | 155 | case CACHER_NO_CACHE: |
156 | 156 | // array_walk(self::$data, create_function('&$v,$k,$p', 'if(strpos($k, $p) === 0)$v = NULL;'), $this->prefix.$prefix_unset); |
157 | - array_walk(self::$data, $array_clear, $this->prefix . $prefix_unset); |
|
157 | + array_walk(self::$data, $array_clear, $this->prefix.$prefix_unset); |
|
158 | 158 | |
159 | 159 | return true; |
160 | 160 | break; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | return false; |
165 | 165 | } |
166 | 166 | |
167 | - return xcache_unset_by_prefix($this->prefix . $prefix_unset); |
|
167 | + return xcache_unset_by_prefix($this->prefix.$prefix_unset); |
|
168 | 168 | break; |
169 | 169 | } |
170 | 170 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | if ($this->$name[0] === null) { |
203 | 203 | for ($i = count($name) - 1; $i > 0; $i--) { |
204 | 204 | $cName = "{$name[$i]}_COUNT"; |
205 | - $cName1 = "{$name[$i-1]}_COUNT"; |
|
205 | + $cName1 = "{$name[$i - 1]}_COUNT"; |
|
206 | 206 | if ($this->$cName1 == null || $i == 1) { |
207 | 207 | $this->$cName++; |
208 | 208 | } |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | |
248 | 248 | for ($i = 1; $i < count($name); $i++) { |
249 | 249 | $cName = "{$name[$i]}_COUNT"; |
250 | - $cName1 = "{$name[$i-1]}_COUNT"; |
|
250 | + $cName1 = "{$name[$i - 1]}_COUNT"; |
|
251 | 251 | |
252 | 252 | if ($i == 1 || $this->$cName1 === null) { |
253 | 253 | $this->$cName--; |
@@ -112,7 +112,7 @@ |
||
112 | 112 | public static function init_3_load_config_file() { |
113 | 113 | $dbsettings = array(); |
114 | 114 | |
115 | - require(SN_ROOT_PHYSICAL . "config" . DOT_PHP_EX); |
|
115 | + require(SN_ROOT_PHYSICAL."config".DOT_PHP_EX); |
|
116 | 116 | self::$cache_prefix = !empty($dbsettings['cache_prefix']) ? $dbsettings['cache_prefix'] : $dbsettings['prefix']; |
117 | 117 | self::$db_name = $dbsettings['name']; |
118 | 118 | self::$sn_secret_word = $dbsettings['secretword']; |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | |
80 | 80 | protected function checkPropertyExists($name) { |
81 | 81 | if (!array_key_exists($name, $this->_properties)) { |
82 | - throw new ExceptionPropertyNotExists('Property [' . get_called_class() . '::' . $name . '] not exists', ERR_ERROR); |
|
82 | + throw new ExceptionPropertyNotExists('Property ['.get_called_class().'::'.$name.'] not exists', ERR_ERROR); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | 86 | protected function checkOverwriteAdjusted($name) { |
87 | 87 | if (array_key_exists($name, $this->propertiesAdjusted)) { |
88 | - throw new ExceptionPropertyAccess('Property [' . get_called_class() . '::' . $name . '] already was adjusted so no SET is possible until dbSave', ERR_ERROR); |
|
88 | + throw new ExceptionPropertyAccess('Property ['.get_called_class().'::'.$name.'] already was adjusted so no SET is possible until dbSave', ERR_ERROR); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @return boolean |
135 | 135 | */ |
136 | 136 | public function isContainerEmpty() { |
137 | - throw new Exception('PropertyHider::isContainerEmpty() is not implemented. You should implement it in class ' . get_called_class()); |
|
137 | + throw new Exception('PropertyHider::isContainerEmpty() is not implemented. You should implement it in class '.get_called_class()); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | |
@@ -178,15 +178,15 @@ discard block |
||
178 | 178 | $result = null; |
179 | 179 | // Now deciding - will we call a protected setter or will we work with protected property |
180 | 180 | // Todo - on init recalc all method_exists |
181 | - if (method_exists($this, $methodName = $action . ucfirst($name))) { |
|
181 | + if (method_exists($this, $methodName = $action.ucfirst($name))) { |
|
182 | 182 | // If method exists - just calling it |
183 | 183 | // TODO - should return TRUE if value changed or FALSE otherwise |
184 | 184 | $result = call_user_func_array(array($this, $methodName), array($value)); |
185 | 185 | } elseif ($this->isPropertyActionAvailable($name, $action)) { |
186 | 186 | // No setter exists - works directly with protected property |
187 | - $result = $this->{$action . 'Property'}($name, $value); |
|
187 | + $result = $this->{$action.'Property'}($name, $value); |
|
188 | 188 | } else { |
189 | - throw new ExceptionPropertyNotExists('Property [' . get_called_class() . '::' . $name . '] does not have ' . $action . 'ter/property to ' . $action, ERR_ERROR); |
|
189 | + throw new ExceptionPropertyNotExists('Property ['.get_called_class().'::'.$name.'] does not have '.$action.'ter/property to '.$action, ERR_ERROR); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | return $result; |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * @return string |
278 | 278 | */ |
279 | 279 | protected function adjustPropertyString($name, $diff) { |
280 | - return (string)$this->$name . (string)$diff; |
|
280 | + return (string) $this->$name.(string) $diff; |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
@@ -287,8 +287,8 @@ discard block |
||
287 | 287 | * @return array |
288 | 288 | */ |
289 | 289 | protected function adjustPropertyArray($name, $diff) { |
290 | - $copy = (array)$this->$name; |
|
291 | - HelperArray::merge($copy, (array)$diff, HelperArray::MERGE_PHP); |
|
290 | + $copy = (array) $this->$name; |
|
291 | + HelperArray::merge($copy, (array) $diff, HelperArray::MERGE_PHP); |
|
292 | 292 | |
293 | 293 | return $copy; |
294 | 294 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * @return int |
301 | 301 | */ |
302 | 302 | protected function deltaInteger($name, $diff) { |
303 | - return (int)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0) + (int)$diff; |
|
303 | + return (int) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0) + (int) $diff; |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | /** |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | * @return float |
311 | 311 | */ |
312 | 312 | protected function deltaDouble($name, $diff) { |
313 | - return (float)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0.0) + (float)$diff; |
|
313 | + return (float) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0.0) + (float) $diff; |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | /** |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | * @return string |
321 | 321 | */ |
322 | 322 | protected function deltaString($name, $diff) { |
323 | - return (string)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, '') . (string)$diff; |
|
323 | + return (string) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, '').(string) $diff; |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | /** |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | * @return array |
331 | 331 | */ |
332 | 332 | protected function deltaArray($name, $diff) { |
333 | - $copy = (array)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, array()); |
|
333 | + $copy = (array) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, array()); |
|
334 | 334 | HelperArray::merge($copy, $diff, HelperArray::MERGE_PHP); |
335 | 335 | |
336 | 336 | return $copy; |
@@ -353,10 +353,10 @@ discard block |
||
353 | 353 | // Capitalizing type name |
354 | 354 | $methodName = explode(' ', $type); |
355 | 355 | array_walk($methodName, 'DbSqlHelper::UCFirstByRef'); |
356 | - $methodName = $prefix . implode('', $methodName); |
|
356 | + $methodName = $prefix.implode('', $methodName); |
|
357 | 357 | |
358 | 358 | if (!method_exists($this, $methodName)) { |
359 | - throw new ExceptionTypeUnsupported('Type "' . $type . '" is unsupported in PropertyHider::propertyMethodResult'); |
|
359 | + throw new ExceptionTypeUnsupported('Type "'.$type.'" is unsupported in PropertyHider::propertyMethodResult'); |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | return call_user_func(array($this, $methodName), $name, $diff); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function offsetSet($offset, $value) { |
91 | 91 | if (isset($this->mapUnitIdToDb[$value->unitId])) { |
92 | - classSupernova::$debug->error('UnitList::offsetSet: Unit with UnitId ' . $value->unitId . ' already exists'); |
|
92 | + classSupernova::$debug->error('UnitList::offsetSet: Unit with UnitId '.$value->unitId.' already exists'); |
|
93 | 93 | } |
94 | 94 | $this->mapUnitIdToDb[$value->unitId] = $value; |
95 | 95 | parent::offsetSet($offset, $value); |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | |
203 | 203 | public function unitGetCount($unit_id) { |
204 | 204 | if (empty($this->mapUnitIdToDb[$unit_id])) { |
205 | - throw new Exception('Unit [' . $unit_id . '] is not exists in UnitList'); |
|
205 | + throw new Exception('Unit ['.$unit_id.'] is not exists in UnitList'); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | return $this->mapUnitIdToDb[$unit_id]->count; |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public function unitsCostInMetal($shipCostInMetalPerPiece) { |
249 | 249 | $shipsCostInMetal = array(); |
250 | - foreach($this->mapUnitIdToDb as $ship_id => $ship) { |
|
250 | + foreach ($this->mapUnitIdToDb as $ship_id => $ship) { |
|
251 | 251 | $shipsCostInMetal[$ship_id] = $ship->count * $shipCostInMetalPerPiece[$ship_id]; |
252 | 252 | } |
253 | 253 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | */ |
330 | 330 | $objFleet = $this->getLocatedAt(); |
331 | 331 | if (empty($objFleet)) { |
332 | - throw new Exception('No fleet owner on UnitList::unitsRender() in ' . __FILE__ . '@' . __LINE__); |
|
332 | + throw new Exception('No fleet owner on UnitList::unitsRender() in '.__FILE__.'@'.__LINE__); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | $tplShips = array(); |
@@ -472,8 +472,8 @@ discard block |
||
472 | 472 | |
473 | 473 | // TODO - DEBUG - REMOVE ============================================================================================= |
474 | 474 | public function _dump() { |
475 | - print(__FILE__ . ':' . __LINE__ . "<br />"); |
|
476 | - print("Located at " . $this->getLocationDbId() . " type " . $this->getLocationType() . "<br />"); |
|
475 | + print(__FILE__.':'.__LINE__."<br />"); |
|
476 | + print("Located at ".$this->getLocationDbId()." type ".$this->getLocationType()."<br />"); |
|
477 | 477 | |
478 | 478 | print('<table border="1">'); |
479 | 479 | print('<tr>'); |
@@ -529,11 +529,11 @@ discard block |
||
529 | 529 | |
530 | 530 | print('<td>'); |
531 | 531 | $type = $unit->getType(); |
532 | - print("[{$type}] " . classLocale::$lang['tech'][$type]); |
|
532 | + print("[{$type}] ".classLocale::$lang['tech'][$type]); |
|
533 | 533 | print('</td>'); |
534 | 534 | |
535 | 535 | print('<td>'); |
536 | - print("[{$unit->unitId}] " . classLocale::$lang['tech'][$unit->unitId]); |
|
536 | + print("[{$unit->unitId}] ".classLocale::$lang['tech'][$unit->unitId]); |
|
537 | 537 | print('</td>'); |
538 | 538 | |
539 | 539 | print('<td>'); |
@@ -193,13 +193,13 @@ discard block |
||
193 | 193 | */ |
194 | 194 | // TODO - Change $filter to only array class |
195 | 195 | public function db_get_record_list($location_type, $filter = '', $fetch = false, $no_return = false) { |
196 | - if(is_array($filter)) { |
|
196 | + if (is_array($filter)) { |
|
197 | 197 | // TODO - TEMPORARY |
198 | 198 | $filterString = array(); |
199 | - if(!empty($filter)) { |
|
199 | + if (!empty($filter)) { |
|
200 | 200 | foreach ($filter as $key => $value) { |
201 | - if(!is_int($key)) { |
|
202 | - $value = "`$key` = '" . $this->db->db_escape($value). "'"; |
|
201 | + if (!is_int($key)) { |
|
202 | + $value = "`$key` = '".$this->db->db_escape($value)."'"; |
|
203 | 203 | } |
204 | 204 | $filterString[$key] = $value; |
205 | 205 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | |
208 | 208 | $filterString = implode(',', $filterString); |
209 | 209 | } else { |
210 | - $filterString = $filter; |
|
210 | + $filterString = $filter; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | |
@@ -238,8 +238,8 @@ discard block |
||
238 | 238 | $query = $this->db->doSelect( |
239 | 239 | "SELECT |
240 | 240 | distinct({{{$location_info[P_TABLE_NAME]}}}.{$owner_data[P_OWNER_FIELD]}) AS parent_id |
241 | - FROM {{{$location_info[P_TABLE_NAME]}}}" . |
|
242 | - ($filter ? ' WHERE ' . $filter : '') . |
|
241 | + FROM {{{$location_info[P_TABLE_NAME]}}}". |
|
242 | + ($filter ? ' WHERE '.$filter : ''). |
|
243 | 243 | ($fetch ? ' LIMIT 1' : '')); |
244 | 244 | } |
245 | 245 | while ($row = db_fetch($query)) { |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | $indexes_str = implode(',', $parent_id_list); |
255 | 255 | $parent_id_field = static::$location_info[$owner_location_type][P_ID]; |
256 | 256 | $this->db_get_record_list($owner_location_type, |
257 | - $parent_id_field . ( |
|
257 | + $parent_id_field.( |
|
258 | 258 | count($parent_id_list) > 1 |
259 | 259 | ? " IN ({$indexes_str})" |
260 | 260 | : " = {$indexes_str}" |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | ); |
278 | 278 | } else { |
279 | 279 | $query = $this->db->doSelect( |
280 | - "SELECT * FROM {{{$location_info[P_TABLE_NAME]}}}" . |
|
280 | + "SELECT * FROM {{{$location_info[P_TABLE_NAME]}}}". |
|
281 | 281 | (($filter = trim($filter)) ? " WHERE {$filter}" : '') |
282 | 282 | . " FOR UPDATE" |
283 | 283 | ); |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | public function db_lock_tables($tables) { |
456 | 456 | $tables = is_array($tables) ? $tables : array($tables => ''); |
457 | 457 | foreach ($tables as $table_name => $condition) { |
458 | - $this->db->doSelect("SELECT 1 FROM {{{$table_name}}}" . ($condition ? ' WHERE ' . $condition : '')); |
|
458 | + $this->db->doSelect("SELECT 1 FROM {{{$table_name}}}".($condition ? ' WHERE '.$condition : '')); |
|
459 | 459 | } |
460 | 460 | } |
461 | 461 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Защита от двойного инита |
4 | -if(defined('INIT')) { |
|
4 | +if (defined('INIT')) { |
|
5 | 5 | return; |
6 | 6 | } |
7 | 7 | |
@@ -19,22 +19,22 @@ discard block |
||
19 | 19 | define('SN_DEBUG_PDUMP_CALLER', true); |
20 | 20 | |
21 | 21 | // Бенчмарк |
22 | -register_shutdown_function(function () { |
|
23 | - if(defined('IN_AJAX')) { |
|
22 | +register_shutdown_function(function() { |
|
23 | + if (defined('IN_AJAX')) { |
|
24 | 24 | return; |
25 | 25 | } |
26 | 26 | |
27 | 27 | global $user, $locale_cache_statistic; |
28 | 28 | |
29 | - print('<hr><div class="benchmark">Benchmark ' . (microtime(true) - SN_TIME_MICRO) . 's, memory: ' . number_format(memory_get_usage() - SN_MEM_START) . |
|
30 | - (!empty($locale_cache_statistic['misses']) ? ', LOCALE MISSED' : '') . |
|
31 | - (class_exists('classSupernova') && is_object(classSupernova::$db) ? ', DB time: ' . classSupernova::$db->time_mysql_total . 'ms' : '') . |
|
29 | + print('<hr><div class="benchmark">Benchmark '.(microtime(true) - SN_TIME_MICRO).'s, memory: '.number_format(memory_get_usage() - SN_MEM_START). |
|
30 | + (!empty($locale_cache_statistic['misses']) ? ', LOCALE MISSED' : ''). |
|
31 | + (class_exists('classSupernova') && is_object(classSupernova::$db) ? ', DB time: '.classSupernova::$db->time_mysql_total.'ms' : ''). |
|
32 | 32 | '</div>'); |
33 | - if($user['authlevel'] >= 2 && file_exists(SN_ROOT_PHYSICAL . 'badqrys.txt') && @filesize(SN_ROOT_PHYSICAL . 'badqrys.txt') > 0) { |
|
33 | + if ($user['authlevel'] >= 2 && file_exists(SN_ROOT_PHYSICAL.'badqrys.txt') && @filesize(SN_ROOT_PHYSICAL.'badqrys.txt') > 0) { |
|
34 | 34 | echo '<a href="badqrys.txt" target="_blank" style="color:red">', 'HACK ALERT!', '</a>'; |
35 | 35 | } |
36 | 36 | |
37 | - if(!empty($locale_cache_statistic['misses'])) { |
|
37 | + if (!empty($locale_cache_statistic['misses'])) { |
|
38 | 38 | print('<!--'); |
39 | 39 | pdump($locale_cache_statistic); |
40 | 40 | print('-->'); |
@@ -54,46 +54,46 @@ discard block |
||
54 | 54 | |
55 | 55 | define('SN_TIME_NOW_GMT_STRING', gmdate(DATE_ATOM, SN_TIME_NOW)); |
56 | 56 | |
57 | -if(strpos(strtolower($_SERVER['SERVER_NAME']), 'google.') !== false) { |
|
57 | +if (strpos(strtolower($_SERVER['SERVER_NAME']), 'google.') !== false) { |
|
58 | 58 | define('SN_GOOGLE', true); |
59 | 59 | } |
60 | 60 | |
61 | 61 | // Эти три строки должны быть В ЭТОМ ФАЙЛЕ, ПО ЭТОМУ ПУТИ и ПЕРЕД ЭТИМ ИНКЛЮДОМ!!! |
62 | -define('SN_ROOT_PHYSICAL', str_replace(array('\\', '//'), '/', dirname(__DIR__) . '/')); |
|
62 | +define('SN_ROOT_PHYSICAL', str_replace(array('\\', '//'), '/', dirname(__DIR__).'/')); |
|
63 | 63 | define('SN_ROOT_PHYSICAL_STR_LEN', strlen(SN_ROOT_PHYSICAL)); |
64 | 64 | $phpbb_root_path = SN_ROOT_PHYSICAL; // Это нужно для работы PTL |
65 | 65 | |
66 | -$sn_root_relative = str_replace(array('\\', '//'), '/', getcwd() . '/'); |
|
66 | +$sn_root_relative = str_replace(array('\\', '//'), '/', getcwd().'/'); |
|
67 | 67 | //$sn_root_relative .= $sn_root_relative[strlen($sn_root_relative) - 1] == '/' ? '' : '/'; |
68 | 68 | $sn_root_relative = str_replace(SN_ROOT_PHYSICAL, '', $sn_root_relative); |
69 | 69 | $sn_root_relative .= basename($_SERVER['SCRIPT_NAME']); |
70 | 70 | $sn_root_relative = str_replace($sn_root_relative, '', $_SERVER['SCRIPT_NAME']); |
71 | 71 | define('SN_ROOT_RELATIVE', $sn_root_relative); |
72 | 72 | |
73 | -define('SN_ROOT_VIRTUAL', 'http' . (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . SN_ROOT_RELATIVE); |
|
73 | +define('SN_ROOT_VIRTUAL', 'http'.(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '').'://'.$_SERVER['HTTP_HOST'].SN_ROOT_RELATIVE); |
|
74 | 74 | define('SN_ROOT_VIRTUAL_PARENT', str_replace('//google.', '//', SN_ROOT_VIRTUAL)); |
75 | 75 | |
76 | 76 | $phpEx = strpos($phpEx = substr(strrchr(__FILE__, '.'), 1), '/') === false ? $phpEx : ''; |
77 | -define('DOT_PHP_EX', '.' . $phpEx); // PHP extension on this server |
|
77 | +define('DOT_PHP_EX', '.'.$phpEx); // PHP extension on this server |
|
78 | 78 | |
79 | 79 | |
80 | 80 | header('Content-type: text/html; charset=utf-8'); |
81 | 81 | ob_start(); |
82 | 82 | ini_set('error_reporting', E_ALL ^ E_NOTICE); |
83 | 83 | |
84 | -empty($classRoot) ? $classRoot = SN_ROOT_PHYSICAL . 'classes/' : false; |
|
85 | -spl_autoload_register(function ($class) use ($classRoot) { |
|
84 | +empty($classRoot) ? $classRoot = SN_ROOT_PHYSICAL.'classes/' : false; |
|
85 | +spl_autoload_register(function($class) use ($classRoot) { |
|
86 | 86 | $class = str_replace('\\', '/', $class); |
87 | - if (file_exists($classRoot . $class . '.php')) { |
|
88 | - require_once $classRoot . $class . '.php'; |
|
89 | - } elseif (file_exists($classRoot . 'UBE/' . $class . '.php')) { |
|
90 | - require_once $classRoot . 'UBE/' . $class . '.php'; |
|
87 | + if (file_exists($classRoot.$class.'.php')) { |
|
88 | + require_once $classRoot.$class.'.php'; |
|
89 | + } elseif (file_exists($classRoot.'UBE/'.$class.'.php')) { |
|
90 | + require_once $classRoot.'UBE/'.$class.'.php'; |
|
91 | 91 | } |
92 | 92 | }); |
93 | 93 | |
94 | 94 | require_once 'constants.php'; |
95 | -require_once SN_ROOT_PHYSICAL . "includes/db" . DOT_PHP_EX; |
|
96 | -require_once(SN_ROOT_PHYSICAL . "includes/init/init_functions" . DOT_PHP_EX); |
|
95 | +require_once SN_ROOT_PHYSICAL."includes/db".DOT_PHP_EX; |
|
96 | +require_once(SN_ROOT_PHYSICAL."includes/init/init_functions".DOT_PHP_EX); |
|
97 | 97 | |
98 | 98 | /** |
99 | 99 | * @var classConfig $config |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | // define('BE_DEBUG', true); // Отладка боевого движка |
112 | 112 | classSupernova::init_debug_state(); |
113 | 113 | |
114 | -require_once(SN_ROOT_PHYSICAL . "includes/vars/vars" . DOT_PHP_EX); |
|
115 | -require_once(SN_ROOT_PHYSICAL . "includes/general" . DOT_PHP_EX); |
|
114 | +require_once(SN_ROOT_PHYSICAL."includes/vars/vars".DOT_PHP_EX); |
|
115 | +require_once(SN_ROOT_PHYSICAL."includes/general".DOT_PHP_EX); |
|
116 | 116 | |
117 | 117 | init_update(); |
118 | 118 | |
@@ -121,28 +121,28 @@ discard block |
||
121 | 121 | ? trim(strip_tags($_GET['page'])) |
122 | 122 | : str_replace(DOT_PHP_EX, '', str_replace(SN_ROOT_RELATIVE, '', str_replace('\\', '/', $_SERVER['SCRIPT_NAME']))); |
123 | 123 | define('INITIAL_PAGE', $sn_page_name_original); |
124 | -define('SN_COOKIE', (classSupernova::$config->COOKIE_NAME ? classSupernova::$config->COOKIE_NAME : 'SuperNova') . (defined('SN_GOOGLE') ? '_G' : '')); |
|
125 | -define('SN_COOKIE_I', SN_COOKIE . AUTH_COOKIE_IMPERSONATE_SUFFIX); |
|
126 | -define('SN_COOKIE_D', SN_COOKIE . '_D'); |
|
127 | -define('SN_COOKIE_T', SN_COOKIE . '_T'); // Time measure cookie |
|
128 | -define('SN_COOKIE_F', SN_COOKIE . '_F'); // Font size cookie |
|
129 | -define('SN_COOKIE_U', SN_COOKIE . '_U'); // Current user cookie aka user ID |
|
130 | -define('SN_COOKIE_U_I', SN_COOKIE_U . AUTH_COOKIE_IMPERSONATE_SUFFIX); // Current impersonator user cookie aka impersonator user ID |
|
124 | +define('SN_COOKIE', (classSupernova::$config->COOKIE_NAME ? classSupernova::$config->COOKIE_NAME : 'SuperNova').(defined('SN_GOOGLE') ? '_G' : '')); |
|
125 | +define('SN_COOKIE_I', SN_COOKIE.AUTH_COOKIE_IMPERSONATE_SUFFIX); |
|
126 | +define('SN_COOKIE_D', SN_COOKIE.'_D'); |
|
127 | +define('SN_COOKIE_T', SN_COOKIE.'_T'); // Time measure cookie |
|
128 | +define('SN_COOKIE_F', SN_COOKIE.'_F'); // Font size cookie |
|
129 | +define('SN_COOKIE_U', SN_COOKIE.'_U'); // Current user cookie aka user ID |
|
130 | +define('SN_COOKIE_U_I', SN_COOKIE_U.AUTH_COOKIE_IMPERSONATE_SUFFIX); // Current impersonator user cookie aka impersonator user ID |
|
131 | 131 | define('TEMPLATE_NAME', classSupernova::$config->game_default_template ? classSupernova::$config->game_default_template : 'OpenGame'); |
132 | -define('TEMPLATE_PATH', 'design/templates/' . TEMPLATE_NAME); |
|
133 | -define('TEMPLATE_DIR', SN_ROOT_PHYSICAL . TEMPLATE_PATH); |
|
132 | +define('TEMPLATE_PATH', 'design/templates/'.TEMPLATE_NAME); |
|
133 | +define('TEMPLATE_DIR', SN_ROOT_PHYSICAL.TEMPLATE_PATH); |
|
134 | 134 | define('DEFAULT_SKINPATH', classSupernova::$config->game_default_skin ? classSupernova::$config->game_default_skin : 'skins/EpicBlue/'); |
135 | 135 | define('DEFAULT_LANG', classSupernova::$config->game_default_language ? classSupernova::$config->game_default_language : 'ru'); |
136 | 136 | define('FMT_DATE', classSupernova::$config->int_format_date ? classSupernova::$config->int_format_date : 'd.m.Y'); |
137 | 137 | define('FMT_TIME', classSupernova::$config->int_format_time ? classSupernova::$config->int_format_time : 'H:i:s'); |
138 | -define('FMT_DATE_TIME', FMT_DATE . ' ' . FMT_TIME); |
|
138 | +define('FMT_DATE_TIME', FMT_DATE.' '.FMT_TIME); |
|
139 | 139 | |
140 | 140 | $HTTP_ACCEPT_LANGUAGE = DEFAULT_LANG; |
141 | 141 | |
142 | -require_once(SN_ROOT_PHYSICAL . "includes/template" . DOT_PHP_EX); |
|
142 | +require_once(SN_ROOT_PHYSICAL."includes/template".DOT_PHP_EX); |
|
143 | 143 | $template_result = array('.' => array('result' => array())); |
144 | 144 | |
145 | -sn_sys_load_php_files(SN_ROOT_PHYSICAL . "includes/functions/", DOT_PHP_EX); |
|
145 | +sn_sys_load_php_files(SN_ROOT_PHYSICAL."includes/functions/", DOT_PHP_EX); |
|
146 | 146 | |
147 | 147 | |
148 | 148 | // Подключаем все модули |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | // Конфиг - часть манифеста? |
153 | 153 | classSupernova::$auth = new core_auth(); |
154 | 154 | |
155 | -sn_sys_load_php_files(SN_ROOT_PHYSICAL . "modules/", DOT_PHP_EX, true); |
|
155 | +sn_sys_load_php_files(SN_ROOT_PHYSICAL."modules/", DOT_PHP_EX, true); |
|
156 | 156 | // Здесь - потому что core_auth модуль лежит в другом каталоге и его нужно инициализировать отдельно |
157 | 157 | |
158 | 158 | // Подключаем дефолтную страницу |
@@ -160,10 +160,10 @@ discard block |
||
160 | 160 | // Сейчас мы делаем это здесь только для того, что бы содержание дефолтной страницы оказалось вверху. Что не факт, что нужно всегда |
161 | 161 | // Но нужно, пока у нас есть не MVC-страницы |
162 | 162 | $sn_page_data = $sn_data['pages'][$sn_page_name]; |
163 | -$sn_page_name_file = 'includes/pages/' . $sn_page_data['filename'] . DOT_PHP_EX; |
|
164 | -if($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
163 | +$sn_page_name_file = 'includes/pages/'.$sn_page_data['filename'].DOT_PHP_EX; |
|
164 | +if ($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
165 | 165 | require_once($sn_page_name_file); |
166 | - if(is_array($sn_page_data['options'])) { |
|
166 | + if (is_array($sn_page_data['options'])) { |
|
167 | 167 | classSupernova::$options = array_merge(classSupernova::$options, $sn_page_data['options']); |
168 | 168 | } |
169 | 169 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | |
175 | 175 | // А теперь проверяем - поддерживают ли у нас загруженный код такую страницу |
176 | -if(!isset($sn_data['pages'][$sn_page_name])) { |
|
176 | +if (!isset($sn_data['pages'][$sn_page_name])) { |
|
177 | 177 | $sn_page_name = ''; |
178 | 178 | } |
179 | 179 | |
@@ -181,6 +181,6 @@ discard block |
||
181 | 181 | classLocale::$lang = $lang = classSupernova::$gc->localePlayer; |
182 | 182 | classLocale::$lang->lng_switch(sys_get_param_str('lang')); |
183 | 183 | |
184 | -if(!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) { |
|
184 | +if (!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) { |
|
185 | 185 | require_once "init_secondary.php"; |
186 | 186 | } |