@@ -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 | |
@@ -114,7 +114,9 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | final public function isValidTitleURL(string $title_url) : bool { |
| 116 | 116 | $success = (bool) preg_match($this->titleFormat, $title_url); |
| 117 | - if(!$success) log_message('error', "Invalid Title URL ({$this->site}): {$title_url}"); |
|
| 117 | + if(!$success) { |
|
| 118 | + log_message('error', "Invalid Title URL ({$this->site}): {$title_url}"); |
|
| 119 | + } |
|
| 118 | 120 | return $success; |
| 119 | 121 | } |
| 120 | 122 | |
@@ -128,7 +130,9 @@ discard block |
||
| 128 | 130 | */ |
| 129 | 131 | final public function isValidChapter(string $chapter) : bool { |
| 130 | 132 | $success = (bool) preg_match($this->chapterFormat, $chapter); |
| 131 | - if(!$success) log_message('error', "Invalid Chapter ({$this->site}): {$chapter}"); |
|
| 133 | + if(!$success) { |
|
| 134 | + log_message('error', "Invalid Chapter ({$this->site}): {$chapter}"); |
|
| 135 | + } |
|
| 132 | 136 | return $success; |
| 133 | 137 | } |
| 134 | 138 | |
@@ -155,14 +159,20 @@ discard block |
||
| 155 | 159 | //curl_setopt($ch, CURLOPT_VERBOSE, 1); |
| 156 | 160 | curl_setopt($ch, CURLOPT_HEADER, 1); |
| 157 | 161 | |
| 158 | - if($follow_redirect) curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
|
| 162 | + if($follow_redirect) { |
|
| 163 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
|
| 164 | + } |
|
| 159 | 165 | |
| 160 | 166 | if(($cookies = $this->cache->get("cloudflare_{$this->site}"))) { |
| 161 | 167 | $cookie_string .= "; {$cookies}"; |
| 162 | 168 | } |
| 163 | 169 | |
| 164 | - if(!empty($cookie_string)) curl_setopt($ch, CURLOPT_COOKIE, $cookie_string); |
|
| 165 | - if(!empty($cookiejar_path)) curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path); |
|
| 170 | + if(!empty($cookie_string)) { |
|
| 171 | + curl_setopt($ch, CURLOPT_COOKIE, $cookie_string); |
|
| 172 | + } |
|
| 173 | + if(!empty($cookiejar_path)) { |
|
| 174 | + curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path); |
|
| 175 | + } |
|
| 166 | 176 | |
| 167 | 177 | //Some sites check the useragent for stuff, use a pre-defined user-agent to avoid stuff. |
| 168 | 178 | curl_setopt($ch, CURLOPT_USERAGENT, $this->userAgent); |
@@ -190,7 +200,9 @@ discard block |
||
| 190 | 200 | $body = substr($response, $header_size); |
| 191 | 201 | curl_close($ch); |
| 192 | 202 | |
| 193 | - if($status_code === 503) $refresh = $this->handleCloudFlare($url, $body); |
|
| 203 | + if($status_code === 503) { |
|
| 204 | + $refresh = $this->handleCloudFlare($url, $body); |
|
| 205 | + } |
|
| 194 | 206 | } |
| 195 | 207 | |
| 196 | 208 | return [ |
@@ -400,8 +412,12 @@ discard block |
||
| 400 | 412 | $status = FALSE; |
| 401 | 413 | |
| 402 | 414 | //Make sure we have a volume element |
| 403 | - if(count($oldChapterSegments) === 1) array_unshift($oldChapterSegments, 'v0'); |
|
| 404 | - if(count($newChapterSegments) === 1) array_unshift($newChapterSegments, 'v0'); |
|
| 415 | + if(count($oldChapterSegments) === 1) { |
|
| 416 | + array_unshift($oldChapterSegments, 'v0'); |
|
| 417 | + } |
|
| 418 | + if(count($newChapterSegments) === 1) { |
|
| 419 | + array_unshift($newChapterSegments, 'v0'); |
|
| 420 | + } |
|
| 405 | 421 | |
| 406 | 422 | $oldCount = count($oldChapterSegments); |
| 407 | 423 | $newCount = count($newChapterSegments); |
@@ -414,8 +430,12 @@ discard block |
||
| 414 | 430 | $newVolume = substr(array_shift($newChapterSegments), 1); |
| 415 | 431 | |
| 416 | 432 | //Forcing volume to 0 as TBD might not be the latest (although it can be, but that is covered by other checks) |
| 417 | - if(in_array($oldVolume, ['TBD', 'TBA', 'NA', 'LMT'])) $oldVolume = 0; |
|
| 418 | - if(in_array($newVolume, ['TBD', 'TBA', 'NA', 'LMT'])) $newVolume = 0; |
|
| 433 | + if(in_array($oldVolume, ['TBD', 'TBA', 'NA', 'LMT'])) { |
|
| 434 | + $oldVolume = 0; |
|
| 435 | + } |
|
| 436 | + if(in_array($newVolume, ['TBD', 'TBA', 'NA', 'LMT'])) { |
|
| 437 | + $newVolume = 0; |
|
| 438 | + } |
|
| 419 | 439 | |
| 420 | 440 | $oldVolume = floatval($oldVolume); |
| 421 | 441 | $newVolume = floatval($newVolume); |