Completed
Branch master (fc8cf3)
by Angus
10:14
created
application/migrations/008_tracker_add_complete.php 1 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 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 Migration_Tracker_add_complete extends CI_Migration {
4 4
 	public function __construct() {
Please login to merge, or discard this patch.
application/migrations/010_tracker_add_category.php 1 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 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 Migration_Tracker_add_category extends CI_Migration {
4 4
 	public function __construct() {
Please login to merge, or discard this patch.
application/core/MY_Controller.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 	protected $footer_data = array();
7 7
 	public    $global_data = array();
8 8
 
9
-	public function __construct(){
9
+	public function __construct() {
10 10
 		parent::__construct();
11 11
 
12 12
 		//FIXME: This is pretty much a phpUnit hack. Without it phpUnit fails here. We need a proper way to fake user/admin testing.
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 	protected $footer_data = array();
7 7
 	public    $global_data = array();
8 8
 
9
-	public function __construct(){
9
+	public function __construct() {
10 10
 		parent::__construct();
11 11
 
12 12
 		//FIXME: This is pretty much a phpUnit hack. Without it phpUnit fails here. We need a proper way to fake user/admin testing.
@@ -80,7 +80,9 @@  discard block
 block discarded – undo
80 80
 	public function __construct() {
81 81
 		parent::__construct();
82 82
 
83
-		if($this->ion_auth->logged_in()) redirect('/');
83
+		if($this->ion_auth->logged_in()) {
84
+			redirect('/');
85
+		}
84 86
 	}
85 87
 }
86 88
 
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 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 MY_Controller extends CI_Controller {
4 4
 	protected $header_data = array();
Please login to merge, or discard this patch.
application/core/MY_Output.php 1 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 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 MY_Output extends CI_Output {
4 4
 	protected $current_header = [
Please login to merge, or discard this patch.
application/models/Site_Model.php 4 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -228,8 +228,8 @@
 block discarded – undo
228 228
 		//Bato.to is annoying and locks stuff behind auth. See: https://github.com/DakuTree/manga-tracker/issues/14#issuecomment-233830855
229 229
 		$cookies = [
230 230
 			"lang_option={$title_lang}",
231
-		    "member_id=" . $this->config->item('batoto_cookie_member_id'),
232
-		    "pass_hash=" . $this->config->item('batoto_cookie_pass_hash')
231
+			"member_id=" . $this->config->item('batoto_cookie_member_id'),
232
+			"pass_hash=" . $this->config->item('batoto_cookie_pass_hash')
233 233
 		];
234 234
 		$data = $this->get_content($title_url, implode("; ", $cookies));
235 235
 		if(!$data) {
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 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 Site_Model extends CI_Model {
4 4
 	public function __construct() {
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
 	public function isValidTitleURL(string $title_url) : bool {}
17 17
 	public function isValidChapter(string $chapter): bool {}
18 18
 
19
-	protected function get_content(string $url, string $cookie_string = "", string $cookiejar_path = ""){
19
+	protected function get_content(string $url, string $cookie_string = "", string $cookiejar_path = "") {
20 20
 		$ch = curl_init();
21 21
 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
22
-		curl_setopt($ch, CURLOPT_ENCODING , "gzip");
22
+		curl_setopt($ch, CURLOPT_ENCODING, "gzip");
23 23
 
24 24
 		if(!empty($cookie_string))  curl_setopt($ch, CURLOPT_COOKIE, $cookie_string);
25 25
 		if(!empty($cookiejar_path)) curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path);
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 
112 112
 				$link = preg_replace('/^(.*\/)(?:[0-9]+\.html)?$/', '$1', (string) $nodes_chapter[0]->getAttribute('href'));
113 113
 				$chapterURLSegments = explode('/', $link);
114
-				$titleData['latest_chapter'] = $chapterURLSegments[5] . (isset($chapterURLSegments[6]) && !empty($chapterURLSegments[6]) ? "/{$chapterURLSegments[6]}" : "");
115
-				$titleData['last_updated'] =  date("Y-m-d H:i:s", strtotime((string) $nodes_latest[0]->nodeValue));
114
+				$titleData['latest_chapter'] = $chapterURLSegments[5].(isset($chapterURLSegments[6]) && !empty($chapterURLSegments[6]) ? "/{$chapterURLSegments[6]}" : "");
115
+				$titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest[0]->nodeValue));
116 116
 			}
117 117
 		} else {
118 118
 			//TODO: Throw ERRORS;
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 
172 172
 				$link = preg_replace('/^(.*\/)(?:[0-9]+\.html)?$/', '$1', (string) $nodes_chapter[0]->getAttribute('href'));
173 173
 				$chapterURLSegments = explode('/', $link);
174
-				$titleData['latest_chapter'] = $chapterURLSegments[5] . (isset($chapterURLSegments[6]) && !empty($chapterURLSegments[6]) ? "/{$chapterURLSegments[6]}" : "");
175
-				$titleData['last_updated'] =  date("Y-m-d H:i:s", strtotime((string) $nodes_latest[0]->nodeValue));
174
+				$titleData['latest_chapter'] = $chapterURLSegments[5].(isset($chapterURLSegments[6]) && !empty($chapterURLSegments[6]) ? "/{$chapterURLSegments[6]}" : "");
175
+				$titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest[0]->nodeValue));
176 176
 			}
177 177
 		} else {
178 178
 			//TODO: Throw ERRORS;
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 
213 213
 		$chapter_parts = explode(':--:', $chapter);
214 214
 		return [
215
-			'url'    => "http://bato.to/reader#" . $chapter_parts[0],
215
+			'url'    => "http://bato.to/reader#".$chapter_parts[0],
216 216
 			'number' => $chapter_parts[1]
217 217
 		];
218 218
 	}
@@ -228,8 +228,8 @@  discard block
 block discarded – undo
228 228
 		//Bato.to is annoying and locks stuff behind auth. See: https://github.com/DakuTree/manga-tracker/issues/14#issuecomment-233830855
229 229
 		$cookies = [
230 230
 			"lang_option={$title_lang}",
231
-		    "member_id=" . $this->config->item('batoto_cookie_member_id'),
232
-		    "pass_hash=" . $this->config->item('batoto_cookie_pass_hash')
231
+		    "member_id=".$this->config->item('batoto_cookie_member_id'),
232
+		    "pass_hash=".$this->config->item('batoto_cookie_pass_hash')
233 233
 		];
234 234
 		$data = $this->get_content($title_url, implode("; ", $cookies));
235 235
 		if(!$data) {
@@ -261,13 +261,13 @@  discard block
 block discarded – undo
261 261
 					preg_match('/^(?:Vol\.(?<volume>\S+) )?(?:Ch.(?<chapter>[^\s:]+)):?.*/', trim($chapter_element->nodeValue), $text);
262 262
 
263 263
 					$titleData['title']          = html_entity_decode(trim($xpath->query('//h1[@class="ipsType_pagetitle"]')->item(0)->nodeValue));
264
-					$titleData['latest_chapter'] = substr($chapter_element->getAttribute('href'), 22) . ':--:' . ((!empty($text['volume']) ? 'v'.$text['volume'].'/' : '') . 'c'.$text['chapter']);
264
+					$titleData['latest_chapter'] = substr($chapter_element->getAttribute('href'), 22).':--:'.((!empty($text['volume']) ? 'v'.$text['volume'].'/' : '').'c'.$text['chapter']);
265 265
 
266 266
 					$dateString = $updated_element->nodeValue;
267 267
 					if($dateString == 'An hour ago') {
268 268
 						$dateString = '1 hour ago';
269 269
 					}
270
-					$titleData['last_updated']   = date("Y-m-d H:i:s", strtotime(preg_replace('/ (-|\[A\]).*$/', '', $dateString)));
270
+					$titleData['last_updated'] = date("Y-m-d H:i:s", strtotime(preg_replace('/ (-|\[A\]).*$/', '', $dateString)));
271 271
 				} else {
272 272
 					log_message('error', "Batoto: Regex missing <td> ({$title_url})");
273 273
 					return NULL;
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 		*/
316 316
 
317 317
 		$chapterData = [
318
-			'url'    => 'http://dynasty-scans.com/chapters/' . $title_parts[0].'_'.$chapter,
318
+			'url'    => 'http://dynasty-scans.com/chapters/'.$title_parts[0].'_'.$chapter,
319 319
 			'number' => ''
320 320
 		];
321 321
 
@@ -355,14 +355,14 @@  discard block
 block discarded – undo
355 355
 
356 356
 			preg_match('/<b>.*<\/b>/', $data, $matchesT);
357 357
 			preg_match('/\/doujins\/[^"]+">(.+)?(?=<\/a>)<\/a>/', $data, $matchesD);
358
-			$titleData['title'] = (!empty($matchesD) ? (substr($matchesD[1], 0, -7) !== 'Original' ? substr($matchesD[1], 0, -7).' - ' : '') : '') . substr($matchesT[0], 3, -4);
358
+			$titleData['title'] = (!empty($matchesD) ? (substr($matchesD[1], 0, -7) !== 'Original' ? substr($matchesD[1], 0, -7).' - ' : '') : '').substr($matchesT[0], 3, -4);
359 359
 
360 360
 			$data = preg_replace('/^[\S\s]*(<dl class=\'chapter-list\'>[\S\s]*<\/dl>)[\S\s]*$/', '$1', $data);
361 361
 			preg_match_all('/<dd>[\s\S]+?(?=<\/dd>)<\/dd>/', $data, $matches);
362 362
 			$latest_chapter_html = array_pop($matches[0]);
363 363
 
364 364
 			preg_match('/\/chapters\/([^"]+)/', $latest_chapter_html, $matches);
365
-			$titleData['latest_chapter'] = substr($matches[1], strlen($title_url)+1);
365
+			$titleData['latest_chapter'] = substr($matches[1], strlen($title_url) + 1);
366 366
 			//FIXME: THIS IS A TEMP FIX, SEE https://github.com/DakuTree/manga-tracker/issues/58
367 367
 			if(!$titleData['latest_chapter']) {
368 368
 				log_message('error', 'DynastyScans::getTitleData cannot parse title properly as it contains oneshot. || URL: '.$title_url);
@@ -370,13 +370,13 @@  discard block
 block discarded – undo
370 370
 			}
371 371
 
372 372
 			preg_match('/<small>released (.*)<\/small>/', $latest_chapter_html, $matches);
373
-			$titleData['last_updated']   = date("Y-m-d H:i:s", strtotime(str_replace('\'', '', $matches[1])));
373
+			$titleData['last_updated'] = date("Y-m-d H:i:s", strtotime(str_replace('\'', '', $matches[1])));
374 374
 		} elseif($title_parts[1] == '1') {
375 375
 			$data = $this->get_content('http://dynasty-scans.com/chapters/'.$title_url);
376 376
 
377 377
 			preg_match('/<b>.*<\/b>/', $data, $matchesT);
378 378
 			preg_match('/\/doujins\/[^"]+">(.+)?(?=<\/a>)<\/a>/', $data, $matchesD);
379
-			$titleData['title'] = (!empty($matchesD) ? ($matchesD[1] !== 'Original' ? $matchesD[1].' - ' : '') : '') . substr($matchesT[0], 3, -4);
379
+			$titleData['title'] = (!empty($matchesD) ? ($matchesD[1] !== 'Original' ? $matchesD[1].' - ' : '') : '').substr($matchesT[0], 3, -4);
380 380
 
381 381
 			$titleData['latest_chapter'] = 'oneshot'; //This will never change
382 382
 
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 				$nodes_chapter = $xpath->query("td[1]/a", $nodes_row[0]);
443 443
 
444 444
 				$titleData['latest_chapter'] = preg_replace('/^.*\/([0-9]+)$/', '$1', (string) $nodes_chapter[0]->getAttribute('href'));
445
-				$titleData['last_updated'] =  date("Y-m-d H:i:s", strtotime((string) $nodes_latest[0]->nodeValue));
445
+				$titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest[0]->nodeValue));
446 446
 			}
447 447
 		} else {
448 448
 			//TODO: Throw ERRORS;
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 				$nodes_chapter = $xpath->query("td[1]/a", $nodes_row[0]);
501 501
 
502 502
 				$titleData['latest_chapter'] = preg_replace('/^.*\/(.*?\/[0-9]+)\/[0-9]+$/', '$1', (string) $nodes_chapter[0]->getAttribute('href'));
503
-				$titleData['last_updated'] =  date("Y-m-d H:i:s", strtotime((string) $nodes_latest[0]->nodeValue));
503
+				$titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest[0]->nodeValue));
504 504
 			}
505 505
 		} else {
506 506
 			//TODO: Throw ERRORS;
@@ -565,8 +565,8 @@  discard block
 block discarded – undo
565 565
 				$titleData['title'] = trim((string) $xml->channel->title);
566 566
 
567 567
 				$chapterURLSegments = explode('/', ((string) $xml->channel->item[0]->link));
568
-				$titleData['latest_chapter'] = preg_replace('/^.*?([0-9]+)$/', '$1', $chapterURLSegments[7]) . ':--:' . $chapterURLSegments[6];
569
-				$titleData['last_updated'] =  date("Y-m-d H:i:s", strtotime((string) $xml->channel->item[0]->pubDate));
568
+				$titleData['latest_chapter'] = preg_replace('/^.*?([0-9]+)$/', '$1', $chapterURLSegments[7]).':--:'.$chapterURLSegments[6];
569
+				$titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $xml->channel->item[0]->pubDate));
570 570
 			}
571 571
 		} else {
572 572
 			//TODO: Throw ERRORS;
@@ -645,8 +645,8 @@  discard block
 block discarded – undo
645 645
 
646 646
 					$link = (string) $nodes_chapter[0]->getAttribute('href');
647 647
 					$chapterURLSegments = explode('/', preg_replace('/\?.*$/', '', $link));
648
-					$titleData['latest_chapter'] = $chapterURLSegments[3] . ':--:' . preg_replace('/.*?([0-9]+)$/', '$1', $link);
649
-					$titleData['last_updated'] =  date("Y-m-d H:i:s", strtotime((string) $nodes_latest[0]->textContent));
648
+					$titleData['latest_chapter'] = $chapterURLSegments[3].':--:'.preg_replace('/.*?([0-9]+)$/', '$1', $link);
649
+					$titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest[0]->textContent));
650 650
 				}
651 651
 			} else {
652 652
 				//TODO: Throw ERRORS;
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 		$chapter_parts = explode('/', $chapter);
682 682
 		return [
683 683
 			'url'    => "https://reader.kireicake.com/read/{$title_url}/{$chapter}",
684
-			'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '') . "c{$chapter_parts[2]}" . (isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/
684
+			'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '')."c{$chapter_parts[2]}".(isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/
685 685
 		];
686 686
 	}
687 687
 
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 
713 713
 				$link = (string) $nodes_chapter[0]->getAttribute('href');
714 714
 				$titleData['latest_chapter'] = preg_replace('/.*\/read\/.*?\/(.*?)\/$/', '$1', $link);
715
-				$titleData['last_updated'] =  date("Y-m-d H:i:s", strtotime((string) str_replace('.', '', explode(',', $nodes_latest[0]->textContent)[1])));
715
+				$titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) str_replace('.', '', explode(',', $nodes_latest[0]->textContent)[1])));
716 716
 			}
717 717
 		} else {
718 718
 			//TODO: Throw ERRORS;
Please login to merge, or discard this patch.
Braces   +61 added lines, -21 removed lines patch added patch discarded remove patch
@@ -16,13 +16,17 @@  discard block
 block discarded – undo
16 16
 	public function isValidTitleURL(string $title_url) : bool {}
17 17
 	public function isValidChapter(string $chapter): bool {}
18 18
 
19
-	protected function get_content(string $url, string $cookie_string = "", string $cookiejar_path = ""){
19
+	protected function get_content(string $url, string $cookie_string = "", string $cookiejar_path = "") {
20 20
 		$ch = curl_init();
21 21
 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
22 22
 		curl_setopt($ch, CURLOPT_ENCODING , "gzip");
23 23
 
24
-		if(!empty($cookie_string))  curl_setopt($ch, CURLOPT_COOKIE, $cookie_string);
25
-		if(!empty($cookiejar_path)) curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path);
24
+		if(!empty($cookie_string)) {
25
+			curl_setopt($ch, CURLOPT_COOKIE, $cookie_string);
26
+		}
27
+		if(!empty($cookiejar_path)) {
28
+			curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path);
29
+		}
26 30
 
27 31
 		//Some sites check the useragent for stuff, use a pre-defined user-agent to avoid stuff.
28 32
 		curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2824.0 Safari/537.36');
@@ -68,12 +72,16 @@  discard block
 block discarded – undo
68 72
 
69 73
 	public function isValidTitleURL(string $title_url) : bool {
70 74
 		$success = (bool) preg_match('/^[a-z0-9_]+$/', $title_url);
71
-		if(!$success) log_message('error', "Invalid Title URL (MangaFox): {$title_url}");
75
+		if(!$success) {
76
+			log_message('error', "Invalid Title URL (MangaFox): {$title_url}");
77
+		}
72 78
 		return $success;
73 79
 	}
74 80
 	public function isValidChapter(string $chapter) : bool {
75 81
 		$success = (bool) preg_match('/^(?:v[0-9a-zA-Z]+\/)?c[0-9\.]+$/', $chapter);
76
-		if(!$success) log_message('error', 'Invalid Chapter (MangaFox): '.$chapter);
82
+		if(!$success) {
83
+			log_message('error', 'Invalid Chapter (MangaFox): '.$chapter);
84
+		}
77 85
 		return $success;
78 86
 	}
79 87
 
@@ -129,12 +137,16 @@  discard block
 block discarded – undo
129 137
 
130 138
 	public function isValidTitleURL(string $title_url) : bool {
131 139
 		$success = (bool) preg_match('/^[a-z0-9_]+$/', $title_url);
132
-		if(!$success) log_message('error', "Invalid Title URL (MangaFox): {$title_url}");
140
+		if(!$success) {
141
+			log_message('error', "Invalid Title URL (MangaFox): {$title_url}");
142
+		}
133 143
 		return $success;
134 144
 	}
135 145
 	public function isValidChapter(string $chapter) : bool {
136 146
 		$success = (bool) preg_match('/^(?:v[0-9]+\/)?c[0-9]+(?:\.[0-9]+)?$/', $chapter);
137
-		if(!$success) log_message('error', 'Invalid Chapter (MangaFox): '.$chapter);
147
+		if(!$success) {
148
+			log_message('error', 'Invalid Chapter (MangaFox): '.$chapter);
149
+		}
138 150
 		return $success;
139 151
 	}
140 152
 
@@ -195,7 +207,9 @@  discard block
 block discarded – undo
195 207
 
196 208
 	public function isValidTitleURL(string $title_url) : bool {
197 209
 		$success = (bool) preg_match('/^[a-z0-9%-]+:--:(?:English|Spanish|French|German|Portuguese|Turkish|Indonesian|Greek|Filipino|Italian|Polish|Thai|Malay|Hungarian|Romanian|Arabic|Hebrew|Russian|Vietnamese|Dutch)$/', $title_url);
198
-		if(!$success) log_message('error', "Invalid Title URL (Batoto): {$title_url}");
210
+		if(!$success) {
211
+			log_message('error', "Invalid Title URL (Batoto): {$title_url}");
212
+		}
199 213
 		return $success;
200 214
 	}
201 215
 	public function isValidChapter(string $chapter) : bool {
@@ -203,7 +217,9 @@  discard block
 block discarded – undo
203 217
 		//       Preferably we'd just use /^[0-9a-z]+:--:(v[0-9]+\/)?c[0-9]+(\.[0-9]+)?$/
204 218
 
205 219
 		$success = (bool) preg_match('/^[0-9a-z]+:--:.+$/', $chapter);
206
-		if(!$success) log_message('error', 'Invalid Chapter (Batoto): '.$chapter);
220
+		if(!$success) {
221
+			log_message('error', 'Invalid Chapter (Batoto): '.$chapter);
222
+		}
207 223
 		return $success;
208 224
 	}
209 225
 
@@ -296,12 +312,16 @@  discard block
 block discarded – undo
296 312
 
297 313
 	public function isValidTitleURL(string $title_url) : bool {
298 314
 		$success = (bool) preg_match('/^[a-z0-9_]+:--:(?:0|1)$/', $title_url);
299
-		if(!$success) log_message('error', "Invalid Title URL (DynastyScans): {$title_url}");
315
+		if(!$success) {
316
+			log_message('error', "Invalid Title URL (DynastyScans): {$title_url}");
317
+		}
300 318
 		return $success;
301 319
 	}
302 320
 	public function isValidChapter(string $chapter) : bool {
303 321
 		$success = (bool) preg_match('/^[0-9a-z_]+$/', $chapter);
304
-		if(!$success) log_message('error', 'Invalid Chapter (DynastyScans): '.$chapter);
322
+		if(!$success) {
323
+			log_message('error', 'Invalid Chapter (DynastyScans): '.$chapter);
324
+		}
305 325
 		return $success;
306 326
 	}
307 327
 
@@ -407,12 +427,16 @@  discard block
 block discarded – undo
407 427
 
408 428
 	public function isValidTitleURL(string $title_url) : bool {
409 429
 		$success = (bool) preg_match('/^[a-z0-9-]+$/', $title_url);
410
-		if(!$success) log_message('error', "Invalid Title URL (MangaPanda): {$title_url}");
430
+		if(!$success) {
431
+			log_message('error', "Invalid Title URL (MangaPanda): {$title_url}");
432
+		}
411 433
 		return $success;
412 434
 	}
413 435
 	public function isValidChapter(string $chapter) : bool {
414 436
 		$success = (bool) preg_match('/^[0-9]+$/', $chapter);
415
-		if(!$success) log_message('error', 'Invalid Chapter (MangaPanda): '.$chapter);
437
+		if(!$success) {
438
+			log_message('error', 'Invalid Chapter (MangaPanda): '.$chapter);
439
+		}
416 440
 		return $success;
417 441
 	}
418 442
 
@@ -459,12 +483,16 @@  discard block
 block discarded – undo
459 483
 
460 484
 	public function isValidTitleURL(string $title_url) : bool {
461 485
 		$success = (bool) preg_match('/^[a-z0-9_]+$/', $title_url);
462
-		if(!$success) log_message('error', "Invalid Title URL (MangaStream): {$title_url}");
486
+		if(!$success) {
487
+			log_message('error', "Invalid Title URL (MangaStream): {$title_url}");
488
+		}
463 489
 		return $success;
464 490
 	}
465 491
 	public function isValidChapter(string $chapter) : bool {
466 492
 		$success = (bool) preg_match('/^(.*?)\/[0-9]+$/', $chapter);
467
-		if(!$success) log_message('error', 'Invalid Chapter (MangaStream): '.$chapter);
493
+		if(!$success) {
494
+			log_message('error', 'Invalid Chapter (MangaStream): '.$chapter);
495
+		}
468 496
 		return $success;
469 497
 	}
470 498
 
@@ -533,12 +561,16 @@  discard block
 block discarded – undo
533 561
 
534 562
 	public function isValidTitleURL(string $title_url) : bool {
535 563
 		$success = (bool) preg_match('/^[0-9]+:--:(?:en|zh-hant|zh-hans|th|id):--:[a-z0-9-]+:--:(?:drama|fantasy|comedy|action|slice-of-life|romance|superhero|thriller|sports|sci-fi)$/', $title_url);
536
-		if(!$success) log_message('error', "Invalid Title URL (WebToons): {$title_url}");
564
+		if(!$success) {
565
+			log_message('error', "Invalid Title URL (WebToons): {$title_url}");
566
+		}
537 567
 		return $success;
538 568
 	}
539 569
 	public function isValidChapter(string $chapter) : bool {
540 570
 		$success = (bool) preg_match('/^[0-9]+:--:.*$/', $chapter);
541
-		if(!$success) log_message('error', 'Invalid Chapter (WebToons): '.$chapter);
571
+		if(!$success) {
572
+			log_message('error', 'Invalid Chapter (WebToons): '.$chapter);
573
+		}
542 574
 		return $success;
543 575
 	}
544 576
 
@@ -595,12 +627,16 @@  discard block
 block discarded – undo
595 627
 
596 628
 	public function isValidTitleURL(string $title_url) : bool {
597 629
 		$success = (bool) preg_match('/^[A-Za-z0-9-]+/', $title_url);
598
-		if(!$success) log_message('error', "Invalid Title URL (KissManga): {$title_url}");
630
+		if(!$success) {
631
+			log_message('error', "Invalid Title URL (KissManga): {$title_url}");
632
+		}
599 633
 		return $success;
600 634
 	}
601 635
 	public function isValidChapter(string $chapter) : bool {
602 636
 		$success = (bool) preg_match('/^.*?:--:[0-9]+$/', $chapter);
603
-		if(!$success) log_message('error', 'Invalid Chapter (KissManga): '.$chapter);
637
+		if(!$success) {
638
+			log_message('error', 'Invalid Chapter (KissManga): '.$chapter);
639
+		}
604 640
 		return $success;
605 641
 	}
606 642
 
@@ -667,12 +703,16 @@  discard block
 block discarded – undo
667 703
 
668 704
 	public function isValidTitleURL(string $title_url) : bool {
669 705
 		$success = (bool) preg_match('/^[a-z0-9_]+/', $title_url);
670
-		if(!$success) log_message('error', "Invalid Title URL (KireiCake): {$title_url}");
706
+		if(!$success) {
707
+			log_message('error', "Invalid Title URL (KireiCake): {$title_url}");
708
+		}
671 709
 		return $success;
672 710
 	}
673 711
 	public function isValidChapter(string $chapter) : bool {
674 712
 		$success = (bool) preg_match('/^en\/[0-9]+(?:\/[0-9]+(?:\/[0-9]+(?:\/[0-9]+)?)?)?$/', $chapter);
675
-		if(!$success) log_message('error', 'Invalid Chapter (KireiCake): '.$chapter);
713
+		if(!$success) {
714
+			log_message('error', 'Invalid Chapter (KireiCake): '.$chapter);
715
+		}
676 716
 		return $success;
677 717
 	}
678 718
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 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 Site_Model extends CI_Model {
4 4
 	public function __construct() {
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
 			//$data = preg_replace('/^[\S\s]*(<body id="body">[\S\s]*<\/body>)[\S\s]*$/', '$1', $data);
95 95
 
96 96
 			$dom = new DOMDocument();
97
-			libxml_use_internal_errors(true);
97
+			libxml_use_internal_errors(TRUE);
98 98
 			$dom->loadHTML($data);
99
-			libxml_use_internal_errors(false);
99
+			libxml_use_internal_errors(FALSE);
100 100
 
101 101
 			$xpath = new DOMXPath($dom);
102 102
 
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 			//$data = preg_replace('/^[\S\s]*(<body id="body">[\S\s]*<\/body>)[\S\s]*$/', '$1', $data);
156 156
 
157 157
 			$dom = new DOMDocument();
158
-			libxml_use_internal_errors(true);
158
+			libxml_use_internal_errors(TRUE);
159 159
 			$dom->loadHTML($data);
160
-			libxml_use_internal_errors(false);
160
+			libxml_use_internal_errors(FALSE);
161 161
 
162 162
 			$xpath = new DOMXPath($dom);
163 163
 			$nodes_title = $xpath->query("//meta[@property='og:title']");
@@ -243,9 +243,9 @@  discard block
 block discarded – undo
243 243
 		if(strpos($data, '>Register now<') === FALSE) {
244 244
 			//Auth was successful
245 245
 			$dom = new DOMDocument();
246
-			libxml_use_internal_errors(true);
246
+			libxml_use_internal_errors(TRUE);
247 247
 			$dom->loadHTML($data);
248
-			libxml_use_internal_errors(false);
248
+			libxml_use_internal_errors(FALSE);
249 249
 
250 250
 			$xpath = new DOMXPath($dom);
251 251
 			$nodes = $xpath->query("(//div/div)[last()]/table/tbody/tr[2]");
@@ -426,9 +426,9 @@  discard block
 block discarded – undo
426 426
 			//$data = preg_replace('/^[\S\s]*(<body id="body">[\S\s]*<\/body>)[\S\s]*$/', '$1', $data);
427 427
 
428 428
 			$dom = new DOMDocument();
429
-			libxml_use_internal_errors(true);
429
+			libxml_use_internal_errors(TRUE);
430 430
 			$dom->loadHTML($data);
431
-			libxml_use_internal_errors(false);
431
+			libxml_use_internal_errors(FALSE);
432 432
 
433 433
 			$xpath = new DOMXPath($dom);
434 434
 
@@ -485,9 +485,9 @@  discard block
 block discarded – undo
485 485
 			//$data = preg_replace('/^[\S\s]*(<body id="body">[\S\s]*<\/body>)[\S\s]*$/', '$1', $data);
486 486
 
487 487
 			$dom = new DOMDocument();
488
-			libxml_use_internal_errors(true);
488
+			libxml_use_internal_errors(TRUE);
489 489
 			$dom->loadHTML($data);
490
-			libxml_use_internal_errors(false);
490
+			libxml_use_internal_errors(FALSE);
491 491
 
492 492
 			$xpath = new DOMXPath($dom);
493 493
 
@@ -629,9 +629,9 @@  discard block
 block discarded – undo
629 629
 				$data = preg_replace('/^[\S\s]*(<div id="leftside">[\S\s]*)<div id="rightside">[\S\s]*$/', '$1', $data);
630 630
 
631 631
 				$dom = new DOMDocument();
632
-				libxml_use_internal_errors(true);
632
+				libxml_use_internal_errors(TRUE);
633 633
 				$dom->loadHTML($data);
634
-				libxml_use_internal_errors(false);
634
+				libxml_use_internal_errors(FALSE);
635 635
 
636 636
 				$xpath = new DOMXPath($dom);
637 637
 
@@ -695,9 +695,9 @@  discard block
 block discarded – undo
695 695
 			$data = preg_replace('/^[\S\s]*(<article>[\S\s]*)<\/article>[\S\s]*$/', '$1', $data);
696 696
 
697 697
 			$dom = new DOMDocument();
698
-			libxml_use_internal_errors(true);
698
+			libxml_use_internal_errors(TRUE);
699 699
 			$dom->loadHTML($data);
700
-			libxml_use_internal_errors(false);
700
+			libxml_use_internal_errors(FALSE);
701 701
 
702 702
 			$xpath = new DOMXPath($dom);
703 703
 
Please login to merge, or discard this patch.
application/models/User_Model.php 4 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 		$this->load->database();
41 41
 
42 42
 		$query = $this->db->select('*')
43
-		                  ->from('auth_users')
44
-		                  ->where('username', $username)
45
-		                  ->get();
43
+						  ->from('auth_users')
44
+						  ->where('username', $username)
45
+						  ->get();
46 46
 
47 47
 		return (bool) $query->num_rows();
48 48
 	}
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 			$this->load->database();
65 65
 
66 66
 			$query = $this->db->select('email')
67
-			                  ->from('auth_users')
68
-			                  ->where('username', $identity)
69
-			                  ->get();
67
+							  ->from('auth_users')
68
+							  ->where('username', $identity)
69
+							  ->get();
70 70
 
71 71
 			if($query->num_rows() > 0) {
72 72
 				//username exists, grab email
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 		$user = NULL;
85 85
 
86 86
 		$query = $this->db->select('*')
87
-		                  ->from('auth_users')
88
-		                  ->where('username', $username)
89
-		                  ->get();
87
+						  ->from('auth_users')
88
+						  ->where('username', $username)
89
+						  ->get();
90 90
 
91 91
 		if($query->num_rows() > 0) {
92 92
 			$user = $query->row();
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
 	
115 115
 	public function get_id_from_api_key(string $api_key) {
116 116
 		$query = $this->db->select('id')
117
-		                  ->from('auth_users')
118
-		                  ->where('api_key', $api_key)
119
-		                  ->get();
117
+						  ->from('auth_users')
118
+						  ->where('api_key', $api_key)
119
+						  ->get();
120 120
 
121 121
 		if($query->num_rows() > 0) {
122 122
 			$userID = $query->row('id');
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 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 User_Model extends CI_Model {
4 4
 	public $id;
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 			if($query->num_rows() > 0) {
72 72
 				//username exists, grab email
73 73
 				$email = $query->row('email');
74
-			}else{
74
+			} else {
75 75
 				//username doesn't exist, return FALSE
76 76
 				$email = FALSE;
77 77
 			}
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	public function get_new_api_key() : string {
104 104
 		$api_key = NULL;
105 105
 		if($this->logged_in()) {
106
-			$api_key = substr("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", mt_rand(0, 51), 1) . substr(md5((string) time()), 1);
106
+			$api_key = substr("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", mt_rand(0, 51), 1).substr(md5((string) time()), 1);
107 107
 
108 108
 			$this->db->where('id', $this->id);
109 109
 			$this->db->update('auth_users', ['api_key' => $api_key]);
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
 			if($query->num_rows() > 0) {
72 72
 				//username exists, grab email
73 73
 				$email = $query->row('email');
74
-			}else{
74
+			} else {
75 75
 				//username doesn't exist, return FALSE
76 76
 				$email = FALSE;
77 77
 			}
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 User_Model extends CI_Model {
4 4
 	public $id;
Please login to merge, or discard this patch.
application/config/email.php 1 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 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.
application/config/migration.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-defined('BASEPATH') OR exit('No direct script access allowed');
2
+defined('BASEPATH') or exit('No direct script access allowed');
3 3
 
4 4
 /*
5 5
 |--------------------------------------------------------------------------
Please login to merge, or discard this patch.
application/config/testing/migration.php 1 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 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.