@@ -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' |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $module_data = Config::instance()->module('Photo_gallery'); |
| 39 | 39 | if (!$module_data->directory_created) { |
| 40 | 40 | $this->storage()->mkdir('Photo_gallery'); |
| 41 | - $module_data->directory_created = 1; |
|
| 41 | + $module_data->directory_created = 1; |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | /** |
@@ -69,12 +69,12 @@ discard block |
||
| 69 | 69 | function get ($id) { |
| 70 | 70 | if (is_array($id)) { |
| 71 | 71 | foreach ($id as &$i) { |
| 72 | - $i = $this->get($i); |
|
| 72 | + $i = $this->get($i); |
|
| 73 | 73 | } |
| 74 | 74 | return $id; |
| 75 | 75 | } |
| 76 | - $L = Language::instance(); |
|
| 77 | - $id = (int)$id; |
|
| 76 | + $L = Language::instance(); |
|
| 77 | + $id = (int)$id; |
|
| 78 | 78 | return $this->cache->get("images/$id/$L->clang", function () use ($id) { |
| 79 | 79 | $data = $this->db()->qf( |
| 80 | 80 | "SELECT |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | $id |
| 93 | 93 | ); |
| 94 | 94 | if ($data) { |
| 95 | - $data['title'] = $this->ml_process($data['title']); |
|
| 96 | - $data['description'] = $this->ml_process($data['description']); |
|
| 95 | + $data['title'] = $this->ml_process($data['title']); |
|
| 96 | + $data['description'] = $this->ml_process($data['description']); |
|
| 97 | 97 | } |
| 98 | 98 | return $data; |
| 99 | 99 | }); |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | if (!filter_var($original, FILTER_VALIDATE_URL)) { |
| 116 | 116 | return false; |
| 117 | 117 | } |
| 118 | - $gallery = (int)$gallery; |
|
| 118 | + $gallery = (int)$gallery; |
|
| 119 | 119 | if ($this->db_prime()->q( |
| 120 | 120 | "INSERT INTO `[prefix]photo_gallery_images` |
| 121 | 121 | ( |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | time(), |
| 137 | 137 | $original |
| 138 | 138 | )) { |
| 139 | - $id = $this->db_prime()->id(); |
|
| 139 | + $id = $this->db_prime()->id(); |
|
| 140 | 140 | if ($this->set($id, $title, $description)) { |
| 141 | 141 | Event::instance()->fire( |
| 142 | 142 | 'System/upload_files/add_tag', |
@@ -145,10 +145,10 @@ discard block |
||
| 145 | 145 | 'url' => $original |
| 146 | 146 | ] |
| 147 | 147 | ); |
| 148 | - $hash = md5(random_bytes(1000)); |
|
| 149 | - $tmp_file = TEMP.'/'.User::instance()->id."_$hash"; |
|
| 148 | + $hash = md5(random_bytes(1000)); |
|
| 149 | + $tmp_file = TEMP.'/'.User::instance()->id."_$hash"; |
|
| 150 | 150 | try { |
| 151 | - $SimpleImage = new SimpleImage($original); |
|
| 151 | + $SimpleImage = new SimpleImage($original); |
|
| 152 | 152 | $SimpleImage->thumbnail(256)->save($tmp_file = "$tmp_file.".$SimpleImage->get_original_info()['format']); |
| 153 | 153 | unset($SimpleImage); |
| 154 | 154 | } catch (Exception $e) { |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | trigger_error($e->getMessage(), E_USER_WARNING); |
| 157 | 157 | return false; |
| 158 | 158 | } |
| 159 | - $storage = $this->storage(); |
|
| 159 | + $storage = $this->storage(); |
|
| 160 | 160 | if (!$storage->file_exists("Photo_gallery/$gallery")) { |
| 161 | 161 | $storage->mkdir("Photo_gallery/$gallery"); |
| 162 | 162 | } |
@@ -198,10 +198,10 @@ discard block |
||
| 198 | 198 | * @return bool |
| 199 | 199 | */ |
| 200 | 200 | function set ($id, $title, $description) { |
| 201 | - $User = User::instance(); |
|
| 202 | - $id = (int)$id; |
|
| 203 | - $title = xap(trim($title)); |
|
| 204 | - $description = xap(trim($description)); |
|
| 201 | + $User = User::instance(); |
|
| 202 | + $id = (int)$id; |
|
| 203 | + $title = xap(trim($title)); |
|
| 204 | + $description = xap(trim($description)); |
|
| 205 | 205 | if ($this->db_prime()->q( |
| 206 | 206 | "UPDATE `[prefix]photo_gallery_images` |
| 207 | 207 | SET |
@@ -233,8 +233,8 @@ discard block |
||
| 233 | 233 | * @return bool |
| 234 | 234 | */ |
| 235 | 235 | function del ($id) { |
| 236 | - $id = (int)$id; |
|
| 237 | - $data = $this->get($id); |
|
| 236 | + $id = (int)$id; |
|
| 237 | + $data = $this->get($id); |
|
| 238 | 238 | if ($this->db_prime()->q( |
| 239 | 239 | "DELETE FROM `[prefix]photo_gallery_images` |
| 240 | 240 | WHERE `id` = $id |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | if ($data['preview']) { |
| 252 | 252 | $this->storage()->unlink($this->storage()->source_by_url($data['preview'])); |
| 253 | 253 | } |
| 254 | - $Cache = $this->cache; |
|
| 254 | + $Cache = $this->cache; |
|
| 255 | 255 | unset( |
| 256 | 256 | $Cache->{"images/$id"}, |
| 257 | 257 | $Cache->{"galleries/$data[gallery]"} |
@@ -298,12 +298,12 @@ discard block |
||
| 298 | 298 | function get_gallery ($id) { |
| 299 | 299 | if (is_array($id)) { |
| 300 | 300 | foreach ($id as &$i) { |
| 301 | - $i = $this->get_gallery($i); |
|
| 301 | + $i = $this->get_gallery($i); |
|
| 302 | 302 | } |
| 303 | 303 | return $id; |
| 304 | 304 | } |
| 305 | - $L = Language::instance(); |
|
| 306 | - $id = (int)$id; |
|
| 305 | + $L = Language::instance(); |
|
| 306 | + $id = (int)$id; |
|
| 307 | 307 | return $this->cache->get("galleries/$id/$L->clang", function () use ($id) { |
| 308 | 308 | if ($data = $this->db()->qf( |
| 309 | 309 | "SELECT |
@@ -323,17 +323,17 @@ discard block |
||
| 323 | 323 | LIMIT 1", |
| 324 | 324 | $id |
| 325 | 325 | )) { |
| 326 | - $data['title'] = $this->ml_process($data['title']); |
|
| 327 | - $data['path'] = $this->ml_process($data['path']); |
|
| 328 | - $data['description'] = $this->ml_process($data['description']); |
|
| 329 | - $order = $data['preview_image'] == 'first' ? 'ASC' : 'DESC'; |
|
| 330 | - $data['preview'] = $this->db()->qfs( |
|
| 326 | + $data['title'] = $this->ml_process($data['title']); |
|
| 327 | + $data['path'] = $this->ml_process($data['path']); |
|
| 328 | + $data['description'] = $this->ml_process($data['description']); |
|
| 329 | + $order = $data['preview_image'] == 'first' ? 'ASC' : 'DESC'; |
|
| 330 | + $data['preview'] = $this->db()->qfs( |
|
| 331 | 331 | "SELECT `preview` |
| 332 | 332 | FROM `[prefix]photo_gallery_images` |
| 333 | 333 | WHERE `gallery` = $data[id] |
| 334 | 334 | ORDER BY `id` $order" |
| 335 | 335 | ) ?: ''; |
| 336 | - $data['images'] = $this->db()->qfas( |
|
| 336 | + $data['images'] = $this->db()->qfas( |
|
| 337 | 337 | "SELECT `id` |
| 338 | 338 | FROM `[prefix]photo_gallery_images` |
| 339 | 339 | WHERE `gallery` = $data[id] |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | ('%s')", |
| 363 | 363 | (int)(bool)$active |
| 364 | 364 | )) { |
| 365 | - $id = $this->db_prime()->id(); |
|
| 365 | + $id = $this->db_prime()->id(); |
|
| 366 | 366 | $this->set_gallery($id, $title, $path, $description, $active, $preview_image); |
| 367 | 367 | return $id; |
| 368 | 368 | } |
@@ -381,10 +381,10 @@ discard block |
||
| 381 | 381 | * @return bool |
| 382 | 382 | */ |
| 383 | 383 | function set_gallery ($id, $title, $path, $description, $active, $preview_image) { |
| 384 | - $path = path($path ?: $title); |
|
| 385 | - $title = xap(trim($title)); |
|
| 386 | - $description = xap(trim($description)); |
|
| 387 | - $id = (int)$id; |
|
| 384 | + $path = path($path ?: $title); |
|
| 385 | + $title = xap(trim($title)); |
|
| 386 | + $description = xap(trim($description)); |
|
| 387 | + $id = (int)$id; |
|
| 388 | 388 | if ($this->db_prime()->q( |
| 389 | 389 | "UPDATE `[prefix]photo_gallery_galleries` |
| 390 | 390 | SET |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | $preview_image, |
| 403 | 403 | $id |
| 404 | 404 | )) { |
| 405 | - $Cache = $this->cache; |
|
| 405 | + $Cache = $this->cache; |
|
| 406 | 406 | unset( |
| 407 | 407 | $Cache->{"galleries/$id"}, |
| 408 | 408 | $Cache->{'galleries/list'} |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | * @return bool |
| 421 | 421 | */ |
| 422 | 422 | function del_gallery ($id) { |
| 423 | - $id = (int)$id; |
|
| 423 | + $id = (int)$id; |
|
| 424 | 424 | if (!$this->db_prime()->q( |
| 425 | 425 | "DELETE FROM `[prefix]photo_gallery_galleries` |
| 426 | 426 | WHERE `id` = '%s' |
@@ -432,12 +432,12 @@ discard block |
||
| 432 | 432 | $this->ml_del('Photo_gallery/galleries/title', $id); |
| 433 | 433 | $this->ml_del('Photo_gallery/galleries/path', $id); |
| 434 | 434 | $this->ml_del('Photo_gallery/galleries/description', $id); |
| 435 | - $Cache = $this->cache; |
|
| 435 | + $Cache = $this->cache; |
|
| 436 | 436 | unset( |
| 437 | 437 | $Cache->{"galleries/$id"}, |
| 438 | 438 | $Cache->{'galleries/list'} |
| 439 | 439 | ); |
| 440 | - $images = $this->db()->qfas( |
|
| 440 | + $images = $this->db()->qfas( |
|
| 441 | 441 | "SELECT `id` |
| 442 | 442 | FROM `[prefix]photo_gallery_images` |
| 443 | 443 | WHERE `gallery` = '%s'", |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | php build.php -M core -m Plupload,Static_pages |
| 76 | 76 | php build.php -M core -p TinyMCE -t DarkEnergy -s custom |
| 77 | 77 | php build.php -M module -m Plupload,Static_pages |
| 78 | -HELP; |
|
| 78 | +help; |
|
| 79 | 79 | } elseif ($mode == 'core') { |
| 80 | 80 | echo $Builder->core($modules, $plugins, $themes, $suffix)."\n"; |
| 81 | 81 | } else { |