@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | $this->load->database(); |
46 | 46 | |
47 | 47 | $query = $this->db->select('*') |
48 | - ->from('auth_users') |
|
49 | - ->where('username', $username) |
|
50 | - ->get(); |
|
48 | + ->from('auth_users') |
|
49 | + ->where('username', $username) |
|
50 | + ->get(); |
|
51 | 51 | |
52 | 52 | return (bool) $query->num_rows(); |
53 | 53 | } |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | $this->load->database(); |
70 | 70 | |
71 | 71 | $query = $this->db->select('email') |
72 | - ->from('auth_users') |
|
73 | - ->where('username', $identity) |
|
74 | - ->get(); |
|
72 | + ->from('auth_users') |
|
73 | + ->where('username', $identity) |
|
74 | + ->get(); |
|
75 | 75 | |
76 | 76 | if($query->num_rows() > 0) { |
77 | 77 | //username exists, grab email |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | $user = NULL; |
90 | 90 | |
91 | 91 | $query = $this->db->select('*') |
92 | - ->from('auth_users') |
|
93 | - ->where('username', $username) |
|
94 | - ->get(); |
|
92 | + ->from('auth_users') |
|
93 | + ->where('username', $username) |
|
94 | + ->get(); |
|
95 | 95 | |
96 | 96 | if($query->num_rows() > 0) { |
97 | 97 | $user = $query->row(); |
@@ -120,12 +120,12 @@ discard block |
||
120 | 120 | $api_key = NULL; |
121 | 121 | if($this->logged_in()) { |
122 | 122 | $this->db->select('api_key') |
123 | - ->where('id', $this->User->id) |
|
124 | - ->get('auth_users'); |
|
123 | + ->where('id', $this->User->id) |
|
124 | + ->get('auth_users'); |
|
125 | 125 | |
126 | 126 | $query = $this->db->select('api_key') |
127 | - ->where('id', $this->User->id) |
|
128 | - ->get('auth_users'); |
|
127 | + ->where('id', $this->User->id) |
|
128 | + ->get('auth_users'); |
|
129 | 129 | |
130 | 130 | if($query->num_rows() > 0) { |
131 | 131 | $api_key = $query->row('api_key'); |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | |
138 | 138 | public function get_id_from_api_key(string $api_key) { |
139 | 139 | $query = $this->db->select('id') |
140 | - ->from('auth_users') |
|
141 | - ->where('api_key', $api_key) |
|
142 | - ->get(); |
|
140 | + ->from('auth_users') |
|
141 | + ->where('api_key', $api_key) |
|
142 | + ->get(); |
|
143 | 143 | |
144 | 144 | if($query->num_rows() > 0) { |
145 | 145 | $userID = $query->row('id'); |
@@ -201,12 +201,12 @@ discard block |
||
201 | 201 | } |
202 | 202 | public function hideLatestNotice() { |
203 | 203 | $idQuery = $this->db->select('1') |
204 | - ->where('user_id', $this->User->id) |
|
205 | - ->get('tracker_user_notices'); |
|
204 | + ->where('user_id', $this->User->id) |
|
205 | + ->get('tracker_user_notices'); |
|
206 | 206 | if($idQuery->num_rows() > 0) { |
207 | 207 | $success = (bool) $this->db->set('hidden_notice_id', '(SELECT id FROM tracker_notices ORDER BY id DESC LIMIT 1)', FALSE) |
208 | - ->where('user_id', $this->User->id) |
|
209 | - ->update('tracker_user_notices'); |
|
208 | + ->where('user_id', $this->User->id) |
|
209 | + ->update('tracker_user_notices'); |
|
210 | 210 | } else { |
211 | 211 | $success = (bool) $this->db->insert('tracker_user_notices', [ |
212 | 212 | 'user_id' => $this->User->id, |
@@ -11,9 +11,9 @@ |
||
11 | 11 | |
12 | 12 | //This is pretty barebones issue reporting, and honestly not a great way to do it, but it works for now (until the Github is public). |
13 | 13 | $body = "". |
14 | - (!is_null($url) && !empty($url) ? "URL: ".htmlspecialchars(substr($url, 0, 255))."<br>\n" : ""). |
|
15 | - "Submitted by: ".$this->input->ip_address().(!is_null($userID) ? "| {$userID}" : "")."<br>\n". |
|
16 | - "<br>Bug report: ".htmlspecialchars(substr($text, 0, 1000)); |
|
14 | + (!is_null($url) && !empty($url) ? "URL: ".htmlspecialchars(substr($url, 0, 255))."<br>\n" : ""). |
|
15 | + "Submitted by: ".$this->input->ip_address().(!is_null($userID) ? "| {$userID}" : "")."<br>\n". |
|
16 | + "<br>Bug report: ".htmlspecialchars(substr($text, 0, 1000)); |
|
17 | 17 | |
18 | 18 | $success = TRUE; |
19 | 19 | $this->email->from('[email protected]', $this->config->item('site_title', 'ion_auth')); |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | */ |
16 | 16 | public function getID(string $titleURL, int $siteID, bool $create = TRUE, bool $returnData = FALSE) { |
17 | 17 | $query = $this->db->select('tracker_titles.id, tracker_titles.title, tracker_titles.title_url, tracker_titles.latest_chapter, tracker_titles.status, tracker_sites.site_class, (tracker_titles.last_checked > DATE_SUB(NOW(), INTERVAL 3 DAY)) AS active', FALSE) |
18 | - ->from('tracker_titles') |
|
19 | - ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left') |
|
20 | - ->where('tracker_titles.title_url', $titleURL) |
|
21 | - ->where('tracker_titles.site_id', $siteID) |
|
22 | - ->get(); |
|
18 | + ->from('tracker_titles') |
|
19 | + ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left') |
|
20 | + ->where('tracker_titles.title_url', $titleURL) |
|
21 | + ->where('tracker_titles.site_id', $siteID) |
|
22 | + ->get(); |
|
23 | 23 | |
24 | 24 | if($query->num_rows() > 0) { |
25 | 25 | $id = (int) $query->row('id'); |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | //Make sure last_checked is always updated on successful run. |
34 | 34 | //CHECK: Is there a reason we aren't just doing this in updateTitleById? |
35 | 35 | $this->db->set('last_checked', 'CURRENT_TIMESTAMP', FALSE) |
36 | - ->where('id', $id) |
|
37 | - ->update('tracker_titles'); |
|
36 | + ->where('id', $id) |
|
37 | + ->update('tracker_titles'); |
|
38 | 38 | } |
39 | 39 | } else { |
40 | 40 | log_message('error', "{$siteClass} | {$query->row('title')} ({$query->row('title_url')}) | Failed to update."); |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | */ |
75 | 75 | private function addTitle(string $titleURL, int $siteID) : int { |
76 | 76 | $query = $this->db->select('site, site_class') |
77 | - ->from('tracker_sites') |
|
78 | - ->where('id', $siteID) |
|
79 | - ->get(); |
|
77 | + ->from('tracker_sites') |
|
78 | + ->where('id', $siteID) |
|
79 | + ->get(); |
|
80 | 80 | |
81 | 81 | $titleData = $this->sites->{$query->row()->site_class}->getTitleData($titleURL, TRUE); |
82 | 82 | |
@@ -102,21 +102,21 @@ discard block |
||
102 | 102 | public function updateByID(int $titleID, ?string $latestChapter) : bool { |
103 | 103 | //FIXME: Really not too happy with how we're doing history stuff here, it just feels messy. |
104 | 104 | $query = $this->db->select('latest_chapter AS current_chapter') |
105 | - ->from('tracker_titles') |
|
106 | - ->where('id', $titleID) |
|
107 | - ->get(); |
|
105 | + ->from('tracker_titles') |
|
106 | + ->where('id', $titleID) |
|
107 | + ->get(); |
|
108 | 108 | $row = $query->row(); |
109 | 109 | |
110 | 110 | //TODO (CHECK): If failed_checks changes won't that trigger affected_rows? |
111 | 111 | $success = $this->db->set(['latest_chapter' => $latestChapter, 'failed_checks' => 0]) //last_updated gets updated via a trigger if something changes |
112 | - ->where('id', $titleID) |
|
113 | - ->update('tracker_titles'); |
|
112 | + ->where('id', $titleID) |
|
113 | + ->update('tracker_titles'); |
|
114 | 114 | |
115 | 115 | if($this->db->affected_rows() > 0) { |
116 | 116 | //Clear hidden latest chapter |
117 | 117 | $this->db->set(['ignore_chapter' => 'NULL', 'last_updated' => 'last_updated'], NULL, FALSE) |
118 | - ->where('title_id', $titleID) |
|
119 | - ->update('tracker_chapters'); |
|
118 | + ->where('title_id', $titleID) |
|
119 | + ->update('tracker_chapters'); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | //Update History |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | |
130 | 130 | public function updateFailedChecksByID(int $titleID) : bool { |
131 | 131 | $success = $this->db->set('failed_checks', 'failed_checks + 1', FALSE) |
132 | - ->where('id', $titleID) |
|
133 | - ->update('tracker_titles'); |
|
132 | + ->where('id', $titleID) |
|
133 | + ->update('tracker_titles'); |
|
134 | 134 | |
135 | 135 | return $success; |
136 | 136 | } |
@@ -142,9 +142,9 @@ discard block |
||
142 | 142 | */ |
143 | 143 | public function getSiteDataFromURL(string $site_url) { |
144 | 144 | $query = $this->db->select('*') |
145 | - ->from('tracker_sites') |
|
146 | - ->where('site', $site_url) |
|
147 | - ->get(); |
|
145 | + ->from('tracker_sites') |
|
146 | + ->where('site', $site_url) |
|
147 | + ->get(); |
|
148 | 148 | |
149 | 149 | return $query->row(); |
150 | 150 | } |
@@ -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, |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | public function verificationCheck(string $verificationCode) { |
77 | 77 | //user is trying to validate their email for signup, check if verification code is still valid/exists |
78 | 78 | $query = $this->db->select('email, verification_code_time') |
79 | - ->from('auth_signup_verification') |
|
80 | - ->where(array('verification_code' => $verificationCode)) |
|
81 | - ->get(); |
|
79 | + ->from('auth_signup_verification') |
|
80 | + ->where(array('verification_code' => $verificationCode)) |
|
81 | + ->get(); |
|
82 | 82 | |
83 | 83 | $return = FALSE; |
84 | 84 | if($query->num_rows() > 0) { |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | $this->session->set_flashdata('errors', 'Verification code expired. Please re-submit signup.'); |
91 | 91 | $this->db->delete('auth_signup_verification') |
92 | - ->where(array('verification_code' => $verificationCode)); |
|
92 | + ->where(array('verification_code' => $verificationCode)); |
|
93 | 93 | } else { |
94 | 94 | //not expired, verification is valid, return email |
95 | 95 | $return = $result->email; |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | $this->load->database(); |
126 | 126 | |
127 | 127 | $query = $this->db->select('email') |
128 | - ->from('auth_users') |
|
129 | - ->where('username', $identity) |
|
130 | - ->get(); |
|
128 | + ->from('auth_users') |
|
129 | + ->where('username', $identity) |
|
130 | + ->get(); |
|
131 | 131 | |
132 | 132 | if($query->num_rows() > 0) { |
133 | 133 | //username exists, grab email |
@@ -115,34 +115,34 @@ |
||
115 | 115 | |
116 | 116 | ////We need the series to be tracked |
117 | 117 | $idCQuery = $this->db->select('id') |
118 | - ->where('user_id', $userID) |
|
119 | - ->where('title_id', $titleID) |
|
120 | - ->get('tracker_chapters'); |
|
118 | + ->where('user_id', $userID) |
|
119 | + ->where('title_id', $titleID) |
|
120 | + ->get('tracker_chapters'); |
|
121 | 121 | if(!($idCQuery->num_rows() > 0)) { |
122 | 122 | //NOTE: This pretty much repeats a lot of what we already did above. Is there a better way to do this? |
123 | 123 | $this->Tracker->list->update($userID, $site, $title, $chapter, FALSE); |
124 | 124 | |
125 | 125 | $idCQuery = $this->db->select('id') |
126 | - ->where('user_id', $userID) |
|
127 | - ->where('title_id', $titleID) |
|
128 | - ->get('tracker_chapters'); |
|
126 | + ->where('user_id', $userID) |
|
127 | + ->where('title_id', $titleID) |
|
128 | + ->get('tracker_chapters'); |
|
129 | 129 | } |
130 | 130 | if($idCQuery->num_rows() > 0) { |
131 | 131 | $idCQueryRow = $idCQuery->row(); |
132 | 132 | |
133 | 133 | //Check if it is already favourited |
134 | 134 | $idFQuery = $this->db->select('id') |
135 | - ->where('chapter_id', $idCQueryRow->id) |
|
136 | - ->where('chapter', $chapter) |
|
137 | - ->where('page', $page) |
|
138 | - ->get('tracker_favourites'); |
|
135 | + ->where('chapter_id', $idCQueryRow->id) |
|
136 | + ->where('chapter', $chapter) |
|
137 | + ->where('page', $page) |
|
138 | + ->get('tracker_favourites'); |
|
139 | 139 | if($idFQuery->num_rows() > 0) { |
140 | 140 | //Chapter is already favourited, so remove it from DB |
141 | 141 | if($removeIfExists) { |
142 | 142 | $idFQueryRow = $idFQuery->row(); |
143 | 143 | |
144 | 144 | $isSuccess = (bool) $this->db->where('id', $idFQueryRow->id) |
145 | - ->delete('tracker_favourites'); |
|
145 | + ->delete('tracker_favourites'); |
|
146 | 146 | |
147 | 147 | if($isSuccess) { |
148 | 148 | $success = array( |