@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | case 'csv': |
33 | 33 | $this->output->set_content_type('text/csv', 'utf-8'); |
34 | - $this->_render_content($this->arrayToCSVRecursive($historyData), 'csv',TRUE, 'tracker-history'); |
|
34 | + $this->_render_content($this->arrayToCSVRecursive($historyData), 'csv', TRUE, 'tracker-history'); |
|
35 | 35 | break; |
36 | 36 | |
37 | 37 | default: |
@@ -50,15 +50,15 @@ discard block |
||
50 | 50 | $enclosure_esc = preg_quote($enclosure, '/'); |
51 | 51 | |
52 | 52 | $output = array(); |
53 | - foreach ($fields as $field) { |
|
54 | - if ($field === NULL && $nullToMysqlNull) { |
|
53 | + foreach($fields as $field) { |
|
54 | + if($field === NULL && $nullToMysqlNull) { |
|
55 | 55 | $output[] = 'NULL'; |
56 | 56 | continue; |
57 | 57 | } |
58 | 58 | |
59 | 59 | // Enclose fields containing $delimiter, $enclosure or whitespace |
60 | - if ($encloseAll || preg_match("/(?:${delimiter_esc}|${enclosure_esc}|\s)/", $field)) { |
|
61 | - $output[] = $enclosure . str_replace($enclosure, $enclosure . $enclosure, $field) . $enclosure; |
|
60 | + if($encloseAll || preg_match("/(?:${delimiter_esc}|${enclosure_esc}|\s)/", $field)) { |
|
61 | + $output[] = $enclosure.str_replace($enclosure, $enclosure.$enclosure, $field).$enclosure; |
|
62 | 62 | } else { |
63 | 63 | $output[] = $field; |
64 | 64 | } |
@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | $csvArr = [ |
71 | 71 | 'Date/Time,Title,URL,Site,Status' |
72 | 72 | ]; |
73 | - foreach ($fields as $field) { |
|
74 | - $csvArr[] = $this->arrayToCSV($field, $delimiter, $enclosure,$encloseAll,$nullToMysqlNull); |
|
73 | + foreach($fields as $field) { |
|
74 | + $csvArr[] = $this->arrayToCSV($field, $delimiter, $enclosure, $encloseAll, $nullToMysqlNull); |
|
75 | 75 | } |
76 | 76 | |
77 | - return implode(PHP_EOL,$csvArr); |
|
77 | + return implode(PHP_EOL, $csvArr); |
|
78 | 78 | } |
79 | 79 | } |
@@ -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 | } |
@@ -1,4 +1,4 @@ |
||
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 MY_Security extends CI_Security { |
4 | 4 | public function __construct() { |
@@ -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() { |
@@ -44,12 +44,12 @@ discard block |
||
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 |
||
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) { |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | $new_tags = implode(',', array_diff( explode(',', $row->tags), [$matches[0]])); |
84 | 84 | |
85 | 85 | $this->db->set(['mal_id' => $malID, 'tags' => $new_tags, 'last_updated' => NULL]) |
86 | - ->where('id', $row->id) |
|
87 | - ->update('tracker_chapters'); |
|
86 | + ->where('id', $row->id) |
|
87 | + ->update('tracker_chapters'); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | } |
@@ -1,4 +1,4 @@ discard block |
||
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() { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | if(!empty($matches)) { |
82 | 82 | $malID = ($matches[1] !== 'none' ? $matches[1] : '0'); |
83 | - $new_tags = implode(',', array_diff( explode(',', $row->tags), [$matches[0]])); |
|
83 | + $new_tags = implode(',', array_diff(explode(',', $row->tags), [$matches[0]])); |
|
84 | 84 | |
85 | 85 | $this->db->set(['mal_id' => $malID, 'tags' => $new_tags, 'last_updated' => NULL]) |
86 | 86 | ->where('id', $row->id) |
@@ -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() { |
@@ -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); |
@@ -78,7 +78,7 @@ |
||
78 | 78 | public function report_bug() : void { |
79 | 79 | $this->load->library('user_agent'); |
80 | 80 | if($this->output->is_custom_header_set()) { $this->output->reset_status_header(); return; } |
81 | - $this->form_validation->set_rules('bug[url]', 'Bug [URL]', 'required'); |
|
81 | + $this->form_validation->set_rules('bug[url]', 'Bug [URL]', 'required'); |
|
82 | 82 | $this->form_validation->set_rules('bug[text]', 'Bug [Text]', 'required'); |
83 | 83 | |
84 | 84 | if($this->form_validation->run() === TRUE) { |
@@ -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?'); |
@@ -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 { |
@@ -63,12 +63,12 @@ |
||
63 | 63 | if($show_404) show_404(); |
64 | 64 | } |
65 | 65 | |
66 | - private function _walk_recursive_remove (array $array, callable $callback) : array { |
|
67 | - foreach ($array as $k => $v) { |
|
68 | - if (is_array($v)) { |
|
66 | + private function _walk_recursive_remove(array $array, callable $callback) : array { |
|
67 | + foreach($array as $k => $v) { |
|
68 | + if(is_array($v)) { |
|
69 | 69 | $array[$k] = $this->_walk_recursive_remove($v, $callback); |
70 | 70 | } else { |
71 | - if ($callback($v, $k)) { |
|
71 | + if($callback($v, $k)) { |
|
72 | 72 | unset($array[$k]); |
73 | 73 | } |
74 | 74 | } |
@@ -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 | } |
@@ -1,4 +1,4 @@ discard block |
||
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 | /** |
4 | 4 | * Checks if view file exists. |
@@ -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 | } |
@@ -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 | } |