@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | ]; |
34 | 34 | } |
35 | 35 | if($result->num_rows() > 0) { |
36 | - foreach ($result->result() as $row) { |
|
36 | + foreach($result->result() as $row) { |
|
37 | 37 | $is_unread = intval((is_null($row->latest_chapter)) || ($row->latest_chapter == $row->ignore_chapter) || ($row->latest_chapter == $row->current_chapter) ? '1' : '0'); |
38 | 38 | $arr['series'][$row->category]['unread_count'] = (($arr['series'][$row->category]['unread_count'] ?? 0) + !$is_unread); |
39 | 39 | $data = [ |
40 | 40 | 'id' => $row->id, |
41 | 41 | 'generated_current_data' => $this->sites->{$row->site_class}->getChapterData($row->title_url, $row->current_chapter), |
42 | - 'generated_latest_data' => !is_null($row->latest_chapter) ? $this->sites->{$row->site_class}->getChapterData($row->title_url, $row->latest_chapter) : ['url' => '#', 'number' => 'No chapters found'] , |
|
42 | + 'generated_latest_data' => !is_null($row->latest_chapter) ? $this->sites->{$row->site_class}->getChapterData($row->title_url, $row->latest_chapter) : ['url' => '#', 'number' => 'No chapters found'], |
|
43 | 43 | 'generated_ignore_data' => ($row->ignore_chapter ? $this->sites->{$row->site_class}->getChapterData($row->title_url, $row->ignore_chapter) : NULL), |
44 | 44 | |
45 | 45 | 'full_title_url' => $this->sites->{$row->site_class}->getFullTitleURL($row->title_url), |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | $sortOrder = $this->User_Options->get('list_sort_order', $userID); |
91 | 91 | switch($this->User_Options->get('list_sort_type', $userID)) { |
92 | 92 | case 'unread': |
93 | - foreach (array_keys($arr['series']) as $category) { |
|
94 | - usort($arr['series'][$category]['manga'], function ($a, $b) use($sortOrder) { |
|
93 | + foreach(array_keys($arr['series']) as $category) { |
|
94 | + usort($arr['series'][$category]['manga'], function($a, $b) use($sortOrder) { |
|
95 | 95 | $a_text = strtolower("{$a['new_chapter_exists']} - {$a['title_data']['title']}"); |
96 | 96 | $b_text = strtolower("{$b['new_chapter_exists']} - {$b['title_data']['title']}"); |
97 | 97 | |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | break; |
106 | 106 | |
107 | 107 | case 'unread_latest': |
108 | - foreach (array_keys($arr['series']) as $category) { |
|
109 | - usort($arr['series'][$category]['manga'], function ($a, $b) use($sortOrder) { |
|
108 | + foreach(array_keys($arr['series']) as $category) { |
|
109 | + usort($arr['series'][$category]['manga'], function($a, $b) use($sortOrder) { |
|
110 | 110 | $a_text = $a['new_chapter_exists']; |
111 | 111 | $b_text = $b['new_chapter_exists']; |
112 | 112 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | break; |
128 | 128 | |
129 | 129 | case 'alphabetical': |
130 | - foreach (array_keys($arr['series']) as $category) { |
|
130 | + foreach(array_keys($arr['series']) as $category) { |
|
131 | 131 | usort($arr['series'][$category]['manga'], function($a, $b) use($sortOrder) { |
132 | 132 | $a_text = strtolower("{$a['title_data']['title']}"); |
133 | 133 | $b_text = strtolower("{$b['title_data']['title']}"); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | break; |
143 | 143 | |
144 | 144 | case 'my_status': |
145 | - foreach (array_keys($arr['series']) as $category) { |
|
145 | + foreach(array_keys($arr['series']) as $category) { |
|
146 | 146 | usort($arr['series'][$category]['manga'], function($a, $b) use($sortOrder) { |
147 | 147 | $a_text = strtolower("{$a['generated_current_data']['number']}"); |
148 | 148 | $b_text = strtolower("{$b['generated_current_data']['number']}"); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | break; |
158 | 158 | |
159 | 159 | case 'latest': |
160 | - foreach (array_keys($arr['series']) as $category) { |
|
160 | + foreach(array_keys($arr['series']) as $category) { |
|
161 | 161 | usort($arr['series'][$category]['manga'], function($a, $b) use($sortOrder) { |
162 | 162 | $a_text = new DateTime("{$a['title_data']['last_updated']}"); |
163 | 163 | $b_text = new DateTime("{$b['title_data']['last_updated']}"); |
@@ -26,7 +26,7 @@ |
||
26 | 26 | $this->enabledCategories['custom3'] = $this->User_Options->get('category_custom_3_text'); |
27 | 27 | } |
28 | 28 | |
29 | - foreach (glob(APPPATH.'models/Tracker/Sites/*.php') as $filename) { |
|
29 | + foreach(glob(APPPATH.'models/Tracker/Sites/*.php') as $filename) { |
|
30 | 30 | /** @noinspection PhpIncludeInspection */ |
31 | 31 | include_once $filename; |
32 | 32 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | $success = TRUE; |
63 | - } catch (Exception $e) { |
|
63 | + } catch(Exception $e) { |
|
64 | 64 | //echo 'Caught exception: ', $e->getMessage(), "\n"; |
65 | 65 | |
66 | 66 | //revert verification |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | //TODO: Remove from DB, send user error that verification expired. |
92 | 92 | } else { |
93 | 93 | //not expired, verification is valid, return email |
94 | - $return = $result->email; |
|
94 | + $return = $result->email; |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | return $return; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | if($query->num_rows() > 0) { |
77 | 77 | //username exists, grab email |
78 | 78 | $email = $query->row('email'); |
79 | - }else{ |
|
79 | + } else { |
|
80 | 80 | //username doesn't exist, return FALSE |
81 | 81 | $email = FALSE; |
82 | 82 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | public function get_new_api_key() : string { |
109 | 109 | $api_key = NULL; |
110 | 110 | if($this->logged_in()) { |
111 | - $api_key = substr("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", mt_rand(0, 51), 1) . substr(md5((string) time()), 1); |
|
111 | + $api_key = substr("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", mt_rand(0, 51), 1).substr(md5((string) time()), 1); |
|
112 | 112 | |
113 | 113 | $this->db->where('id', $this->id); |
114 | 114 | $this->db->update('auth_users', ['api_key' => $api_key]); |
@@ -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 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | parent::__construct(); |
8 | 8 | log_message('debug', "MY_Form_validation Class Initialized"); |
9 | 9 | |
10 | - $this->CI =& get_instance(); |
|
10 | + $this->CI = & get_instance(); |
|
11 | 11 | $this->CI->config->load('ion_auth', TRUE); |
12 | 12 | $this->user_tables = $this->CI->config->item('tables', 'ion_auth'); |
13 | 13 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function isRuleValid(string $ruleName) : bool { |
97 | 97 | $isValid = FALSE; |
98 | - if(is_string($ruleName) && $this->has_rule($ruleName)){ |
|
98 | + if(is_string($ruleName) && $this->has_rule($ruleName)) { |
|
99 | 99 | $isValid = !in_array($ruleName, array_keys($this->error_array()), TRUE); |
100 | 100 | } |
101 | 101 | return $isValid; |
@@ -5,7 +5,7 @@ |
||
5 | 5 | protected $CI; |
6 | 6 | |
7 | 7 | public function __construct() { |
8 | - $this->CI =& get_instance(); //grab an instance of CI |
|
8 | + $this->CI = & get_instance(); //grab an instance of CI |
|
9 | 9 | $this->initiate_cache(); |
10 | 10 | } |
11 | 11 |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | | always be used to set the mode correctly. |
27 | 27 | | |
28 | 28 | */ |
29 | -defined('FILE_READ_MODE') OR define('FILE_READ_MODE', 0644); |
|
29 | +defined('FILE_READ_MODE') OR define('FILE_READ_MODE', 0644); |
|
30 | 30 | defined('FILE_WRITE_MODE') OR define('FILE_WRITE_MODE', 0666); |
31 | -defined('DIR_READ_MODE') OR define('DIR_READ_MODE', 0755); |
|
32 | -defined('DIR_WRITE_MODE') OR define('DIR_WRITE_MODE', 0755); |
|
31 | +defined('DIR_READ_MODE') OR define('DIR_READ_MODE', 0755); |
|
32 | +defined('DIR_WRITE_MODE') OR define('DIR_WRITE_MODE', 0755); |
|
33 | 33 | |
34 | 34 | /* |
35 | 35 | |-------------------------------------------------------------------------- |
@@ -39,14 +39,14 @@ discard block |
||
39 | 39 | | These modes are used when working with fopen()/popen() |
40 | 40 | | |
41 | 41 | */ |
42 | -defined('FOPEN_READ') OR define('FOPEN_READ', 'rb'); |
|
43 | -defined('FOPEN_READ_WRITE') OR define('FOPEN_READ_WRITE', 'r+b'); |
|
44 | -defined('FOPEN_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care |
|
42 | +defined('FOPEN_READ') OR define('FOPEN_READ', 'rb'); |
|
43 | +defined('FOPEN_READ_WRITE') OR define('FOPEN_READ_WRITE', 'r+b'); |
|
44 | +defined('FOPEN_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care |
|
45 | 45 | defined('FOPEN_READ_WRITE_CREATE_DESCTRUCTIVE') OR define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care |
46 | -defined('FOPEN_WRITE_CREATE') OR define('FOPEN_WRITE_CREATE', 'ab'); |
|
47 | -defined('FOPEN_READ_WRITE_CREATE') OR define('FOPEN_READ_WRITE_CREATE', 'a+b'); |
|
48 | -defined('FOPEN_WRITE_CREATE_STRICT') OR define('FOPEN_WRITE_CREATE_STRICT', 'xb'); |
|
49 | -defined('FOPEN_READ_WRITE_CREATE_STRICT') OR define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b'); |
|
46 | +defined('FOPEN_WRITE_CREATE') OR define('FOPEN_WRITE_CREATE', 'ab'); |
|
47 | +defined('FOPEN_READ_WRITE_CREATE') OR define('FOPEN_READ_WRITE_CREATE', 'a+b'); |
|
48 | +defined('FOPEN_WRITE_CREATE_STRICT') OR define('FOPEN_WRITE_CREATE_STRICT', 'xb'); |
|
49 | +defined('FOPEN_READ_WRITE_CREATE_STRICT') OR define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b'); |
|
50 | 50 | |
51 | 51 | /* |
52 | 52 | |-------------------------------------------------------------------------- |
@@ -73,20 +73,20 @@ discard block |
||
73 | 73 | | http://tldp.org/LDP/abs/html/exitcodes.html |
74 | 74 | | |
75 | 75 | */ |
76 | -defined('EXIT_SUCCESS') OR define('EXIT_SUCCESS', 0); // no errors |
|
77 | -defined('EXIT_ERROR') OR define('EXIT_ERROR', 1); // generic error |
|
78 | -defined('EXIT_CONFIG') OR define('EXIT_CONFIG', 3); // configuration error |
|
79 | -defined('EXIT_UNKNOWN_FILE') OR define('EXIT_UNKNOWN_FILE', 4); // file not found |
|
80 | -defined('EXIT_UNKNOWN_CLASS') OR define('EXIT_UNKNOWN_CLASS', 5); // unknown class |
|
76 | +defined('EXIT_SUCCESS') OR define('EXIT_SUCCESS', 0); // no errors |
|
77 | +defined('EXIT_ERROR') OR define('EXIT_ERROR', 1); // generic error |
|
78 | +defined('EXIT_CONFIG') OR define('EXIT_CONFIG', 3); // configuration error |
|
79 | +defined('EXIT_UNKNOWN_FILE') OR define('EXIT_UNKNOWN_FILE', 4); // file not found |
|
80 | +defined('EXIT_UNKNOWN_CLASS') OR define('EXIT_UNKNOWN_CLASS', 5); // unknown class |
|
81 | 81 | defined('EXIT_UNKNOWN_METHOD') OR define('EXIT_UNKNOWN_METHOD', 6); // unknown class member |
82 | -defined('EXIT_USER_INPUT') OR define('EXIT_USER_INPUT', 7); // invalid user input |
|
83 | -defined('EXIT_DATABASE') OR define('EXIT_DATABASE', 8); // database error |
|
84 | -defined('EXIT__AUTO_MIN') OR define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code |
|
85 | -defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code |
|
82 | +defined('EXIT_USER_INPUT') OR define('EXIT_USER_INPUT', 7); // invalid user input |
|
83 | +defined('EXIT_DATABASE') OR define('EXIT_DATABASE', 8); // database error |
|
84 | +defined('EXIT__AUTO_MIN') OR define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code |
|
85 | +defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code |
|
86 | 86 | |
87 | 87 | /***** TIMEAGO CONSTANTS *****/ |
88 | 88 | defined('TIMEAGO_MONTH') OR define('TIMEAGO_MONTH', strtotime('-1 month')); //1 month ago |
89 | -defined('TIMEAGO_WEEK') OR define('TIMEAGO_WEEK', strtotime('-1 week')); //1 week ago |
|
90 | -defined('TIMEAGO_3DAY') OR define('TIMEAGO_3DAY', strtotime('-3 day')); //3 days ago |
|
89 | +defined('TIMEAGO_WEEK') OR define('TIMEAGO_WEEK', strtotime('-1 week')); //1 week ago |
|
90 | +defined('TIMEAGO_3DAY') OR define('TIMEAGO_3DAY', strtotime('-3 day')); //3 days ago |
|
91 | 91 | |
92 | 92 | defined('USERSCRIPT_VERSION') OR define('USERSCRIPT_VERSION', '1.10.41'); //This is automatically set by a PHPStorm File Watcher |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | protected $footer_data = array(); |
7 | 7 | public $global_data = array(); |
8 | 8 | |
9 | - public function __construct(){ |
|
9 | + public function __construct() { |
|
10 | 10 | parent::__construct(); |
11 | 11 | |
12 | 12 | //FIXME: This is pretty much a phpUnit hack. Without it phpUnit fails here. We need a proper way to fake user/admin testing. |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | $this->global_data['theme'] = $this->User_Options->get('theme'); |
20 | 20 | if(ENVIRONMENT !== 'development') { |
21 | 21 | $css_path = "css/main.{$this->User_Options->get('theme')}"; |
22 | - $this->global_data['complied_css_path'] = asset_url()."{$css_path}.".filemtime(APPPATH . "../public/assets/{$css_path}.css").".css"; |
|
22 | + $this->global_data['complied_css_path'] = asset_url()."{$css_path}.".filemtime(APPPATH."../public/assets/{$css_path}.css").".css"; |
|
23 | 23 | |
24 | 24 | $js_path = 'js/compiled.min'; |
25 | - $this->global_data['complied_js_path'] = asset_url()."{$js_path}.".filemtime(APPPATH . "../public/assets/{$js_path}.js").".js"; |
|
25 | + $this->global_data['complied_js_path'] = asset_url()."{$js_path}.".filemtime(APPPATH."../public/assets/{$js_path}.js").".js"; |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $json = is_array($json_input) ? json_encode($json_input) : $json_input; |
48 | 48 | |
49 | 49 | $this->output->set_content_type('application/json', 'utf-8'); |
50 | - $this->_render_content($json ?? '{}','json', $download, $filenamePrefix); |
|
50 | + $this->_render_content($json ?? '{}', 'json', $download, $filenamePrefix); |
|
51 | 51 | } |
52 | 52 | public function _render_content(string $content, string $filenameExt, bool $download = FALSE, string $filenamePrefix = 'tracker') : void { |
53 | 53 | if($download) { |