Completed
Push — master ( 839a1f...d41ceb )
by Nazar
04:26
created
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-2015, 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-2015, 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/admin/clients/delete.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@
 block discarded – undo
13 13
 	cs\Language\Prefix,
14 14
 	cs\Page,
15 15
 	cs\Route;
16
-$Index						= Index::instance();
17
-$L							= new Prefix('oauth2_');
18
-$client						= OAuth2::instance()->get_client(Route::instance()->route[2]);
16
+$Index = Index::instance();
17
+$L = new Prefix('oauth2_');
18
+$client = OAuth2::instance()->get_client(Route::instance()->route[2]);
19 19
 Page::instance()->title($L->deletion_of_client($client['name']));
20
-$Index->buttons				= false;
21
-$Index->cancel_button_back	= true;
22
-$Index->action				= 'admin/OAuth2/clients/list';
20
+$Index->buttons = false;
21
+$Index->cancel_button_back = true;
22
+$Index->action = 'admin/OAuth2/clients/list';
23 23
 $Index->content(
24 24
 	h::{'h2.cs-text-center'}(
25 25
 		$L->sure_to_delete_client($client['name'])
Please login to merge, or discard this 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-2015, 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-2015, Nazar Mokrynskyi
7
+	 * @license		MIT License, see license.txt
8
+	 */
9 9
 namespace	cs\modules\OAuth2;
10 10
 use			cs\Config,
11 11
 			cs\Index;
Please login to merge, or discard this patch.
components/modules/OAuth2/admin/clients/list.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-2015, 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-2015, Nazar Mokrynskyi
7
+	 * @license   MIT License, see license.txt
8
+	 */
9 9
 
10 10
 namespace cs\modules\OAuth2;
11 11
 use
Please login to merge, or discard this patch.
components/modules/OAuth2/admin/clients/save.php 2 patches
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-2015, 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-2015, Nazar Mokrynskyi
7
+	 * @license		MIT License, see license.txt
8
+	 */
9 9
 namespace	cs\modules\OAuth2;
10 10
 use			cs\Config,
11 11
 			cs\Index;
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@
 block discarded – undo
9 9
 namespace	cs\modules\OAuth2;
10 10
 use			cs\Config,
11 11
 			cs\Index;
12
-$OAuth2	= OAuth2::instance();
13
-$Index	= Index::instance();
12
+$OAuth2 = OAuth2::instance();
13
+$Index = Index::instance();
14 14
 if (isset($_POST['mode'])) {
15 15
 	switch ($_POST['mode']) {
16 16
 		case 'add':
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-2015, 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-2015, 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
@@ -233,86 +233,86 @@
 block discarded – undo
233 233
 	return;
234 234
 }
235 235
 switch ($_GET['response_type']) {
236
-	case 'code':
237
-		_header(
238
-			'Location: '.http_build_url(
239
-				urldecode($redirect_uri),
240
-				[
241
-					'code'  => $code,
242
-					'state' => isset($_GET['state']) ? $_GET['state'] : false
243
-				]
244
-			),
245
-			true,
246
-			302
247
-		);
248
-		$Page->Content = '';
249
-		return;
250
-	case 'token':
251
-		$token_data = $OAuth2->get_code($code, $client['id'], $client['secret'], $redirect_uri);
252
-		if ($token_data) {
253
-			unset($token_data['refresh_token']);
236
+		case 'code':
254 237
 			_header(
255
-				'Location: '.uri_for_token(
256
-					http_build_url(
257
-						urldecode($redirect_uri),
258
-						array_merge(
259
-							$token_data,
260
-							[
261
-								'state' => isset($_GET['state']) ? $_GET['state'] : false
262
-							]
263
-						)
264
-					)
238
+				'Location: '.http_build_url(
239
+					urldecode($redirect_uri),
240
+					[
241
+						'code'  => $code,
242
+						'state' => isset($_GET['state']) ? $_GET['state'] : false
243
+					]
265 244
 				),
266 245
 				true,
267 246
 				302
268 247
 			);
269 248
 			$Page->Content = '';
270 249
 			return;
271
-		} else {
272
-			error_redirect('server_error', "Server can't get token data, try later");
273
-			return;
274
-		}
275
-	case 'guest_token':
276
-		_header('Cache-Control: no-store');
277
-		_header('Pragma: no-cache');
278
-		interface_off();
279
-		if ($User->user()) {
280
-			$e = new ExitException(
281
-				[
282
-					'access_denied',
283
-					'Only guests, not users allowed to access this response_type'
284
-				],
285
-				403
286
-			);
287
-			$e->setJson();
288
-			throw $e;
289
-		}
290
-		$code = $OAuth2->add_code($client['id'], 'token', urldecode($_GET['redirect_uri']));
291
-		if (!$code) {
292
-			$e = new ExitException(
293
-				[
294
-					'server_error',
295
-					"Server can't generate code, try later"
296
-				],
297
-				500
298
-			);
299
-			$e->setJson();
300
-			throw $e;
301
-		}
302
-		$token_data = $OAuth2->get_code($code, $client['id'], $client['secret'], urldecode($_GET['redirect_uri']));
303
-		if ($token_data) {
304
-			unset($token_data['refresh_token']);
305
-			$Page->json($token_data);
306
-			return;
307
-		} else {
308
-			$e = new ExitException(
309
-				[
310
-					'server_error',
311
-					"Server can't get token data, try later"
312
-				],
313
-				500
314
-			);
315
-			$e->setJson();
316
-			throw $e;
317
-		}
250
+		case 'token':
251
+			$token_data = $OAuth2->get_code($code, $client['id'], $client['secret'], $redirect_uri);
252
+			if ($token_data) {
253
+				unset($token_data['refresh_token']);
254
+				_header(
255
+					'Location: '.uri_for_token(
256
+						http_build_url(
257
+							urldecode($redirect_uri),
258
+							array_merge(
259
+								$token_data,
260
+								[
261
+									'state' => isset($_GET['state']) ? $_GET['state'] : false
262
+								]
263
+							)
264
+						)
265
+					),
266
+					true,
267
+					302
268
+				);
269
+				$Page->Content = '';
270
+				return;
271
+			} else {
272
+				error_redirect('server_error', "Server can't get token data, try later");
273
+				return;
274
+			}
275
+		case 'guest_token':
276
+			_header('Cache-Control: no-store');
277
+			_header('Pragma: no-cache');
278
+			interface_off();
279
+			if ($User->user()) {
280
+				$e = new ExitException(
281
+					[
282
+						'access_denied',
283
+						'Only guests, not users allowed to access this response_type'
284
+					],
285
+					403
286
+				);
287
+				$e->setJson();
288
+				throw $e;
289
+			}
290
+			$code = $OAuth2->add_code($client['id'], 'token', urldecode($_GET['redirect_uri']));
291
+			if (!$code) {
292
+				$e = new ExitException(
293
+					[
294
+						'server_error',
295
+						"Server can't generate code, try later"
296
+					],
297
+					500
298
+				);
299
+				$e->setJson();
300
+				throw $e;
301
+			}
302
+			$token_data = $OAuth2->get_code($code, $client['id'], $client['secret'], urldecode($_GET['redirect_uri']));
303
+			if ($token_data) {
304
+				unset($token_data['refresh_token']);
305
+				$Page->json($token_data);
306
+				return;
307
+			} else {
308
+				$e = new ExitException(
309
+					[
310
+						'server_error',
311
+						"Server can't get token data, try later"
312
+					],
313
+					500
314
+				);
315
+				$e->setJson();
316
+				throw $e;
317
+			}
318 318
 }
Please login to merge, or discard this patch.
components/modules/OAuth2/blank.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		OAuth2
4
- * @category	modules
5
- * @author		Nazar Mokrynskyi <[email protected]>
6
- * @copyright	Copyright (c) 2011-2015, 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-2015, Nazar Mokrynskyi
7
+		 * @license		MIT License, see license.txt
8
+		 */
9 9
 interface_off();
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-2013, 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-2013, 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/events/enabled.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-2013, 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-2013, Nazar Mokrynskyi
7
+	 * @license   MIT License, see license.txt
8
+	 */
9 9
 namespace cs\modules\OAuth2;
10 10
 
11 11
 use
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-2015, 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-2015, 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.