@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | function db_change_units_perform($query, $tablename, $object_id) { |
13 | 13 | $query = implode(',', $query); |
14 | - if($query && $object_id) { |
|
14 | + if ($query && $object_id) { |
|
15 | 15 | return classSupernova::db_upd_record_by_id($tablename == 'users' ? LOC_USER : LOC_PLANET, $object_id, $query); |
16 | 16 | // return doquery("UPDATE {{{$tablename}}} SET {$query} WHERE `id` = '{$object_id}' LIMIT 1;"); |
17 | 17 | } |
@@ -28,15 +28,15 @@ discard block |
||
28 | 28 | |
29 | 29 | $group = sn_get_groups('resources_loot'); |
30 | 30 | |
31 | - foreach($unit_list as $unit_id => $unit_amount) { |
|
32 | - if(!in_array($unit_id, $group)) { |
|
31 | + foreach ($unit_list as $unit_id => $unit_amount) { |
|
32 | + if (!in_array($unit_id, $group)) { |
|
33 | 33 | // TODO - remove later |
34 | 34 | print('<h1>СООБЩИТЕ ЭТО АДМИНУ: db_change_units() вызван для не-ресурсов!</h1>'); |
35 | 35 | pdump(debug_backtrace()); |
36 | 36 | die('db_change_units() вызван для не-ресурсов!'); |
37 | 37 | } |
38 | 38 | |
39 | - if(!$unit_amount) { |
|
39 | + if (!$unit_amount) { |
|
40 | 40 | continue; |
41 | 41 | } |
42 | 42 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $unit_location = sys_get_unit_location($user, $planet, $unit_id); |
46 | 46 | |
47 | 47 | // Changing value in object |
48 | - switch($unit_location) { |
|
48 | + switch ($unit_location) { |
|
49 | 49 | case LOC_USER: |
50 | 50 | $user[$unit_db_name] += $unit_amount; |
51 | 51 | break; |
@@ -67,23 +67,23 @@ discard block |
||
67 | 67 | $field_set = ''; |
68 | 68 | $value_set = ''; |
69 | 69 | |
70 | - switch($type) { |
|
70 | + switch ($type) { |
|
71 | 71 | case 'delete': |
72 | 72 | $query = 'DELETE FROM'; |
73 | 73 | break; |
74 | 74 | |
75 | 75 | case 'insert': |
76 | 76 | $query = 'INSERT INTO'; |
77 | - if(isset($options['__multi'])) { |
|
77 | + if (isset($options['__multi'])) { |
|
78 | 78 | // Here we generate mass-insert set |
79 | 79 | break; |
80 | 80 | } |
81 | 81 | case 'update': |
82 | - if(!$query) { |
|
82 | + if (!$query) { |
|
83 | 83 | $query = 'UPDATE'; |
84 | 84 | } |
85 | 85 | |
86 | - foreach($values as $field => &$value) { |
|
86 | + foreach ($values as $field => &$value) { |
|
87 | 87 | $value_type = gettype($value); |
88 | 88 | if ($value_type == 'string') { |
89 | 89 | $value = "'" . db_escape($value) . "'"; |
@@ -111,12 +111,12 @@ discard block |
||
111 | 111 | $field_set['__IS_SAFE'] = true; |
112 | 112 | } |
113 | 113 | function sn_db_field_set_make_safe($field_set, $serialize = false) { |
114 | - if(!is_array($field_set)) { |
|
114 | + if (!is_array($field_set)) { |
|
115 | 115 | die('$field_set is not an array!'); |
116 | 116 | } |
117 | 117 | |
118 | 118 | $result = array(); |
119 | - foreach($field_set as $field => $value) { |
|
119 | + foreach ($field_set as $field => $value) { |
|
120 | 120 | $field = db_escape(trim($field)); |
121 | 121 | switch (true) { |
122 | 122 | case is_int($value): |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | require SN_ROOT_PHYSICAL . 'config.php'; |
92 | 92 | |
93 | 93 | $module_config_array = get_class($this) . '_config'; |
94 | - if(!empty($$module_config_array) && is_array($$module_config_array)) { |
|
94 | + if (!empty($$module_config_array) && is_array($$module_config_array)) { |
|
95 | 95 | $this->config = $$module_config_array; |
96 | 96 | return true; |
97 | 97 | } |
@@ -110,15 +110,15 @@ discard block |
||
110 | 110 | |
111 | 111 | // TODO: Load configuration from DB. Manifest setting |
112 | 112 | // Trying to load configuration from file |
113 | - if(!$config_exists = $this->loadModuleRootConfig()) { |
|
113 | + if (!$config_exists = $this->loadModuleRootConfig()) { |
|
114 | 114 | // Конфигурация может лежать в config_path в манифеста или в корне модуля |
115 | - if(isset($this->manifest['config_path']) && file_exists($config_filename = $this->manifest['config_path'] . '/config.php')) { |
|
115 | + if (isset($this->manifest['config_path']) && file_exists($config_filename = $this->manifest['config_path'] . '/config.php')) { |
|
116 | 116 | $config_exists = true; |
117 | - } elseif(file_exists($config_filename = dirname($filename) . '/config.php')) { |
|
117 | + } elseif (file_exists($config_filename = dirname($filename) . '/config.php')) { |
|
118 | 118 | $config_exists = true; |
119 | 119 | } |
120 | 120 | |
121 | - if($config_exists) { |
|
121 | + if ($config_exists) { |
|
122 | 122 | include($config_filename); |
123 | 123 | $module_config_array = $class_module_name . '_config'; |
124 | 124 | $this->config = $$module_config_array; |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | } |
131 | 131 | |
132 | 132 | protected function __patch_menu(&$sn_menu_extra, &$menu_patch) { |
133 | - if(isset($menu_patch) && is_array($menu_patch) && !empty($menu_patch)) { |
|
134 | - foreach($menu_patch as $menu_item_name => $menu_item_data) { |
|
133 | + if (isset($menu_patch) && is_array($menu_patch) && !empty($menu_patch)) { |
|
134 | + foreach ($menu_patch as $menu_item_name => $menu_item_data) { |
|
135 | 135 | $sn_menu_extra[$menu_item_name] = $menu_item_data; |
136 | 136 | } |
137 | 137 | } |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | public function initialize() { |
142 | 142 | // Checking module status - is it installed and active |
143 | 143 | $this->check_status(); |
144 | - if(!$this->manifest['active']) { |
|
144 | + if (!$this->manifest['active']) { |
|
145 | 145 | return; |
146 | 146 | } |
147 | 147 | |
148 | 148 | // Setting constants - if any |
149 | - if(isset($this->manifest['constants']) && is_array($this->manifest['constants']) && !empty($this->manifest['constants'])) { |
|
150 | - foreach($this->manifest['constants'] as $constant_name => $constant_value) { |
|
149 | + if (isset($this->manifest['constants']) && is_array($this->manifest['constants']) && !empty($this->manifest['constants'])) { |
|
150 | + foreach ($this->manifest['constants'] as $constant_name => $constant_value) { |
|
151 | 151 | defined($constant_name) or define($constant_name, $constant_value); |
152 | 152 | } |
153 | 153 | } |
@@ -158,34 +158,34 @@ discard block |
||
158 | 158 | // New values from module variables will overwrite previous values (for root variables) and array elements with corresponding indexes (for arrays) |
159 | 159 | // Constants as array indexes are honored - it's make valid such declarations as 'sn_data[ques][QUE_STRUCTURES]' |
160 | 160 | $this->manifest['vars'] = $this->__assign_vars(); |
161 | - if(!empty($this->manifest['vars'])) { |
|
161 | + if (!empty($this->manifest['vars'])) { |
|
162 | 162 | $vars_assigned = array(); |
163 | - foreach($this->manifest['vars'] as $var_name => $var_value) { |
|
163 | + foreach ($this->manifest['vars'] as $var_name => $var_value) { |
|
164 | 164 | $sub_vars = explode('[', str_replace(']', '', $var_name)); |
165 | 165 | $var_name = $sub_vars[0]; |
166 | 166 | |
167 | - if(!isset($vars_assigned[$var_name])) { |
|
167 | + if (!isset($vars_assigned[$var_name])) { |
|
168 | 168 | $vars_assigned[$var_name] = true; |
169 | 169 | global $$var_name; |
170 | 170 | } |
171 | 171 | |
172 | 172 | $pointer = &$$var_name; |
173 | - if(($n = count($sub_vars)) > 1) { |
|
174 | - for($i = 1; $i < $n; $i++) { |
|
175 | - if(defined($sub_vars[$i])) { |
|
173 | + if (($n = count($sub_vars)) > 1) { |
|
174 | + for ($i = 1; $i < $n; $i++) { |
|
175 | + if (defined($sub_vars[$i])) { |
|
176 | 176 | $sub_vars[$i] = constant($sub_vars[$i]); |
177 | 177 | } |
178 | 178 | |
179 | - if(!isset($pointer[$sub_vars[$i]]) && $i != $n) { |
|
179 | + if (!isset($pointer[$sub_vars[$i]]) && $i != $n) { |
|
180 | 180 | $pointer[$sub_vars[$i]] = array(); |
181 | 181 | } |
182 | 182 | $pointer = &$pointer[$sub_vars[$i]]; |
183 | 183 | } |
184 | 184 | } |
185 | 185 | |
186 | - if(!isset($pointer) || !is_array($pointer)) { |
|
186 | + if (!isset($pointer) || !is_array($pointer)) { |
|
187 | 187 | $pointer = $var_value; |
188 | - } elseif(is_array($$var_name)) { |
|
188 | + } elseif (is_array($$var_name)) { |
|
189 | 189 | $pointer = array_merge_recursive_numeric($pointer, $var_value); |
190 | 190 | } |
191 | 191 | } |
@@ -201,44 +201,44 @@ discard block |
||
201 | 201 | isset($this->manifest['menu_admin']) and $this->__patch_menu($sn_menu_admin_extra, $this->manifest['menu_admin']); |
202 | 202 | |
203 | 203 | global $sn_mvc; |
204 | - foreach($sn_mvc as $handler_type => &$handler_data) { |
|
204 | + foreach ($sn_mvc as $handler_type => &$handler_data) { |
|
205 | 205 | sn_sys_handler_add($handler_data, $this->manifest['mvc'][$handler_type], $this, $handler_type); |
206 | 206 | } |
207 | 207 | |
208 | - if(isset($this->manifest['i18n']) && is_array($this->manifest['i18n']) && !empty($this->manifest['i18n'])) { |
|
209 | - foreach($this->manifest['i18n'] as $i18n_page_name => &$i18n_file_list) { |
|
210 | - foreach($i18n_file_list as &$i18n_file_data) { |
|
211 | - if(is_array($i18n_file_data) && !$i18n_file_data['path']) { |
|
208 | + if (isset($this->manifest['i18n']) && is_array($this->manifest['i18n']) && !empty($this->manifest['i18n'])) { |
|
209 | + foreach ($this->manifest['i18n'] as $i18n_page_name => &$i18n_file_list) { |
|
210 | + foreach ($i18n_file_list as &$i18n_file_data) { |
|
211 | + if (is_array($i18n_file_data) && !$i18n_file_data['path']) { |
|
212 | 212 | $i18n_file_data['path'] = $this->manifest['root_relative']; |
213 | 213 | } |
214 | 214 | } |
215 | - if(!isset($sn_mvc['i18n'][$i18n_page_name])) { |
|
215 | + if (!isset($sn_mvc['i18n'][$i18n_page_name])) { |
|
216 | 216 | $sn_mvc['i18n'][$i18n_page_name] = array(); |
217 | 217 | } |
218 | 218 | $sn_mvc['i18n'][$i18n_page_name] += $i18n_file_list; |
219 | 219 | } |
220 | 220 | } |
221 | 221 | |
222 | - if(!empty($this->manifest['javascript']) && is_array($this->manifest['javascript'])) { |
|
223 | - foreach($this->manifest['javascript'] as $javascript_page_name => &$javascript_list) { |
|
222 | + if (!empty($this->manifest['javascript']) && is_array($this->manifest['javascript'])) { |
|
223 | + foreach ($this->manifest['javascript'] as $javascript_page_name => &$javascript_list) { |
|
224 | 224 | !isset($sn_mvc['javascript'][$javascript_page_name]) ? $sn_mvc['javascript'][$javascript_page_name] = array() : false; |
225 | - foreach($javascript_list as $script_name => &$script_content) { |
|
225 | + foreach ($javascript_list as $script_name => &$script_content) { |
|
226 | 226 | $sn_mvc['javascript'][$javascript_page_name][$script_name] = $script_content; |
227 | 227 | } |
228 | 228 | } |
229 | 229 | } |
230 | 230 | |
231 | - if(!empty($this->manifest['css']) && is_array($this->manifest['css'])) { |
|
232 | - foreach($this->manifest['css'] as $javascript_page_name => &$javascript_list) { |
|
231 | + if (!empty($this->manifest['css']) && is_array($this->manifest['css'])) { |
|
232 | + foreach ($this->manifest['css'] as $javascript_page_name => &$javascript_list) { |
|
233 | 233 | !isset($sn_mvc['css'][$javascript_page_name]) ? $sn_mvc['css'][$javascript_page_name] = array() : false; |
234 | - foreach($javascript_list as $script_name => &$script_content) { |
|
234 | + foreach ($javascript_list as $script_name => &$script_content) { |
|
235 | 235 | $sn_mvc['css'][$javascript_page_name][$script_name] = $script_content; |
236 | 236 | } |
237 | 237 | } |
238 | 238 | } |
239 | 239 | |
240 | - if(!empty($this->manifest['navbar_prefix_button']) && is_array($this->manifest['navbar_prefix_button'])) { |
|
241 | - foreach($this->manifest['navbar_prefix_button'] as $button_image => $button_url_relative) { |
|
240 | + if (!empty($this->manifest['navbar_prefix_button']) && is_array($this->manifest['navbar_prefix_button'])) { |
|
241 | + foreach ($this->manifest['navbar_prefix_button'] as $button_image => $button_url_relative) { |
|
242 | 242 | $sn_mvc['navbar_prefix_button'][$button_image] = $button_url_relative; |
243 | 243 | } |
244 | 244 | } |
@@ -50,16 +50,16 @@ discard block |
||
50 | 50 | function log_file($message, $ident_change = 0) { |
51 | 51 | static $ident = 0; |
52 | 52 | |
53 | - if(!defined('SN_DEBUG_LOG')) { |
|
53 | + if (!defined('SN_DEBUG_LOG')) { |
|
54 | 54 | return; |
55 | 55 | } |
56 | 56 | |
57 | - if($this->log_file_handler === null) { |
|
57 | + if ($this->log_file_handler === null) { |
|
58 | 58 | $this->log_file_handler = @fopen(SN_ROOT_PHYSICAL . '/.logs/supernova.log', 'a+'); |
59 | 59 | @fwrite($this->log_file_handler, "\r\n\r\n"); |
60 | 60 | } |
61 | 61 | $ident_change < 0 ? $ident += $ident_change * 2 : false; |
62 | - if($this->log_file_handler) { |
|
62 | + if ($this->log_file_handler) { |
|
63 | 63 | @fwrite($this->log_file_handler, date(FMT_DATE_TIME_SQL, time()) . str_repeat(' ', $ident + 1) . $message . "\r\n"); |
64 | 64 | } |
65 | 65 | $ident_change > 0 ? $ident += $ident_change * 2 : false; |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | $result = array(); |
91 | 91 | $transaction_id = classSupernova::db_transaction_check(false) ? classSupernova::$transaction_id : classSupernova::$transaction_id++; |
92 | 92 | $result[] = "tID {$transaction_id}"; |
93 | - foreach($backtrace as $a_trace) { |
|
94 | - if(in_array($a_trace['function'], $exclude_functions)) { |
|
93 | + foreach ($backtrace as $a_trace) { |
|
94 | + if (in_array($a_trace['function'], $exclude_functions)) { |
|
95 | 95 | continue; |
96 | 96 | } |
97 | 97 | $function = |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | // $result[] = "{$function} ({$a_trace['line']})'{$file}'"; |
109 | 109 | $result[] = "{$function} - '{$file}' Line {$a_trace['line']}"; |
110 | 110 | |
111 | - if(!$long_comment) { |
|
111 | + if (!$long_comment) { |
|
112 | 112 | break; |
113 | 113 | } |
114 | 114 | } |
@@ -120,26 +120,26 @@ discard block |
||
120 | 120 | } |
121 | 121 | |
122 | 122 | function dump($dump = false, $force_base = false, $deadlock = false) { |
123 | - if($dump === false) { |
|
123 | + if ($dump === false) { |
|
124 | 124 | return; |
125 | 125 | } |
126 | 126 | |
127 | 127 | $error_backtrace = array(); |
128 | 128 | $base_dump = false; |
129 | 129 | |
130 | - if($force_base === true) { |
|
130 | + if ($force_base === true) { |
|
131 | 131 | $base_dump = true; |
132 | 132 | } |
133 | 133 | |
134 | - if($dump === true) { |
|
134 | + if ($dump === true) { |
|
135 | 135 | $base_dump = true; |
136 | 136 | } else { |
137 | - if(!is_array($dump)) { |
|
137 | + if (!is_array($dump)) { |
|
138 | 138 | $dump = array('var' => $dump); |
139 | 139 | } |
140 | 140 | |
141 | - foreach($dump as $dump_var_name => $dump_var) { |
|
142 | - if($dump_var_name == 'base_dump') { |
|
141 | + foreach ($dump as $dump_var_name => $dump_var) { |
|
142 | + if ($dump_var_name == 'base_dump') { |
|
143 | 143 | $base_dump = $dump_var; |
144 | 144 | } else { |
145 | 145 | $error_backtrace[$dump_var_name] = $dump_var; |
@@ -148,26 +148,25 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | // if($deadlock && ($q = db_fetch(classSupernova::$db->__db_query('SHOW ENGINE INNODB STATUS')))) { |
151 | - if($deadlock && ($q = db_fetch(classSupernova::$db->mysql_get_innodb_status()))) { |
|
151 | + if ($deadlock && ($q = db_fetch(classSupernova::$db->mysql_get_innodb_status()))) { |
|
152 | 152 | $error_backtrace['deadlock'] = explode("\n", $q['Status']); |
153 | 153 | $error_backtrace['locks'] = classSupernova::$locks; |
154 | 154 | $error_backtrace['cSN_data'] = classSupernova::$data; |
155 | - foreach($error_backtrace['cSN_data'] as &$location) { |
|
156 | - foreach($location as $location_id => &$location_data) // $location_data = $location_id; |
|
155 | + foreach ($error_backtrace['cSN_data'] as &$location) { |
|
156 | + foreach ($location as $location_id => &$location_data) // $location_data = $location_id; |
|
157 | 157 | { |
158 | - $location_data = isset($location_data['username']) ? $location_data['username'] : |
|
159 | - (isset($location_data['name']) ? $location_data['name'] : $location_id); |
|
158 | + $location_data = isset($location_data['username']) ? $location_data['username'] : (isset($location_data['name']) ? $location_data['name'] : $location_id); |
|
160 | 159 | } |
161 | 160 | } |
162 | 161 | $error_backtrace['cSN_queries'] = classSupernova::$queries; |
163 | 162 | } |
164 | 163 | |
165 | - if($base_dump) { |
|
166 | - if(is_array($this->log_array) && count($this->log_array) > 0) { |
|
164 | + if ($base_dump) { |
|
165 | + if (is_array($this->log_array) && count($this->log_array) > 0) { |
|
167 | 166 | // ; |
168 | 167 | // } |
169 | 168 | // { |
170 | - foreach($this->log_array as $log) { |
|
169 | + foreach ($this->log_array as $log) { |
|
171 | 170 | $error_backtrace['queries'][] = $log; |
172 | 171 | } |
173 | 172 | } |
@@ -198,14 +197,14 @@ discard block |
||
198 | 197 | function error($message = 'There is a error on page', $title = 'Internal Error', $error_code = 500, $dump = true) { |
199 | 198 | global $config, $sys_stop_log_hit, $lang, $sys_log_disabled, $user; |
200 | 199 | |
201 | - if(empty(classSupernova::$db->connected)) { |
|
200 | + if (empty(classSupernova::$db->connected)) { |
|
202 | 201 | // TODO - писать ошибку в файл |
203 | 202 | die('SQL server currently unavailable. Please contact Administration...'); |
204 | 203 | } |
205 | 204 | |
206 | 205 | sn_db_transaction_rollback(); |
207 | 206 | |
208 | - if($config->debug == 1) { |
|
207 | + if ($config->debug == 1) { |
|
209 | 208 | echo "<h2>{$title}</h2><br><font color=red>{$message}</font><br><hr>"; |
210 | 209 | echo "<table>{$this->log}</table>"; |
211 | 210 | } |
@@ -215,7 +214,7 @@ discard block |
||
215 | 214 | $error_text = db_escape($message); |
216 | 215 | $error_backtrace = $this->dump($dump, true, strpos($message, 'Deadlock') !== false); |
217 | 216 | |
218 | - if(!$sys_log_disabled) { |
|
217 | + if (!$sys_log_disabled) { |
|
219 | 218 | $query = "INSERT INTO `{{logs}}` SET |
220 | 219 | `log_time` = '" . time() . "', `log_code` = '" . db_escape($error_code) . "', `log_sender` = '" . db_escape($user['id']) . "', |
221 | 220 | `log_username` = '" . db_escape($user['user_name']) . "', `log_title` = '" . db_escape($title) . "', `log_text` = '" . db_escape($message) . "', |
@@ -233,7 +232,7 @@ discard block |
||
233 | 232 | ob_start(); |
234 | 233 | print("<hr>User ID {$user['id']} raised error code {$error_code} titled '{$title}' with text '{$error_text}' on page {$_SERVER['SCRIPT_NAME']}"); |
235 | 234 | |
236 | - foreach($error_backtrace as $name => $value) { |
|
235 | + foreach ($error_backtrace as $name => $value) { |
|
237 | 236 | print(__DEBUG_LINE); |
238 | 237 | pdump($value, $name); |
239 | 238 | } |
@@ -245,14 +244,14 @@ discard block |
||
245 | 244 | function warning($message, $title = 'System Message', $log_code = 300, $dump = false) { |
246 | 245 | global $user, $lang, $sys_log_disabled; |
247 | 246 | |
248 | - if(empty(classSupernova::$db->connected)) { |
|
247 | + if (empty(classSupernova::$db->connected)) { |
|
249 | 248 | // TODO - писать ошибку в файл |
250 | 249 | die('SQL server currently unavailable. Please contact Administration...'); |
251 | 250 | } |
252 | 251 | |
253 | 252 | $error_backtrace = $this->dump($dump, false); |
254 | 253 | |
255 | - if(!$sys_log_disabled) { |
|
254 | + if (!$sys_log_disabled) { |
|
256 | 255 | $query = "INSERT INTO `{{logs}}` SET |
257 | 256 | `log_time` = '" . time() . "', `log_code` = '" . db_escape($log_code) . "', `log_sender` = '" . db_escape($user['id']) . "', |
258 | 257 | `log_username` = '" . db_escape($user['user_name']) . "', `log_title` = '" . db_escape($title) . "', `log_text` = '" . db_escape($message) . "', |
@@ -270,11 +269,11 @@ discard block |
||
270 | 269 | // Dump variables nicer then var_dump() |
271 | 270 | |
272 | 271 | function dump($value, $varname = null, $level = 0, $dumper = '') { |
273 | - if(isset($varname)) { |
|
272 | + if (isset($varname)) { |
|
274 | 273 | $varname .= " = "; |
275 | 274 | } |
276 | 275 | |
277 | - if($level == -1) { |
|
276 | + if ($level == -1) { |
|
278 | 277 | $trans[' '] = '∴'; |
279 | 278 | $trans["\t"] = '⇒'; |
280 | 279 | $trans["\n"] = '¶;'; |
@@ -283,7 +282,7 @@ discard block |
||
283 | 282 | |
284 | 283 | return strtr(htmlspecialchars($value), $trans); |
285 | 284 | } |
286 | - if($level == 0) { |
|
285 | + if ($level == 0) { |
|
287 | 286 | // $dumper = '<pre>' . mt_rand(10, 99) . '|' . $varname; |
288 | 287 | $dumper = mt_rand(10, 99) . '|' . $varname; |
289 | 288 | } |
@@ -291,22 +290,22 @@ discard block |
||
291 | 290 | $type = gettype($value); |
292 | 291 | $dumper .= $type; |
293 | 292 | |
294 | - if($type == 'string') { |
|
293 | + if ($type == 'string') { |
|
295 | 294 | $dumper .= '(' . strlen($value) . ')'; |
296 | 295 | $value = dump($value, '', -1); |
297 | - } elseif($type == 'boolean') { |
|
296 | + } elseif ($type == 'boolean') { |
|
298 | 297 | $value = ($value ? 'true' : 'false'); |
299 | - } elseif($type == 'object') { |
|
298 | + } elseif ($type == 'object') { |
|
300 | 299 | $props = get_class_vars(get_class($value)); |
301 | 300 | $dumper .= '(' . count($props) . ') <u>' . get_class($value) . '</u>'; |
302 | - foreach($props as $key => $val) { |
|
301 | + foreach ($props as $key => $val) { |
|
303 | 302 | $dumper .= "\n" . str_repeat("\t", $level + 1) . $key . ' => '; |
304 | 303 | $dumper .= dump($value->$key, '', $level + 1); |
305 | 304 | } |
306 | 305 | $value = ''; |
307 | - } elseif($type == 'array') { |
|
306 | + } elseif ($type == 'array') { |
|
308 | 307 | $dumper .= '(' . count($value) . ')'; |
309 | - foreach($value as $key => $val) { |
|
308 | + foreach ($value as $key => $val) { |
|
310 | 309 | $dumper .= "\n" . str_repeat("\t", $level + 1) . dump($key, '', -1) . ' => '; |
311 | 310 | $dumper .= dump($val, '', $level + 1); |
312 | 311 | } |
@@ -326,7 +325,7 @@ discard block |
||
326 | 325 | // $backtrace = $backtrace[1]; |
327 | 326 | |
328 | 327 | $caller = ''; |
329 | - if(defined('SN_DEBUG_PDUMP_CALLER') && SN_DEBUG_PDUMP_CALLER) { |
|
328 | + if (defined('SN_DEBUG_PDUMP_CALLER') && SN_DEBUG_PDUMP_CALLER) { |
|
330 | 329 | $caller = (!empty($backtrace[1]['class']) ? $backtrace[1]['class'] : '') . |
331 | 330 | (!empty($backtrace[1]['type']) ? $backtrace[1]['type'] : '') . |
332 | 331 | $backtrace[1]['function'] . |
@@ -353,7 +352,7 @@ discard block |
||
353 | 352 | } |
354 | 353 | |
355 | 354 | function pr($prePrint = false) { |
356 | - if($prePrint) { |
|
355 | + if ($prePrint) { |
|
357 | 356 | print(__DEBUG_CRLF); |
358 | 357 | } |
359 | 358 | print(mt_rand() . __DEBUG_CRLF); |
@@ -363,7 +362,7 @@ discard block |
||
363 | 362 | global $_PRINT_COUNT_VALUE; |
364 | 363 | $_PRINT_COUNT_VALUE++; |
365 | 364 | |
366 | - if($prePrint) { |
|
365 | + if ($prePrint) { |
|
367 | 366 | print(__DEBUG_CRLF); |
368 | 367 | } |
369 | 368 | print($_PRINT_COUNT_VALUE . __DEBUG_CRLF); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | 'shield' => 10, |
36 | 36 | 'armor' => 400, |
37 | 37 | 'attack' => 5, |
38 | - 'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250, ), |
|
38 | + 'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250,), |
|
39 | 39 | ), |
40 | 40 | SHIP_CARGO_BIG => array( |
41 | 41 | 'name' => 'big_ship_cargo', |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | 'shield' => 25, |
56 | 56 | 'armor' => 1200, |
57 | 57 | 'attack' => 5, |
58 | - 'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250, ), |
|
58 | + 'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250,), |
|
59 | 59 | 'engine' => array( |
60 | 60 | array( |
61 | 61 | 'tech' => TECH_ENGINE_CHEMICAL, |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | 'shield' => 50, |
84 | 84 | 'armor' => 3000, |
85 | 85 | 'attack' => 10, |
86 | - 'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250, ), |
|
86 | + 'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250,), |
|
87 | 87 | 'engine' => array( |
88 | 88 | array( |
89 | 89 | 'tech' => TECH_ENGINE_ION, |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | 'shield' => 200, |
112 | 112 | 'armor' => 70000, |
113 | 113 | 'attack' => 50, |
114 | - 'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250, ), |
|
114 | + 'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250,), |
|
115 | 115 | 'engine' => array( |
116 | 116 | array( |
117 | 117 | 'tech' => TECH_ENGINE_HYPER, |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | 'shield' => 100, |
141 | 141 | 'armor' => 3000, |
142 | 142 | 'attack' => 50, |
143 | - 'amplify' => array(SHIP_SPY => 10.001, SHIP_SATTELITE_SOLAR => 21, ), |
|
143 | + 'amplify' => array(SHIP_SPY => 10.001, SHIP_SATTELITE_SOLAR => 21,), |
|
144 | 144 | 'engine' => array( |
145 | 145 | array( |
146 | 146 | 'tech' => TECH_ENGINE_ION, |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | 'shield' => 10, |
169 | 169 | 'armor' => 1600, |
170 | 170 | 'attack' => 1, |
171 | - 'amplify' => array(SHIP_SPY => 500.05, SHIP_SATTELITE_SOLAR => 1050, ), |
|
171 | + 'amplify' => array(SHIP_SPY => 500.05, SHIP_SATTELITE_SOLAR => 1050,), |
|
172 | 172 | 'engine' => array( |
173 | 173 | array( |
174 | 174 | 'tech' => TECH_ENGINE_CHEMICAL, |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | 'shield' => 0.01, |
197 | 197 | 'armor' => 100, |
198 | 198 | 'attack' => 0.01, |
199 | - 'amplify' => array( SHIP_SPY => 1,), |
|
199 | + 'amplify' => array(SHIP_SPY => 1,), |
|
200 | 200 | 'engine' => array( |
201 | 201 | array( |
202 | 202 | 'tech' => TECH_ENGINE_CHEMICAL, |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | 'factor' => 1, |
221 | 221 | ), |
222 | 222 | P_UNIT_PRODUCTION => array( |
223 | - RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return ($planet_row["temp_max"] / 4 + 20) * $level * (0.1 * $production_factor);}, |
|
223 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return ($planet_row["temp_max"] / 4 + 20) * $level * (0.1 * $production_factor); }, |
|
224 | 224 | ), |
225 | 225 | P_MINING_IS_MANAGED => true, |
226 | 226 | |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | 'shield' => 10, |
230 | 230 | 'armor' => 200, |
231 | 231 | 'attack' => 1, |
232 | - 'amplify' => array(SHIP_SPY => 1, ), |
|
232 | + 'amplify' => array(SHIP_SPY => 1,), |
|
233 | 233 | 'engine' => array( |
234 | 234 | array( |
235 | 235 | 'tech' => TECH_ENGINE_CHEMICAL, |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | 'shield' => 10, |
262 | 262 | 'armor' => 400, |
263 | 263 | 'attack' => 50, |
264 | - 'amplify' => array(SHIP_CARGO_SMALL => 16.4, SHIP_SPY => 10.001, SHIP_SATTELITE_SOLAR => 21, ), |
|
264 | + 'amplify' => array(SHIP_CARGO_SMALL => 16.4, SHIP_SPY => 10.001, SHIP_SATTELITE_SOLAR => 21,), |
|
265 | 265 | 'engine' => array( |
266 | 266 | array( |
267 | 267 | 'tech' => TECH_ENGINE_CHEMICAL, |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | 'shield' => 25, |
291 | 291 | 'armor' => 1000, |
292 | 292 | 'attack' => 150, |
293 | - 'amplify' => array(SHIP_CARGO_SMALL => 8.2, SHIP_SPY => 3.33367, SHIP_SATTELITE_SOLAR => 7, ), |
|
293 | + 'amplify' => array(SHIP_CARGO_SMALL => 8.2, SHIP_SPY => 3.33367, SHIP_SATTELITE_SOLAR => 7,), |
|
294 | 294 | 'engine' => array( |
295 | 295 | array( |
296 | 296 | 'tech' => TECH_ENGINE_ION, |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | 'shield' => 50, |
350 | 350 | 'armor' => 2700, |
351 | 351 | 'attack' => 400, |
352 | - 'amplify' => array(SHIP_SMALL_FIGHTER_LIGHT => 6.15, SHIP_SPY => 1.25013, SHIP_SATTELITE_SOLAR => 2.625, UNIT_DEF_TURRET_MISSILE => 5.5, ), |
|
352 | + 'amplify' => array(SHIP_SMALL_FIGHTER_LIGHT => 6.15, SHIP_SPY => 1.25013, SHIP_SATTELITE_SOLAR => 2.625, UNIT_DEF_TURRET_MISSILE => 5.5,), |
|
353 | 353 | 'engine' => array( |
354 | 354 | array( |
355 | 355 | 'tech' => TECH_ENGINE_ION, |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | 'shield' => 200, |
409 | 409 | 'armor' => 6000, |
410 | 410 | 'attack' => 1000, |
411 | - 'amplify' => array(SHIP_SPY => 0.50005, SHIP_SATTELITE_SOLAR => 1.05, UNIT_DEF_TURRET_MISSILE => 1.76, ), |
|
411 | + 'amplify' => array(SHIP_SPY => 0.50005, SHIP_SATTELITE_SOLAR => 1.05, UNIT_DEF_TURRET_MISSILE => 1.76,), |
|
412 | 412 | 'engine' => array( |
413 | 413 | array( |
414 | 414 | 'tech' => TECH_ENGINE_HYPER, |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | 'shield' => 500, |
505 | 505 | 'armor' => 11000, |
506 | 506 | 'attack' => 2000, |
507 | - 'amplify' => array(SHIP_SPY => 0.25003, SHIP_SATTELITE_SOLAR => 0.525, SHIP_LARGE_BATTLESHIP => 7.4, UNIT_DEF_TURRET_LASER_SMALL => 1.125, ), |
|
507 | + 'amplify' => array(SHIP_SPY => 0.25003, SHIP_SATTELITE_SOLAR => 0.525, SHIP_LARGE_BATTLESHIP => 7.4, UNIT_DEF_TURRET_LASER_SMALL => 1.125,), |
|
508 | 508 | 'engine' => array( |
509 | 509 | array( |
510 | 510 | 'tech' => TECH_ENGINE_HYPER, |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | 'shield' => 20, |
609 | 609 | 'armor' => 200, |
610 | 610 | 'attack' => 80, |
611 | - 'amplify' => array(SHIP_SPY => 7, ), |
|
611 | + 'amplify' => array(SHIP_SPY => 7,), |
|
612 | 612 | ), |
613 | 613 | UNIT_DEF_TURRET_LASER_SMALL => array( |
614 | 614 | 'name' => 'small_laser', |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | 'shield' => 25, |
627 | 627 | 'armor' => 200, |
628 | 628 | 'attack' => 100, |
629 | - 'amplify' => array(SHIP_SPY => 5, ), |
|
629 | + 'amplify' => array(SHIP_SPY => 5,), |
|
630 | 630 | ), |
631 | 631 | UNIT_DEF_TURRET_LASER_BIG => array( |
632 | 632 | 'name' => 'big_laser', |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | 'shield' => 100, |
645 | 645 | 'armor' => 800, |
646 | 646 | 'attack' => 250, |
647 | - 'amplify' => array(SHIP_SPY => 2, ), |
|
647 | + 'amplify' => array(SHIP_SPY => 2,), |
|
648 | 648 | ), |
649 | 649 | UNIT_DEF_TURRET_GAUSS => array( |
650 | 650 | 'name' => 'gauss_canyon', |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | 'armor' => 3500, |
663 | 663 | 'shield' => 200, |
664 | 664 | 'attack' => 1100, |
665 | - 'amplify' => array(SHIP_SPY => 0.5, ), |
|
665 | + 'amplify' => array(SHIP_SPY => 0.5,), |
|
666 | 666 | ), |
667 | 667 | UNIT_DEF_TURRET_ION => array( |
668 | 668 | 'name' => 'ionic_canyon', |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | 'shield' => 500, |
681 | 681 | 'armor' => 800, |
682 | 682 | 'attack' => 150, |
683 | - 'amplify' => array(SHIP_SPY => 3.3, ), |
|
683 | + 'amplify' => array(SHIP_SPY => 3.3,), |
|
684 | 684 | ), |
685 | 685 | UNIT_DEF_TURRET_PLASMA => array( |
686 | 686 | 'name' => 'buster_canyon', |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | 'shield' => 300, |
699 | 699 | 'armor' => 10000, |
700 | 700 | 'attack' => 3000, |
701 | - 'amplify' => array(SHIP_SPY => 0.17, ), |
|
701 | + 'amplify' => array(SHIP_SPY => 0.17,), |
|
702 | 702 | ), |
703 | 703 | |
704 | 704 | UNIT_DEF_SHIELD_SMALL => array( |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | 'shield' => 2000, |
719 | 719 | 'armor' => 2000, |
720 | 720 | 'attack' => 1, |
721 | - 'amplify' => array(SHIP_SPY => 500, ), |
|
721 | + 'amplify' => array(SHIP_SPY => 500,), |
|
722 | 722 | ), |
723 | 723 | UNIT_DEF_SHIELD_BIG => array( |
724 | 724 | 'name' => 'big_protection_shield', |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | 'shield' => 2000, |
738 | 738 | 'armor' => 10000, |
739 | 739 | 'attack' => 1, |
740 | - 'amplify' => array(SHIP_SPY => 500, ), |
|
740 | + 'amplify' => array(SHIP_SPY => 500,), |
|
741 | 741 | ), |
742 | 742 | UNIT_DEF_SHIELD_PLANET => array( |
743 | 743 | 'name' => 'planet_protector', |