@@ -210,10 +210,10 @@ |
||
| 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? |
@@ -9,9 +9,9 @@ |
||
| 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) { |
@@ -7,9 +7,9 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | public function setByID(int $userID, int $chapterID, string $category) : bool { |
| 9 | 9 | $success = $this->db->set(['category' => $category, 'active' => 'Y', 'last_updated' => NULL]) |
| 10 | - ->where('user_id', $userID) |
|
| 11 | - ->where('id', $chapterID) |
|
| 12 | - ->update('tracker_chapters'); |
|
| 10 | + ->where('user_id', $userID) |
|
| 11 | + ->where('id', $chapterID) |
|
| 12 | + ->update('tracker_chapters'); |
|
| 13 | 13 | |
| 14 | 14 | return (bool) $success; |
| 15 | 15 | } |
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | public function getUsed(int $userID) : array { |
| 42 | 42 | $query = $this->db->distinct() |
| 43 | - ->select('category') |
|
| 44 | - ->from('tracker_chapters') |
|
| 45 | - ->where('tracker_chapters.active', 'Y') |
|
| 46 | - ->where('user_id', $userID) |
|
| 47 | - ->get(); |
|
| 43 | + ->select('category') |
|
| 44 | + ->from('tracker_chapters') |
|
| 45 | + ->where('tracker_chapters.active', 'Y') |
|
| 46 | + ->where('user_id', $userID) |
|
| 47 | + ->get(); |
|
| 48 | 48 | |
| 49 | 49 | return array_column($query->result_array(), 'category'); |
| 50 | 50 | } |
@@ -188,18 +188,18 @@ |
||
| 188 | 188 | //FIXME: Query duplication. |
| 189 | 189 | if($this->User->id !== $userID) { |
| 190 | 190 | $query = $this->db->select('value_str, value_int') |
| 191 | - ->from('user_options') |
|
| 192 | - ->where('user_id', $userID) |
|
| 193 | - ->where('name', $option) |
|
| 194 | - ->limit(1); |
|
| 191 | + ->from('user_options') |
|
| 192 | + ->where('user_id', $userID) |
|
| 193 | + ->where('name', $option) |
|
| 194 | + ->limit(1); |
|
| 195 | 195 | $data = $query->get()->row_array(); |
| 196 | 196 | } else { |
| 197 | 197 | if(!($data = $this->session->tempdata("option_{$option}"))) { |
| 198 | 198 | $query = $this->db->select('value_str, value_int') |
| 199 | - ->from('user_options') |
|
| 200 | - ->where('user_id', $userID) |
|
| 201 | - ->where('name', $option) |
|
| 202 | - ->limit(1); |
|
| 199 | + ->from('user_options') |
|
| 200 | + ->where('user_id', $userID) |
|
| 201 | + ->where('name', $option) |
|
| 202 | + ->limit(1); |
|
| 203 | 203 | $data = $query->get()->row_array(); |
| 204 | 204 | $this->session->set_tempdata("option_{$option}", $data, 3600); |
| 205 | 205 | } |
@@ -40,12 +40,12 @@ |
||
| 40 | 40 | |
| 41 | 41 | private function _list_complete_titles() { |
| 42 | 42 | $query = $this->db->select('tracker_titles.id, tracker_sites.site_class, tracker_titles.title, tracker_titles.title_url') |
| 43 | - ->from('tracker_chapters') |
|
| 44 | - ->join('tracker_titles', 'tracker_chapters.title_id = tracker_titles.id', 'left') |
|
| 45 | - ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left') |
|
| 46 | - ->like('tracker_chapters.tags', 'complete') |
|
| 47 | - ->where('tracker_titles.status', 0) |
|
| 48 | - ->get(); |
|
| 43 | + ->from('tracker_chapters') |
|
| 44 | + ->join('tracker_titles', 'tracker_chapters.title_id = tracker_titles.id', 'left') |
|
| 45 | + ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left') |
|
| 46 | + ->like('tracker_chapters.tags', 'complete') |
|
| 47 | + ->where('tracker_titles.status', 0) |
|
| 48 | + ->get(); |
|
| 49 | 49 | |
| 50 | 50 | $completeList = []; |
| 51 | 51 | if($query->num_rows() > 0) { |
@@ -53,9 +53,9 @@ |
||
| 53 | 53 | ]; |
| 54 | 54 | |
| 55 | 55 | $this->output |
| 56 | - ->set_status_header('200') |
|
| 57 | - ->set_content_type('application/json', 'utf-8') |
|
| 58 | - ->set_output(json_encode($json)); |
|
| 56 | + ->set_status_header('200') |
|
| 57 | + ->set_content_type('application/json', 'utf-8') |
|
| 58 | + ->set_output(json_encode($json)); |
|
| 59 | 59 | } else { |
| 60 | 60 | //TODO: We should probably try and have more verbose errors here. Return via JSON or something. |
| 61 | 61 | $this->output->set_status_header('400', 'Unable to update?'); |
@@ -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 |
@@ -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')); |