@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | $order[1] |
242 | 242 | ); |
243 | 243 | |
244 | - return Cache::flexible($returnSql.$page, [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($returnSql, $games) { |
|
244 | + return Cache::flexible($returnSql.$page, [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($returnSql, $games) { |
|
245 | 245 | $return = DB::select($returnSql); |
246 | 246 | if (\count($return) > 0) { |
247 | 247 | $return[0]->_totalcount = $games['total'][0]->total ?? 0; |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | { |
294 | 294 | $browseBy = ' '; |
295 | 295 | foreach ($this->getBrowseByOptions() as $bbk => $bbv) { |
296 | - if (! empty($_REQUEST[$bbk])) { |
|
296 | + if (!empty($_REQUEST[$bbk])) { |
|
297 | 297 | $bbs = stripslashes($_REQUEST[$bbk]); |
298 | 298 | if ($bbk === 'year') { |
299 | 299 | $browseBy .= ' AND YEAR (gi.releasedate) '.'LIKE '.escapeString('%'.$bbs.'%'); |
@@ -357,11 +357,11 @@ discard block |
||
357 | 357 | if (empty($this->_gameResults['title'])) { |
358 | 358 | return false; |
359 | 359 | } |
360 | - if (! empty($this->_gameResults['cover'])) { |
|
360 | + if (!empty($this->_gameResults['cover'])) { |
|
361 | 361 | $game['coverurl'] = (string) $this->_gameResults['cover']; |
362 | 362 | } |
363 | 363 | |
364 | - if (! empty($this->_gameResults['backdrop'])) { |
|
364 | + if (!empty($this->_gameResults['backdrop'])) { |
|
365 | 365 | $game['backdropurl'] = (string) $this->_gameResults['backdrop']; |
366 | 366 | } |
367 | 367 | |
@@ -369,41 +369,41 @@ discard block |
||
369 | 369 | $game['asin'] = $this->_gameResults['steamid']; |
370 | 370 | $game['url'] = (string) $this->_gameResults['directurl']; |
371 | 371 | |
372 | - if (! empty($this->_gameResults['publisher'])) { |
|
372 | + if (!empty($this->_gameResults['publisher'])) { |
|
373 | 373 | $game['publisher'] = (string) $this->_gameResults['publisher']; |
374 | 374 | } else { |
375 | 375 | $game['publisher'] = 'Unknown'; |
376 | 376 | } |
377 | 377 | |
378 | - if (! empty($this->_gameResults['rating'])) { |
|
378 | + if (!empty($this->_gameResults['rating'])) { |
|
379 | 379 | $game['esrb'] = (string) $this->_gameResults['rating']; |
380 | 380 | } else { |
381 | 381 | $game['esrb'] = 'Not Rated'; |
382 | 382 | } |
383 | 383 | |
384 | - if (! empty($this->_gameResults['releasedate'])) { |
|
384 | + if (!empty($this->_gameResults['releasedate'])) { |
|
385 | 385 | $dateReleased = strtotime($this->_gameResults['releasedate']) === false ? '' : $this->_gameResults['releasedate']; |
386 | 386 | $game['releasedate'] = ($this->_gameResults['releasedate'] === '' || strtotime($this->_gameResults['releasedate']) === false) ? null : Carbon::createFromFormat('M j, Y', Carbon::parse($dateReleased)->toFormattedDateString())->format('Y-m-d'); |
387 | 387 | } |
388 | 388 | |
389 | - if (! empty($this->_gameResults['description'])) { |
|
389 | + if (!empty($this->_gameResults['description'])) { |
|
390 | 390 | $game['review'] = (string) $this->_gameResults['description']; |
391 | 391 | } |
392 | 392 | |
393 | - if (! empty($this->_gameResults['genres'])) { |
|
393 | + if (!empty($this->_gameResults['genres'])) { |
|
394 | 394 | $genres = $this->_gameResults['genres']; |
395 | 395 | $genreName = $this->_matchGenre($genres); |
396 | 396 | } |
397 | 397 | } |
398 | 398 | } |
399 | 399 | |
400 | - if (! empty($this->publicKey)) { |
|
400 | + if (!empty($this->publicKey)) { |
|
401 | 401 | if ($steamGameID === false || $this->_gameResults === false) { |
402 | 402 | $bestMatch = false; |
403 | 403 | $this->_classUsed = 'GiantBomb'; |
404 | 404 | try { |
405 | 405 | $result = $this->giantBomb->search($gameInfo['title'], 'Game'); |
406 | - if (! \is_object($result)) { |
|
406 | + if (!\is_object($result)) { |
|
407 | 407 | $bestMatchPct = 0; |
408 | 408 | foreach ($result as $res) { |
409 | 409 | similar_text(strtolower($gameInfo['title']), strtolower($res->name), $percent1); |
@@ -416,17 +416,17 @@ discard block |
||
416 | 416 | if ($bestMatch !== false) { |
417 | 417 | $this->_gameResults = $this->giantBomb->findWithResourceID('Game', '3030-'.$bestMatch); |
418 | 418 | |
419 | - if (! empty($this->_gameResults->image['medium_url'])) { |
|
419 | + if (!empty($this->_gameResults->image['medium_url'])) { |
|
420 | 420 | $game['coverurl'] = (string) $this->_gameResults->image['medium_url']; |
421 | 421 | } |
422 | 422 | |
423 | - if (! empty($this->_gameResults->image['screen_url'])) { |
|
423 | + if (!empty($this->_gameResults->image['screen_url'])) { |
|
424 | 424 | $game['backdropurl'] = (string) $this->_gameResults->image['screen_url']; |
425 | 425 | } |
426 | 426 | |
427 | 427 | $game['title'] = (string) $this->_gameResults->get('name'); |
428 | 428 | $game['asin'] = $this->_gameResults->get('id'); |
429 | - if (! empty($this->_gameResults->get('site_detail_url'))) { |
|
429 | + if (!empty($this->_gameResults->get('site_detail_url'))) { |
|
430 | 430 | $game['url'] = (string) $this->_gameResults->get('site_detail_url'); |
431 | 431 | } else { |
432 | 432 | $game['url'] = ''; |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | $game['publisher'] = 'Unknown'; |
439 | 439 | } |
440 | 440 | |
441 | - if (! empty($this->_gameResults->original_game_rating[0]['name'])) { |
|
441 | + if (!empty($this->_gameResults->original_game_rating[0]['name'])) { |
|
442 | 442 | $game['esrb'] = $this->_gameResults->original_game_rating[0]['name'] ?? 'Not Rated'; |
443 | 443 | } else { |
444 | 444 | $game['esrb'] = 'Not Rated'; |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | $bestMatch = false; |
476 | 476 | $this->_classUsed = 'IGDB'; |
477 | 477 | $result = Game::where('name', $gameInfo['title'])->get(); |
478 | - if (! empty($result)) { |
|
478 | + if (!empty($result)) { |
|
479 | 479 | $bestMatchPct = 0; |
480 | 480 | foreach ($result as $res) { |
481 | 481 | similar_text(strtolower($gameInfo['title']), strtolower($res->name), $percent1); |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | ])->where('id', $bestMatch)->first(); |
494 | 494 | |
495 | 495 | $publishers = []; |
496 | - if (! empty($this->_gameResults->involved_companies)) { |
|
496 | + if (!empty($this->_gameResults->involved_companies)) { |
|
497 | 497 | foreach ($this->_gameResults->involved_companies as $publisher) { |
498 | 498 | if ($publisher['publisher'] === true) { |
499 | 499 | $company = Company::find($publisher['company']); |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | |
505 | 505 | $genres = []; |
506 | 506 | |
507 | - if (! empty($this->_gameResults->themes)) { |
|
507 | + if (!empty($this->_gameResults->themes)) { |
|
508 | 508 | foreach ($this->_gameResults->themes as $theme) { |
509 | 509 | $genres[] = $theme['name']; |
510 | 510 | } |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | 'esrb' => isset($this->_gameResults->aggregated_rating) ? round($this->_gameResults->aggregated_rating).'%' : 'Not Rated', |
527 | 527 | 'url' => $this->_gameResults->url ?? '', |
528 | 528 | 'backdropurl' => isset($this->_gameResults->screenshots) ? 'https:'.str_replace('t_thumb', 't_cover_big', $this->_gameResults->screenshots[0]['url']) : '', |
529 | - 'publisher' => ! empty($publishers) ? implode(',', $publishers) : 'Unknown', |
|
529 | + 'publisher' => !empty($publishers) ? implode(',', $publishers) : 'Unknown', |
|
530 | 530 | ]; |
531 | 531 | } else { |
532 | 532 | $this->colorCli->notice('IGDB returned no valid results'); |
@@ -560,20 +560,20 @@ discard block |
||
560 | 560 | } else { |
561 | 561 | $game['backdrop'] = 0; |
562 | 562 | } |
563 | - if (! isset($game['trailer'])) { |
|
563 | + if (!isset($game['trailer'])) { |
|
564 | 564 | $game['trailer'] = 0; |
565 | 565 | } |
566 | 566 | if (empty($game['title'])) { |
567 | 567 | $game['title'] = $gameInfo['title']; |
568 | 568 | } |
569 | - if (! isset($game['releasedate'])) { |
|
569 | + if (!isset($game['releasedate'])) { |
|
570 | 570 | $game['releasedate'] = ''; |
571 | 571 | } |
572 | 572 | |
573 | 573 | if ($game['releasedate'] === '') { |
574 | 574 | $game['releasedate'] = ''; |
575 | 575 | } |
576 | - if (! isset($game['review'])) { |
|
576 | + if (!isset($game['review'])) { |
|
577 | 577 | $game['review'] = 'No Review'; |
578 | 578 | } |
579 | 579 | $game['classused'] = $this->_classUsed; |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | $game['gamesgenre'] = $genreName; |
592 | 592 | $game['gamesgenreID'] = $genreKey; |
593 | 593 | |
594 | - if (! empty($game['asin'])) { |
|
594 | + if (!empty($game['asin'])) { |
|
595 | 595 | $check = GamesInfo::query()->where('asin', $game['asin'])->first(); |
596 | 596 | if ($check === null) { |
597 | 597 | $gamesId = GamesInfo::query() |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | } |
637 | 637 | } |
638 | 638 | |
639 | - if (! empty($gamesId)) { |
|
639 | + if (!empty($gamesId)) { |
|
640 | 640 | if ($this->echoOutput) { |
641 | 641 | $this->colorCli->header('Added/updated game: '). |
642 | 642 | $this->colorCli->alternateOver(' Title: '). |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | $this->colorCli->primary($game['title'].' (PC)'); |
656 | 656 | } |
657 | 657 | |
658 | - return ! empty($gamesId) ? $gamesId : false; |
|
658 | + return !empty($gamesId) ? $gamesId : false; |
|
659 | 659 | } |
660 | 660 | |
661 | 661 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | %s %s %s %s |
154 | 154 | GROUP BY xxx.id |
155 | 155 | ORDER BY %s %s", |
156 | - (! empty($xxxIDs) ? implode(',', $xxxIDs) : -1), |
|
156 | + (!empty($xxxIDs) ? implode(',', $xxxIDs) : -1), |
|
157 | 157 | $this->showPasswords, |
158 | 158 | $this->getBrowseBy(), |
159 | 159 | $catSrch, |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $order[1] |
168 | 168 | ); |
169 | 169 | |
170 | - return Cache::flexible($sql.$page, [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql, $xxxmovies) { |
|
170 | + return Cache::flexible($sql.$page, [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($sql, $xxxmovies) { |
|
171 | 171 | $return = DB::select($sql); |
172 | 172 | if (\count($return) > 0) { |
173 | 173 | $return[0]->_totalcount = $xxxmovies['total'][0]->total ?? 0; |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | { |
204 | 204 | $browseBy = ' '; |
205 | 205 | foreach (['title', 'director', 'actors', 'genre', 'id'] as $bb) { |
206 | - if (! empty($_REQUEST[$bb])) { |
|
206 | + if (!empty($_REQUEST[$bb])) { |
|
207 | 207 | $bbv = stripslashes($_REQUEST[$bb]); |
208 | 208 | if ($bb === 'genre') { |
209 | 209 | $bbv = $this->getGenreID($bbv); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | string $cover = '', |
239 | 239 | string $backdrop = '' |
240 | 240 | ): void { |
241 | - if (! empty($id)) { |
|
241 | + if (!empty($id)) { |
|
242 | 242 | XxxInfo::query()->where('id', $id)->update( |
243 | 243 | [ |
244 | 244 | 'title' => $title, |
@@ -277,12 +277,12 @@ discard block |
||
277 | 277 | public function getGenres(bool $activeOnly = false, $gid = null): mixed |
278 | 278 | { |
279 | 279 | if ($activeOnly) { |
280 | - return Genre::query()->where(['disabled' => 0, 'type' => Category::XXX_ROOT])->when($gid !== null, function ($query) use ($gid) { |
|
280 | + return Genre::query()->where(['disabled' => 0, 'type' => Category::XXX_ROOT])->when($gid !== null, function($query) use ($gid) { |
|
281 | 281 | return $query->where('id', $gid); |
282 | 282 | })->orderBy('title')->first(['title']); |
283 | 283 | } |
284 | 284 | |
285 | - return Genre::query()->where(['type' => Category::XXX_ROOT])->when($gid !== null, function ($query) use ($gid) { |
|
285 | + return Genre::query()->where(['type' => Category::XXX_ROOT])->when($gid !== null, function($query) use ($gid) { |
|
286 | 286 | return $query->where('id', $gid); |
287 | 287 | })->orderBy('title')->first(['title']); |
288 | 288 | } |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | { |
298 | 298 | $ret = null; |
299 | 299 | |
300 | - if (! \is_array($arr)) { |
|
300 | + if (!\is_array($arr)) { |
|
301 | 301 | $res = Genre::query()->where('title', $arr)->first(['id']); |
302 | 302 | if ($res !== null) { |
303 | 303 | return $res['id']; |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | public function insertSwf($whichClass, $res): string |
338 | 338 | { |
339 | 339 | $ret = ''; |
340 | - if (($whichClass === 'ade') && ! empty($res)) { |
|
340 | + if (($whichClass === 'ade') && !empty($res)) { |
|
341 | 341 | $trailers = unserialize($res, 'ade'); |
342 | 342 | $ret .= "<object width='360' height='240' type='application/x-shockwave-flash' id='EmpireFlashPlayer' name='EmpireFlashPlayer' data='".$trailers['url']."'>"; |
343 | 343 | $ret .= "<param name='flashvars' value= 'streamID=".$trailers['streamid'].'&autoPlay=false&BaseStreamingUrl='.$trailers['baseurl']."'>"; |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | |
346 | 346 | return $ret; |
347 | 347 | } |
348 | - if (($whichClass === 'pop') && ! empty($res)) { |
|
348 | + if (($whichClass === 'pop') && !empty($res)) { |
|
349 | 349 | $trailers = unserialize($res, 'pop'); |
350 | 350 | $ret .= "<embed id='trailer' width='480' height='360'"; |
351 | 351 | $ret .= "flashvars='".$trailers['flashvars']."' allowfullscreen='true' allowscriptaccess='always' quality='high' name='trailer' style='undefined'"; |
@@ -422,22 +422,22 @@ discard block |
||
422 | 422 | return -2; |
423 | 423 | } |
424 | 424 | |
425 | - $res['cast'] = ! empty($res['cast']) ? implode(',', $res['cast']) : ''; |
|
426 | - $res['genres'] = ! empty($res['genres']) ? $this->getGenreID($res['genres']) : ''; |
|
425 | + $res['cast'] = !empty($res['cast']) ? implode(',', $res['cast']) : ''; |
|
426 | + $res['genres'] = !empty($res['genres']) ? $this->getGenreID($res['genres']) : ''; |
|
427 | 427 | |
428 | 428 | $mov = [ |
429 | - 'trailers' => ! empty($res['trailers']) ? serialize($res['trailers']) : '', |
|
430 | - 'extras' => ! empty($res['extras']) ? serialize($res['extras']) : '', |
|
431 | - 'productinfo' => ! empty($res['productinfo']) ? serialize($res['productinfo']) : '', |
|
432 | - 'backdrop' => ! empty($res['backcover']) ? $res['backcover'] : 0, |
|
433 | - 'cover' => ! empty($res['boxcover']) ? $res['boxcover'] : 0, |
|
434 | - 'title' => ! empty($res['title']) ? html_entity_decode($res['title'], ENT_QUOTES, 'UTF-8') : '', |
|
435 | - 'plot' => ! empty($res['synopsis']) ? html_entity_decode($res['synopsis'], ENT_QUOTES, 'UTF-8') : '', |
|
436 | - 'tagline' => ! empty($res['tagline']) ? html_entity_decode($res['tagline'], ENT_QUOTES, 'UTF-8') : '', |
|
437 | - 'genre' => ! empty($res['genres']) ? html_entity_decode($res['genres'], ENT_QUOTES, 'UTF-8') : '', |
|
438 | - 'director' => ! empty($res['director']) ? html_entity_decode($res['director'], ENT_QUOTES, 'UTF-8') : '', |
|
439 | - 'actors' => ! empty($res['cast']) ? html_entity_decode($res['cast'], ENT_QUOTES, 'UTF-8') : '', |
|
440 | - 'directurl' => ! empty($res['directurl']) ? html_entity_decode($res['directurl'], ENT_QUOTES, 'UTF-8') : '', |
|
429 | + 'trailers' => !empty($res['trailers']) ? serialize($res['trailers']) : '', |
|
430 | + 'extras' => !empty($res['extras']) ? serialize($res['extras']) : '', |
|
431 | + 'productinfo' => !empty($res['productinfo']) ? serialize($res['productinfo']) : '', |
|
432 | + 'backdrop' => !empty($res['backcover']) ? $res['backcover'] : 0, |
|
433 | + 'cover' => !empty($res['boxcover']) ? $res['boxcover'] : 0, |
|
434 | + 'title' => !empty($res['title']) ? html_entity_decode($res['title'], ENT_QUOTES, 'UTF-8') : '', |
|
435 | + 'plot' => !empty($res['synopsis']) ? html_entity_decode($res['synopsis'], ENT_QUOTES, 'UTF-8') : '', |
|
436 | + 'tagline' => !empty($res['tagline']) ? html_entity_decode($res['tagline'], ENT_QUOTES, 'UTF-8') : '', |
|
437 | + 'genre' => !empty($res['genres']) ? html_entity_decode($res['genres'], ENT_QUOTES, 'UTF-8') : '', |
|
438 | + 'director' => !empty($res['director']) ? html_entity_decode($res['director'], ENT_QUOTES, 'UTF-8') : '', |
|
439 | + 'actors' => !empty($res['cast']) ? html_entity_decode($res['cast'], ENT_QUOTES, 'UTF-8') : '', |
|
440 | + 'directurl' => !empty($res['directurl']) ? html_entity_decode($res['directurl'], ENT_QUOTES, 'UTF-8') : '', |
|
441 | 441 | 'classused' => $this->whichClass, |
442 | 442 | ]; |
443 | 443 | |
@@ -447,12 +447,12 @@ discard block |
||
447 | 447 | $xxxID = $check['id']; |
448 | 448 | |
449 | 449 | // Update BoxCover. |
450 | - if (! empty($mov['cover'])) { |
|
450 | + if (!empty($mov['cover'])) { |
|
451 | 451 | $cover = $this->releaseImage->saveImage($xxxID.'-cover', $mov['cover'], $this->imgSavePath); |
452 | 452 | } |
453 | 453 | |
454 | 454 | // BackCover. |
455 | - if (! empty($mov['backdrop'])) { |
|
455 | + if (!empty($mov['backdrop'])) { |
|
456 | 456 | $backdrop = $this->releaseImage->saveImage($xxxID.'-backdrop', $mov['backdrop'], $this->imgSavePath, 1920, 1024); |
457 | 457 | } |
458 | 458 | |
@@ -480,12 +480,12 @@ discard block |
||
480 | 480 | ] |
481 | 481 | ); |
482 | 482 | // Update BoxCover. |
483 | - if (! empty($mov['cover'])) { |
|
483 | + if (!empty($mov['cover'])) { |
|
484 | 484 | $cover = $this->releaseImage->saveImage($xxxID.'-cover', $mov['cover'], $this->imgSavePath); |
485 | 485 | } |
486 | 486 | |
487 | 487 | // BackCover. |
488 | - if (! empty($mov['backdrop'])) { |
|
488 | + if (!empty($mov['backdrop'])) { |
|
489 | 489 | $backdrop = $this->releaseImage->saveImage($xxxID.'-backdrop', $mov['backdrop'], $this->imgSavePath, 1920, 1024); |
490 | 490 | } |
491 | 491 | |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | $name = trim(preg_replace('/(brazilian|chinese|croatian|danish|deutsch|dutch|estonian|flemish|finnish|french|german|greek|hebrew|icelandic|italian|latin|nordic|norwegian|polish|portuguese|japenese|japanese|russian|serbian|slovenian|spanish|spanisch|swedish|thai|turkish)$/i', '', $name)); |
599 | 599 | |
600 | 600 | // Check if the name is long enough and not just numbers and not file (d) of (d) and does not contain Episodes and any dated 00.00.00 which are site rips.. |
601 | - if (\strlen($name) > 5 && ! preg_match('/^\d+$/', $name) && ! preg_match('/( File \d+ of \d+|\d+.\d+.\d+)/', $name) && ! preg_match('/(E\d+)/', $name) && ! preg_match('/\d\d\.\d\d.\d\d/', $name)) { |
|
601 | + if (\strlen($name) > 5 && !preg_match('/^\d+$/', $name) && !preg_match('/( File \d+ of \d+|\d+.\d+.\d+)/', $name) && !preg_match('/(E\d+)/', $name) && !preg_match('/\d\d\.\d\d.\d\d/', $name)) { |
|
602 | 602 | $this->currentTitle = $name; |
603 | 603 | |
604 | 604 | return true; |
@@ -169,14 +169,14 @@ discard block |
||
169 | 169 | %s |
170 | 170 | GROUP BY boo.id |
171 | 171 | ORDER BY %s %s', |
172 | - \is_array($bookIDs) && ! empty($bookIDs) ? implode(',', $bookIDs) : -1, |
|
173 | - \is_array($releaseIDs) && ! empty($releaseIDs) ? implode(',', $releaseIDs) : -1, |
|
172 | + \is_array($bookIDs) && !empty($bookIDs) ? implode(',', $bookIDs) : -1, |
|
173 | + \is_array($releaseIDs) && !empty($releaseIDs) ? implode(',', $releaseIDs) : -1, |
|
174 | 174 | $catsrch, |
175 | 175 | $order[0], |
176 | 176 | $order[1] |
177 | 177 | ); |
178 | 178 | |
179 | - return Cache::flexible($sql.$page, [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql, $books) { |
|
179 | + return Cache::flexible($sql.$page, [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($sql, $books) { |
|
180 | 180 | $return = DB::select($sql); |
181 | 181 | if (\count($return) > 0) { |
182 | 182 | $return[0]->_totalcount = $books['total'][0]->total ?? 0; |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | { |
235 | 235 | $browseby = ' '; |
236 | 236 | foreach ($this->getBrowseByOptions() as $bbk => $bbv) { |
237 | - if (! empty($_REQUEST[$bbk])) { |
|
237 | + if (!empty($_REQUEST[$bbk])) { |
|
238 | 238 | $bbs = stripslashes($_REQUEST[$bbk]); |
239 | 239 | $browseby .= ' AND boo.'.$bbv.' '.'LIKE '.escapeString('%'.$bbs.'%'); |
240 | 240 | } |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | return false; |
365 | 365 | } |
366 | 366 | |
367 | - if (preg_match('/^([a-z0-9ü!]+ ){1,2}(N|Vol)?\d{1,4}([abc])?$|^([a-z0-9]+ ){1,2}(Jan( |unar|$)|Feb( |ruary|$)|Mar( |ch|$)|Apr( |il|$)|May(?![a-z0-9])|Jun([ e$])|Jul([ y$])|Aug( |ust|$)|Sep( |tember|$)|O([ck])t( |ober|$)|Nov( |ember|$)|De([cz])( |ember|$))/ui', $releasename) && ! preg_match('/Part \d+/i', $releasename)) { |
|
367 | + if (preg_match('/^([a-z0-9ü!]+ ){1,2}(N|Vol)?\d{1,4}([abc])?$|^([a-z0-9]+ ){1,2}(Jan( |unar|$)|Feb( |ruary|$)|Mar( |ch|$)|Apr( |il|$)|May(?![a-z0-9])|Jun([ e$])|Jul([ y$])|Aug( |ust|$)|Sep( |tember|$)|O([ck])t( |ober|$)|Nov( |ember|$)|De([cz])( |ember|$))/ui', $releasename) && !preg_match('/Part \d+/i', $releasename)) { |
|
368 | 368 | if ($this->echooutput) { |
369 | 369 | $this->colorCli->headerOver('Changing category to magazines: ').$this->colorCli->primary($releasename); |
370 | 370 | } |
@@ -372,14 +372,14 @@ discard block |
||
372 | 372 | |
373 | 373 | return false; |
374 | 374 | } |
375 | - if (! empty($releasename) && ! preg_match('/^[a-z0-9]+$|^([0-9]+ ){1,}$|Part \d+/i', $releasename)) { |
|
375 | + if (!empty($releasename) && !preg_match('/^[a-z0-9]+$|^([0-9]+ ){1,}$|Part \d+/i', $releasename)) { |
|
376 | 376 | return $releasename; |
377 | 377 | } |
378 | 378 | |
379 | 379 | return false; |
380 | 380 | } |
381 | 381 | if ($releasetype === 'audiobook') { |
382 | - if (! empty($releasename) && ! preg_match('/^[a-z0-9]+$|^([0-9]+ ){1,}$|Part \d+/i', $releasename)) { |
|
382 | + if (!empty($releasename) && !preg_match('/^[a-z0-9]+$|^([0-9]+ ){1,}$|Part \d+/i', $releasename)) { |
|
383 | 383 | // we can skip category for audiobooks, since we already know it, so as long as the release name is valid return it so that it is postprocessed by amazon. In the future, determining the type of audiobook could be added (Lecture or book), since we can skip lookups on lectures, but for now handle them all the same way |
384 | 384 | return $releasename; |
385 | 385 | } |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | |
404 | 404 | $book = false; |
405 | 405 | if ($bookInfo !== '') { |
406 | - if (! $book) { |
|
406 | + if (!$book) { |
|
407 | 407 | $this->colorCli->info('Fetching data from iTunes for '.$bookInfo); |
408 | 408 | $book = $this->fetchItunesBookProperties($bookInfo); |
409 | 409 | } elseif ($amazdata !== null) { |
@@ -510,12 +510,12 @@ discard block |
||
510 | 510 | 'salesrank' => '', |
511 | 511 | 'publisher' => '', |
512 | 512 | 'pages' => '', |
513 | - 'coverurl' => ! empty($iTunesBook->getCover()) ? str_replace('100x100', '800x800', $iTunesBook->getCover()) : '', |
|
513 | + 'coverurl' => !empty($iTunesBook->getCover()) ? str_replace('100x100', '800x800', $iTunesBook->getCover()) : '', |
|
514 | 514 | 'genre' => implode(', ', $iTunesBook->getGenre()), |
515 | 515 | 'overview' => strip_tags($iTunesBook->getDescription()), |
516 | 516 | 'publishdate' => $iTunesBook->getReleaseDate()->format('Y-m-d'), |
517 | 517 | ]; |
518 | - if (! empty($book['coverurl'])) { |
|
518 | + if (!empty($book['coverurl'])) { |
|
519 | 519 | $book['cover'] = 1; |
520 | 520 | } else { |
521 | 521 | $book['cover'] = 0; |
@@ -195,14 +195,14 @@ discard block |
||
195 | 195 | %s %s %s |
196 | 196 | GROUP BY m.id |
197 | 197 | ORDER BY %s %s', |
198 | - ! empty($musicIDs) ? 'WHERE m.id IN ('.implode(',', $musicIDs).')' : 'AND 1=1', |
|
199 | - (! empty($releaseIDs)) ? 'AND r.id in ('.implode(',', $releaseIDs).')' : '', |
|
198 | + !empty($musicIDs) ? 'WHERE m.id IN ('.implode(',', $musicIDs).')' : 'AND 1=1', |
|
199 | + (!empty($releaseIDs)) ? 'AND r.id in ('.implode(',', $releaseIDs).')' : '', |
|
200 | 200 | $catsrch, |
201 | 201 | $order[0], |
202 | 202 | $order[1] |
203 | 203 | ); |
204 | 204 | |
205 | - return Cache::flexible($sql.$page, [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql, $music) { |
|
205 | + return Cache::flexible($sql.$page, [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($sql, $music) { |
|
206 | 206 | $return = DB::select($sql); |
207 | 207 | if (\count($return) > 0) { |
208 | 208 | $return[0]->_totalcount = $music['total'][0]->total ?? 0; |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | { |
260 | 260 | $browseby = ' '; |
261 | 261 | foreach ($this->getBrowseByOptions() as $bbk => $bbv) { |
262 | - if (! empty($_REQUEST[$bbk])) { |
|
262 | + if (!empty($_REQUEST[$bbk])) { |
|
263 | 263 | $bbs = stripslashes($_REQUEST[$bbk]); |
264 | 264 | if (stripos($bbv, 'id') !== false) { |
265 | 265 | $browseby .= ' AND m.'.$bbv.' = '.$bbs; |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | ) |
411 | 411 | ); |
412 | 412 | |
413 | - if (! empty($res)) { |
|
413 | + if (!empty($res)) { |
|
414 | 414 | foreach ($res as $arr) { |
415 | 415 | $startTime = now(); |
416 | 416 | $usedAmazon = false; |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | $h = trim(preg_replace('/\s\s+/', ' ', $g)); |
484 | 484 | $newname = trim(preg_replace('/ [a-z]{2}$| [a-z]{3} \d{2,}$|\d{5,} \d{5,}$|-WEB$/i', '', $h)); |
485 | 485 | |
486 | - if (! preg_match('/^[a-z0-9]+$/i', $newname) && strlen($newname) > 10) { |
|
486 | + if (!preg_match('/^[a-z0-9]+$/i', $newname) && strlen($newname) > 10) { |
|
487 | 487 | $result['name'] = $newname; |
488 | 488 | |
489 | 489 | return $result; |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $transport = ($tls === true ? 'tls' : 'tcp'); |
193 | 193 | |
194 | 194 | $socket_string = $transport.'://'.$hostname.':'.$port; |
195 | - if ($socket_string !== $this->_remote_socket_string || ! $this->_connected()) { |
|
195 | + if ($socket_string !== $this->_remote_socket_string || !$this->_connected()) { |
|
196 | 196 | if ($hostname === '') { |
197 | 197 | echo 'ERROR: IRC host name must not be empty!'.PHP_EOL; |
198 | 198 | |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | */ |
238 | 238 | public function login(string $nickName, string $userName, string $realName, $password = null): bool |
239 | 239 | { |
240 | - if (! $this->_connected()) { |
|
240 | + if (!$this->_connected()) { |
|
241 | 241 | echo 'ERROR: You must connect to IRC first!'.PHP_EOL; |
242 | 242 | |
243 | 243 | return false; |
@@ -254,15 +254,15 @@ discard block |
||
254 | 254 | $this->_realName = $realName; |
255 | 255 | $this->_password = $password; |
256 | 256 | |
257 | - if (empty($password) && ! $this->_writeSocket('PASSWORD '.$password)) { |
|
257 | + if (empty($password) && !$this->_writeSocket('PASSWORD '.$password)) { |
|
258 | 258 | return false; |
259 | 259 | } |
260 | 260 | |
261 | - if (! $this->_writeSocket('NICK '.$nickName)) { |
|
261 | + if (!$this->_writeSocket('NICK '.$nickName)) { |
|
262 | 262 | return false; |
263 | 263 | } |
264 | 264 | |
265 | - if (! $this->_writeSocket('USER '.$userName.' 0 * :'.$realName)) { |
|
265 | + if (!$this->_writeSocket('USER '.$userName.' 0 * :'.$realName)) { |
|
266 | 266 | return false; |
267 | 267 | } |
268 | 268 | |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | $tempPass = $password; |
292 | 292 | } |
293 | 293 | |
294 | - if ($password !== null && ! $this->_writeSocket('PASS '.$tempPass)) { |
|
294 | + if ($password !== null && !$this->_writeSocket('PASS '.$tempPass)) { |
|
295 | 295 | return false; |
296 | 296 | } |
297 | 297 | |
@@ -370,13 +370,13 @@ discard block |
||
370 | 370 | { |
371 | 371 | $this->_channels = $channels; |
372 | 372 | |
373 | - if (! $this->_connected()) { |
|
373 | + if (!$this->_connected()) { |
|
374 | 374 | echo 'ERROR: You must connect to IRC first!'.PHP_EOL; |
375 | 375 | |
376 | 376 | return false; |
377 | 377 | } |
378 | 378 | |
379 | - if (! empty($channels)) { |
|
379 | + if (!empty($channels)) { |
|
380 | 380 | foreach ($channels as $channel => $password) { |
381 | 381 | $this->_joinChannel($channel, $password ?? ''); |
382 | 382 | } |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | */ |
405 | 405 | protected function _pong(string $host) |
406 | 406 | { |
407 | - if (! $this->_writeSocket('PONG '.$host)) { |
|
407 | + if (!$this->_writeSocket('PONG '.$host)) { |
|
408 | 408 | $this->_reconnect(); |
409 | 409 | } |
410 | 410 | |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | $pong = $this->_writeSocket('PING '.$host); |
423 | 423 | |
424 | 424 | // Check if there's a connection error. |
425 | - if ($pong === false || ((time() - $this->_lastPing) > ($this->_socket_timeout / 2) && ! 0 === strpos($this->_buffer, 'PONG'))) { |
|
425 | + if ($pong === false || ((time() - $this->_lastPing) > ($this->_socket_timeout / 2) && !0 === strpos($this->_buffer, 'PONG'))) { |
|
426 | 426 | $this->_reconnect(); |
427 | 427 | } |
428 | 428 | |
@@ -437,12 +437,12 @@ discard block |
||
437 | 437 | */ |
438 | 438 | protected function _reconnect(): void |
439 | 439 | { |
440 | - if (! $this->connect($this->_remote_host, $this->_remote_port, $this->_remote_tls)) { |
|
440 | + if (!$this->connect($this->_remote_host, $this->_remote_port, $this->_remote_tls)) { |
|
441 | 441 | exit('FATAL: Could not reconnect to ('.$this->_remote_host.') after ('.$this->_reconnectRetries.') tries.'.PHP_EOL); |
442 | 442 | } |
443 | 443 | |
444 | - if (! $this->_alreadyLoggedIn) { |
|
445 | - if (! $this->login($this->_nickName, $this->_userName, $this->_realName, $this->_password)) { |
|
444 | + if (!$this->_alreadyLoggedIn) { |
|
445 | + if (!$this->login($this->_nickName, $this->_userName, $this->_realName, $this->_password)) { |
|
446 | 446 | exit('FATAL: Could not log in to ('.$this->_remote_host.')!'.PHP_EOL); |
447 | 447 | } |
448 | 448 | |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | do { |
460 | 460 | stream_set_timeout($this->_socket, $this->_socket_timeout); |
461 | 461 | $buffer .= fgets($this->_socket, 1024); |
462 | - } while (! empty($buffer) && ! preg_match('/\v+$/', $buffer)); |
|
462 | + } while (!empty($buffer) && !preg_match('/\v+$/', $buffer)); |
|
463 | 463 | $this->_buffer = trim($buffer); |
464 | 464 | |
465 | 465 | if ($this->_debug && $this->_buffer !== '') { |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | */ |
546 | 546 | protected function _connected(): bool |
547 | 547 | { |
548 | - return \is_resource($this->_socket) && ! feof($this->_socket); |
|
548 | + return \is_resource($this->_socket) && !feof($this->_socket); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | /** |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | { |
30 | 30 | $sql = $this->getListQuery($type, $activeOnly); |
31 | 31 | |
32 | - return Cache::flexible($sql, [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql) { |
|
32 | + return Cache::flexible($sql, [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($sql) { |
|
33 | 33 | return DB::select($sql); |
34 | 34 | }); |
35 | 35 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | private function getListQuery(string $type = '', bool $activeOnly = false): string |
49 | 49 | { |
50 | - if (! empty($type)) { |
|
50 | + if (!empty($type)) { |
|
51 | 51 | $typesql = sprintf(' AND g.type = %d', $type); |
52 | 52 | } else { |
53 | 53 | $typesql = ''; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | public function getCount(string $type = '', bool $activeOnly = false): mixed |
95 | 95 | { |
96 | - if (! empty($type)) { |
|
96 | + if (!empty($type)) { |
|
97 | 97 | $typesql = sprintf(' AND g.type = %d', $type); |
98 | 98 | } else { |
99 | 99 | $typesql = ''; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public function getDisabledIDs() |
150 | 150 | { |
151 | - return Cache::flexible('disabledCats', [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () { |
|
151 | + return Cache::flexible('disabledCats', [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() { |
|
152 | 152 | return Genre::query()->where('disabled', '=', 1)->get(['id']); |
153 | 153 | }); |
154 | 154 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $order[1] |
210 | 210 | ); |
211 | 211 | |
212 | - return Cache::flexible($sql.$page, [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql, $consoles) { |
|
212 | + return Cache::flexible($sql.$page, [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($sql, $consoles) { |
|
213 | 213 | $return = DB::select($sql); |
214 | 214 | if (\count($return) > 0) { |
215 | 215 | $return[0]->_totalcount = $consoles['total'][0]->total ?? 0; |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | { |
270 | 270 | $browseBy = ' '; |
271 | 271 | foreach ($this->getBrowseByOptions() as $bbk => $bbv) { |
272 | - if (! empty($_REQUEST[$bbk])) { |
|
272 | + if (!empty($_REQUEST[$bbk])) { |
|
273 | 273 | $bbs = stripslashes($_REQUEST[$bbk]); |
274 | 274 | $browseBy .= ' AND con.'.$bbv.' LIKE '.escapeString('%'.$bbs.'%'); |
275 | 275 | } |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | $con['esrb'] = (string) $amaz->ItemAttributes->ESRBAgeRating; |
395 | 395 | $con['releasedate'] = (string) $amaz->ItemAttributes->ReleaseDate; |
396 | 396 | |
397 | - if (! isset($con['releasedate'])) { |
|
397 | + if (!isset($con['releasedate'])) { |
|
398 | 398 | $con['releasedate'] = ''; |
399 | 399 | } |
400 | 400 | |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | if (config('config.credentials.client_id') !== '' && config('config.credentials.client_secret') !== '') { |
621 | 621 | try { |
622 | 622 | $result = Game::where('name', $gameInfo)->get(); |
623 | - if (! empty($result)) { |
|
623 | + if (!empty($result)) { |
|
624 | 624 | $bestMatchPct = 0; |
625 | 625 | foreach ($result as $res) { |
626 | 626 | similar_text(strtolower($gameInfo), strtolower($res->name), $percent); |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | ])->where('id', $bestMatch)->first(); |
639 | 639 | |
640 | 640 | $publishers = []; |
641 | - if (! empty($game->involved_companies)) { |
|
641 | + if (!empty($game->involved_companies)) { |
|
642 | 642 | foreach ($game->involved_companies as $publisher) { |
643 | 643 | if ($publisher['publisher'] === true) { |
644 | 644 | $company = Company::find($publisher['company']); |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | |
650 | 650 | $genres = []; |
651 | 651 | |
652 | - if (! empty($game->themes)) { |
|
652 | + if (!empty($game->themes)) { |
|
653 | 653 | foreach ($game->themes as $theme) { |
654 | 654 | $genres[] = $theme['name']; |
655 | 655 | } |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | |
660 | 660 | $platform = ''; |
661 | 661 | |
662 | - if (! empty($game->platforms)) { |
|
662 | + if (!empty($game->platforms)) { |
|
663 | 663 | foreach ($game->platforms as $platforms) { |
664 | 664 | $percentCurrent = 0; |
665 | 665 | $gamePlatforms = Platform::where('id', $platforms)->get(); |
@@ -678,13 +678,13 @@ discard block |
||
678 | 678 | 'title' => $game->name, |
679 | 679 | 'asin' => $game->id, |
680 | 680 | 'review' => $game->summary ?? '', |
681 | - 'coverurl' => ! empty($game->cover->url) ? 'https:'.$game->cover->url : '', |
|
682 | - 'releasedate' => ! empty($game->first_release_date) ? $game->first_release_date->format('Y-m-d') : now()->format('Y-m-d'), |
|
683 | - 'esrb' => ! empty($game->aggregated_rating) ? round($game->aggregated_rating).'%' : 'Not Rated', |
|
681 | + 'coverurl' => !empty($game->cover->url) ? 'https:'.$game->cover->url : '', |
|
682 | + 'releasedate' => !empty($game->first_release_date) ? $game->first_release_date->format('Y-m-d') : now()->format('Y-m-d'), |
|
683 | + 'esrb' => !empty($game->aggregated_rating) ? round($game->aggregated_rating).'%' : 'Not Rated', |
|
684 | 684 | 'url' => $game->url ?? '', |
685 | - 'publisher' => ! empty($publishers) ? implode(',', $publishers) : 'Unknown', |
|
685 | + 'publisher' => !empty($publishers) ? implode(',', $publishers) : 'Unknown', |
|
686 | 686 | 'platform' => $platform ?? '', |
687 | - 'consolegenre' => ! empty($genres) ? implode(',', $genres) : 'Unknown', |
|
687 | + 'consolegenre' => !empty($genres) ? implode(',', $genres) : 'Unknown', |
|
688 | 688 | 'consolegenreid' => $genreKey ?? '', |
689 | 689 | 'salesrank' => '', |
690 | 690 | ]; |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | $platform = 'PSX'; |
830 | 830 | } |
831 | 831 | |
832 | - if (! empty($title) && stripos('XBLA', $platform) === 0 && stripos('dlc', $title) !== false) { |
|
832 | + if (!empty($title) && stripos('XBLA', $platform) === 0 && stripos('dlc', $title) !== false) { |
|
833 | 833 | $platform = 'XBOX360'; |
834 | 834 | } |
835 | 835 | |
@@ -844,7 +844,7 @@ discard block |
||
844 | 844 | Other option is to pass the $release->categories_id here if we don't find a platform but that |
845 | 845 | would require an extra lookup to determine the name. In either case we should have a title at the minimum. */ |
846 | 846 | |
847 | - return (isset($result['title'], $result['platform']) && ! empty($result['title'])) ? $result : false; |
|
847 | + return (isset($result['title'], $result['platform']) && !empty($result['title'])) ? $result : false; |
|
848 | 848 | } |
849 | 849 | |
850 | 850 | public function getBrowseNode($platform): string |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | ($start === 0 ? ' LIMIT '.$num : ' LIMIT '.$num.' OFFSET '.$start) |
90 | 90 | ); |
91 | 91 | |
92 | - return Cache::flexible(md5($qry.$page), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($qry, $cat, $maxAge, $excludedCats, $groupName) { |
|
92 | + return Cache::flexible(md5($qry.$page), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($qry, $cat, $maxAge, $excludedCats, $groupName) { |
|
93 | 93 | $sql = self::fromQuery($qry); |
94 | 94 | if (\count($sql) > 0) { |
95 | 95 | $possibleRows = $this->getBrowseCount($cat, $maxAge, $excludedCats, $groupName); |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | GROUP BY r.id |
266 | 266 | ORDER BY %s %s %s", |
267 | 267 | $this->uSQL($userShows, 'videos_id'), |
268 | - (! empty($excludedCats) ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), |
|
268 | + (!empty($excludedCats) ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), |
|
269 | 269 | NZB::NZB_ADDED, |
270 | 270 | Category::TV_ROOT, |
271 | 271 | Category::TV_OTHER, |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | ($offset === false ? '' : (' LIMIT '.$limit.' OFFSET '.$offset)) |
277 | 277 | ); |
278 | 278 | |
279 | - return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql) { |
|
279 | + return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($sql) { |
|
280 | 280 | return self::fromQuery($sql); |
281 | 281 | }); |
282 | 282 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | { |
331 | 331 | // Delete NZB from disk. |
332 | 332 | $nzbPath = $nzb->NZBPath($identifiers['g']); |
333 | - if (! empty($nzbPath)) { |
|
333 | + if (!empty($nzbPath)) { |
|
334 | 334 | File::delete($nzbPath); |
335 | 335 | } |
336 | 336 | |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | */ |
371 | 371 | public function updateMulti($guids, $category, $grabs, $videoId, $episodeId, $anidbId, $imdbId) |
372 | 372 | { |
373 | - if (! \is_array($guids) || \count($guids) < 1) { |
|
373 | + if (!\is_array($guids) || \count($guids) < 1) { |
|
374 | 374 | return false; |
375 | 375 | } |
376 | 376 | |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | $sql = '(1=2 '; |
395 | 395 | foreach ($userQuery as $query) { |
396 | 396 | $sql .= sprintf('OR (r.%s = %d', $type, $query->$type); |
397 | - if (! empty($query->categories)) { |
|
397 | + if (!empty($query->categories)) { |
|
398 | 398 | $catsArr = explode('|', $query->categories); |
399 | 399 | if (\count($catsArr) > 1) { |
400 | 400 | $sql .= sprintf(' AND r.categories_id IN (%s)', implode(',', $catsArr)); |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | $orderBy = $this->getBrowseOrder($orderBy); |
436 | 436 | } |
437 | 437 | |
438 | - $searchFields = Arr::where($searchArr, static function ($value) { |
|
438 | + $searchFields = Arr::where($searchArr, static function($value) { |
|
439 | 439 | return $value !== -1; |
440 | 440 | }); |
441 | 441 | |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | $searchResult = $this->elasticSearch->indexSearch($phrases, $limit); |
446 | 446 | } else { |
447 | 447 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', '', [], $searchFields); |
448 | - if (! empty($searchResult)) { |
|
448 | + if (!empty($searchResult)) { |
|
449 | 449 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
450 | 450 | } |
451 | 451 | } |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | $offset |
511 | 511 | ); |
512 | 512 | |
513 | - return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql, $baseSql) { |
|
513 | + return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($sql, $baseSql) { |
|
514 | 514 | $releases = self::fromQuery($sql); |
515 | 515 | if ($releases->isNotEmpty()) { |
516 | 516 | $releases[0]->_totalrows = $this->getPagerCount($baseSql); |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | $searchResult = $this->elasticSearch->indexSearchApi($searchName, $limit); |
528 | 528 | } else { |
529 | 529 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $searchName, ['searchname']); |
530 | - if (! empty($searchResult)) { |
|
530 | + if (!empty($searchResult)) { |
|
531 | 531 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
532 | 532 | } |
533 | 533 | } |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | ((int) $groupName !== -1 ? sprintf(' AND r.groups_id = %d ', UsenetGroup::getIDByName($groupName)) : ''), |
544 | 544 | $catQuery, |
545 | 545 | (\count($excludedCats) > 0 ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), |
546 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
546 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
547 | 547 | ($minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '') |
548 | 548 | ); |
549 | 549 | $baseSql = sprintf( |
@@ -574,8 +574,8 @@ discard block |
||
574 | 574 | $offset |
575 | 575 | ); |
576 | 576 | |
577 | - return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql, $baseSql, $searchName, $searchResult) { |
|
578 | - if ($searchName !== -1 && ! empty($searchResult)) { |
|
577 | + return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($sql, $baseSql, $searchName, $searchResult) { |
|
578 | + if ($searchName !== -1 && !empty($searchResult)) { |
|
579 | 579 | $releases = self::fromQuery($sql); |
580 | 580 | } elseif ($searchName !== -1 && empty($searchResult)) { |
581 | 581 | $releases = collect(); |
@@ -627,11 +627,11 @@ discard block |
||
627 | 627 | $show = self::fromQuery($showQry); |
628 | 628 | |
629 | 629 | if ($show->isNotEmpty()) { |
630 | - if ((! empty($episode) && ! empty($series)) && $show[0]->episodes !== '') { |
|
630 | + if ((!empty($episode) && !empty($series)) && $show[0]->episodes !== '') { |
|
631 | 631 | $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series; |
632 | - } elseif (! empty($episode) && $show[0]->episodes !== '') { |
|
632 | + } elseif (!empty($episode) && $show[0]->episodes !== '') { |
|
633 | 633 | $showSql = sprintf('AND r.tv_episodes_id IN (%s)', $show[0]->episodes); |
634 | - } elseif (! empty($series) && empty($episode)) { |
|
634 | + } elseif (!empty($series) && empty($episode)) { |
|
635 | 635 | // If $series is set but episode is not, return Season Packs and Episodes |
636 | 636 | $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series; |
637 | 637 | } |
@@ -645,26 +645,26 @@ discard block |
||
645 | 645 | } |
646 | 646 | |
647 | 647 | // If $name is set it is a fallback search, add available SxxExx/airdate info to the query |
648 | - if (! empty($name) && $showSql === '') { |
|
649 | - if (! empty($series) && (int) $series < 1900) { |
|
648 | + if (!empty($name) && $showSql === '') { |
|
649 | + if (!empty($series) && (int) $series < 1900) { |
|
650 | 650 | $name .= sprintf(' S%s', str_pad($series, 2, '0', STR_PAD_LEFT)); |
651 | - if (! empty($episode) && ! str_contains($episode, '/')) { |
|
651 | + if (!empty($episode) && !str_contains($episode, '/')) { |
|
652 | 652 | $name .= sprintf('E%s', str_pad($episode, 2, '0', STR_PAD_LEFT)); |
653 | 653 | } |
654 | 654 | // If season is not empty but episode is, add a wildcard to the search |
655 | 655 | if (empty($episode)) { |
656 | 656 | $name .= '*'; |
657 | 657 | } |
658 | - } elseif (! empty($airDate)) { |
|
658 | + } elseif (!empty($airDate)) { |
|
659 | 659 | $name .= sprintf(' %s', str_replace(['/', '-', '.', '_'], ' ', $airDate)); |
660 | 660 | } |
661 | 661 | } |
662 | - if (! empty($name)) { |
|
662 | + if (!empty($name)) { |
|
663 | 663 | if (config('nntmux.elasticsearch_enabled') === true) { |
664 | 664 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
665 | 665 | } else { |
666 | 666 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
667 | - if (! empty($searchResult)) { |
|
667 | + if (!empty($searchResult)) { |
|
668 | 668 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
669 | 669 | } |
670 | 670 | } |
@@ -680,11 +680,11 @@ discard block |
||
680 | 680 | NZB::NZB_ADDED, |
681 | 681 | $this->showPasswords(), |
682 | 682 | $showSql, |
683 | - (! empty($name) && ! empty($searchResult)) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '', |
|
683 | + (!empty($name) && !empty($searchResult)) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '', |
|
684 | 684 | Category::getCategorySearch($cat), |
685 | 685 | $maxAge > 0 ? sprintf('AND r.postdate > NOW() - INTERVAL %d DAY', $maxAge) : '', |
686 | 686 | $minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '', |
687 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
687 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
688 | 688 | ); |
689 | 689 | $baseSql = sprintf( |
690 | 690 | "SELECT r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.videos_id, r.tv_episodes_id, r.haspreview, r.jpgstatus, |
@@ -717,8 +717,8 @@ discard block |
||
717 | 717 | $offset |
718 | 718 | ); |
719 | 719 | |
720 | - return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql, $baseSql, $name, $searchResult) { |
|
721 | - $releases = ((! empty($name) && ! empty($searchResult)) || empty($name)) ? self::fromQuery($sql) : []; |
|
720 | + return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($sql, $baseSql, $name, $searchResult) { |
|
721 | + $releases = ((!empty($name) && !empty($searchResult)) || empty($name)) ? self::fromQuery($sql) : []; |
|
722 | 722 | if (count($releases) !== 0 && $releases->isNotEmpty()) { |
723 | 723 | $releases[0]->_totalrows = $this->getPagerCount( |
724 | 724 | preg_replace('#LEFT(\s+OUTER)?\s+JOIN\s+(?!tv_episodes)\s+.*ON.*=.*\n#i', ' ', $baseSql) |
@@ -762,11 +762,11 @@ discard block |
||
762 | 762 | |
763 | 763 | $show = self::fromQuery($showQry); |
764 | 764 | if ($show->isNotEmpty()) { |
765 | - if ((! empty($episode) && ! empty($series)) && $show[0]->episodes !== '') { |
|
765 | + if ((!empty($episode) && !empty($series)) && $show[0]->episodes !== '') { |
|
766 | 766 | $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series; |
767 | - } elseif (! empty($episode) && $show[0]->episodes !== '') { |
|
767 | + } elseif (!empty($episode) && $show[0]->episodes !== '') { |
|
768 | 768 | $showSql = sprintf('AND r.tv_episodes_id IN (%s)', $show[0]->episodes); |
769 | - } elseif (! empty($series) && empty($episode)) { |
|
769 | + } elseif (!empty($series) && empty($episode)) { |
|
770 | 770 | // If $series is set but episode is not, return Season Packs and Episodes |
771 | 771 | $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series; |
772 | 772 | } |
@@ -779,26 +779,26 @@ discard block |
||
779 | 779 | } |
780 | 780 | } |
781 | 781 | // If $name is set it is a fallback search, add available SxxExx/airdate info to the query |
782 | - if (! empty($name) && $showSql === '') { |
|
783 | - if (! empty($series) && (int) $series < 1900) { |
|
782 | + if (!empty($name) && $showSql === '') { |
|
783 | + if (!empty($series) && (int) $series < 1900) { |
|
784 | 784 | $name .= sprintf(' S%s', str_pad($series, 2, '0', STR_PAD_LEFT)); |
785 | - if (! empty($episode) && ! str_contains($episode, '/')) { |
|
785 | + if (!empty($episode) && !str_contains($episode, '/')) { |
|
786 | 786 | $name .= sprintf('E%s', str_pad($episode, 2, '0', STR_PAD_LEFT)); |
787 | 787 | } |
788 | 788 | // If season is not empty but episode is, add a wildcard to the search |
789 | 789 | if (empty($episode)) { |
790 | 790 | $name .= '*'; |
791 | 791 | } |
792 | - } elseif (! empty($airDate)) { |
|
792 | + } elseif (!empty($airDate)) { |
|
793 | 793 | $name .= sprintf(' %s', str_replace(['/', '-', '.', '_'], ' ', $airDate)); |
794 | 794 | } |
795 | 795 | } |
796 | - if (! empty($name)) { |
|
796 | + if (!empty($name)) { |
|
797 | 797 | if (config('nntmux.elasticsearch_enabled') === true) { |
798 | 798 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
799 | 799 | } else { |
800 | 800 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
801 | - if (! empty($searchResult)) { |
|
801 | + if (!empty($searchResult)) { |
|
802 | 802 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
803 | 803 | } |
804 | 804 | } |
@@ -814,11 +814,11 @@ discard block |
||
814 | 814 | NZB::NZB_ADDED, |
815 | 815 | $this->showPasswords(), |
816 | 816 | $showSql, |
817 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
817 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
818 | 818 | Category::getCategorySearch($cat), |
819 | 819 | ($maxAge > 0 ? sprintf('AND r.postdate > NOW() - INTERVAL %d DAY', $maxAge) : ''), |
820 | 820 | ($minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : ''), |
821 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
821 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
822 | 822 | ); |
823 | 823 | $baseSql = sprintf( |
824 | 824 | "SELECT r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.tv_episodes_id, r.haspreview, r.jpgstatus, |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | $offset |
846 | 846 | ); |
847 | 847 | |
848 | - return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql, $baseSql) { |
|
848 | + return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($sql, $baseSql) { |
|
849 | 849 | $releases = self::fromQuery($sql); |
850 | 850 | if ($releases->isNotEmpty()) { |
851 | 851 | $releases[0]->_totalrows = $this->getPagerCount( |
@@ -862,12 +862,12 @@ discard block |
||
862 | 862 | */ |
863 | 863 | public function animeSearch($aniDbID, int $offset = 0, int $limit = 100, string $name = '', array $cat = [-1], int $maxAge = -1, array $excludedCategories = []): mixed |
864 | 864 | { |
865 | - if (! empty($name)) { |
|
865 | + if (!empty($name)) { |
|
866 | 866 | if (config('nntmux.elasticsearch_enabled') === true) { |
867 | 867 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
868 | 868 | } else { |
869 | 869 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
870 | - if (! empty($searchResult)) { |
|
870 | + if (!empty($searchResult)) { |
|
871 | 871 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
872 | 872 | } |
873 | 873 | } |
@@ -884,8 +884,8 @@ discard block |
||
884 | 884 | $this->showPasswords(), |
885 | 885 | NZB::NZB_ADDED, |
886 | 886 | ($aniDbID > -1 ? sprintf(' AND r.anidbid = %d ', $aniDbID) : ''), |
887 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
888 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
887 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
888 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
889 | 889 | Category::getCategorySearch($cat), |
890 | 890 | ($maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '') |
891 | 891 | ); |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | $offset |
912 | 912 | ); |
913 | 913 | |
914 | - return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql, $baseSql) { |
|
914 | + return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($sql, $baseSql) { |
|
915 | 915 | $releases = self::fromQuery($sql); |
916 | 916 | if ($releases->isNotEmpty()) { |
917 | 917 | $releases[0]->_totalrows = $this->getPagerCount($baseSql); |
@@ -926,12 +926,12 @@ discard block |
||
926 | 926 | */ |
927 | 927 | public function moviesSearch(int $imDbId = -1, int $tmDbId = -1, int $traktId = -1, int $offset = 0, int $limit = 100, string $name = '', array $cat = [-1], int $maxAge = -1, int $minSize = 0, array $excludedCategories = []): mixed |
928 | 928 | { |
929 | - if (! empty($name)) { |
|
929 | + if (!empty($name)) { |
|
930 | 930 | if (config('nntmux.elasticsearch_enabled') === true) { |
931 | 931 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
932 | 932 | } else { |
933 | 933 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
934 | - if (! empty($searchResult)) { |
|
934 | + if (!empty($searchResult)) { |
|
935 | 935 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
936 | 936 | } |
937 | 937 | } |
@@ -948,11 +948,11 @@ discard block |
||
948 | 948 | %s %s %s %s %s %s %s', |
949 | 949 | NZB::NZB_ADDED, |
950 | 950 | $this->showPasswords(), |
951 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
951 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
952 | 952 | ($imDbId !== -1 && is_numeric($imDbId)) ? sprintf(' AND m.imdbid = \'%s\' ', $imDbId) : '', |
953 | 953 | ($tmDbId !== -1 && is_numeric($tmDbId)) ? sprintf(' AND m.tmdbid = %d ', $tmDbId) : '', |
954 | 954 | ($traktId !== -1 && is_numeric($traktId)) ? sprintf(' AND m.traktid = %d ', $traktId) : '', |
955 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
955 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
956 | 956 | Category::getCategorySearch($cat), |
957 | 957 | $maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '', |
958 | 958 | $minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '' |
@@ -980,7 +980,7 @@ discard block |
||
980 | 980 | $offset |
981 | 981 | ); |
982 | 982 | |
983 | - return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql, $baseSql) { |
|
983 | + return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($sql, $baseSql) { |
|
984 | 984 | $releases = self::fromQuery($sql); |
985 | 985 | if ($releases->isNotEmpty()) { |
986 | 986 | $releases[0]->_totalrows = $this->getPagerCount($baseSql); |
@@ -1004,7 +1004,7 @@ discard block |
||
1004 | 1004 | } |
1005 | 1005 | |
1006 | 1006 | $results = $this->search(['searchname' => getSimilarName($name)], -1, '', '', -1, -1, 0, config('nntmux.items_per_page'), '', -1, $excludedCats, 'basic', [$parentCat]); |
1007 | - if (! $results) { |
|
1007 | + if (!$results) { |
|
1008 | 1008 | return $ret; |
1009 | 1009 | } |
1010 | 1010 | |
@@ -1027,7 +1027,7 @@ discard block |
||
1027 | 1027 | (int) config('nntmux.max_pager_results') |
1028 | 1028 | ); |
1029 | 1029 | |
1030 | - return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_short'), config('nntmux.cache_expiry_medium')], function () use ($sql) { |
|
1030 | + return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_short'), config('nntmux.cache_expiry_medium')], function() use ($sql) { |
|
1031 | 1031 | $count = self::fromQuery($sql); |
1032 | 1032 | |
1033 | 1033 | return $count[0]->count ?? 0; |