@@ -1,14 +1,12 @@ discard block |
||
1 | 1 | <?php defined('BASEPATH') OR exit('No direct script access allowed'); |
2 | 2 | |
3 | 3 | class Migration_Setup_Sessions extends CI_Migration { |
4 | - public function __construct() |
|
5 | - { |
|
4 | + public function __construct() { |
|
6 | 5 | parent::__construct(); |
7 | 6 | $this->load->dbforge(); |
8 | 7 | } |
9 | 8 | |
10 | - public function up() |
|
11 | - { |
|
9 | + public function up() { |
|
12 | 10 | // Table structure for table 'ci_sessions' |
13 | 11 | $this->dbforge->add_field(array( |
14 | 12 | 'id' => array( |
@@ -39,8 +37,7 @@ discard block |
||
39 | 37 | $this->dbforge->create_table('ci_sessions'); |
40 | 38 | } |
41 | 39 | |
42 | - public function down() |
|
43 | - { |
|
40 | + public function down() { |
|
44 | 41 | $this->dbforge->drop_table('ci_sessions', TRUE); |
45 | 42 | } |
46 | 43 | } |
@@ -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'); |
@@ -70,12 +74,16 @@ discard block |
||
70 | 74 | |
71 | 75 | public function isValidTitleURL(string $title_url) : bool { |
72 | 76 | $success = (bool) preg_match('/^[a-z0-9_]+$/', $title_url); |
73 | - if(!$success) log_message('error', "Invalid Title URL (MangaFox): {$title_url}"); |
|
77 | + if(!$success) { |
|
78 | + log_message('error', "Invalid Title URL (MangaFox): {$title_url}"); |
|
79 | + } |
|
74 | 80 | return $success; |
75 | 81 | } |
76 | 82 | public function isValidChapter(string $chapter) : bool { |
77 | 83 | $success = (bool) preg_match('/^(?:v[0-9a-zA-Z]+\/)?c[0-9\.]+$/', $chapter); |
78 | - if(!$success) log_message('error', 'Invalid Chapter (MangaFox): '.$chapter); |
|
84 | + if(!$success) { |
|
85 | + log_message('error', 'Invalid Chapter (MangaFox): '.$chapter); |
|
86 | + } |
|
79 | 87 | return $success; |
80 | 88 | } |
81 | 89 | |
@@ -131,12 +139,16 @@ discard block |
||
131 | 139 | |
132 | 140 | public function isValidTitleURL(string $title_url) : bool { |
133 | 141 | $success = (bool) preg_match('/^[a-z0-9_]+$/', $title_url); |
134 | - if(!$success) log_message('error', "Invalid Title URL (MangaFox): {$title_url}"); |
|
142 | + if(!$success) { |
|
143 | + log_message('error', "Invalid Title URL (MangaFox): {$title_url}"); |
|
144 | + } |
|
135 | 145 | return $success; |
136 | 146 | } |
137 | 147 | public function isValidChapter(string $chapter) : bool { |
138 | 148 | $success = (bool) preg_match('/^(?:v[0-9]+\/)?c[0-9]+(?:\.[0-9]+)?$/', $chapter); |
139 | - if(!$success) log_message('error', 'Invalid Chapter (MangaFox): '.$chapter); |
|
149 | + if(!$success) { |
|
150 | + log_message('error', 'Invalid Chapter (MangaFox): '.$chapter); |
|
151 | + } |
|
140 | 152 | return $success; |
141 | 153 | } |
142 | 154 | |
@@ -197,7 +209,9 @@ discard block |
||
197 | 209 | |
198 | 210 | public function isValidTitleURL(string $title_url) : bool { |
199 | 211 | $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); |
200 | - if(!$success) log_message('error', "Invalid Title URL (Batoto): {$title_url}"); |
|
212 | + if(!$success) { |
|
213 | + log_message('error', "Invalid Title URL (Batoto): {$title_url}"); |
|
214 | + } |
|
201 | 215 | return $success; |
202 | 216 | } |
203 | 217 | public function isValidChapter(string $chapter) : bool { |
@@ -205,7 +219,9 @@ discard block |
||
205 | 219 | // Preferably we'd just use /^[0-9a-z]+:--:(v[0-9]+\/)?c[0-9]+(\.[0-9]+)?$/ |
206 | 220 | |
207 | 221 | $success = (bool) preg_match('/^[0-9a-z]+:--:.+$/', $chapter); |
208 | - if(!$success) log_message('error', 'Invalid Chapter (Batoto): '.$chapter); |
|
222 | + if(!$success) { |
|
223 | + log_message('error', 'Invalid Chapter (Batoto): '.$chapter); |
|
224 | + } |
|
209 | 225 | return $success; |
210 | 226 | } |
211 | 227 | |
@@ -298,12 +314,16 @@ discard block |
||
298 | 314 | |
299 | 315 | public function isValidTitleURL(string $title_url) : bool { |
300 | 316 | $success = (bool) preg_match('/^[a-z0-9_]+:--:(?:0|1)$/', $title_url); |
301 | - if(!$success) log_message('error', "Invalid Title URL (DynastyScans): {$title_url}"); |
|
317 | + if(!$success) { |
|
318 | + log_message('error', "Invalid Title URL (DynastyScans): {$title_url}"); |
|
319 | + } |
|
302 | 320 | return $success; |
303 | 321 | } |
304 | 322 | public function isValidChapter(string $chapter) : bool { |
305 | 323 | $success = (bool) preg_match('/^[0-9a-z_]+$/', $chapter); |
306 | - if(!$success) log_message('error', 'Invalid Chapter (DynastyScans): '.$chapter); |
|
324 | + if(!$success) { |
|
325 | + log_message('error', 'Invalid Chapter (DynastyScans): '.$chapter); |
|
326 | + } |
|
307 | 327 | return $success; |
308 | 328 | } |
309 | 329 | |
@@ -409,12 +429,16 @@ discard block |
||
409 | 429 | |
410 | 430 | public function isValidTitleURL(string $title_url) : bool { |
411 | 431 | $success = (bool) preg_match('/^[a-z0-9-]+$/', $title_url); |
412 | - if(!$success) log_message('error', "Invalid Title URL (MangaPanda): {$title_url}"); |
|
432 | + if(!$success) { |
|
433 | + log_message('error', "Invalid Title URL (MangaPanda): {$title_url}"); |
|
434 | + } |
|
413 | 435 | return $success; |
414 | 436 | } |
415 | 437 | public function isValidChapter(string $chapter) : bool { |
416 | 438 | $success = (bool) preg_match('/^[0-9]+$/', $chapter); |
417 | - if(!$success) log_message('error', 'Invalid Chapter (MangaPanda): '.$chapter); |
|
439 | + if(!$success) { |
|
440 | + log_message('error', 'Invalid Chapter (MangaPanda): '.$chapter); |
|
441 | + } |
|
418 | 442 | return $success; |
419 | 443 | } |
420 | 444 | |
@@ -461,12 +485,16 @@ discard block |
||
461 | 485 | |
462 | 486 | public function isValidTitleURL(string $title_url) : bool { |
463 | 487 | $success = (bool) preg_match('/^[a-z0-9_]+$/', $title_url); |
464 | - if(!$success) log_message('error', "Invalid Title URL (MangaStream): {$title_url}"); |
|
488 | + if(!$success) { |
|
489 | + log_message('error', "Invalid Title URL (MangaStream): {$title_url}"); |
|
490 | + } |
|
465 | 491 | return $success; |
466 | 492 | } |
467 | 493 | public function isValidChapter(string $chapter) : bool { |
468 | 494 | $success = (bool) preg_match('/^(.*?)\/[0-9]+$/', $chapter); |
469 | - if(!$success) log_message('error', 'Invalid Chapter (MangaStream): '.$chapter); |
|
495 | + if(!$success) { |
|
496 | + log_message('error', 'Invalid Chapter (MangaStream): '.$chapter); |
|
497 | + } |
|
470 | 498 | return $success; |
471 | 499 | } |
472 | 500 | |
@@ -535,12 +563,16 @@ discard block |
||
535 | 563 | |
536 | 564 | public function isValidTitleURL(string $title_url) : bool { |
537 | 565 | $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); |
538 | - if(!$success) log_message('error', "Invalid Title URL (WebToons): {$title_url}"); |
|
566 | + if(!$success) { |
|
567 | + log_message('error', "Invalid Title URL (WebToons): {$title_url}"); |
|
568 | + } |
|
539 | 569 | return $success; |
540 | 570 | } |
541 | 571 | public function isValidChapter(string $chapter) : bool { |
542 | 572 | $success = (bool) preg_match('/^[0-9]+:--:.*$/', $chapter); |
543 | - if(!$success) log_message('error', 'Invalid Chapter (WebToons): '.$chapter); |
|
573 | + if(!$success) { |
|
574 | + log_message('error', 'Invalid Chapter (WebToons): '.$chapter); |
|
575 | + } |
|
544 | 576 | return $success; |
545 | 577 | } |
546 | 578 | |
@@ -597,12 +629,16 @@ discard block |
||
597 | 629 | |
598 | 630 | public function isValidTitleURL(string $title_url) : bool { |
599 | 631 | $success = (bool) preg_match('/^[A-Za-z0-9-]+/', $title_url); |
600 | - if(!$success) log_message('error', "Invalid Title URL (KissManga): {$title_url}"); |
|
632 | + if(!$success) { |
|
633 | + log_message('error', "Invalid Title URL (KissManga): {$title_url}"); |
|
634 | + } |
|
601 | 635 | return $success; |
602 | 636 | } |
603 | 637 | public function isValidChapter(string $chapter) : bool { |
604 | 638 | $success = (bool) preg_match('/^.*?:--:[0-9]+$/', $chapter); |
605 | - if(!$success) log_message('error', 'Invalid Chapter (KissManga): '.$chapter); |
|
639 | + if(!$success) { |
|
640 | + log_message('error', 'Invalid Chapter (KissManga): '.$chapter); |
|
641 | + } |
|
606 | 642 | return $success; |
607 | 643 | } |
608 | 644 | |
@@ -669,12 +705,16 @@ discard block |
||
669 | 705 | |
670 | 706 | public function isValidTitleURL(string $title_url) : bool { |
671 | 707 | $success = (bool) preg_match('/^[a-z0-9_]+/', $title_url); |
672 | - if(!$success) log_message('error', "Invalid Title URL (KireiCake): {$title_url}"); |
|
708 | + if(!$success) { |
|
709 | + log_message('error', "Invalid Title URL (KireiCake): {$title_url}"); |
|
710 | + } |
|
673 | 711 | return $success; |
674 | 712 | } |
675 | 713 | public function isValidChapter(string $chapter) : bool { |
676 | 714 | $success = (bool) preg_match('/^en\/[0-9]+(?:\/[0-9]+(?:\/[0-9]+(?:\/[0-9]+)?)?)?$/', $chapter); |
677 | - if(!$success) log_message('error', 'Invalid Chapter (KireiCake): '.$chapter); |
|
715 | + if(!$success) { |
|
716 | + log_message('error', 'Invalid Chapter (KireiCake): '.$chapter); |
|
717 | + } |
|
678 | 718 | return $success; |
679 | 719 | } |
680 | 720 | |
@@ -731,12 +771,16 @@ discard block |
||
731 | 771 | |
732 | 772 | public function isValidTitleURL(string $title_url) : bool { |
733 | 773 | $success = (bool) preg_match('/^[a-z0-9-]+/', $title_url); |
734 | - if(!$success) log_message('error', "Invalid Title URL (GameOfScanlation): {$title_url}"); |
|
774 | + if(!$success) { |
|
775 | + log_message('error', "Invalid Title URL (GameOfScanlation): {$title_url}"); |
|
776 | + } |
|
735 | 777 | return $success; |
736 | 778 | } |
737 | 779 | public function isValidChapter(string $chapter) : bool { |
738 | 780 | $success = (bool) preg_match('/^[a-z0-9\.-]+$/', $chapter); |
739 | - if(!$success) log_message('error', 'Invalid Chapter (GameOfScanlation): '.$chapter); |
|
781 | + if(!$success) { |
|
782 | + log_message('error', 'Invalid Chapter (GameOfScanlation): '.$chapter); |
|
783 | + } |
|
740 | 784 | return $success; |
741 | 785 | } |
742 | 786 |
@@ -6,7 +6,9 @@ discard block |
||
6 | 6 | } |
7 | 7 | |
8 | 8 | public function index(int $page = 1) { |
9 | - if($page === 0) redirect('user/history/1'); |
|
9 | + if($page === 0) { |
|
10 | + redirect('user/history/1'); |
|
11 | + } |
|
10 | 12 | |
11 | 13 | $this->header_data['title'] = "History"; |
12 | 14 | $this->header_data['page'] = "history"; |
@@ -16,7 +18,9 @@ discard block |
||
16 | 18 | $this->body_data['currentPage'] = $page; |
17 | 19 | $this->body_data['totalPages'] = $historyData['totalPages']; |
18 | 20 | |
19 | - if($page > $this->body_data['totalPages']) redirect('user/history/1'); |
|
21 | + if($page > $this->body_data['totalPages']) { |
|
22 | + redirect('user/history/1'); |
|
23 | + } |
|
20 | 24 | |
21 | 25 | $this->_render_page('User/History'); |
22 | 26 | } |