@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Blogs |
|
| 4 | - * @category modules |
|
| 5 | - * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | - * @copyright Copyright (c) 2011-2016, Nazar Mokrynskyi |
|
| 7 | - * @license MIT License, see license.txt |
|
| 8 | - */ |
|
| 3 | + * @package Blogs |
|
| 4 | + * @category modules |
|
| 5 | + * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | + * @copyright Copyright (c) 2011-2016, Nazar Mokrynskyi |
|
| 7 | + * @license MIT License, see license.txt |
|
| 8 | + */ |
|
| 9 | 9 | namespace cs\modules\Blogs; |
| 10 | 10 | use |
| 11 | 11 | h, |
@@ -1,18 +1,18 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package CleverStyle CMS |
|
| 4 | - * @author Nazar Mokrynskyi <[email protected]> |
|
| 5 | - * @copyright Copyright (c) 2015-2016, Nazar Mokrynskyi |
|
| 6 | - * @license MIT License, see license.txt |
|
| 7 | - */ |
|
| 3 | + * @package CleverStyle CMS |
|
| 4 | + * @author Nazar Mokrynskyi <[email protected]> |
|
| 5 | + * @copyright Copyright (c) 2015-2016, Nazar Mokrynskyi |
|
| 6 | + * @license MIT License, see license.txt |
|
| 7 | + */ |
|
| 8 | 8 | namespace cs; |
| 9 | 9 | /** |
| 10 | - * Event class |
|
| 11 | - * |
|
| 12 | - * Provides events subscribing and dispatching |
|
| 13 | - * |
|
| 14 | - * @method static $this instance($check = false) |
|
| 15 | - */ |
|
| 10 | + * Event class |
|
| 11 | + * |
|
| 12 | + * Provides events subscribing and dispatching |
|
| 13 | + * |
|
| 14 | + * @method static $this instance($check = false) |
|
| 15 | + */ |
|
| 16 | 16 | class Event { |
| 17 | 17 | use |
| 18 | 18 | Singleton; |
@@ -1,23 +1,23 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package CleverStyle CMS |
|
| 4 | - * @author Nazar Mokrynskyi <[email protected]> |
|
| 5 | - * @copyright Copyright (c) 2013-2016, Nazar Mokrynskyi |
|
| 6 | - * @license MIT License, see license.txt |
|
| 7 | - */ |
|
| 3 | + * @package CleverStyle CMS |
|
| 4 | + * @author Nazar Mokrynskyi <[email protected]> |
|
| 5 | + * @copyright Copyright (c) 2013-2016, Nazar Mokrynskyi |
|
| 6 | + * @license MIT License, see license.txt |
|
| 7 | + */ |
|
| 8 | 8 | /** |
| 9 | - * Provides next events:<br> |
|
| 10 | - * |
|
| 11 | - * System/User/Group/add |
|
| 12 | - * ['id' => <i>group_id</i>] |
|
| 13 | - * |
|
| 14 | - * System/User/Group/del/before |
|
| 15 | - * ['id' => <i>group_id</i>] |
|
| 16 | - * |
|
| 17 | - * System/User/Group/del/after |
|
| 18 | - * ['id' => <i>group_id</i>] |
|
| 19 | - * |
|
| 20 | - */ |
|
| 9 | + * Provides next events:<br> |
|
| 10 | + * |
|
| 11 | + * System/User/Group/add |
|
| 12 | + * ['id' => <i>group_id</i>] |
|
| 13 | + * |
|
| 14 | + * System/User/Group/del/before |
|
| 15 | + * ['id' => <i>group_id</i>] |
|
| 16 | + * |
|
| 17 | + * System/User/Group/del/after |
|
| 18 | + * ['id' => <i>group_id</i>] |
|
| 19 | + * |
|
| 20 | + */ |
|
| 21 | 21 | namespace cs; |
| 22 | 22 | use |
| 23 | 23 | cs\Cache\Prefix, |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Uploader |
|
| 4 | - * @category modules |
|
| 5 | - * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | - * @copyright Copyright (c) 2015-2016, Nazar Mokrynskyi |
|
| 7 | - * @license MIT License, see license.txt |
|
| 8 | - */ |
|
| 3 | + * @package Uploader |
|
| 4 | + * @category modules |
|
| 5 | + * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | + * @copyright Copyright (c) 2015-2016, Nazar Mokrynskyi |
|
| 7 | + * @license MIT License, see license.txt |
|
| 8 | + */ |
|
| 9 | 9 | namespace cs; |
| 10 | 10 | use |
| 11 | 11 | Karwana\Mime\Mime; |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | throw new ExitException('File Not Specified', 400); |
| 21 | 21 | } |
| 22 | 22 | /** |
| 23 | - * Getting Uploader module configuration |
|
| 24 | - */ |
|
| 23 | + * Getting Uploader module configuration |
|
| 24 | + */ |
|
| 25 | 25 | $module_data = Config::instance()->module('Uploader'); |
| 26 | 26 | $max_file_size = (int)$module_data->max_file_size; |
| 27 | 27 | switch (substr(strtolower($module_data->max_file_size), -2)) { |
@@ -45,25 +45,25 @@ discard block |
||
| 45 | 45 | throw new ExitException(500); |
| 46 | 46 | } |
| 47 | 47 | /** |
| 48 | - * Only registered users allowed |
|
| 49 | - */ |
|
| 48 | + * Only registered users allowed |
|
| 49 | + */ |
|
| 50 | 50 | if (!$User->user()) { |
| 51 | 51 | throw new ExitException(403); |
| 52 | 52 | } |
| 53 | 53 | /** |
| 54 | - * Getting instances of storage and database |
|
| 55 | - */ |
|
| 54 | + * Getting instances of storage and database |
|
| 55 | + */ |
|
| 56 | 56 | $storage = Storage::instance()->storage($module_data->storage('files')); |
| 57 | 57 | /** |
| 58 | - * @var DB\_Abstract $cdb |
|
| 59 | - */ |
|
| 58 | + * @var DB\_Abstract $cdb |
|
| 59 | + */ |
|
| 60 | 60 | $cdb = DB::instance()->db_prime($module_data->db('files')); |
| 61 | 61 | if (!$storage || !$cdb) { |
| 62 | 62 | throw new ExitException(500); |
| 63 | 63 | } |
| 64 | 64 | /** |
| 65 | - * Moving file into storage |
|
| 66 | - */ |
|
| 65 | + * Moving file into storage |
|
| 66 | + */ |
|
| 67 | 67 | if (!$module_data->directory_created) { |
| 68 | 68 | $storage->mkdir('Uploader'); |
| 69 | 69 | $module_data->directory_created = 1; |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | throw new ExitException(500); |
| 84 | 84 | } |
| 85 | 85 | /** |
| 86 | - * Registering file in database |
|
| 87 | - */ |
|
| 86 | + * Registering file in database |
|
| 87 | + */ |
|
| 88 | 88 | if (!$cdb->q( |
| 89 | 89 | "INSERT INTO `[prefix]uploader_files` |
| 90 | 90 | (`user`, `uploaded`, `source`, `url`) |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Blogs |
|
| 4 | - * @category modules |
|
| 5 | - * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | - * @copyright Copyright (c) 2015-2016, Nazar Mokrynskyi |
|
| 7 | - * @license MIT License, see license.txt |
|
| 8 | - */ |
|
| 3 | + * @package Blogs |
|
| 4 | + * @category modules |
|
| 5 | + * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | + * @copyright Copyright (c) 2015-2016, Nazar Mokrynskyi |
|
| 7 | + * @license MIT License, see license.txt |
|
| 8 | + */ |
|
| 9 | 9 | namespace cs\modules\Blogs; |
| 10 | 10 | use |
| 11 | 11 | cs\Cache\Prefix, |
@@ -13,12 +13,12 @@ discard block |
||
| 13 | 13 | cs\plugins\Tags\Tags as Tags_trait, |
| 14 | 14 | cs\Singleton; |
| 15 | 15 | /** |
| 16 | - * Tags trait |
|
| 17 | - * |
|
| 18 | - * Provides methods for working with tags for faster development |
|
| 19 | - * |
|
| 20 | - * @method static $this instance($check = false) |
|
| 21 | - */ |
|
| 16 | + * Tags trait |
|
| 17 | + * |
|
| 18 | + * Provides methods for working with tags for faster development |
|
| 19 | + * |
|
| 20 | + * @method static $this instance($check = false) |
|
| 21 | + */ |
|
| 22 | 22 | class Tags { |
| 23 | 23 | use |
| 24 | 24 | Tags_trait, |
@@ -230,84 +230,84 @@ |
||
| 230 | 230 | return; |
| 231 | 231 | } |
| 232 | 232 | switch ($_GET['response_type']) { |
| 233 | - case 'code': |
|
| 234 | - $Response->redirect( |
|
| 235 | - http_build_url( |
|
| 236 | - urldecode($redirect_uri), |
|
| 237 | - [ |
|
| 238 | - 'code' => $code, |
|
| 239 | - 'state' => isset($_GET['state']) ? $_GET['state'] : false |
|
| 240 | - ] |
|
| 241 | - ), |
|
| 242 | - 302 |
|
| 243 | - ); |
|
| 244 | - $Page->Content = ''; |
|
| 245 | - return; |
|
| 246 | - case 'token': |
|
| 247 | - $token_data = $OAuth2->get_code($code, $client['id'], $client['secret'], $redirect_uri); |
|
| 248 | - if ($token_data) { |
|
| 249 | - unset($token_data['refresh_token']); |
|
| 233 | + case 'code': |
|
| 250 | 234 | $Response->redirect( |
| 251 | - uri_for_token( |
|
| 252 | - http_build_url( |
|
| 253 | - urldecode($redirect_uri), |
|
| 254 | - array_merge( |
|
| 255 | - $token_data, |
|
| 256 | - [ |
|
| 257 | - 'state' => isset($_GET['state']) ? $_GET['state'] : false |
|
| 258 | - ] |
|
| 259 | - ) |
|
| 260 | - ) |
|
| 235 | + http_build_url( |
|
| 236 | + urldecode($redirect_uri), |
|
| 237 | + [ |
|
| 238 | + 'code' => $code, |
|
| 239 | + 'state' => isset($_GET['state']) ? $_GET['state'] : false |
|
| 240 | + ] |
|
| 261 | 241 | ), |
| 262 | 242 | 302 |
| 263 | 243 | ); |
| 264 | 244 | $Page->Content = ''; |
| 265 | 245 | return; |
| 266 | - } else { |
|
| 267 | - error_redirect('server_error', "Server can't get token data, try later"); |
|
| 268 | - return; |
|
| 269 | - } |
|
| 270 | - case 'guest_token': |
|
| 271 | - $Response |
|
| 272 | - ->header('cache-control', 'no-store') |
|
| 273 | - ->header('pragma', 'no-cache'); |
|
| 274 | - if ($User->user()) { |
|
| 275 | - $e = new ExitException( |
|
| 276 | - [ |
|
| 277 | - 'access_denied', |
|
| 278 | - 'Only guests, not users allowed to access this response_type' |
|
| 279 | - ], |
|
| 280 | - 403 |
|
| 281 | - ); |
|
| 282 | - $e->setJson(); |
|
| 283 | - throw $e; |
|
| 284 | - } |
|
| 285 | - $code = $OAuth2->add_code($client['id'], 'token', urldecode($_GET['redirect_uri'])); |
|
| 286 | - if (!$code) { |
|
| 287 | - $e = new ExitException( |
|
| 288 | - [ |
|
| 289 | - 'server_error', |
|
| 290 | - "Server can't generate code, try later" |
|
| 291 | - ], |
|
| 292 | - 500 |
|
| 293 | - ); |
|
| 294 | - $e->setJson(); |
|
| 295 | - throw $e; |
|
| 296 | - } |
|
| 297 | - $token_data = $OAuth2->get_code($code, $client['id'], $client['secret'], urldecode($_GET['redirect_uri'])); |
|
| 298 | - if ($token_data) { |
|
| 299 | - unset($token_data['refresh_token']); |
|
| 300 | - $Page->json($token_data); |
|
| 301 | - return; |
|
| 302 | - } else { |
|
| 303 | - $e = new ExitException( |
|
| 304 | - [ |
|
| 305 | - 'server_error', |
|
| 306 | - "Server can't get token data, try later" |
|
| 307 | - ], |
|
| 308 | - 500 |
|
| 309 | - ); |
|
| 310 | - $e->setJson(); |
|
| 311 | - throw $e; |
|
| 312 | - } |
|
| 246 | + case 'token': |
|
| 247 | + $token_data = $OAuth2->get_code($code, $client['id'], $client['secret'], $redirect_uri); |
|
| 248 | + if ($token_data) { |
|
| 249 | + unset($token_data['refresh_token']); |
|
| 250 | + $Response->redirect( |
|
| 251 | + uri_for_token( |
|
| 252 | + http_build_url( |
|
| 253 | + urldecode($redirect_uri), |
|
| 254 | + array_merge( |
|
| 255 | + $token_data, |
|
| 256 | + [ |
|
| 257 | + 'state' => isset($_GET['state']) ? $_GET['state'] : false |
|
| 258 | + ] |
|
| 259 | + ) |
|
| 260 | + ) |
|
| 261 | + ), |
|
| 262 | + 302 |
|
| 263 | + ); |
|
| 264 | + $Page->Content = ''; |
|
| 265 | + return; |
|
| 266 | + } else { |
|
| 267 | + error_redirect('server_error', "Server can't get token data, try later"); |
|
| 268 | + return; |
|
| 269 | + } |
|
| 270 | + case 'guest_token': |
|
| 271 | + $Response |
|
| 272 | + ->header('cache-control', 'no-store') |
|
| 273 | + ->header('pragma', 'no-cache'); |
|
| 274 | + if ($User->user()) { |
|
| 275 | + $e = new ExitException( |
|
| 276 | + [ |
|
| 277 | + 'access_denied', |
|
| 278 | + 'Only guests, not users allowed to access this response_type' |
|
| 279 | + ], |
|
| 280 | + 403 |
|
| 281 | + ); |
|
| 282 | + $e->setJson(); |
|
| 283 | + throw $e; |
|
| 284 | + } |
|
| 285 | + $code = $OAuth2->add_code($client['id'], 'token', urldecode($_GET['redirect_uri'])); |
|
| 286 | + if (!$code) { |
|
| 287 | + $e = new ExitException( |
|
| 288 | + [ |
|
| 289 | + 'server_error', |
|
| 290 | + "Server can't generate code, try later" |
|
| 291 | + ], |
|
| 292 | + 500 |
|
| 293 | + ); |
|
| 294 | + $e->setJson(); |
|
| 295 | + throw $e; |
|
| 296 | + } |
|
| 297 | + $token_data = $OAuth2->get_code($code, $client['id'], $client['secret'], urldecode($_GET['redirect_uri'])); |
|
| 298 | + if ($token_data) { |
|
| 299 | + unset($token_data['refresh_token']); |
|
| 300 | + $Page->json($token_data); |
|
| 301 | + return; |
|
| 302 | + } else { |
|
| 303 | + $e = new ExitException( |
|
| 304 | + [ |
|
| 305 | + 'server_error', |
|
| 306 | + "Server can't get token data, try later" |
|
| 307 | + ], |
|
| 308 | + 500 |
|
| 309 | + ); |
|
| 310 | + $e->setJson(); |
|
| 311 | + throw $e; |
|
| 312 | + } |
|
| 313 | 313 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | if ($User->guest()) { |
| 21 | 21 | throw new ExitException(403); |
| 22 | 22 | } |
| 23 | - $fields = [ |
|
| 23 | + $fields = [ |
|
| 24 | 24 | 'id', |
| 25 | 25 | 'login', |
| 26 | 26 | 'username', |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Plupload |
|
| 4 | - * @category modules |
|
| 5 | - * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | - * @copyright Copyright (c) 2013-2016, Nazar Mokrynskyi |
|
| 7 | - * @license GNU GPL v2, see license.txt |
|
| 8 | - */ |
|
| 3 | + * @package Plupload |
|
| 4 | + * @category modules |
|
| 5 | + * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | + * @copyright Copyright (c) 2013-2016, Nazar Mokrynskyi |
|
| 7 | + * @license GNU GPL v2, see license.txt |
|
| 8 | + */ |
|
| 9 | 9 | namespace cs; |
| 10 | 10 | use |
| 11 | 11 | Karwana\Mime\Mime; |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | return; |
| 30 | 30 | } |
| 31 | 31 | /** |
| 32 | - * Getting Plupload module configuration |
|
| 33 | - */ |
|
| 32 | + * Getting Plupload module configuration |
|
| 33 | + */ |
|
| 34 | 34 | $module_data = Config::instance()->module('Plupload'); |
| 35 | 35 | $max_file_size = trim(strtolower($module_data->max_file_size), 'b'); |
| 36 | 36 | switch (substr($max_file_size, -1)) { |
@@ -74,8 +74,8 @@ discard block |
||
| 74 | 74 | return; |
| 75 | 75 | } |
| 76 | 76 | /** |
| 77 | - * Only registered users allowed |
|
| 78 | - */ |
|
| 77 | + * Only registered users allowed |
|
| 78 | + */ |
|
| 79 | 79 | if (!$User->user()) { |
| 80 | 80 | $Page->json( |
| 81 | 81 | [ |
@@ -90,12 +90,12 @@ discard block |
||
| 90 | 90 | return; |
| 91 | 91 | } |
| 92 | 92 | /** |
| 93 | - * Getting instances of storage and database |
|
| 94 | - */ |
|
| 93 | + * Getting instances of storage and database |
|
| 94 | + */ |
|
| 95 | 95 | $storage = Storage::instance()->{$module_data->storage('files')}; |
| 96 | 96 | /** |
| 97 | - * @var DB\_Abstract $cdb |
|
| 98 | - */ |
|
| 97 | + * @var DB\_Abstract $cdb |
|
| 98 | + */ |
|
| 99 | 99 | $cdb = DB::instance()->db_prime($module_data->db('files')); |
| 100 | 100 | if (!$storage || !$cdb) { |
| 101 | 101 | $Page->json( |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | return; |
| 112 | 112 | } |
| 113 | 113 | /** |
| 114 | - * Moving file into storage |
|
| 115 | - */ |
|
| 114 | + * Moving file into storage |
|
| 115 | + */ |
|
| 116 | 116 | if (!$module_data->directory_created) { |
| 117 | 117 | $storage->mkdir('Plupload'); |
| 118 | 118 | $module_data->directory_created = 1; |
@@ -142,8 +142,8 @@ discard block |
||
| 142 | 142 | return; |
| 143 | 143 | } |
| 144 | 144 | /** |
| 145 | - * Registering file in database |
|
| 146 | - */ |
|
| 145 | + * Registering file in database |
|
| 146 | + */ |
|
| 147 | 147 | if (!$cdb->q( |
| 148 | 148 | "INSERT INTO `[prefix]plupload_files` |
| 149 | 149 | (`user`, `uploaded`, `source`, `url`) |