Completed
Push — master ( 477aa2...0a4bb5 )
by Angus
06:22
created
application/controllers/User/Favourites.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,9 @@  discard block
 block discarded – undo
6 6
 	}
7 7
 
8 8
 	public function index(int $page = 1) : void {
9
-		if($page === 0) redirect('user/favourites/1');
9
+		if($page === 0) {
10
+			redirect('user/favourites/1');
11
+		}
10 12
 
11 13
 		$this->header_data['title'] = "Favourites";
12 14
 		$this->header_data['page']  = "favourites";
@@ -16,7 +18,9 @@  discard block
 block discarded – undo
16 18
 		$this->body_data['currentPage'] = $page;
17 19
 		$this->body_data['totalPages']  = $favouriteData['totalPages'];
18 20
 
19
-		if($page > $this->body_data['totalPages'] && $page <= 1) redirect('user/favourites/1');
21
+		if($page > $this->body_data['totalPages'] && $page <= 1) {
22
+			redirect('user/favourites/1');
23
+		}
20 24
 
21 25
 		$this->_render_page('User/Favourites');
22 26
 	}
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 
32 32
 			case 'csv':
33 33
 				$this->output->set_content_type('text/csv', 'utf-8');
34
-				$this->_render_content($this->Tracker->portation->arrayToCSVRecursive($favouriteData, 'Date/Time,Title,Manga URL,Site,Chapter,Chapter Number, Chapter URL', ',', '"', FALSE, TRUE), 'csv',TRUE, 'tracker-favourite');
34
+				$this->_render_content($this->Tracker->portation->arrayToCSVRecursive($favouriteData, 'Date/Time,Title,Manga URL,Site,Chapter,Chapter Number, Chapter URL', ',', '"', FALSE, TRUE), 'csv', TRUE, 'tracker-favourite');
35 35
 				break;
36 36
 
37 37
 			default:
Please login to merge, or discard this patch.
application/helpers/generic_helper.php 2 patches
Braces   +6 added lines, -5 removed lines patch added patch discarded remove patch
@@ -32,18 +32,19 @@
 block discarded – undo
32 32
 	return $time_string;
33 33
 }
34 34
 
35
-if (!function_exists('http_parse_headers')) { #http://www.php.net/manual/en/function.http-parse-headers.php#112917
35
+if (!function_exists('http_parse_headers')) {
36
+#http://www.php.net/manual/en/function.http-parse-headers.php#112917
36 37
 	function http_parse_headers (string $raw_headers) : array {
37 38
 		$headers = array(); // $headers = [];
38 39
 		foreach (explode("\n", $raw_headers) as $i => $h) {
39 40
 			$h = explode(':', $h, 2);
40
-			if (isset($h[1])){
41
-				if(!isset($headers[$h[0]])){
41
+			if (isset($h[1])) {
42
+				if(!isset($headers[$h[0]])) {
42 43
 					$headers[$h[0]] = trim($h[1]);
43
-				}else if(is_array($headers[$h[0]])){
44
+				} else if(is_array($headers[$h[0]])) {
44 45
 					$tmp = array_merge($headers[$h[0]],array(trim($h[1])));
45 46
 					$headers[$h[0]] = $tmp;
46
-				}else{
47
+				} else {
47 48
 					$tmp = array_merge(array($headers[$h[0]]),array(trim($h[1])));
48 49
 					$headers[$h[0]] = $tmp;
49 50
 				}
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @return bool
7 7
  */
8 8
 function view_exists(string $path) : bool {
9
-	return file_exists(APPPATH . "/views/{$path}.php");
9
+	return file_exists(APPPATH."/views/{$path}.php");
10 10
 }
11 11
 
12 12
 function get_time_class(string $time_string) : string {
@@ -32,19 +32,19 @@  discard block
 block discarded – undo
32 32
 	return $time_string;
33 33
 }
34 34
 
35
-if (!function_exists('http_parse_headers')) { #http://www.php.net/manual/en/function.http-parse-headers.php#112917
36
-	function http_parse_headers (string $raw_headers) : array {
35
+if(!function_exists('http_parse_headers')) { #http://www.php.net/manual/en/function.http-parse-headers.php#112917
36
+	function http_parse_headers(string $raw_headers) : array {
37 37
 		$headers = array(); // $headers = [];
38
-		foreach (explode("\n", $raw_headers) as $i => $h) {
38
+		foreach(explode("\n", $raw_headers) as $i => $h) {
39 39
 			$h = explode(':', $h, 2);
40
-			if (isset($h[1])){
41
-				if(!isset($headers[$h[0]])){
40
+			if(isset($h[1])) {
41
+				if(!isset($headers[$h[0]])) {
42 42
 					$headers[$h[0]] = trim($h[1]);
43
-				}else if(is_array($headers[$h[0]])){
44
-					$tmp = array_merge($headers[$h[0]],array(trim($h[1])));
43
+				} else if(is_array($headers[$h[0]])) {
44
+					$tmp = array_merge($headers[$h[0]], array(trim($h[1])));
45 45
 					$headers[$h[0]] = $tmp;
46
-				}else{
47
-					$tmp = array_merge(array($headers[$h[0]]),array(trim($h[1])));
46
+				} else {
47
+					$tmp = array_merge(array($headers[$h[0]]), array(trim($h[1])));
48 48
 					$headers[$h[0]] = $tmp;
49 49
 				}
50 50
 			}
@@ -66,19 +66,19 @@  discard block
 block discarded – undo
66 66
 	} elseif($notices = $CI->session->flashdata('errors')) {
67 67
 		$CI->session->unset_userdata('errors'); //Sometimes we call this flashdata without redirecting, so make sure we remove it
68 68
 		if(is_string($notices)) {
69
-			$notice_str = $CI->config->item('error_start_delimiter', 'ion_auth') . $notices . $CI->config->item('error_end_delimiter', 'ion_auth');
69
+			$notice_str = $CI->config->item('error_start_delimiter', 'ion_auth').$notices.$CI->config->item('error_end_delimiter', 'ion_auth');
70 70
 		} elseif(is_array($notices)) {
71 71
 			foreach($notices as $notice) {
72
-				$notice_str .= $CI->config->item('error_start_delimiter', 'ion_auth') . $notice . $CI->config->item('error_end_delimiter', 'ion_auth');
72
+				$notice_str .= $CI->config->item('error_start_delimiter', 'ion_auth').$notice.$CI->config->item('error_end_delimiter', 'ion_auth');
73 73
 			}
74 74
 		}
75 75
 	} elseif($notices = $CI->session->flashdata('notices')) {
76 76
 		$CI->session->unset_userdata('notices'); //Sometimes we call this flashdata without redirecting, so make sure we remove it
77 77
 		if(is_string($notices)) {
78
-			$notice_str = $CI->config->item('message_start_delimiter', 'ion_auth') . $notices . $CI->config->item('message_end_delimiter', 'ion_auth');
78
+			$notice_str = $CI->config->item('message_start_delimiter', 'ion_auth').$notices.$CI->config->item('message_end_delimiter', 'ion_auth');
79 79
 		} elseif(is_array($notices)) {
80 80
 			foreach($notices as $notice) {
81
-				$notice_str .= $CI->config->item('message_start_delimiter', 'ion_auth') . $notice . $CI->config->item('message_end_delimiter', 'ion_auth');
81
+				$notice_str .= $CI->config->item('message_start_delimiter', 'ion_auth').$notice.$CI->config->item('message_end_delimiter', 'ion_auth');
82 82
 			}
83 83
 		}
84 84
 	}
Please login to merge, or discard this patch.
application/controllers/Ajax/Userscript.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,9 +53,9 @@
 block discarded – undo
53 53
 				];
54 54
 
55 55
 				$this->output
56
-				     ->set_status_header('200')
57
-				     ->set_content_type('application/json', 'utf-8')
58
-				     ->set_output(json_encode($json));
56
+					 ->set_status_header('200')
57
+					 ->set_content_type('application/json', 'utf-8')
58
+					 ->set_output(json_encode($json));
59 59
 			} else {
60 60
 				//TODO: We should probably try and have more verbose errors here. Return via JSON or something.
61 61
 				$this->output->set_status_header('400', 'Unable to update?');
Please login to merge, or discard this patch.
application/models/Tracker/Tracker_Sites_Model.php 4 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php declare(strict_types=1); defined('BASEPATH') OR exit('No direct script access allowed');
1
+<?php declare(strict_types=1); defined('BASEPATH') or exit('No direct script access allowed');
2 2
 
3 3
 /**
4 4
  * Class Tracker_Sites_Model
Please login to merge, or discard this patch.
Braces   +36 added lines, -12 removed lines patch added patch discarded remove patch
@@ -125,7 +125,9 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	final public function isValidTitleURL(string $title_url) : bool {
127 127
 		$success = (bool) preg_match($this->titleFormat, $title_url);
128
-		if(!$success) log_message('error', "Invalid Title URL ({$this->site}): {$title_url}");
128
+		if(!$success) {
129
+			log_message('error', "Invalid Title URL ({$this->site}): {$title_url}");
130
+		}
129 131
 		return $success;
130 132
 	}
131 133
 
@@ -139,7 +141,9 @@  discard block
 block discarded – undo
139 141
 	 */
140 142
 	final public function isValidChapter(string $chapter) : bool {
141 143
 		$success = (bool) preg_match($this->chapterFormat, $chapter);
142
-		if(!$success) log_message('error', "Invalid Chapter ({$this->site}): {$chapter}");
144
+		if(!$success) {
145
+			log_message('error', "Invalid Chapter ({$this->site}): {$chapter}");
146
+		}
143 147
 		return $success;
144 148
 	}
145 149
 
@@ -168,14 +172,20 @@  discard block
 block discarded – undo
168 172
 			//curl_setopt($ch, CURLOPT_VERBOSE, 1);
169 173
 			curl_setopt($ch, CURLOPT_HEADER, 1);
170 174
 
171
-			if($follow_redirect)        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
175
+			if($follow_redirect) {
176
+				curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
177
+			}
172 178
 
173 179
 			if($cookies = $this->cache->get("cloudflare_{$this->site}")) {
174 180
 				$cookie_string .= "; {$cookies}";
175 181
 			}
176 182
 
177
-			if(!empty($cookie_string))  curl_setopt($ch, CURLOPT_COOKIE, $cookie_string);
178
-			if(!empty($cookiejar_path)) curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path);
183
+			if(!empty($cookie_string)) {
184
+				curl_setopt($ch, CURLOPT_COOKIE, $cookie_string);
185
+			}
186
+			if(!empty($cookiejar_path)) {
187
+				curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path);
188
+			}
179 189
 
180 190
 			//Some sites check the useragent for stuff, use a pre-defined user-agent to avoid stuff.
181 191
 			curl_setopt($ch, CURLOPT_USERAGENT, $this->userAgent);
@@ -206,7 +216,9 @@  discard block
 block discarded – undo
206 216
 			$body        = substr($response, $header_size);
207 217
 			curl_close($ch);
208 218
 
209
-			if($status_code === 503) $refresh = $this->handleCloudFlare($url, $body);
219
+			if($status_code === 503) {
220
+				$refresh = $this->handleCloudFlare($url, $body);
221
+			}
210 222
 		}
211 223
 
212 224
 		return [
@@ -312,7 +324,9 @@  discard block
 block discarded – undo
312 324
 								'nodes_chapter' => $nodes_chapter->item(0)
313 325
 							];
314 326
 
315
-							if(is_callable($extraCall)) $extraCall($xpath, $returnData);
327
+							if(is_callable($extraCall)) {
328
+								$extraCall($xpath, $returnData);
329
+							}
316 330
 
317 331
 							return $returnData;
318 332
 						} else {
@@ -326,7 +340,9 @@  discard block
 block discarded – undo
326 340
 						$noChaptersCall($data, $xpath, $returnData);
327 341
 
328 342
 						if(is_array($returnData)) {
329
-							if(is_callable($extraCall) && is_array($returnData)) $extraCall($xpath, $returnData);
343
+							if(is_callable($extraCall) && is_array($returnData)) {
344
+								$extraCall($xpath, $returnData);
345
+							}
330 346
 						} else {
331 347
 							log_message('error', "{$this->site} : {$title_url} | canHaveNoChapters set, but doesn't match possible checks! XPath is probably broken.");
332 348
 						}
@@ -461,8 +477,12 @@  discard block
 block discarded – undo
461 477
 		$status = FALSE;
462 478
 
463 479
 		//Make sure we have a volume element
464
-		if(count($oldChapterSegments) === 1) array_unshift($oldChapterSegments, 'v0');
465
-		if(count($newChapterSegments) === 1) array_unshift($newChapterSegments, 'v0');
480
+		if(count($oldChapterSegments) === 1) {
481
+			array_unshift($oldChapterSegments, 'v0');
482
+		}
483
+		if(count($newChapterSegments) === 1) {
484
+			array_unshift($newChapterSegments, 'v0');
485
+		}
466 486
 
467 487
 		$oldCount = count($oldChapterSegments);
468 488
 		$newCount = count($newChapterSegments);
@@ -475,8 +495,12 @@  discard block
 block discarded – undo
475 495
 				$newVolume = substr(array_shift($newChapterSegments), 1);
476 496
 
477 497
 				//Forcing volume to 0 as TBD might not be the latest (although it can be, but that is covered by other checks)
478
-				if(in_array($oldVolume, ['TBD', 'TBA', 'NA', 'LMT'])) $oldVolume = 0;
479
-				if(in_array($newVolume, ['TBD', 'TBA', 'NA', 'LMT'])) $newVolume = 0;
498
+				if(in_array($oldVolume, ['TBD', 'TBA', 'NA', 'LMT'])) {
499
+					$oldVolume = 0;
500
+				}
501
+				if(in_array($newVolume, ['TBD', 'TBA', 'NA', 'LMT'])) {
502
+					$newVolume = 0;
503
+				}
480 504
 
481 505
 				$oldVolume = floatval($oldVolume);
482 506
 				$newVolume = floatval($newVolume);
Please login to merge, or discard this patch.
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -531,6 +531,10 @@
 block discarded – undo
531 531
 	final private function _getSiteRateLimit() : int {
532 532
 		return (int) ($this->cache->get("{$this->site}_ratelimit") ?: 0);
533 533
 	}
534
+
535
+	/**
536
+	 * @param integer $rateLimit
537
+	 */
534 538
 	final private function _setSiteRateLimit(?int $rateLimit = NULL) : bool {
535 539
 		//We would just use increment(), but we can't set ttl with it...
536 540
 		$currentRateLimit = $rateLimit ?: $this->_getSiteRateLimit();
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 				//We don't want double trailing slashes, so fix this when possible.
121 121
 				$pageSeparator = '';
122 122
 			}
123
-			$pageURL = $chapterData['url'] . $pageSeparator . $page;
123
+			$pageURL = $chapterData['url'].$pageSeparator.$page;
124 124
 		}
125 125
 		return $pageURL;
126 126
 	}
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 
215 215
 			$ch = curl_init();
216 216
 			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
217
-			curl_setopt($ch, CURLOPT_ENCODING , 'gzip');
217
+			curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
218 218
 			//curl_setopt($ch, CURLOPT_VERBOSE, 1);
219 219
 			curl_setopt($ch, CURLOPT_HEADER, 1);
220 220
 
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
 			curl_setopt($ch, CURLOPT_URL, $url);
242 242
 
243 243
 			if($isPost) {
244
-				curl_setopt($ch,CURLOPT_POST, count($postFields));
245
-				curl_setopt($ch,CURLOPT_POSTFIELDS, http_build_query($postFields));
244
+				curl_setopt($ch, CURLOPT_POST, count($postFields));
245
+				curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postFields));
246 246
 			}
247 247
 
248 248
 			$response = curl_exec($ch);
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 			$result = shell_exec('python3 '.APPPATH.'../_scripts/get_cloudflare_cookie.py '.escapeshellarg(json_encode($urlData)));
290 290
 			$cookieData = json_decode($result, TRUE);
291 291
 
292
-			$this->cache->save("cloudflare_{$this->site}", $cookieData['cookies'],  31536000 /* 1 year, or until we renew it */);
292
+			$this->cache->save("cloudflare_{$this->site}", $cookieData['cookies'], 31536000 /* 1 year, or until we renew it */);
293 293
 			log_message('debug', "Saving CloudFlare Cookies for {$this->site}");
294 294
 
295 295
 			$refresh = TRUE;
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 
353 353
 				$dom = new DOMDocument();
354 354
 				libxml_use_internal_errors(TRUE);
355
-				$dom->loadHTML('<?xml encoding="utf-8" ?>' . $data);
355
+				$dom->loadHTML('<?xml encoding="utf-8" ?>'.$data);
356 356
 				libxml_use_internal_errors(FALSE);
357 357
 
358 358
 				$xpath = new DOMXPath($dom);
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 				if($nodes_title->length === 1) {
362 362
 					if($nodes_row->length === 1) {
363 363
 						$firstRow      = $nodes_row->item(0);
364
-						$nodes_latest  = $xpath->query($node_latest_string,  $firstRow);
364
+						$nodes_latest  = $xpath->query($node_latest_string, $firstRow);
365 365
 
366 366
 						if($node_chapter_string !== '') {
367 367
 							$nodes_chapter = $xpath->query($node_chapter_string, $firstRow);
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 	final private function _setSiteRateLimit(?int $rateLimit = NULL) : bool {
578 578
 		//We would just use increment(), but we can't set ttl with it...
579 579
 		$currentRateLimit = $rateLimit ?: $this->_getSiteRateLimit();
580
-		return $this->cache->save("{$this->site}_ratelimit", $currentRateLimit + 1,3600);
580
+		return $this->cache->save("{$this->site}_ratelimit", $currentRateLimit + 1, 3600);
581 581
 	}
582 582
 }
583 583
 
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 		$chapter_parts = explode('/', $chapter); //returns #LANG#/#VOLUME#/#CHAPTER#/#CHAPTER_EXTRA#(/#PAGE#/)
596 596
 		return [
597 597
 			'url'    => $this->getChapterURL($title_url, $chapter),
598
-			'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '') . "c{$chapter_parts[2]}" . (isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/
598
+			'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '')."c{$chapter_parts[2]}".(isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/
599 599
 		];
600 600
 	}
601 601
 	public function getChapterURL(string $title_url, string $chapter) : string {
@@ -785,9 +785,9 @@  discard block
 block discarded – undo
785 785
 
786 786
 							$dateString = str_replace('/', '-', trim($nodes_latest->item(0)->nodeValue)); //NOTE: We replace slashes here as it stops strtotime interpreting the date as US date format.
787 787
 							if($dateString == 'T') {
788
-								$dateString = date("Y-m-d",now());
788
+								$dateString = date("Y-m-d", now());
789 789
 							}
790
-							$titleData['last_updated'] = date("Y-m-d H:i:s", strtotime($dateString . ' 00:00'));
790
+							$titleData['last_updated'] = date("Y-m-d H:i:s", strtotime($dateString.' 00:00'));
791 791
 
792 792
 							$titleDataList[$title_url] = $titleData;
793 793
 						}
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
 	public $chapterFormat = '/^[0-9\.]+$/';
812 812
 	public $pageSeparator = '/';
813 813
 
814
-	public $customType    = 2;#
814
+	public $customType    = 2; #
815 815
 
816 816
 	public $version = 1; # New versions of GlossyBright have a diff style.
817 817
 
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
 				$titleData['title'] = preg_replace('/^Meraki Scans - (.*?)$/', '$1', trim($data['nodes_title']->textContent));
870 870
 				//For whatever reason, DOMDocument breaks the <link> element we need to grab the chapter, so we have to grab it elsewhere.
871 871
 				$chapter = preg_replace('/^.*?(https:\/\/.*)$/', '$1', trim($data['nodes_chapter']->textContent));
872
-				$titleData['latest_chapter'] = explode('/', $chapter)[sizeof(explode('/', $chapter))-2];
872
+				$titleData['latest_chapter'] = explode('/', $chapter)[sizeof(explode('/', $chapter)) - 2];
873 873
 
874 874
 				$titleData['last_updated'] = date('Y-m-d H:i:s', strtotime((string) $data['nodes_latest']->textContent));
875 875
 			}
@@ -979,11 +979,11 @@  discard block
 block discarded – undo
979 979
 			""
980 980
 		);
981 981
 		if($data) {
982
-			$titleData['title'] = trim(preg_replace('/ Added on .*$/','', $data['nodes_title']->textContent));
982
+			$titleData['title'] = trim(preg_replace('/ Added on .*$/', '', $data['nodes_title']->textContent));
983 983
 			$titleData['latest_chapter'] = preg_replace('/^.*\/([0-9\.]+)$/', '$1', (string) $data['nodes_chapter']->getAttribute('href'));
984 984
 
985
-			$dateString = preg_replace('/^Added (?:on )?/', '',$data['nodes_latest']->textContent);
986
-			$titleData['last_updated'] =  date("Y-m-d H:i:s", strtotime($dateString));
985
+			$dateString = preg_replace('/^Added (?:on )?/', '', $data['nodes_latest']->textContent);
986
+			$titleData['last_updated'] = date("Y-m-d H:i:s", strtotime($dateString));
987 987
 		}
988 988
 		return (!empty($titleData) ? $titleData : NULL);
989 989
 	}
@@ -1061,9 +1061,9 @@  discard block
 block discarded – undo
1061 1061
 	public function getChapterData(string $title_url, string $chapter) : array {
1062 1062
 		if(strpos($chapter, '/')) {
1063 1063
 			$chapterArr = explode('/', $chapter);
1064
-			$chapterN   = "v{$chapterArr[0]}/c".str_replace('chapter_','',$chapterArr[1]);
1065
-		} else if (ctype_digit($chapter)) {
1066
-			$chapterN = 'c'.str_replace('chapter_','', $chapter);
1064
+			$chapterN   = "v{$chapterArr[0]}/c".str_replace('chapter_', '', $chapterArr[1]);
1065
+		} else if(ctype_digit($chapter)) {
1066
+			$chapterN = 'c'.str_replace('chapter_', '', $chapter);
1067 1067
 		}
1068 1068
 		return [
1069 1069
 			'url'    => $this->getChapterURL($title_url, $chapter),
Please login to merge, or discard this patch.
application/models/Tracker/Tracker_Issue_Model.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@
 block discarded – undo
11 11
 
12 12
 		//This is pretty barebones issue reporting, and honestly not a great way to do it, but it works for now (until the Github is public).
13 13
 		$body = "".
14
-		        (!is_null($url) && !empty($url) ? "URL: ".htmlspecialchars(substr($url, 0, 255))."<br>\n" : "").
15
-		        "Submitted by: ".$this->input->ip_address().(!is_null($userID) ? "| {$userID}" : "")."<br>\n".
16
-		        "<br>Bug report: ".htmlspecialchars(substr($text, 0, 1000));
14
+				(!is_null($url) && !empty($url) ? "URL: ".htmlspecialchars(substr($url, 0, 255))."<br>\n" : "").
15
+				"Submitted by: ".$this->input->ip_address().(!is_null($userID) ? "| {$userID}" : "")."<br>\n".
16
+				"<br>Bug report: ".htmlspecialchars(substr($text, 0, 1000));
17 17
 
18 18
 		$success = TRUE;
19 19
 		$this->email->from('[email protected]', $this->config->item('site_title', 'ion_auth'));
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php declare(strict_types=1); defined('BASEPATH') OR exit('No direct script access allowed');
1
+<?php declare(strict_types=1); defined('BASEPATH') or exit('No direct script access allowed');
2 2
 
3 3
 class Tracker_Issue_Model extends Tracker_Base_Model {
4 4
 	public function __construct() {
Please login to merge, or discard this patch.
application/controllers/ReportIssue.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php defined('BASEPATH') OR exit('No direct script access allowed');
1
+<?php defined('BASEPATH') or exit('No direct script access allowed');
2 2
 
3 3
 class ReportIssue extends MY_Controller {
4 4
 	public function __construct() {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 		return;
16 16
 
17 17
 		$this->form_validation->set_rules('issue_description', 'Description', 'required|max_length[1000]');
18
-		$this->form_validation->set_rules('issue_url',         'URL',         'valid_url');
18
+		$this->form_validation->set_rules('issue_url', 'URL', 'valid_url');
19 19
 
20 20
 
21 21
 		$this->body_data['issue_submitted'] = FALSE;
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
 
25 25
 			if(!empty($this->input->post('website'))) {
26 26
 				$this->body_data['issue_submitted'] = FALSE;
27
-				log_message('error', 'Bot attempting to spam report issue form: "' . $this->input->post('issue_description') . '"');
27
+				log_message('error', 'Bot attempting to spam report issue form: "'.$this->input->post('issue_description').'"');
28 28
 			} else {
29
-				$this->body_data['issue_submitted'] = $this->Tracker->issue->report('USERID:' . $this->User->id . ' ||| ' . $this->input->post('issue_description'), NULL, $this->input->post('issue_url'));
29
+				$this->body_data['issue_submitted'] = $this->Tracker->issue->report('USERID:'.$this->User->id.' ||| '.$this->input->post('issue_description'), NULL, $this->input->post('issue_url'));
30 30
 			}
31 31
 		}
32 32
 
Please login to merge, or discard this patch.
_scripts/generate_foolslide.php 3 patches
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php declare(strict_types=1);
2 2
 
3
-if(!extension_loaded('gd')) die('GD ext is required to run this!');
3
+if(!extension_loaded('gd')) {
4
+	die('GD ext is required to run this!');
5
+}
4 6
 
5 7
 chdir(dirname(__FILE__).'/../'); //Just to make things easier, change dir to project root.
6 8
 
@@ -9,7 +11,7 @@  discard block
 block discarded – undo
9 11
 	private $className;
10 12
 
11 13
 	public function __construct() {
12
-		if(isset($_SERVER['argv']) && count($_SERVER['argv']) === 3){
14
+		if(isset($_SERVER['argv']) && count($_SERVER['argv']) === 3) {
13 15
 			$this->baseURL   = rtrim($_SERVER['argv'][1], '/');
14 16
 			$this->className = $_SERVER['argv'][2];
15 17
 
@@ -98,7 +100,9 @@  discard block
 block discarded – undo
98 100
 		$baseFile = file_get_contents($baseFileName);
99 101
 
100 102
 		$parse = parse_url($this->baseURL);
101
-		if(strpos($baseFile, $parse['host']) !== false) die("Domain already exists in userscript?");
103
+		if(strpos($baseFile, $parse['host']) !== false) {
104
+			die("Domain already exists in userscript?");
105
+		}
102 106
 
103 107
 		preg_match('/\@updated      ([0-9\-]+)[\r\n]+.*?\@version      ([0-9\.]+)/s', $baseFile, $matches);
104 108
 
@@ -188,7 +192,9 @@  discard block
 block discarded – undo
188 192
 			}
189 193
 		}
190 194
 
191
-		if(empty($titleArr)) die("API isn't returning any titles?");
195
+		if(empty($titleArr)) {
196
+			die("API isn't returning any titles?");
197
+		}
192 198
 		return $titleArr;
193 199
 	}
194 200
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
 		//Replace class names
69 69
 		$baseFile = str_replace('class HelveticaScans', "class {$this->className}", $baseFile);
70
-		$baseFile = str_replace('coversDefaultClass HelveticaScans', "coversDefaultClass {$this->className}", $baseFile);
70
+		$baseFile = str_replace('coversDefaultClass HelveticaScans', "coversdefaultclass {$this->className}", $baseFile);
71 71
 
72 72
 		//Replace tests
73 73
 		$titleList  = $this->getTitles();
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 		$baseFile = file_get_contents($baseFileName);
99 99
 
100 100
 		$parse = parse_url($this->baseURL);
101
-		if(strpos($baseFile, $parse['host']) !== false) die("Domain already exists in userscript?");
101
+		if(strpos($baseFile, $parse['host']) !== FALSE) die("Domain already exists in userscript?");
102 102
 
103 103
 		preg_match('/\@updated      ([0-9\-]+)[\r\n]+.*?\@version      ([0-9\.]+)/s', $baseFile, $matches);
104 104
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 		$require = <<<EOT
121 121
 // @require      https://{$baseDomain}/userscripts/sites/{$this->className}.1.js
122 122
 // @resource     fontAwesome
123
-EOT;
123
+eot;
124 124
 		$baseFile = str_replace('// @resource     fontAwesome', $require, $baseFile);
125 125
 
126 126
 		file_put_contents($baseFileName, $baseFile);
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	};
147 147
 })(window.trackerSites = (window.trackerSites || {}));
148 148
 
149
-EOT;
149
+eot;
150 150
 
151 151
 		file_put_contents("./public/userscripts/sites/{$this->className}.js", $siteData);
152 152
 	}
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
 
167 167
 		$ch = curl_init("{$this->baseURL}/api/reader/chapters/orderby/desc_created/format/json");
168 168
 
169
-		curl_setopt($ch, CURLOPT_NOBODY, true);
170
-		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
169
+		curl_setopt($ch, CURLOPT_NOBODY, TRUE);
170
+		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
171 171
 		curl_exec($ch);
172 172
 		$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
173 173
 		curl_close($ch);
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 		if($content = file_get_contents($jsonURL)) {
182 182
 			$json = json_decode($content, TRUE);
183 183
 			shuffle($json['comics']);
184
-			$comics = array_slice($json['comics'], 0, 5, true);
184
+			$comics = array_slice($json['comics'], 0, 5, TRUE);
185 185
 
186 186
 			foreach($comics as $comic) {
187 187
 				$titleArr[$comic['stub']] = $comic['name'];
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 	private $className;
10 10
 
11 11
 	public function __construct() {
12
-		if(isset($_SERVER['argv']) && count($_SERVER['argv']) === 3){
12
+		if(isset($_SERVER['argv']) && count($_SERVER['argv']) === 3) {
13 13
 			$this->baseURL   = rtrim($_SERVER['argv'][1], '/');
14 14
 			$this->className = $_SERVER['argv'][2];
15 15
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
 		$this->updateDocs();
31 31
 
32
-		$domain =  preg_replace('#^https?://(.*?)(?:/.*?)?$#', '$1', $this->baseURL);
32
+		$domain = preg_replace('#^https?://(.*?)(?:/.*?)?$#', '$1', $this->baseURL);
33 33
 		say("\nAdmin SQL:");
34 34
 		say("INSERT INTO `mangatracker_development`.`tracker_sites` (`id`, `site`, `site_class`, `status`, `use_custom`) VALUES (NULL, '{$domain}', '{$this->className}', 'enabled', 'Y');");
35 35
 		say("INSERT INTO `mangatracker_production`.`tracker_sites` (`id`, `site`, `site_class`, `status`, `use_custom`) VALUES (NULL, '{$domain}', '{$this->className}', 'enabled', 'Y');");
@@ -108,12 +108,12 @@  discard block
 block discarded – undo
108 108
 
109 109
 		//Update @updated
110 110
 		$currentDate = date("Y-m-d", time());
111
-		$baseFile = str_replace("@updated      {$matches[1]}","@updated      {$currentDate}", $baseFile);
111
+		$baseFile = str_replace("@updated      {$matches[1]}", "@updated      {$currentDate}", $baseFile);
112 112
 
113 113
 		//Update @version
114 114
 		$currentVersion = explode('.', $matches[2]);
115
-		$newVersion = "{$currentVersion[0]}.{$currentVersion[1]}.". (((int) $currentVersion[2]) + 1);
116
-		$baseFile = str_replace("@version      {$matches[2]}","@version      {$newVersion}", $baseFile);
115
+		$newVersion = "{$currentVersion[0]}.{$currentVersion[1]}.".(((int) $currentVersion[2]) + 1);
116
+		$baseFile = str_replace("@version      {$matches[2]}", "@version      {$newVersion}", $baseFile);
117 117
 
118 118
 		//Add @require
119 119
 		// @resource     fontAwesome
Please login to merge, or discard this patch.
application/core/MY_Log.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@
 block discarded – undo
137 137
 	 * Write to defined logger. Is called from CodeIgniters native log_message()
138 138
 	 *
139 139
 	 * @param string $level
140
-	 * @param $msg
140
+	 * @param string $msg
141 141
 	 * @return bool
142 142
 	 */
143 143
 	public function write_log($level = 'error', $msg)
Please login to merge, or discard this patch.
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -67,8 +67,7 @@  discard block
 block discarded – undo
67 67
 		// detect and register all PHP errors in this log hence forth
68 68
 		ErrorHandler::register($this->log);
69 69
 
70
-		if ($this->config['introspection_processor'])
71
-		{
70
+		if ($this->config['introspection_processor']) {
72 71
 			// add controller and line number info to each log message
73 72
 			// 2 = depth in the stacktrace to ignore. This gives us the file
74 73
 			// making the call to log_message();
@@ -76,10 +75,8 @@  discard block
 block discarded – undo
76 75
 		}
77 76
 
78 77
 		// decide which handler(s) to use
79
-		foreach ($this->config['handlers'] as $value)
80
-		{
81
-			switch ($value)
82
-			{
78
+		foreach ($this->config['handlers'] as $value) {
79
+			switch ($value) {
83 80
 				case 'file':
84 81
 					$handler = new RotatingFileHandler($this->config['file_logfile']);
85 82
 					$formatter = new LineFormatter(null, null, $config['file_multiline']);
@@ -140,35 +137,28 @@  discard block
 block discarded – undo
140 137
 	 * @param $msg
141 138
 	 * @return bool
142 139
 	 */
143
-	public function write_log($level = 'error', $msg)
144
-	{
140
+	public function write_log($level = 'error', $msg) {
145 141
 		$level = strtoupper($level);
146 142
 
147 143
 		// verify error level
148
-		if (!isset($this->_levels[$level]))
149
-		{
144
+		if (!isset($this->_levels[$level])) {
150 145
 			$this->log->addError('unknown error level: ' . $level);
151 146
 			$level = 'ALL';
152 147
 		}
153 148
 
154 149
 		// filter out anything in $this->config['exclusion_list']
155
-		if (!empty($this->config['exclusion_list']))
156
-		{
157
-			foreach ($this->config['exclusion_list'] as $findme)
158
-			{
150
+		if (!empty($this->config['exclusion_list'])) {
151
+			foreach ($this->config['exclusion_list'] as $findme) {
159 152
 				$pos = strpos($msg, $findme);
160
-				if ($pos !== false)
161
-				{
153
+				if ($pos !== false) {
162 154
 					// just exit now - we don't want to log this error
163 155
 					return true;
164 156
 				}
165 157
 			}
166 158
 		}
167 159
 
168
-		if ($this->_levels[$level] <= $this->config['threshold'])
169
-		{
170
-			switch ($level)
171
-			{
160
+		if ($this->_levels[$level] <= $this->config['threshold']) {
161
+			switch ($level) {
172 162
 				case 'ERROR':
173 163
 					$this->log->addError($msg);
174 164
 					break;
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -48,22 +48,22 @@  discard block
 block discarded – undo
48 48
 	public function __construct() {
49 49
 		$file_path = APPPATH.'config/monolog.php';
50 50
 		$found = FALSE;
51
-		if (file_exists($file_path)) {
51
+		if(file_exists($file_path)) {
52 52
 			$found = TRUE;
53 53
 			require($file_path);
54 54
 		}
55 55
 
56 56
 		// Is the config file in the environment folder?
57
-		if (file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/monolog.php')) {
57
+		if(file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/monolog.php')) {
58 58
 			require($file_path);
59
-		} elseif (!$found) {
59
+		} elseif(!$found) {
60 60
 			exit('monolog.php config does not exist');
61 61
 		}
62 62
 
63 63
 		// Is the config file in the _secure folder?
64
-		if (file_exists($file_path = APPPATH.'config/_secure/monolog.php')) {
64
+		if(file_exists($file_path = APPPATH.'config/_secure/monolog.php')) {
65 65
 			require($file_path);
66
-		} elseif (!$found) {
66
+		} elseif(!$found) {
67 67
 			exit('monolog.php config does not exist');
68 68
 		}
69 69
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		// detect and register all PHP errors in this log hence forth
75 75
 		ErrorHandler::register($this->log);
76 76
 
77
-		if ($this->config['introspection_processor'])
77
+		if($this->config['introspection_processor'])
78 78
 		{
79 79
 			// add controller and line number info to each log message
80 80
 			// 2 = depth in the stacktrace to ignore. This gives us the file
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
 		}
84 84
 
85 85
 		// decide which handler(s) to use
86
-		foreach ($this->config['handlers'] as $value)
86
+		foreach($this->config['handlers'] as $value)
87 87
 		{
88
-			switch ($value)
88
+			switch($value)
89 89
 			{
90 90
 				case 'file':
91 91
 					$handler = new RotatingFileHandler($this->config['file_logfile']);
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 					break;
131 131
 
132 132
 				default:
133
-					exit('log handler not supported: ' . $value . "\n");
133
+					exit('log handler not supported: '.$value."\n");
134 134
 			}
135 135
 
136 136
 			$this->log->pushHandler($handler);
@@ -152,19 +152,19 @@  discard block
 block discarded – undo
152 152
 		$level = strtoupper($level);
153 153
 
154 154
 		// verify error level
155
-		if (!isset($this->_levels[$level]))
155
+		if(!isset($this->_levels[$level]))
156 156
 		{
157
-			$this->log->addError('unknown error level: ' . $level);
157
+			$this->log->addError('unknown error level: '.$level);
158 158
 			$level = 'ALL';
159 159
 		}
160 160
 
161 161
 		// filter out anything in $this->config['exclusion_list']
162
-		if (!empty($this->config['exclusion_list']))
162
+		if(!empty($this->config['exclusion_list']))
163 163
 		{
164
-			foreach ($this->config['exclusion_list'] as $findme)
164
+			foreach($this->config['exclusion_list'] as $findme)
165 165
 			{
166 166
 				$pos = strpos($msg, $findme);
167
-				if ($pos !== false)
167
+				if($pos !== false)
168 168
 				{
169 169
 					// just exit now - we don't want to log this error
170 170
 					return true;
@@ -172,9 +172,9 @@  discard block
 block discarded – undo
172 172
 			}
173 173
 		}
174 174
 
175
-		if ($this->_levels[$level] <= $this->config['threshold'])
175
+		if($this->_levels[$level] <= $this->config['threshold'])
176 176
 		{
177
-			switch ($level)
177
+			switch($level)
178 178
 			{
179 179
 				case 'ERROR':
180 180
 					$this->log->addError($msg);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php defined('BASEPATH') OR exit('No direct script access allowed');
1
+<?php defined('BASEPATH') or exit('No direct script access allowed');
2 2
 
3 3
 /*
4 4
  * CodeIgniter Monolog Plus
@@ -89,18 +89,18 @@  discard block
 block discarded – undo
89 89
 			{
90 90
 				case 'file':
91 91
 					$handler = new RotatingFileHandler($this->config['file_logfile']);
92
-					$formatter = new LineFormatter(null, null, $config['file_multiline']);
92
+					$formatter = new LineFormatter(NULL, NULL, $config['file_multiline']);
93 93
 					$handler->setFormatter($formatter);
94 94
 					break;
95 95
 
96 96
 				case 'ci_file':
97 97
 					$handler = new RotatingFileHandler($this->config['ci_file_logfile']);
98
-					$formatter = new LineFormatter("%level_name% - %datetime% --> %message% %extra%\n", null, $config['ci_file_multiline']);
98
+					$formatter = new LineFormatter("%level_name% - %datetime% --> %message% %extra%\n", NULL, $config['ci_file_multiline']);
99 99
 					$handler->setFormatter($formatter);
100 100
 					break;
101 101
 
102 102
 				case 'new_relic':
103
-					$handler = new NewRelicHandler(Logger::ERROR, true, $this->config['new_relic_app_name']);
103
+					$handler = new NewRelicHandler(Logger::ERROR, TRUE, $this->config['new_relic_app_name']);
104 104
 					break;
105 105
 
106 106
 				case 'hipchat':
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
 				case 'papertrail':
121 121
 					$handler = new SyslogUdpHandler($this->config['papertrail_host'], $this->config['papertrail_port']);
122
-					$formatter = new LineFormatter('%channel%.%level_name%: %message% %extra%', null, $config['papertrail_multiline']);
122
+					$formatter = new LineFormatter('%channel%.%level_name%: %message% %extra%', NULL, $config['papertrail_multiline']);
123 123
 					$handler->setFormatter($formatter);
124 124
 					break;
125 125
 
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
 			foreach ($this->config['exclusion_list'] as $findme)
165 165
 			{
166 166
 				$pos = strpos($msg, $findme);
167
-				if ($pos !== false)
167
+				if ($pos !== FALSE)
168 168
 				{
169 169
 					// just exit now - we don't want to log this error
170
-					return true;
170
+					return TRUE;
171 171
 				}
172 172
 			}
173 173
 		}
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 					break;
191 191
 			}
192 192
 		}
193
-		return true;
193
+		return TRUE;
194 194
 	}
195 195
 
196 196
 }
Please login to merge, or discard this patch.
application/config/config.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php defined('BASEPATH') OR exit('No direct script access allowed');
1
+<?php defined('BASEPATH') or exit('No direct script access allowed');
2 2
 
3 3
 /*
4 4
 |--------------------------------------------------------------------------
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -134,9 +134,9 @@
 block discarded – undo
134 134
 $config['composer_autoload'] = FALSE;
135 135
 
136 136
 //NOTE: This doesn't work in autoload.php as it is loaded after we need it.
137
-spl_autoload_register(function ($class) {
138
-	$fileMono = APPPATH . '../vendor/monolog/monolog/src/'. str_replace('\\', '/', $class) .'.php';
139
-	$filePsr  = APPPATH . '../vendor/psr/log/'. str_replace('\\', '/', $class) .'.php';
137
+spl_autoload_register(function($class) {
138
+	$fileMono = APPPATH.'../vendor/monolog/monolog/src/'.str_replace('\\', '/', $class).'.php';
139
+	$filePsr  = APPPATH.'../vendor/psr/log/'.str_replace('\\', '/', $class).'.php';
140 140
 	if(file_exists($fileMono)) {
141 141
 		require $fileMono;
142 142
 		return TRUE;
Please login to merge, or discard this patch.