@@ -157,9 +157,9 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | public function getSiteDataFromURL(string $site_url) { |
| 159 | 159 | $query = $this->db->select('id, site_class') |
| 160 | - ->from('tracker_sites') |
|
| 161 | - ->where('site', $site_url) |
|
| 162 | - ->get(); |
|
| 160 | + ->from('tracker_sites') |
|
| 161 | + ->where('site', $site_url) |
|
| 162 | + ->get(); |
|
| 163 | 163 | |
| 164 | 164 | if($query->num_rows() > 0) { |
| 165 | 165 | $siteData = $query->row(); |
@@ -170,11 +170,11 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | public function getTitleID(string $titleURL, int $siteID, bool $create = TRUE, bool $returnData = FALSE) { |
| 172 | 172 | $query = $this->db->select('tracker_titles.id, tracker_titles.title, tracker_titles.title_url, tracker_titles.latest_chapter, tracker_titles.status, tracker_sites.site_class, (tracker_titles.last_checked > DATE_SUB(NOW(), INTERVAL 3 DAY)) AS active', FALSE) |
| 173 | - ->from('tracker_titles') |
|
| 174 | - ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left') |
|
| 175 | - ->where('tracker_titles.title_url', $titleURL) |
|
| 176 | - ->where('tracker_titles.site_id', $siteID) |
|
| 177 | - ->get(); |
|
| 173 | + ->from('tracker_titles') |
|
| 174 | + ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left') |
|
| 175 | + ->where('tracker_titles.title_url', $titleURL) |
|
| 176 | + ->where('tracker_titles.site_id', $siteID) |
|
| 177 | + ->get(); |
|
| 178 | 178 | |
| 179 | 179 | if($query->num_rows() > 0) { |
| 180 | 180 | $id = (int) $query->row('id'); |
@@ -187,8 +187,8 @@ discard block |
||
| 187 | 187 | //Make sure last_checked is always updated on successful run. |
| 188 | 188 | //CHECK: Is there a reason we aren't just doing this in updateTitleById? |
| 189 | 189 | $this->db->set('last_checked', 'CURRENT_TIMESTAMP', FALSE) |
| 190 | - ->where('id', $id) |
|
| 191 | - ->update('tracker_titles'); |
|
| 190 | + ->where('id', $id) |
|
| 191 | + ->update('tracker_titles'); |
|
| 192 | 192 | } |
| 193 | 193 | } else { |
| 194 | 194 | log_message('error', "{$query->row('title')} failed to update successfully"); |
@@ -227,14 +227,14 @@ discard block |
||
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | $idQuery = $this->db->select('id') |
| 230 | - ->where('user_id', $userID) |
|
| 231 | - ->where('title_id', $titleID) |
|
| 232 | - ->get('tracker_chapters'); |
|
| 230 | + ->where('user_id', $userID) |
|
| 231 | + ->where('title_id', $titleID) |
|
| 232 | + ->get('tracker_chapters'); |
|
| 233 | 233 | if($idQuery->num_rows() > 0) { |
| 234 | 234 | $success = (bool) $this->db->set(['current_chapter' => $chapter, 'active' => 'Y', 'last_updated' => NULL]) |
| 235 | - ->where('user_id', $userID) |
|
| 236 | - ->where('title_id', $titleID) |
|
| 237 | - ->update('tracker_chapters'); |
|
| 235 | + ->where('user_id', $userID) |
|
| 236 | + ->where('title_id', $titleID) |
|
| 237 | + ->update('tracker_chapters'); |
|
| 238 | 238 | |
| 239 | 239 | if($success) { |
| 240 | 240 | $idQueryRow = $idQuery->row(); |
@@ -259,9 +259,9 @@ discard block |
||
| 259 | 259 | |
| 260 | 260 | public function updateTrackerByID(int $userID, int $chapterID, string $chapter) : bool { |
| 261 | 261 | $success = (bool) $this->db->set(['current_chapter' => $chapter, 'active' => 'Y', 'last_updated' => NULL]) |
| 262 | - ->where('user_id', $userID) |
|
| 263 | - ->where('id', $chapterID) |
|
| 264 | - ->update('tracker_chapters'); |
|
| 262 | + ->where('user_id', $userID) |
|
| 263 | + ->where('id', $chapterID) |
|
| 264 | + ->update('tracker_chapters'); |
|
| 265 | 265 | |
| 266 | 266 | if($success) { |
| 267 | 267 | $this->History->userUpdateTitle($chapterID, $chapter); |
@@ -274,23 +274,23 @@ discard block |
||
| 274 | 274 | //This is to allow user history to function properly. |
| 275 | 275 | |
| 276 | 276 | $success = $this->db->set(['active' => 'N', 'last_updated' => NULL]) |
| 277 | - ->where('user_id', $userID) |
|
| 278 | - ->where('id', $chapterID) |
|
| 279 | - ->update('tracker_chapters'); |
|
| 277 | + ->where('user_id', $userID) |
|
| 278 | + ->where('id', $chapterID) |
|
| 279 | + ->update('tracker_chapters'); |
|
| 280 | 280 | |
| 281 | 281 | return (bool) $success; |
| 282 | 282 | } |
| 283 | 283 | private function updateTitleById(int $id, string $latestChapter) { |
| 284 | 284 | //FIXME: Really not too happy with how we're doing history stuff here, it just feels messy. |
| 285 | 285 | $query = $this->db->select('latest_chapter AS current_chapter') |
| 286 | - ->from('tracker_titles') |
|
| 287 | - ->where('id', $id) |
|
| 288 | - ->get(); |
|
| 286 | + ->from('tracker_titles') |
|
| 287 | + ->where('id', $id) |
|
| 288 | + ->get(); |
|
| 289 | 289 | $row = $query->row(); |
| 290 | 290 | |
| 291 | 291 | $success = $this->db->set(['latest_chapter' => $latestChapter]) //last_updated gets updated via a trigger if something changes |
| 292 | - ->where('id', $id) |
|
| 293 | - ->update('tracker_titles'); |
|
| 292 | + ->where('id', $id) |
|
| 293 | + ->update('tracker_titles'); |
|
| 294 | 294 | |
| 295 | 295 | //Update History |
| 296 | 296 | //NOTE: To avoid doing another query to grab the last_updated time, we just use time() which <should> get the same thing. |
@@ -301,16 +301,16 @@ discard block |
||
| 301 | 301 | } |
| 302 | 302 | private function updateTitleDataById(int $id, array $titleData) { |
| 303 | 303 | $success = $this->db->set($titleData) |
| 304 | - ->where('id', $id) |
|
| 305 | - ->update('tracker_titles'); |
|
| 304 | + ->where('id', $id) |
|
| 305 | + ->update('tracker_titles'); |
|
| 306 | 306 | |
| 307 | 307 | return (bool) $success; |
| 308 | 308 | } |
| 309 | 309 | private function addTitle(string $titleURL, int $siteID) { |
| 310 | 310 | $query = $this->db->select('site, site_class') |
| 311 | - ->from('tracker_sites') |
|
| 312 | - ->where('id', $siteID) |
|
| 313 | - ->get(); |
|
| 311 | + ->from('tracker_sites') |
|
| 312 | + ->where('id', $siteID) |
|
| 313 | + ->get(); |
|
| 314 | 314 | |
| 315 | 315 | $titleData = $this->sites->{$query->row()->site_class}->getTitleData($titleURL, TRUE); |
| 316 | 316 | |
@@ -371,8 +371,8 @@ discard block |
||
| 371 | 371 | //Make sure last_checked is always updated on successful run. |
| 372 | 372 | //CHECK: Is there a reason we aren't just doing this in updateTitleById? |
| 373 | 373 | $this->db->set('last_checked', 'CURRENT_TIMESTAMP', FALSE) |
| 374 | - ->where('id', $row->id) |
|
| 375 | - ->update('tracker_titles'); |
|
| 374 | + ->where('id', $row->id) |
|
| 375 | + ->update('tracker_titles'); |
|
| 376 | 376 | |
| 377 | 377 | print " - ({$titleData['latest_chapter']})\n"; |
| 378 | 378 | } |
@@ -398,8 +398,8 @@ discard block |
||
| 398 | 398 | //Make sure last_checked is always updated on successful run. |
| 399 | 399 | //CHECK: Is there a reason we aren't just doing this in updateTitleById? |
| 400 | 400 | $this->db->set('last_checked', 'CURRENT_TIMESTAMP', FALSE) |
| 401 | - ->where('id', $titleID) |
|
| 402 | - ->update('tracker_titles'); |
|
| 401 | + ->where('id', $titleID) |
|
| 402 | + ->update('tracker_titles'); |
|
| 403 | 403 | |
| 404 | 404 | print " - ({$titleData['latest_chapter']})\n"; |
| 405 | 405 | } else { |
@@ -526,9 +526,9 @@ discard block |
||
| 526 | 526 | } |
| 527 | 527 | public function setCategoryTrackerByID(int $userID, int $chapterID, string $category) : bool { |
| 528 | 528 | $success = $this->db->set(['category' => $category, 'active' => 'Y', 'last_updated' => NULL]) |
| 529 | - ->where('user_id', $userID) |
|
| 530 | - ->where('id', $chapterID) |
|
| 531 | - ->update('tracker_chapters'); |
|
| 529 | + ->where('user_id', $userID) |
|
| 530 | + ->where('id', $chapterID) |
|
| 531 | + ->update('tracker_chapters'); |
|
| 532 | 532 | |
| 533 | 533 | return (bool) $success; |
| 534 | 534 | } |
@@ -537,9 +537,9 @@ discard block |
||
| 537 | 537 | $success = FALSE; |
| 538 | 538 | if(preg_match("/^[a-z0-9\\-_,:]{0,255}$/", $tag_string)) { |
| 539 | 539 | $success = (bool) $this->db->set(['tags' => $tag_string, 'active' => 'Y', 'last_updated' => NULL]) |
| 540 | - ->where('user_id', $userID) |
|
| 541 | - ->where('id', $chapterID) |
|
| 542 | - ->update('tracker_chapters'); |
|
| 540 | + ->where('user_id', $userID) |
|
| 541 | + ->where('id', $chapterID) |
|
| 542 | + ->update('tracker_chapters'); |
|
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | if($success) { |
@@ -577,23 +577,23 @@ discard block |
||
| 577 | 577 | |
| 578 | 578 | //We need the series to be tracked |
| 579 | 579 | $idCQuery = $this->db->select('id') |
| 580 | - ->where('user_id', $userID) |
|
| 581 | - ->where('title_id', $titleID) |
|
| 582 | - ->get('tracker_chapters'); |
|
| 580 | + ->where('user_id', $userID) |
|
| 581 | + ->where('title_id', $titleID) |
|
| 582 | + ->get('tracker_chapters'); |
|
| 583 | 583 | if($idCQuery->num_rows() > 0) { |
| 584 | 584 | $idCQueryRow = $idCQuery->row(); |
| 585 | 585 | |
| 586 | 586 | //Check if it is already favourited |
| 587 | 587 | $idFQuery = $this->db->select('id') |
| 588 | - ->where('chapter_id', $idCQueryRow->id) |
|
| 589 | - ->where('chapter', $chapter) |
|
| 590 | - ->get('tracker_favourites'); |
|
| 588 | + ->where('chapter_id', $idCQueryRow->id) |
|
| 589 | + ->where('chapter', $chapter) |
|
| 590 | + ->get('tracker_favourites'); |
|
| 591 | 591 | if($idFQuery->num_rows() > 0) { |
| 592 | 592 | //Chapter is already favourited, so remove it from DB |
| 593 | 593 | $idFQueryRow = $idFQuery->row(); |
| 594 | 594 | |
| 595 | 595 | $isSuccess = (bool) $this->db->where('id', $idFQueryRow->id) |
| 596 | - ->delete('tracker_favourites'); |
|
| 596 | + ->delete('tracker_favourites'); |
|
| 597 | 597 | |
| 598 | 598 | if($isSuccess) { |
| 599 | 599 | $success = array( |
@@ -664,20 +664,20 @@ discard block |
||
| 664 | 664 | |
| 665 | 665 | public function getSites() : array { |
| 666 | 666 | $query = $this->db->select('*') |
| 667 | - ->from('tracker_sites') |
|
| 668 | - ->where('status', 'enabled') |
|
| 669 | - ->get(); |
|
| 667 | + ->from('tracker_sites') |
|
| 668 | + ->where('status', 'enabled') |
|
| 669 | + ->get(); |
|
| 670 | 670 | |
| 671 | 671 | return $query->result_array(); |
| 672 | 672 | } |
| 673 | 673 | |
| 674 | 674 | public function getUsedCategories(int $userID) : array { |
| 675 | 675 | $query = $this->db->distinct() |
| 676 | - ->select('category') |
|
| 677 | - ->from('tracker_chapters') |
|
| 678 | - ->where('tracker_chapters.active', 'Y') |
|
| 679 | - ->where('user_id', $userID) |
|
| 680 | - ->get(); |
|
| 676 | + ->select('category') |
|
| 677 | + ->from('tracker_chapters') |
|
| 678 | + ->where('tracker_chapters.active', 'Y') |
|
| 679 | + ->where('user_id', $userID) |
|
| 680 | + ->get(); |
|
| 681 | 681 | |
| 682 | 682 | return array_column($query->result_array(), 'category'); |
| 683 | 683 | } |
@@ -688,51 +688,51 @@ discard block |
||
| 688 | 688 | |
| 689 | 689 | //CHECK: Is it possible to merge some of these queries? |
| 690 | 690 | $queryUsers = $this->db->select([ |
| 691 | - 'COUNT(*) AS total_users', |
|
| 692 | - 'SUM(CASE WHEN api_key IS NOT NULL THEN 1 ELSE 0 END) AS validated_users', |
|
| 693 | - 'SUM(CASE WHEN (api_key IS NOT NULL AND from_unixtime(last_login) > DATE_SUB(NOW(), INTERVAL 7 DAY)) THEN 1 ELSE 0 END) AS active_users' |
|
| 694 | - ], FALSE) |
|
| 695 | - ->from('auth_users') |
|
| 696 | - ->get(); |
|
| 691 | + 'COUNT(*) AS total_users', |
|
| 692 | + 'SUM(CASE WHEN api_key IS NOT NULL THEN 1 ELSE 0 END) AS validated_users', |
|
| 693 | + 'SUM(CASE WHEN (api_key IS NOT NULL AND from_unixtime(last_login) > DATE_SUB(NOW(), INTERVAL 7 DAY)) THEN 1 ELSE 0 END) AS active_users' |
|
| 694 | + ], FALSE) |
|
| 695 | + ->from('auth_users') |
|
| 696 | + ->get(); |
|
| 697 | 697 | $stats = array_merge($stats, $queryUsers->result_array()[0]); |
| 698 | 698 | |
| 699 | 699 | $queryCounts = $this->db->select([ |
| 700 | - 'tracker_titles.title', |
|
| 701 | - 'COUNT(tracker_chapters.title_id) AS count' |
|
| 702 | - ], FALSE) |
|
| 703 | - ->from('tracker_chapters') |
|
| 704 | - ->join('tracker_titles', 'tracker_titles.id = tracker_chapters.title_id', 'left') |
|
| 705 | - ->group_by('tracker_chapters.title_id') |
|
| 706 | - ->having('count > 1') |
|
| 707 | - ->order_by('count DESC') |
|
| 708 | - ->get(); |
|
| 700 | + 'tracker_titles.title', |
|
| 701 | + 'COUNT(tracker_chapters.title_id) AS count' |
|
| 702 | + ], FALSE) |
|
| 703 | + ->from('tracker_chapters') |
|
| 704 | + ->join('tracker_titles', 'tracker_titles.id = tracker_chapters.title_id', 'left') |
|
| 705 | + ->group_by('tracker_chapters.title_id') |
|
| 706 | + ->having('count > 1') |
|
| 707 | + ->order_by('count DESC') |
|
| 708 | + ->get(); |
|
| 709 | 709 | $stats['titles_tracked_more'] = count($queryCounts->result_array()); |
| 710 | 710 | $stats['top_title_name'] = $queryCounts->result_array()[0]['title'] ?? 'N/A'; |
| 711 | 711 | $stats['top_title_count'] = $queryCounts->result_array()[0]['count'] ?? 'N/A'; |
| 712 | 712 | |
| 713 | 713 | $queryTitles = $this->db->select([ |
| 714 | - 'COUNT(DISTINCT tracker_titles.id) AS total_titles', |
|
| 715 | - 'COUNT(DISTINCT tracker_titles.site_id) AS total_sites', |
|
| 716 | - 'SUM(CASE WHEN from_unixtime(auth_users.last_login) > DATE_SUB(NOW(), INTERVAL 120 HOUR) IS NOT NULL THEN 0 ELSE 1 END) AS inactive_titles', |
|
| 717 | - 'SUM(CASE WHEN (tracker_titles.last_updated > DATE_SUB(NOW(), INTERVAL 24 HOUR)) THEN 1 ELSE 0 END) AS updated_titles' |
|
| 718 | - ], FALSE) |
|
| 719 | - ->from('tracker_titles') |
|
| 720 | - ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left') |
|
| 721 | - ->join('tracker_chapters', 'tracker_titles.id = tracker_chapters.title_id', 'left') |
|
| 722 | - ->join('auth_users', 'tracker_chapters.user_id = auth_users.id', 'left') |
|
| 723 | - ->get(); |
|
| 714 | + 'COUNT(DISTINCT tracker_titles.id) AS total_titles', |
|
| 715 | + 'COUNT(DISTINCT tracker_titles.site_id) AS total_sites', |
|
| 716 | + 'SUM(CASE WHEN from_unixtime(auth_users.last_login) > DATE_SUB(NOW(), INTERVAL 120 HOUR) IS NOT NULL THEN 0 ELSE 1 END) AS inactive_titles', |
|
| 717 | + 'SUM(CASE WHEN (tracker_titles.last_updated > DATE_SUB(NOW(), INTERVAL 24 HOUR)) THEN 1 ELSE 0 END) AS updated_titles' |
|
| 718 | + ], FALSE) |
|
| 719 | + ->from('tracker_titles') |
|
| 720 | + ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left') |
|
| 721 | + ->join('tracker_chapters', 'tracker_titles.id = tracker_chapters.title_id', 'left') |
|
| 722 | + ->join('auth_users', 'tracker_chapters.user_id = auth_users.id', 'left') |
|
| 723 | + ->get(); |
|
| 724 | 724 | $stats = array_merge($stats, $queryTitles->result_array()[0]); |
| 725 | 725 | |
| 726 | 726 | $querySites = $this->db->select([ |
| 727 | - 'tracker_sites.site', |
|
| 728 | - 'COUNT(*) AS count' |
|
| 729 | - ], FALSE) |
|
| 730 | - ->from('tracker_titles') |
|
| 731 | - ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left') |
|
| 732 | - ->group_by('tracker_titles.site_id') |
|
| 733 | - ->order_by('count DESC') |
|
| 734 | - ->limit(3) |
|
| 735 | - ->get(); |
|
| 727 | + 'tracker_sites.site', |
|
| 728 | + 'COUNT(*) AS count' |
|
| 729 | + ], FALSE) |
|
| 730 | + ->from('tracker_titles') |
|
| 731 | + ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left') |
|
| 732 | + ->group_by('tracker_titles.site_id') |
|
| 733 | + ->order_by('count DESC') |
|
| 734 | + ->limit(3) |
|
| 735 | + ->get(); |
|
| 736 | 736 | $querySitesResult = $querySites->result_array(); |
| 737 | 737 | $stats['rank1_site'] = $querySitesResult[0]['site']; |
| 738 | 738 | $stats['rank1_site_count'] = $querySitesResult[0]['count']; |
@@ -742,17 +742,17 @@ discard block |
||
| 742 | 742 | $stats['rank3_site_count'] = $querySitesResult[2]['count']; |
| 743 | 743 | |
| 744 | 744 | $queryTitlesU = $this->db->select([ |
| 745 | - 'COUNT(*) AS title_updated_count' |
|
| 746 | - ], FALSE) |
|
| 747 | - ->from('tracker_titles_history') |
|
| 748 | - ->get(); |
|
| 745 | + 'COUNT(*) AS title_updated_count' |
|
| 746 | + ], FALSE) |
|
| 747 | + ->from('tracker_titles_history') |
|
| 748 | + ->get(); |
|
| 749 | 749 | $stats = array_merge($stats, $queryTitlesU->result_array()[0]); |
| 750 | 750 | |
| 751 | 751 | $queryUsersU = $this->db->select([ |
| 752 | - 'COUNT(*) AS user_updated_count' |
|
| 753 | - ], FALSE) |
|
| 754 | - ->from('tracker_user_history') |
|
| 755 | - ->get(); |
|
| 752 | + 'COUNT(*) AS user_updated_count' |
|
| 753 | + ], FALSE) |
|
| 754 | + ->from('tracker_user_history') |
|
| 755 | + ->get(); |
|
| 756 | 756 | $stats = array_merge($stats, $queryUsersU->result_array()[0]); |
| 757 | 757 | |
| 758 | 758 | $stats['live_time'] = timespan(/*2016-09-10T03:17:19*/ 1473477439, time(), 2); |
@@ -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 | } |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); defined('BASEPATH') OR exit('No direct script access allowed'); |
|
| 1 | +<?php declare(strict_types = 1); defined('BASEPATH') OR exit('No direct script access allowed'); |
|
| 2 | 2 | |
| 3 | 3 | abstract class Site_Model extends CI_Model { |
| 4 | 4 | public $site = ''; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | final protected function get_content(string $url, string $cookie_string = "", string $cookiejar_path = "", bool $follow_redirect = FALSE, bool $isPost = FALSE, array $postFields = []) { |
| 33 | 33 | $ch = curl_init(); |
| 34 | 34 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
| 35 | - curl_setopt($ch, CURLOPT_ENCODING , "gzip"); |
|
| 35 | + curl_setopt($ch, CURLOPT_ENCODING, "gzip"); |
|
| 36 | 36 | //curl_setopt($ch, CURLOPT_VERBOSE, 1); |
| 37 | 37 | curl_setopt($ch, CURLOPT_HEADER, 1); |
| 38 | 38 | |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | curl_setopt($ch, CURLOPT_URL, $url); |
| 51 | 51 | |
| 52 | 52 | if($isPost) { |
| 53 | - curl_setopt($ch,CURLOPT_POST, count($postFields)); |
|
| 54 | - curl_setopt($ch,CURLOPT_POSTFIELDS, http_build_query($postFields)); |
|
| 53 | + curl_setopt($ch, CURLOPT_POST, count($postFields)); |
|
| 54 | + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postFields)); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | $response = curl_exec($ch); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $nodes_row = $xpath->query($node_row_string); |
| 119 | 119 | if($nodes_title->length === 1 && $nodes_row->length === 1) { |
| 120 | 120 | $firstRow = $nodes_row->item(0); |
| 121 | - $nodes_latest = $xpath->query($node_latest_string, $firstRow); |
|
| 121 | + $nodes_latest = $xpath->query($node_latest_string, $firstRow); |
|
| 122 | 122 | |
| 123 | 123 | if($node_chapter_string !== '') { |
| 124 | 124 | $nodes_chapter = $xpath->query($node_chapter_string, $firstRow); |
@@ -254,8 +254,8 @@ discard block |
||
| 254 | 254 | |
| 255 | 255 | $link = preg_replace('/^(.*\/)(?:[0-9]+\.html)?$/', '$1', (string) $data['nodes_chapter']->getAttribute('href')); |
| 256 | 256 | $chapterURLSegments = explode('/', $link); |
| 257 | - $titleData['latest_chapter'] = $chapterURLSegments[5] . (isset($chapterURLSegments[6]) && !empty($chapterURLSegments[6]) ? "/{$chapterURLSegments[6]}" : ""); |
|
| 258 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue)); |
|
| 257 | + $titleData['latest_chapter'] = $chapterURLSegments[5].(isset($chapterURLSegments[6]) && !empty($chapterURLSegments[6]) ? "/{$chapterURLSegments[6]}" : ""); |
|
| 258 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue)); |
|
| 259 | 259 | |
| 260 | 260 | if($firstGet) { |
| 261 | 261 | $this->doCustomFollow($content['body']); |
@@ -333,9 +333,9 @@ discard block |
||
| 333 | 333 | |
| 334 | 334 | $link = preg_replace('/^(.*\/)(?:[0-9]+\.html)?$/', '$1', (string) $nodes_chapter->item(0)->getAttribute('href')); |
| 335 | 335 | $chapterURLSegments = explode('/', $link); |
| 336 | - $titleData['latest_chapter'] = $chapterURLSegments[5] . (isset($chapterURLSegments[6]) && !empty($chapterURLSegments[6]) ? "/{$chapterURLSegments[6]}" : ""); |
|
| 336 | + $titleData['latest_chapter'] = $chapterURLSegments[5].(isset($chapterURLSegments[6]) && !empty($chapterURLSegments[6]) ? "/{$chapterURLSegments[6]}" : ""); |
|
| 337 | 337 | |
| 338 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest->item(0)->nodeValue)); |
|
| 338 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest->item(0)->nodeValue)); |
|
| 339 | 339 | |
| 340 | 340 | $title_url = explode('/', $title->getAttribute('href'))[4]; |
| 341 | 341 | $titleDataList[$title_url] = $titleData; |
@@ -426,8 +426,8 @@ discard block |
||
| 426 | 426 | |
| 427 | 427 | $link = preg_replace('/^(.*\/)(?:[0-9]+\.html)?$/', '$1', (string) $data['nodes_chapter']->getAttribute('href')); |
| 428 | 428 | $chapterURLSegments = explode('/', $link); |
| 429 | - $titleData['latest_chapter'] = $chapterURLSegments[5] . (isset($chapterURLSegments[6]) && !empty($chapterURLSegments[6]) ? "/{$chapterURLSegments[6]}" : ""); |
|
| 430 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue)); |
|
| 429 | + $titleData['latest_chapter'] = $chapterURLSegments[5].(isset($chapterURLSegments[6]) && !empty($chapterURLSegments[6]) ? "/{$chapterURLSegments[6]}" : ""); |
|
| 430 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue)); |
|
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | return (!empty($titleData) ? $titleData : NULL); |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | |
| 459 | 459 | $chapter_parts = explode(':--:', $chapter); |
| 460 | 460 | return [ |
| 461 | - 'url' => "http://bato.to/reader#" . $chapter_parts[0], |
|
| 461 | + 'url' => "http://bato.to/reader#".$chapter_parts[0], |
|
| 462 | 462 | 'number' => $chapter_parts[1] |
| 463 | 463 | ]; |
| 464 | 464 | } |
@@ -493,13 +493,13 @@ discard block |
||
| 493 | 493 | |
| 494 | 494 | ///^(?:Vol\.(?<volume>\S+) )?(?:Ch.(?<chapter>[^\s:]+)(?:\s?-\s?(?<extra>[0-9]+))?):?.*/ |
| 495 | 495 | preg_match('/^(?:Vol\.(?<volume>\S+) )?(?:Ch.(?<chapter>[^\s:]+)(?:\s?-\s?(?<extra>[0-9]+))?):?.*/', trim($data['nodes_chapter']->nodeValue), $text); |
| 496 | - $titleData['latest_chapter'] = substr($data['nodes_chapter']->getAttribute('href'), 22) . ':--:' . ((!empty($text['volume']) ? 'v'.$text['volume'].'/' : '') . 'c'.$text['chapter'] . (!empty($text['extra']) ? '-'.$text['extra'] : '')); |
|
| 496 | + $titleData['latest_chapter'] = substr($data['nodes_chapter']->getAttribute('href'), 22).':--:'.((!empty($text['volume']) ? 'v'.$text['volume'].'/' : '').'c'.$text['chapter'].(!empty($text['extra']) ? '-'.$text['extra'] : '')); |
|
| 497 | 497 | |
| 498 | 498 | $dateString = $data['nodes_latest']->nodeValue; |
| 499 | 499 | if($dateString == 'An hour ago') { |
| 500 | 500 | $dateString = '1 hour ago'; |
| 501 | 501 | } |
| 502 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime(preg_replace('/ (-|\[A\]).*$/', '', $dateString))); |
|
| 502 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime(preg_replace('/ (-|\[A\]).*$/', '', $dateString))); |
|
| 503 | 503 | |
| 504 | 504 | if($firstGet && $lang == 'English') { |
| 505 | 505 | //FIXME: English is forced due for now. See #78. |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | |
| 603 | 603 | $chapter = $nodes_chapter->item(0); |
| 604 | 604 | preg_match('/^(?:Vol\.(?<volume>\S+) )?(?:Ch.(?<chapter>[^\s:]+)(?:\s?-\s?(?<extra>[0-9]+))?):?.*/', trim($chapter->nodeValue), $text); |
| 605 | - $titleData['latest_chapter'] = substr($chapter->getAttribute('href'), 8) . ':--:' . ((!empty($text['volume']) ? 'v' . $text['volume'] . '/' : '') . 'c' . $text['chapter'] . (!empty($text['extra']) ? '-' . $text['extra'] : '')); |
|
| 605 | + $titleData['latest_chapter'] = substr($chapter->getAttribute('href'), 8).':--:'.((!empty($text['volume']) ? 'v'.$text['volume'].'/' : '').'c'.$text['chapter'].(!empty($text['extra']) ? '-'.$text['extra'] : '')); |
|
| 606 | 606 | |
| 607 | 607 | $dateString = $nodes_latest->item(0)->nodeValue; |
| 608 | 608 | if($dateString == 'An hour ago') { |
@@ -651,7 +651,7 @@ discard block |
||
| 651 | 651 | */ |
| 652 | 652 | |
| 653 | 653 | $chapterData = [ |
| 654 | - 'url' => 'http://dynasty-scans.com/chapters/' . $title_parts[0].'_'.$chapter, |
|
| 654 | + 'url' => 'http://dynasty-scans.com/chapters/'.$title_parts[0].'_'.$chapter, |
|
| 655 | 655 | 'number' => '' |
| 656 | 656 | ]; |
| 657 | 657 | |
@@ -706,13 +706,13 @@ discard block |
||
| 706 | 706 | } |
| 707 | 707 | |
| 708 | 708 | $chapterURLSegments = explode('/', (string) $data['nodes_chapter']->getAttribute('href')); |
| 709 | - if (strpos($chapterURLSegments[2], $title_parts[0]) !== false) { |
|
| 709 | + if(strpos($chapterURLSegments[2], $title_parts[0]) !== false) { |
|
| 710 | 710 | $titleData['latest_chapter'] = substr($chapterURLSegments[2], strlen($title_parts[0]) + 1); |
| 711 | 711 | } else { |
| 712 | 712 | $titleData['latest_chapter'] = $chapterURLSegments[2]; |
| 713 | 713 | } |
| 714 | 714 | |
| 715 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime(str_replace("'", '', substr((string) $data['nodes_latest']->textContent, 9)))); |
|
| 715 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime(str_replace("'", '', substr((string) $data['nodes_latest']->textContent, 9)))); |
|
| 716 | 716 | } |
| 717 | 717 | break; |
| 718 | 718 | |
@@ -722,7 +722,7 @@ discard block |
||
| 722 | 722 | |
| 723 | 723 | preg_match('/<b>.*<\/b>/', $data, $matchesT); |
| 724 | 724 | preg_match('/\/doujins\/[^"]+">(.+)?(?=<\/a>)<\/a>/', $data, $matchesD); |
| 725 | - $titleData['title'] = (!empty($matchesD) ? ($matchesD[1] !== 'Original' ? $matchesD[1].' - ' : '') : '') . substr($matchesT[0], 3, -4); |
|
| 725 | + $titleData['title'] = (!empty($matchesD) ? ($matchesD[1] !== 'Original' ? $matchesD[1].' - ' : '') : '').substr($matchesT[0], 3, -4); |
|
| 726 | 726 | |
| 727 | 727 | $titleData['latest_chapter'] = 'oneshot'; //This will never change |
| 728 | 728 | |
@@ -777,7 +777,7 @@ discard block |
||
| 777 | 777 | |
| 778 | 778 | $titleData['latest_chapter'] = preg_replace('/^.*\/([0-9]+)$/', '$1', (string) $data['nodes_chapter']->getAttribute('href')); |
| 779 | 779 | |
| 780 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue)); |
|
| 780 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue)); |
|
| 781 | 781 | } |
| 782 | 782 | |
| 783 | 783 | return (!empty($titleData) ? $titleData : NULL); |
@@ -820,7 +820,7 @@ discard block |
||
| 820 | 820 | |
| 821 | 821 | $titleData['latest_chapter'] = preg_replace('/^.*\/(.*?\/[0-9]+)\/[0-9]+$/', '$1', (string) $data['nodes_chapter']->getAttribute('href')); |
| 822 | 822 | |
| 823 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue)); |
|
| 823 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue)); |
|
| 824 | 824 | } |
| 825 | 825 | |
| 826 | 826 | return (!empty($titleData) ? $titleData : NULL); |
@@ -879,8 +879,8 @@ discard block |
||
| 879 | 879 | $titleData['title'] = trim((string) $xml->{'channel'}->title); |
| 880 | 880 | |
| 881 | 881 | $chapterURLSegments = explode('/', ((string) $xml->{'channel'}->item[0]->link)); |
| 882 | - $titleData['latest_chapter'] = preg_replace('/^.*?([0-9]+)$/', '$1', $chapterURLSegments[7]) . ':--:' . $chapterURLSegments[6]; |
|
| 883 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $xml->{'channel'}->item[0]->pubDate)); |
|
| 882 | + $titleData['latest_chapter'] = preg_replace('/^.*?([0-9]+)$/', '$1', $chapterURLSegments[7]).':--:'.$chapterURLSegments[6]; |
|
| 883 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $xml->{'channel'}->item[0]->pubDate)); |
|
| 884 | 884 | } |
| 885 | 885 | } else { |
| 886 | 886 | log_message('error', "Series missing? (WebToons): {$title_url}"); |
@@ -951,13 +951,13 @@ discard block |
||
| 951 | 951 | $titleData['title'] = $nodes_title->item(0)->textContent; |
| 952 | 952 | |
| 953 | 953 | $firstRow = $nodes_row->item(0); |
| 954 | - $nodes_latest = $xpath->query("td[2]", $firstRow); |
|
| 954 | + $nodes_latest = $xpath->query("td[2]", $firstRow); |
|
| 955 | 955 | $nodes_chapter = $xpath->query("td[1]/a", $firstRow); |
| 956 | 956 | |
| 957 | 957 | $link = (string) $nodes_chapter->item(0)->getAttribute('href'); |
| 958 | 958 | $chapterURLSegments = explode('/', preg_replace('/\?.*$/', '', $link)); |
| 959 | - $titleData['latest_chapter'] = $chapterURLSegments[3] . ':--:' . preg_replace('/.*?([0-9]+)$/', '$1', $link); |
|
| 960 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest->item(0)->textContent)); |
|
| 959 | + $titleData['latest_chapter'] = $chapterURLSegments[3].':--:'.preg_replace('/.*?([0-9]+)$/', '$1', $link); |
|
| 960 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest->item(0)->textContent)); |
|
| 961 | 961 | } |
| 962 | 962 | } else { |
| 963 | 963 | //TODO: Throw ERRORS; |
@@ -981,7 +981,7 @@ discard block |
||
| 981 | 981 | The bad thing is these are interchangeable, despite them showing the exact same listing page. |
| 982 | 982 | Thankfully the title_url of manga which use /forums/ seem to be appended with ".%ID%" which means we can easily check them. */ |
| 983 | 983 | |
| 984 | - if (strpos($title_url, '.') !== FALSE) { |
|
| 984 | + if(strpos($title_url, '.') !== FALSE) { |
|
| 985 | 985 | $format = "https://gameofscanlation.moe/forums/{$title_url}/"; |
| 986 | 986 | } else { |
| 987 | 987 | $format = "https://gameofscanlation.moe/projects/{$title_url}/"; |
@@ -1016,7 +1016,7 @@ discard block |
||
| 1016 | 1016 | |
| 1017 | 1017 | $titleData['latest_chapter'] = preg_replace('/^projects\/.*?\/(.*?)\/$/', '$1', (string) $data['nodes_chapter']->getAttribute('href')); |
| 1018 | 1018 | |
| 1019 | - $titleData['last_updated'] = date("Y-m-d H:i:s",(int) $data['nodes_latest']->getAttribute('title')); |
|
| 1019 | + $titleData['last_updated'] = date("Y-m-d H:i:s", (int) $data['nodes_latest']->getAttribute('title')); |
|
| 1020 | 1020 | } |
| 1021 | 1021 | |
| 1022 | 1022 | return (!empty($titleData) ? $titleData : NULL); |
@@ -1060,7 +1060,7 @@ discard block |
||
| 1060 | 1060 | |
| 1061 | 1061 | $titleData['latest_chapter'] = preg_replace('/^.*\/([0-9]+)\/$/', '$1', (string) $data['nodes_chapter']->getAttribute('href')); |
| 1062 | 1062 | |
| 1063 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) substr($data['nodes_latest']->getAttribute('title'), 13))); |
|
| 1063 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) substr($data['nodes_latest']->getAttribute('title'), 13))); |
|
| 1064 | 1064 | } |
| 1065 | 1065 | |
| 1066 | 1066 | return (!empty($titleData) ? $titleData : NULL); |
@@ -1083,7 +1083,7 @@ discard block |
||
| 1083 | 1083 | $chapter_parts = explode('/', $chapter); |
| 1084 | 1084 | return [ |
| 1085 | 1085 | 'url' => "https://reader.kireicake.com/read/{$title_url}/{$chapter}/", |
| 1086 | - 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '') . "c{$chapter_parts[2]}" . (isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
| 1086 | + 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '')."c{$chapter_parts[2]}".(isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
| 1087 | 1087 | ]; |
| 1088 | 1088 | } |
| 1089 | 1089 | |
@@ -1107,7 +1107,7 @@ discard block |
||
| 1107 | 1107 | $chapter_parts = explode('/', $chapter); |
| 1108 | 1108 | return [ |
| 1109 | 1109 | 'url' => "https://reader.seaotterscans.com/read/{$title_url}/{$chapter}/", |
| 1110 | - 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '') . "c{$chapter_parts[2]}" . (isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
| 1110 | + 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '')."c{$chapter_parts[2]}".(isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
| 1111 | 1111 | ]; |
| 1112 | 1112 | } |
| 1113 | 1113 | |
@@ -1131,7 +1131,7 @@ discard block |
||
| 1131 | 1131 | $chapter_parts = explode('/', $chapter); |
| 1132 | 1132 | return [ |
| 1133 | 1133 | 'url' => "http://helveticascans.com/reader/read/{$title_url}/{$chapter}/", |
| 1134 | - 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '') . "c{$chapter_parts[2]}" . (isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
| 1134 | + 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '')."c{$chapter_parts[2]}".(isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
| 1135 | 1135 | ]; |
| 1136 | 1136 | } |
| 1137 | 1137 | |
@@ -1155,7 +1155,7 @@ discard block |
||
| 1155 | 1155 | $chapter_parts = explode('/', $chapter); |
| 1156 | 1156 | return [ |
| 1157 | 1157 | 'url' => "http://reader.sensescans.com/read/{$title_url}/{$chapter}/", |
| 1158 | - 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '') . "c{$chapter_parts[2]}" . (isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
| 1158 | + 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '')."c{$chapter_parts[2]}".(isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
| 1159 | 1159 | ]; |
| 1160 | 1160 | } |
| 1161 | 1161 | |
@@ -1179,7 +1179,7 @@ discard block |
||
| 1179 | 1179 | $chapter_parts = explode('/', $chapter); |
| 1180 | 1180 | return [ |
| 1181 | 1181 | 'url' => "https://jaiminisbox.com/reader/read/{$title_url}/{$chapter}/", |
| 1182 | - 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '') . "c{$chapter_parts[2]}" . (isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
| 1182 | + 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '')."c{$chapter_parts[2]}".(isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
| 1183 | 1183 | ]; |
| 1184 | 1184 | } |
| 1185 | 1185 | |
@@ -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); |