@@ -1,4 +1,4 @@ |
||
| 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 | include_once APPPATH.'models/Tracker/Tracker_Base_Model.php'; |
| 4 | 4 | foreach (glob(APPPATH.'models/Tracker/*.php') as $filename) { |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php declare(strict_types=1); defined('BASEPATH') OR exit('No direct script access allowed'); |
| 2 | 2 | |
| 3 | 3 | include_once APPPATH.'models/Tracker/Tracker_Base_Model.php'; |
| 4 | -foreach (glob(APPPATH.'models/Tracker/*.php') as $filename) { |
|
| 4 | +foreach(glob(APPPATH.'models/Tracker/*.php') as $filename) { |
|
| 5 | 5 | /** @noinspection PhpIncludeInspection */ |
| 6 | 6 | include_once $filename; |
| 7 | 7 | } |
@@ -1,4 +1,4 @@ |
||
| 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 | class History_Model extends CI_Model { |
| 4 | 4 | public function __construct() { |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | foreach($result as $row) { |
| 58 | 58 | $arrRow = []; |
| 59 | 59 | |
| 60 | - $arrRow['updated_at'] = $row->updated_at; |
|
| 60 | + $arrRow['updated_at'] = $row->updated_at; |
|
| 61 | 61 | |
| 62 | 62 | $newChapterData = $this->Tracker->sites->{$row->site_class}->getChapterData($row->title_url, $row->new_chapter); |
| 63 | 63 | $arrRow['new_chapter'] = "<a href=\"{$newChapterData['url']}\">{$newChapterData['number']}</a>"; |
@@ -1,4 +1,4 @@ |
||
| 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 | class Tracker_Stats_Model extends Tracker_Base_Model { |
| 4 | 4 | public function __construct() { |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | ], FALSE) |
| 29 | 29 | ->from('tracker_chapters') |
| 30 | 30 | ->join('tracker_titles', 'tracker_titles.id = tracker_chapters.title_id', 'left') |
| 31 | - ->join('tracker_sites','tracker_titles.site_id = tracker_sites.id', 'left') |
|
| 31 | + ->join('tracker_sites', 'tracker_titles.site_id = tracker_sites.id', 'left') |
|
| 32 | 32 | ->where('tracker_sites.status', 'enabled') |
| 33 | 33 | ->group_by('tracker_chapters.title_id') |
| 34 | 34 | ->having('count > 1') |
@@ -1,4 +1,4 @@ |
||
| 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 | //http://english.stackexchange.com/a/141735 |
| 4 | 4 | class Tracker_Portation_Model extends Tracker_Base_Model { |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | $arr = []; |
| 63 | 63 | if($query->num_rows() > 0) { |
| 64 | - foreach ($query->result() as $row) { |
|
| 64 | + foreach($query->result() as $row) { |
|
| 65 | 65 | $arr[$row->category][] = [ |
| 66 | 66 | 'site' => $row->site, |
| 67 | 67 | 'title_url' => $row->title_url, |
@@ -94,15 +94,15 @@ discard block |
||
| 94 | 94 | $enclosure_esc = preg_quote($enclosure, '/'); |
| 95 | 95 | |
| 96 | 96 | $output = array(); |
| 97 | - foreach ($fields as $field) { |
|
| 98 | - if ($field === NULL && $nullToMysqlNull) { |
|
| 97 | + foreach($fields as $field) { |
|
| 98 | + if($field === NULL && $nullToMysqlNull) { |
|
| 99 | 99 | $output[] = 'NULL'; |
| 100 | 100 | continue; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | // Enclose fields containing $delimiter, $enclosure or whitespace |
| 104 | - if ($encloseAll || preg_match("/(?:${delimiter_esc}|${enclosure_esc}|\s)/", $field)) { |
|
| 105 | - $output[] = $enclosure . str_replace($enclosure, $enclosure . $enclosure, $field) . $enclosure; |
|
| 104 | + if($encloseAll || preg_match("/(?:${delimiter_esc}|${enclosure_esc}|\s)/", $field)) { |
|
| 105 | + $output[] = $enclosure.str_replace($enclosure, $enclosure.$enclosure, $field).$enclosure; |
|
| 106 | 106 | } else { |
| 107 | 107 | $output[] = $field; |
| 108 | 108 | } |
@@ -116,10 +116,10 @@ discard block |
||
| 116 | 116 | $csvArr[] = $headers; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - foreach ($fields as $field) { |
|
| 120 | - $csvArr[] = $this->arrayToCSV($field, $delimiter, $enclosure,$encloseAll,$nullToMysqlNull); |
|
| 119 | + foreach($fields as $field) { |
|
| 120 | + $csvArr[] = $this->arrayToCSV($field, $delimiter, $enclosure, $encloseAll, $nullToMysqlNull); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - return implode(PHP_EOL,$csvArr); |
|
| 123 | + return implode(PHP_EOL, $csvArr); |
|
| 124 | 124 | } |
| 125 | 125 | } |
@@ -1,4 +1,4 @@ |
||
| 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 | class Tracker_Favourites_Model extends Tracker_Base_Model { |
| 4 | 4 | public function __construct() { |
@@ -71,32 +71,32 @@ |
||
| 71 | 71 | |
| 72 | 72 | ////We need the series to be tracked |
| 73 | 73 | $idCQuery = $this->db->select('id') |
| 74 | - ->where('user_id', $userID) |
|
| 75 | - ->where('title_id', $titleID) |
|
| 76 | - ->get('tracker_chapters'); |
|
| 74 | + ->where('user_id', $userID) |
|
| 75 | + ->where('title_id', $titleID) |
|
| 76 | + ->get('tracker_chapters'); |
|
| 77 | 77 | if(!($idCQuery->num_rows() > 0)) { |
| 78 | 78 | //NOTE: This pretty much repeats a lot of what we already did above. Is there a better way to do this? |
| 79 | 79 | $this->Tracker->list->update($userID, $site, $title, $chapter, FALSE); |
| 80 | 80 | |
| 81 | 81 | $idCQuery = $this->db->select('id') |
| 82 | - ->where('user_id', $userID) |
|
| 83 | - ->where('title_id', $titleID) |
|
| 84 | - ->get('tracker_chapters'); |
|
| 82 | + ->where('user_id', $userID) |
|
| 83 | + ->where('title_id', $titleID) |
|
| 84 | + ->get('tracker_chapters'); |
|
| 85 | 85 | } |
| 86 | 86 | if($idCQuery->num_rows() > 0) { |
| 87 | 87 | $idCQueryRow = $idCQuery->row(); |
| 88 | 88 | |
| 89 | 89 | //Check if it is already favourited |
| 90 | 90 | $idFQuery = $this->db->select('id') |
| 91 | - ->where('chapter_id', $idCQueryRow->id) |
|
| 92 | - ->where('chapter', $chapter) |
|
| 93 | - ->get('tracker_favourites'); |
|
| 91 | + ->where('chapter_id', $idCQueryRow->id) |
|
| 92 | + ->where('chapter', $chapter) |
|
| 93 | + ->get('tracker_favourites'); |
|
| 94 | 94 | if($idFQuery->num_rows() > 0) { |
| 95 | 95 | //Chapter is already favourited, so remove it from DB |
| 96 | 96 | $idFQueryRow = $idFQuery->row(); |
| 97 | 97 | |
| 98 | 98 | $isSuccess = (bool) $this->db->where('id', $idFQueryRow->id) |
| 99 | - ->delete('tracker_favourites'); |
|
| 99 | + ->delete('tracker_favourites'); |
|
| 100 | 100 | |
| 101 | 101 | if($isSuccess) { |
| 102 | 102 | $success = array( |
@@ -14,8 +14,8 @@ discard block |
||
| 14 | 14 | tf.chapter, tf.updated_at', FALSE) |
| 15 | 15 | ->from('tracker_favourites AS tf') |
| 16 | 16 | ->join('tracker_chapters AS tc', 'tf.chapter_id = tc.id', 'left') |
| 17 | - ->join('tracker_titles AS tt', 'tc.title_id = tt.id', 'left') |
|
| 18 | - ->join('tracker_sites AS ts', 'tt.site_id = ts.id', 'left') |
|
| 17 | + ->join('tracker_titles AS tt', 'tc.title_id = tt.id', 'left') |
|
| 18 | + ->join('tracker_sites AS ts', 'tt.site_id = ts.id', 'left') |
|
| 19 | 19 | ->where('tc.user_id', $this->User->id) //CHECK: Is this inefficient? Would it be better to have a user_id column in tracker_favourites? |
| 20 | 20 | ->order_by('tf.id DESC') |
| 21 | 21 | ->limit($rowsPerPage, ($rowsPerPage * ($page - 1))) |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | tf.chapter, tf.updated_at', FALSE) |
| 51 | 51 | ->from('tracker_favourites AS tf') |
| 52 | 52 | ->join('tracker_chapters AS tc', 'tf.chapter_id = tc.id', 'left') |
| 53 | - ->join('tracker_titles AS tt', 'tc.title_id = tt.id', 'left') |
|
| 54 | - ->join('tracker_sites AS ts', 'tt.site_id = ts.id', 'left') |
|
| 53 | + ->join('tracker_titles AS tt', 'tc.title_id = tt.id', 'left') |
|
| 54 | + ->join('tracker_sites AS ts', 'tt.site_id = ts.id', 'left') |
|
| 55 | 55 | ->where('tc.user_id', $this->User->id) //CHECK: Is this inefficient? Would it be better to have a user_id column in tracker_favourites? |
| 56 | 56 | ->order_by('tf.id DESC') |
| 57 | 57 | ->get(); |
@@ -1,4 +1,4 @@ |
||
| 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 | class Tracker_Base_Model extends CI_Model { |
| 4 | 4 | public $sites; |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | $this->enabledCategories['custom3'] = $this->User_Options->get('category_custom_3_text'); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - foreach (glob(APPPATH.'models/Tracker/Sites/*.php') as $filename) { |
|
| 29 | + foreach(glob(APPPATH.'models/Tracker/Sites/*.php') as $filename) { |
|
| 30 | 30 | /** @noinspection PhpIncludeInspection */ |
| 31 | 31 | include_once $filename; |
| 32 | 32 | } |
@@ -1,4 +1,4 @@ |
||
| 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 | class Tracker_Admin_Model extends Tracker_Base_Model { |
| 4 | 4 | public function __construct() { |
@@ -159,8 +159,8 @@ discard block |
||
| 159 | 159 | //Make sure last_checked is always updated on successful run. |
| 160 | 160 | //CHECK: Is there a reason we aren't just doing this in updateByID? |
| 161 | 161 | $this->db->set('last_checked', 'CURRENT_TIMESTAMP', FALSE) |
| 162 | - ->where('id', $row->title_id) |
|
| 163 | - ->update('tracker_titles'); |
|
| 162 | + ->where('id', $row->title_id) |
|
| 163 | + ->update('tracker_titles'); |
|
| 164 | 164 | |
| 165 | 165 | print " - ({$titleData['latest_chapter']})\n"; |
| 166 | 166 | } else { |
@@ -174,8 +174,8 @@ discard block |
||
| 174 | 174 | //Make sure last_checked is always updated on successful run. |
| 175 | 175 | //CHECK: Is there a reason we aren't just doing this in updateByID? |
| 176 | 176 | $this->db->set('last_checked', 'CURRENT_TIMESTAMP', FALSE) |
| 177 | - ->where('id', $row->title_id) |
|
| 178 | - ->update('tracker_titles'); |
|
| 177 | + ->where('id', $row->title_id) |
|
| 178 | + ->update('tracker_titles'); |
|
| 179 | 179 | |
| 180 | 180 | print " - (No chapters found?)\n"; |
| 181 | 181 | } else { |
@@ -203,10 +203,10 @@ discard block |
||
| 203 | 203 | */ |
| 204 | 204 | public function updateCustom() { |
| 205 | 205 | $query = $this->db->select('*') |
| 206 | - ->from('tracker_sites') |
|
| 207 | - ->where('tracker_sites.status', 'enabled') |
|
| 208 | - ->where('tracker_sites.use_custom', 'Y') |
|
| 209 | - ->get(); |
|
| 206 | + ->from('tracker_sites') |
|
| 207 | + ->where('tracker_sites.status', 'enabled') |
|
| 208 | + ->where('tracker_sites.use_custom', 'Y') |
|
| 209 | + ->get(); |
|
| 210 | 210 | |
| 211 | 211 | $sites = $query->result_array(); |
| 212 | 212 | foreach ($sites as $site) { |
@@ -223,8 +223,8 @@ discard block |
||
| 223 | 223 | //Make sure last_checked is always updated on successful run. |
| 224 | 224 | //CHECK: Is there a reason we aren't just doing this in updateByID? |
| 225 | 225 | $this->db->set('last_checked', 'CURRENT_TIMESTAMP', FALSE) |
| 226 | - ->where('id', $titleID) |
|
| 227 | - ->update('tracker_titles'); |
|
| 226 | + ->where('id', $titleID) |
|
| 227 | + ->update('tracker_titles'); |
|
| 228 | 228 | |
| 229 | 229 | print " - ({$titleData['latest_chapter']})\n"; |
| 230 | 230 | } else { |
@@ -253,13 +253,13 @@ discard block |
||
| 253 | 253 | |
| 254 | 254 | public function refollowCustom() { |
| 255 | 255 | $query = $this->db->select('tracker_titles.id, tracker_titles.title_url, tracker_sites.site_class') |
| 256 | - ->from('tracker_titles') |
|
| 257 | - ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left') |
|
| 258 | - ->where('tracker_titles.followed','N') |
|
| 259 | - ->where('tracker_titles !=', '255') |
|
| 260 | - ->where('tracker_sites.status', 'enabled') |
|
| 261 | - ->where('tracker_sites.use_custom', 'Y') |
|
| 262 | - ->get(); |
|
| 256 | + ->from('tracker_titles') |
|
| 257 | + ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left') |
|
| 258 | + ->where('tracker_titles.followed','N') |
|
| 259 | + ->where('tracker_titles !=', '255') |
|
| 260 | + ->where('tracker_sites.status', 'enabled') |
|
| 261 | + ->where('tracker_sites.use_custom', 'Y') |
|
| 262 | + ->get(); |
|
| 263 | 263 | |
| 264 | 264 | if($query->num_rows() > 0) { |
| 265 | 265 | foreach($query->result() as $row) { |
@@ -270,8 +270,8 @@ discard block |
||
| 270 | 270 | |
| 271 | 271 | if(!empty($titleData)) { |
| 272 | 272 | $this->db->set($titleData) |
| 273 | - ->where('id', $row->id) |
|
| 274 | - ->update('tracker_titles'); |
|
| 273 | + ->where('id', $row->id) |
|
| 274 | + ->update('tracker_titles'); |
|
| 275 | 275 | |
| 276 | 276 | print "> {$row->site_class}:{$row->id}:{$row->title_url} FOLLOWED\n"; |
| 277 | 277 | } else { |
@@ -291,14 +291,14 @@ discard block |
||
| 291 | 291 | $date = $temp_now->format('Y-m-d'); |
| 292 | 292 | |
| 293 | 293 | $query = $this->db->select('1') |
| 294 | - ->from('site_stats') |
|
| 295 | - ->where('date', $date) |
|
| 296 | - ->get(); |
|
| 294 | + ->from('site_stats') |
|
| 295 | + ->where('date', $date) |
|
| 296 | + ->get(); |
|
| 297 | 297 | |
| 298 | 298 | if($query->num_rows() > 0) { |
| 299 | 299 | $this->db->set('total_requests', 'total_requests+1', FALSE) |
| 300 | - ->where('date', $date) |
|
| 301 | - ->update('site_stats'); |
|
| 300 | + ->where('date', $date) |
|
| 301 | + ->update('site_stats'); |
|
| 302 | 302 | } else { |
| 303 | 303 | $this->db->insert('site_stats', [ |
| 304 | 304 | 'date' => $date, |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $query = $query->get(); |
| 78 | 78 | |
| 79 | 79 | if($query->num_rows() > 0) { |
| 80 | - foreach ($query->result() as $row) { |
|
| 80 | + foreach($query->result() as $row) { |
|
| 81 | 81 | $this->handleUpdate($row); |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $query = $query->get(); |
| 135 | 135 | |
| 136 | 136 | if($query->num_rows() > 0) { |
| 137 | - foreach ($query->result() as $row) { |
|
| 137 | + foreach($query->result() as $row) { |
|
| 138 | 138 | $this->handleUpdate($row); |
| 139 | 139 | } |
| 140 | 140 | } |
@@ -209,10 +209,10 @@ discard block |
||
| 209 | 209 | ->get(); |
| 210 | 210 | |
| 211 | 211 | $sites = $query->result_array(); |
| 212 | - foreach ($sites as $site) { |
|
| 212 | + foreach($sites as $site) { |
|
| 213 | 213 | $siteClass = $this->sites->{$site['site_class']}; |
| 214 | 214 | if($titleDataList = $siteClass->doCustomUpdate()) { |
| 215 | - foreach ($titleDataList as $titleURL => $titleData) { |
|
| 215 | + foreach($titleDataList as $titleURL => $titleData) { |
|
| 216 | 216 | $titleURL = (string) $titleURL; //Number only keys get converted to int for some reason, so we need to fix that. |
| 217 | 217 | print "> {$titleData['title']} <{$site['site_class']}>"; //Print this prior to doing anything so we can more easily find out if something went wrong |
| 218 | 218 | if(is_array($titleData) && !is_null($titleData['latest_chapter'])) { |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | $query = $this->db->select('tracker_titles.id, tracker_titles.title_url, tracker_sites.site_class') |
| 256 | 256 | ->from('tracker_titles') |
| 257 | 257 | ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left') |
| 258 | - ->where('tracker_titles.followed','N') |
|
| 258 | + ->where('tracker_titles.followed', 'N') |
|
| 259 | 259 | ->where('tracker_titles !=', '255') |
| 260 | 260 | ->where('tracker_sites.status', 'enabled') |
| 261 | 261 | ->where('tracker_sites.use_custom', 'Y') |
@@ -184,8 +184,7 @@ |
||
| 184 | 184 | print " - Something went wrong?\n"; |
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | - } |
|
| 188 | - else { |
|
| 187 | + } else { |
|
| 189 | 188 | //TODO: We should have some way to handle this in the site models. |
| 190 | 189 | if($row->site_class !== 'MangaKakarot') { |
| 191 | 190 | log_message('error', "{$row->site_class} | {$row->title} ({$row->title_url}) | Failed to update."); |
@@ -1,4 +1,4 @@ |
||
| 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 | class Tracker_List_Model extends Tracker_Base_Model { |
| 4 | 4 | public function __construct() { |
@@ -114,11 +114,15 @@ |
||
| 114 | 114 | |
| 115 | 115 | if($sortOrder == 'asc') { |
| 116 | 116 | $unreadSort = ($a_text <=> $b_text); |
| 117 | - if($unreadSort) return $unreadSort; |
|
| 117 | + if($unreadSort) { |
|
| 118 | + return $unreadSort; |
|
| 119 | + } |
|
| 118 | 120 | return $a_text2 <=> $b_text2; |
| 119 | 121 | } else { |
| 120 | 122 | $unreadSort = ($a_text <=> $b_text); |
| 121 | - if($unreadSort) return $unreadSort; |
|
| 123 | + if($unreadSort) { |
|
| 124 | + return $unreadSort; |
|
| 125 | + } |
|
| 122 | 126 | return $b_text2 <=> $a_text2; |
| 123 | 127 | } |
| 124 | 128 | }); |
@@ -203,14 +203,14 @@ discard block |
||
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | $idQuery = $this->db->select('id') |
| 206 | - ->where('user_id', $userID) |
|
| 207 | - ->where('title_id', $titleID) |
|
| 208 | - ->get('tracker_chapters'); |
|
| 206 | + ->where('user_id', $userID) |
|
| 207 | + ->where('title_id', $titleID) |
|
| 208 | + ->get('tracker_chapters'); |
|
| 209 | 209 | if($idQuery->num_rows() > 0) { |
| 210 | 210 | $success = (bool) $this->db->set(['current_chapter' => $chapter, 'active' => 'Y', 'last_updated' => NULL, 'ignore_chapter' => NULL]) |
| 211 | - ->where('user_id', $userID) |
|
| 212 | - ->where('title_id', $titleID) |
|
| 213 | - ->update('tracker_chapters'); |
|
| 211 | + ->where('user_id', $userID) |
|
| 212 | + ->where('title_id', $titleID) |
|
| 213 | + ->update('tracker_chapters'); |
|
| 214 | 214 | |
| 215 | 215 | if($success) { |
| 216 | 216 | $idQueryRow = $idQuery->row(); |
@@ -236,9 +236,9 @@ discard block |
||
| 236 | 236 | } |
| 237 | 237 | public function updateByID(int $userID, int $chapterID, string $chapter) : bool { |
| 238 | 238 | $success = (bool) $this->db->set(['current_chapter' => $chapter, 'active' => 'Y', 'last_updated' => NULL]) |
| 239 | - ->where('user_id', $userID) |
|
| 240 | - ->where('id', $chapterID) |
|
| 241 | - ->update('tracker_chapters'); |
|
| 239 | + ->where('user_id', $userID) |
|
| 240 | + ->where('id', $chapterID) |
|
| 241 | + ->update('tracker_chapters'); |
|
| 242 | 242 | |
| 243 | 243 | if($success) { |
| 244 | 244 | $this->History->userUpdateTitle($chapterID, $chapter); |
@@ -248,9 +248,9 @@ discard block |
||
| 248 | 248 | |
| 249 | 249 | public function ignoreByID(int $userID, int $chapterID, string $chapter) : bool { |
| 250 | 250 | $success = (bool) $this->db->set(['ignore_chapter' => $chapter, 'active' => 'Y', 'last_updated' => NULL]) |
| 251 | - ->where('user_id', $userID) |
|
| 252 | - ->where('id', $chapterID) |
|
| 253 | - ->update('tracker_chapters'); |
|
| 251 | + ->where('user_id', $userID) |
|
| 252 | + ->where('id', $chapterID) |
|
| 253 | + ->update('tracker_chapters'); |
|
| 254 | 254 | |
| 255 | 255 | if($success) { |
| 256 | 256 | $this->History->userIgnoreTitle($chapterID, $chapter); |
@@ -263,9 +263,9 @@ discard block |
||
| 263 | 263 | //This is to allow user history to function properly. |
| 264 | 264 | |
| 265 | 265 | $success = $this->db->set(['active' => 'N', 'last_updated' => NULL]) |
| 266 | - ->where('user_id', $userID) |
|
| 267 | - ->where('id', $chapterID) |
|
| 268 | - ->update('tracker_chapters'); |
|
| 266 | + ->where('user_id', $userID) |
|
| 267 | + ->where('id', $chapterID) |
|
| 268 | + ->update('tracker_chapters'); |
|
| 269 | 269 | |
| 270 | 270 | return (bool) $success; |
| 271 | 271 | } |
@@ -295,10 +295,10 @@ discard block |
||
| 295 | 295 | //TODO: OPTION, USE BACKEND MAL ID DB WHERE POSSIBLE (DEFAULT TRUE) |
| 296 | 296 | |
| 297 | 297 | $queryC = $this->db->select('mal_id') |
| 298 | - ->where('user_id', $userID) |
|
| 299 | - ->where('title_id', $titleID) |
|
| 300 | - ->where('mal_id IS NOT NULL', NULL, FALSE) |
|
| 301 | - ->get('tracker_chapters'); |
|
| 298 | + ->where('user_id', $userID) |
|
| 299 | + ->where('title_id', $titleID) |
|
| 300 | + ->where('mal_id IS NOT NULL', NULL, FALSE) |
|
| 301 | + ->get('tracker_chapters'); |
|
| 302 | 302 | |
| 303 | 303 | if($queryC->num_rows() > 0 && ($rowC = $queryC->row())) { |
| 304 | 304 | $malIDArr = [ |
@@ -307,8 +307,8 @@ discard block |
||
| 307 | 307 | ]; |
| 308 | 308 | } else { |
| 309 | 309 | $queryT = $this->db->select('mal_id') |
| 310 | - ->where('id', $titleID) |
|
| 311 | - ->get('tracker_titles'); |
|
| 310 | + ->where('id', $titleID) |
|
| 311 | + ->get('tracker_titles'); |
|
| 312 | 312 | |
| 313 | 313 | if($queryT->num_rows() > 0 && ($rowT = $queryT->row())) { |
| 314 | 314 | $malIDArr = [ |
@@ -341,9 +341,9 @@ discard block |
||
| 341 | 341 | public function setMalID(int $userID, int $chapterID, ?int $malID) : bool { |
| 342 | 342 | //TODO: Handle NULL? |
| 343 | 343 | $success = (bool) $this->db->set(['mal_id' => $malID, 'active' => 'Y', 'last_updated' => NULL]) |
| 344 | - ->where('user_id', $userID) |
|
| 345 | - ->where('id', $chapterID) |
|
| 346 | - ->update('tracker_chapters'); |
|
| 344 | + ->where('user_id', $userID) |
|
| 345 | + ->where('id', $chapterID) |
|
| 346 | + ->update('tracker_chapters'); |
|
| 347 | 347 | |
| 348 | 348 | if($success) { |
| 349 | 349 | //MAL id update was successful, update history |
@@ -33,13 +33,13 @@ discard block |
||
| 33 | 33 | ]; |
| 34 | 34 | } |
| 35 | 35 | if($result->num_rows() > 0) { |
| 36 | - foreach ($result->result() as $row) { |
|
| 36 | + foreach($result->result() as $row) { |
|
| 37 | 37 | $is_unread = intval((is_null($row->latest_chapter)) || ($row->latest_chapter == $row->ignore_chapter) || ($row->latest_chapter == $row->current_chapter) ? '1' : '0'); |
| 38 | 38 | $arr['series'][$row->category]['unread_count'] = (($arr['series'][$row->category]['unread_count'] ?? 0) + !$is_unread); |
| 39 | 39 | $data = [ |
| 40 | 40 | 'id' => $row->id, |
| 41 | 41 | 'generated_current_data' => $this->sites->{$row->site_class}->getChapterData($row->title_url, $row->current_chapter), |
| 42 | - 'generated_latest_data' => !is_null($row->latest_chapter) ? $this->sites->{$row->site_class}->getChapterData($row->title_url, $row->latest_chapter) : ['url' => '#', 'number' => 'No chapters found'] , |
|
| 42 | + 'generated_latest_data' => !is_null($row->latest_chapter) ? $this->sites->{$row->site_class}->getChapterData($row->title_url, $row->latest_chapter) : ['url' => '#', 'number' => 'No chapters found'], |
|
| 43 | 43 | 'generated_ignore_data' => ($row->ignore_chapter ? $this->sites->{$row->site_class}->getChapterData($row->title_url, $row->ignore_chapter) : NULL), |
| 44 | 44 | |
| 45 | 45 | 'full_title_url' => $this->sites->{$row->site_class}->getFullTitleURL($row->title_url), |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | $sortOrder = $this->User_Options->get('list_sort_order', $userID); |
| 91 | 91 | switch($this->User_Options->get('list_sort_type', $userID)) { |
| 92 | 92 | case 'unread': |
| 93 | - foreach (array_keys($arr['series']) as $category) { |
|
| 94 | - usort($arr['series'][$category]['manga'], function ($a, $b) use($sortOrder) { |
|
| 93 | + foreach(array_keys($arr['series']) as $category) { |
|
| 94 | + usort($arr['series'][$category]['manga'], function($a, $b) use($sortOrder) { |
|
| 95 | 95 | $a_text = strtolower("{$a['new_chapter_exists']} - {$a['title_data']['title']}"); |
| 96 | 96 | $b_text = strtolower("{$b['new_chapter_exists']} - {$b['title_data']['title']}"); |
| 97 | 97 | |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | break; |
| 106 | 106 | |
| 107 | 107 | case 'unread_latest': |
| 108 | - foreach (array_keys($arr['series']) as $category) { |
|
| 109 | - usort($arr['series'][$category]['manga'], function ($a, $b) use($sortOrder) { |
|
| 108 | + foreach(array_keys($arr['series']) as $category) { |
|
| 109 | + usort($arr['series'][$category]['manga'], function($a, $b) use($sortOrder) { |
|
| 110 | 110 | $a_text = $a['new_chapter_exists']; |
| 111 | 111 | $b_text = $b['new_chapter_exists']; |
| 112 | 112 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | break; |
| 128 | 128 | |
| 129 | 129 | case 'alphabetical': |
| 130 | - foreach (array_keys($arr['series']) as $category) { |
|
| 130 | + foreach(array_keys($arr['series']) as $category) { |
|
| 131 | 131 | usort($arr['series'][$category]['manga'], function($a, $b) use($sortOrder) { |
| 132 | 132 | $a_text = strtolower("{$a['title_data']['title']}"); |
| 133 | 133 | $b_text = strtolower("{$b['title_data']['title']}"); |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | break; |
| 143 | 143 | |
| 144 | 144 | case 'my_status': |
| 145 | - foreach (array_keys($arr['series']) as $category) { |
|
| 145 | + foreach(array_keys($arr['series']) as $category) { |
|
| 146 | 146 | usort($arr['series'][$category]['manga'], function($a, $b) use($sortOrder) { |
| 147 | 147 | $a_text = strtolower("{$a['generated_current_data']['number']}"); |
| 148 | 148 | $b_text = strtolower("{$b['generated_current_data']['number']}"); |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | break; |
| 158 | 158 | |
| 159 | 159 | case 'latest': |
| 160 | - foreach (array_keys($arr['series']) as $category) { |
|
| 160 | + foreach(array_keys($arr['series']) as $category) { |
|
| 161 | 161 | usort($arr['series'][$category]['manga'], function($a, $b) use($sortOrder) { |
| 162 | 162 | $a_text = new DateTime("{$a['title_data']['last_updated']}"); |
| 163 | 163 | $b_text = new DateTime("{$b['title_data']['last_updated']}"); |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php defined('BASEPATH') OR exit('No direct script access allowed'); |
|
| 1 | +<?php defined('BASEPATH') or exit('No direct script access allowed'); |
|
| 2 | 2 | |
| 3 | 3 | $active_group = 'default'; |
| 4 | 4 | $query_builder = TRUE; |