@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | define('DIR', __DIR__); |
| 21 | 21 | } |
| 22 | 22 | mb_internal_encoding('utf-8'); |
| 23 | -define('ROOT', getcwd()); //Path to site root |
|
| 23 | +define('ROOT', getcwd()); //Path to site root |
|
| 24 | 24 | $fs = json_decode(file_get_contents(DIR.'/fs.json'), true); |
| 25 | 25 | /** |
| 26 | 26 | * Special autoloader for installer |
@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | * Try to load classes from different places. If not found in one place - try in another. |
| 39 | 39 | */ |
| 40 | 40 | if ( |
| 41 | - strlen($file = @$fs[str_replace('//', '/', "core/classes/$namespace/$class_name.php")]) || //Core classes |
|
| 41 | + strlen($file = @$fs[str_replace('//', '/', "core/classes/$namespace/$class_name.php")]) || //Core classes |
|
| 42 | 42 | strlen($file = @$fs[str_replace('//', '/', "core/thirdparty/$namespace/$class_name.php")]) || //Third party classes |
| 43 | - strlen($file = @$fs[str_replace('//', '/', "core/traits/$namespace/$class_name.php")]) || //Core traits |
|
| 44 | - strlen($file = @$fs[str_replace('//', '/', "core/engines/$namespace/$class_name.php")]) || //Core engines |
|
| 43 | + strlen($file = @$fs[str_replace('//', '/', "core/traits/$namespace/$class_name.php")]) || //Core traits |
|
| 44 | + strlen($file = @$fs[str_replace('//', '/', "core/engines/$namespace/$class_name.php")]) || //Core engines |
|
| 45 | 45 | strlen($file = @$fs[str_replace('//', '/', "components/$namespace/$class_name.php")]) //Classes in modules and plugins |
| 46 | 46 | ) { |
| 47 | 47 | require_once DIR."/fs/$file"; |
@@ -27,8 +27,8 @@ discard block |
||
| 27 | 27 | protected $shortname; |
| 28 | 28 | |
| 29 | 29 | protected function construct () { |
| 30 | - $this->module = Request::instance()->current_module; |
|
| 31 | - $this->shortname = Config::instance()->module('Disqus')->shortname; |
|
| 30 | + $this->module = Request::instance()->current_module; |
|
| 31 | + $this->shortname = Config::instance()->module('Disqus')->shortname; |
|
| 32 | 32 | } |
| 33 | 33 | /** |
| 34 | 34 | * Set module (current module assumed by default) |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * @param string $module Module name |
| 37 | 37 | */ |
| 38 | 38 | function set_module ($module) { |
| 39 | - $this->module = $module; |
|
| 39 | + $this->module = $module; |
|
| 40 | 40 | } |
| 41 | 41 | /** |
| 42 | 42 | * Count of comments for specified item |
@@ -73,11 +73,11 @@ discard block |
||
| 73 | 73 | return '<div id="disqus_thread"></div>'; |
| 74 | 74 | } |
| 75 | 75 | protected function count_js () { |
| 76 | - static $added = false; |
|
| 76 | + static $added = false; |
|
| 77 | 77 | if ($added) { |
| 78 | 78 | return; |
| 79 | 79 | } |
| 80 | - $added = true; |
|
| 80 | + $added = true; |
|
| 81 | 81 | Page::instance()->js( |
| 82 | 82 | "var disqus_shortname = '$this->shortname'; |
| 83 | 83 | if (!window.disqus_count_items) { window.disqus_count_items = []; }", |
@@ -85,11 +85,11 @@ discard block |
||
| 85 | 85 | ); |
| 86 | 86 | } |
| 87 | 87 | protected function block_js ($item) { |
| 88 | - static $added = false; |
|
| 88 | + static $added = false; |
|
| 89 | 89 | if ($added) { |
| 90 | 90 | return; |
| 91 | 91 | } |
| 92 | - $added = true; |
|
| 92 | + $added = true; |
|
| 93 | 93 | Page::instance()->js( |
| 94 | 94 | "var disqus_shortname = '$this->shortname', disqus_identifier = '".str_replace("'", "\'", "$this->module/$item")."';", |
| 95 | 95 | 'code' |
@@ -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; |