@@ -14,8 +14,8 @@ discard block |
||
| 14 | 14 | tf.chapter, tf.updated_at', FALSE) |
| 15 | 15 | ->from('tracker_favourites AS tf') |
| 16 | 16 | ->join('tracker_chapters AS tc', 'tf.chapter_id = tc.id', 'left') |
| 17 | - ->join('tracker_titles AS tt', 'tc.title_id = tt.id', 'left') |
|
| 18 | - ->join('tracker_sites AS ts', 'tt.site_id = ts.id', 'left') |
|
| 17 | + ->join('tracker_titles AS tt', 'tc.title_id = tt.id', 'left') |
|
| 18 | + ->join('tracker_sites AS ts', 'tt.site_id = ts.id', 'left') |
|
| 19 | 19 | ->where('tc.user_id', $this->User->id) //CHECK: Is this inefficient? Would it be better to have a user_id column in tracker_favourites? |
| 20 | 20 | ->order_by('tf.id DESC') |
| 21 | 21 | ->limit($rowsPerPage, ($rowsPerPage * ($page - 1))) |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | tf.chapter, tf.updated_at', FALSE) |
| 51 | 51 | ->from('tracker_favourites AS tf') |
| 52 | 52 | ->join('tracker_chapters AS tc', 'tf.chapter_id = tc.id', 'left') |
| 53 | - ->join('tracker_titles AS tt', 'tc.title_id = tt.id', 'left') |
|
| 54 | - ->join('tracker_sites AS ts', 'tt.site_id = ts.id', 'left') |
|
| 53 | + ->join('tracker_titles AS tt', 'tc.title_id = tt.id', 'left') |
|
| 54 | + ->join('tracker_sites AS ts', 'tt.site_id = ts.id', 'left') |
|
| 55 | 55 | ->where('tc.user_id', $this->User->id) //CHECK: Is this inefficient? Would it be better to have a user_id column in tracker_favourites? |
| 56 | 56 | ->order_by('tf.id DESC') |
| 57 | 57 | ->get(); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | $arr = []; |
| 63 | 63 | if($query->num_rows() > 0) { |
| 64 | - foreach ($query->result() as $row) { |
|
| 64 | + foreach($query->result() as $row) { |
|
| 65 | 65 | $arr[$row->category][] = [ |
| 66 | 66 | 'site' => $row->site, |
| 67 | 67 | 'title_url' => $row->title_url, |
@@ -94,15 +94,15 @@ discard block |
||
| 94 | 94 | $enclosure_esc = preg_quote($enclosure, '/'); |
| 95 | 95 | |
| 96 | 96 | $output = array(); |
| 97 | - foreach ($fields as $field) { |
|
| 98 | - if ($field === NULL && $nullToMysqlNull) { |
|
| 97 | + foreach($fields as $field) { |
|
| 98 | + if($field === NULL && $nullToMysqlNull) { |
|
| 99 | 99 | $output[] = 'NULL'; |
| 100 | 100 | continue; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | // Enclose fields containing $delimiter, $enclosure or whitespace |
| 104 | - if ($encloseAll || preg_match("/(?:${delimiter_esc}|${enclosure_esc}|\s)/", $field)) { |
|
| 105 | - $output[] = $enclosure . str_replace($enclosure, $enclosure . $enclosure, $field) . $enclosure; |
|
| 104 | + if($encloseAll || preg_match("/(?:${delimiter_esc}|${enclosure_esc}|\s)/", $field)) { |
|
| 105 | + $output[] = $enclosure.str_replace($enclosure, $enclosure.$enclosure, $field).$enclosure; |
|
| 106 | 106 | } else { |
| 107 | 107 | $output[] = $field; |
| 108 | 108 | } |
@@ -116,10 +116,10 @@ discard block |
||
| 116 | 116 | $csvArr[] = $headers; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - foreach ($fields as $field) { |
|
| 120 | - $csvArr[] = $this->arrayToCSV($field, $delimiter, $enclosure,$encloseAll,$nullToMysqlNull); |
|
| 119 | + foreach($fields as $field) { |
|
| 120 | + $csvArr[] = $this->arrayToCSV($field, $delimiter, $enclosure, $encloseAll, $nullToMysqlNull); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - return implode(PHP_EOL,$csvArr); |
|
| 123 | + return implode(PHP_EOL, $csvArr); |
|
| 124 | 124 | } |
| 125 | 125 | } |
@@ -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 | } |
@@ -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]); |
@@ -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 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | $success = TRUE; |
| 62 | - } catch (Exception $e) { |
|
| 62 | + } catch(Exception $e) { |
|
| 63 | 63 | //echo 'Caught exception: ', $e->getMessage(), "\n"; |
| 64 | 64 | |
| 65 | 65 | //revert verification |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | ->where(array('verification_code' => $verificationCode)); |
| 93 | 93 | } else { |
| 94 | 94 | //not expired, verification is valid, return email |
| 95 | - $return = $result->email; |
|
| 95 | + $return = $result->email; |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | return $return; |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | if($query->num_rows() > 0) { |
| 133 | 133 | //username exists, grab email |
| 134 | 134 | $email = $query->row('email'); |
| 135 | - }else{ |
|
| 135 | + } else { |
|
| 136 | 136 | //username doesn't exist, return FALSE |
| 137 | 137 | $email = NULL; |
| 138 | 138 | } |
@@ -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 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | 'is_unique_email' => 'Email already exists.' |
| 42 | 42 | )); |
| 43 | 43 | |
| 44 | - if ($isValid = ($this->form_validation->run() === TRUE)) { |
|
| 44 | + if($isValid = ($this->form_validation->run() === TRUE)) { |
|
| 45 | 45 | $email = $this->Auth->parseEmail($this->input->post('email')); |
| 46 | 46 | |
| 47 | 47 | $this->body_data['email'] = $email; |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | //login wasn't valid, failed, or this is a fresh login attempt |
| 57 | - if(!$isValid){ |
|
| 57 | + if(!$isValid) { |
|
| 58 | 58 | //display the email validation form |
| 59 | 59 | $this->body_data['form_email'] = array( |
| 60 | 60 | 'name' => 'email', |
@@ -89,14 +89,14 @@ discard block |
||
| 89 | 89 | if(!($email = $this->Auth->verificationCheck($verificationCode))) redirect('user/signup'); |
| 90 | 90 | |
| 91 | 91 | //validation is valid, proceed as normal |
| 92 | - $this->form_validation->set_rules('username', 'Username', 'required|min_length[4]|max_length[15]|valid_username|is_unique_username'); |
|
| 93 | - $this->form_validation->set_rules('password', 'Password', 'required|valid_password'); |
|
| 94 | - $this->form_validation->set_rules('password_confirm', 'Confirm Password', 'required|matches[password]'); |
|
| 95 | - $this->form_validation->set_rules('terms', 'Terms & Conditions', 'required'); |
|
| 92 | + $this->form_validation->set_rules('username', 'Username', 'required|min_length[4]|max_length[15]|valid_username|is_unique_username'); |
|
| 93 | + $this->form_validation->set_rules('password', 'Password', 'required|valid_password'); |
|
| 94 | + $this->form_validation->set_rules('password_confirm', 'Confirm Password', 'required|matches[password]'); |
|
| 95 | + $this->form_validation->set_rules('terms', 'Terms & Conditions', 'required'); |
|
| 96 | 96 | //TODO: timezone |
| 97 | 97 | //TODO: receive email |
| 98 | 98 | |
| 99 | - if ($isValid = ($this->form_validation->run() === TRUE)) { |
|
| 99 | + if($isValid = ($this->form_validation->run() === TRUE)) { |
|
| 100 | 100 | $username = $this->input->post('username'); |
| 101 | 101 | $password = $this->input->post('password'); |
| 102 | 102 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | //signup wasn't valid, failed, or this is a fresh signup attempt |
| 120 | - if(!$isValid){ |
|
| 120 | + if(!$isValid) { |
|
| 121 | 121 | //display the create user form |
| 122 | 122 | $this->body_data['verificationCode'] = $verificationCode; |
| 123 | 123 | |