Completed
Push — master ( 8c3ec6...fb1626 )
by Angus
09:07
created
application/controllers/Import_AMR.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
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
 class Import_AMR extends User_Controller {
4 4
 	public function __construct() {
Please login to merge, or discard this patch.
application/controllers/TitleHistory.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
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
 class TitleHistory extends Auth_Controller {
4 4
 	public function __construct() {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@
 block discarded – undo
23 23
 			$this->body_data['totalPages']  = $historyData['totalPages'];
24 24
 			$this->body_data['titleID']     = (int) $titleID;
25 25
 
26
-			if($page > $this->body_data['totalPages'] && $page > 1) redirect("/history/{$titleID}/1");
26
+			if($page > $this->body_data['totalPages'] && $page > 1) {
27
+				redirect("/history/{$titleID}/1");
28
+			}
27 29
 
28 30
 			$this->_render_page("TitleHistory");
29 31
 
Please login to merge, or discard this patch.
application/models/Tracker_Model.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
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) {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
application/models/History_Model.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
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() {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
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>";
Please login to merge, or discard this patch.
application/models/Tracker/Tracker_Stats_Model.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
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() {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
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')
Please login to merge, or discard this patch.
application/models/Tracker/Tracker_Portation_Model.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
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 {
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
application/models/Tracker/Tracker_Favourites_Model.php 3 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
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() {
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -71,32 +71,32 @@
 block discarded – undo
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(
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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();
Please login to merge, or discard this patch.
application/models/Tracker/Tracker_Base_Model.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
application/models/Tracker/Tracker_Admin_Model.php 4 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
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() {
Please login to merge, or discard this patch.
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 		if($query->num_rows() > 0) {
80 80
 			$hardRateLimit  = 500; //This is to avoid any possible IP bans by cache breaking again.
81 81
 			$siteRateLimits = [];
82
-			foreach ($query->result() as $row) {
83
-				if(!array_key_exists($row->site_class,$siteRateLimits)) {
82
+			foreach($query->result() as $row) {
83
+				if(!array_key_exists($row->site_class, $siteRateLimits)) {
84 84
 					$siteRateLimits[$row->site_class] = 0;
85 85
 				}
86 86
 				$siteRateLimits[$row->site_class]++;
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		$query = $query->get();
143 143
 
144 144
 		if($query->num_rows() > 0) {
145
-			foreach ($query->result() as $row) {
145
+			foreach($query->result() as $row) {
146 146
 				$this->handleUpdate($row);
147 147
 			}
148 148
 		}
@@ -220,10 +220,10 @@  discard block
 block discarded – undo
220 220
 		                  ->get();
221 221
 
222 222
 		$sites = $query->result_array();
223
-		foreach ($sites as $site) {
223
+		foreach($sites as $site) {
224 224
 			$siteClass = $this->sites->{$site['site_class']};
225 225
 			if($titleDataList = $siteClass->doCustomUpdate()) {
226
-				foreach ($titleDataList as $titleURL => $titleData) {
226
+				foreach($titleDataList as $titleURL => $titleData) {
227 227
 					$titleURL = (string) $titleURL; //Number only keys get converted to int for some reason, so we need to fix that.
228 228
 					print "> {$titleData['title']} <{$site['site_class']}>"; //Print this prior to doing anything so we can more easily find out if something went wrong
229 229
 					if(is_array($titleData) && !is_null($titleData['latest_chapter'])) {
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 		$query = $this->db->select('tracker_titles.id, tracker_titles.title_url, tracker_sites.site_class')
267 267
 		                  ->from('tracker_titles')
268 268
 		                  ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left')
269
-		                  ->where('tracker_titles.followed','N')
269
+		                  ->where('tracker_titles.followed', 'N')
270 270
 		                  ->where('tracker_titles !=', '255')
271 271
 		                  ->where('tracker_sites.status', 'enabled')
272 272
 		                  ->where('tracker_sites.use_custom', 'Y')
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -84,7 +84,9 @@  discard block
 block discarded – undo
84 84
 					$siteRateLimits[$row->site_class] = 0;
85 85
 				}
86 86
 				$siteRateLimits[$row->site_class]++;
87
-				if($siteRateLimits[$row->site_class] > $hardRateLimit) continue;
87
+				if($siteRateLimits[$row->site_class] > $hardRateLimit) {
88
+					continue;
89
+				}
88 90
 
89 91
 				$this->handleUpdate($row);
90 92
 			}
@@ -192,8 +194,7 @@  discard block
 block discarded – undo
192 194
 						print " - Something went wrong?\n";
193 195
 					}
194 196
 				}
195
-			}
196
-			else {
197
+			} else {
197 198
 				//TODO: We should have some way to handle this in the site models.
198 199
 				if($row->site_class !== 'MangaKakarot') {
199 200
 					log_message('error', "{$row->site_class} | {$row->title} ({$row->title_url}) | Failed to update.");
Please login to merge, or discard this patch.