Completed
Push — master ( 4145fd...56b6bc )
by Angus
03:27
created
application/models/Auth_Model.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
 
73 73
 	/**
74 74
 	 * @param string $verificationCode
75
-	 * @return mixed
75
+	 * @return string
76 76
 	 */
77 77
 	public function verification_check(string $verificationCode) {
78 78
 		//user is trying to validate their email for signup, check if verification code is still valid/exists
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -77,9 +77,9 @@
 block discarded – undo
77 77
 	public function verification_check(string $verificationCode) {
78 78
 		//user is trying to validate their email for signup, check if verification code is still valid/exists
79 79
 		$query = $this->db->select('email, verification_code_time')
80
-		                  ->from('auth_signup_verification')
81
-		                  ->where(array('verification_code' => $verificationCode))
82
-		                  ->get();
80
+						  ->from('auth_signup_verification')
81
+						  ->where(array('verification_code' => $verificationCode))
82
+						  ->get();
83 83
 
84 84
 		$return = FALSE;
85 85
 		if($query->num_rows() > 0) {
Please login to merge, or discard this patch.
application/models/Tracker_Model.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -88,6 +88,9 @@
 block discarded – undo
88 88
 		return $arr;
89 89
 	}
90 90
 
91
+	/**
92
+	 * @return string
93
+	 */
91 94
 	public function getSiteDataFromURL(string $site_url) {
92 95
 		$query = $this->db->select('id, site_class')
93 96
 		                  ->from('tracker_sites')
Please login to merge, or discard this patch.
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
 
92 92
 	public function getSiteDataFromURL(string $site_url) {
93 93
 		$query = $this->db->select('id, site_class')
94
-		                  ->from('tracker_sites')
95
-		                  ->where('site', $site_url)
96
-		                  ->get();
94
+						  ->from('tracker_sites')
95
+						  ->where('site', $site_url)
96
+						  ->get();
97 97
 
98 98
 		if($query->num_rows() > 0) {
99 99
 			$siteData = $query->row();
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
 
105 105
 	public function getTitleID(string $titleURL, int $siteID) {
106 106
 		$query = $this->db->select('tracker_titles.id, tracker_titles.title, tracker_titles.title_url, tracker_titles.complete, tracker_sites.site_class, (tracker_titles.last_checked > DATE_SUB(NOW(), INTERVAL 3 DAY)) AS active', FALSE)
107
-		                  ->from('tracker_titles')
108
-		                  ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left')
109
-		                  ->where('tracker_titles.title_url', $titleURL)
110
-		                  ->where('tracker_titles.site_id', $siteID)
111
-		                  ->get();
107
+						  ->from('tracker_titles')
108
+						  ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left')
109
+						  ->where('tracker_titles.title_url', $titleURL)
110
+						  ->where('tracker_titles.site_id', $siteID)
111
+						  ->get();
112 112
 
113 113
 		if($query->num_rows() > 0) {
114 114
 			$id = (int) $query->row('id');
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 						//Make sure last_checked is always updated on successful run.
122 122
 						//CHECK: Is there a reason we aren't just doing this in updateTitleById?
123 123
 						$this->db->set('last_checked', 'CURRENT_TIMESTAMP', FALSE)
124
-						         ->where('id', $id)
125
-						         ->update('tracker_titles');
124
+								 ->where('id', $id)
125
+								 ->update('tracker_titles');
126 126
 					}
127 127
 				} else {
128 128
 					log_message('error', "{$query->row('title')} failed to update successfully");
@@ -160,14 +160,14 @@  discard block
 block discarded – undo
160 160
 			}
161 161
 
162 162
 			$idQuery = $this->db->select('id')
163
-			                    ->where('user_id', $userID)
164
-			                    ->where('title_id', $titleID)
165
-			                    ->get('tracker_chapters');
163
+								->where('user_id', $userID)
164
+								->where('title_id', $titleID)
165
+								->get('tracker_chapters');
166 166
 			if($idQuery->num_rows() > 0) {
167 167
 				$success = (bool) $this->db->set(['current_chapter' => $chapter, 'active' => 'Y', 'last_updated' => NULL])
168
-				                    ->where('user_id', $userID)
169
-				                    ->where('title_id', $titleID)
170
-				                    ->update('tracker_chapters');
168
+									->where('user_id', $userID)
169
+									->where('title_id', $titleID)
170
+									->update('tracker_chapters');
171 171
 
172 172
 				if($success) {
173 173
 					$idQueryRow = $idQuery->row();
@@ -192,9 +192,9 @@  discard block
 block discarded – undo
192 192
 
193 193
 	public function updateTrackerByID(int $userID, int $chapterID, string $chapter) : bool {
194 194
 		$success = (bool) $this->db->set(['current_chapter' => $chapter, 'active' => 'Y', 'last_updated' => NULL])
195
-		                    ->where('user_id', $userID)
196
-		                    ->where('id', $chapterID)
197
-		                    ->update('tracker_chapters');
195
+							->where('user_id', $userID)
196
+							->where('id', $chapterID)
197
+							->update('tracker_chapters');
198 198
 
199 199
 		if($success) {
200 200
 			$this->History->userUpdateTitle($chapterID, $chapter);
@@ -207,23 +207,23 @@  discard block
 block discarded – undo
207 207
 		//This is to allow user history to function properly.
208 208
 
209 209
 		$success = $this->db->set(['active' => 'N', 'last_updated' => NULL])
210
-		                    ->where('user_id', $userID)
211
-		                    ->where('id', $chapterID)
212
-		                    ->update('tracker_chapters');
210
+							->where('user_id', $userID)
211
+							->where('id', $chapterID)
212
+							->update('tracker_chapters');
213 213
 
214 214
 		return (bool) $success;
215 215
 	}
216 216
 	private function updateTitleById(int $id, string $latestChapter) {
217 217
 		//FIXME: Really not too happy with how we're doing history stuff here, it just feels messy.
218 218
 		$query = $this->db->select('latest_chapter AS current_chapter')
219
-		                  ->from('tracker_titles')
220
-		                  ->where('id', $id)
221
-		                  ->get();
219
+						  ->from('tracker_titles')
220
+						  ->where('id', $id)
221
+						  ->get();
222 222
 		$row = $query->row();
223 223
 
224 224
 		$success = $this->db->set(['latest_chapter' => $latestChapter]) //last_updated gets updated via a trigger if something changes
225
-		                    ->where('id', $id)
226
-		                    ->update('tracker_titles');
225
+							->where('id', $id)
226
+							->update('tracker_titles');
227 227
 
228 228
 		//Update History
229 229
 		//NOTE: To avoid doing another query to grab the last_updated time, we just use time() which <should> get the same thing.
@@ -234,16 +234,16 @@  discard block
 block discarded – undo
234 234
 	}
235 235
 	private function updateTitleDataById(int $id, array $titleData) {
236 236
 		$success = $this->db->set($titleData)
237
-		                    ->where('id', $id)
238
-		                    ->update('tracker_titles');
237
+							->where('id', $id)
238
+							->update('tracker_titles');
239 239
 
240 240
 		return (bool) $success;
241 241
 	}
242 242
 	private function addTitle(string $titleURL, int $siteID) {
243 243
 		$query = $this->db->select('site, site_class')
244
-		                  ->from('tracker_sites')
245
-		                  ->where('id', $siteID)
246
-		                  ->get();
244
+						  ->from('tracker_sites')
245
+						  ->where('id', $siteID)
246
+						  ->get();
247 247
 
248 248
 		$titleData = $this->sites->{$query->row()->site_class}->getTitleData($titleURL);
249 249
 		$this->db->insert('tracker_titles', array_merge($titleData, ['title_url' => $titleURL, 'site_id' => $siteID]));
@@ -294,8 +294,8 @@  discard block
 block discarded – undo
294 294
 						//Make sure last_checked is always updated on successful run.
295 295
 						//CHECK: Is there a reason we aren't just doing this in updateTitleById?
296 296
 						$this->db->set('last_checked', 'CURRENT_TIMESTAMP', FALSE)
297
-						         ->where('id', $row->id)
298
-						         ->update('tracker_titles');
297
+								 ->where('id', $row->id)
298
+								 ->update('tracker_titles');
299 299
 
300 300
 						print " - ({$titleData['latest_chapter']})\n";
301 301
 					}
@@ -412,9 +412,9 @@  discard block
 block discarded – undo
412 412
 	}
413 413
 	public function setCategoryTrackerByID(int $userID, int $chapterID, string $category) : bool {
414 414
 		$success = $this->db->set(['category' => $category, 'active' => 'Y', 'last_updated' => NULL])
415
-		                    ->where('user_id', $userID)
416
-		                    ->where('id', $chapterID)
417
-		                    ->update('tracker_chapters');
415
+							->where('user_id', $userID)
416
+							->where('id', $chapterID)
417
+							->update('tracker_chapters');
418 418
 
419 419
 		return (bool) $success;
420 420
 	}
@@ -424,9 +424,9 @@  discard block
 block discarded – undo
424 424
 		$success = FALSE;
425 425
 		if(preg_match("/^[a-z0-9-_,]{0,255}$/", $tag_string)) {
426 426
 			$success = (bool) $this->db->set(['tags' => $tag_string, 'active' => 'Y', 'last_updated' => NULL])
427
-			                           ->where('user_id', $userID)
428
-			                           ->where('id', $chapterID)
429
-			                           ->update('tracker_chapters');
427
+									   ->where('user_id', $userID)
428
+									   ->where('id', $chapterID)
429
+									   ->update('tracker_chapters');
430 430
 		}
431 431
 
432 432
 		if($success) {
@@ -464,23 +464,23 @@  discard block
 block discarded – undo
464 464
 
465 465
 			//We need the series to be tracked
466 466
 			$idCQuery = $this->db->select('id')
467
-			                    ->where('user_id', $userID)
468
-			                    ->where('title_id', $titleID)
469
-			                    ->get('tracker_chapters');
467
+								->where('user_id', $userID)
468
+								->where('title_id', $titleID)
469
+								->get('tracker_chapters');
470 470
 			if($idCQuery->num_rows() > 0) {
471 471
 				$idCQueryRow = $idCQuery->row();
472 472
 
473 473
 				//Check if it is already favourited
474 474
 				$idFQuery = $this->db->select('id')
475
-				                    ->where('chapter_id', $idCQueryRow->id)
476
-				                    ->where('chapter', $chapter)
477
-				                    ->get('tracker_favourites');
475
+									->where('chapter_id', $idCQueryRow->id)
476
+									->where('chapter', $chapter)
477
+									->get('tracker_favourites');
478 478
 				if($idFQuery->num_rows() > 0) {
479 479
 					//Chapter is already favourited, so remove it from DB
480 480
 					$idFQueryRow = $idFQuery->row();
481 481
 
482 482
 					$isSuccess = (bool) $this->db->where('id', $idFQueryRow->id)
483
-					                           ->delete('tracker_favourites');
483
+											   ->delete('tracker_favourites');
484 484
 
485 485
 					if($isSuccess) {
486 486
 						$success = array(
@@ -553,10 +553,10 @@  discard block
 block discarded – undo
553 553
 		$usedCategories = [];
554 554
 
555 555
 		$query = $this->db->distinct()
556
-		                  ->select('category')
557
-		                  ->from('tracker_chapters')
558
-		                  ->where('tracker_chapters.active', 'Y')
559
-		                  ->get();
556
+						  ->select('category')
557
+						  ->from('tracker_chapters')
558
+						  ->where('tracker_chapters.active', 'Y')
559
+						  ->get();
560 560
 
561 561
 		return array_column($query->result_array(), 'category');
562 562
 	}
@@ -568,51 +568,51 @@  discard block
 block discarded – undo
568 568
 
569 569
 		//$this->db->cache_on();
570 570
 		$queryUsers = $this->db->select([
571
-		                      'COUNT(*) AS total_users',
572
-		                      'SUM(CASE WHEN api_key IS NOT NULL THEN 1 ELSE 0 END) AS validated_users',
573
-		                      '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'
574
-		                  ], FALSE)
575
-		                  ->from('auth_users')
576
-		                  ->get();
571
+							  'COUNT(*) AS total_users',
572
+							  'SUM(CASE WHEN api_key IS NOT NULL THEN 1 ELSE 0 END) AS validated_users',
573
+							  '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'
574
+						  ], FALSE)
575
+						  ->from('auth_users')
576
+						  ->get();
577 577
 		$stats = array_merge($stats, $queryUsers->result_array()[0]);
578 578
 
579 579
 		$queryCounts = $this->db->select([
580
-		                      'tracker_titles.title',
581
-		                      'COUNT(tracker_chapters.title_id) AS count'
582
-		                  ], FALSE)
583
-		                  ->from('tracker_chapters')
584
-		                  ->join('tracker_titles', 'tracker_titles.id = tracker_chapters.title_id', 'left')
585
-		                  ->group_by('tracker_chapters.title_id')
586
-		                  ->having('count > 1')
587
-		                  ->order_by('count DESC')
588
-		                  ->get();
580
+							  'tracker_titles.title',
581
+							  'COUNT(tracker_chapters.title_id) AS count'
582
+						  ], FALSE)
583
+						  ->from('tracker_chapters')
584
+						  ->join('tracker_titles', 'tracker_titles.id = tracker_chapters.title_id', 'left')
585
+						  ->group_by('tracker_chapters.title_id')
586
+						  ->having('count > 1')
587
+						  ->order_by('count DESC')
588
+						  ->get();
589 589
 		$stats['titles_tracked_more'] = count($queryCounts->result_array());
590 590
 		$stats['top_title_name']  = $queryCounts->result_array()[0]['title'] ?? 'N/A';
591 591
 		$stats['top_title_count'] = $queryCounts->result_array()[0]['count'] ?? 'N/A';
592 592
 
593 593
 		$queryTitles = $this->db->select([
594
-		                      'COUNT(DISTINCT tracker_titles.id) AS total_titles',
595
-		                      'COUNT(DISTINCT tracker_titles.site_id) AS total_sites',
596
-		                      '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',
597
-		                      'SUM(CASE WHEN (tracker_titles.last_updated > DATE_SUB(NOW(), INTERVAL 24 HOUR)) THEN 1 ELSE 0 END) AS updated_titles'
598
-		                  ], FALSE)
599
-		                  ->from('tracker_titles')
600
-		                  ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left')
601
-		                  ->join('tracker_chapters', 'tracker_titles.id = tracker_chapters.title_id', 'left')
602
-		                  ->join('auth_users', 'tracker_chapters.user_id = auth_users.id', 'left')
603
-		                  ->get();
594
+							  'COUNT(DISTINCT tracker_titles.id) AS total_titles',
595
+							  'COUNT(DISTINCT tracker_titles.site_id) AS total_sites',
596
+							  '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',
597
+							  'SUM(CASE WHEN (tracker_titles.last_updated > DATE_SUB(NOW(), INTERVAL 24 HOUR)) THEN 1 ELSE 0 END) AS updated_titles'
598
+						  ], FALSE)
599
+						  ->from('tracker_titles')
600
+						  ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left')
601
+						  ->join('tracker_chapters', 'tracker_titles.id = tracker_chapters.title_id', 'left')
602
+						  ->join('auth_users', 'tracker_chapters.user_id = auth_users.id', 'left')
603
+						  ->get();
604 604
 		$stats = array_merge($stats, $queryTitles->result_array()[0]);
605 605
 
606 606
 		$querySites = $this->db->select([
607
-		                      'tracker_sites.site',
608
-		                      'COUNT(*) AS count'
609
-		                  ], FALSE)
610
-		                  ->from('tracker_titles')
611
-		                  ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left')
612
-		                  ->group_by('tracker_titles.site_id')
613
-		                  ->order_by('count DESC')
614
-		                  ->limit(3)
615
-		                  ->get();
607
+							  'tracker_sites.site',
608
+							  'COUNT(*) AS count'
609
+						  ], FALSE)
610
+						  ->from('tracker_titles')
611
+						  ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left')
612
+						  ->group_by('tracker_titles.site_id')
613
+						  ->order_by('count DESC')
614
+						  ->limit(3)
615
+						  ->get();
616 616
 		$querySitesResult = $querySites->result_array();
617 617
 		$stats['rank1_site']       = $querySitesResult[0]['site'];
618 618
 		$stats['rank1_site_count'] = $querySitesResult[0]['count'];
@@ -622,17 +622,17 @@  discard block
 block discarded – undo
622 622
 		$stats['rank3_site_count'] = $querySitesResult[2]['count'];
623 623
 
624 624
 		$queryTitlesU = $this->db->select([
625
-		                      'COUNT(*) AS title_updated_count'
626
-		                  ], FALSE)
627
-		                  ->from('tracker_titles_history')
628
-		                  ->get();
625
+							  'COUNT(*) AS title_updated_count'
626
+						  ], FALSE)
627
+						  ->from('tracker_titles_history')
628
+						  ->get();
629 629
 		$stats = array_merge($stats, $queryTitlesU->result_array()[0]);
630 630
 
631 631
 		$queryUsersU = $this->db->select([
632
-		                      'COUNT(*) AS user_updated_count'
633
-		                  ], FALSE)
634
-		                  ->from('tracker_user_history')
635
-		                  ->get();
632
+							  'COUNT(*) AS user_updated_count'
633
+						  ], FALSE)
634
+						  ->from('tracker_user_history')
635
+						  ->get();
636 636
 		$stats = array_merge($stats, $queryUsersU->result_array()[0]);
637 637
 
638 638
 		$stats['live_time'] = timespan(/*2016-09-10T03:17:19*/ 1473477439, time(), 2);
Please login to merge, or discard this patch.
application/tests/libraries/MY_Form_validation_test.php 1 patch
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -144,6 +144,10 @@
 block discarded – undo
144 144
 	}
145 145
 
146 146
 	//utility functions
147
+
148
+	/**
149
+	 * @param string $field
150
+	 */
147 151
 	function get_error_message(/*str*/$field, /*obj*/ $customObj = FALSE) {
148 152
 		$obj = $customObj ?: $this->form_validation;
149 153
 		$error_messages = ReflectionHelper::getPrivateProperty(
Please login to merge, or discard this patch.
public/index.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -210,10 +210,10 @@
 block discarded – undo
210 210
 {
211 211
 	// Ensure there's a trailing slash
212 212
 	$system_path = strtr(
213
-		               rtrim($system_path, '/\\'),
214
-		               '/\\',
215
-		               DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
216
-	               ).DIRECTORY_SEPARATOR;
213
+					   rtrim($system_path, '/\\'),
214
+					   '/\\',
215
+					   DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
216
+				   ).DIRECTORY_SEPARATOR;
217 217
 }
218 218
 
219 219
 // Is the system path correct?
Please login to merge, or discard this patch.
application/tests/TestCase.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -29,27 +29,27 @@  discard block
 block discarded – undo
29 29
 
30 30
 	public function getMock_ion_auth_logged_in() {
31 31
 		$ion_auth = $this->getMockBuilder('Ion_auth')
32
-		                 ->disableOriginalConstructor()
33
-		                 ->getMock();
32
+						 ->disableOriginalConstructor()
33
+						 ->getMock();
34 34
 
35 35
 		$ion_auth->expects($this->at(0))
36
-		         ->method('logged_in')
37
-		         ->willReturn(TRUE);
36
+				 ->method('logged_in')
37
+				 ->willReturn(TRUE);
38 38
 		$ion_auth->expects($this->at(1))
39
-		         ->method('logged_in')
40
-		         ->willReturn(TRUE);
39
+				 ->method('logged_in')
40
+				 ->willReturn(TRUE);
41 41
 
42 42
 		$ion_auth->expects($this->any())
43
-		         ->method($this->anything())
44
-		         ->will($this->returnSelf());
43
+				 ->method($this->anything())
44
+				 ->will($this->returnSelf());
45 45
 		
46 46
 		return $ion_auth;
47 47
 	}
48 48
 
49 49
 	public function getMock_CI_DB_result(array $methods) {
50 50
 		$db_result = $this->getMockBuilder('CI_DB_result')
51
-		                  ->disableOriginalConstructor()
52
-		                  ->getMock();
51
+						  ->disableOriginalConstructor()
52
+						  ->getMock();
53 53
 
54 54
 		foreach ($methods as $method => $return) {
55 55
 			$db_result->method($method)->willReturn($return);
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
 
60 60
 	public function getMock_CI_DB($return) {
61 61
 		$db = $this->getMockBuilder('CI_DB')
62
-		           ->disableOriginalConstructor()
63
-		           ->setMethods(array('select', 'from', 'where', 'get'))
64
-		           ->getMock();
62
+				   ->disableOriginalConstructor()
63
+				   ->setMethods(array('select', 'from', 'where', 'get'))
64
+				   ->getMock();
65 65
 
66 66
 		$db->expects($this->at(3))
67 67
 		   ->method('get')
Please login to merge, or discard this patch.
application/tests/models/User_Model_test.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@
 block discarded – undo
30 30
 		$User_Model = $this->User_Model;
31 31
 
32 32
 		$ion_auth = $this->getMockBuilder('ion_auth')
33
-		                 ->disableOriginalConstructor()
34
-		                 ->getMock();
33
+						 ->disableOriginalConstructor()
34
+						 ->getMock();
35 35
 		$ion_auth->method('logged_in')->willReturn(FALSE);
36 36
 
37 37
 		$User_Model->ion_auth = $ion_auth;
Please login to merge, or discard this patch.
application/models/User_Options_Model.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -138,10 +138,10 @@
 block discarded – undo
138 138
 	private function get_db(string $option, int $userID) {
139 139
 		//This function assumes we've already done some basic validation.
140 140
 		$query = $this->db->select('value_str, value_int')
141
-		                  ->from('user_options')
142
-		                  ->where('user_id', $userID)
143
-		                  ->where('name',    $option)
144
-		                  ->limit(1);
141
+						  ->from('user_options')
142
+						  ->where('user_id', $userID)
143
+						  ->where('name',    $option)
144
+						  ->limit(1);
145 145
 		return $query->get()->row_array();
146 146
 	}
147 147
 	private function set_db(string $option, $value) : bool {}
Please login to merge, or discard this patch.
Doc Comments   +8 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,11 +73,15 @@  discard block
 block discarded – undo
73 73
 	/**
74 74
 	 * Get user option, or default option if it does not exist.
75 75
 	 * @param string $option
76
-	 * @return mixed Returns option value as STRING, or FALSE if option does not exist.
76
+	 * @return string Returns option value as STRING, or FALSE if option does not exist.
77 77
 	 */
78 78
 	public function get(string $option) {
79 79
 		return $this->get_by_userid($option, (int) $this->User->id);
80 80
 	}
81
+
82
+	/**
83
+	 * @return string
84
+	 */
81 85
 	public function get_by_userid(string $option, int $userID) {
82 86
 		//Check if option is valid
83 87
 		if(array_key_exists($option, $this->options)) {
@@ -135,6 +139,9 @@  discard block
 block discarded – undo
135 139
 		return $success;
136 140
 	}
137 141
 
142
+	/**
143
+	 * @return string
144
+	 */
138 145
 	private function get_db(string $option, int $userID) {
139 146
 		//This function assumes we've already done some basic validation.
140 147
 		$query = $this->db->select('value_str, value_int')
Please login to merge, or discard this patch.
application/models/Site_Model.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -228,8 +228,8 @@
 block discarded – undo
228 228
 		//Bato.to is annoying and locks stuff behind auth. See: https://github.com/DakuTree/manga-tracker/issues/14#issuecomment-233830855
229 229
 		$cookies = [
230 230
 			"lang_option={$title_lang}",
231
-		    "member_id=" . $this->config->item('batoto_cookie_member_id'),
232
-		    "pass_hash=" . $this->config->item('batoto_cookie_pass_hash')
231
+			"member_id=" . $this->config->item('batoto_cookie_member_id'),
232
+			"pass_hash=" . $this->config->item('batoto_cookie_pass_hash')
233 233
 		];
234 234
 		$data = $this->get_content($title_url, implode("; ", $cookies));
235 235
 		if(!$data) {
Please login to merge, or discard this patch.
application/models/User_Model.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 		$this->load->database();
41 41
 
42 42
 		$query = $this->db->select('*')
43
-		                  ->from('auth_users')
44
-		                  ->where('username', $username)
45
-		                  ->get();
43
+						  ->from('auth_users')
44
+						  ->where('username', $username)
45
+						  ->get();
46 46
 
47 47
 		return (bool) $query->num_rows();
48 48
 	}
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 			$this->load->database();
65 65
 
66 66
 			$query = $this->db->select('email')
67
-			                  ->from('auth_users')
68
-			                  ->where('username', $identity)
69
-			                  ->get();
67
+							  ->from('auth_users')
68
+							  ->where('username', $identity)
69
+							  ->get();
70 70
 
71 71
 			if($query->num_rows() > 0) {
72 72
 				//username exists, grab email
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 		$user = NULL;
85 85
 
86 86
 		$query = $this->db->select('*')
87
-		                  ->from('auth_users')
88
-		                  ->where('username', $username)
89
-		                  ->get();
87
+						  ->from('auth_users')
88
+						  ->where('username', $username)
89
+						  ->get();
90 90
 
91 91
 		if($query->num_rows() > 0) {
92 92
 			$user = $query->row();
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
 	
115 115
 	public function get_id_from_api_key(string $api_key) {
116 116
 		$query = $this->db->select('id')
117
-		                  ->from('auth_users')
118
-		                  ->where('api_key', $api_key)
119
-		                  ->get();
117
+						  ->from('auth_users')
118
+						  ->where('api_key', $api_key)
119
+						  ->get();
120 120
 
121 121
 		if($query->num_rows() > 0) {
122 122
 			$userID = $query->row('id');
Please login to merge, or discard this patch.