@@ -27,7 +27,7 @@ |
||
27 | 27 | public function onOpen (ConnectionInterface $conn, RequestInterface $request = null) { |
28 | 28 | $L = Language::instance(); |
29 | 29 | /** @noinspection PhpUndefinedFieldInspection */ |
30 | - $ip = $this->ip( |
|
30 | + $ip = $this->ip( |
|
31 | 31 | [ |
32 | 32 | $conn->remoteAddress, |
33 | 33 | $request->getHeader('X-Forwarded-For'), |
@@ -9,8 +9,8 @@ |
||
9 | 9 | use |
10 | 10 | cs\Language; |
11 | 11 | /** |
12 | - * Class for simplified work with languages, when using common prefix |
|
13 | - */ |
|
12 | + * Class for simplified work with languages, when using common prefix |
|
13 | + */ |
|
14 | 14 | class Prefix { |
15 | 15 | /** |
16 | 16 | * @var string |
@@ -281,7 +281,7 @@ |
||
281 | 281 | $module_data['active'] == Config\Module_Properties::ENABLED; |
282 | 282 | } |
283 | 283 | ); |
284 | - $L = Language::instance(); |
|
284 | + $L = Language::instance(); |
|
285 | 285 | foreach ($modules as $module => &$localized_name) { |
286 | 286 | $localized_name = path($L->$module); |
287 | 287 | } |
@@ -108,7 +108,7 @@ |
||
108 | 108 | * If match was not found - mirror is not allowed! |
109 | 109 | */ |
110 | 110 | if ($this->mirror_index === -1) { |
111 | - throw new ExitException("Mirror $this->host not allowed", 400); |
|
111 | + throw new ExitException("mirror $this->host not allowed", 400); |
|
112 | 112 | } |
113 | 113 | $results = $this->analyze_route_path($this->path); |
114 | 114 | $this->handle_redirect($Config, $results['path_normalized']); |
@@ -54,8 +54,7 @@ |
||
54 | 54 | * |
55 | 55 | * @throws ExitException |
56 | 56 | */ |
57 | - function init ($server, $query, $data, $files, $data_stream, $cookie, $request_started) { |
|
58 | - ++static::$id; |
|
57 | + function init ($server, $query, $data, $files, $data_stream, $cookie, $request_started) {++static::$id; |
|
59 | 58 | $this->init_server($server); |
60 | 59 | $this->init_query($query); |
61 | 60 | $this->init_data_and_files($data, $files, $data_stream); |
@@ -172,43 +172,43 @@ |
||
172 | 172 | return; |
173 | 173 | } |
174 | 174 | switch ($_GET['response_type']) { |
175 | - case 'code': |
|
176 | - $Response->redirect( |
|
177 | - http_build_url( |
|
178 | - urldecode($redirect_uri), |
|
179 | - [ |
|
180 | - 'code' => $code, |
|
181 | - 'state' => isset($_GET['state']) ? $_GET['state'] : false |
|
182 | - ] |
|
183 | - ), |
|
184 | - 302 |
|
185 | - ); |
|
186 | - $Page->Content = ''; |
|
187 | - return; |
|
188 | - case 'token': |
|
189 | - $token_data = $OAuth2->get_code($code, $client['id'], $client['secret'], $redirect_uri); |
|
190 | - if ($token_data) { |
|
191 | - unset($token_data['refresh_token']); |
|
175 | + case 'code': |
|
192 | 176 | $Response->redirect( |
193 | - uri_for_token( |
|
194 | - http_build_url( |
|
195 | - urldecode($redirect_uri), |
|
196 | - array_merge( |
|
197 | - $token_data, |
|
198 | - [ |
|
199 | - 'state' => isset($_GET['state']) ? $_GET['state'] : false |
|
200 | - ] |
|
201 | - ) |
|
202 | - ) |
|
177 | + http_build_url( |
|
178 | + urldecode($redirect_uri), |
|
179 | + [ |
|
180 | + 'code' => $code, |
|
181 | + 'state' => isset($_GET['state']) ? $_GET['state'] : false |
|
182 | + ] |
|
203 | 183 | ), |
204 | 184 | 302 |
205 | 185 | ); |
206 | 186 | $Page->Content = ''; |
207 | 187 | return; |
208 | - } else { |
|
209 | - error_redirect('server_error', "Server can't get token data, try later"); |
|
210 | - return; |
|
211 | - } |
|
212 | - default: |
|
213 | - error_redirect('unsupported_response_type', 'Specified response_type is not supported, only "token" or "code" types available'); |
|
188 | + case 'token': |
|
189 | + $token_data = $OAuth2->get_code($code, $client['id'], $client['secret'], $redirect_uri); |
|
190 | + if ($token_data) { |
|
191 | + unset($token_data['refresh_token']); |
|
192 | + $Response->redirect( |
|
193 | + uri_for_token( |
|
194 | + http_build_url( |
|
195 | + urldecode($redirect_uri), |
|
196 | + array_merge( |
|
197 | + $token_data, |
|
198 | + [ |
|
199 | + 'state' => isset($_GET['state']) ? $_GET['state'] : false |
|
200 | + ] |
|
201 | + ) |
|
202 | + ) |
|
203 | + ), |
|
204 | + 302 |
|
205 | + ); |
|
206 | + $Page->Content = ''; |
|
207 | + return; |
|
208 | + } else { |
|
209 | + error_redirect('server_error', "Server can't get token data, try later"); |
|
210 | + return; |
|
211 | + } |
|
212 | + default: |
|
213 | + error_redirect('unsupported_response_type', 'Specified response_type is not supported, only "token" or "code" types available'); |
|
214 | 214 | } |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | * Try to load classes from different places. If not found in one place - try in another. |
41 | 41 | */ |
42 | 42 | if ( |
43 | - _require_once($file = DIR."/core/classes/$namespace/$class_name.php", false) || //Core classes |
|
43 | + _require_once($file = DIR."/core/classes/$namespace/$class_name.php", false) || //Core classes |
|
44 | 44 | _require_once($file = DIR."/core/thirdparty/$namespace/$class_name.php", false) || //Third party classes |
45 | - _require_once($file = DIR."/core/traits/$namespace/$class_name.php", false) || //Core traits |
|
46 | - _require_once($file = ENGINES."/$namespace/$class_name.php", false) || //Core engines |
|
47 | - _require_once($file = MODULES."/../$namespace/$class_name.php", false) || //Classes in modules |
|
45 | + _require_once($file = DIR."/core/traits/$namespace/$class_name.php", false) || //Core traits |
|
46 | + _require_once($file = ENGINES."/$namespace/$class_name.php", false) || //Core engines |
|
47 | + _require_once($file = MODULES."/../$namespace/$class_name.php", false) || //Classes in modules |
|
48 | 48 | _require_once($file = PLUGINS."/../$namespace/$class_name.php", false) //Classes in plugins |
49 | 49 | ) { |
50 | 50 | $cache[$class] = realpath($file); |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | ] |
434 | 434 | ); |
435 | 435 | }; |
436 | - $render_page_item = function ($i) use ($page, $url, $head_links, $render_head_links) { |
|
436 | + $render_page_item = function ($i) use ($page, $url, $head_links, $render_head_links) { |
|
437 | 437 | if ($head_links) { |
438 | 438 | $render_head_links($i); |
439 | 439 | } |
@@ -217,7 +217,7 @@ |
||
217 | 217 | * |
218 | 218 | * @return array|false |
219 | 219 | */ |
220 | - protected static function &get_block_by_index ($index) { |
|
220 | + protected static function &get_block_by_index($index) { |
|
221 | 221 | foreach (Config::instance()->components['blocks'] as &$block) { |
222 | 222 | if ($block['index'] == $index) { |
223 | 223 | return $block; |
@@ -25,7 +25,7 @@ |
||
25 | 25 | use |
26 | 26 | CRUD, |
27 | 27 | Singleton; |
28 | - protected $data_model = [ |
|
28 | + protected $data_model = [ |
|
29 | 29 | 'id' => 'int:0', |
30 | 30 | 'user' => 'int:0', |
31 | 31 | 'date' => 'int:0', |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | CRUD, |
26 | 26 | Singleton; |
27 | 27 | |
28 | - protected $data_model = [ |
|
28 | + protected $data_model = [ |
|
29 | 29 | 'id' => 'int:0', |
30 | 30 | 'parent' => 'int:0', |
31 | 31 | 'title' => 'ml:text', |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $structure['title'] = $L->root_section; |
106 | 106 | $structure['posts'] = Posts::instance()->get_for_section_count($structure['id']); |
107 | 107 | } |
108 | - $sections = $this->db()->qfa( |
|
108 | + $sections = $this->db()->qfa( |
|
109 | 109 | [ |
110 | 110 | "SELECT |
111 | 111 | `id`, |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | $section['parent'] |
266 | 266 | ] |
267 | 267 | ) ?: $section['parent']; |
268 | - $update = $this->db_prime()->q( |
|
268 | + $update = $this->db_prime()->q( |
|
269 | 269 | [ |
270 | 270 | "UPDATE `[prefix]blogs_sections` |
271 | 271 | SET `parent` = '%2\$d' |