@@ -6,7 +6,9 @@ discard block |
||
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 |
||
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 | } |
@@ -32,18 +32,19 @@ |
||
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 | } |
@@ -44,12 +44,16 @@ discard block |
||
44 | 44 | |
45 | 45 | final public function isValidTitleURL(string $title_url) : bool { |
46 | 46 | $success = (bool) preg_match($this->titleFormat, $title_url); |
47 | - if(!$success) log_message('error', "Invalid Title URL ({$this->site}): {$title_url}"); |
|
47 | + if(!$success) { |
|
48 | + log_message('error', "Invalid Title URL ({$this->site}): {$title_url}"); |
|
49 | + } |
|
48 | 50 | return $success; |
49 | 51 | } |
50 | 52 | final public function isValidChapter(string $chapter) : bool { |
51 | 53 | $success = (bool) preg_match($this->chapterFormat, $chapter); |
52 | - if(!$success) log_message('error', "Invalid Chapter ({$this->site}): {$chapter}"); |
|
54 | + if(!$success) { |
|
55 | + log_message('error', "Invalid Chapter ({$this->site}): {$chapter}"); |
|
56 | + } |
|
53 | 57 | return $success; |
54 | 58 | } |
55 | 59 | |
@@ -60,10 +64,16 @@ discard block |
||
60 | 64 | //curl_setopt($ch, CURLOPT_VERBOSE, 1); |
61 | 65 | curl_setopt($ch, CURLOPT_HEADER, 1); |
62 | 66 | |
63 | - if($follow_redirect) curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
|
67 | + if($follow_redirect) { |
|
68 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
|
69 | + } |
|
64 | 70 | |
65 | - if(!empty($cookie_string)) curl_setopt($ch, CURLOPT_COOKIE, $cookie_string); |
|
66 | - if(!empty($cookiejar_path)) curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path); |
|
71 | + if(!empty($cookie_string)) { |
|
72 | + curl_setopt($ch, CURLOPT_COOKIE, $cookie_string); |
|
73 | + } |
|
74 | + if(!empty($cookiejar_path)) { |
|
75 | + curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path); |
|
76 | + } |
|
67 | 77 | |
68 | 78 | //Some sites check the useragent for stuff, use a pre-defined user-agent to avoid stuff. |
69 | 79 | 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'); |
@@ -234,8 +244,12 @@ discard block |
||
234 | 244 | $status = FALSE; |
235 | 245 | |
236 | 246 | //Make sure we have a volume element |
237 | - if(count($oldChapterSegments) === 1) array_unshift($oldChapterSegments, 'v0'); |
|
238 | - if(count($newChapterSegments) === 1) array_unshift($newChapterSegments, 'v0'); |
|
247 | + if(count($oldChapterSegments) === 1) { |
|
248 | + array_unshift($oldChapterSegments, 'v0'); |
|
249 | + } |
|
250 | + if(count($newChapterSegments) === 1) { |
|
251 | + array_unshift($newChapterSegments, 'v0'); |
|
252 | + } |
|
239 | 253 | |
240 | 254 | $oldCount = count($oldChapterSegments); |
241 | 255 | $newCount = count($newChapterSegments); |
@@ -248,8 +262,12 @@ discard block |
||
248 | 262 | $newVolume = substr(array_shift($newChapterSegments), 1); |
249 | 263 | |
250 | 264 | //Forcing volume to 0 as TBD might not be the latest (although it can be, but that is covered by other checks) |
251 | - if(in_array($oldVolume, ['TBD', 'TBA', 'NA', 'LMT'])) $oldVolume = 0; |
|
252 | - if(in_array($newVolume, ['TBD', 'TBA', 'NA', 'LMT'])) $newVolume = 0; |
|
265 | + if(in_array($oldVolume, ['TBD', 'TBA', 'NA', 'LMT'])) { |
|
266 | + $oldVolume = 0; |
|
267 | + } |
|
268 | + if(in_array($newVolume, ['TBD', 'TBA', 'NA', 'LMT'])) { |
|
269 | + $newVolume = 0; |
|
270 | + } |
|
253 | 271 | |
254 | 272 | $oldVolume = floatval($oldVolume); |
255 | 273 | $newVolume = floatval($newVolume); |
@@ -1,6 +1,8 @@ |
||
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 | const ASSET_FOLDER = 'public/assets'; |
@@ -72,8 +72,12 @@ discard block |
||
72 | 72 | |
73 | 73 | $arr['series'][$row->category]['manga'][] = $data; |
74 | 74 | |
75 | - if(!$arr['has_inactive']) $arr['has_inactive'] = !$data['title_data']['active']; |
|
76 | - if($arr['has_inactive']) $arr['inactive_titles'][$data['full_title_url']] = $data['title_data']['title']; |
|
75 | + if(!$arr['has_inactive']) { |
|
76 | + $arr['has_inactive'] = !$data['title_data']['active']; |
|
77 | + } |
|
78 | + if($arr['has_inactive']) { |
|
79 | + $arr['inactive_titles'][$data['full_title_url']] = $data['title_data']['title']; |
|
80 | + } |
|
77 | 81 | } |
78 | 82 | |
79 | 83 | //FIXME: This is not good for speed, but we're kind of required to do this for UX purposes. |
@@ -107,11 +111,15 @@ discard block |
||
107 | 111 | |
108 | 112 | if($sortOrder == 'asc') { |
109 | 113 | $unreadSort = ($a_text <=> $b_text); |
110 | - if($unreadSort) return $unreadSort; |
|
114 | + if($unreadSort) { |
|
115 | + return $unreadSort; |
|
116 | + } |
|
111 | 117 | return $a_text2 <=> $b_text2; |
112 | 118 | } else { |
113 | 119 | $unreadSort = ($a_text <=> $b_text); |
114 | - if($unreadSort) return $unreadSort; |
|
120 | + if($unreadSort) { |
|
121 | + return $unreadSort; |
|
122 | + } |
|
115 | 123 | return $b_text2 <=> $a_text2; |
116 | 124 | } |
117 | 125 | }); |