@@ -23,7 +23,9 @@ |
||
23 | 23 | * DO NOT CHANGE |
24 | 24 | */ |
25 | 25 | |
26 | -if (!defined('INSIDE')) die(); |
|
26 | +if (!defined('INSIDE')) { |
|
27 | + die(); |
|
28 | +} |
|
27 | 29 | |
28 | 30 | //$lang = array_merge($lang, |
29 | 31 | //$lang->merge( |
@@ -19,7 +19,7 @@ |
||
19 | 19 | $query = DBStaticUnit::db_unit_list_laboratories($user['id']); |
20 | 20 | while ($row = db_fetch($query)) { |
21 | 21 | if (!eco_unit_busy($user, $row, UNIT_TECHNOLOGIES)) { |
22 | - $row += array( |
|
22 | + $row += array( |
|
23 | 23 | STRUC_LABORATORY => $level_lab = mrc_get_level($user, $row, STRUC_LABORATORY), |
24 | 24 | STRUC_LABORATORY_NANO => $level_lab_nano = mrc_get_level($user, $row, STRUC_LABORATORY_NANO), |
25 | 25 | 'laboratory_effective_level' => $level_lab * pow(2, $level_lab_nano), |
@@ -332,7 +332,7 @@ |
||
332 | 332 | $time_left = min(floor($time_left / PERIOD_DAY), $term_original); |
333 | 333 | $cost_left = $term_original > 0 ? ceil($time_left / $term_original * $original_cost) : 0; |
334 | 334 | |
335 | - array_walk_recursive($result, function (&$value) use ($cost_left) { |
|
335 | + array_walk_recursive($result, function(&$value) use ($cost_left) { |
|
336 | 336 | $value -= $cost_left; |
337 | 337 | }); |
338 | 338 | } |
@@ -262,7 +262,7 @@ |
||
262 | 262 | foreach ($planets as $planetId => $planet) { |
263 | 263 | $templatizedPlanet = tpl_parse_planet($user, $planet); |
264 | 264 | |
265 | - if($planet['planet_type'] == PT_MOON) { |
|
265 | + if ($planet['planet_type'] == PT_MOON) { |
|
266 | 266 | $parentPlanet = DBStaticPlanet::db_planet_by_id($planet['parent_planet']); |
267 | 267 | } else { |
268 | 268 | $parentPlanet = $planet; |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -define('INSIDE' , true); |
|
4 | -define('INSTALL' , false); |
|
3 | +define('INSIDE', true); |
|
4 | +define('INSTALL', false); |
|
5 | 5 | define('IN_ADMIN', true); |
6 | 6 | |
7 | 7 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | SnTemplate::messageBoxAdminAccessDenied(AUTH_LEVEL_ADMINISTRATOR); |
12 | 12 | |
13 | 13 | $planet_active = sys_get_param_int('planet_active'); |
14 | -if(!$planet_active) { |
|
14 | +if (!$planet_active) { |
|
15 | 15 | $planet_type = sys_get_param_int('planet_type', 1); |
16 | 16 | $planet_type = $planet_type == 3 ? 3 : 1; |
17 | 17 | } else { |
@@ -40,8 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | $page_title = |
42 | 42 | $lang['adm_planet_list_title'] . ': ' . |
43 | - ($planet_active ? $lang['adm_planet_active'] : |
|
44 | - ($planet_type ? ($planet_type == 3 ? $lang['sys_moons'] : $lang['sys_planets']) : '') |
|
43 | + ($planet_active ? $lang['adm_planet_active'] : ($planet_type ? ($planet_type == 3 ? $lang['sys_moons'] : $lang['sys_planets']) : '') |
|
45 | 44 | ); |
46 | 45 | $template->assign_vars(array( |
47 | 46 | 'PAGE_TITLE' => $page_title, |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | include_once('common.' . substr(strrchr(__FILE__, '.'), 1)); |
4 | 4 | |
5 | -if(SN::$gc->modules->countModulesInGroup('payment') && !SN_GOOGLE) { |
|
5 | +if (SN::$gc->modules->countModulesInGroup('payment') && !SN_GOOGLE) { |
|
6 | 6 | sys_redirect('metamatter.php'); |
7 | 7 | } |
8 | 8 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @return DbMysqliResultIterator|EmptyCountableIterator |
19 | 19 | */ |
20 | 20 | public static function dbFleetsOnHoldOnPlanetsByIds($planetIds, $time = SN_TIME_NOW) { |
21 | - if(empty($planetIds) || !is_array($planetIds)) { |
|
21 | + if (empty($planetIds) || !is_array($planetIds)) { |
|
22 | 22 | return new EmptyCountableIterator(); |
23 | 23 | } |
24 | 24 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $speeds = array(); |
42 | 42 | if (!empty($fleet)) { |
43 | 43 | foreach ($fleet as $ship_id => $amount) { |
44 | - if ($amount && in_array($ship_id, sn_get_groups(['fleet', 'missile',]))) { |
|
44 | + if ($amount && in_array($ship_id, sn_get_groups(['fleet', 'missile', ]))) { |
|
45 | 45 | $single_ship_data = !empty($shipData[$ship_id]) ? $shipData[$ship_id] : get_ship_data($ship_id, $user); |
46 | 46 | $speeds[] = $single_ship_data['speed']; |
47 | 47 | } |
@@ -136,7 +136,7 @@ |
||
136 | 136 | // var_dump($fallBackPath); |
137 | 137 | // var_dump($template); |
138 | 138 | |
139 | - if(empty($fallBackPath)) { |
|
139 | + if (empty($fallBackPath)) { |
|
140 | 140 | if (!$this->parent || empty($fallbackName = $this->parent->getName()) || !$this->isTemplateExists()) { |
141 | 141 | // If no parent template - then using default template as fallback one |
142 | 142 | $fallbackName = SnTemplate::SN_TEMPLATE_NAME_DEFAULT; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $this->sql_index_field = "{$table_name}_name"; |
41 | 41 | $this->sql_value_field = "{$table_name}_value"; |
42 | 42 | |
43 | - if(!$this->_DB_LOADED) { |
|
43 | + if (!$this->_DB_LOADED) { |
|
44 | 44 | $this->db_loadAll(); |
45 | 45 | } |
46 | 46 | } |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function db_loadItem($index) { |
62 | 62 | $result = null; |
63 | - if($index) { |
|
63 | + if ($index) { |
|
64 | 64 | $index_safe = SN::$db->db_escape($index); |
65 | 65 | $queryResult = doquery("SELECT `{$this->sql_value_field}` FROM `{{{$this->table_name}}}` WHERE `{$this->sql_index_field}` = '{$index_safe}' FOR UPDATE", true); |
66 | - if(is_array($queryResult) && !empty($queryResult)) { |
|
66 | + if (is_array($queryResult) && !empty($queryResult)) { |
|
67 | 67 | $this->$index = $result = $queryResult[$this->sql_value_field]; |
68 | 68 | } |
69 | 69 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $this->loadDefaults(); |
76 | 76 | |
77 | 77 | $query = doquery("SELECT * FROM {{{$this->table_name}}} FOR UPDATE;"); |
78 | - while($row = db_fetch($query)) { |
|
78 | + while ($row = db_fetch($query)) { |
|
79 | 79 | $this[$row[$this->sql_index_field]] = $row[$this->sql_value_field]; |
80 | 80 | } |
81 | 81 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | public function loadDefaults() { |
86 | - foreach($this->defaults as $defName => $defValue) { |
|
86 | + foreach ($this->defaults as $defName => $defValue) { |
|
87 | 87 | $this->$defName = $defValue; |
88 | 88 | } |
89 | 89 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | public function db_saveItem($item_list, $value = NULL) { |
96 | - if(empty($item_list)) { |
|
96 | + if (empty($item_list)) { |
|
97 | 97 | return; |
98 | 98 | } |
99 | 99 | |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | |
102 | 102 | // Сначала записываем данные в базу - что бы поймать все блокировки |
103 | 103 | $qry = array(); |
104 | - foreach($item_list as $item_name => $item_value) { |
|
105 | - if($item_name) { |
|
104 | + foreach ($item_list as $item_name => $item_value) { |
|
105 | + if ($item_name) { |
|
106 | 106 | $item_value = SN::$db->db_escape($item_value === NULL ? $this->$item_name : $item_value); |
107 | 107 | $item_name = SN::$db->db_escape($item_name); |
108 | 108 | $qry[] = "('{$item_name}', '{$item_value}')"; |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | doquery("REPLACE INTO `{{" . $this->table_name . "}}` (`{$this->sql_index_field}`, `{$this->sql_value_field}`) VALUES " . implode(',', $qry) . ";"); |
112 | 112 | |
113 | 113 | // И только после взятия блокировок - меняем значения в кэше |
114 | - foreach($item_list as $item_name => $item_value) { |
|
115 | - if($item_name && $item_value !== null) { |
|
114 | + foreach ($item_list as $item_name => $item_value) { |
|
115 | + if ($item_name && $item_value !== null) { |
|
116 | 116 | $this->__set($item_name, $item_value); |
117 | 117 | } |
118 | 118 | } |
@@ -140,14 +140,14 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | public function __get($name) { |
143 | - if($this->force) { |
|
143 | + if ($this->force) { |
|
144 | 144 | $this->force = false; |
145 | 145 | $value = $this->db_loadItem($name); |
146 | 146 | } else { |
147 | 147 | $value = parent::__get($name); |
148 | 148 | } |
149 | 149 | |
150 | - if(isset($this->notEmptyFields[$name]) && empty($value) && isset($this->defaults[$name])) { |
|
150 | + if (isset($this->notEmptyFields[$name]) && empty($value) && isset($this->defaults[$name])) { |
|
151 | 151 | $value = $this->defaults[$name]; |
152 | 152 | } |
153 | 153 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | public function __set($name, $value) { |
158 | - if($this->force) { |
|
158 | + if ($this->force) { |
|
159 | 159 | $this->force = false; |
160 | 160 | $this->db_saveItem($name, $value); |
161 | 161 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $this->db_saveItem(array_combine(array_keys($this->defaults), array_fill(0, count($this->defaults), null))); |
93 | 93 | } |
94 | 94 | |
95 | - public function db_saveItem($item_list, $value = NULL) { |
|
95 | + public function db_saveItem($item_list, $value = null) { |
|
96 | 96 | if(empty($item_list)) { |
97 | 97 | return; |
98 | 98 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $qry = array(); |
104 | 104 | foreach($item_list as $item_name => $item_value) { |
105 | 105 | if($item_name) { |
106 | - $item_value = SN::$db->db_escape($item_value === NULL ? $this->$item_name : $item_value); |
|
106 | + $item_value = SN::$db->db_escape($item_value === null ? $this->$item_name : $item_value); |
|
107 | 107 | $item_name = SN::$db->db_escape($item_name); |
108 | 108 | $qry[] = "('{$item_name}', '{$item_value}')"; |
109 | 109 | } |