Completed
Push — master ( 631a79...21674a )
by Angus
02:45
created
application/models/Tracker/Tracker_Tag_Model.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@
 block discarded – undo
9 9
 		$success = FALSE;
10 10
 		if(preg_match("/^[a-z0-9\\-_,:]{0,255}$/", $tag_string)) {
11 11
 			$success = (bool) $this->db->set(['tags' => $tag_string, 'active' => 'Y', 'last_updated' => NULL])
12
-			                           ->where('user_id', $userID)
13
-			                           ->where('id', $chapterID)
14
-			                           ->update('tracker_chapters');
12
+									   ->where('user_id', $userID)
13
+									   ->where('id', $chapterID)
14
+									   ->update('tracker_chapters');
15 15
 		}
16 16
 
17 17
 		if($success) {
Please login to merge, or discard this patch.
Spacing   +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_Tag_Model extends Tracker_Base_Model {
4 4
 	public function __construct() {
Please login to merge, or discard this patch.
application/migrations/025_tracker_add_mal_id.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 	}
24 24
 
25 25
 	public function down() {
26
-		$this->dbforge->drop_column('tracker_titles',   'mal_id');
26
+		$this->dbforge->drop_column('tracker_titles', 'mal_id');
27 27
 		$this->dbforge->drop_column('tracker_chapters', 'mal_id');
28 28
 
29 29
 	}
Please login to merge, or discard this 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 Migration_Tracker_Add_MAL_id extends CI_Migration {
4 4
 	public function __construct() {
Please login to merge, or discard this patch.
application/models/Tracker/Tracker_List_Model.php 3 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -171,14 +171,14 @@  discard block
 block discarded – undo
171 171
 			}
172 172
 
173 173
 			$idQuery = $this->db->select('id')
174
-			                    ->where('user_id', $userID)
175
-			                    ->where('title_id', $titleID)
176
-			                    ->get('tracker_chapters');
174
+								->where('user_id', $userID)
175
+								->where('title_id', $titleID)
176
+								->get('tracker_chapters');
177 177
 			if($idQuery->num_rows() > 0) {
178 178
 				$success = (bool) $this->db->set(['current_chapter' => $chapter, 'active' => 'Y', 'last_updated' => NULL, 'ignore_chapter' => NULL])
179
-				                           ->where('user_id', $userID)
180
-				                           ->where('title_id', $titleID)
181
-				                           ->update('tracker_chapters');
179
+										   ->where('user_id', $userID)
180
+										   ->where('title_id', $titleID)
181
+										   ->update('tracker_chapters');
182 182
 
183 183
 				if($success) {
184 184
 					$idQueryRow = $idQuery->row();
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
 	}
205 205
 	public function updateByID(int $userID, int $chapterID, string $chapter) : bool {
206 206
 		$success = (bool) $this->db->set(['current_chapter' => $chapter, 'active' => 'Y', 'last_updated' => NULL])
207
-		                           ->where('user_id', $userID)
208
-		                           ->where('id', $chapterID)
209
-		                           ->update('tracker_chapters');
207
+								   ->where('user_id', $userID)
208
+								   ->where('id', $chapterID)
209
+								   ->update('tracker_chapters');
210 210
 
211 211
 		if($success) {
212 212
 			$this->History->userUpdateTitle($chapterID, $chapter);
@@ -216,9 +216,9 @@  discard block
 block discarded – undo
216 216
 
217 217
 	public function ignoreByID(int $userID, int $chapterID, string $chapter) : bool {
218 218
 		$success = (bool) $this->db->set(['ignore_chapter' => $chapter, 'active' => 'Y', 'last_updated' => NULL])
219
-		                           ->where('user_id', $userID)
220
-		                           ->where('id', $chapterID)
221
-		                           ->update('tracker_chapters');
219
+								   ->where('user_id', $userID)
220
+								   ->where('id', $chapterID)
221
+								   ->update('tracker_chapters');
222 222
 
223 223
 		if($success) {
224 224
 			$this->History->userIgnoreTitle($chapterID, $chapter);
@@ -231,9 +231,9 @@  discard block
 block discarded – undo
231 231
 		//This is to allow user history to function properly.
232 232
 
233 233
 		$success = $this->db->set(['active' => 'N', 'last_updated' => NULL])
234
-		                    ->where('user_id', $userID)
235
-		                    ->where('id', $chapterID)
236
-		                    ->update('tracker_chapters');
234
+							->where('user_id', $userID)
235
+							->where('id', $chapterID)
236
+							->update('tracker_chapters');
237 237
 
238 238
 		return (bool) $success;
239 239
 	}
@@ -263,9 +263,9 @@  discard block
 block discarded – undo
263 263
 		//TODO: OPTION, USE BACKEND MAL ID DB WHERE POSSIBLE (DEFAULT TRUE)
264 264
 
265 265
 		$queryC = $this->db->select('mal_id')
266
-		                   ->where('user_id', $userID)
267
-		                   ->where('title_id', $titleID)
268
-		                   ->get('tracker_chapters');
266
+						   ->where('user_id', $userID)
267
+						   ->where('title_id', $titleID)
268
+						   ->get('tracker_chapters');
269 269
 
270 270
 		if($queryC->num_rows() > 0 && ($rowC = $queryC->row())) {
271 271
 			$malIDArr = [
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
 			];
275 275
 		} else {
276 276
 			$queryT = $this->db->select('mal_id')
277
-			                   ->where('title_id', $titleID)
278
-			                   ->get('tracker_titles');
277
+							   ->where('title_id', $titleID)
278
+							   ->get('tracker_titles');
279 279
 
280 280
 			if($queryT->num_rows() > 0 && ($rowT = $queryT->row())) {
281 281
 				$malIDArr = [
@@ -289,9 +289,9 @@  discard block
 block discarded – undo
289 289
 		//TODO: Remove after a few weeks!
290 290
 		if(is_null($malIDArr)) {
291 291
 			$queryC2 = $this->db->select('tags')
292
-			                  ->where('user_id', $userID)
293
-			                  ->where('title_id', $titleID)
294
-			                  ->get('tracker_chapters');
292
+							  ->where('user_id', $userID)
293
+							  ->where('title_id', $titleID)
294
+							  ->get('tracker_chapters');
295 295
 
296 296
 			if($queryC2->num_rows() > 0 && ($tag_string = $queryC2->row()->tags) && !is_null($tag_string)) {
297 297
 				$arr   = preg_grep('/^mal:([0-9]+|none)$/', explode(',', $tag_string));
@@ -309,9 +309,9 @@  discard block
 block discarded – undo
309 309
 	public function setMalID(int $userID, int $chapterID, ?int $malID) : bool {
310 310
 		//TODO: Handle NULL?
311 311
 		$success = (bool) $this->db->set(['mal_id' => $malID, 'active' => 'Y', 'last_updated' => NULL])
312
-		                           ->where('user_id', $userID)
313
-		                           ->where('id', $chapterID)
314
-		                           ->update('tracker_chapters');
312
+								   ->where('user_id', $userID)
313
+								   ->where('id', $chapterID)
314
+								   ->update('tracker_chapters');
315 315
 
316 316
 		if($success) {
317 317
 			//MAL id update was successful, update history
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 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_List_Model extends Tracker_Base_Model {
4 4
 	public function __construct() {
5 5
 		parent::__construct();
6 6
 	}
7 7
 
8
-	public function get(?int $userID = NULL) {
8
+	public function get(? int $userID = NULL) {
9 9
 		$userID = (is_null($userID) ? (int) $this->User->id : $userID);
10 10
 
11 11
 		$query = $this->db
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 			];
30 30
 		}
31 31
 		if($query->num_rows() > 0) {
32
-			foreach ($query->result() as $row) {
32
+			foreach($query->result() as $row) {
33 33
 				$is_unread = intval(($row->latest_chapter == $row->ignore_chapter) || ($row->latest_chapter == $row->current_chapter) ? '1' : '0');
34 34
 				$arr['series'][$row->category]['unread_count'] = (($arr['series'][$row->category]['unread_count'] ?? 0) + !$is_unread);
35 35
 				$data = [
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 			$sortOrder = $this->User_Options->get('list_sort_order', $userID);
80 80
 			switch($this->User_Options->get('list_sort_type', $userID)) {
81 81
 				case 'unread':
82
-					foreach (array_keys($arr['series']) as $category) {
83
-						usort($arr['series'][$category]['manga'], function ($a, $b) use($sortOrder) {
82
+					foreach(array_keys($arr['series']) as $category) {
83
+						usort($arr['series'][$category]['manga'], function($a, $b) use($sortOrder) {
84 84
 							$a_text = strtolower("{$a['new_chapter_exists']} - {$a['title_data']['title']}");
85 85
 							$b_text = strtolower("{$b['new_chapter_exists']} - {$b['title_data']['title']}");
86 86
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 					break;
95 95
 
96 96
 				case 'alphabetical':
97
-					foreach (array_keys($arr['series']) as $category) {
97
+					foreach(array_keys($arr['series']) as $category) {
98 98
 						usort($arr['series'][$category]['manga'], function($a, $b) use($sortOrder) {
99 99
 							$a_text = strtolower("{$a['title_data']['title']}");
100 100
 							$b_text = strtolower("{$b['title_data']['title']}");
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 					break;
110 110
 
111 111
 				case 'my_status':
112
-					foreach (array_keys($arr['series']) as $category) {
112
+					foreach(array_keys($arr['series']) as $category) {
113 113
 						usort($arr['series'][$category]['manga'], function($a, $b) use($sortOrder) {
114 114
 							$a_text = strtolower("{$a['generated_current_data']['number']}");
115 115
 							$b_text = strtolower("{$b['generated_current_data']['number']}");
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 					break;
125 125
 
126 126
 				case 'latest':
127
-					foreach (array_keys($arr['series']) as $category) {
127
+					foreach(array_keys($arr['series']) as $category) {
128 128
 						usort($arr['series'][$category]['manga'], function($a, $b) use($sortOrder) {
129 129
 							$a_text = strtolower("{$a['generated_latest_data']['number']}");
130 130
 							$b_text = strtolower("{$b['generated_latest_data']['number']}");
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 		return $status;
257 257
 	}
258 258
 
259
-	public function getMalID(int $userID, int $titleID) : ?array{
259
+	public function getMalID(int $userID, int $titleID) : ? array{
260 260
 		$malIDArr = NULL;
261 261
 
262 262
 		//NEW METHOD
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 			                  ->get('tracker_chapters');
295 295
 
296 296
 			if($queryC2->num_rows() > 0 && ($tag_string = $queryC2->row()->tags) && !is_null($tag_string)) {
297
-				$arr   = preg_grep('/^mal:([0-9]+|none)$/', explode(',', $tag_string));
297
+				$arr = preg_grep('/^mal:([0-9]+|none)$/', explode(',', $tag_string));
298 298
 				if(!empty($arr)) {
299 299
 					$malIDArr = [
300 300
 						'id'   => explode(':', $arr[0])[1],
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 
307 307
 		return $malIDArr;
308 308
 	}
309
-	public function setMalID(int $userID, int $chapterID, ?int $malID) : bool {
309
+	public function setMalID(int $userID, int $chapterID, ? int $malID) : bool {
310 310
 		//TODO: Handle NULL?
311 311
 		$success = (bool) $this->db->set(['mal_id' => $malID, 'active' => 'Y', 'last_updated' => NULL])
312 312
 		                           ->where('user_id', $userID)
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,9 @@
 block discarded – undo
70 70
 
71 71
 				$arr['series'][$row->category]['manga'][] = $data;
72 72
 
73
-				if(!$arr['has_inactive']) $arr['has_inactive'] = !$data['title_data']['active'];
73
+				if(!$arr['has_inactive']) {
74
+					$arr['has_inactive'] = !$data['title_data']['active'];
75
+				}
74 76
 			}
75 77
 
76 78
 			//FIXME: This is not good for speed, but we're kind of required to do this for UX purposes.
Please login to merge, or discard this patch.
application/models/History_Model.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 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() {
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 			foreach($query->result() as $row) {
47 47
 				$arrRow = [];
48 48
 
49
-				$arrRow['updated_at']  = $row->updated_at;
49
+				$arrRow['updated_at'] = $row->updated_at;
50 50
 
51 51
 				$newChapterData = $this->Tracker->sites->{$row->site_class}->getChapterData($row->title_url, $row->new_chapter);
52 52
 				$arrRow['new_chapter']      = "<a href=\"{$newChapterData['url']}\">{$newChapterData['number']}</a>";
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
 		return $success;
170 170
 	}
171
-	public function userSetMalID(int $chapterID, ?int $malID) : bool {
171
+	public function userSetMalID(int $chapterID, ? int $malID) : bool {
172 172
 		$success = $this->db->insert('tracker_user_history', [
173 173
 			'chapter_id'  => $chapterID,
174 174
 
Please login to merge, or discard this patch.
application/controllers/Ajax/TrackerInline.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 	 * URL:        /ajax/update_inline
27 27
 	 */
28 28
 	public function update() {
29
-		$this->form_validation->set_rules('id',      'Chapter ID', 'required|ctype_digit');
30
-		$this->form_validation->set_rules('chapter', 'Chapter',    'required');
29
+		$this->form_validation->set_rules('id', 'Chapter ID', 'required|ctype_digit');
30
+		$this->form_validation->set_rules('chapter', 'Chapter', 'required');
31 31
 
32 32
 		if($this->form_validation->run() === TRUE) {
33 33
 			$success = $this->Tracker->list->updateByID($this->userID, $this->input->post('id'), $this->input->post('chapter'));
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 * URL:        /tag_update
123 123
 	 */
124 124
 	public function tag_update() {
125
-		$this->form_validation->set_rules('id',         'Chapter ID', 'required|ctype_digit');
125
+		$this->form_validation->set_rules('id', 'Chapter ID', 'required|ctype_digit');
126 126
 		$this->form_validation->set_rules('tag_string', 'Tag String', 'max_length[255]|is_valid_tag_string|not_equals[none]');
127 127
 
128 128
 		if($this->form_validation->run() === TRUE) {
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 * URL:        /set_category
164 164
 	 */
165 165
 	public function set_category() {
166
-		$this->form_validation->set_rules('id[]',     'List of IDs',   'required|ctype_digit');
166
+		$this->form_validation->set_rules('id[]', 'List of IDs', 'required|ctype_digit');
167 167
 		$this->form_validation->set_rules('category', 'Category Name', 'required|is_valid_category');
168 168
 
169 169
 		if($this->form_validation->run() === TRUE) {
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
 	 * URL:        /ajax/ignore_inline
210 210
 	 */
211 211
 	public function ignore() {
212
-		$this->form_validation->set_rules('id',      'Chapter ID', 'required|ctype_digit');
213
-		$this->form_validation->set_rules('chapter', 'Chapter',    'required');
212
+		$this->form_validation->set_rules('id', 'Chapter ID', 'required|ctype_digit');
213
+		$this->form_validation->set_rules('chapter', 'Chapter', 'required');
214 214
 
215 215
 		if($this->form_validation->run() === TRUE) {
216 216
 			$success = $this->Tracker->list->ignoreByID($this->userID, $this->input->post('id'), $this->input->post('chapter'));
@@ -232,8 +232,8 @@  discard block
 block discarded – undo
232 232
 	 * URL:        /set_mal_id
233 233
 	 */
234 234
 	public function set_mal_id() {
235
-		$this->form_validation->set_rules('id',     'Chapter ID', 'required|ctype_digit');
236
-		$this->form_validation->set_rules('mal_id', 'MAL ID',     'regex_match[/^[0-9]*$/]');
235
+		$this->form_validation->set_rules('id', 'Chapter ID', 'required|ctype_digit');
236
+		$this->form_validation->set_rules('mal_id', 'MAL ID', 'regex_match[/^[0-9]*$/]');
237 237
 
238 238
 		if($this->form_validation->run() === TRUE) {
239 239
 			$malID = (is_numeric($this->input->post('mal_id')) ? $this->input->post('mal_id') : NULL);
Please login to merge, or discard this patch.
application/controllers/AdminPanel.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
 
45 45
 	private function _list_complete_titles() {
46 46
 		$query = $this->db->select('tracker_titles.id, tracker_sites.site_class, tracker_titles.title, tracker_titles.title_url')
47
-		                  ->from('tracker_chapters')
48
-		                  ->join('tracker_titles', 'tracker_chapters.title_id = tracker_titles.id', 'left')
49
-		                  ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left')
50
-		                  ->like('tracker_chapters.tags', 'complete')
51
-		                  ->where('tracker_titles.status', 0)
52
-		                  ->get();
47
+						  ->from('tracker_chapters')
48
+						  ->join('tracker_titles', 'tracker_chapters.title_id = tracker_titles.id', 'left')
49
+						  ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left')
50
+						  ->like('tracker_chapters.tags', 'complete')
51
+						  ->where('tracker_titles.status', 0)
52
+						  ->get();
53 53
 
54 54
 		$completeList = [];
55 55
 		if($query->num_rows() > 0) {
@@ -68,10 +68,10 @@  discard block
 block discarded – undo
68 68
 
69 69
 	private function _update_mal_id() : void {
70 70
 		$query = $this->db->select('id, tags')
71
-		                  ->from('tracker_chapters')
72
-		                  ->where('tags REGEXP "[[:<:]]mal:([0-9]+|none)[[:>:]]"', NULL, FALSE)
73
-		                  ->where('mal_id', NULL)
74
-		                  ->get();
71
+						  ->from('tracker_chapters')
72
+						  ->where('tags REGEXP "[[:<:]]mal:([0-9]+|none)[[:>:]]"', NULL, FALSE)
73
+						  ->where('mal_id', NULL)
74
+						  ->get();
75 75
 
76 76
 
77 77
 		if($query->num_rows() > 0) {
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 					$malID = ($matches[1] !== 'none' ? $matches[1] : '0');
83 83
 
84 84
 					$this->db->set(['mal_id' => $malID, 'last_updated' => NULL])
85
-					         ->where('id', $row->id)
86
-					         ->update('tracker_chapters');
85
+							 ->where('id', $row->id)
86
+							 ->update('tracker_chapters');
87 87
 				}
88 88
 			}
89 89
 		}
Please login to merge, or discard this patch.