Completed
Push — master ( 7aea5e...35c95f )
by Nazar
04:34
created
components/modules/Uploader/api/index.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
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 Karwana\Mime\Mime;
11 11
 $L    = new Language\Prefix('uploader_');
@@ -13,14 +13,14 @@  discard block
 block discarded – undo
13 13
 $User = User::instance();
14 14
 interface_off();
15 15
 /**
16
- * File should be specified
17
- */
16
+	 * File should be specified
17
+	 */
18 18
 if (!isset($_FILES['file'])) {
19 19
 	throw new ExitException('File Not Specified', 400);
20 20
 }
21 21
 /**
22
- * Getting Uploader module configuration
23
- */
22
+	 * Getting Uploader module configuration
23
+	 */
24 24
 $module_data   = Config::instance()->module('Uploader');
25 25
 $max_file_size = (int)$module_data->max_file_size;
26 26
 switch (substr(strtolower($module_data->max_file_size), -2)) {
@@ -44,25 +44,25 @@  discard block
 block discarded – undo
44 44
 	throw new ExitException(500);
45 45
 }
46 46
 /**
47
- * Only registered users allowed
48
- */
47
+	 * Only registered users allowed
48
+	 */
49 49
 if (!$User->user()) {
50 50
 	throw new ExitException(403);
51 51
 }
52 52
 /**
53
- * Getting instances of storage and database
54
- */
53
+	 * Getting instances of storage and database
54
+	 */
55 55
 $storage = Storage::instance()->storage($module_data->storage('files'));
56 56
 /**
57
- * @var DB\_Abstract $cdb
58
- */
57
+	 * @var DB\_Abstract $cdb
58
+	 */
59 59
 $cdb = DB::instance()->db_prime($module_data->db('files'));
60 60
 if (!$storage || !$cdb) {
61 61
 	throw new ExitException(500);
62 62
 }
63 63
 /**
64
- * Moving file into storage
65
- */
64
+	 * Moving file into storage
65
+	 */
66 66
 if (!$module_data->directory_created) {
67 67
 	$storage->mkdir('Uploader');
68 68
 	$module_data->directory_created = 1;
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	throw new ExitException(500);
83 83
 }
84 84
 /**
85
- * Registering file in database
86
- */
85
+	 * Registering file in database
86
+	 */
87 87
 if (!$cdb->q(
88 88
 	"INSERT INTO `[prefix]uploader_files`
89 89
 		(`user`, `uploaded`, `source`, `url`)
Please login to merge, or discard this patch.
components/modules/Photo_gallery/admin/galleries.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @package		Photo gallery
4
- * @category	modules
5
- * @author		Nazar Mokrynskyi <[email protected]>
6
- * @copyright	Copyright (c) 2014-2016, Nazar Mokrynskyi
7
- * @license		MIT License, see license.txt
8
- */
3
+	 * @package		Photo gallery
4
+	 * @category	modules
5
+	 * @author		Nazar Mokrynskyi <[email protected]>
6
+	 * @copyright	Copyright (c) 2014-2016, Nazar Mokrynskyi
7
+	 * @license		MIT License, see license.txt
8
+	 */
9 9
 include __DIR__.'/galleries/save.php';
Please login to merge, or discard this patch.
components/modules/Photo_gallery/api/images.post.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @package   Photo gallery
4
- * @category  modules
5
- * @author    Nazar Mokrynskyi <[email protected]>
6
- * @copyright Copyright (c) 2013-2016, Nazar Mokrynskyi
7
- * @license   MIT License, see license.txt
8
- */
3
+	 * @package   Photo gallery
4
+	 * @category  modules
5
+	 * @author    Nazar Mokrynskyi <[email protected]>
6
+	 * @copyright Copyright (c) 2013-2016, Nazar Mokrynskyi
7
+	 * @license   MIT License, see license.txt
8
+	 */
9 9
 namespace cs\modules\Photo_gallery;
10 10
 use
11 11
 	cs\ExitException,
Please login to merge, or discard this patch.
components/modules/OAuth2/admin/clients.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @package   OAuth2
4
- * @category  modules
5
- * @author    Nazar Mokrynskyi <[email protected]>
6
- * @copyright Copyright (c) 2014-2016, Nazar Mokrynskyi
7
- * @license   MIT License, see license.txt
8
- */
3
+	 * @package   OAuth2
4
+	 * @category  modules
5
+	 * @author    Nazar Mokrynskyi <[email protected]>
6
+	 * @copyright Copyright (c) 2014-2016, Nazar Mokrynskyi
7
+	 * @license   MIT License, see license.txt
8
+	 */
9 9
 namespace cs;
10 10
 include __DIR__.'/clients/save.php';
11 11
 Index::instance()->form_attributes['is'] = 'cs-form';
Please login to merge, or discard this patch.
components/modules/OAuth2/invalidate_token.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @package        OAuth2
4
- * @category       modules
5
- * @author         Nazar Mokrynskyi <[email protected]>
6
- * @copyright      Copyright (c) 2014-2016, Nazar Mokrynskyi
7
- * @license        MIT License, see license.txt
8
- */
3
+	 * @package        OAuth2
4
+	 * @category       modules
5
+	 * @author         Nazar Mokrynskyi <[email protected]>
6
+	 * @copyright      Copyright (c) 2014-2016, Nazar Mokrynskyi
7
+	 * @license        MIT License, see license.txt
8
+	 */
9 9
 namespace cs\modules\OAuth2;
10 10
 use
11 11
 	cs\ExitException;
Please login to merge, or discard this patch.
components/modules/OAuth2/events/uninstalled.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @package		OAuth2
4
- * @category	modules
5
- * @author		Nazar Mokrynskyi <[email protected]>
6
- * @copyright	Copyright (c) 2013-2016, Nazar Mokrynskyi
7
- * @license		MIT License, see license.txt
8
- */
3
+	 * @package		OAuth2
4
+	 * @category	modules
5
+	 * @author		Nazar Mokrynskyi <[email protected]>
6
+	 * @copyright	Copyright (c) 2013-2016, Nazar Mokrynskyi
7
+	 * @license		MIT License, see license.txt
8
+	 */
9 9
 namespace	cs;
10 10
 Event::instance()->on(
11 11
 	'admin/System/components/modules/install/after',
Please login to merge, or discard this patch.
components/modules/OAuth2/events.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @package   OAuth2
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   OAuth2
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;
10 10
 
11 11
 Event::instance()
Please login to merge, or discard this patch.
components/modules/OAuth2/authorize.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @package   OAuth2
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   OAuth2
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
 /**
10
- * Provides next events:<br>
11
- *  OAuth2/custom_sign_in_page
12
- *  OAuth2/custom_allow_access_page
13
- */
10
+	 * Provides next events:<br>
11
+	 *  OAuth2/custom_sign_in_page
12
+	 *  OAuth2/custom_allow_access_page
13
+	 */
14 14
 namespace cs\modules\OAuth2;
15 15
 use
16 16
 	h,
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 $L      = new Prefix('oauth2_');
47 47
 $Page   = Page::instance();
48 48
 /**
49
- * Errors processing
50
- */
49
+	 * Errors processing
50
+	 */
51 51
 if (!isset($_GET['client_id'])) {
52 52
 	error_redirect('invalid_request', 'client_id parameter required');
53 53
 	return;
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 	}
116 116
 }
117 117
 /**
118
- * guest_token should return JSON data while all other works with redirects
119
- */
118
+	 * guest_token should return JSON data while all other works with redirects
119
+	 */
120 120
 if ($_GET['response_type'] != 'guest_token') {
121 121
 	if (!isset($_GET['redirect_uri'])) {
122 122
 		$e = new ExitException(
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
 	}
190 190
 }
191 191
 /**
192
- * Authorization processing
193
- */
192
+	 * Authorization processing
193
+	 */
194 194
 if (isset($_POST['mode'])) {
195 195
 	switch ($_POST['mode']) {
196 196
 		case 'allow':
Please login to merge, or discard this patch.
Switch Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -230,85 +230,85 @@
 block discarded – undo
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
-		interface_off();
275
-		if ($User->user()) {
276
-			$e = new ExitException(
277
-				[
278
-					'access_denied',
279
-					'Only guests, not users allowed to access this response_type'
280
-				],
281
-				403
282
-			);
283
-			$e->setJson();
284
-			throw $e;
285
-		}
286
-		$code = $OAuth2->add_code($client['id'], 'token', urldecode($_GET['redirect_uri']));
287
-		if (!$code) {
288
-			$e = new ExitException(
289
-				[
290
-					'server_error',
291
-					"Server can't generate code, try later"
292
-				],
293
-				500
294
-			);
295
-			$e->setJson();
296
-			throw $e;
297
-		}
298
-		$token_data = $OAuth2->get_code($code, $client['id'], $client['secret'], urldecode($_GET['redirect_uri']));
299
-		if ($token_data) {
300
-			unset($token_data['refresh_token']);
301
-			$Page->json($token_data);
302
-			return;
303
-		} else {
304
-			$e = new ExitException(
305
-				[
306
-					'server_error',
307
-					"Server can't get token data, try later"
308
-				],
309
-				500
310
-			);
311
-			$e->setJson();
312
-			throw $e;
313
-		}
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
+			interface_off();
275
+			if ($User->user()) {
276
+				$e = new ExitException(
277
+					[
278
+						'access_denied',
279
+						'Only guests, not users allowed to access this response_type'
280
+					],
281
+					403
282
+				);
283
+				$e->setJson();
284
+				throw $e;
285
+			}
286
+			$code = $OAuth2->add_code($client['id'], 'token', urldecode($_GET['redirect_uri']));
287
+			if (!$code) {
288
+				$e = new ExitException(
289
+					[
290
+						'server_error',
291
+						"Server can't generate code, try later"
292
+					],
293
+					500
294
+				);
295
+				$e->setJson();
296
+				throw $e;
297
+			}
298
+			$token_data = $OAuth2->get_code($code, $client['id'], $client['secret'], urldecode($_GET['redirect_uri']));
299
+			if ($token_data) {
300
+				unset($token_data['refresh_token']);
301
+				$Page->json($token_data);
302
+				return;
303
+			} else {
304
+				$e = new ExitException(
305
+					[
306
+						'server_error',
307
+						"Server can't get token data, try later"
308
+					],
309
+					500
310
+				);
311
+				$e->setJson();
312
+				throw $e;
313
+			}
314 314
 }
Please login to merge, or discard this patch.
components/modules/HybridAuth/events.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @package   HybridAuth
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   HybridAuth
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;
10 10
 Event::instance()->on(
11 11
 	'System/User/construct/after',
Please login to merge, or discard this patch.