@@ -114,7 +114,7 @@ |
||
114 | 114 | * @param string $option |
115 | 115 | * @param int|null $userID |
116 | 116 | * |
117 | - * @return mixed Returns option value as STRING, or FALSE if option does not exist. |
|
117 | + * @return string Returns option value as STRING, or FALSE if option does not exist. |
|
118 | 118 | */ |
119 | 119 | public function get(string $option, ?int $userID = NULL) { |
120 | 120 | $userID = (is_null($userID) ? (int) $this->User->id : $userID); |
@@ -190,16 +190,16 @@ |
||
190 | 190 | //FIXME: Query duplication. |
191 | 191 | if($this->User->id !== $userID) { |
192 | 192 | $query = $this->db->select("options->\"$.{$option}\" AS value", FALSE) |
193 | - ->from('auth_users') |
|
194 | - ->where('id', $userID) |
|
195 | - ->limit(1); |
|
193 | + ->from('auth_users') |
|
194 | + ->where('id', $userID) |
|
195 | + ->limit(1); |
|
196 | 196 | $data = $query->get()->row_object(); |
197 | 197 | } else { |
198 | 198 | //if(!($data = $this->session->tempdata("option_{$option}"))) { |
199 | 199 | $query = $this->db->select("options->\"$.{$option}\" AS value", FALSE) |
200 | - ->from('auth_users') |
|
201 | - ->where('id', $userID) |
|
202 | - ->limit(1); |
|
200 | + ->from('auth_users') |
|
201 | + ->where('id', $userID) |
|
202 | + ->limit(1); |
|
203 | 203 | $data = $query->get()->row_object(); |
204 | 204 | $this->session->set_tempdata("option_{$option}", $data, 3600); |
205 | 205 | //} |
@@ -237,7 +237,7 @@ |
||
237 | 237 | ); |
238 | 238 | //FIXME: Get a better solution than str_replace for removing special characters |
239 | 239 | $elements = array(); |
240 | - foreach (array_values($this->options[$option]['valid_options']) as $valid_option) { |
|
240 | + foreach(array_values($this->options[$option]['valid_options']) as $valid_option) { |
|
241 | 241 | $elements[$option.'_'.str_replace(',', '_', $valid_option)] = array_merge($base_attributes, array( |
242 | 242 | 'value' => $valid_option |
243 | 243 | )); |
@@ -154,7 +154,9 @@ discard block |
||
154 | 154 | //CI doesn't have any nice way of using the query builder with JSON columns. |
155 | 155 | $sql = 'UPDATE `auth_users` SET `options` = JSON_SET(COALESCE(`options`, \'{}\'), ?, ?) WHERE `id` = ?'; |
156 | 156 | if($success = $this->db->query($sql, ["$.{$option}", $parsedValue, $this->User->id])) { |
157 | - if($success) $this->session->unset_tempdata("option_{$option}"); |
|
157 | + if($success) { |
|
158 | + $this->session->unset_tempdata("option_{$option}"); |
|
159 | + } |
|
158 | 160 | } |
159 | 161 | } |
160 | 162 | } |
@@ -177,7 +179,9 @@ discard block |
||
177 | 179 | } |
178 | 180 | |
179 | 181 | //Overall fallback method. |
180 | - if(!isset($value)) $value = $this->options[$option]['default']; |
|
182 | + if(!isset($value)) { |
|
183 | + $value = $this->options[$option]['default']; |
|
184 | + } |
|
181 | 185 | } else { |
182 | 186 | $value = FALSE; |
183 | 187 | } |
@@ -224,7 +228,10 @@ discard block |
||
224 | 228 | //This should never happen. |
225 | 229 | break; |
226 | 230 | } |
227 | - if(!isset($value)) $value = FALSE; //FIXME: This won't play nice with BOOL type false? |
|
231 | + if(!isset($value)) { |
|
232 | + $value = FALSE; |
|
233 | + } |
|
234 | + //FIXME: This won't play nice with BOOL type false? |
|
228 | 235 | return $value; |
229 | 236 | } |
230 | 237 |
@@ -16,16 +16,16 @@ discard block |
||
16 | 16 | $usedCategories = $this->Tracker->category->getUsed($this->User->id); |
17 | 17 | |
18 | 18 | //NOTE: The checkbox validation is handled in run() |
19 | - $this->form_validation->set_rules('category_custom_1_text', 'Custom Category 1 Text', 'trim|regex_match[/^[a-zA-Z0-9-_\\s]{0,16}$/]'); |
|
20 | - $this->form_validation->set_rules('category_custom_2_text', 'Custom Category 2 Text', 'trim|regex_match[/^[a-zA-Z0-9-_\\s]{0,16}$/]'); |
|
21 | - $this->form_validation->set_rules('category_custom_3_text', 'Custom Category 3 Text', 'trim|regex_match[/^[a-zA-Z0-9-_\\s]{0,16}$/]'); |
|
19 | + $this->form_validation->set_rules('category_custom_1_text', 'Custom Category 1 Text', 'trim|regex_match[/^[a-zA-Z0-9-_\\s]{0,16}$/]'); |
|
20 | + $this->form_validation->set_rules('category_custom_2_text', 'Custom Category 2 Text', 'trim|regex_match[/^[a-zA-Z0-9-_\\s]{0,16}$/]'); |
|
21 | + $this->form_validation->set_rules('category_custom_3_text', 'Custom Category 3 Text', 'trim|regex_match[/^[a-zA-Z0-9-_\\s]{0,16}$/]'); |
|
22 | 22 | $this->form_validation->set_rules('default_series_category', 'Default Series Category', 'required|is_valid_option_value[default_series_category]'); |
23 | - $this->form_validation->set_rules('list_sort_type', 'List Sort Type', 'required|is_valid_option_value[list_sort_type]'); |
|
24 | - $this->form_validation->set_rules('list_sort_order', 'List Sort Order', 'required|is_valid_option_value[list_sort_order]'); |
|
25 | - $this->form_validation->set_rules('theme', 'Theme', 'required|is_valid_option_value[theme]'); |
|
26 | - $this->form_validation->set_rules('mal_sync', 'MAL Sync', 'required|is_valid_option_value[mal_sync]'); |
|
23 | + $this->form_validation->set_rules('list_sort_type', 'List Sort Type', 'required|is_valid_option_value[list_sort_type]'); |
|
24 | + $this->form_validation->set_rules('list_sort_order', 'List Sort Order', 'required|is_valid_option_value[list_sort_order]'); |
|
25 | + $this->form_validation->set_rules('theme', 'Theme', 'required|is_valid_option_value[theme]'); |
|
26 | + $this->form_validation->set_rules('mal_sync', 'MAL Sync', 'required|is_valid_option_value[mal_sync]'); |
|
27 | 27 | |
28 | - if ($isValid = $this->form_validation->run() === TRUE) { |
|
28 | + if($isValid = $this->form_validation->run() === TRUE) { |
|
29 | 29 | foreach($customCategories as $categoryK => $category) { |
30 | 30 | if(!in_array($categoryK, $usedCategories)) { |
31 | 31 | $this->User_Options->set($category, $this->input->post($category) ? 'enabled' : 'disabled'); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | $this->User_Options->set('enable_live_countdown_timer', $this->input->post('enable_live_countdown_timer')); |
40 | 40 | |
41 | - $this->User_Options->set('list_sort_type', $this->input->post('list_sort_type')); |
|
41 | + $this->User_Options->set('list_sort_type', $this->input->post('list_sort_type')); |
|
42 | 42 | $this->User_Options->set('list_sort_order', $this->input->post('list_sort_order')); |
43 | 43 | |
44 | 44 | $this->User_Options->set('theme', $this->input->post('theme')); |
@@ -1,4 +1,4 @@ |
||
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 AdminPanel extends Admin_Controller { |
4 | 4 | public function __construct() { |
@@ -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) { |
@@ -1,4 +1,4 @@ |
||
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 UpdateStatus extends MY_Controller { |
4 | 4 | public function __construct() { |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | * URL: /ajax/update_inline |
27 | 27 | */ |
28 | 28 | public function update() : void { |
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 |
||
122 | 122 | * URL: /tag_update |
123 | 123 | */ |
124 | 124 | public function tag_update() : void { |
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) { |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * URL: /set_category |
170 | 170 | */ |
171 | 171 | public function set_category() : void { |
172 | - $this->form_validation->set_rules('id[]', 'List of IDs', 'required|ctype_digit'); |
|
172 | + $this->form_validation->set_rules('id[]', 'List of IDs', 'required|ctype_digit'); |
|
173 | 173 | $this->form_validation->set_rules('category', 'Category Name', 'required|is_valid_category'); |
174 | 174 | |
175 | 175 | if($this->form_validation->run() === TRUE) { |
@@ -215,8 +215,8 @@ discard block |
||
215 | 215 | * URL: /ajax/ignore_inline |
216 | 216 | */ |
217 | 217 | public function ignore() : void { |
218 | - $this->form_validation->set_rules('id', 'Chapter ID', 'required|ctype_digit'); |
|
219 | - $this->form_validation->set_rules('chapter', 'Chapter', 'required'); |
|
218 | + $this->form_validation->set_rules('id', 'Chapter ID', 'required|ctype_digit'); |
|
219 | + $this->form_validation->set_rules('chapter', 'Chapter', 'required'); |
|
220 | 220 | |
221 | 221 | if($this->form_validation->run() === TRUE) { |
222 | 222 | $success = $this->Tracker->list->ignoreByID($this->userID, $this->input->post('id'), $this->input->post('chapter')); |
@@ -238,8 +238,8 @@ discard block |
||
238 | 238 | * URL: /set_mal_id |
239 | 239 | */ |
240 | 240 | public function set_mal_id() : void { |
241 | - $this->form_validation->set_rules('id', 'Chapter ID', 'required|ctype_digit'); |
|
242 | - $this->form_validation->set_rules('mal_id', 'MAL ID', 'regex_match[/^[0-9]*$/]'); |
|
241 | + $this->form_validation->set_rules('id', 'Chapter ID', 'required|ctype_digit'); |
|
242 | + $this->form_validation->set_rules('mal_id', 'MAL ID', 'regex_match[/^[0-9]*$/]'); |
|
243 | 243 | |
244 | 244 | if($this->form_validation->run() === TRUE) { |
245 | 245 | $malID = (is_numeric($this->input->post('mal_id')) ? $this->input->post('mal_id') : NULL); |
@@ -6,7 +6,9 @@ discard block |
||
6 | 6 | } |
7 | 7 | |
8 | 8 | public function index(int $page = 1) : void { |
9 | - if($page === 0) redirect('user/history/1'); |
|
9 | + if($page === 0) { |
|
10 | + redirect('user/history/1'); |
|
11 | + } |
|
10 | 12 | |
11 | 13 | $this->header_data['title'] = "History"; |
12 | 14 | $this->header_data['page'] = "history"; |
@@ -16,7 +18,9 @@ discard block |
||
16 | 18 | $this->body_data['currentPage'] = (int) $page; |
17 | 19 | $this->body_data['totalPages'] = $historyData['totalPages']; |
18 | 20 | |
19 | - if($page > $this->body_data['totalPages'] && $page > 1) redirect('user/history/1'); |
|
21 | + if($page > $this->body_data['totalPages'] && $page > 1) { |
|
22 | + redirect('user/history/1'); |
|
23 | + } |
|
20 | 24 | |
21 | 25 | $this->_render_page('User/History'); |
22 | 26 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | |
32 | 32 | case 'csv': |
33 | 33 | $this->output->set_content_type('text/csv', 'utf-8'); |
34 | - $this->_render_content($this->Tracker->portation->arrayToCSVRecursive($historyData, 'Date/Time,Title,URL,Site,Status'), 'csv',TRUE, 'tracker-history'); |
|
34 | + $this->_render_content($this->Tracker->portation->arrayToCSVRecursive($historyData, 'Date/Time,Title,URL,Site,Status'), 'csv', TRUE, 'tracker-history'); |
|
35 | 35 | break; |
36 | 36 | |
37 | 37 | default: |
@@ -60,7 +60,9 @@ |
||
60 | 60 | $show_404 = TRUE; |
61 | 61 | } |
62 | 62 | |
63 | - if($show_404) show_404(); |
|
63 | + if($show_404) { |
|
64 | + show_404(); |
|
65 | + } |
|
64 | 66 | } |
65 | 67 | |
66 | 68 | private function _walk_recursive_remove (array $array, callable $callback) : array { |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | // break; |
27 | 27 | |
28 | 28 | case 'html': |
29 | - $this->body_data['trackerData'] = $trackerData['series']; |
|
29 | + $this->body_data['trackerData'] = $trackerData['series']; |
|
30 | 30 | |
31 | 31 | $this->header_data['show_header'] = FALSE; |
32 | 32 | $this->footer_data['show_footer'] = FALSE; |
@@ -62,12 +62,12 @@ discard block |
||
62 | 62 | if($show_404) show_404(); |
63 | 63 | } |
64 | 64 | |
65 | - private function _walk_recursive_remove (array $array, callable $callback) : array { |
|
66 | - foreach ($array as $k => $v) { |
|
67 | - if (is_array($v)) { |
|
65 | + private function _walk_recursive_remove(array $array, callable $callback) : array { |
|
66 | + foreach($array as $k => $v) { |
|
67 | + if(is_array($v)) { |
|
68 | 68 | $array[$k] = $this->_walk_recursive_remove($v, $callback); |
69 | 69 | } else { |
70 | - if ($callback($v, $k)) { |
|
70 | + if($callback($v, $k)) { |
|
71 | 71 | unset($array[$k]); |
72 | 72 | } |
73 | 73 | } |
@@ -6,7 +6,9 @@ discard block |
||
6 | 6 | } |
7 | 7 | |
8 | 8 | public function index(int $page = 1) : void { |
9 | - if($page === 0) redirect('user/favourites/1'); |
|
9 | + if($page === 0) { |
|
10 | + redirect('user/favourites/1'); |
|
11 | + } |
|
10 | 12 | |
11 | 13 | $this->header_data['title'] = "Favourites"; |
12 | 14 | $this->header_data['page'] = "favourites"; |
@@ -16,7 +18,9 @@ discard block |
||
16 | 18 | $this->body_data['currentPage'] = $page; |
17 | 19 | $this->body_data['totalPages'] = $favouriteData['totalPages']; |
18 | 20 | |
19 | - if($page > $this->body_data['totalPages'] && $page <= 1) redirect('user/favourites/1'); |
|
21 | + if($page > $this->body_data['totalPages'] && $page <= 1) { |
|
22 | + redirect('user/favourites/1'); |
|
23 | + } |
|
20 | 24 | |
21 | 25 | $this->_render_page('User/Favourites'); |
22 | 26 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | |
32 | 32 | case 'csv': |
33 | 33 | $this->output->set_content_type('text/csv', 'utf-8'); |
34 | - $this->_render_content($this->Tracker->portation->arrayToCSVRecursive($favouriteData, 'Date/Time,Title,Manga URL,Site,Chapter,Chapter Number, Chapter URL'), 'csv',TRUE, 'tracker-favourite'); |
|
34 | + $this->_render_content($this->Tracker->portation->arrayToCSVRecursive($favouriteData, 'Date/Time,Title,Manga URL,Site,Chapter,Chapter Number, Chapter URL'), 'csv', TRUE, 'tracker-favourite'); |
|
35 | 35 | break; |
36 | 36 | |
37 | 37 | default: |
@@ -32,18 +32,19 @@ |
||
32 | 32 | return $time_string; |
33 | 33 | } |
34 | 34 | |
35 | -if (!function_exists('http_parse_headers')) { #http://www.php.net/manual/en/function.http-parse-headers.php#112917 |
|
35 | +if (!function_exists('http_parse_headers')) { |
|
36 | +#http://www.php.net/manual/en/function.http-parse-headers.php#112917 |
|
36 | 37 | function http_parse_headers (string $raw_headers) : array { |
37 | 38 | $headers = array(); // $headers = []; |
38 | 39 | foreach (explode("\n", $raw_headers) as $i => $h) { |
39 | 40 | $h = explode(':', $h, 2); |
40 | - if (isset($h[1])){ |
|
41 | - if(!isset($headers[$h[0]])){ |
|
41 | + if (isset($h[1])) { |
|
42 | + if(!isset($headers[$h[0]])) { |
|
42 | 43 | $headers[$h[0]] = trim($h[1]); |
43 | - }else if(is_array($headers[$h[0]])){ |
|
44 | + } else if(is_array($headers[$h[0]])) { |
|
44 | 45 | $tmp = array_merge($headers[$h[0]],array(trim($h[1]))); |
45 | 46 | $headers[$h[0]] = $tmp; |
46 | - }else{ |
|
47 | + } else { |
|
47 | 48 | $tmp = array_merge(array($headers[$h[0]]),array(trim($h[1]))); |
48 | 49 | $headers[$h[0]] = $tmp; |
49 | 50 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @return bool |
7 | 7 | */ |
8 | 8 | function view_exists(string $path) : bool { |
9 | - return file_exists(APPPATH . "/views/{$path}.php"); |
|
9 | + return file_exists(APPPATH."/views/{$path}.php"); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | function get_time_class(string $time_string) : string { |
@@ -32,19 +32,19 @@ discard block |
||
32 | 32 | return $time_string; |
33 | 33 | } |
34 | 34 | |
35 | -if (!function_exists('http_parse_headers')) { #http://www.php.net/manual/en/function.http-parse-headers.php#112917 |
|
36 | - function http_parse_headers (string $raw_headers) : array { |
|
35 | +if(!function_exists('http_parse_headers')) { #http://www.php.net/manual/en/function.http-parse-headers.php#112917 |
|
36 | + function http_parse_headers(string $raw_headers) : array { |
|
37 | 37 | $headers = array(); // $headers = []; |
38 | - foreach (explode("\n", $raw_headers) as $i => $h) { |
|
38 | + foreach(explode("\n", $raw_headers) as $i => $h) { |
|
39 | 39 | $h = explode(':', $h, 2); |
40 | - if (isset($h[1])){ |
|
41 | - if(!isset($headers[$h[0]])){ |
|
40 | + if(isset($h[1])) { |
|
41 | + if(!isset($headers[$h[0]])) { |
|
42 | 42 | $headers[$h[0]] = trim($h[1]); |
43 | - }else if(is_array($headers[$h[0]])){ |
|
44 | - $tmp = array_merge($headers[$h[0]],array(trim($h[1]))); |
|
43 | + } else if(is_array($headers[$h[0]])) { |
|
44 | + $tmp = array_merge($headers[$h[0]], array(trim($h[1]))); |
|
45 | 45 | $headers[$h[0]] = $tmp; |
46 | - }else{ |
|
47 | - $tmp = array_merge(array($headers[$h[0]]),array(trim($h[1]))); |
|
46 | + } else { |
|
47 | + $tmp = array_merge(array($headers[$h[0]]), array(trim($h[1]))); |
|
48 | 48 | $headers[$h[0]] = $tmp; |
49 | 49 | } |
50 | 50 | } |
@@ -66,19 +66,19 @@ discard block |
||
66 | 66 | } elseif($notices = $CI->session->flashdata('errors')) { |
67 | 67 | $CI->session->unset_userdata('errors'); //Sometimes we call this flashdata without redirecting, so make sure we remove it |
68 | 68 | if(is_string($notices)) { |
69 | - $notice_str = $CI->config->item('error_start_delimiter', 'ion_auth') . $notices . $CI->config->item('error_end_delimiter', 'ion_auth'); |
|
69 | + $notice_str = $CI->config->item('error_start_delimiter', 'ion_auth').$notices.$CI->config->item('error_end_delimiter', 'ion_auth'); |
|
70 | 70 | } elseif(is_array($notices)) { |
71 | 71 | foreach($notices as $notice) { |
72 | - $notice_str .= $CI->config->item('error_start_delimiter', 'ion_auth') . $notice . $CI->config->item('error_end_delimiter', 'ion_auth'); |
|
72 | + $notice_str .= $CI->config->item('error_start_delimiter', 'ion_auth').$notice.$CI->config->item('error_end_delimiter', 'ion_auth'); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | } elseif($notices = $CI->session->flashdata('notices')) { |
76 | 76 | $CI->session->unset_userdata('notices'); //Sometimes we call this flashdata without redirecting, so make sure we remove it |
77 | 77 | if(is_string($notices)) { |
78 | - $notice_str = $CI->config->item('message_start_delimiter', 'ion_auth') . $notices . $CI->config->item('message_end_delimiter', 'ion_auth'); |
|
78 | + $notice_str = $CI->config->item('message_start_delimiter', 'ion_auth').$notices.$CI->config->item('message_end_delimiter', 'ion_auth'); |
|
79 | 79 | } elseif(is_array($notices)) { |
80 | 80 | foreach($notices as $notice) { |
81 | - $notice_str .= $CI->config->item('message_start_delimiter', 'ion_auth') . $notice . $CI->config->item('message_end_delimiter', 'ion_auth'); |
|
81 | + $notice_str .= $CI->config->item('message_start_delimiter', 'ion_auth').$notice.$CI->config->item('message_end_delimiter', 'ion_auth'); |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | } |