@@ -18,26 +18,26 @@ discard block |
||
| 18 | 18 | $file = ($file === '') ? 'config' : str_replace('.php', '', $file); |
| 19 | 19 | $loaded = FALSE; |
| 20 | 20 | |
| 21 | - foreach ($this->_config_paths as $path) |
|
| 21 | + foreach($this->_config_paths as $path) |
|
| 22 | 22 | { |
| 23 | - foreach (array($file, '_secure'.DIRECTORY_SEPARATOR.$file, ENVIRONMENT.DIRECTORY_SEPARATOR.$file) as $location) |
|
| 23 | + foreach(array($file, '_secure'.DIRECTORY_SEPARATOR.$file, ENVIRONMENT.DIRECTORY_SEPARATOR.$file) as $location) |
|
| 24 | 24 | { |
| 25 | 25 | $file_path = $path.'config/'.$location.'.php'; |
| 26 | - if (in_array($file_path, $this->is_loaded, TRUE)) |
|
| 26 | + if(in_array($file_path, $this->is_loaded, TRUE)) |
|
| 27 | 27 | { |
| 28 | 28 | return TRUE; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - if ( ! file_exists($file_path)) |
|
| 31 | + if(!file_exists($file_path)) |
|
| 32 | 32 | { |
| 33 | 33 | continue; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | include($file_path); |
| 37 | 37 | |
| 38 | - if ( ! isset($config) OR ! is_array($config)) |
|
| 38 | + if(!isset($config) OR !is_array($config)) |
|
| 39 | 39 | { |
| 40 | - if ($fail_gracefully === TRUE) |
|
| 40 | + if($fail_gracefully === TRUE) |
|
| 41 | 41 | { |
| 42 | 42 | return FALSE; |
| 43 | 43 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | show_error('Your '.$file_path.' file does not appear to contain a valid configuration array.'); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - if ($use_sections === TRUE) |
|
| 48 | + if($use_sections === TRUE) |
|
| 49 | 49 | { |
| 50 | 50 | $this->config[$file] = isset($this->config[$file]) |
| 51 | 51 | ? array_merge($this->config[$file], $config) |
@@ -63,11 +63,11 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - if ($loaded === TRUE) |
|
| 66 | + if($loaded === TRUE) |
|
| 67 | 67 | { |
| 68 | 68 | return TRUE; |
| 69 | 69 | } |
| 70 | - elseif ($fail_gracefully === TRUE) |
|
| 70 | + elseif($fail_gracefully === TRUE) |
|
| 71 | 71 | { |
| 72 | 72 | return FALSE; |
| 73 | 73 | } |
@@ -48,22 +48,22 @@ discard block |
||
| 48 | 48 | public function __construct() { |
| 49 | 49 | $file_path = APPPATH.'config/monolog.php'; |
| 50 | 50 | $found = FALSE; |
| 51 | - if (file_exists($file_path)) { |
|
| 51 | + if(file_exists($file_path)) { |
|
| 52 | 52 | $found = TRUE; |
| 53 | 53 | require($file_path); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | // Is the config file in the environment folder? |
| 57 | - if (file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/monolog.php')) { |
|
| 57 | + if(file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/monolog.php')) { |
|
| 58 | 58 | require($file_path); |
| 59 | - } elseif (!$found) { |
|
| 59 | + } elseif(!$found) { |
|
| 60 | 60 | exit('monolog.php config does not exist'); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // Is the config file in the _secure folder? |
| 64 | - if (file_exists($file_path = APPPATH.'config/_secure/monolog.php')) { |
|
| 64 | + if(file_exists($file_path = APPPATH.'config/_secure/monolog.php')) { |
|
| 65 | 65 | require($file_path); |
| 66 | - } elseif (!$found) { |
|
| 66 | + } elseif(!$found) { |
|
| 67 | 67 | exit('monolog.php config does not exist'); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | // detect and register all PHP errors in this log hence forth |
| 75 | 75 | ErrorHandler::register($this->log); |
| 76 | 76 | |
| 77 | - if ($this->config['introspection_processor']) |
|
| 77 | + if($this->config['introspection_processor']) |
|
| 78 | 78 | { |
| 79 | 79 | // add controller and line number info to each log message |
| 80 | 80 | // 2 = depth in the stacktrace to ignore. This gives us the file |
@@ -83,9 +83,9 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // decide which handler(s) to use |
| 86 | - foreach ($this->config['handlers'] as $value) |
|
| 86 | + foreach($this->config['handlers'] as $value) |
|
| 87 | 87 | { |
| 88 | - switch ($value) |
|
| 88 | + switch($value) |
|
| 89 | 89 | { |
| 90 | 90 | case 'file': |
| 91 | 91 | $handler = new RotatingFileHandler($this->config['file_logfile']); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | break; |
| 131 | 131 | |
| 132 | 132 | default: |
| 133 | - exit('log handler not supported: ' . $value . "\n"); |
|
| 133 | + exit('log handler not supported: '.$value."\n"); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | $this->log->pushHandler($handler); |
@@ -152,19 +152,19 @@ discard block |
||
| 152 | 152 | $level = strtoupper($level); |
| 153 | 153 | |
| 154 | 154 | // verify error level |
| 155 | - if (!isset($this->_levels[$level])) |
|
| 155 | + if(!isset($this->_levels[$level])) |
|
| 156 | 156 | { |
| 157 | - $this->log->addError('unknown error level: ' . $level); |
|
| 157 | + $this->log->addError('unknown error level: '.$level); |
|
| 158 | 158 | $level = 'ALL'; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | // filter out anything in $this->config['exclusion_list'] |
| 162 | - if (!empty($this->config['exclusion_list'])) |
|
| 162 | + if(!empty($this->config['exclusion_list'])) |
|
| 163 | 163 | { |
| 164 | - foreach ($this->config['exclusion_list'] as $findme) |
|
| 164 | + foreach($this->config['exclusion_list'] as $findme) |
|
| 165 | 165 | { |
| 166 | 166 | $pos = strpos($msg, $findme); |
| 167 | - if ($pos !== false) |
|
| 167 | + if($pos !== false) |
|
| 168 | 168 | { |
| 169 | 169 | // just exit now - we don't want to log this error |
| 170 | 170 | return true; |
@@ -172,9 +172,9 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - if ($this->_levels[$level] <= $this->config['threshold']) |
|
| 175 | + if($this->_levels[$level] <= $this->config['threshold']) |
|
| 176 | 176 | { |
| 177 | - switch ($level) |
|
| 177 | + switch($level) |
|
| 178 | 178 | { |
| 179 | 179 | case 'ERROR': |
| 180 | 180 | $this->log->addError($msg); |
@@ -96,7 +96,7 @@ |
||
| 96 | 96 | $route['ajax/hide_notice']['post'] = 'Ajax/TrackerInline/hide_notice'; |
| 97 | 97 | $route['ajax/set_mal_id']['post'] = 'Ajax/TrackerInline/set_mal_id'; |
| 98 | 98 | |
| 99 | -$route['export_list'] = 'Ajax/TrackerInline/export'; |
|
| 99 | +$route['export_list'] = 'Ajax/TrackerInline/export'; |
|
| 100 | 100 | //$route['import_list']['post'] = 'Ajax/TrackerInline/import'; |
| 101 | 101 | |
| 102 | 102 | $route['import_amr'] = 'Import_AMR'; |
@@ -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. |
@@ -17,13 +17,13 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | $this->global_data['theme'] = $this->User_Options->get('theme'); |
| 19 | 19 | if(ENVIRONMENT === 'production') { |
| 20 | - $this->global_data['compiled_css_path'] = function () { |
|
| 20 | + $this->global_data['compiled_css_path'] = function() { |
|
| 21 | 21 | $css_path = "css/main.{$this->global_data['theme']}"; |
| 22 | - return asset_url() . $css_path . '.' . filemtime(APPPATH . "../public/assets/{$css_path}.css") . '.css'; |
|
| 22 | + return asset_url().$css_path.'.'.filemtime(APPPATH."../public/assets/{$css_path}.css").'.css'; |
|
| 23 | 23 | }; |
| 24 | 24 | |
| 25 | 25 | $js_path = 'js/compiled.min'; |
| 26 | - $this->global_data['compiled_js_path'] = asset_url() . $js_path . '.' . filemtime(APPPATH . "../public/assets/{$js_path}.js") . '.js'; |
|
| 26 | + $this->global_data['compiled_js_path'] = asset_url().$js_path.'.'.filemtime(APPPATH."../public/assets/{$js_path}.js").'.js'; |
|
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $json = is_array($json_input) ? json_encode($json_input) : $json_input; |
| 55 | 55 | |
| 56 | 56 | $this->output->set_content_type('application/json', 'utf-8'); |
| 57 | - $this->_render_content($json ?? '{}','json', $download, $filenamePrefix); |
|
| 57 | + $this->_render_content($json ?? '{}', 'json', $download, $filenamePrefix); |
|
| 58 | 58 | } |
| 59 | 59 | public function _render_content(string $content, string $filenameExt, bool $download = FALSE, string $filenamePrefix = 'tracker') : void { |
| 60 | 60 | if($download) { |
@@ -40,6 +40,6 @@ |
||
| 40 | 40 | |
| 41 | 41 | $config['dsn'] = TRUE; |
| 42 | 42 | |
| 43 | -if(file_exists(APPPATH . 'config/_secure/email.php')) { |
|
| 44 | - include APPPATH . 'config/_secure/email.php'; //CI BUG: For some odd reason, this isn't picked up by MY_Config. Possibly due to MY_Config not being loaded yet? |
|
| 43 | +if(file_exists(APPPATH.'config/_secure/email.php')) { |
|
| 44 | + include APPPATH.'config/_secure/email.php'; //CI BUG: For some odd reason, this isn't picked up by MY_Config. Possibly due to MY_Config not being loaded yet? |
|
| 45 | 45 | } |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | if($query->num_rows() > 0) { |
| 80 | 80 | $hardRateLimit = 500; //This is to avoid any possible IP bans by cache breaking again. |
| 81 | 81 | $siteRateLimits = []; |
| 82 | - foreach ($query->result() as $row) { |
|
| 83 | - if(!array_key_exists($row->site_class,$siteRateLimits)) { |
|
| 82 | + foreach($query->result() as $row) { |
|
| 83 | + if(!array_key_exists($row->site_class, $siteRateLimits)) { |
|
| 84 | 84 | $siteRateLimits[$row->site_class] = 0; |
| 85 | 85 | } |
| 86 | 86 | $siteRateLimits[$row->site_class]++; |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $query = $query->get(); |
| 143 | 143 | |
| 144 | 144 | if($query->num_rows() > 0) { |
| 145 | - foreach ($query->result() as $row) { |
|
| 145 | + foreach($query->result() as $row) { |
|
| 146 | 146 | $this->handleUpdate($row); |
| 147 | 147 | } |
| 148 | 148 | } |
@@ -220,10 +220,10 @@ discard block |
||
| 220 | 220 | ->get(); |
| 221 | 221 | |
| 222 | 222 | $sites = $query->result_array(); |
| 223 | - foreach ($sites as $site) { |
|
| 223 | + foreach($sites as $site) { |
|
| 224 | 224 | $siteClass = $this->sites->{$site['site_class']}; |
| 225 | 225 | if($titleDataList = $siteClass->doCustomUpdate()) { |
| 226 | - foreach ($titleDataList as $titleURL => $titleData) { |
|
| 226 | + foreach($titleDataList as $titleURL => $titleData) { |
|
| 227 | 227 | $titleURL = (string) $titleURL; //Number only keys get converted to int for some reason, so we need to fix that. |
| 228 | 228 | print "> {$titleData['title']} <{$site['site_class']}>"; //Print this prior to doing anything so we can more easily find out if something went wrong |
| 229 | 229 | if(is_array($titleData) && !is_null($titleData['latest_chapter'])) { |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | $query = $this->db->select('tracker_titles.id, tracker_titles.title_url, tracker_sites.site_class') |
| 267 | 267 | ->from('tracker_titles') |
| 268 | 268 | ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left') |
| 269 | - ->where('tracker_titles.followed','N') |
|
| 269 | + ->where('tracker_titles.followed', 'N') |
|
| 270 | 270 | ->where('tracker_titles !=', '255') |
| 271 | 271 | ->where('tracker_sites.status', 'enabled') |
| 272 | 272 | ->where('tracker_sites.use_custom', 'Y') |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | (PHP_SAPI !== 'cli' || isset($_SERVER['HTTP_USER_AGENT'])) && die('CLI only.'); |
| 4 | 4 | |
| 5 | -chdir(__DIR__ . '/../'); //Just to make things easier, change dir to project root. |
|
| 5 | +chdir(__DIR__.'/../'); //Just to make things easier, change dir to project root. |
|
| 6 | 6 | |
| 7 | 7 | function setup() { |
| 8 | 8 | vendor_copy(); |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | chmod_files(); |
| 11 | 11 | |
| 12 | 12 | //Make sure .gitkeep file is recreated |
| 13 | - touch(getcwd() . '/application/tests/_ci_phpunit_test/.gitkeep'); |
|
| 13 | + touch(getcwd().'/application/tests/_ci_phpunit_test/.gitkeep'); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | /**********************************************************************************************************************/ |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | function chmod_files() { |
| 24 | - $directory = new RecursiveDirectoryIterator(getcwd() . '/application/config'); |
|
| 24 | + $directory = new RecursiveDirectoryIterator(getcwd().'/application/config'); |
|
| 25 | 25 | $flattened = new RecursiveIteratorIterator($directory); |
| 26 | 26 | |
| 27 | 27 | $files = new RegexIterator($flattened, '/^(.*\/)?(database|database_password|config|email|recaptcha|sites)\.php/'); |
@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | imagealphablending($sheetImage, FALSE); |
| 39 | 39 | imagesavealpha($sheetImage, TRUE); |
| 40 | 40 | |
| 41 | - imagefill($sheetImage,0,0,0x7fff0000); |
|
| 41 | + imagefill($sheetImage, 0, 0, 0x7fff0000); |
|
| 42 | 42 | |
| 43 | 43 | $x = 0; |
| 44 | - foreach ($this->fileList as $filename) { |
|
| 44 | + foreach($this->fileList as $filename) { |
|
| 45 | 45 | $iconImage = imagecreatefrompng("{$this->iconFolder}/{$filename}"); |
| 46 | 46 | imagealphablending($iconImage, TRUE); |
| 47 | 47 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $x++; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - imagepng($sheetImage, ASSET_FOLDER . "/img/{$this->type}s.png"); |
|
| 55 | + imagepng($sheetImage, ASSET_FOLDER."/img/{$this->type}s.png"); |
|
| 56 | 56 | say('Updated spritesheet!'); |
| 57 | 57 | } |
| 58 | 58 | private function generateLESS(string $filename, int $dst_x) : void { |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | " .sprite();\n". |
| 79 | 79 | " background: url('../../img/{$this->type}s.@{cache-version}.png') no-repeat;\n\n". |
| 80 | 80 | " {$newIconLESS}\n". |
| 81 | - "} //end sprite-{$this->type}",$oldLESS); |
|
| 81 | + "} //end sprite-{$this->type}", $oldLESS); |
|
| 82 | 82 | |
| 83 | 83 | file_put_contents($icons_file, $newLESS); |
| 84 | 84 | say('Updated LESS!'); |
@@ -14,8 +14,8 @@ discard block |
||
| 14 | 14 | tf.chapter, tf.page, 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))) |
@@ -57,8 +57,8 @@ discard block |
||
| 57 | 57 | tf.chapter, tf.page, tf.updated_at', FALSE) |
| 58 | 58 | ->from('tracker_favourites AS tf') |
| 59 | 59 | ->join('tracker_chapters AS tc', 'tf.chapter_id = tc.id', 'left') |
| 60 | - ->join('tracker_titles AS tt', 'tc.title_id = tt.id', 'left') |
|
| 61 | - ->join('tracker_sites AS ts', 'tt.site_id = ts.id', 'left') |
|
| 60 | + ->join('tracker_titles AS tt', 'tc.title_id = tt.id', 'left') |
|
| 61 | + ->join('tracker_sites AS ts', 'tt.site_id = ts.id', 'left') |
|
| 62 | 62 | ->where('tc.user_id', $this->User->id) //CHECK: Is this inefficient? Would it be better to have a user_id column in tracker_favourites? |
| 63 | 63 | ->order_by('tf.id DESC') |
| 64 | 64 | ->get(); |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | if($isSuccess) { |
| 147 | 147 | $success = array( |
| 148 | - 'status' => 'Unfavourited' . ($page ? " page {$page}" : ''), |
|
| 148 | + 'status' => 'Unfavourited'.($page ? " page {$page}" : ''), |
|
| 149 | 149 | 'bool' => TRUE |
| 150 | 150 | ); |
| 151 | 151 | $this->History->userRemoveFavourite((int) $idCQueryRow->id, $chapter); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | if($isSuccess) { |
| 169 | 169 | $success = array( |
| 170 | - 'status' => 'Favourited' . ($page ? " page {$page}" : ''), |
|
| 170 | + 'status' => 'Favourited'.($page ? " page {$page}" : ''), |
|
| 171 | 171 | 'bool' => TRUE |
| 172 | 172 | ); |
| 173 | 173 | $this->History->userAddFavourite((int) $idCQueryRow->id, $chapter); |