From e577141d87ffb8ebb41338c49d36ccff5f1c6de2 Mon Sep 17 00:00:00 2001 From: DariusIII Date: Sat, 1 Apr 2023 23:05:58 +0200 Subject: [PATCH] Fix couple of occurences of missed DS constant usage --- Blacklight/NZBExport.php | 29 ++++++------------- Blacklight/Nfo.php | 2 +- .../processing/post/ProcessAdditional.php | 2 +- .../Controllers/Admin/AdminNzbController.php | 5 ++-- misc/testing/nzb-export.php | 2 +- 5 files changed, 15 insertions(+), 25 deletions(-) diff --git a/Blacklight/NZBExport.php b/Blacklight/NZBExport.php index 645ed833e..59206ac43 100755 --- a/Blacklight/NZBExport.php +++ b/Blacklight/NZBExport.php @@ -5,33 +5,22 @@ namespace Blacklight; use App\Models\UsenetGroup; use Blacklight\utility\Utility; use Illuminate\Support\Facades\File; +use Illuminate\Support\Str; /** * Class NZBExport. */ class NZBExport { - /** - * @var mixed - */ - protected $browser; + protected mixed $browser; protected $retVal; - /** - * @var NZB - */ - protected $nzb; + protected NZB $nzb; - /** - * @var Releases - */ - protected $releases; + protected Releases $releases; - /** - * @var bool - */ - protected $echoCLI; + protected bool $echoCLI; /** * NZBExport constructor. @@ -70,8 +59,8 @@ class NZBExport $path = $params[0]; // Check if the path ends with dir separator. - if (substr($path, -1) !== DS) { - $path .= DS; + if (! Str::endsWith($path, '/')) { + $path .= '/'; } // Check if it's a directory. @@ -202,9 +191,9 @@ class NZBExport } /** - * @return bool|string + * @return true */ - protected function returnValue() + protected function returnValue(): bool { return $this->browser ? $this->retVal : true; } diff --git a/Blacklight/Nfo.php b/Blacklight/Nfo.php index b69b01425..4034943e0 100755 --- a/Blacklight/Nfo.php +++ b/Blacklight/Nfo.php @@ -78,7 +78,7 @@ class Nfo $this->tmpPath = (string) Settings::settingValue('..tmpunrarpath'); if (! preg_match('/[\/\\\\]$/', $this->tmpPath)) { - $this->tmpPath .= DS; + $this->tmpPath .= '/'; } } diff --git a/Blacklight/processing/post/ProcessAdditional.php b/Blacklight/processing/post/ProcessAdditional.php index e5bb2b6a6..7f8896256 100755 --- a/Blacklight/processing/post/ProcessAdditional.php +++ b/Blacklight/processing/post/ProcessAdditional.php @@ -428,7 +428,7 @@ class ProcessAdditional // Check if it ends with a dir separator. if (! preg_match('/[\/\\\\]$/', $this->_mainTmpPath)) { - $this->_mainTmpPath .= DS; + $this->_mainTmpPath .= '/'; } // If we are doing per group, use the groupID has a inner path, so other scripts don't delete the files we are working on. diff --git a/app/Http/Controllers/Admin/AdminNzbController.php b/app/Http/Controllers/Admin/AdminNzbController.php index bb2763af6..d86405939 100644 --- a/app/Http/Controllers/Admin/AdminNzbController.php +++ b/app/Http/Controllers/Admin/AdminNzbController.php @@ -7,6 +7,7 @@ use Blacklight\NZBExport; use Blacklight\NZBImport; use Blacklight\Releases; use Illuminate\Http\Request; +use Illuminate\Support\Str; class AdminNzbController extends BasePageController { @@ -39,8 +40,8 @@ class AdminNzbController extends BasePageController // Get the path the user set in the browser if he put one. $path = ($request->has('folder') ? $request->input('folder') : ''); - if (substr($path, \strlen($path) - 1) !== DS) { - $path .= DS; + if (! Str::endsWith($path, '/')) { + $path .= '/'; } // Get the files from the user specified path. diff --git a/misc/testing/nzb-export.php b/misc/testing/nzb-export.php index d027374ff..c84f35790 100644 --- a/misc/testing/nzb-export.php +++ b/misc/testing/nzb-export.php @@ -35,6 +35,6 @@ $NE->beginExport( // Group ID. (strtolower($argv[4]) === 'false' ? 0 : (int) $argv[4]), // Gzip. - (strtolower($argv[5]) === 'true' ? true : false), + strtolower($argv[5]) === 'true', ] );