@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | $themes = scandir(base_path().'/resources/views/themes', SCANDIR_SORT_ASCENDING); |
| 20 | 20 | $themeList[] = 'None'; |
| 21 | 21 | foreach ($themes as $theme) { |
| 22 | - if (! str_contains($theme, '.') && ! \in_array($theme, $ignoredThemes, false) && File::isDirectory(base_path().'/resources/views/themes/'.$theme)) { |
|
| 22 | + if (!str_contains($theme, '.') && !\in_array($theme, $ignoredThemes, false) && File::isDirectory(base_path().'/resources/views/themes/'.$theme)) { |
|
| 23 | 23 | $themeList[] = $theme; |
| 24 | 24 | } |
| 25 | 25 | } |
@@ -39,12 +39,12 @@ discard block |
||
| 39 | 39 | $string = ''; |
| 40 | 40 | $gzFile = @gzopen($filePath, 'rb', 0); |
| 41 | 41 | if ($gzFile) { |
| 42 | - while (! gzeof($gzFile)) { |
|
| 42 | + while (!gzeof($gzFile)) { |
|
| 43 | 43 | $temp = gzread($gzFile, 1024); |
| 44 | 44 | // Check for empty string. |
| 45 | 45 | // Without this the loop would be endless and consume 100% CPU. |
| 46 | 46 | // Do not set $string empty here, as the data might still be good. |
| 47 | - if (! $temp) { |
|
| 47 | + if (!$temp) { |
|
| 48 | 48 | break; |
| 49 | 49 | } |
| 50 | 50 | $string .= $temp; |
@@ -101,15 +101,14 @@ discard block |
||
| 101 | 101 | $fileSpecTemplate = '%s/%s%s'; |
| 102 | 102 | $fileSpec = ''; |
| 103 | 103 | |
| 104 | - if (! empty($options['id']) && \in_array( |
|
| 104 | + if (!empty($options['id']) && \in_array( |
|
| 105 | 105 | $options['type'], |
| 106 | 106 | ['anime', 'audio', 'audiosample', 'book', 'console', 'games', 'movies', 'music', 'preview', 'sample', 'tvrage', 'video', 'xxx'], |
| 107 | 107 | false |
| 108 | 108 | ) |
| 109 | 109 | ) { |
| 110 | 110 | $fileSpec = sprintf($fileSpecTemplate, $options['type'], $options['id'], $options['suffix']); |
| 111 | - $fileSpec = file_exists(storage_path('covers').$fileSpec) ? $fileSpec : |
|
| 112 | - sprintf($fileSpecTemplate, $options['type'], 'no', $options['suffix']); |
|
| 111 | + $fileSpec = file_exists(storage_path('covers').$fileSpec) ? $fileSpec : sprintf($fileSpecTemplate, $options['type'], 'no', $options['suffix']); |
|
| 113 | 112 | } |
| 114 | 113 | |
| 115 | 114 | return $fileSpec; |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | public function setSocketTimeout(int $timeout) |
| 152 | 152 | { |
| 153 | - if (! is_numeric($timeout)) { |
|
| 153 | + if (!is_numeric($timeout)) { |
|
| 154 | 154 | echo 'ERROR: IRC socket timeout must be a number!'.PHP_EOL; |
| 155 | 155 | } else { |
| 156 | 156 | $this->_socket_timeout = $timeout; |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | public function setConnectionTimeout(int $timeout) |
| 166 | 166 | { |
| 167 | - if (! is_numeric($timeout)) { |
|
| 167 | + if (!is_numeric($timeout)) { |
|
| 168 | 168 | echo 'ERROR: IRC connection timeout must be a number!'.PHP_EOL; |
| 169 | 169 | } else { |
| 170 | 170 | $this->_remote_connection_timeout = $timeout; |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | public function setConnectionRetries(int $retries) |
| 178 | 178 | { |
| 179 | - if (! is_numeric($retries)) { |
|
| 179 | + if (!is_numeric($retries)) { |
|
| 180 | 180 | echo 'ERROR: IRC connection retries must be a number!'.PHP_EOL; |
| 181 | 181 | } else { |
| 182 | 182 | $this->_reconnectRetries = $retries; |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | */ |
| 191 | 191 | public function setReConnectDelay(int $delay) |
| 192 | 192 | { |
| 193 | - if (! is_numeric($delay)) { |
|
| 193 | + if (!is_numeric($delay)) { |
|
| 194 | 194 | echo 'ERROR: IRC reconnect delay must be a number!'.PHP_EOL; |
| 195 | 195 | } else { |
| 196 | 196 | $this->_reconnectDelay = $delay; |
@@ -210,14 +210,14 @@ discard block |
||
| 210 | 210 | $transport = ($tls === true ? 'tls' : 'tcp'); |
| 211 | 211 | |
| 212 | 212 | $socket_string = $transport.'://'.$hostname.':'.$port; |
| 213 | - if ($socket_string !== $this->_remote_socket_string || ! $this->_connected()) { |
|
| 214 | - if (! \is_string($hostname) || $hostname === '') { |
|
| 213 | + if ($socket_string !== $this->_remote_socket_string || !$this->_connected()) { |
|
| 214 | + if (!\is_string($hostname) || $hostname === '') { |
|
| 215 | 215 | echo 'ERROR: IRC host name must not be empty!'.PHP_EOL; |
| 216 | 216 | |
| 217 | 217 | return false; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - if (! is_numeric($port)) { |
|
| 220 | + if (!is_numeric($port)) { |
|
| 221 | 221 | echo 'ERROR: IRC port must be a number!'.PHP_EOL; |
| 222 | 222 | |
| 223 | 223 | return false; |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | */ |
| 262 | 262 | public function login(string $nickName, string $userName, string $realName, $password = null): bool |
| 263 | 263 | { |
| 264 | - if (! $this->_connected()) { |
|
| 264 | + if (!$this->_connected()) { |
|
| 265 | 265 | echo 'ERROR: You must connect to IRC first!'.PHP_EOL; |
| 266 | 266 | |
| 267 | 267 | return false; |
@@ -278,15 +278,15 @@ discard block |
||
| 278 | 278 | $this->_realName = $realName; |
| 279 | 279 | $this->_password = $password; |
| 280 | 280 | |
| 281 | - if (($password !== null && ! empty($password)) && ! $this->_writeSocket('PASSWORD '.$password)) { |
|
| 281 | + if (($password !== null && !empty($password)) && !$this->_writeSocket('PASSWORD '.$password)) { |
|
| 282 | 282 | return false; |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | - if (! $this->_writeSocket('NICK '.$nickName)) { |
|
| 285 | + if (!$this->_writeSocket('NICK '.$nickName)) { |
|
| 286 | 286 | return false; |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | - if (! $this->_writeSocket('USER '.$userName.' 0 * :'.$realName)) { |
|
| 289 | + if (!$this->_writeSocket('USER '.$userName.' 0 * :'.$realName)) { |
|
| 290 | 290 | return false; |
| 291 | 291 | } |
| 292 | 292 | |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | $tempPass = $password; |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - if ($password !== null && ! $this->_writeSocket('PASS '.$tempPass)) { |
|
| 318 | + if ($password !== null && !$this->_writeSocket('PASS '.$tempPass)) { |
|
| 319 | 319 | return false; |
| 320 | 320 | } |
| 321 | 321 | |
@@ -399,13 +399,13 @@ discard block |
||
| 399 | 399 | { |
| 400 | 400 | $this->_channels = $channels; |
| 401 | 401 | |
| 402 | - if (! $this->_connected()) { |
|
| 402 | + if (!$this->_connected()) { |
|
| 403 | 403 | echo 'ERROR: You must connect to IRC first!'.PHP_EOL; |
| 404 | 404 | |
| 405 | 405 | return false; |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | - if (! empty($channels)) { |
|
| 408 | + if (!empty($channels)) { |
|
| 409 | 409 | foreach ($channels as $channel => $password) { |
| 410 | 410 | $this->_joinChannel($channel, $password ?? ''); |
| 411 | 411 | } |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | $pong = $this->_writeSocket('PING '.$host); |
| 454 | 454 | |
| 455 | 455 | // Check if there's a connection error. |
| 456 | - if ($pong === false || ((time() - $this->_lastPing) > ($this->_socket_timeout / 2) && ! 0 === strpos($this->_buffer, 'PONG'))) { |
|
| 456 | + if ($pong === false || ((time() - $this->_lastPing) > ($this->_socket_timeout / 2) && !0 === strpos($this->_buffer, 'PONG'))) { |
|
| 457 | 457 | $this->_reconnect(); |
| 458 | 458 | } |
| 459 | 459 | |
@@ -468,12 +468,12 @@ discard block |
||
| 468 | 468 | */ |
| 469 | 469 | protected function _reconnect() |
| 470 | 470 | { |
| 471 | - if (! $this->connect($this->_remote_host, $this->_remote_port, $this->_remote_tls)) { |
|
| 471 | + if (!$this->connect($this->_remote_host, $this->_remote_port, $this->_remote_tls)) { |
|
| 472 | 472 | exit('FATAL: Could not reconnect to ('.$this->_remote_host.') after ('.$this->_reconnectRetries.') tries.'.PHP_EOL); |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | if ($this->_alreadyLoggedIn === false) { |
| 476 | - if (! $this->login($this->_nickName, $this->_userName, $this->_realName, $this->_password)) { |
|
| 476 | + if (!$this->login($this->_nickName, $this->_userName, $this->_realName, $this->_password)) { |
|
| 477 | 477 | exit('FATAL: Could not log in to ('.$this->_remote_host.')!'.PHP_EOL); |
| 478 | 478 | } |
| 479 | 479 | |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | do { |
| 491 | 491 | stream_set_timeout($this->_socket, $this->_socket_timeout); |
| 492 | 492 | $buffer .= fgets($this->_socket, 1024); |
| 493 | - } while (! empty($buffer) && ! preg_match('/\v+$/', $buffer)); |
|
| 493 | + } while (!empty($buffer) && !preg_match('/\v+$/', $buffer)); |
|
| 494 | 494 | $this->_buffer = trim($buffer); |
| 495 | 495 | |
| 496 | 496 | if ($this->_debug && $this->_buffer !== '') { |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | */ |
| 577 | 577 | protected function _connected(): bool |
| 578 | 578 | { |
| 579 | - return \is_resource($this->_socket) && ! feof($this->_socket); |
|
| 579 | + return \is_resource($this->_socket) && !feof($this->_socket); |
|
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | /** |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | public function updatePreDb(array $parameters): void |
| 158 | 158 | { |
| 159 | - if (! empty($parameters)) { |
|
| 159 | + if (!empty($parameters)) { |
|
| 160 | 160 | $this->insertPredb($parameters); |
| 161 | 161 | } |
| 162 | 162 | } |
@@ -217,12 +217,12 @@ discard block |
||
| 217 | 217 | $resultData = []; |
| 218 | 218 | try { |
| 219 | 219 | $query = $this->search->setIndex($rt_index)->option('ranker', 'sph04')->option('sort_method', 'pq')->maxMatches(10000)->limit(10000)->sort('id', 'desc')->stripBadUtf8(true)->trackScores(true); |
| 220 | - if (! empty($searchArray)) { |
|
| 220 | + if (!empty($searchArray)) { |
|
| 221 | 221 | foreach ($searchArray as $key => $value) { |
| 222 | 222 | $query->search('@@relaxed @'.$key.' '.self::escapeString($value)); |
| 223 | 223 | } |
| 224 | - } elseif (! empty($searchString)) { |
|
| 225 | - $searchColumns = ! empty($column) ? '@'.implode('', $column) : ''; |
|
| 224 | + } elseif (!empty($searchString)) { |
|
| 225 | + $searchColumns = !empty($column) ? '@'.implode('', $column) : ''; |
|
| 226 | 226 | $query->search('@@relaxed'.$searchColumns.' '.self::escapeString($searchString)); |
| 227 | 227 | } else { |
| 228 | 228 | return []; |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | $this->config->language = $this->lookuplanguage; |
| 138 | 138 | $this->config->throwHttpExceptions = false; |
| 139 | 139 | $cacheDir = storage_path('framework/cache/imdb_cache'); |
| 140 | - if (! File::isDirectory($cacheDir)) { |
|
| 140 | + if (!File::isDirectory($cacheDir)) { |
|
| 141 | 141 | File::makeDirectory($cacheDir, 0777, false, true); |
| 142 | 142 | } |
| 143 | 143 | $this->config->cachedir = $cacheDir; |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | ORDER BY %s %s %s", |
| 191 | 191 | $this->showPasswords, |
| 192 | 192 | $this->getBrowseBy(), |
| 193 | - (! empty($catsrch) ? $catsrch : ''), |
|
| 193 | + (!empty($catsrch) ? $catsrch : ''), |
|
| 194 | 194 | ( |
| 195 | 195 | $maxAge > 0 |
| 196 | 196 | ? 'AND r.postdate > NOW() - INTERVAL '.$maxAge.'DAY ' |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | Cache::put(md5($moviesSql.$page), $movies, $expiresAt); |
| 211 | 211 | } |
| 212 | 212 | $movieIDs = $releaseIDs = []; |
| 213 | - if (! empty($movies['result'])) { |
|
| 213 | + if (!empty($movies['result'])) { |
|
| 214 | 214 | foreach ($movies['result'] as $movie => $id) { |
| 215 | 215 | $movieIDs[] = $id->imdbid; |
| 216 | 216 | $releaseIDs[] = $id->grp_release_id; |
@@ -249,9 +249,9 @@ discard block |
||
| 249 | 249 | AND r.id IN (%s) %s |
| 250 | 250 | GROUP BY m.imdbid |
| 251 | 251 | ORDER BY %s %s", |
| 252 | - (\is_array($movieIDs) && ! empty($movieIDs) ? implode(',', $movieIDs) : -1), |
|
| 253 | - (\is_array($releaseIDs) && ! empty($releaseIDs) ? implode(',', $releaseIDs) : -1), |
|
| 254 | - (! empty($catsrch) ? $catsrch : ''), |
|
| 252 | + (\is_array($movieIDs) && !empty($movieIDs) ? implode(',', $movieIDs) : -1), |
|
| 253 | + (\is_array($releaseIDs) && !empty($releaseIDs) ? implode(',', $releaseIDs) : -1), |
|
| 254 | + (!empty($catsrch) ? $catsrch : ''), |
|
| 255 | 255 | $order[0], |
| 256 | 256 | $order[1] |
| 257 | 257 | ); |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | $browseBy = ' '; |
| 298 | 298 | $browseByArr = ['title', 'director', 'actors', 'genre', 'rating', 'year', 'imdb']; |
| 299 | 299 | foreach ($browseByArr as $bb) { |
| 300 | - if (request()->has($bb) && ! empty(request()->input($bb))) { |
|
| 300 | + if (request()->has($bb) && !empty(request()->input($bb))) { |
|
| 301 | 301 | $bbv = stripslashes(request()->input($bb)); |
| 302 | 302 | if ($bb === 'rating') { |
| 303 | 303 | $bbv .= '.'; |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | |
| 331 | 331 | if ($this->traktcheck !== null) { |
| 332 | 332 | $data = $this->traktTv->client->movieSummary('tt'.$imdbId, 'full'); |
| 333 | - if (($data !== false) && ! empty($data['trailer'])) { |
|
| 333 | + if (($data !== false) && !empty($data['trailer'])) { |
|
| 334 | 334 | return $data['trailer']; |
| 335 | 335 | } |
| 336 | 336 | } |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | return false; |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | - if (! empty($data['trailer'])) { |
|
| 359 | + if (!empty($data['trailer'])) { |
|
| 360 | 360 | $data['trailer'] = str_ireplace( |
| 361 | 361 | ['watch?v=', 'http://'], |
| 362 | 362 | ['embed/', 'https://'], |
@@ -390,17 +390,17 @@ discard block |
||
| 390 | 390 | */ |
| 391 | 391 | private function checkTraktValue($value) |
| 392 | 392 | { |
| 393 | - if (\is_array($value) && ! empty($value)) { |
|
| 393 | + if (\is_array($value) && !empty($value)) { |
|
| 394 | 394 | $temp = ''; |
| 395 | 395 | foreach ($value as $val) { |
| 396 | - if (! \is_array($val) && ! \is_object($val)) { |
|
| 396 | + if (!\is_array($val) && !\is_object($val)) { |
|
| 397 | 397 | $temp .= $val; |
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | 400 | $value = $temp; |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | - return ! empty($value) ? $value : ''; |
|
| 403 | + return !empty($value) ? $value : ''; |
|
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | /** |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | */ |
| 422 | 422 | public function update(array $values): bool |
| 423 | 423 | { |
| 424 | - if (! \count($values)) { |
|
| 424 | + if (!\count($values)) { |
|
| 425 | 425 | return false; |
| 426 | 426 | } |
| 427 | 427 | |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | $onDuplicateKey = ['created_at' => now()]; |
| 430 | 430 | $found = 0; |
| 431 | 431 | foreach ($values as $key => $value) { |
| 432 | - if (! empty($value)) { |
|
| 432 | + if (!empty($value)) { |
|
| 433 | 433 | $found++; |
| 434 | 434 | if (\in_array($key, ['genre', 'language'], false)) { |
| 435 | 435 | $value = substr($value, 0, 64); |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | $onDuplicateKey += [$key => $value]; |
| 439 | 439 | } |
| 440 | 440 | } |
| 441 | - if (! $found) { |
|
| 441 | + if (!$found) { |
|
| 442 | 442 | return false; |
| 443 | 443 | } |
| 444 | 444 | foreach ($query as $key => $value) { |
@@ -455,19 +455,19 @@ discard block |
||
| 455 | 455 | */ |
| 456 | 456 | protected function setVariables(string|array $variable1, string|array $variable2, string|array $variable3, string|array $variable4, string|array $variable5) |
| 457 | 457 | { |
| 458 | - if (! empty($variable1)) { |
|
| 458 | + if (!empty($variable1)) { |
|
| 459 | 459 | return $variable1; |
| 460 | 460 | } |
| 461 | - if (! empty($variable2)) { |
|
| 461 | + if (!empty($variable2)) { |
|
| 462 | 462 | return $variable2; |
| 463 | 463 | } |
| 464 | - if (! empty($variable3)) { |
|
| 464 | + if (!empty($variable3)) { |
|
| 465 | 465 | return $variable3; |
| 466 | 466 | } |
| 467 | - if (! empty($variable4)) { |
|
| 467 | + if (!empty($variable4)) { |
|
| 468 | 468 | return $variable4; |
| 469 | 469 | } |
| 470 | - if (! empty($variable5)) { |
|
| 470 | + if (!empty($variable5)) { |
|
| 471 | 471 | return $variable5; |
| 472 | 472 | } |
| 473 | 473 | |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | |
| 503 | 503 | $iTunes = $this->fetchItunesMovieProperties($this->currentTitle); |
| 504 | 504 | |
| 505 | - if (! $imdb && ! $tmdb && ! $trakt && ! $omdb && empty($iTunes)) { |
|
| 505 | + if (!$imdb && !$tmdb && !$trakt && !$omdb && empty($iTunes)) { |
|
| 506 | 506 | return false; |
| 507 | 507 | } |
| 508 | 508 | |
@@ -515,36 +515,36 @@ discard block |
||
| 515 | 515 | $mov['type'] = $mov['director'] = $mov['actors'] = $mov['language'] = ''; |
| 516 | 516 | |
| 517 | 517 | $mov['imdbid'] = $imdbId; |
| 518 | - $mov['tmdbid'] = (! isset($tmdb['tmdbid']) || $tmdb['tmdbid'] === '') ? 0 : $tmdb['tmdbid']; |
|
| 519 | - $mov['traktid'] = (! isset($trakt['id']) || $trakt['id'] === '') ? 0 : $trakt['id']; |
|
| 518 | + $mov['tmdbid'] = (!isset($tmdb['tmdbid']) || $tmdb['tmdbid'] === '') ? 0 : $tmdb['tmdbid']; |
|
| 519 | + $mov['traktid'] = (!isset($trakt['id']) || $trakt['id'] === '') ? 0 : $trakt['id']; |
|
| 520 | 520 | |
| 521 | 521 | // Prefer Fanart.tv cover over TMDB,TMDB over IMDB,IMDB over OMDB and OMDB over iTunes. |
| 522 | - if (! empty($fanart['cover'])) { |
|
| 522 | + if (!empty($fanart['cover'])) { |
|
| 523 | 523 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $fanart['cover'], $this->imgSavePath); |
| 524 | - } elseif (! empty($tmdb['cover'])) { |
|
| 524 | + } elseif (!empty($tmdb['cover'])) { |
|
| 525 | 525 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $tmdb['cover'], $this->imgSavePath); |
| 526 | - } elseif (! empty($imdb['cover'])) { |
|
| 526 | + } elseif (!empty($imdb['cover'])) { |
|
| 527 | 527 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $imdb['cover'], $this->imgSavePath); |
| 528 | - } elseif (! empty($omdb['cover'])) { |
|
| 528 | + } elseif (!empty($omdb['cover'])) { |
|
| 529 | 529 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $omdb['cover'], $this->imgSavePath); |
| 530 | - } elseif (! empty($iTunes['cover'])) { |
|
| 530 | + } elseif (!empty($iTunes['cover'])) { |
|
| 531 | 531 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $iTunes['cover'], $this->imgSavePath); |
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | // Backdrops. |
| 535 | - if (! empty($fanart['backdrop'])) { |
|
| 535 | + if (!empty($fanart['backdrop'])) { |
|
| 536 | 536 | $mov['backdrop'] = $this->releaseImage->saveImage($imdbId.'-backdrop', $fanart['backdrop'], $this->imgSavePath, 1920, 1024); |
| 537 | - } elseif (! empty($tmdb['backdrop'])) { |
|
| 537 | + } elseif (!empty($tmdb['backdrop'])) { |
|
| 538 | 538 | $mov['backdrop'] = $this->releaseImage->saveImage($imdbId.'-backdrop', $tmdb['backdrop'], $this->imgSavePath, 1920, 1024); |
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | // Banner |
| 542 | - if (! empty($fanart['banner'])) { |
|
| 542 | + if (!empty($fanart['banner'])) { |
|
| 543 | 543 | $mov['banner'] = $this->releaseImage->saveImage($imdbId.'-banner', $fanart['banner'], $this->imgSavePath); |
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | // RottenTomatoes rating from OmdbAPI |
| 547 | - if ($omdb !== false && ! empty($omdb['rtRating'])) { |
|
| 547 | + if ($omdb !== false && !empty($omdb['rtRating'])) { |
|
| 548 | 548 | $mov['rtrating'] = $omdb['rtRating']; |
| 549 | 549 | } |
| 550 | 550 | |
@@ -555,29 +555,29 @@ discard block |
||
| 555 | 555 | $mov['year'] = $this->setVariables($imdb['year'] ?? '', $tmdb['year'] ?? '', $trakt['year'] ?? '', $omdb['year'] ?? '', $iTunes['year'] ?? ''); |
| 556 | 556 | $mov['genre'] = $this->setVariables($imdb['genre'] ?? '', $tmdb['genre'] ?? '', $trakt['genres'] ?? '', $omdb['genre'] ?? '', $iTunes['genre'] ?? ''); |
| 557 | 557 | |
| 558 | - if (! empty($imdb['type'])) { |
|
| 558 | + if (!empty($imdb['type'])) { |
|
| 559 | 559 | $mov['type'] = $imdb['type']; |
| 560 | 560 | } |
| 561 | 561 | |
| 562 | - if (! empty($imdb['director'])) { |
|
| 562 | + if (!empty($imdb['director'])) { |
|
| 563 | 563 | $mov['director'] = \is_array($imdb['director']) ? implode(', ', array_unique($imdb['director'])) : $imdb['director']; |
| 564 | - } elseif (! empty($omdb['director'])) { |
|
| 564 | + } elseif (!empty($omdb['director'])) { |
|
| 565 | 565 | $mov['director'] = \is_array($omdb['director']) ? implode(', ', array_unique($omdb['director'])) : $omdb['director']; |
| 566 | - } elseif (! empty($tmdb['director'])) { |
|
| 566 | + } elseif (!empty($tmdb['director'])) { |
|
| 567 | 567 | $mov['director'] = \is_array($tmdb['director']) ? implode(', ', array_unique($tmdb['director'])) : $tmdb['director']; |
| 568 | 568 | } |
| 569 | 569 | |
| 570 | - if (! empty($imdb['actors'])) { |
|
| 570 | + if (!empty($imdb['actors'])) { |
|
| 571 | 571 | $mov['actors'] = \is_array($imdb['actors']) ? implode(', ', array_unique($imdb['actors'])) : $imdb['actors']; |
| 572 | - } elseif (! empty($omdb['actors'])) { |
|
| 572 | + } elseif (!empty($omdb['actors'])) { |
|
| 573 | 573 | $mov['actors'] = \is_array($omdb['actors']) ? implode(', ', array_unique($omdb['actors'])) : $omdb['actors']; |
| 574 | - } elseif (! empty($tmdb['actors'])) { |
|
| 574 | + } elseif (!empty($tmdb['actors'])) { |
|
| 575 | 575 | $mov['actors'] = \is_array($tmdb['actors']) ? implode(', ', array_unique($tmdb['actors'])) : $tmdb['actors']; |
| 576 | 576 | } |
| 577 | 577 | |
| 578 | - if (! empty($imdb['language'])) { |
|
| 578 | + if (!empty($imdb['language'])) { |
|
| 579 | 579 | $mov['language'] = \is_array($imdb['language']) ? implode(', ', array_unique($imdb['language'])) : $imdb['language']; |
| 580 | - } elseif (! empty($omdb['language']) && ! is_bool($omdb['language'])) { |
|
| 580 | + } elseif (!empty($omdb['language']) && !is_bool($omdb['language'])) { |
|
| 581 | 581 | $mov['language'] = \is_array($omdb['language']) ? implode(', ', array_unique($omdb['language'])) : $omdb['language']; |
| 582 | 582 | } |
| 583 | 583 | |
@@ -635,20 +635,20 @@ discard block |
||
| 635 | 635 | if ($this->fanartapikey !== null) { |
| 636 | 636 | $art = $this->fanart->getMovieFanArt('tt'.$imdbId); |
| 637 | 637 | |
| 638 | - if (! empty($art)) { |
|
| 638 | + if (!empty($art)) { |
|
| 639 | 639 | if (isset($art['status']) && $art['status'] === 'error') { |
| 640 | 640 | return false; |
| 641 | 641 | } |
| 642 | 642 | $ret = []; |
| 643 | - if (! empty($art['moviebackground'][0]['url'])) { |
|
| 643 | + if (!empty($art['moviebackground'][0]['url'])) { |
|
| 644 | 644 | $ret['backdrop'] = $art['moviebackground'][0]['url']; |
| 645 | - } elseif (! empty($art['moviethumb'][0]['url'])) { |
|
| 645 | + } elseif (!empty($art['moviethumb'][0]['url'])) { |
|
| 646 | 646 | $ret['backdrop'] = $art['moviethumb'][0]['url']; |
| 647 | 647 | } |
| 648 | - if (! empty($art['movieposter'][0]['url'])) { |
|
| 648 | + if (!empty($art['movieposter'][0]['url'])) { |
|
| 649 | 649 | $ret['cover'] = $art['movieposter'][0]['url']; |
| 650 | 650 | } |
| 651 | - if (! empty($art['moviebanner'][0]['url'])) { |
|
| 651 | + if (!empty($art['moviebanner'][0]['url'])) { |
|
| 652 | 652 | $ret['banner'] = $art['moviebanner'][0]['url']; |
| 653 | 653 | } |
| 654 | 654 | |
@@ -685,7 +685,7 @@ discard block |
||
| 685 | 685 | return false; |
| 686 | 686 | } |
| 687 | 687 | |
| 688 | - if (! empty($tmdbLookup)) { |
|
| 688 | + if (!empty($tmdbLookup)) { |
|
| 689 | 689 | if ($this->currentTitle !== '') { |
| 690 | 690 | // Check the similarity. |
| 691 | 691 | similar_text($this->currentTitle, $tmdbLookup['title'], $percent); |
@@ -714,7 +714,7 @@ discard block |
||
| 714 | 714 | $ret['rating'] = ''; |
| 715 | 715 | } |
| 716 | 716 | $actors = Arr::pluck($tmdbLookup['credits']['cast'], 'name'); |
| 717 | - if (! empty($actors)) { |
|
| 717 | + if (!empty($actors)) { |
|
| 718 | 718 | $ret['actors'] = $actors; |
| 719 | 719 | } else { |
| 720 | 720 | $ret['actors'] = ''; |
@@ -725,7 +725,7 @@ discard block |
||
| 725 | 725 | } |
| 726 | 726 | } |
| 727 | 727 | $overview = $tmdbLookup['overview']; |
| 728 | - if (! empty($overview)) { |
|
| 728 | + if (!empty($overview)) { |
|
| 729 | 729 | $ret['plot'] = $overview; |
| 730 | 730 | } else { |
| 731 | 731 | $ret['plot'] = ''; |
@@ -735,13 +735,13 @@ discard block |
||
| 735 | 735 | $ret['tagline'] = $tagline ?? ''; |
| 736 | 736 | |
| 737 | 737 | $released = $tmdbLookup['release_date']; |
| 738 | - if (! empty($released)) { |
|
| 738 | + if (!empty($released)) { |
|
| 739 | 739 | $ret['year'] = Carbon::parse($released)->year; |
| 740 | 740 | } else { |
| 741 | 741 | $ret['year'] = ''; |
| 742 | 742 | } |
| 743 | 743 | $genresa = $tmdbLookup['genres']; |
| 744 | - if (! empty($genresa) && \count($genresa) > 0) { |
|
| 744 | + if (!empty($genresa) && \count($genresa) > 0) { |
|
| 745 | 745 | $genres = []; |
| 746 | 746 | foreach ($genresa as $genre) { |
| 747 | 747 | $genres[] = $genre['name']; |
@@ -751,13 +751,13 @@ discard block |
||
| 751 | 751 | $ret['genre'] = ''; |
| 752 | 752 | } |
| 753 | 753 | $posterp = $tmdbLookup['poster_path']; |
| 754 | - if (! empty($posterp)) { |
|
| 754 | + if (!empty($posterp)) { |
|
| 755 | 755 | $ret['cover'] = 'https://image.tmdb.org/t/p/original'.$posterp; |
| 756 | 756 | } else { |
| 757 | 757 | $ret['cover'] = ''; |
| 758 | 758 | } |
| 759 | 759 | $backdrop = $tmdbLookup['backdrop_path']; |
| 760 | - if (! empty($backdrop)) { |
|
| 760 | + if (!empty($backdrop)) { |
|
| 761 | 761 | $ret['backdrop'] = 'https://image.tmdb.org/t/p/original'.$backdrop; |
| 762 | 762 | } else { |
| 763 | 763 | $ret['backdrop'] = ''; |
@@ -779,9 +779,9 @@ discard block |
||
| 779 | 779 | { |
| 780 | 780 | $realId = (new Title($imdbId, $this->config))->real_id(); |
| 781 | 781 | $result = new Title($realId, $this->config); |
| 782 | - $title = ! empty($result->orig_title()) ? $result->orig_title() : $result->title(); |
|
| 783 | - if (! empty($title)) { |
|
| 784 | - if (! empty($this->currentTitle)) { |
|
| 782 | + $title = !empty($result->orig_title()) ? $result->orig_title() : $result->title(); |
|
| 783 | + if (!empty($title)) { |
|
| 784 | + if (!empty($this->currentTitle)) { |
|
| 785 | 785 | similar_text($this->currentTitle, $title, $percent); |
| 786 | 786 | if ($percent >= self::MATCH_PERCENT) { |
| 787 | 787 | similar_text($this->currentYear, $result->year(), $percent); |
@@ -790,7 +790,7 @@ discard block |
||
| 790 | 790 | 'title' => $title, |
| 791 | 791 | 'tagline' => $result->tagline() ?? '', |
| 792 | 792 | 'plot' => Arr::get($result->plot_split(), '0.plot'), |
| 793 | - 'rating' => ! empty($result->rating()) ? $result->rating() : '', |
|
| 793 | + 'rating' => !empty($result->rating()) ? $result->rating() : '', |
|
| 794 | 794 | 'year' => $result->year() ?? '', |
| 795 | 795 | 'cover' => $result->photo() ?? '', |
| 796 | 796 | 'genre' => $result->genre() ?? '', |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | 'title' => $title, |
| 816 | 816 | 'tagline' => $result->tagline() ?? '', |
| 817 | 817 | 'plot' => Arr::get($result->plot_split(), '0.plot'), |
| 818 | - 'rating' => ! empty($result->rating()) ? $result->rating() : '', |
|
| 818 | + 'rating' => !empty($result->rating()) ? $result->rating() : '', |
|
| 819 | 819 | 'year' => $result->year() ?? '', |
| 820 | 820 | 'cover' => $result->photo() ?? '', |
| 821 | 821 | 'genre' => $result->genre() ?? '', |
@@ -889,7 +889,7 @@ discard block |
||
| 889 | 889 | if ($this->omdbapikey !== null) { |
| 890 | 890 | $resp = $this->omdbApi->fetch('i', 'tt'.$imdbId); |
| 891 | 891 | |
| 892 | - if (\is_object($resp) && $resp->message === 'OK' && ! Str::contains($resp->data->Response, 'Error:') && $resp->data->Response !== 'False') { |
|
| 892 | + if (\is_object($resp) && $resp->message === 'OK' && !Str::contains($resp->data->Response, 'Error:') && $resp->data->Response !== 'False') { |
|
| 893 | 893 | similar_text($this->currentTitle, $resp->data->Title, $percent); |
| 894 | 894 | if ($percent >= self::MATCH_PERCENT) { |
| 895 | 895 | similar_text($this->currentYear, $resp->data->Year, $percent); |
@@ -1055,7 +1055,7 @@ discard block |
||
| 1055 | 1055 | // Loop over releases. |
| 1056 | 1056 | foreach ($res as $arr) { |
| 1057 | 1057 | // Try to get a name/year. |
| 1058 | - if (! $this->parseMovieSearchName($arr['searchname'])) { |
|
| 1058 | + if (!$this->parseMovieSearchName($arr['searchname'])) { |
|
| 1059 | 1059 | //We didn't find a name, so set to all 0's so we don't parse again. |
| 1060 | 1060 | Release::query()->where('id', $arr['id'])->update(['imdbid' => 0000000]); |
| 1061 | 1061 | |
@@ -1089,7 +1089,7 @@ discard block |
||
| 1089 | 1089 | $imdbSearch = new TitleSearch($this->config); |
| 1090 | 1090 | foreach ($imdbSearch->search($this->currentTitle, [TitleSearch::MOVIE]) as $imdbTitle) { |
| 1091 | 1091 | try { |
| 1092 | - if (! empty($imdbTitle->orig_title())) { |
|
| 1092 | + if (!empty($imdbTitle->orig_title())) { |
|
| 1093 | 1093 | similar_text($imdbTitle->orig_title(), $this->currentTitle, $percent); |
| 1094 | 1094 | if ($percent >= self::MATCH_PERCENT) { |
| 1095 | 1095 | similar_text($this->currentYear, $imdbTitle->year(), $percent); |
@@ -1119,10 +1119,10 @@ discard block |
||
| 1119 | 1119 | $buffer = $this->omdbApi->search($omdbTitle, 'movie'); |
| 1120 | 1120 | } |
| 1121 | 1121 | |
| 1122 | - if (\is_object($buffer) && $buffer->message === 'OK' && ! Str::contains($buffer->data->Response, 'Error:') && $buffer->data->Response === 'True') { |
|
| 1122 | + if (\is_object($buffer) && $buffer->message === 'OK' && !Str::contains($buffer->data->Response, 'Error:') && $buffer->data->Response === 'True') { |
|
| 1123 | 1123 | $getIMDBid = $buffer->data->Search[0]->imdbID; |
| 1124 | 1124 | |
| 1125 | - if (! empty($getIMDBid)) { |
|
| 1125 | + if (!empty($getIMDBid)) { |
|
| 1126 | 1126 | $imdbId = $this->doMovieUpdate($getIMDBid, 'OMDbAPI', $arr['id']); |
| 1127 | 1127 | if ($imdbId !== false) { |
| 1128 | 1128 | $movieUpdated = true; |
@@ -1137,7 +1137,7 @@ discard block |
||
| 1137 | 1137 | $data = $this->traktTv->client->movieSummary($movieName, 'full'); |
| 1138 | 1138 | if ($data !== false) { |
| 1139 | 1139 | $this->parseTraktTv($data); |
| 1140 | - if (! empty($data['ids']['imdb'])) { |
|
| 1140 | + if (!empty($data['ids']['imdb'])) { |
|
| 1141 | 1141 | $imdbId = $this->doMovieUpdate($data['ids']['imdb'], 'Trakt', $arr['id']); |
| 1142 | 1142 | if ($imdbId !== false) { |
| 1143 | 1143 | $movieUpdated = true; |
@@ -1150,13 +1150,13 @@ discard block |
||
| 1150 | 1150 | if ($movieUpdated === false) { |
| 1151 | 1151 | try { |
| 1152 | 1152 | $data = Tmdb::getSearchApi()->searchMovies($this->currentTitle); |
| 1153 | - if (($data['total_results'] > 0) && ! empty($data['results'])) { |
|
| 1153 | + if (($data['total_results'] > 0) && !empty($data['results'])) { |
|
| 1154 | 1154 | foreach ($data['results'] as $result) { |
| 1155 | - if (! empty($result['id']) && ! empty($result['release_date'])) { |
|
| 1155 | + if (!empty($result['id']) && !empty($result['release_date'])) { |
|
| 1156 | 1156 | similar_text($this->currentYear, Carbon::parse($result['release_date'])->year, $percent); |
| 1157 | 1157 | if ($percent >= self::YEAR_MATCH_PERCENT) { |
| 1158 | 1158 | $ret = $this->fetchTMDBProperties($result['id'], true); |
| 1159 | - if ($ret !== false && ! empty($ret['imdbid'])) { |
|
| 1159 | + if ($ret !== false && !empty($ret['imdbid'])) { |
|
| 1160 | 1160 | $imdbId = $this->doMovieUpdate('tt'.$ret['imdbid'], 'TMDB', $arr['id']); |
| 1161 | 1161 | if ($imdbId !== false) { |
| 1162 | 1162 | $movieUpdated = true; |
@@ -1235,7 +1235,7 @@ discard block |
||
| 1235 | 1235 | // Finally remove multiple spaces and trim leading spaces. |
| 1236 | 1236 | $name = trim(preg_replace('/\s{2,}/', ' ', $name)); |
| 1237 | 1237 | // Check if the name is long enough and not just numbers. |
| 1238 | - if (\strlen($name) > 4 && ! preg_match('/^\d+$/', $name)) { |
|
| 1238 | + if (\strlen($name) > 4 && !preg_match('/^\d+$/', $name)) { |
|
| 1239 | 1239 | $this->currentTitle = $name; |
| 1240 | 1240 | $this->currentYear = $year; |
| 1241 | 1241 | |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | $channels = config('irc_settings.scrape_irc_channels') ? unserialize(config('irc_settings.scrape_irc_channels'), ['allowed_classes' => ['#PreNNTmux', '#nZEDbPRE']]) : ['#PreNNTmux' => null]; |
| 174 | 174 | $this->joinChannels($channels); |
| 175 | 175 | |
| 176 | - if (! $this->_silent) { |
|
| 176 | + if (!$this->_silent) { |
|
| 177 | 177 | echo '['. |
| 178 | 178 | date('r'). |
| 179 | 179 | '] [Scraping of IRC channels for ('. |
@@ -291,34 +291,34 @@ discard block |
||
| 291 | 291 | } else { |
| 292 | 292 | $indexData = $this->manticoreSearch->searchIndexes('predb_rt', $this->_curPre['title'], ['title']); |
| 293 | 293 | } |
| 294 | - if (! empty($indexData) || empty($this->_curPre['title'])) { |
|
| 294 | + if (!empty($indexData) || empty($this->_curPre['title'])) { |
|
| 295 | 295 | return; |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | $query = 'INSERT INTO predb ('; |
| 299 | 299 | |
| 300 | - $query .= (! empty($this->_curPre['size']) ? 'size, ' : ''); |
|
| 301 | - $query .= (! empty($this->_curPre['category']) ? 'category, ' : ''); |
|
| 302 | - $query .= (! empty($this->_curPre['source']) ? 'source, ' : ''); |
|
| 303 | - $query .= (! empty($this->_curPre['reason']) ? 'nukereason, ' : ''); |
|
| 304 | - $query .= (! empty($this->_curPre['files']) ? 'files, ' : ''); |
|
| 305 | - $query .= (! empty($this->_curPre['reqid']) ? 'requestid, ' : ''); |
|
| 306 | - $query .= (! empty($this->_curPre['group_id']) ? 'groups_id, ' : ''); |
|
| 307 | - $query .= (! empty($this->_curPre['nuked']) ? 'nuked, ' : ''); |
|
| 308 | - $query .= (! empty($this->_curPre['filename']) ? 'filename, ' : ''); |
|
| 300 | + $query .= (!empty($this->_curPre['size']) ? 'size, ' : ''); |
|
| 301 | + $query .= (!empty($this->_curPre['category']) ? 'category, ' : ''); |
|
| 302 | + $query .= (!empty($this->_curPre['source']) ? 'source, ' : ''); |
|
| 303 | + $query .= (!empty($this->_curPre['reason']) ? 'nukereason, ' : ''); |
|
| 304 | + $query .= (!empty($this->_curPre['files']) ? 'files, ' : ''); |
|
| 305 | + $query .= (!empty($this->_curPre['reqid']) ? 'requestid, ' : ''); |
|
| 306 | + $query .= (!empty($this->_curPre['group_id']) ? 'groups_id, ' : ''); |
|
| 307 | + $query .= (!empty($this->_curPre['nuked']) ? 'nuked, ' : ''); |
|
| 308 | + $query .= (!empty($this->_curPre['filename']) ? 'filename, ' : ''); |
|
| 309 | 309 | |
| 310 | 310 | $query .= 'predate, title) VALUES ('; |
| 311 | 311 | |
| 312 | - $query .= (! empty($this->_curPre['size']) ? escapeString($this->_curPre['size']).', ' : ''); |
|
| 313 | - $query .= (! empty($this->_curPre['category']) ? escapeString($this->_curPre['category']).', ' : ''); |
|
| 314 | - $query .= (! empty($this->_curPre['source']) ? escapeString($this->_curPre['source']).', ' : ''); |
|
| 315 | - $query .= (! empty($this->_curPre['reason']) ? escapeString($this->_curPre['reason']).', ' : ''); |
|
| 316 | - $query .= (! empty($this->_curPre['files']) ? escapeString($this->_curPre['files']).', ' : ''); |
|
| 317 | - $query .= (! empty($this->_curPre['reqid']) ? $this->_curPre['reqid'].', ' : ''); |
|
| 318 | - $query .= (! empty($this->_curPre['group_id']) ? $this->_curPre['group_id'].', ' : ''); |
|
| 319 | - $query .= (! empty($this->_curPre['nuked']) ? $this->_curPre['nuked'].', ' : ''); |
|
| 320 | - $query .= (! empty($this->_curPre['filename']) ? escapeString($this->_curPre['filename']).', ' : ''); |
|
| 321 | - $query .= (! empty($this->_curPre['predate']) ? $this->_curPre['predate'].', ' : 'NOW(), '); |
|
| 312 | + $query .= (!empty($this->_curPre['size']) ? escapeString($this->_curPre['size']).', ' : ''); |
|
| 313 | + $query .= (!empty($this->_curPre['category']) ? escapeString($this->_curPre['category']).', ' : ''); |
|
| 314 | + $query .= (!empty($this->_curPre['source']) ? escapeString($this->_curPre['source']).', ' : ''); |
|
| 315 | + $query .= (!empty($this->_curPre['reason']) ? escapeString($this->_curPre['reason']).', ' : ''); |
|
| 316 | + $query .= (!empty($this->_curPre['files']) ? escapeString($this->_curPre['files']).', ' : ''); |
|
| 317 | + $query .= (!empty($this->_curPre['reqid']) ? $this->_curPre['reqid'].', ' : ''); |
|
| 318 | + $query .= (!empty($this->_curPre['group_id']) ? $this->_curPre['group_id'].', ' : ''); |
|
| 319 | + $query .= (!empty($this->_curPre['nuked']) ? $this->_curPre['nuked'].', ' : ''); |
|
| 320 | + $query .= (!empty($this->_curPre['filename']) ? escapeString($this->_curPre['filename']).', ' : ''); |
|
| 321 | + $query .= (!empty($this->_curPre['predate']) ? $this->_curPre['predate'].', ' : 'NOW(), '); |
|
| 322 | 322 | |
| 323 | 323 | $query .= '%s)'; |
| 324 | 324 | |
@@ -359,17 +359,17 @@ discard block |
||
| 359 | 359 | |
| 360 | 360 | $query = 'UPDATE predb SET '; |
| 361 | 361 | |
| 362 | - $query .= (! empty($this->_curPre['size']) ? 'size = '.escapeString($this->_curPre['size']).', ' : ''); |
|
| 363 | - $query .= (! empty($this->_curPre['source']) ? 'source = '.escapeString($this->_curPre['source']).', ' : ''); |
|
| 364 | - $query .= (! empty($this->_curPre['files']) ? 'files = '.escapeString($this->_curPre['files']).', ' : ''); |
|
| 365 | - $query .= (! empty($this->_curPre['reason']) ? 'nukereason = '.escapeString($this->_curPre['reason']).', ' : ''); |
|
| 366 | - $query .= (! empty($this->_curPre['reqid']) ? 'requestid = '.$this->_curPre['reqid'].', ' : ''); |
|
| 367 | - $query .= (! empty($this->_curPre['group_id']) ? 'groups_id = '.$this->_curPre['group_id'].', ' : ''); |
|
| 368 | - $query .= (! empty($this->_curPre['predate']) ? 'predate = '.$this->_curPre['predate'].', ' : ''); |
|
| 369 | - $query .= (! empty($this->_curPre['nuked']) ? 'nuked = '.$this->_curPre['nuked'].', ' : ''); |
|
| 370 | - $query .= (! empty($this->_curPre['filename']) ? 'filename = '.escapeString($this->_curPre['filename']).', ' : ''); |
|
| 362 | + $query .= (!empty($this->_curPre['size']) ? 'size = '.escapeString($this->_curPre['size']).', ' : ''); |
|
| 363 | + $query .= (!empty($this->_curPre['source']) ? 'source = '.escapeString($this->_curPre['source']).', ' : ''); |
|
| 364 | + $query .= (!empty($this->_curPre['files']) ? 'files = '.escapeString($this->_curPre['files']).', ' : ''); |
|
| 365 | + $query .= (!empty($this->_curPre['reason']) ? 'nukereason = '.escapeString($this->_curPre['reason']).', ' : ''); |
|
| 366 | + $query .= (!empty($this->_curPre['reqid']) ? 'requestid = '.$this->_curPre['reqid'].', ' : ''); |
|
| 367 | + $query .= (!empty($this->_curPre['group_id']) ? 'groups_id = '.$this->_curPre['group_id'].', ' : ''); |
|
| 368 | + $query .= (!empty($this->_curPre['predate']) ? 'predate = '.$this->_curPre['predate'].', ' : ''); |
|
| 369 | + $query .= (!empty($this->_curPre['nuked']) ? 'nuked = '.$this->_curPre['nuked'].', ' : ''); |
|
| 370 | + $query .= (!empty($this->_curPre['filename']) ? 'filename = '.escapeString($this->_curPre['filename']).', ' : ''); |
|
| 371 | 371 | $query .= ( |
| 372 | - (empty($this->_oldPre['category']) && ! empty($this->_curPre['category'])) |
|
| 372 | + (empty($this->_oldPre['category']) && !empty($this->_curPre['category'])) |
|
| 373 | 373 | ? 'category = '.escapeString($this->_curPre['category']).', ' |
| 374 | 374 | : '' |
| 375 | 375 | ); |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | */ |
| 405 | 405 | protected function _doEcho(bool $new = true): void |
| 406 | 406 | { |
| 407 | - if (! $this->_silent) { |
|
| 407 | + if (!$this->_silent) { |
|
| 408 | 408 | $nukeString = ''; |
| 409 | 409 | if ($this->_nuked !== false) { |
| 410 | 410 | switch ((int) $this->_curPre['nuked']) { |
@@ -439,15 +439,15 @@ discard block |
||
| 439 | 439 | $this->_curPre['title']. |
| 440 | 440 | ']'. |
| 441 | 441 | ( |
| 442 | - ! empty($this->_curPre['category']) |
|
| 442 | + !empty($this->_curPre['category']) |
|
| 443 | 443 | ? ' ['.$this->_curPre['category'].']' |
| 444 | 444 | : ( |
| 445 | - ! empty($this->_oldPre['category']) |
|
| 445 | + !empty($this->_oldPre['category']) |
|
| 446 | 446 | ? ' ['.$this->_oldPre['category'].']' |
| 447 | 447 | : '' |
| 448 | 448 | ) |
| 449 | 449 | ). |
| 450 | - (! empty($this->_curPre['size']) ? ' ['.$this->_curPre['size'].']' : ''). |
|
| 450 | + (!empty($this->_curPre['size']) ? ' ['.$this->_curPre['size'].']' : ''). |
|
| 451 | 451 | PHP_EOL; |
| 452 | 452 | } |
| 453 | 453 | } |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | */ |
| 458 | 458 | protected function _getGroupID(string $groupName): mixed |
| 459 | 459 | { |
| 460 | - if (! isset($this->_groupList[$groupName])) { |
|
| 460 | + if (!isset($this->_groupList[$groupName])) { |
|
| 461 | 461 | $group = UsenetGroup::query()->where('name', $groupName)->first(['id']); |
| 462 | 462 | $this->_groupList[$groupName] = $group !== null ? $group['id'] : ''; |
| 463 | 463 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | ]; |
| 152 | 152 | $primaryConnections = $this->_tmux->getUSPConnections('primary', $primaryUSP); |
| 153 | 153 | $alternateConnections = $this->_tmux->getUSPConnections('alternate', $alternateUSP); |
| 154 | - if ($this->_isConnected() && (($alternate && $this->_currentServer === config('nntmux_nntp.alternate_server') && ($this->_primaryNntpConnections < $alternateConnections['alternate']['active'])) || (! $alternate && $this->_currentServer === config('nntmux_nntp.server') && ($this->_primaryNntpConnections < $primaryConnections['primary']['active'])))) { |
|
| 154 | + if ($this->_isConnected() && (($alternate && $this->_currentServer === config('nntmux_nntp.alternate_server') && ($this->_primaryNntpConnections < $alternateConnections['alternate']['active'])) || (!$alternate && $this->_currentServer === config('nntmux_nntp.server') && ($this->_primaryNntpConnections < $primaryConnections['primary']['active'])))) { |
|
| 155 | 155 | return true; |
| 156 | 156 | } |
| 157 | 157 | |
@@ -160,20 +160,20 @@ discard block |
||
| 160 | 160 | $ret = $connected = $cError = $aError = false; |
| 161 | 161 | |
| 162 | 162 | // Set variables to connect based on if we are using the alternate provider or not. |
| 163 | - if (! $alternate) { |
|
| 163 | + if (!$alternate) { |
|
| 164 | 164 | $sslEnabled = (bool) config('nntmux_nntp.ssl'); |
| 165 | 165 | $this->_currentServer = config('nntmux_nntp.server'); |
| 166 | 166 | $this->_currentPort = config('nntmux_nntp.port'); |
| 167 | 167 | $userName = config('nntmux_nntp.username'); |
| 168 | 168 | $password = config('nntmux_nntp.password'); |
| 169 | - $socketTimeout = ! empty(config('nntmux_nntp.socket_timeout')) ? config('nntmux_nntp.socket_timeout') : $this->_socketTimeout; |
|
| 169 | + $socketTimeout = !empty(config('nntmux_nntp.socket_timeout')) ? config('nntmux_nntp.socket_timeout') : $this->_socketTimeout; |
|
| 170 | 170 | } else { |
| 171 | 171 | $sslEnabled = (bool) config('nntmux_nntp.alternate_server_ssl'); |
| 172 | 172 | $this->_currentServer = config('nntmux_nntp.alternate_server'); |
| 173 | 173 | $this->_currentPort = config('nntmux_nntp.alternate_server_port'); |
| 174 | 174 | $userName = config('nntmux_nntp.alternate_server_username'); |
| 175 | 175 | $password = config('nntmux_nntp.alternate_server_password'); |
| 176 | - $socketTimeout = ! empty(config('nntmux_nntp.alternate_server_socket_timeout')) ? config('nntmux_nntp.alternate_server_socket_timeout') : $this->_socketTimeout; |
|
| 176 | + $socketTimeout = !empty(config('nntmux_nntp.alternate_server_socket_timeout')) ? config('nntmux_nntp.alternate_server_socket_timeout') : $this->_socketTimeout; |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | $enc = ($sslEnabled ? ' (ssl)' : ' (non-ssl)'); |
@@ -186,19 +186,19 @@ discard block |
||
| 186 | 186 | $authenticated = false; |
| 187 | 187 | |
| 188 | 188 | // If we are not connected, try to connect. |
| 189 | - if (! $connected) { |
|
| 189 | + if (!$connected) { |
|
| 190 | 190 | $ret = $this->connect($this->_currentServer, $sslEnabled, $this->_currentPort, 5, $socketTimeout); |
| 191 | 191 | } |
| 192 | 192 | // Check if we got an error while connecting. |
| 193 | 193 | $cErr = self::isError($ret); |
| 194 | 194 | |
| 195 | 195 | // If no error, we are connected. |
| 196 | - if (! $cErr) { |
|
| 196 | + if (!$cErr) { |
|
| 197 | 197 | // Say that we are connected so we don't retry. |
| 198 | 198 | $connected = true; |
| 199 | 199 | // When there is no error it returns bool if we are allowed to post or not. |
| 200 | 200 | $this->_postingAllowed = $ret; |
| 201 | - } elseif (! $cError) { |
|
| 201 | + } elseif (!$cError) { |
|
| 202 | 202 | $cError = $ret->getMessage(); |
| 203 | 203 | } |
| 204 | 204 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | // If we have no more retries and could not connect, return an error. |
| 211 | - if ($retries === 0 && ! $connected) { |
|
| 211 | + if ($retries === 0 && !$connected) { |
|
| 212 | 212 | $message = |
| 213 | 213 | 'Cannot connect to server '. |
| 214 | 214 | $this->_currentServer. |
@@ -233,9 +233,9 @@ discard block |
||
| 233 | 233 | $aErr = self::isError($ret2); |
| 234 | 234 | |
| 235 | 235 | // If there was no error, then we are authenticated. |
| 236 | - if (! $aErr) { |
|
| 236 | + if (!$aErr) { |
|
| 237 | 237 | $authenticated = true; |
| 238 | - } elseif (! $aError) { |
|
| 238 | + } elseif (!$aError) { |
|
| 239 | 239 | $aError = $ret2->getMessage(); |
| 240 | 240 | } |
| 241 | 241 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | // If we ran out of retries, return an error. |
| 248 | - if ($retries === 0 && ! $authenticated) { |
|
| 248 | + if ($retries === 0 && !$authenticated) { |
|
| 249 | 249 | $message = |
| 250 | 250 | 'Cannot authenticate to server '. |
| 251 | 251 | $this->_currentServer. |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | // If we are connected and authenticated, try enabling compression if we have it enabled. |
| 262 | 262 | if ($connected && $authenticated) { |
| 263 | 263 | // Check if we should use compression on the connection. |
| 264 | - if (! $compression || (int) Settings::settingValue('..compressedheaders') === 0) { |
|
| 264 | + if (!$compression || (int) Settings::settingValue('..compressedheaders') === 0) { |
|
| 265 | 265 | $this->_compressionSupported = false; |
| 266 | 266 | } |
| 267 | 267 | |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | $message = $this->_getMessage($groupName, $wanted); |
| 544 | 544 | |
| 545 | 545 | // Append the body to $body. |
| 546 | - if (! self::isError($message)) { |
|
| 546 | + if (!self::isError($message)) { |
|
| 547 | 547 | $body .= $message; |
| 548 | 548 | |
| 549 | 549 | if ($messageSize === 0) { |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | |
| 553 | 553 | // If there is an error try the alternate provider or return the PEAR error. |
| 554 | 554 | } elseif ($alternate) { |
| 555 | - if (! $aConnected) { |
|
| 555 | + if (!$aConnected) { |
|
| 556 | 556 | // Check if the current connected server is the alternate or not. |
| 557 | 557 | $aConnected = $this->_currentServer === config('nntmux_nntp.server') ? $nntp->doConnect(true, true) : $nntp->doConnect(); |
| 558 | 558 | } |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | } |
| 639 | 639 | |
| 640 | 640 | // Check if it's an article number or message-ID. |
| 641 | - if (! is_numeric($identifier)) { |
|
| 641 | + if (!is_numeric($identifier)) { |
|
| 642 | 642 | // If it's a message-ID, check if it has the required triangular brackets. |
| 643 | 643 | $identifier = $this->_formatMessageID($identifier); |
| 644 | 644 | } |
@@ -658,7 +658,7 @@ discard block |
||
| 658 | 658 | $emptyLine = false; |
| 659 | 659 | foreach ($article as $line) { |
| 660 | 660 | // If we found the empty line it means we are done reading the header and we will start reading the body. |
| 661 | - if (! $emptyLine) { |
|
| 661 | + if (!$emptyLine) { |
|
| 662 | 662 | if ($line === '') { |
| 663 | 663 | $emptyLine = true; |
| 664 | 664 | |
@@ -716,7 +716,7 @@ discard block |
||
| 716 | 716 | } |
| 717 | 717 | |
| 718 | 718 | // Check if it's an article number or message-id. |
| 719 | - if (! is_numeric($identifier)) { |
|
| 719 | + if (!is_numeric($identifier)) { |
|
| 720 | 720 | // Verify we have the required triangular brackets if it is a message-id. |
| 721 | 721 | $identifier = $this->_formatMessageID($identifier); |
| 722 | 722 | } |
@@ -766,7 +766,7 @@ discard block |
||
| 766 | 766 | */ |
| 767 | 767 | public function postArticle(array|string $groups, string $subject, \Exception|string $body, string $from, bool $yEnc = true, bool $compress = true, string $extra = ''): mixed |
| 768 | 768 | { |
| 769 | - if (! $this->_postingAllowed) { |
|
| 769 | + if (!$this->_postingAllowed) { |
|
| 770 | 770 | $message = 'You do not have the right to post articles on server '.$this->_currentServer; |
| 771 | 771 | |
| 772 | 772 | return $this->throwError($this->colorCli->climate()->error($message)); |
@@ -900,7 +900,7 @@ discard block |
||
| 900 | 900 | if ($this->_compressionEnabled) { |
| 901 | 901 | return true; |
| 902 | 902 | } |
| 903 | - if (! $this->_compressionSupported) { |
|
| 903 | + if (!$this->_compressionSupported) { |
|
| 904 | 904 | return false; |
| 905 | 905 | } |
| 906 | 906 | |
@@ -914,7 +914,7 @@ discard block |
||
| 914 | 914 | return $response; |
| 915 | 915 | } |
| 916 | 916 | if ($response !== 290) { |
| 917 | - if (! $secondTry) { |
|
| 917 | + if (!$secondTry) { |
|
| 918 | 918 | // Retry. |
| 919 | 919 | $this->cmdQuit(); |
| 920 | 920 | if ($this->_checkConnection()) { |
@@ -972,7 +972,7 @@ discard block |
||
| 972 | 972 | $possibleTerm = false; |
| 973 | 973 | $data = null; |
| 974 | 974 | |
| 975 | - while (! feof($this->_socket)) { |
|
| 975 | + while (!feof($this->_socket)) { |
|
| 976 | 976 | // Did we find a possible ending ? (.\r\n) |
| 977 | 977 | if ($possibleTerm) { |
| 978 | 978 | // Loop, sleeping shortly, to allow the server time to upload data, if it has any. |
@@ -987,7 +987,7 @@ discard block |
||
| 987 | 987 | stream_set_blocking($this->_socket, 1); |
| 988 | 988 | |
| 989 | 989 | // Don't sleep on last iteration. |
| 990 | - if (! empty($buffer)) { |
|
| 990 | + if (!empty($buffer)) { |
|
| 991 | 991 | break; |
| 992 | 992 | } |
| 993 | 993 | if ($i < 2) { |
@@ -1000,7 +1000,7 @@ discard block |
||
| 1000 | 1000 | // Remove .\r\n from end, decompress data. |
| 1001 | 1001 | $deComp = @gzuncompress(mb_substr($data, 0, -3, '8bit')); |
| 1002 | 1002 | |
| 1003 | - if (! empty($deComp)) { |
|
| 1003 | + if (!empty($deComp)) { |
|
| 1004 | 1004 | $bytesReceived = \strlen($data); |
| 1005 | 1005 | if ($this->_echo && $bytesReceived > 10240) { |
| 1006 | 1006 | $this->colorCli->climate()->primaryOver( |
@@ -1072,7 +1072,7 @@ discard block |
||
| 1072 | 1072 | } |
| 1073 | 1073 | |
| 1074 | 1074 | // Check if the last char is >, if not add it. |
| 1075 | - if (! str_ends_with($messageID, '>')) { |
|
| 1075 | + if (!str_ends_with($messageID, '>')) { |
|
| 1076 | 1076 | $messageID .= '>'; |
| 1077 | 1077 | } |
| 1078 | 1078 | |
@@ -1099,7 +1099,7 @@ discard block |
||
| 1099 | 1099 | } |
| 1100 | 1100 | |
| 1101 | 1101 | // Check if this is an article number or message-id. |
| 1102 | - if (! is_numeric($identifier)) { |
|
| 1102 | + if (!is_numeric($identifier)) { |
|
| 1103 | 1103 | // It's a message-id so check if it has the triangular brackets. |
| 1104 | 1104 | $identifier = $this->_formatMessageID($identifier); |
| 1105 | 1105 | } |
@@ -1113,7 +1113,7 @@ discard block |
||
| 1113 | 1113 | $body = ''; |
| 1114 | 1114 | if ($response === NET_NNTP_PROTOCOL_RESPONSECODE_BODY_FOLLOWS) { |
| 1115 | 1115 | // Continue until connection is lost |
| 1116 | - while (! feof($this->_socket)) { |
|
| 1116 | + while (!feof($this->_socket)) { |
|
| 1117 | 1117 | // Retrieve and append up to 1024 characters from the server. |
| 1118 | 1118 | $line = fgets($this->_socket, 1024); |
| 1119 | 1119 | |
@@ -1363,6 +1363,6 @@ discard block |
||
| 1363 | 1363 | */ |
| 1364 | 1364 | public function _isConnected(bool $feOf = true): bool |
| 1365 | 1365 | { |
| 1366 | - return is_resource($this->_socket) && (! $feOf || ! feof($this->_socket)); |
|
| 1366 | + return is_resource($this->_socket) && (!$feOf || !feof($this->_socket)); |
|
| 1367 | 1367 | } |
| 1368 | 1368 | } |
@@ -276,8 +276,8 @@ |
||
| 276 | 276 | |
| 277 | 277 | // Execute a Scroll request and repeat |
| 278 | 278 | $results = \Elasticsearch::scroll([ |
| 279 | - 'scroll_id' => $scroll_id, //...using our previously obtained _scroll_id |
|
| 280 | - 'scroll' => '30s', // and the same timeout window |
|
| 279 | + 'scroll_id' => $scroll_id, //...using our previously obtained _scroll_id |
|
| 280 | + 'scroll' => '30s', // and the same timeout window |
|
| 281 | 281 | ] |
| 282 | 282 | ); |
| 283 | 283 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | foreach ($hit as $val) { |
| 115 | 115 | $title = Predb::query()->where('title', trim($val))->first(['title', 'id']); |
| 116 | 116 | // don't match against ab.teevee if title is for just the season |
| 117 | - if (! empty($title) && $groupName === 'alt.binaries.teevee' && preg_match('/\.S\d\d\./', $title['title'], $hit)) { |
|
| 117 | + if (!empty($title) && $groupName === 'alt.binaries.teevee' && preg_match('/\.S\d\d\./', $title['title'], $hit)) { |
|
| 118 | 118 | $title = null; |
| 119 | 119 | } |
| 120 | 120 | if ($title !== null) { |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | } |
| 159 | 159 | break; |
| 160 | 160 | } |
| 161 | - if ($title === null && ! empty($reqGname)) { |
|
| 161 | + if ($title === null && !empty($reqGname)) { |
|
| 162 | 162 | $title = Predb::query()->where(['predb.requestid' => $hit[1], 'g.name' => $reqGname])->join('usenet_groups as g', 'g.id', '=', 'predb.groups_id')->first(['predb.title', 'predb.id']); |
| 163 | 163 | } |
| 164 | 164 | // don't match against ab.teevee if title is for just the season |
@@ -143,7 +143,7 @@ |
||
| 143 | 143 | $content['url'] = '/'.$content['url']; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - if (! str_ends_with($content['url'], '/')) { |
|
| 146 | + if (!str_ends_with($content['url'], '/')) { |
|
| 147 | 147 | $content['url'] .= '/'; |
| 148 | 148 | } |
| 149 | 149 | |