@@ -82,7 +82,9 @@ discard block |
||
| 82 | 82 | ]; |
| 83 | 83 | $arr['series'][$row->category]['manga'][] = $data; |
| 84 | 84 | |
| 85 | - if(!$arr['has_inactive']) $arr['has_inactive'] = !$data['title_data']['active']; |
|
| 85 | + if(!$arr['has_inactive']) { |
|
| 86 | + $arr['has_inactive'] = !$data['title_data']['active']; |
|
| 87 | + } |
|
| 86 | 88 | } |
| 87 | 89 | |
| 88 | 90 | //CHECK: Is this good for speed? |
@@ -198,9 +200,13 @@ discard block |
||
| 198 | 200 | $titleID = $id; |
| 199 | 201 | } else { |
| 200 | 202 | //TODO: Check if title is valid URL! |
| 201 | - if($create) $titleID = $this->addTitle($titleURL, $siteID); |
|
| 203 | + if($create) { |
|
| 204 | + $titleID = $this->addTitle($titleURL, $siteID); |
|
| 205 | + } |
|
| 206 | + } |
|
| 207 | + if(!isset($titleID) || !$titleID) { |
|
| 208 | + $titleID = 0; |
|
| 202 | 209 | } |
| 203 | - if(!isset($titleID) || !$titleID) $titleID = 0; |
|
| 204 | 210 | |
| 205 | 211 | return ($returnData && $titleID !== 0 ? $query->row_array() : $titleID); |
| 206 | 212 | } |
@@ -20,12 +20,16 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | public function isValidTitleURL(string $title_url) : bool { |
| 22 | 22 | $success = (bool) preg_match($this->titleFormat, $title_url); |
| 23 | - if(!$success) log_message('error', "Invalid Title URL ({$this->site}): {$title_url}"); |
|
| 23 | + if(!$success) { |
|
| 24 | + log_message('error', "Invalid Title URL ({$this->site}): {$title_url}"); |
|
| 25 | + } |
|
| 24 | 26 | return $success; |
| 25 | 27 | } |
| 26 | 28 | public function isValidChapter(string $chapter) : bool { |
| 27 | 29 | $success = (bool) preg_match($this->chapterFormat, $chapter); |
| 28 | - if(!$success) log_message('error', "Invalid Chapter ({$this->site}): {$chapter}"); |
|
| 30 | + if(!$success) { |
|
| 31 | + log_message('error', "Invalid Chapter ({$this->site}): {$chapter}"); |
|
| 32 | + } |
|
| 29 | 33 | return $success; |
| 30 | 34 | } |
| 31 | 35 | |
@@ -36,10 +40,16 @@ discard block |
||
| 36 | 40 | //curl_setopt($ch, CURLOPT_VERBOSE, 1); |
| 37 | 41 | curl_setopt($ch, CURLOPT_HEADER, 1); |
| 38 | 42 | |
| 39 | - if($follow_redirect) curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
|
| 43 | + if($follow_redirect) { |
|
| 44 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
|
| 45 | + } |
|
| 40 | 46 | |
| 41 | - if(!empty($cookie_string)) curl_setopt($ch, CURLOPT_COOKIE, $cookie_string); |
|
| 42 | - if(!empty($cookiejar_path)) curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path); |
|
| 47 | + if(!empty($cookie_string)) { |
|
| 48 | + curl_setopt($ch, CURLOPT_COOKIE, $cookie_string); |
|
| 49 | + } |
|
| 50 | + if(!empty($cookiejar_path)) { |
|
| 51 | + curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path); |
|
| 52 | + } |
|
| 43 | 53 | |
| 44 | 54 | //Some sites check the useragent for stuff, use a pre-defined user-agent to avoid stuff. |
| 45 | 55 | 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'); |
@@ -365,8 +375,12 @@ discard block |
||
| 365 | 375 | $oldVolume = substr(array_shift($oldChapterSegments), 1); |
| 366 | 376 | $newVolume = substr(array_shift($newChapterSegments), 1); |
| 367 | 377 | |
| 368 | - if(in_array($oldVolume, ['TBD', 'TBA', 'NA'])) $oldVolume = 999; |
|
| 369 | - if(in_array($newVolume, ['TBD', 'TBA', 'NA'])) $newVolume = 999; |
|
| 378 | + if(in_array($oldVolume, ['TBD', 'TBA', 'NA'])) { |
|
| 379 | + $oldVolume = 999; |
|
| 380 | + } |
|
| 381 | + if(in_array($newVolume, ['TBD', 'TBA', 'NA'])) { |
|
| 382 | + $newVolume = 999; |
|
| 383 | + } |
|
| 370 | 384 | |
| 371 | 385 | $oldVolume = floatval($oldVolume); |
| 372 | 386 | $newVolume = floatval($newVolume); |
@@ -873,7 +887,8 @@ discard block |
||
| 873 | 887 | |
| 874 | 888 | $content = $this->get_content($fullURL); |
| 875 | 889 | $data = $content['body']; |
| 876 | - if($data !== 'Can\'t find the manga series.') { //FIXME: We should check for he proper error here. |
|
| 890 | + if($data !== 'Can\'t find the manga series.') { |
|
| 891 | +//FIXME: We should check for he proper error here. |
|
| 877 | 892 | $xml = simplexml_load_string($data) or die("Error: Cannot create object"); |
| 878 | 893 | if(isset($xml->{'channel'}->item[0])) { |
| 879 | 894 | $titleData['title'] = trim((string) $xml->{'channel'}->title); |