Completed
Push — master ( 7aea5e...35c95f )
by Nazar
04:34
created
components/modules/HybridAuth/events/enabled.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 						return strtolower($provider);
30 30
 				}
31 31
 			};
32
-			$providers     = [];
32
+			$providers = [];
33 33
 			foreach ($Config->module('HybridAuth')->providers as $provider => $provider_settings) {
34 34
 				if ($provider_settings['enabled']) {
35 35
 					$providers[$provider] = [
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   HybridAuth
4
- * @category  modules
5
- * @author    Nazar Mokrynskyi <[email protected]>
6
- * @copyright Copyright (c) 2012-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) 2012-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/HybridAuth/events/uninstalled.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,6 +13,6 @@
 block discarded – undo
13 13
 		if ($data['name'] != 'HybridAuth') {
14 14
 			return;
15 15
 		}
16
-		Config::instance()->module('HybridAuth')->providers	= [];
16
+		Config::instance()->module('HybridAuth')->providers = [];
17 17
 	}
18 18
 );
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   HybridAuth
4
- * @category  modules
5
- * @author    Nazar Mokrynskyi <[email protected]>
6
- * @copyright Copyright (c) 2012-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) 2012-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/prepare.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,19 +31,19 @@
 block discarded – undo
31 31
  * @return string
32 32
  */
33 33
 function http_build_url ($url, $parts) {
34
-	$url	= explode('?', $url, 2);
35
-	$params	= [];
34
+	$url = explode('?', $url, 2);
35
+	$params = [];
36 36
 	if (isset($url[1])) {
37 37
 		foreach (explode('&', $url[1]) as $u) {
38
-			$params[]	= $u;
38
+			$params[] = $u;
39 39
 		}
40 40
 		unset($u, $url[1]);
41 41
 	}
42
-	$url	= $url[0];
42
+	$url = $url[0];
43 43
 	foreach ($parts as $name => $value) {
44
-		$params[]	= $name.'='.urlencode($value);
44
+		$params[] = $name.'='.urlencode($value);
45 45
 	}
46 46
 	unset($parts, $p);
47
-	$params	= array_unique($params);
47
+	$params = array_unique($params);
48 48
 	return "$url?".implode('&', $params);
49 49
 }
Please login to merge, or discard this patch.
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@  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
 namespace	cs\modules\OAuth2;
10 10
 /**
11
- * Just replaces first "?" symbol by "#"
12
- *
13
- * @param string	$str
14
- *
15
- * @return string
16
- */
11
+	 * Just replaces first "?" symbol by "#"
12
+	 *
13
+	 * @param string	$str
14
+	 *
15
+	 * @return string
16
+	 */
17 17
 function uri_for_token ($str) {
18 18
 	return implode(
19 19
 		'#',
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
25 25
 	);
26 26
 }
27 27
 /**
28
- * @param string	$url
29
- * @param string[]	$parts
30
- *
31
- * @return string
32
- */
28
+	 * @param string	$url
29
+	 * @param string[]	$parts
30
+	 *
31
+	 * @return string
32
+	 */
33 33
 function http_build_url ($url, $parts) {
34 34
 	$url	= explode('?', $url, 2);
35 35
 	$params	= [];
Please login to merge, or discard this patch.
components/modules/OAuth2/token.php 2 patches
Switch Indentation   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -142,118 +142,118 @@
 block discarded – undo
142 142
  * Tokens operations processing
143 143
  */
144 144
 switch ($_POST['grant_type']) {
145
-	case 'authorization_code':
146
-		if (!isset($_POST['code'])) {
147
-			$e = new ExitException(
148
-				[
149
-					'invalid_request',
150
-					'code parameter required'
151
-				],
152
-				400
153
-			);
154
-			$e->setJson();
155
-			throw $e;
156
-		}
157
-		$token_data = $OAuth2->get_code($_POST['code'], $client['id'], $client['secret'], urldecode($_POST['redirect_uri']));
158
-		if (!$token_data) {
159
-			$e = new ExitException(
160
-				[
161
-					'access_denied',
162
-					"Server can't get token data, check parameters and try again"
163
-				],
164
-				403
165
-			);
166
-			$e->setJson();
167
-			throw $e;
168
-		}
169
-		if ($token_data['expires_in'] < 0) {
170
-			$e = new ExitException(
171
-				[
172
-					'access_denied',
173
-					'access_token expired'
174
-				],
175
-				403
176
-			);
177
-			$e->setJson();
178
-			throw $e;
179
-		}
180
-		$Page->json($token_data);
181
-		return;
182
-	case 'refresh_token':
183
-		if (!isset($_POST['refresh_token'])) {
184
-			$e = new ExitException(
185
-				[
186
-					'invalid_request',
187
-					'refresh_token parameter required'
188
-				],
189
-				400
190
-			);
191
-			$e->setJson();
192
-			throw $e;
193
-		}
194
-		$token_data = $OAuth2->refresh_token($_POST['refresh_token'], $client['id'], $client['secret']);
195
-		if (!$token_data) {
196
-			$e = new ExitException(
197
-				[
198
-					'access_denied',
199
-					'User session invalid'
200
-				],
201
-				403
202
-			);
203
-			$e->setJson();
204
-			throw $e;
205
-		}
206
-		$Page->json($token_data);
207
-		return;
208
-	case 'guest_token':
209
-		if (User::instance()->user()) {
210
-			$e = new ExitException(
211
-				[
212
-					'access_denied',
213
-					'Only guests, not user allowed to access this grant_type'
214
-				],
215
-				403
216
-			);
217
-			$e->setJson();
218
-			throw $e;
219
-		}
220
-		if (!$Config->module('OAuth2')->guest_tokens) {
221
-			$e = new ExitException(
222
-				[
223
-					'access_denied',
224
-					'Guest tokens disabled'
225
-				],
226
-				403
227
-			);
228
-			$e->setJson();
229
-			throw $e;
230
-		}
231
-		$code = $OAuth2->add_code($client['id'], 'code', '');
232
-		if (!$code) {
233
-			$e = new ExitException(
234
-				[
235
-					'server_error',
236
-					"Server can't generate code, try later"
237
-				],
238
-				500
239
-			);
240
-			$e->setJson();
241
-			throw $e;
242
-		}
243
-		$token_data = $OAuth2->get_code($code, $client['id'], $client['secret'], '');
244
-		if ($token_data) {
245
-			unset($token_data['refresh_token']);
145
+		case 'authorization_code':
146
+			if (!isset($_POST['code'])) {
147
+				$e = new ExitException(
148
+					[
149
+						'invalid_request',
150
+						'code parameter required'
151
+					],
152
+					400
153
+				);
154
+				$e->setJson();
155
+				throw $e;
156
+			}
157
+			$token_data = $OAuth2->get_code($_POST['code'], $client['id'], $client['secret'], urldecode($_POST['redirect_uri']));
158
+			if (!$token_data) {
159
+				$e = new ExitException(
160
+					[
161
+						'access_denied',
162
+						"Server can't get token data, check parameters and try again"
163
+					],
164
+					403
165
+				);
166
+				$e->setJson();
167
+				throw $e;
168
+			}
169
+			if ($token_data['expires_in'] < 0) {
170
+				$e = new ExitException(
171
+					[
172
+						'access_denied',
173
+						'access_token expired'
174
+					],
175
+					403
176
+				);
177
+				$e->setJson();
178
+				throw $e;
179
+			}
246 180
 			$Page->json($token_data);
247 181
 			return;
248
-		} else {
249
-			$e = new ExitException(
250
-				[
251
-					'server_error',
252
-					"Server can't get token data, try later"
253
-				],
254
-				500
255
-			);
256
-			$e->setJson();
257
-			throw $e;
258
-		}
182
+		case 'refresh_token':
183
+			if (!isset($_POST['refresh_token'])) {
184
+				$e = new ExitException(
185
+					[
186
+						'invalid_request',
187
+						'refresh_token parameter required'
188
+					],
189
+					400
190
+				);
191
+				$e->setJson();
192
+				throw $e;
193
+			}
194
+			$token_data = $OAuth2->refresh_token($_POST['refresh_token'], $client['id'], $client['secret']);
195
+			if (!$token_data) {
196
+				$e = new ExitException(
197
+					[
198
+						'access_denied',
199
+						'User session invalid'
200
+					],
201
+					403
202
+				);
203
+				$e->setJson();
204
+				throw $e;
205
+			}
206
+			$Page->json($token_data);
207
+			return;
208
+		case 'guest_token':
209
+			if (User::instance()->user()) {
210
+				$e = new ExitException(
211
+					[
212
+						'access_denied',
213
+						'Only guests, not user allowed to access this grant_type'
214
+					],
215
+					403
216
+				);
217
+				$e->setJson();
218
+				throw $e;
219
+			}
220
+			if (!$Config->module('OAuth2')->guest_tokens) {
221
+				$e = new ExitException(
222
+					[
223
+						'access_denied',
224
+						'Guest tokens disabled'
225
+					],
226
+					403
227
+				);
228
+				$e->setJson();
229
+				throw $e;
230
+			}
231
+			$code = $OAuth2->add_code($client['id'], 'code', '');
232
+			if (!$code) {
233
+				$e = new ExitException(
234
+					[
235
+						'server_error',
236
+						"Server can't generate code, try later"
237
+					],
238
+					500
239
+				);
240
+				$e->setJson();
241
+				throw $e;
242
+			}
243
+			$token_data = $OAuth2->get_code($code, $client['id'], $client['secret'], '');
244
+			if ($token_data) {
245
+				unset($token_data['refresh_token']);
246
+				$Page->json($token_data);
247
+				return;
248
+			} else {
249
+				$e = new ExitException(
250
+					[
251
+						'server_error',
252
+						"Server can't get token data, try later"
253
+					],
254
+					500
255
+				);
256
+				$e->setJson();
257
+				throw $e;
258
+			}
259 259
 }
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  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
 namespace cs\modules\OAuth2;
10 10
 
11 11
 use
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
 	->header('pragma', 'no-cache');
21 21
 interface_off();
22 22
 /**
23
- * Errors processing
24
- */
23
+	 * Errors processing
24
+	 */
25 25
 $Config = Config::instance();
26 26
 $Page   = Page::instance();
27 27
 if (!isset($_POST['grant_type'])) {
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
 	throw $e;
142 142
 }
143 143
 /**
144
- * Tokens operations processing
145
- */
144
+	 * Tokens operations processing
145
+	 */
146 146
 switch ($_POST['grant_type']) {
147 147
 	case 'authorization_code':
148 148
 		if (!isset($_POST['code'])) {
Please login to merge, or discard this patch.
components/modules/Shop/Items.php 3 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
 	const DEFAULT_IMAGE = 'components/modules/Shop/includes/img/no-image.svg';
57 57
 
58
-	protected $data_model                  = [
58
+	protected $data_model = [
59 59
 		'id'         => 'int',
60 60
 		'date'       => 'int',
61 61
 		'category'   => 'int',
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 				'string'  => '',
444 444
 				'text'    => ''
445 445
 			];
446
-			$lang       = '';
446
+			$lang = '';
447 447
 			switch ($this->attribute_type_to_value_field($attribute_data['type'])) {
448 448
 				case 'numeric_value':
449 449
 					$value_type['numeric'] = $value;
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -286,17 +286,20 @@
 block discarded – undo
286 286
 		$where        = [];
287 287
 		$where_params = [];
288 288
 		foreach ($search_parameters as $key => $details) {
289
-			if (isset($this->data_model[$key])) { // Property
289
+			if (isset($this->data_model[$key])) {
290
+// Property
290 291
 				$where[]        = "`i`.`$key` = '%s'";
291 292
 				$where_params[] = $details;
292
-			} elseif (is_numeric($key)) { // Tag
293
+			} elseif (is_numeric($key)) {
294
+// Tag
293 295
 				$joins .=
294 296
 					"INNER JOIN `{$this->table}_tags` AS `t`
295 297
 					ON
296 298
 						`i`.`id`	= `t`.`id` AND
297 299
 						`t`.`tag`	= '%s'";
298 300
 				$where_params[] = $details;
299
-			} else { // Attribute
301
+			} else {
302
+// Attribute
300 303
 				$field = @$this->attribute_type_to_value_field($Attributes->get($key)['type']);
301 304
 				if (!$field || empty($details)) {
302 305
 					continue;
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   Shop
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   Shop
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\Shop;
10 10
 use
11 11
 	h,
Please login to merge, or discard this patch.
components/modules/Shop/Orders.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
 
68 68
 	const PAYMENT_METHOD_CASH = 'shop:cash';
69 69
 
70
-	protected $data_model            = [
70
+	protected $data_model = [
71 71
 		'id'                => 'int',
72 72
 		'user'              => 'int',
73 73
 		'date'              => 'int',
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   Shop
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   Shop
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\Shop;
10 10
 use
11 11
 	h,
Please login to merge, or discard this patch.
components/modules/Shop/categories_.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@
 block discarded – undo
113 113
 if (!$items) {
114 114
 	return;
115 115
 }
116
-$items_total     = $Items->search(
116
+$items_total = $Items->search(
117 117
 	[
118 118
 		'listed'      => 1,
119 119
 		'category'    => $current_category,
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   Shop
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   Shop
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\Shop;
10 10
 use
11 11
 	h,
Please login to merge, or discard this patch.
components/modules/Shop/items_.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 	':',
24 24
 	array_slice(Route::instance()->path, -1)[0]
25 25
 );
26
-$item       = $Items->get_for_user(array_pop($item));
26
+$item = $Items->get_for_user(array_pop($item));
27 27
 $Page->title($item['title']);
28 28
 $Page->Description = description($item['description']);
29 29
 $Page->canonical_url(
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   Shop
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   Shop
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\Shop;
10 10
 use
11 11
 	h,
Please login to merge, or discard this patch.
components/modules/Static_pages/Categories.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 	use
21 21
 		CRUD,
22 22
 		Singleton;
23
-	protected $data_model          = [
23
+	protected $data_model = [
24 24
 		'id'     => 'int',
25 25
 		'title'  => 'ml:text',
26 26
 		'path'   => 'ml:text',
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   Static Pages
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   Static Pages
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\Static_pages;
10 10
 use
11 11
 	cs\CRUD,
Please login to merge, or discard this patch.