Completed
Push — master ( aa4637...fa65af )
by Nazar
04:18
created
components/modules/OAuth2/OAuth2.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/plugins/Tags/Tags.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   Tags
4
- * @category  plugins
5
- * @author    Nazar Mokrynskyi <[email protected]>
6
- * @copyright Copyright (c) 2015-2016, Nazar Mokrynskyi
7
- * @license   MIT License, see license.txt
8
- */
3
+	 * @package   Tags
4
+	 * @category  plugins
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\plugins\Tags;
10 10
 use
11 11
 	cs\DB\Accessor;
Please login to merge, or discard this patch.
components/modules/Photo_gallery/Photo_gallery.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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'",
Please login to merge, or discard this patch.
components/modules/Comments/Comments.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -37,11 +37,11 @@  discard block
 block discarded – undo
37 37
 	/**
38 38
 	 * @var int	Avatar size in px, can be redefined
39 39
 	 */
40
-	public		$avatar_size	= 36;
40
+	public		$avatar_size = 36;
41 41
 
42 42
 	protected function construct () {
43
-		$this->module	= Request::instance()->current_module;
44
-		$this->cache	= new Cache_prefix("Comments/$this->module");
43
+		$this->module = Request::instance()->current_module;
44
+		$this->cache = new Cache_prefix("Comments/$this->module");
45 45
 	}
46 46
 	/**
47 47
 	 * Set module (current module assumed by default)
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 	 * @param string	$module	Module name
50 50
 	 */
51 51
 	function set_module ($module) {
52
-		$this->module	= $module;
53
-		$this->cache	= new Cache_prefix("Comments/$this->module");
52
+		$this->module = $module;
53
+		$this->cache = new Cache_prefix("Comments/$this->module");
54 54
 	}
55 55
 	/**
56 56
 	 * Returns database index
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @return array|false		Array of comment data on success or <b>false</b> on failure
69 69
 	 */
70 70
 	function get ($id) {
71
-		$id	= (int)$id;
71
+		$id = (int)$id;
72 72
 		return $this->db()->qf(
73 73
 			"SELECT
74 74
 				`id`,
@@ -97,14 +97,14 @@  discard block
 block discarded – undo
97 97
 	 * @return array|bool			Array of comment data on success or <b>false</b> on failure
98 98
 	 */
99 99
 	function add ($item, $text, $parent = 0) {
100
-		$L		= Language::instance();
100
+		$L = Language::instance();
101 101
 		$User	= User::instance();
102 102
 		$text	= xap($text, true);
103 103
 		if (!$text) {
104 104
 			return false;
105 105
 		}
106
-		$item	= (int)$item;
107
-		$parent	= (int)$parent;
106
+		$item = (int)$item;
107
+		$parent = (int)$parent;
108 108
 		if (
109 109
 			$parent != 0 &&
110 110
 			$this->db_prime()->qfs(
@@ -172,12 +172,12 @@  discard block
 block discarded – undo
172 172
 	 * @return array|false			Array of comment data on success or <b>false</b> on failure
173 173
 	 */
174 174
 	function set ($id, $text) {
175
-		$text	= xap($text, true);
175
+		$text = xap($text, true);
176 176
 		if (!$text) {
177 177
 			return false;
178 178
 		}
179
-		$id				= (int)$id;
180
-		$comment		= $this->get($id);
179
+		$id = (int)$id;
180
+		$comment = $this->get($id);
181 181
 		if (!$comment) {
182 182
 			return false;
183 183
 		}
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 			$this->module
194 194
 		)) {
195 195
 			unset($this->cache->{$comment['item']});
196
-			$comment['text']	= $text;
196
+			$comment['text'] = $text;
197 197
 			return $comment;
198 198
 		}
199 199
 		return false;
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
 	 * @return bool
207 207
 	 */
208 208
 	function del ($id) {
209
-		$id				= (int)$id;
210
-		$comment		= $this->db_prime()->qf(
209
+		$id = (int)$id;
210
+		$comment = $this->db_prime()->qf(
211 211
 			"SELECT `p`.`item`, COUNT(`c`.`id`) AS `count`
212 212
 			FROM `[prefix]comments` AS `p`
213 213
 			LEFT JOIN `[prefix]comments` AS `c`
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 	 * @return bool
245 245
 	 */
246 246
 	function del_all ($item) {
247
-		$item			= (int)$item;
247
+		$item = (int)$item;
248 248
 		if ($this->db_prime()->q(
249 249
 			"DELETE FROM `[prefix]comments`
250 250
 			WHERE
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
 		if (!is_array($data)) {
277 277
 			return 0;
278 278
 		}
279
-		$count	= 0;
279
+		$count = 0;
280 280
 		foreach ($data as &$d) {
281
-			$count	+= $this->count_internal($d['comments']) + 1;
281
+			$count += $this->count_internal($d['comments']) + 1;
282 282
 		}
283 283
 		return $count;
284 284
 	}
@@ -301,12 +301,12 @@  discard block
 block discarded – undo
301 301
 	 * @return false|array
302 302
 	 */
303 303
 	function tree_data ($item, $parent = 0) {
304
-		$Cache	= $this->cache;
305
-		$L		= Language::instance();
304
+		$Cache = $this->cache;
305
+		$L = Language::instance();
306 306
 		if (($comments = $Cache->{"$item/$L->clang"}) === false) {
307
-			$item		= (int)$item;
308
-			$parent		= (int)$parent;
309
-			$comments	= $this->db()->qfa(
307
+			$item = (int)$item;
308
+			$parent = (int)$parent;
309
+			$comments = $this->db()->qfa(
310 310
 				"SELECT
311 311
 					`id`,
312 312
 					`parent`,
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 			 * Cache only root tree data
332 332
 			 */
333 333
 			if ($parent == 0) {
334
-				$Cache->{"$item/$L->clang"}	= $comments;
334
+				$Cache->{"$item/$L->clang"} = $comments;
335 335
 			}
336 336
 		}
337 337
 		return $comments;
@@ -344,15 +344,15 @@  discard block
 block discarded – undo
344 344
 	 * @return string
345 345
 	 */
346 346
 	function tree_html ($comments) {
347
-		$L			= Language::instance();
348
-		$User		= User::instance();
347
+		$L = Language::instance();
348
+		$User = User::instance();
349 349
 		if (!is_array($comments) || !$comments) {
350 350
 			return '';
351 351
 		}
352
-		$content	= '';
352
+		$content = '';
353 353
 		foreach ($comments as $comment) {
354
-			$uniqid		= uniqid('comment_', true);
355
-			$content	.= str_replace($uniqid, $comment['text'], h::{'article.cs-comments-comment'}(
354
+			$uniqid = uniqid('comment_', true);
355
+			$content .= str_replace($uniqid, $comment['text'], h::{'article.cs-comments-comment'}(
356 356
 				h::{'img.cs-comments-comment-avatar'}([
357 357
 					'src'	=> $User->avatar($this->avatar_size, $comment['user']),
358 358
 					'alt'	=> $User->username($comment['user']),
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 	 * @return string
409 409
 	 */
410 410
 	function block ($item) {
411
-		$L	= new Language_prefix('comments_');
411
+		$L = new Language_prefix('comments_');
412 412
 		return h::{'section#comments.cs-comments-comments'}(
413 413
 			$L->comments.':'.
414 414
 			(
Please login to merge, or discard this patch.
core/traits/CRUD.php 1 patch
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 		$columns      = "`".implode("`,`", array_keys($columns))."`";
165 165
 		$first_column = array_keys($data_model)[0];
166 166
 		$data         = $this->db()->qf(
167
-			"SELECT $columns
167
+			"select $columns
168 168
 			FROM `$table`
169 169
 			WHERE `$first_column` = '%s'
170 170
 			LIMIT 1",
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 			: '';
213 213
 		$fields                   = '`'.implode('`,`', array_keys($model['data_model'])).'`';
214 214
 		$rows                     = $this->db_prime()->qfa(
215
-			"SELECT $fields
215
+			"select $fields
216 216
 			FROM `{$this->table}_$table`
217 217
 			WHERE
218 218
 					`$id_field`	= '%s'
Please login to merge, or discard this patch.