@@ -21,13 +21,13 @@ discard block |
||
21 | 21 | |
22 | 22 | public static function db_unit_count_by_user_and_type_and_snid($user_id, $unit_type = 0, $unit_snid = 0) { |
23 | 23 | $query = doquery( |
24 | - "SELECT unit_snid, sum(unit_level) as `qty` FROM {{unit}} WHERE `unit_player_id` = {$user_id} " . |
|
25 | - ($unit_type ? "AND `unit_type` = {$unit_type} " : '') . |
|
26 | - ($unit_snid ? "AND `unit_snid` = {$unit_snid} " : '') . |
|
24 | + "SELECT unit_snid, sum(unit_level) as `qty` FROM {{unit}} WHERE `unit_player_id` = {$user_id} ". |
|
25 | + ($unit_type ? "AND `unit_type` = {$unit_type} " : ''). |
|
26 | + ($unit_snid ? "AND `unit_snid` = {$unit_snid} " : ''). |
|
27 | 27 | 'GROUP BY `unit_snid`' |
28 | 28 | ); |
29 | 29 | $result = array(); |
30 | - while($row = db_fetch($query)) { |
|
30 | + while ($row = db_fetch($query)) { |
|
31 | 31 | $result[$row['unit_snid']] = $row; |
32 | 32 | } |
33 | 33 | |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | WHERE |
44 | 44 | f.fleet_owner = {$user_id} AND |
45 | 45 | (f.fleet_start_planet_id = {$location_id} OR f.fleet_end_planet_id = {$location_id}) |
46 | - AND u.unit_snid = {$unit_snid} AND u.`unit_location_type` = " . LOC_FLEET . " AND " . self::db_unit_time_restrictions() . |
|
47 | - " LIMIT 1" . |
|
46 | + AND u.unit_snid = {$unit_snid} AND u.`unit_location_type` = ".LOC_FLEET." AND ".self::db_unit_time_restrictions(). |
|
47 | + " LIMIT 1". |
|
48 | 48 | ($for_update ? ' FOR UPDATE' : '') |
49 | 49 | , true); |
50 | 50 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | public static function db_unit_list_laboratories($user_id) { |
54 | 54 | return doquery("SELECT DISTINCT unit_location_id AS `id` |
55 | 55 | FROM {{unit}} |
56 | - WHERE unit_player_id = {$user_id} AND unit_location_type = " . LOC_PLANET . " AND unit_level > 0 AND unit_snid IN (" . STRUC_LABORATORY . ", " . STRUC_LABORATORY_NANO . ");"); |
|
56 | + WHERE unit_player_id = {$user_id} AND unit_location_type = ".LOC_PLANET." AND unit_level > 0 AND unit_snid IN (".STRUC_LABORATORY.", ".STRUC_LABORATORY_NANO.");"); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | public static function db_unit_set_by_id($unit_id, $set) { |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | |
72 | 72 | public static function db_unit_list_delete($user_id = 0, $unit_location_type, $unit_location_id = 0, $unit_snid = 0) { |
73 | 73 | return classSupernova::db_del_record_list(LOC_UNIT, |
74 | - "`unit_location_type` = {$unit_location_type}" . |
|
75 | - ($unit_location_id = idval($unit_location_id) ? " AND `unit_location_id` = {$unit_location_id}" : '') . |
|
76 | - ($user_id = idval($user_id) ? " AND `unit_player_id` = {$user_id}" : '') . |
|
74 | + "`unit_location_type` = {$unit_location_type}". |
|
75 | + ($unit_location_id = idval($unit_location_id) ? " AND `unit_location_id` = {$unit_location_id}" : ''). |
|
76 | + ($user_id = idval($user_id) ? " AND `unit_player_id` = {$user_id}" : ''). |
|
77 | 77 | ($unit_snid = idval($unit_snid) ? " AND `unit_snid` = {$unit_snid}" : '')); |
78 | 78 | } |
79 | 79 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | return doquery( |
82 | 82 | "SELECT unit_player_id, unit_type, unit_snid, unit_level, count(*) AS unit_amount |
83 | 83 | FROM `{{unit}}` |
84 | - WHERE unit_level > 0 AND " . self::db_unit_time_restrictions() . |
|
84 | + WHERE unit_level > 0 AND " . self::db_unit_time_restrictions(). |
|
85 | 85 | " GROUP BY unit_player_id, unit_type, unit_snid, unit_level" |
86 | 86 | ); |
87 | 87 | } |
@@ -93,15 +93,15 @@ discard block |
||
93 | 93 | |
94 | 94 | |
95 | 95 | public static function db_unit_list_admin_delete_mercenaries_finished() { |
96 | - return doquery("DELETE FROM {{unit}} WHERE unit_time_finish IS NOT NULL AND unit_time_finish < FROM_UNIXTIME(" . SN_TIME_NOW . ") AND unit_type = " . UNIT_MERCENARIES); |
|
96 | + return doquery("DELETE FROM {{unit}} WHERE unit_time_finish IS NOT NULL AND unit_time_finish < FROM_UNIXTIME(".SN_TIME_NOW.") AND unit_type = ".UNIT_MERCENARIES); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | public static function db_unit_list_admin_set_mercenaries_expire_time($default_length) { |
100 | 100 | return doquery( |
101 | 101 | "UPDATE {{unit}} |
102 | 102 | SET |
103 | - unit_time_start = FROM_UNIXTIME(" . SN_TIME_NOW . "), |
|
104 | - unit_time_finish = FROM_UNIXTIME(" . (SN_TIME_NOW + $default_length) . ") |
|
103 | + unit_time_start = FROM_UNIXTIME(" . SN_TIME_NOW."), |
|
104 | + unit_time_finish = FROM_UNIXTIME(" . (SN_TIME_NOW + $default_length).") |
|
105 | 105 | WHERE unit_type = " . UNIT_MERCENARIES |
106 | 106 | ); |
107 | 107 | } |
@@ -398,31 +398,31 @@ discard block |
||
398 | 398 | |
399 | 399 | return doquery( |
400 | 400 | // Блокировка самого флота |
401 | - "SELECT 1 FROM {{fleets}} AS f " . |
|
401 | + "SELECT 1 FROM {{fleets}} AS f ". |
|
402 | 402 | |
403 | 403 | // Блокировка всех юнитов, принадлежащих этому флоту |
404 | - "LEFT JOIN {{unit}} as unit ON unit.unit_location_type = " . static::$locationType . " AND unit.unit_location_id = f.fleet_id " . |
|
404 | + "LEFT JOIN {{unit}} as unit ON unit.unit_location_type = ".static::$locationType." AND unit.unit_location_id = f.fleet_id ". |
|
405 | 405 | |
406 | 406 | // Блокировка всех прилетающих и улетающих флотов, если нужно |
407 | 407 | // TODO - lock fleets by COORDINATES |
408 | - ($mission_data['dst_fleets'] ? "LEFT JOIN {{fleets}} AS fd ON fd.fleet_end_planet_id = f.fleet_end_planet_id OR fd.fleet_start_planet_id = f.fleet_end_planet_id " : '') . |
|
408 | + ($mission_data['dst_fleets'] ? "LEFT JOIN {{fleets}} AS fd ON fd.fleet_end_planet_id = f.fleet_end_planet_id OR fd.fleet_start_planet_id = f.fleet_end_planet_id " : ''). |
|
409 | 409 | // Блокировка всех юнитов, принадлежащих прилетающим и улетающим флотам - ufd = unit_fleet_destination |
410 | - ($mission_data['dst_fleets'] ? "LEFT JOIN {{unit}} AS ufd ON ufd.unit_location_type = " . static::$locationType . " AND ufd.unit_location_id = fd.fleet_id " : '') . |
|
410 | + ($mission_data['dst_fleets'] ? "LEFT JOIN {{unit}} AS ufd ON ufd.unit_location_type = ".static::$locationType." AND ufd.unit_location_id = fd.fleet_id " : ''). |
|
411 | 411 | |
412 | - ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{users}} AS ud ON ud.id = f.fleet_target_owner " : '') . |
|
412 | + ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{users}} AS ud ON ud.id = f.fleet_target_owner " : ''). |
|
413 | 413 | // Блокировка всех юнитов, принадлежащих владельцу планеты-цели |
414 | - ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS unit_player_dest ON unit_player_dest.unit_player_id = ud.id " : '') . |
|
414 | + ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS unit_player_dest ON unit_player_dest.unit_player_id = ud.id " : ''). |
|
415 | 415 | // Блокировка планеты-цели |
416 | - ($mission_data['dst_planet'] ? "LEFT JOIN {{planets}} AS pd ON pd.id = f.fleet_end_planet_id " : '') . |
|
416 | + ($mission_data['dst_planet'] ? "LEFT JOIN {{planets}} AS pd ON pd.id = f.fleet_end_planet_id " : ''). |
|
417 | 417 | // Блокировка всех юнитов, принадлежащих планете-цели - НЕ НУЖНО. Уже залочили ранее, как принадлежащие игроку-цели |
418 | 418 | // ($mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS upd ON upd.unit_location_type = " . LOC_PLANET . " AND upd.unit_location_id = pd.id " : '') . |
419 | 419 | |
420 | 420 | |
421 | - ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{users}} AS us ON us.id = f.fleet_owner " : '') . |
|
421 | + ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{users}} AS us ON us.id = f.fleet_owner " : ''). |
|
422 | 422 | // Блокировка всех юнитов, принадлежащих владельцу флота |
423 | - ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS unit_player_src ON unit_player_src.unit_player_id = us.id " : '') . |
|
423 | + ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS unit_player_src ON unit_player_src.unit_player_id = us.id " : ''). |
|
424 | 424 | // Блокировка планеты отправления |
425 | - ($mission_data['src_planet'] ? "LEFT JOIN {{planets}} AS ps ON ps.id = f.fleet_start_planet_id " : '') . |
|
425 | + ($mission_data['src_planet'] ? "LEFT JOIN {{planets}} AS ps ON ps.id = f.fleet_start_planet_id " : ''). |
|
426 | 426 | // Блокировка всех юнитов, принадлежащих планете с которой юниты были отправлены - НЕ НУЖНО. Уже залочили ранее, как принадлежащие владельцу флота |
427 | 427 | // ($mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS ups ON ups.unit_location_type = " . LOC_PLANET . " AND ups.unit_location_id = ps.id " : '') . |
428 | 428 | |
@@ -439,11 +439,11 @@ discard block |
||
439 | 439 | public function dbGetLockById($dbId) { |
440 | 440 | doquery( |
441 | 441 | // Блокировка самого флота |
442 | - "SELECT 1 FROM {{fleets}} AS FLEET0 " . |
|
442 | + "SELECT 1 FROM {{fleets}} AS FLEET0 ". |
|
443 | 443 | // Lock fleet owner |
444 | - "LEFT JOIN {{users}} as USER0 on USER0.id = FLEET0.fleet_owner " . |
|
444 | + "LEFT JOIN {{users}} as USER0 on USER0.id = FLEET0.fleet_owner ". |
|
445 | 445 | // Блокировка всех юнитов, принадлежащих этому флоту |
446 | - "LEFT JOIN {{unit}} as UNIT0 ON UNIT0.unit_location_type = " . LOC_FLEET . " AND UNIT0.unit_location_id = FLEET0.fleet_id " . |
|
446 | + "LEFT JOIN {{unit}} as UNIT0 ON UNIT0.unit_location_type = ".LOC_FLEET." AND UNIT0.unit_location_id = FLEET0.fleet_id ". |
|
447 | 447 | |
448 | 448 | // Без предварительной выборки неизвестно - куда летит этот флот. |
449 | 449 | // Поэтому надо выбирать флоты, чьи координаты прибытия ИЛИ отбытия совпадают с координатами прибытия ИЛИ отбытия текущего флота. |
@@ -459,9 +459,9 @@ discard block |
||
459 | 459 | FLEET1.fleet_end_planet = FLEET0.fleet_end_planet |
460 | 460 | " . |
461 | 461 | // Блокировка всех юнитов, принадлежащих этим флотам |
462 | - "LEFT JOIN {{unit}} as UNIT1 ON UNIT1.unit_location_type = " . LOC_FLEET . " AND UNIT1.unit_location_id = FLEET1.fleet_id " . |
|
462 | + "LEFT JOIN {{unit}} as UNIT1 ON UNIT1.unit_location_type = ".LOC_FLEET." AND UNIT1.unit_location_id = FLEET1.fleet_id ". |
|
463 | 463 | // Lock fleet owner |
464 | - "LEFT JOIN {{users}} as USER1 on USER1.id = FLEET1.fleet_owner " . |
|
464 | + "LEFT JOIN {{users}} as USER1 on USER1.id = FLEET1.fleet_owner ". |
|
465 | 465 | |
466 | 466 | "LEFT JOIN {{fleets}} AS FLEET2 ON |
467 | 467 | FLEET2.fleet_mess = 1 AND FLEET0.fleet_mess = 0 AND |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | " . |
472 | 472 | // Блокировка всех юнитов, принадлежащих этим флотам |
473 | 473 | "LEFT JOIN {{unit}} as UNIT2 ON |
474 | - UNIT2.unit_location_type = " . LOC_FLEET . " AND |
|
474 | + UNIT2.unit_location_type = " . LOC_FLEET." AND |
|
475 | 475 | UNIT2.unit_location_id = FLEET2.fleet_id |
476 | 476 | " . |
477 | 477 | // Lock fleet owner |
@@ -488,11 +488,11 @@ discard block |
||
488 | 488 | " . |
489 | 489 | // Блокировка всех юнитов, принадлежащих этим флотам |
490 | 490 | "LEFT JOIN {{unit}} as UNIT3 ON |
491 | - UNIT3.unit_location_type = " . LOC_FLEET . " AND |
|
491 | + UNIT3.unit_location_type = " . LOC_FLEET." AND |
|
492 | 492 | UNIT3.unit_location_id = FLEET3.fleet_id |
493 | 493 | " . |
494 | 494 | // Lock fleet owner |
495 | - "LEFT JOIN {{users}} as USER3 on USER3.id = FLEET3.fleet_owner " . |
|
495 | + "LEFT JOIN {{users}} as USER3 on USER3.id = FLEET3.fleet_owner ". |
|
496 | 496 | |
497 | 497 | "LEFT JOIN {{fleets}} AS FLEET4 ON |
498 | 498 | FLEET4.fleet_mess = 1 AND FLEET0.fleet_mess = 1 AND |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | " . |
503 | 503 | // Блокировка всех юнитов, принадлежащих этим флотам |
504 | 504 | "LEFT JOIN {{unit}} as UNIT4 ON |
505 | - UNIT4.unit_location_type = " . LOC_FLEET . " AND |
|
505 | + UNIT4.unit_location_type = " . LOC_FLEET." AND |
|
506 | 506 | UNIT4.unit_location_id = FLEET4.fleet_id |
507 | 507 | " . |
508 | 508 | // Lock fleet owner |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | " . |
525 | 525 | // Блокировка всех юнитов, принадлежащих этой планете |
526 | 526 | "LEFT JOIN {{unit}} as UNIT5 ON |
527 | - UNIT5.unit_location_type = " . LOC_PLANET . " AND |
|
527 | + UNIT5.unit_location_type = " . LOC_PLANET." AND |
|
528 | 528 | UNIT5.unit_location_id = PLANETS5.id |
529 | 529 | " . |
530 | 530 | |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | " . |
543 | 543 | // Блокировка всех юнитов, принадлежащих этой планете |
544 | 544 | "LEFT JOIN {{unit}} as UNIT6 ON |
545 | - UNIT6.unit_location_type = " . LOC_PLANET . " AND |
|
545 | + UNIT6.unit_location_type = " . LOC_PLANET." AND |
|
546 | 546 | UNIT6.unit_location_id = PLANETS6.id |
547 | 547 | " . |
548 | 548 | "WHERE FLEET0.fleet_id = {$dbId} GROUP BY 1 FOR UPDATE" |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | } elseif ($this->isResource($unit_id)) { |
662 | 662 | $this->resource_list[$unit_id] = $unit_count; |
663 | 663 | } else { |
664 | - throw new Exception('Trying to pass to fleet non-resource and non-ship ' . var_export($unit_array, true), ERR_ERROR); |
|
664 | + throw new Exception('Trying to pass to fleet non-resource and non-ship '.var_export($unit_array, true), ERR_ERROR); |
|
665 | 665 | } |
666 | 666 | } |
667 | 667 | } |
@@ -986,7 +986,7 @@ discard block |
||
986 | 986 | */ |
987 | 987 | public function resourcesSet($resource_list) { |
988 | 988 | if (!empty($this->propertiesAdjusted['resource_list'])) { |
989 | - throw new PropertyAccessException('Property "resource_list" already was adjusted so no SET is possible until dbSave in ' . get_called_class() . '::unitSetResourceList', ERR_ERROR); |
|
989 | + throw new PropertyAccessException('Property "resource_list" already was adjusted so no SET is possible until dbSave in '.get_called_class().'::unitSetResourceList', ERR_ERROR); |
|
990 | 990 | } |
991 | 991 | $this->resourcesAdjust($resource_list, true); |
992 | 992 | } |
@@ -1020,7 +1020,7 @@ discard block |
||
1020 | 1020 | // Check for negative unit value |
1021 | 1021 | if ($this->resource_list[$resource_id] < 0) { |
1022 | 1022 | // TODO |
1023 | - throw new Exception('Resource ' . $resource_id . ' will become negative in ' . get_called_class() . '::unitAdjustResourceList', ERR_ERROR); |
|
1023 | + throw new Exception('Resource '.$resource_id.' will become negative in '.get_called_class().'::unitAdjustResourceList', ERR_ERROR); |
|
1024 | 1024 | } |
1025 | 1025 | } |
1026 | 1026 | } |
@@ -1193,7 +1193,7 @@ discard block |
||
1193 | 1193 | |
1194 | 1194 | protected function printErrorIfNoShips() { |
1195 | 1195 | if ($this->unitList->unitsCount() <= 0) { |
1196 | - message(classLocale::$lang['fl_err_no_ships'], classLocale::$lang['fl_error'], 'fleet' . DOT_PHP_EX, 5); |
|
1196 | + message(classLocale::$lang['fl_err_no_ships'], classLocale::$lang['fl_error'], 'fleet'.DOT_PHP_EX, 5); |
|
1197 | 1197 | } |
1198 | 1198 | } |
1199 | 1199 | |
@@ -1540,7 +1540,7 @@ discard block |
||
1540 | 1540 | } catch (Exception $e) { |
1541 | 1541 | |
1542 | 1542 | // TODO - MESSAGE BOX |
1543 | - if($e instanceof ExceptionFleetInvalid) { |
|
1543 | + if ($e instanceof ExceptionFleetInvalid) { |
|
1544 | 1544 | sn_db_transaction_rollback(); |
1545 | 1545 | pdie(classLocale::$lang['fl_attack_error'][$e->getCode()]); |
1546 | 1546 | } else { |
@@ -1629,7 +1629,7 @@ discard block |
||
1629 | 1629 | $validator->validate(); |
1630 | 1630 | } catch (Exception $e) { |
1631 | 1631 | // TODO - MESSAGE BOX |
1632 | - if($e instanceof ExceptionFleetInvalid) { |
|
1632 | + if ($e instanceof ExceptionFleetInvalid) { |
|
1633 | 1633 | sn_db_transaction_rollback(); |
1634 | 1634 | pdie(classLocale::$lang['fl_attack_error'][$e->getCode()]); |
1635 | 1635 | } else { |
@@ -1690,7 +1690,7 @@ discard block |
||
1690 | 1690 | |
1691 | 1691 | |
1692 | 1692 | if (!empty($this->captain['unit_id'])) { |
1693 | - DBStaticUnit::db_unit_set_by_id($this->captain['unit_id'], "`unit_location_type` = " . LOC_FLEET . ", `unit_location_id` = {$this->_dbId}"); |
|
1693 | + DBStaticUnit::db_unit_set_by_id($this->captain['unit_id'], "`unit_location_type` = ".LOC_FLEET.", `unit_location_id` = {$this->_dbId}"); |
|
1694 | 1694 | } |
1695 | 1695 | |
1696 | 1696 | // return $this->fleet->acs['ankunft'] - $this->fleet->time_launch >= $this->fleet->travelData['duration']; |
@@ -1702,7 +1702,7 @@ discard block |
||
1702 | 1702 | $template_result['.']['fleets'][] = $this->renderFleet(SN_TIME_NOW, $timeMissionJob); |
1703 | 1703 | |
1704 | 1704 | $template_result += array( |
1705 | - 'mission' => classLocale::$lang['type_mission'][$this->_mission_type] . ($this->_mission_type == MT_EXPLORE || $this->_mission_type == MT_HOLD ? ' ' . pretty_time($timeMissionJob) : ''), |
|
1705 | + 'mission' => classLocale::$lang['type_mission'][$this->_mission_type].($this->_mission_type == MT_EXPLORE || $this->_mission_type == MT_HOLD ? ' '.pretty_time($timeMissionJob) : ''), |
|
1706 | 1706 | 'dist' => pretty_number($this->travelData['distance']), |
1707 | 1707 | 'speed' => pretty_number($this->travelData['fleet_speed']), |
1708 | 1708 | 'deute_need' => pretty_number($this->travelData['consumption']), |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | |
36 | 36 | $this->container = array(); |
37 | 37 | |
38 | - if(classSupernova::$cache->_MODE != CACHER_NO_CACHE && !classSupernova::$config->locale_cache_disable) { |
|
38 | + if (classSupernova::$cache->_MODE != CACHER_NO_CACHE && !classSupernova::$config->locale_cache_disable) { |
|
39 | 39 | $this->cache = classSupernova::$cache; |
40 | 40 | classSupernova::log_file('locale.__constructor: Cache is present'); |
41 | 41 | //$this->cache->unset_by_prefix($this->cache_prefix); // TODO - remove? 'cause debug! |
42 | 42 | } |
43 | 43 | |
44 | - if($enable_stat_usage && empty($this->stat_usage)) { |
|
44 | + if ($enable_stat_usage && empty($this->stat_usage)) { |
|
45 | 45 | $this->enable_stat_usage = $enable_stat_usage; |
46 | 46 | $this->usage_stat_load(); |
47 | 47 | // TODO shutdown function |
@@ -67,18 +67,18 @@ discard block |
||
67 | 67 | unset($fallback[$this->active]); |
68 | 68 | |
69 | 69 | // Проходим по оставшимся локалям |
70 | - foreach($fallback as $try_language) { |
|
70 | + foreach ($fallback as $try_language) { |
|
71 | 71 | // Если нет такой строки - пытаемся вытащить из кэша |
72 | - if(!isset($this->container[$try_language][$offset]) && $this->cache) { |
|
73 | - $this->container[$try_language][$offset] = $this->cache->__get($this->cache_prefix . $try_language . '_' . $offset); |
|
72 | + if (!isset($this->container[$try_language][$offset]) && $this->cache) { |
|
73 | + $this->container[$try_language][$offset] = $this->cache->__get($this->cache_prefix.$try_language.'_'.$offset); |
|
74 | 74 | // Записываем результат работы кэша |
75 | 75 | $locale_cache_statistic['queries']++; |
76 | 76 | isset($this->container[$try_language][$offset]) ? $locale_cache_statistic['hits']++ : $locale_cache_statistic['misses']++; |
77 | -!isset($this->container[$try_language][$offset]) ? $locale_cache_statistic['missed_str'][] = $this->cache_prefix . $try_language . '_' . $offset : false; |
|
77 | +!isset($this->container[$try_language][$offset]) ? $locale_cache_statistic['missed_str'][] = $this->cache_prefix.$try_language.'_'.$offset : false; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | // Если мы как-то где-то нашли строку... |
81 | - if(isset($this->container[$try_language][$offset])) { |
|
81 | + if (isset($this->container[$try_language][$offset])) { |
|
82 | 82 | // ...значит она получена в результате фоллбэка и записываем её в кэш и контейнер |
83 | 83 | $this[$offset] = $this->container[$try_language][$offset]; |
84 | 84 | $locale_cache_statistic['fallbacks']++; |
@@ -94,16 +94,16 @@ discard block |
||
94 | 94 | $this->container[$this->active][] = $value; |
95 | 95 | } else { |
96 | 96 | $this->container[$this->active][$offset] = $value; |
97 | - if($this->cache) { |
|
98 | - $this->cache->__set($this->cache_prefix_lang . $offset, $value); |
|
97 | + if ($this->cache) { |
|
98 | + $this->cache->__set($this->cache_prefix_lang.$offset, $value); |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | } |
102 | 102 | public function offsetExists($offset) { |
103 | 103 | // Шорткат если у нас уже есть строка в памяти PHP |
104 | - if(!isset($this->container[$this->active][$offset])) { |
|
104 | + if (!isset($this->container[$this->active][$offset])) { |
|
105 | 105 | // pdump($this->cache_prefix_lang . $offset); |
106 | - if(!$this->cache || !($this->container[$this->active][$offset] = $this->cache->__get($this->cache_prefix_lang . $offset))) { |
|
106 | + if (!$this->cache || !($this->container[$this->active][$offset] = $this->cache->__get($this->cache_prefix_lang.$offset))) { |
|
107 | 107 | // pdump($this->cache_prefix_lang . $offset); |
108 | 108 | // Если нету такой строки - делаем фоллбэк |
109 | 109 | $this->locale_string_fallback($offset); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | } |
120 | 120 | public function offsetGet($offset) { |
121 | 121 | $value = $this->offsetExists($offset) ? $this->container[$this->active][$offset] : null; |
122 | - if($this->enable_stat_usage) { |
|
122 | + if ($this->enable_stat_usage) { |
|
123 | 123 | $this->usage_stat_log($offset, $value); |
124 | 124 | } |
125 | 125 | return $value; |
@@ -136,26 +136,26 @@ discard block |
||
136 | 136 | public function usage_stat_load() { |
137 | 137 | global $sn_cache; |
138 | 138 | |
139 | - $this->stat_usage = $sn_cache->lng_stat_usage = array(); // TODO for debug |
|
140 | - if(empty($this->stat_usage)) { |
|
139 | + $this->stat_usage = $sn_cache->lng_stat_usage = array(); // TODO for debug |
|
140 | + if (empty($this->stat_usage)) { |
|
141 | 141 | $query = doquery("SELECT * FROM {{lng_usage_stat}}"); |
142 | - while($row = db_fetch($query)) { |
|
143 | - $this->stat_usage[$row['lang_code'] . ':' . $row['string_id'] . ':' . $row['file'] . ':' . $row['line']] = $row['is_empty']; |
|
142 | + while ($row = db_fetch($query)) { |
|
143 | + $this->stat_usage[$row['lang_code'].':'.$row['string_id'].':'.$row['file'].':'.$row['line']] = $row['is_empty']; |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | } |
147 | 147 | public function usage_stat_save() { |
148 | - if(!empty($this->stat_usage_new)) { |
|
148 | + if (!empty($this->stat_usage_new)) { |
|
149 | 149 | global $sn_cache; |
150 | 150 | $sn_cache->lng_stat_usage = $this->stat_usage; |
151 | 151 | doquery("SELECT 1 FROM {{lng_usage_stat}} LIMIT 1"); |
152 | - foreach($this->stat_usage_new as &$value) { |
|
153 | - foreach($value as &$value2) { |
|
154 | - $value2 = '"' . db_escape($value2) . '"'; |
|
152 | + foreach ($this->stat_usage_new as &$value) { |
|
153 | + foreach ($value as &$value2) { |
|
154 | + $value2 = '"'.db_escape($value2).'"'; |
|
155 | 155 | } |
156 | - $value = '(' . implode(',', $value) .')'; |
|
156 | + $value = '('.implode(',', $value).')'; |
|
157 | 157 | } |
158 | - doquery("REPLACE INTO {{lng_usage_stat}} (lang_code,string_id,`file`,line,is_empty,locale) VALUES " . implode(',', $this->stat_usage_new)); |
|
158 | + doquery("REPLACE INTO {{lng_usage_stat}} (lang_code,string_id,`file`,line,is_empty,locale) VALUES ".implode(',', $this->stat_usage_new)); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | public function usage_stat_log(&$offset, &$value) { |
@@ -165,8 +165,8 @@ discard block |
||
165 | 165 | |
166 | 166 | $file = str_replace('\\', '/', substr($trace[1]['file'], strlen(SN_ROOT_PHYSICAL) - 1)); |
167 | 167 | |
168 | - $string_id = $this->active . ':' . $offset . ':' . $file . ':' . $trace[1]['line']; |
|
169 | - if(!isset($this->stat_usage[$string_id]) || $this->stat_usage[$string_id] != empty($value)) { |
|
168 | + $string_id = $this->active.':'.$offset.':'.$file.':'.$trace[1]['line']; |
|
169 | + if (!isset($this->stat_usage[$string_id]) || $this->stat_usage[$string_id] != empty($value)) { |
|
170 | 170 | $this->stat_usage[$string_id] = empty($value); |
171 | 171 | $this->stat_usage_new[] = array( |
172 | 172 | 'lang_code' => $this->active, |
@@ -174,14 +174,14 @@ discard block |
||
174 | 174 | 'file' => $file, |
175 | 175 | 'line' => $trace[1]['line'], |
176 | 176 | 'is_empty' => intval(empty($value)), |
177 | - 'locale' => '' . $value, |
|
177 | + 'locale' => ''.$value, |
|
178 | 178 | ); |
179 | 179 | } |
180 | 180 | } |
181 | 181 | |
182 | 182 | |
183 | 183 | protected function lng_try_filepath($path, $file_path_relative) { |
184 | - $file_path = SN_ROOT_PHYSICAL . ($path && file_exists(SN_ROOT_PHYSICAL . $path . $file_path_relative) ? $path : '') . $file_path_relative; |
|
184 | + $file_path = SN_ROOT_PHYSICAL.($path && file_exists(SN_ROOT_PHYSICAL.$path.$file_path_relative) ? $path : '').$file_path_relative; |
|
185 | 185 | return file_exists($file_path) ? $file_path : false; |
186 | 186 | } |
187 | 187 | |
@@ -203,14 +203,14 @@ discard block |
||
203 | 203 | |
204 | 204 | classSupernova::log_file("locale.include: Loading data from domain '{$filename}'", 1); |
205 | 205 | |
206 | - $cache_file_key = $this->cache_prefix_lang . '__' . $filename; |
|
206 | + $cache_file_key = $this->cache_prefix_lang.'__'.$filename; |
|
207 | 207 | |
208 | 208 | // Подключен ли внешний кэш? |
209 | - if($this->cache) { |
|
209 | + if ($this->cache) { |
|
210 | 210 | // Загружен ли уже данный файл? |
211 | 211 | $cache_file_status = $this->cache->__get($cache_file_key); |
212 | - 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); |
|
213 | - if($cache_file_status) { |
|
212 | + 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); |
|
213 | + if ($cache_file_status) { |
|
214 | 214 | // Если да - повторять загрузку нет смысла |
215 | 215 | return null; |
216 | 216 | } |
@@ -224,47 +224,47 @@ discard block |
||
224 | 224 | $this->make_fallback($language); |
225 | 225 | |
226 | 226 | $file_path = ''; |
227 | - foreach($this->fallback as $lang_try) { |
|
228 | - if(!$lang_try /* || isset($language_tried[$lang_try]) */) { |
|
227 | + foreach ($this->fallback as $lang_try) { |
|
228 | + if (!$lang_try /* || isset($language_tried[$lang_try]) */) { |
|
229 | 229 | continue; |
230 | 230 | } |
231 | 231 | |
232 | - if($file_path = $this->lng_try_filepath($path, "language/{$lang_try}/{$filename_ext}")) { |
|
232 | + if ($file_path = $this->lng_try_filepath($path, "language/{$lang_try}/{$filename_ext}")) { |
|
233 | 233 | break; |
234 | 234 | } |
235 | 235 | |
236 | - if($file_path = $this->lng_try_filepath($path, "language/{$filename}_{$lang_try}{$ext}")) { |
|
236 | + if ($file_path = $this->lng_try_filepath($path, "language/{$filename}_{$lang_try}{$ext}")) { |
|
237 | 237 | break; |
238 | 238 | } |
239 | 239 | |
240 | 240 | $file_path = ''; |
241 | 241 | } |
242 | 242 | |
243 | - if($file_path) { |
|
243 | + if ($file_path) { |
|
244 | 244 | $a_lang_array = array(); |
245 | 245 | include($file_path); |
246 | 246 | |
247 | - if(!empty($a_lang_array)) { |
|
247 | + if (!empty($a_lang_array)) { |
|
248 | 248 | $this->merge($a_lang_array); |
249 | 249 | |
250 | 250 | // Загрузка данных из файла в кэш |
251 | - if($this->cache) { |
|
251 | + if ($this->cache) { |
|
252 | 252 | classSupernova::log_file("Locale: loading '{$filename}' into cache"); |
253 | - foreach($a_lang_array as $key => $value) { |
|
254 | - $value_cache_key = $this->cache_prefix_lang . $key; |
|
255 | - if($this->cache->__isset($value_cache_key)) { |
|
256 | - if(is_array($value)) { |
|
253 | + foreach ($a_lang_array as $key => $value) { |
|
254 | + $value_cache_key = $this->cache_prefix_lang.$key; |
|
255 | + if ($this->cache->__isset($value_cache_key)) { |
|
256 | + if (is_array($value)) { |
|
257 | 257 | $alt_value = $this->cache->__get($value_cache_key); |
258 | 258 | $value = array_replace_recursive($alt_value, $value); |
259 | 259 | // pdump($alt_value, $alt_value); |
260 | 260 | } |
261 | 261 | } |
262 | - $this->cache->__set($this->cache_prefix_lang . $key, $value); |
|
262 | + $this->cache->__set($this->cache_prefix_lang.$key, $value); |
|
263 | 263 | } |
264 | 264 | } |
265 | 265 | } |
266 | 266 | |
267 | - if($this->cache) { |
|
267 | + if ($this->cache) { |
|
268 | 268 | $this->cache->__set($cache_file_key, true); |
269 | 269 | } |
270 | 270 | |
@@ -277,14 +277,14 @@ discard block |
||
277 | 277 | } |
278 | 278 | |
279 | 279 | public function lng_load_i18n($i18n) { |
280 | - if(!isset($i18n)) { |
|
280 | + if (!isset($i18n)) { |
|
281 | 281 | return; |
282 | 282 | } |
283 | 283 | |
284 | - foreach($i18n as $i18n_data) { |
|
285 | - if(is_string($i18n_data)) { |
|
284 | + foreach ($i18n as $i18n_data) { |
|
285 | + if (is_string($i18n_data)) { |
|
286 | 286 | $this->lng_include($i18n_data); |
287 | - } elseif(is_array($i18n_data)) { |
|
287 | + } elseif (is_array($i18n_data)) { |
|
288 | 288 | $this->lng_include($i18n_data['file'], $i18n_data['path']); |
289 | 289 | } |
290 | 290 | } |
@@ -302,27 +302,27 @@ discard block |
||
302 | 302 | |
303 | 303 | classSupernova::log_file("locale.switch: Trying to switch language to '{$language_new}'"); |
304 | 304 | |
305 | - if($language_new == $this->active) { |
|
305 | + if ($language_new == $this->active) { |
|
306 | 306 | classSupernova::log_file("locale.switch: New language '{$language_new}' is equal to current language '{$this->active}' - EXIT", -1); |
307 | 307 | return false; |
308 | 308 | } |
309 | 309 | |
310 | 310 | $this->active = $language = $language_new; |
311 | - $this->cache_prefix_lang = $this->cache_prefix . $this->active . '_'; |
|
311 | + $this->cache_prefix_lang = $this->cache_prefix.$this->active.'_'; |
|
312 | 312 | |
313 | 313 | $this['LANG_INFO'] = $this->lng_get_info($this->active); |
314 | 314 | $this->make_fallback($this->active); |
315 | 315 | |
316 | - if($this->cache) { |
|
317 | - $cache_lang_init_status = $this->cache->__get($this->cache_prefix_lang . '__INIT'); |
|
318 | - 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); |
|
319 | - if($cache_lang_init_status) { |
|
316 | + if ($this->cache) { |
|
317 | + $cache_lang_init_status = $this->cache->__get($this->cache_prefix_lang.'__INIT'); |
|
318 | + 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); |
|
319 | + if ($cache_lang_init_status) { |
|
320 | 320 | return false; |
321 | 321 | } |
322 | 322 | |
323 | 323 | // Чистим текущие локализации из кэша. Достаточно почистить только флаги инициализации языкового кэша и загрузки файлов - они начинаются с '__' |
324 | 324 | classSupernova::log_file("locale.switch: Cache - invalidating data"); |
325 | - $this->cache->unset_by_prefix($this->cache_prefix_lang . '__'); |
|
325 | + $this->cache->unset_by_prefix($this->cache_prefix_lang.'__'); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | $this->lng_include('system'); |
@@ -332,9 +332,9 @@ discard block |
||
332 | 332 | // Loading global language files |
333 | 333 | $this->lng_load_i18n(classSupernova::$sn_mvc['i18n']['']); |
334 | 334 | |
335 | - if($this->cache) { |
|
336 | - classSupernova::log_file("locale.switch: Cache - setting flag " . $this->cache_prefix_lang . '__INIT'); |
|
337 | - $this->cache->__set($this->cache_prefix_lang . '__INIT', true); |
|
335 | + if ($this->cache) { |
|
336 | + classSupernova::log_file("locale.switch: Cache - setting flag ".$this->cache_prefix_lang.'__INIT'); |
|
337 | + $this->cache->__set($this->cache_prefix_lang.'__INIT', true); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | classSupernova::log_file("locale.switch: Complete - EXIT"); |
@@ -344,9 +344,9 @@ discard block |
||
344 | 344 | |
345 | 345 | |
346 | 346 | public function lng_get_info($entry) { |
347 | - $file_name = SN_ROOT_PHYSICAL . 'language/' . $entry . '/language.mo.php'; |
|
347 | + $file_name = SN_ROOT_PHYSICAL.'language/'.$entry.'/language.mo.php'; |
|
348 | 348 | $lang_info = array(); |
349 | - if(file_exists($file_name)) { |
|
349 | + if (file_exists($file_name)) { |
|
350 | 350 | include($file_name); |
351 | 351 | } |
352 | 352 | |
@@ -354,15 +354,15 @@ discard block |
||
354 | 354 | } |
355 | 355 | |
356 | 356 | public function lng_get_list() { |
357 | - if(empty($this->lang_list)) { |
|
357 | + if (empty($this->lang_list)) { |
|
358 | 358 | $this->lang_list = array(); |
359 | 359 | |
360 | - $path = SN_ROOT_PHYSICAL . 'language/'; |
|
360 | + $path = SN_ROOT_PHYSICAL.'language/'; |
|
361 | 361 | $dir = dir($path); |
362 | - while(false !== ($entry = $dir->read())) { |
|
363 | - if(is_dir($path . $entry) && $entry[0] != '.') { |
|
362 | + while (false !== ($entry = $dir->read())) { |
|
363 | + if (is_dir($path.$entry) && $entry[0] != '.') { |
|
364 | 364 | $lang_info = $this->lng_get_info($entry); |
365 | - if($lang_info['LANG_NAME_ISO2'] == $entry) { |
|
365 | + if ($lang_info['LANG_NAME_ISO2'] == $entry) { |
|
366 | 366 | $this->lang_list[$lang_info['LANG_NAME_ISO2']] = $lang_info; |
367 | 367 | } |
368 | 368 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @return $this |
32 | 32 | */ |
33 | 33 | public function literal($value) { |
34 | - $this->literal = (string)$value; |
|
34 | + $this->literal = (string) $value; |
|
35 | 35 | |
36 | 36 | return $this; |
37 | 37 | } |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | $alias = $this->aliasFromField($functionName, $field); |
65 | 65 | } |
66 | 66 | |
67 | - $this->literal = strtoupper($functionName) . '(' . $this->quoteField($field) . ')'; |
|
67 | + $this->literal = strtoupper($functionName).'('.$this->quoteField($field).')'; |
|
68 | 68 | |
69 | 69 | if (self::SQL_LITERAL_ALIAS_NONE !== $alias && !empty($alias)) { |
70 | - $this->literal .= ' AS `' . $alias . '`'; |
|
70 | + $this->literal .= ' AS `'.$alias.'`'; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | return $this; |
@@ -124,10 +124,10 @@ discard block |
||
124 | 124 | $alias = $this->aliasFromField($functionName, $field); |
125 | 125 | } |
126 | 126 | |
127 | - $this->literal = $this->quoteField($field) . ' IS NULL'; |
|
127 | + $this->literal = $this->quoteField($field).' IS NULL'; |
|
128 | 128 | |
129 | 129 | if (!empty($alias)) { |
130 | - $this->literal .= ' AS `' . $alias . '`'; |
|
130 | + $this->literal .= ' AS `'.$alias.'`'; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | return $this; |
@@ -15,13 +15,13 @@ |
||
15 | 15 | * @return string |
16 | 16 | */ |
17 | 17 | public static function quoteComment($comment) { |
18 | - if($comment == '') { |
|
18 | + if ($comment == '') { |
|
19 | 19 | return ''; |
20 | 20 | } |
21 | 21 | |
22 | - $comment = str_replace(array('/*', '*/'), '__',$comment); |
|
22 | + $comment = str_replace(array('/*', '*/'), '__', $comment); |
|
23 | 23 | |
24 | - return "\r\n/*" . $comment . "*/"; |
|
24 | + return "\r\n/*".$comment."*/"; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | } |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | $crystal += $destroyed * $unit_info[P_COST][RES_CRYSTAL] / 4; |
78 | 78 | } |
79 | 79 | |
80 | - $return['structures'] = $structures; // Structures left after attack |
|
81 | - $return['metal'] = floor($metal); // Metal scraps |
|
80 | + $return['structures'] = $structures; // Structures left after attack |
|
81 | + $return['metal'] = floor($metal); // Metal scraps |
|
82 | 82 | $return['crystal'] = floor($crystal); // Crystal scraps |
83 | 83 | |
84 | 84 | return $return; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | if (!empty($message)) { |
151 | - $message = classLocale::$lang['mip_defense_destroyed'] . $message . "{$classLocale['mip_recycled']}{$classLocale['Metal']}: {$attackResult['metal']}, {$classLocale['Crystal']}: {$attackResult['crystal']}<br>"; |
|
151 | + $message = classLocale::$lang['mip_defense_destroyed'].$message."{$classLocale['mip_recycled']}{$classLocale['Metal']}: {$attackResult['metal']}, {$classLocale['Crystal']}: {$attackResult['crystal']}<br>"; |
|
152 | 152 | |
153 | 153 | DBStaticPlanet::db_planet_set_by_id($target_planet_row['id'], "`metal` = `metal` + {$attackResult['metal']}, `crystal` = `crystal` + {$attackResult['crystal']}"); |
154 | 154 | } |
@@ -165,8 +165,8 @@ discard block |
||
165 | 165 | |
166 | 166 | empty($message) ? $message = classLocale::$lang['mip_no_defense'] : false; |
167 | 167 | |
168 | - DBStaticMessages::msg_send_simple_message($fleetRow['fleet_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, classLocale::$lang['mip_sender_amd'], classLocale::$lang['mip_subject_amd'], $message_vorlage . $message); |
|
169 | - DBStaticMessages::msg_send_simple_message($fleetRow['fleet_target_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, classLocale::$lang['mip_sender_amd'], classLocale::$lang['mip_subject_amd'], $message_vorlage . $message); |
|
168 | + DBStaticMessages::msg_send_simple_message($fleetRow['fleet_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, classLocale::$lang['mip_sender_amd'], classLocale::$lang['mip_subject_amd'], $message_vorlage.$message); |
|
169 | + DBStaticMessages::msg_send_simple_message($fleetRow['fleet_target_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, classLocale::$lang['mip_sender_amd'], classLocale::$lang['mip_subject_amd'], $message_vorlage.$message); |
|
170 | 170 | } |
171 | 171 | DBStaticFleetMissile::db_missile_delete($fleetRow); |
172 | 172 | } |
@@ -1,22 +1,22 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
3 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
4 | 4 | classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
5 | 5 | } |
6 | 6 | |
7 | -if(!$user_can_send_mails) { |
|
7 | +if (!$user_can_send_mails) { |
|
8 | 8 | message(classLocale::$lang['Denied_access'], classLocale::$lang['Send_circular_mail']); |
9 | 9 | } |
10 | 10 | |
11 | 11 | $POST_text = sys_get_param_str('text'); |
12 | -if($POST_text) { |
|
13 | - message(classLocale::$lang['members_who_recived_message'] . DBStaticMessages::msg_ali_send($POST_text, classLocale::$lang['ali_adm_msg_subject'], sys_get_param_int('r')), classLocale::$lang['Circular_sended'], "alliance.php", ''); |
|
12 | +if ($POST_text) { |
|
13 | + message(classLocale::$lang['members_who_recived_message'].DBStaticMessages::msg_ali_send($POST_text, classLocale::$lang['ali_adm_msg_subject'], sys_get_param_int('r')), classLocale::$lang['Circular_sended'], "alliance.php", ''); |
|
14 | 14 | } |
15 | 15 | |
16 | -$r_list = "<option value=\"-1\">" . classLocale::$lang['All_players'] . "</option>"; |
|
17 | -if($ranks) { |
|
18 | - foreach($ranks as $id => $array) { |
|
19 | - $r_list .= "<option value=\"" . $id . "\">" . $array['name'] . "</option>"; |
|
16 | +$r_list = "<option value=\"-1\">".classLocale::$lang['All_players']."</option>"; |
|
17 | +if ($ranks) { |
|
18 | + foreach ($ranks as $id => $array) { |
|
19 | + $r_list .= "<option value=\"".$id."\">".$array['name']."</option>"; |
|
20 | 20 | } |
21 | 21 | } |
22 | 22 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | $allow_anonymous = true; |
12 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
12 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
13 | 13 | |
14 | 14 | nws_mark_read($user); |
15 | 15 | $template = gettemplate('announce', true); |
@@ -21,41 +21,41 @@ discard block |
||
21 | 21 | $mode = sys_get_param_str('mode'); |
22 | 22 | |
23 | 23 | $announce = array(); |
24 | -if($user['authlevel'] >= 3) { |
|
25 | - if(!empty($text)) { |
|
24 | +if ($user['authlevel'] >= 3) { |
|
25 | + if (!empty($text)) { |
|
26 | 26 | $announce_time = strtotime($announce_time, SN_TIME_NOW); |
27 | 27 | $announce_time = $announce_time ? $announce_time : SN_TIME_NOW; |
28 | 28 | |
29 | - if($mode == 'edit') { |
|
29 | + if ($mode == 'edit') { |
|
30 | 30 | DBStaticNews::db_news_update_set($announce_time, $text, $detail_url, $announce_id); |
31 | 31 | DBStaticSurvey::db_survey_delete_by_id($announce_id); |
32 | 32 | } else { |
33 | 33 | DBStaticNews::db_news_insert_set($announce_time, $text, $detail_url, $user); |
34 | 34 | $announce_id = db_insert_id(); |
35 | 35 | } |
36 | - if(($survey_question = sys_get_param_str('survey_question')) && ($survey_answers = sys_get_param('survey_answers'))) { |
|
36 | + if (($survey_question = sys_get_param_str('survey_question')) && ($survey_answers = sys_get_param('survey_answers'))) { |
|
37 | 37 | $survey_answers = explode("\r\n", $survey_answers); |
38 | 38 | $survey_until = strtotime($survey_until = sys_get_param_str('survey_until'), SN_TIME_NOW); |
39 | 39 | $survey_until = date(FMT_DATE_TIME_SQL, $survey_until ? $survey_until : SN_TIME_NOW + PERIOD_DAY * 1); |
40 | 40 | DBStaticSurvey::db_survey_insert($announce_id, $survey_question, $survey_until); |
41 | 41 | $survey_id = db_insert_id(); |
42 | - foreach($survey_answers as $survey_answer) { |
|
42 | + foreach ($survey_answers as $survey_answer) { |
|
43 | 43 | $survey_answer = db_escape(trim($survey_answer)); |
44 | - if(empty($survey_answer)) { |
|
44 | + if (empty($survey_answer)) { |
|
45 | 45 | continue; |
46 | 46 | } |
47 | 47 | DBStaticSurveyAnswer::db_survey_answer_insert($survey_id, $survey_answer); |
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
51 | - if($announce_time <= SN_TIME_NOW) { |
|
52 | - if($announce_time > classSupernova::$config->var_news_last && $announce_time == SN_TIME_NOW) { |
|
51 | + if ($announce_time <= SN_TIME_NOW) { |
|
52 | + if ($announce_time > classSupernova::$config->var_news_last && $announce_time == SN_TIME_NOW) { |
|
53 | 53 | classSupernova::$config->db_saveItem('var_news_last', $announce_time); |
54 | 54 | } |
55 | 55 | |
56 | - if(sys_get_param_int('news_mass_mail')) { |
|
56 | + if (sys_get_param_int('news_mass_mail')) { |
|
57 | 57 | $lang_news_more = classLocale::$lang['news_more']; |
58 | - $text = sys_get_param('text') . ($detail_url ? " <a href=\"{$detail_url}\"><span class=\"positive\">{$lang_news_more}</span></a>" : ''); |
|
58 | + $text = sys_get_param('text').($detail_url ? " <a href=\"{$detail_url}\"><span class=\"positive\">{$lang_news_more}</span></a>" : ''); |
|
59 | 59 | DBStaticMessages::msgSendFromAdmin('*', classLocale::$lang['news_title'], $text); |
60 | 60 | } |
61 | 61 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | $survey_answers = ''; |
68 | - switch($mode) { |
|
68 | + switch ($mode) { |
|
69 | 69 | case 'del': |
70 | 70 | DBStaticNews::db_news_delete_by_id($announce_id); |
71 | 71 | $mode = ''; |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | $template->assign_var('ID', $announce_id); |
77 | 77 | case 'copy': |
78 | 78 | $announce = DBStaticNews::db_news_with_survey_select_by_id($announce_id); |
79 | - if($announce['survey_id']) { |
|
79 | + if ($announce['survey_id']) { |
|
80 | 80 | $query = DBStaticSurveyAnswer::db_survey_answer_text_select_by_news($announce); |
81 | - while($row = db_fetch($query)) { |
|
81 | + while ($row = db_fetch($query)) { |
|
82 | 82 | $survey_answers[] = $row['survey_answer_text']; |
83 | 83 | } |
84 | 84 | $survey_answers = implode("\r\n", $survey_answers); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | break; |
87 | 87 | } |
88 | 88 | } else { |
89 | - $annQuery = 'WHERE UNIX_TIMESTAMP(`tsTimeStamp`) <= ' . SN_TIME_NOW; |
|
89 | + $annQuery = 'WHERE UNIX_TIMESTAMP(`tsTimeStamp`) <= '.SN_TIME_NOW; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | nws_render($template, $annQuery, 20); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | $language_new = sys_get_param_str('langer', $user['lang']); |
14 | 14 | |
15 | - if($language_new != $user['lang']) { |
|
15 | + if ($language_new != $user['lang']) { |
|
16 | 16 | classLocale::$lang->lng_switch($language_new); |
17 | 17 | } |
18 | 18 | |
@@ -21,41 +21,41 @@ discard block |
||
21 | 21 | |
22 | 22 | $FMT_DATE = preg_replace(array('/d/', '/m/', '/Y/'), array('DD', 'MM', 'YYYY'), FMT_DATE); |
23 | 23 | |
24 | - if(sys_get_param_str('mode') == 'change') { |
|
25 | - if($user['authlevel'] > 0) { |
|
24 | + if (sys_get_param_str('mode') == 'change') { |
|
25 | + if ($user['authlevel'] > 0) { |
|
26 | 26 | $planet_protection = sys_get_param_int('adm_pl_prot') ? $user['authlevel'] : 0; |
27 | 27 | DBStaticPlanet::db_planet_set_by_owner($user['id'], "`id_level` = '{$planet_protection}'"); |
28 | 28 | DBStaticUser::db_user_set_by_id($user['id'], "`admin_protection` = '{$planet_protection}'"); |
29 | 29 | $user['admin_protection'] = $planet_protection; |
30 | 30 | } |
31 | 31 | |
32 | - if(sys_get_param_int('vacation') && !classSupernova::$config->user_vacation_disable) { |
|
32 | + if (sys_get_param_int('vacation') && !classSupernova::$config->user_vacation_disable) { |
|
33 | 33 | sn_db_transaction_start(); |
34 | - if($user['authlevel'] < 3) { |
|
35 | - if($user['vacation_next'] > SN_TIME_NOW) { |
|
34 | + if ($user['authlevel'] < 3) { |
|
35 | + if ($user['vacation_next'] > SN_TIME_NOW) { |
|
36 | 36 | message(classLocale::$lang['opt_vacation_err_timeout'], classLocale::$lang['Error'], 'index.php?page=options', 5); |
37 | 37 | die(); |
38 | 38 | } |
39 | 39 | |
40 | - if(FleetList::fleet_count_flying($user['id'])) { |
|
40 | + if (FleetList::fleet_count_flying($user['id'])) { |
|
41 | 41 | message(classLocale::$lang['opt_vacation_err_your_fleet'], classLocale::$lang['Error'], 'index.php?page=options', 5); |
42 | 42 | die(); |
43 | 43 | } |
44 | 44 | |
45 | 45 | $que = que_get($user['id'], false); |
46 | - if(!empty($que)) { |
|
46 | + if (!empty($que)) { |
|
47 | 47 | message(classLocale::$lang['opt_vacation_err_que'], classLocale::$lang['Error'], 'index.php?page=options', 5); |
48 | 48 | die(); |
49 | 49 | } |
50 | 50 | |
51 | 51 | $query = classSupernova::db_get_record_list(LOC_PLANET, "`id_owner` = {$user['id']}"); |
52 | - foreach($query as $planet) { |
|
52 | + foreach ($query as $planet) { |
|
53 | 53 | // $planet = sys_o_get_updated($user, $planet, SN_TIME_NOW); |
54 | 54 | // $planet = $planet['planet']; |
55 | 55 | |
56 | 56 | $classConfig = classSupernova::$config; |
57 | 57 | DBStaticPlanet::db_planet_set_by_id($planet['id'], |
58 | - "last_update = " . SN_TIME_NOW . ", energy_used = '0', energy_max = '0', |
|
58 | + "last_update = ".SN_TIME_NOW.", energy_used = '0', energy_max = '0', |
|
59 | 59 | metal_perhour = '{$classConfig->metal_basic_income}', crystal_perhour = '{$classConfig->crystal_basic_income}', deuterium_perhour = '{$classConfig->deuterium_basic_income}', |
60 | 60 | metal_mine_porcent = '0', crystal_mine_porcent = '0', deuterium_sintetizer_porcent = '0', solar_plant_porcent = '0', |
61 | 61 | fusion_plant_porcent = '0', solar_satelit_porcent = '0', ship_sattelite_sloth_porcent = 0" |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | sn_db_transaction_commit(); |
69 | 69 | } |
70 | 70 | |
71 | - foreach($user_option_list as $option_group_id => $option_group) { |
|
72 | - foreach($option_group as $option_name => $option_value) { |
|
73 | - if($user[$option_name] !== null) { |
|
71 | + foreach ($user_option_list as $option_group_id => $option_group) { |
|
72 | + foreach ($option_group as $option_name => $option_value) { |
|
73 | + if ($user[$option_name] !== null) { |
|
74 | 74 | $user[$option_name] = sys_get_param_str($option_name); |
75 | 75 | } else { |
76 | 76 | $user[$option_name] = $option_value; |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | |
82 | 82 | |
83 | 83 | $player_options = sys_get_param('options'); |
84 | - if(!empty($player_options)) { |
|
85 | - array_walk($player_options, function (&$value) { |
|
84 | + if (!empty($player_options)) { |
|
85 | + array_walk($player_options, function(&$value) { |
|
86 | 86 | // TODO - Когда будет больше параметров - сделать больше проверок |
87 | 87 | $value = intval($value); |
88 | 88 | }); |
@@ -93,15 +93,15 @@ discard block |
||
93 | 93 | |
94 | 94 | $username = substr(sys_get_param_str_unsafe('username'), 0, 32); |
95 | 95 | $username_safe = db_escape($username); |
96 | - if($username && $user['username'] != $username && classSupernova::$config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_NONE && sys_get_param_int('username_confirm') && !strpbrk($username, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) { |
|
96 | + if ($username && $user['username'] != $username && classSupernova::$config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_NONE && sys_get_param_int('username_confirm') && !strpbrk($username, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) { |
|
97 | 97 | // проверка на корректность |
98 | 98 | sn_db_transaction_start(); |
99 | 99 | $name_check = db_player_name_history_get_name_by_name($username_safe); |
100 | - if(!$name_check || $name_check['player_id'] == $user['id']) { |
|
100 | + if (!$name_check || $name_check['player_id'] == $user['id']) { |
|
101 | 101 | $user = DBStaticUser::db_user_by_id($user['id'], true); |
102 | - switch(classSupernova::$config->game_user_changename) { |
|
102 | + switch (classSupernova::$config->game_user_changename) { |
|
103 | 103 | case SERVER_PLAYER_NAME_CHANGE_PAY: |
104 | - if(mrc_get_level($user, $planetrow, RES_DARK_MATTER) < classSupernova::$config->game_user_changename_cost) { |
|
104 | + if (mrc_get_level($user, $planetrow, RES_DARK_MATTER) < classSupernova::$config->game_user_changename_cost) { |
|
105 | 105 | $template_result['.']['result'][] = array( |
106 | 106 | 'STATUS' => ERR_ERROR, |
107 | 107 | 'MESSAGE' => classLocale::$lang['opt_msg_name_change_err_no_dm'], |
@@ -131,18 +131,18 @@ discard block |
||
131 | 131 | sn_db_transaction_commit(); |
132 | 132 | } |
133 | 133 | |
134 | - if($new_password = sys_get_param('newpass1')) { |
|
134 | + if ($new_password = sys_get_param('newpass1')) { |
|
135 | 135 | try { |
136 | - if($new_password != sys_get_param('newpass2')) { |
|
136 | + if ($new_password != sys_get_param('newpass2')) { |
|
137 | 137 | throw new Exception(classLocale::$lang['opt_err_pass_unmatched'], ERR_WARNING); |
138 | 138 | } |
139 | 139 | |
140 | - if(!classSupernova::$auth->password_change(sys_get_param('db_password'), $new_password)) { |
|
140 | + if (!classSupernova::$auth->password_change(sys_get_param('db_password'), $new_password)) { |
|
141 | 141 | throw new Exception(classLocale::$lang['opt_err_pass_wrong'], ERR_WARNING); |
142 | 142 | } |
143 | 143 | |
144 | 144 | throw new Exception(classLocale::$lang['opt_msg_pass_changed'], ERR_NONE); |
145 | - } catch(Exception $e) { |
|
145 | + } catch (Exception $e) { |
|
146 | 146 | $template_result['.']['result'][] = array( |
147 | 147 | 'STATUS' => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR, |
148 | 148 | 'MESSAGE' => $e->getMessage() |
@@ -164,12 +164,12 @@ discard block |
||
164 | 164 | $user['gender'] = $user['gender'] == GENDER_UNKNOWN ? $gender : $user['gender']; |
165 | 165 | |
166 | 166 | try { |
167 | - if($user['birthday']) { |
|
167 | + if ($user['birthday']) { |
|
168 | 168 | throw new exception(); |
169 | 169 | } |
170 | 170 | |
171 | 171 | $user_birthday = sys_get_param_str_unsafe('user_birthday'); |
172 | - if(!$user_birthday || $user_birthday == $FMT_DATE) { |
|
172 | + if (!$user_birthday || $user_birthday == $FMT_DATE) { |
|
173 | 173 | throw new exception(); |
174 | 174 | } |
175 | 175 | |
@@ -179,16 +179,16 @@ discard block |
||
179 | 179 | $pos['Y'] = strpos(FMT_DATE, 'Y'); |
180 | 180 | asort($pos); |
181 | 181 | $i = 0; |
182 | - foreach($pos as &$position) { |
|
182 | + foreach ($pos as &$position) { |
|
183 | 183 | $position = ++$i; |
184 | 184 | } |
185 | 185 | |
186 | - $regexp = "/" . preg_replace(array('/\\\\/', '/\//', '/\./', '/\-/', '/d/', '/m/', '/Y/'), array('\\\\\\', '\/', '\.', '\-', '(\d?\d)', '(\d?\d)', '(\d{4})'), FMT_DATE) . "/"; |
|
187 | - if(!preg_match($regexp, $user_birthday, $match)) { |
|
186 | + $regexp = "/".preg_replace(array('/\\\\/', '/\//', '/\./', '/\-/', '/d/', '/m/', '/Y/'), array('\\\\\\', '\/', '\.', '\-', '(\d?\d)', '(\d?\d)', '(\d{4})'), FMT_DATE)."/"; |
|
187 | + if (!preg_match($regexp, $user_birthday, $match)) { |
|
188 | 188 | throw new exception(); |
189 | 189 | } |
190 | 190 | |
191 | - if(!checkdate($match[$pos['m']], $match[$pos['d']], $match[$pos['Y']])) { |
|
191 | + if (!checkdate($match[$pos['m']], $match[$pos['d']], $match[$pos['Y']])) { |
|
192 | 192 | throw new exception(); |
193 | 193 | } |
194 | 194 | |
@@ -196,13 +196,13 @@ discard block |
||
196 | 196 | // EOF black magic! Now we have valid SQL date in $user['user_birthday'] - independent of date format |
197 | 197 | |
198 | 198 | $year = date('Y', SN_TIME_NOW); |
199 | - if(mktime(0, 0, 0, $match[$pos['m']], $match[$pos['d']], $year) > SN_TIME_NOW) { |
|
199 | + if (mktime(0, 0, 0, $match[$pos['m']], $match[$pos['d']], $year) > SN_TIME_NOW) { |
|
200 | 200 | $year--; |
201 | 201 | } |
202 | 202 | $user['user_birthday_celebrated'] = db_escape("{$year}-{$match[$pos['m']]}-{$match[$pos['d']]}"); |
203 | 203 | |
204 | 204 | $user_birthday = ", `user_birthday` = '{$user['user_birthday']}', `user_birthday_celebrated` = '{$user['user_birthday_celebrated']}'"; |
205 | - } catch(exception $e) { |
|
205 | + } catch (exception $e) { |
|
206 | 206 | $user_birthday = ''; |
207 | 207 | } |
208 | 208 | |
@@ -212,14 +212,14 @@ discard block |
||
212 | 212 | $template_result['.']['result'][] = $avatar_upload_result; |
213 | 213 | |
214 | 214 | $user_time_diff = playerTimeDiff::user_time_diff_get(); |
215 | - if(sys_get_param_int('PLAYER_OPTION_TIME_DIFF_FORCED')) { |
|
215 | + if (sys_get_param_int('PLAYER_OPTION_TIME_DIFF_FORCED')) { |
|
216 | 216 | playerTimeDiff::user_time_diff_set(array( |
217 | 217 | PLAYER_OPTION_TIME_DIFF => sys_get_param_int('PLAYER_OPTION_TIME_DIFF'), |
218 | 218 | PLAYER_OPTION_TIME_DIFF_UTC_OFFSET => 0, |
219 | 219 | PLAYER_OPTION_TIME_DIFF_FORCED => 1, |
220 | 220 | PLAYER_OPTION_TIME_DIFF_MEASURE_TIME => SN_TIME_SQL, |
221 | 221 | )); |
222 | - } elseif(sys_get_param_int('opt_time_diff_clear') || $user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
222 | + } elseif (sys_get_param_int('opt_time_diff_clear') || $user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
223 | 223 | playerTimeDiff::user_time_diff_set(array( |
224 | 224 | PLAYER_OPTION_TIME_DIFF => '', |
225 | 225 | PLAYER_OPTION_TIME_DIFF_UTC_OFFSET => 0, |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | 'STATUS' => ERR_NONE, |
240 | 240 | 'MESSAGE' => classLocale::$lang['opt_msg_saved'] |
241 | 241 | ); |
242 | - } elseif(sys_get_param_str('result') == 'ok') { |
|
242 | + } elseif (sys_get_param_str('result') == 'ok') { |
|
243 | 243 | $template_result['.']['result'][] = array( |
244 | 244 | 'STATUS' => ERR_NONE, |
245 | 245 | 'MESSAGE' => classLocale::$lang['opt_msg_saved'] |
@@ -262,9 +262,9 @@ discard block |
||
262 | 262 | |
263 | 263 | $template = gettemplate('options', $template); |
264 | 264 | |
265 | - $dir = dir(SN_ROOT_PHYSICAL . 'skins'); |
|
266 | - while(($entry = $dir->read()) !== false) { |
|
267 | - if(is_dir("skins/{$entry}") && $entry[0] != '.') { |
|
265 | + $dir = dir(SN_ROOT_PHYSICAL.'skins'); |
|
266 | + while (($entry = $dir->read()) !== false) { |
|
267 | + if (is_dir("skins/{$entry}") && $entry[0] != '.') { |
|
268 | 268 | $template_result['.']['skin_list'][] = array( |
269 | 269 | 'VALUE' => $entry, |
270 | 270 | 'NAME' => $entry, |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | } |
275 | 275 | $dir->close(); |
276 | 276 | |
277 | - foreach(classLocale::$lang['opt_planet_sort_options'] as $key => &$value) { |
|
277 | + foreach (classLocale::$lang['opt_planet_sort_options'] as $key => &$value) { |
|
278 | 278 | $template_result['.']['planet_sort_options'][] = array( |
279 | 279 | 'VALUE' => $key, |
280 | 280 | 'NAME' => $value, |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | ); |
283 | 283 | } |
284 | 284 | |
285 | - foreach(classLocale::$lang['sys_gender_list'] as $key => $value) { |
|
285 | + foreach (classLocale::$lang['sys_gender_list'] as $key => $value) { |
|
286 | 286 | $template_result['.']['gender_list'][] = array( |
287 | 287 | 'VALUE' => $key, |
288 | 288 | 'NAME' => $value, |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | } |
292 | 292 | |
293 | 293 | $lang_list = lng_get_list(); |
294 | - foreach($lang_list as $lang_id => $lang_data) { |
|
294 | + foreach ($lang_list as $lang_id => $lang_data) { |
|
295 | 295 | $template_result['.']['languages'][] = array( |
296 | 296 | 'VALUE' => $lang_id, |
297 | 297 | 'NAME' => $lang_data['LANG_NAME_NATIVE'], |
@@ -300,8 +300,8 @@ discard block |
||
300 | 300 | } |
301 | 301 | |
302 | 302 | |
303 | - if(isset(classLocale::$lang['menu_customize_show_hide_button_state'])) { |
|
304 | - foreach(classLocale::$lang['menu_customize_show_hide_button_state'] as $key => $value) { |
|
303 | + if (isset(classLocale::$lang['menu_customize_show_hide_button_state'])) { |
|
304 | + foreach (classLocale::$lang['menu_customize_show_hide_button_state'] as $key => $value) { |
|
305 | 305 | $template->assign_block_vars('menu_customize_show_hide_button_state', array( |
306 | 306 | 'ID' => $key, |
307 | 307 | 'NAME' => $value, |
@@ -408,10 +408,10 @@ discard block |
||
408 | 408 | 'PAGE_HEADER' => classLocale::$lang['opt_header'], |
409 | 409 | )); |
410 | 410 | |
411 | - foreach($user_option_list as $option_group_id => $option_group) { |
|
412 | - if($option_group_id == OPT_MESSAGE) { |
|
413 | - foreach(DBStaticMessages::$snMessageClassList as $message_class_id => $message_class_data) { |
|
414 | - if($message_class_data['switchable'] || ($message_class_data['email'] && classSupernova::$config->game_email_pm)) { |
|
411 | + foreach ($user_option_list as $option_group_id => $option_group) { |
|
412 | + if ($option_group_id == OPT_MESSAGE) { |
|
413 | + foreach (DBStaticMessages::$snMessageClassList as $message_class_id => $message_class_data) { |
|
414 | + if ($message_class_data['switchable'] || ($message_class_data['email'] && classSupernova::$config->game_email_pm)) { |
|
415 | 415 | $option_name = $message_class_data['name']; |
416 | 416 | |
417 | 417 | $template->assign_block_vars("options_{$option_group_id}", array( |
@@ -423,8 +423,8 @@ discard block |
||
423 | 423 | } |
424 | 424 | } |
425 | 425 | } else { |
426 | - foreach($option_group as $option_name => $option_value) { |
|
427 | - if(array_key_exists($option_name, $user_option_types)) { |
|
426 | + foreach ($option_group as $option_name => $option_value) { |
|
427 | + if (array_key_exists($option_name, $user_option_types)) { |
|
428 | 428 | $option_type = $user_option_types[$option_name]; |
429 | 429 | } else { |
430 | 430 | $option_type = 'switch'; |