@@ -18,7 +18,7 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class FunctionalTester extends \Codeception\Actor |
| 20 | 20 | { |
| 21 | - use _generated\FunctionalTesterActions; |
|
| 21 | + use _generated\FunctionalTesterActions; |
|
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * Define custom actions here |
@@ -16,8 +16,7 @@ |
||
| 16 | 16 | * |
| 17 | 17 | * @SuppressWarnings(PHPMD) |
| 18 | 18 | */ |
| 19 | -class FunctionalTester extends \Codeception\Actor |
|
| 20 | -{ |
|
| 19 | +class FunctionalTester extends \Codeception\Actor { |
|
| 21 | 20 | use _generated\FunctionalTesterActions; |
| 22 | 21 | |
| 23 | 22 | /** |
@@ -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 MY_Form_validation extends CI_Form_validation { |
| 4 | 4 | private $user_tables; |
@@ -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 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function isRuleValid(string $ruleName) : bool { |
| 93 | 93 | $isValid = FALSE; |
| 94 | - if(is_string($ruleName) && $this->has_rule($ruleName)){ |
|
| 94 | + if(is_string($ruleName) && $this->has_rule($ruleName)) { |
|
| 95 | 95 | $isValid = !in_array($ruleName, array_keys($this->error_array()), TRUE); |
| 96 | 96 | } |
| 97 | 97 | return $isValid; |
@@ -30,8 +30,7 @@ discard block |
||
| 30 | 30 | public function valid_password(string $password) : bool { |
| 31 | 31 | if(!($isValid = $this->min_length($password, $this->CI->config->item('min_password_length', 'ion_auth')))) { |
| 32 | 32 | $this->set_message('valid_password', 'The password is too short!'); |
| 33 | - } |
|
| 34 | - elseif(!($isValid = $this->max_length($password, $this->CI->config->item('max_password_length', 'ion_auth')))) { |
|
| 33 | + } elseif(!($isValid = $this->max_length($password, $this->CI->config->item('max_password_length', 'ion_auth')))) { |
|
| 35 | 34 | $this->set_message('valid_password', 'The password is too long!'); |
| 36 | 35 | } |
| 37 | 36 | return $isValid; |
@@ -91,7 +90,7 @@ discard block |
||
| 91 | 90 | */ |
| 92 | 91 | public function isRuleValid(string $ruleName) : bool { |
| 93 | 92 | $isValid = FALSE; |
| 94 | - if(is_string($ruleName) && $this->has_rule($ruleName)){ |
|
| 93 | + if(is_string($ruleName) && $this->has_rule($ruleName)) { |
|
| 95 | 94 | $isValid = !in_array($ruleName, array_keys($this->error_array()), TRUE); |
| 96 | 95 | } |
| 97 | 96 | return $isValid; |
@@ -245,7 +245,7 @@ |
||
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | /** |
| 248 | - * @param $md5 |
|
| 248 | + * @param string $md5 |
|
| 249 | 249 | * |
| 250 | 250 | * @return array |
| 251 | 251 | */ |
@@ -74,8 +74,8 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function __construct(&$db) { |
| 76 | 76 | // Assign the main CI object to $this->CI and load the file helper since we use it a lot |
| 77 | - $this->CI =& get_instance(); |
|
| 78 | - $this->db =& $db; |
|
| 77 | + $this->CI = & get_instance(); |
|
| 78 | + $this->db = & $db; |
|
| 79 | 79 | $this->CI->load->helper('file'); |
| 80 | 80 | |
| 81 | 81 | $this->check_path(); |
@@ -102,18 +102,18 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | // Add a trailing slash to the path if needed |
| 104 | 104 | $path = realpath($path) |
| 105 | - ? rtrim(realpath($path), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR |
|
| 106 | - : rtrim($path, '/') . '/'; |
|
| 105 | + ? rtrim(realpath($path), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR |
|
| 106 | + : rtrim($path, '/').'/'; |
|
| 107 | 107 | |
| 108 | 108 | if(!is_dir($path)) { |
| 109 | - log_message('debug', 'DB cache path error: ' . $path); |
|
| 109 | + log_message('debug', 'DB cache path error: '.$path); |
|
| 110 | 110 | |
| 111 | 111 | // If the path is wrong we'll turn off caching |
| 112 | 112 | return $this->db->cache_off(); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | if(!is_really_writable($path)) { |
| 116 | - log_message('debug', 'DB cache dir not writable: ' . $path); |
|
| 116 | + log_message('debug', 'DB cache dir not writable: '.$path); |
|
| 117 | 117 | |
| 118 | 118 | // If the path is not really writable we'll turn off caching |
| 119 | 119 | return $this->db->cache_off(); |
@@ -144,11 +144,11 @@ discard block |
||
| 144 | 144 | // BEGIN --- modification for supporting multi-level cache folders |
| 145 | 145 | |
| 146 | 146 | if(is_array($this->CI->config->item('multi_level_cache_folders'))) { |
| 147 | - $uri_md5 = md5($segment_one . '+' . $segment_two); |
|
| 147 | + $uri_md5 = md5($segment_one.'+'.$segment_two); |
|
| 148 | 148 | $layer = $this->get_folder_layers($uri_md5); |
| 149 | - $filepath = $this->db->cachedir . $segment_one.'/'.$segment_two . '/' . implode('/', $layer) . '/' . $uri_md5; |
|
| 149 | + $filepath = $this->db->cachedir.$segment_one.'/'.$segment_two.'/'.implode('/', $layer).'/'.$uri_md5; |
|
| 150 | 150 | } else { |
| 151 | - $filepath = $this->db->cachedir . $segment_one.'/'. $segment_two . '/' . md5($sql); |
|
| 151 | + $filepath = $this->db->cachedir.$segment_one.'/'.$segment_two.'/'.md5($sql); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | // END --- modification for supporting multi-level cache folders |
@@ -178,9 +178,9 @@ discard block |
||
| 178 | 178 | // BEGIN --- modification for supporting multi-level cache folders |
| 179 | 179 | |
| 180 | 180 | if(is_array($this->CI->config->item('multi_level_cache_folders'))) { |
| 181 | - $uri_md5 = md5($segment_one . '+' . $segment_two); |
|
| 181 | + $uri_md5 = md5($segment_one.'+'.$segment_two); |
|
| 182 | 182 | $layer = $this->get_folder_layers($uri_md5); |
| 183 | - $dir_path = $this->db->cachedir . $segment_one.'/'.$segment_two . '/' . implode('/', $layer) . '/'; |
|
| 183 | + $dir_path = $this->db->cachedir.$segment_one.'/'.$segment_two.'/'.implode('/', $layer).'/'; |
|
| 184 | 184 | |
| 185 | 185 | if(!is_dir($dir_path)) { |
| 186 | 186 | $old = umask(0); |
@@ -188,18 +188,18 @@ discard block |
||
| 188 | 188 | umask($old); |
| 189 | 189 | } |
| 190 | 190 | } else { |
| 191 | - $dir_path = $this->db->cachedir . $segment_one.'/'. $segment_two . '/'; |
|
| 191 | + $dir_path = $this->db->cachedir.$segment_one.'/'.$segment_two.'/'; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | $filename = md5($sql); |
| 195 | 195 | |
| 196 | 196 | // END --- modification for supporting multi-level cache folders |
| 197 | 197 | |
| 198 | - if(write_file($dir_path . $filename, serialize($object)) === FALSE) { |
|
| 198 | + if(write_file($dir_path.$filename, serialize($object)) === FALSE) { |
|
| 199 | 199 | return FALSE; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - chmod($dir_path . $filename, 0640); |
|
| 202 | + chmod($dir_path.$filename, 0640); |
|
| 203 | 203 | |
| 204 | 204 | return TRUE; |
| 205 | 205 | } |
@@ -224,11 +224,11 @@ discard block |
||
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | if(is_array($this->CI->config->item('multi_level_cache_folders'))) { |
| 227 | - $uri_md5 = md5($segment_one . '+' . $segment_two); |
|
| 227 | + $uri_md5 = md5($segment_one.'+'.$segment_two); |
|
| 228 | 228 | $layer = $this->get_folder_layers($uri_md5); |
| 229 | - $dir_path = $this->db->cachedir . $segment_one.'/'.$segment_two . '/' . implode('/', $layer) . '/'; |
|
| 229 | + $dir_path = $this->db->cachedir.$segment_one.'/'.$segment_two.'/'.implode('/', $layer).'/'; |
|
| 230 | 230 | } else { |
| 231 | - $dir_path = $this->db->cachedir . $segment_one.'/'. $segment_two . '/'; |
|
| 231 | + $dir_path = $this->db->cachedir.$segment_one.'/'.$segment_two.'/'; |
|
| 232 | 232 | } |
| 233 | 233 | delete_files($dir_path, TRUE); |
| 234 | 234 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @since Version 1.0.0 |
| 36 | 36 | * @filesource |
| 37 | 37 | */ |
| 38 | -defined('BASEPATH') OR exit('No direct script access allowed'); |
|
| 38 | +defined('BASEPATH') or exit('No direct script access allowed'); |
|
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * Database Cache Class |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | $last_key = 0; |
| 255 | 255 | $last_value = 0; |
| 256 | 256 | |
| 257 | - foreach($this->CI->config->item('multi_level_cache_folders') AS $key => $value) { |
|
| 257 | + foreach($this->CI->config->item('multi_level_cache_folders') as $key => $value) { |
|
| 258 | 258 | if($key != 0) { |
| 259 | 259 | $key = $last_key + $last_value; |
| 260 | 260 | } |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | // if this class is already loaded before instantiating it. Loading it now |
| 23 | 23 | // makes sure our version is used when a controller enables query caching |
| 24 | 24 | if(!class_exists('CI_DB_Cache')) { |
| 25 | - @include(APPPATH . 'libraries/MY_DB_cache.php'); |
|
| 25 | + @include(APPPATH.'libraries/MY_DB_cache.php'); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | // call the parent method to retain the CI functionality |
@@ -11,14 +11,14 @@ |
||
| 11 | 11 | |
| 12 | 12 | $config['gravatar_base_url'] = 'http://www.gravatar.com/'; |
| 13 | 13 | $config['gravatar_secure_base_url'] = 'https://secure.gravatar.com/'; |
| 14 | -$config['gravatar_image_extension'] = '.png'; // '', '.png' or '.jpg'. |
|
| 14 | +$config['gravatar_image_extension'] = '.png'; // '', '.png' or '.jpg'. |
|
| 15 | 15 | $config['gravatar_image_size'] = 44; |
| 16 | 16 | |
| 17 | 17 | $config['gravatar_default_image'] = 'identicon'; // '', '404', 'mm', 'identicon', 'monsterid', 'wavatar', 'retro', 'blank'. |
| 18 | 18 | //$config['gravatar_default_image'] = BASE_URL.'assets/img/lib/default-person.png'; // Another possible option: a custon image. |
| 19 | 19 | |
| 20 | 20 | $config['gravatar_force_default_image'] = false; |
| 21 | -$config['gravatar_rating'] = ''; // '', 'g' (default), 'pg', 'r', 'x'. |
|
| 21 | +$config['gravatar_rating'] = ''; // '', 'g' (default), 'pg', 'r', 'x'. |
|
| 22 | 22 | |
| 23 | 23 | // Useragent string for server-made requests. |
| 24 | 24 | // It is for not getting 403 forbidden response. |
@@ -1,4 +1,4 @@ discard block |
||
| 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 | /** |
| 4 | 4 | * Gravatar Library for CodeIgniter - Configuration |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | $config['gravatar_default_image'] = 'identicon'; // '', '404', 'mm', 'identicon', 'monsterid', 'wavatar', 'retro', 'blank'. |
| 18 | 18 | //$config['gravatar_default_image'] = BASE_URL.'assets/img/lib/default-person.png'; // Another possible option: a custon image. |
| 19 | 19 | |
| 20 | -$config['gravatar_force_default_image'] = false; |
|
| 20 | +$config['gravatar_force_default_image'] = FALSE; |
|
| 21 | 21 | $config['gravatar_rating'] = ''; // '', 'g' (default), 'pg', 'r', 'x'. |
| 22 | 22 | |
| 23 | 23 | // Useragent string for server-made requests. |
@@ -137,7 +137,9 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | $success = $this->set_db($idData, $valueData); |
| 140 | - if($success) $this->session->unset_tempdata("option_{$option}"); |
|
| 140 | + if($success) { |
|
| 141 | + $this->session->unset_tempdata("option_{$option}"); |
|
| 142 | + } |
|
| 141 | 143 | } else { |
| 142 | 144 | $success = FALSE; |
| 143 | 145 | } |
@@ -164,7 +166,9 @@ discard block |
||
| 164 | 166 | } |
| 165 | 167 | |
| 166 | 168 | //Overall fallback method. |
| 167 | - if(!isset($value)) $value = $this->options[$option]['default']; |
|
| 169 | + if(!isset($value)) { |
|
| 170 | + $value = $this->options[$option]['default']; |
|
| 171 | + } |
|
| 168 | 172 | } else { |
| 169 | 173 | $value = FALSE; |
| 170 | 174 | } |
@@ -215,7 +219,10 @@ discard block |
||
| 215 | 219 | //This should never happen. |
| 216 | 220 | break; |
| 217 | 221 | } |
| 218 | - if(!isset($value)) $value = FALSE; //FIXME: This won't play nice with BOOL type false? |
|
| 222 | + if(!isset($value)) { |
|
| 223 | + $value = FALSE; |
|
| 224 | + } |
|
| 225 | + //FIXME: This won't play nice with BOOL type false? |
|
| 219 | 226 | |
| 220 | 227 | return $value; |
| 221 | 228 | } |
@@ -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); |
@@ -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 | } |
@@ -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 User_Options_Model extends CI_Model { |
| 4 | 4 | public $options = array( |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | * |
| 117 | 117 | * @return mixed Returns option value as STRING, or FALSE if option does not exist. |
| 118 | 118 | */ |
| 119 | - public function get(string $option, ?int $userID = NULL) { |
|
| 119 | + public function get(string $option, ? int $userID = NULL) { |
|
| 120 | 120 | $userID = (is_null($userID) ? (int) $this->User->id : $userID); |
| 121 | 121 | |
| 122 | 122 | return $this->get_by_userid($option, $userID); |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | $query = $this->db->select('value_str, value_int') |
| 191 | 191 | ->from('user_options') |
| 192 | 192 | ->where('user_id', $userID) |
| 193 | - ->where('name', $option) |
|
| 193 | + ->where('name', $option) |
|
| 194 | 194 | ->limit(1); |
| 195 | 195 | $data = $query->get()->row_array(); |
| 196 | 196 | } else { |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | $query = $this->db->select('value_str, value_int') |
| 199 | 199 | ->from('user_options') |
| 200 | 200 | ->where('user_id', $userID) |
| 201 | - ->where('name', $option) |
|
| 201 | + ->where('name', $option) |
|
| 202 | 202 | ->limit(1); |
| 203 | 203 | $data = $query->get()->row_array(); |
| 204 | 204 | $this->session->set_tempdata("option_{$option}", $data, 3600); |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | ); |
| 252 | 252 | //FIXME: Get a better solution than str_replace for removing special characters |
| 253 | 253 | $elements = array(); |
| 254 | - foreach (array_values($this->options[$option]['valid_options']) as $valid_option) { |
|
| 254 | + foreach(array_values($this->options[$option]['valid_options']) as $valid_option) { |
|
| 255 | 255 | $elements[$option.'_'.str_replace(',', '_', $valid_option)] = array_merge($base_attributes, array( |
| 256 | 256 | 'value' => $valid_option |
| 257 | 257 | )); |
@@ -1,7 +1,7 @@ |
||
| 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 | include_once APPPATH.'models/Tracker/Tracker_Base_Model.php'; |
| 4 | -foreach (glob(APPPATH.'models/Tracker/*.php') as $filename) { |
|
| 4 | +foreach(glob(APPPATH.'models/Tracker/*.php') as $filename) { |
|
| 5 | 5 | /** @noinspection PhpIncludeInspection */ |
| 6 | 6 | include_once $filename; |
| 7 | 7 | } |
@@ -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 | include_once APPPATH.'models/Tracker/Tracker_Base_Model.php'; |
| 4 | 4 | foreach (glob(APPPATH.'models/Tracker/*.php') as $filename) { |
@@ -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) { |
@@ -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 Tracker_Tag_Model extends Tracker_Base_Model { |
| 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 Tracker_Tag_Model extends Tracker_Base_Model { |
| 4 | 4 | public function __construct() { |
@@ -35,9 +35,13 @@ |
||
| 35 | 35 | $titleID = $id; |
| 36 | 36 | } else { |
| 37 | 37 | //TODO: Check if title is valid URL! |
| 38 | - if($create) $titleID = $this->addTitle($titleURL, $siteID); |
|
| 38 | + if($create) { |
|
| 39 | + $titleID = $this->addTitle($titleURL, $siteID); |
|
| 40 | + } |
|
| 41 | + } |
|
| 42 | + if(!isset($titleID) || !$titleID) { |
|
| 43 | + $titleID = 0; |
|
| 39 | 44 | } |
| 40 | - if(!isset($titleID) || !$titleID) $titleID = 0; |
|
| 41 | 45 | |
| 42 | 46 | return ($returnData && $titleID !== 0 ? $query->row_array() : $titleID); |
| 43 | 47 | } |
@@ -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 Tracker_Title_Model extends Tracker_Base_Model { |
| 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 Tracker_Title_Model extends Tracker_Base_Model { |
| 4 | 4 | public function __construct() { |
@@ -122,7 +122,7 @@ |
||
| 122 | 122 | /** |
| 123 | 123 | * @param string $site_url |
| 124 | 124 | * |
| 125 | - * @return stdClass|object|null |
|
| 125 | + * @return string |
|
| 126 | 126 | */ |
| 127 | 127 | public function getSiteDataFromURL(string $site_url) { |
| 128 | 128 | $query = $this->db->select('*') |
@@ -15,11 +15,11 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | public function getID(string $titleURL, int $siteID, bool $create = TRUE, bool $returnData = FALSE) { |
| 17 | 17 | $query = $this->db->select('tracker_titles.id, tracker_titles.title, tracker_titles.title_url, tracker_titles.latest_chapter, tracker_titles.status, tracker_sites.site_class, (tracker_titles.last_checked > DATE_SUB(NOW(), INTERVAL 3 DAY)) AS active', FALSE) |
| 18 | - ->from('tracker_titles') |
|
| 19 | - ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left') |
|
| 20 | - ->where('tracker_titles.title_url', $titleURL) |
|
| 21 | - ->where('tracker_titles.site_id', $siteID) |
|
| 22 | - ->get(); |
|
| 18 | + ->from('tracker_titles') |
|
| 19 | + ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left') |
|
| 20 | + ->where('tracker_titles.title_url', $titleURL) |
|
| 21 | + ->where('tracker_titles.site_id', $siteID) |
|
| 22 | + ->get(); |
|
| 23 | 23 | |
| 24 | 24 | if($query->num_rows() > 0) { |
| 25 | 25 | $id = (int) $query->row('id'); |
@@ -32,8 +32,8 @@ discard block |
||
| 32 | 32 | //Make sure last_checked is always updated on successful run. |
| 33 | 33 | //CHECK: Is there a reason we aren't just doing this in updateTitleById? |
| 34 | 34 | $this->db->set('last_checked', 'CURRENT_TIMESTAMP', FALSE) |
| 35 | - ->where('id', $id) |
|
| 36 | - ->update('tracker_titles'); |
|
| 35 | + ->where('id', $id) |
|
| 36 | + ->update('tracker_titles'); |
|
| 37 | 37 | } |
| 38 | 38 | } else { |
| 39 | 39 | log_message('error', "{$query->row('title')} failed to update successfully"); |
@@ -73,9 +73,9 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | private function addTitle(string $titleURL, int $siteID) : int { |
| 75 | 75 | $query = $this->db->select('site, site_class') |
| 76 | - ->from('tracker_sites') |
|
| 77 | - ->where('id', $siteID) |
|
| 78 | - ->get(); |
|
| 76 | + ->from('tracker_sites') |
|
| 77 | + ->where('id', $siteID) |
|
| 78 | + ->get(); |
|
| 79 | 79 | |
| 80 | 80 | $titleData = $this->sites->{$query->row()->site_class}->getTitleData($titleURL, TRUE); |
| 81 | 81 | |
@@ -101,20 +101,20 @@ discard block |
||
| 101 | 101 | public function updateByID(int $titleID, string $latestChapter) : bool { |
| 102 | 102 | //FIXME: Really not too happy with how we're doing history stuff here, it just feels messy. |
| 103 | 103 | $query = $this->db->select('latest_chapter AS current_chapter') |
| 104 | - ->from('tracker_titles') |
|
| 105 | - ->where('id', $titleID) |
|
| 106 | - ->get(); |
|
| 104 | + ->from('tracker_titles') |
|
| 105 | + ->where('id', $titleID) |
|
| 106 | + ->get(); |
|
| 107 | 107 | $row = $query->row(); |
| 108 | 108 | |
| 109 | 109 | $success = $this->db->set(['latest_chapter' => $latestChapter, 'failed_checks' => 0]) //last_updated gets updated via a trigger if something changes |
| 110 | - ->where('id', $titleID) |
|
| 111 | - ->update('tracker_titles'); |
|
| 110 | + ->where('id', $titleID) |
|
| 111 | + ->update('tracker_titles'); |
|
| 112 | 112 | |
| 113 | 113 | if($this->db->affected_rows() > 0) { |
| 114 | 114 | //Clear hidden latest chapter |
| 115 | 115 | $this->db->set(['ignore_chapter' => 'NULL', 'last_updated' => 'last_updated'], NULL, FALSE) |
| 116 | - ->where('title_id', $titleID) |
|
| 117 | - ->update('tracker_chapters'); |
|
| 116 | + ->where('title_id', $titleID) |
|
| 117 | + ->update('tracker_chapters'); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | //Update History |
@@ -127,8 +127,8 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | public function updateFailedChecksByID(int $titleID) : bool { |
| 129 | 129 | $success = $this->db->set('failed_checks', 'failed_checks + 1', FALSE) |
| 130 | - ->where('id', $titleID) |
|
| 131 | - ->update('tracker_titles'); |
|
| 130 | + ->where('id', $titleID) |
|
| 131 | + ->update('tracker_titles'); |
|
| 132 | 132 | |
| 133 | 133 | return $success; |
| 134 | 134 | } |
@@ -140,9 +140,9 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | public function getSiteDataFromURL(string $site_url) { |
| 142 | 142 | $query = $this->db->select('*') |
| 143 | - ->from('tracker_sites') |
|
| 144 | - ->where('site', $site_url) |
|
| 145 | - ->get(); |
|
| 143 | + ->from('tracker_sites') |
|
| 144 | + ->where('site', $site_url) |
|
| 145 | + ->get(); |
|
| 146 | 146 | |
| 147 | 147 | return $query->row(); |
| 148 | 148 | } |