| @@ -6,7 +6,7 @@ discard block | ||
| 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 | ||
| 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 | |
| @@ -94,7 +94,9 @@ discard block | ||
| 94 | 94 | } | 
| 95 | 95 | |
| 96 | 96 | //Overall fallback method. | 
| 97 | - if(!isset($value)) $value = $this->options[$option]['default']; | |
| 97 | +			if(!isset($value)) { | |
| 98 | + $value = $this->options[$option]['default']; | |
| 99 | + } | |
| 98 | 100 |  		} else { | 
| 99 | 101 | $value = FALSE; | 
| 100 | 102 | } | 
| @@ -165,7 +167,10 @@ discard block | ||
| 165 | 167 | //This should never happen. | 
| 166 | 168 | break; | 
| 167 | 169 | } | 
| 168 | - if(!isset($value)) $value = FALSE; //FIXME: This won't play nice with BOOL type false? | |
| 170 | +		if(!isset($value)) { | |
| 171 | + $value = FALSE; | |
| 172 | + } | |
| 173 | + //FIXME: This won't play nice with BOOL type false? | |
| 169 | 174 | |
| 170 | 175 | return $value; | 
| 171 | 176 | } | 
| @@ -16,13 +16,17 @@ discard block | ||
| 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 | ||
| 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 | ||
| 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 | ||
| 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 | ||
| 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 | ||
| 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 | ||
| 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 | ||
| 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 | ||
| 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 | ||
| 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 | ||
| 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 | |
| @@ -71,7 +71,7 @@ | ||
| 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 | } | 
| @@ -16,8 +16,7 @@ | ||
| 16 | 16 | * | 
| 17 | 17 | * @SuppressWarnings(PHPMD) | 
| 18 | 18 | */ | 
| 19 | -class UnitTester extends \Codeception\Actor | |
| 20 | -{ | |
| 19 | +class UnitTester extends \Codeception\Actor { | |
| 21 | 20 | use _generated\UnitTesterActions; | 
| 22 | 21 | |
| 23 | 22 | /** | 
| @@ -4,7 +4,6 @@ | ||
| 4 | 4 | // here you can define custom actions | 
| 5 | 5 | // all public methods declared in helper class will be available in $I | 
| 6 | 6 | |
| 7 | -class Functional extends \Codeception\Module | |
| 8 | -{ | |
| 7 | +class Functional extends \Codeception\Module { | |
| 9 | 8 | |
| 10 | 9 | } | 
| @@ -4,7 +4,6 @@ | ||
| 4 | 4 | // here you can define custom actions | 
| 5 | 5 | // all public methods declared in helper class will be available in $I | 
| 6 | 6 | |
| 7 | -class Unit extends \Codeception\Module | |
| 8 | -{ | |
| 7 | +class Unit extends \Codeception\Module { | |
| 9 | 8 | |
| 10 | 9 | } | 
| @@ -4,7 +4,6 @@ | ||
| 4 | 4 | // here you can define custom actions | 
| 5 | 5 | // all public methods declared in helper class will be available in $I | 
| 6 | 6 | |
| 7 | -class Acceptance extends \Codeception\Module | |
| 8 | -{ | |
| 7 | +class Acceptance extends \Codeception\Module { | |
| 9 | 8 | |
| 10 | 9 | } | 
| @@ -16,8 +16,7 @@ | ||
| 16 | 16 | * | 
| 17 | 17 | * @SuppressWarnings(PHPMD) | 
| 18 | 18 | */ | 
| 19 | -class AcceptanceTester extends \Codeception\Actor | |
| 20 | -{ | |
| 19 | +class AcceptanceTester extends \Codeception\Actor { | |
| 21 | 20 | use _generated\AcceptanceTesterActions; | 
| 22 | 21 | |
| 23 | 22 | /** |