diff --git a/Blacklight/Books.php b/Blacklight/Books.php index c33bff34c..e2f52fc54 100755 --- a/Blacklight/Books.php +++ b/Blacklight/Books.php @@ -76,7 +76,7 @@ class Books $this->asstag = Settings::settingValue('APIs..amazonassociatetag'); $this->bookqty = Settings::settingValue('..maxbooksprocessed') !== '' ? (int) Settings::settingValue('..maxbooksprocessed') : 300; $this->sleeptime = Settings::settingValue('..amazonsleep') !== '' ? (int) Settings::settingValue('..amazonsleep') : 1000; - $this->imgSavePath = NN_COVERS.'book'.DS; + $this->imgSavePath = storage_path('covers/book/'); $result = Settings::settingValue('..book_reqids'); $this->bookreqids = $result ?? Category::BOOKS_EBOOK; $this->renamed = (int) Settings::settingValue('..lookupbooks') === 2 ? 'AND isrenamed = 1' : ''; diff --git a/Blacklight/Console.php b/Blacklight/Console.php index 0ac36f697..eaa3c4c6e 100755 --- a/Blacklight/Console.php +++ b/Blacklight/Console.php @@ -106,7 +106,7 @@ class Console $this->asstag = Settings::settingValue('APIs..amazonassociatetag'); $this->gameqty = (Settings::settingValue('..maxgamesprocessed') !== '') ? (int) Settings::settingValue('..maxgamesprocessed') : 150; $this->sleeptime = (Settings::settingValue('..amazonsleep') !== '') ? (int) Settings::settingValue('..amazonsleep') : 1000; - $this->imgSavePath = NN_COVERS.'console'.DS; + $this->imgSavePath = storage_path('covers/console/'); $this->renamed = (int) Settings::settingValue('..lookupgames') === 2; $this->failCache = []; diff --git a/Blacklight/Games.php b/Blacklight/Games.php index d3f27f904..7009c80f4 100755 --- a/Blacklight/Games.php +++ b/Blacklight/Games.php @@ -92,7 +92,7 @@ class Games $this->publicKey = config('nntmux_api.giantbomb_api_key'); $this->gameQty = Settings::settingValue('..maxgamesprocessed') !== '' ? (int) Settings::settingValue('..maxgamesprocessed') : 150; - $this->imgSavePath = NN_COVERS.'games'.DS; + $this->imgSavePath = storage_path('covers/games/'); $this->renamed = (int) Settings::settingValue('..lookupgames') === 2 ? 'AND isrenamed = 1' : ''; $this->matchPercentage = 60; $this->maxHitRequest = false; diff --git a/Blacklight/Movie.php b/Blacklight/Movie.php index 75d21811a..a7126eca4 100755 --- a/Blacklight/Movie.php +++ b/Blacklight/Movie.php @@ -197,7 +197,7 @@ class Movie $this->showPasswords = (new Releases())->showPasswords(); $this->echooutput = ($options['Echo'] && config('nntmux.echocli')); - $this->imgSavePath = NN_COVERS.'movies/'; + $this->imgSavePath = storage_path('covers/movies'); $this->service = ''; } diff --git a/Blacklight/Music.php b/Blacklight/Music.php index d8dcdafd0..40a63fa58 100755 --- a/Blacklight/Music.php +++ b/Blacklight/Music.php @@ -96,7 +96,7 @@ class Music $this->asstag = Settings::settingValue('APIs..amazonassociatetag'); $this->musicqty = Settings::settingValue('..maxmusicprocessed') !== '' ? (int) Settings::settingValue('..maxmusicprocessed') : 150; $this->sleeptime = Settings::settingValue('..amazonsleep') !== '' ? (int) Settings::settingValue('..amazonsleep') : 1000; - $this->imgSavePath = NN_COVERS.'music'.DS; + $this->imgSavePath = storage_path('covers/music/'); $this->renamed = (int) Settings::settingValue('..lookupmusic') === 2 ? 'AND isrenamed = 1' : ''; $this->failCache = []; diff --git a/Blacklight/ReleaseImage.php b/Blacklight/ReleaseImage.php index 93f94141e..c62e0e9fe 100755 --- a/Blacklight/ReleaseImage.php +++ b/Blacklight/ReleaseImage.php @@ -53,11 +53,11 @@ class ReleaseImage public function __construct() { $this->colorCli = new ColorCLI(); - $this->audSavePath = NN_COVERS.'audiosample'.DS; - $this->imgSavePath = NN_COVERS.'preview'.DS; - $this->jpgSavePath = NN_COVERS.'sample'.DS; - $this->movieImgSavePath = NN_COVERS.'movies'.DS; - $this->vidSavePath = NN_COVERS.'video'.DS; + $this->audSavePath = storage_path('covers/audiosample/'); + $this->imgSavePath = storage_path('covers/preview/'); + $this->jpgSavePath = storage_path('covers/sample/'); + $this->movieImgSavePath = storage_path('covers/movies/'); + $this->vidSavePath = storage_path('covers/video/'); } protected function fetchImage(string $imgLoc): \Intervention\Image\Image|bool diff --git a/Blacklight/Tmux.php b/Blacklight/Tmux.php index 0805239be..38adc5c72 100755 --- a/Blacklight/Tmux.php +++ b/Blacklight/Tmux.php @@ -227,7 +227,7 @@ class Tmux public function writelog($pane): ?string { - $path = NN_LOGS; + $path = storage_path('logs'); $getDate = now()->format('Y_m_d'); $logs = Settings::settingValue('site.tmux.write_logs') ?? 0; if ($logs === 1) { diff --git a/Blacklight/XXX.php b/Blacklight/XXX.php index cb8190dda..3b6c56427 100755 --- a/Blacklight/XXX.php +++ b/Blacklight/XXX.php @@ -69,8 +69,8 @@ class XXX $this->movieQty = Settings::settingValue('..maxxxxprocessed') !== '' ? (int) Settings::settingValue('..maxxxxprocessed') : 100; $this->showPasswords = (new Releases())->showPasswords(); $this->echoOutput = ($options['Echo'] && config('nntmux.echocli')); - $this->imgSavePath = NN_COVERS.'xxx'.DS; - $this->cookie = NN_TMP.'xxx.cookie'; + $this->imgSavePath = storage_path('covers/xxx/'); + $this->cookie = resource_path('tmp/xxx.cookie'); } /** diff --git a/Blacklight/db/populate/AniDB.php b/Blacklight/db/populate/AniDB.php index a3ca1e205..9e085f396 100755 --- a/Blacklight/db/populate/AniDB.php +++ b/Blacklight/db/populate/AniDB.php @@ -65,7 +65,7 @@ class AniDB $anidbupdint = Settings::settingValue('APIs.AniDB.max_update_frequency'); $lastupdated = Settings::settingValue('APIs.AniDB.last_full_update'); - $this->imgSavePath = NN_COVERS.'anime'.DS; + $this->imgSavePath = storage_path('covers/anime/'); $this->apiKey = config('nntmux_api.anidb_api_key'); $this->updateInterval = $anidbupdint ?? '7'; diff --git a/Blacklight/processing/post/ProcessAdditional.php b/Blacklight/processing/post/ProcessAdditional.php index 14bc38edc..32b039ad5 100755 --- a/Blacklight/processing/post/ProcessAdditional.php +++ b/Blacklight/processing/post/ProcessAdditional.php @@ -372,7 +372,7 @@ class ProcessAdditional $this->_processAudioInfo = $this->_processMediaInfo; $this->_processPasswords = ! empty(Settings::settingValue('..checkpasswordedrar')) && ! empty(Settings::settingValue('apps..unrarpath')); - $this->_audioSavePath = NN_COVERS.'audiosample'.DS; + $this->_audioSavePath = storage_path('covers/audiosample/'); $this->_audioFileRegex = '\.(AAC|AIFF|APE|AC3|ASF|DTS|FLAC|MKA|MKS|MP2|MP3|RA|OGG|OGM|W64|WAV|WMA)'; $this->_ignoreBookRegex = '/\b(epub|lit|mobi|pdf|sipdf|html)\b.*\.rar(?!.{20,})/i'; diff --git a/Blacklight/processing/tv/TV.php b/Blacklight/processing/tv/TV.php index a50eaecc2..24ba5da99 100755 --- a/Blacklight/processing/tv/TV.php +++ b/Blacklight/processing/tv/TV.php @@ -87,7 +87,7 @@ abstract class TV extends Videos $this->colorCli = new ColorCLI(); $this->catWhere = 'categories_id BETWEEN '.Category::TV_ROOT.' AND '.Category::TV_OTHER.' AND categories_id != '.Category::TV_ANIME; $this->tvqty = Settings::settingValue('..maxrageprocessed') !== '' ? (int) Settings::settingValue('..maxrageprocessed') : 75; - $this->imgSavePath = NN_COVERS.'tvshows'.DS; + $this->imgSavePath = storage_path('covers/tvshows/'); $this->siteColumns = ['tvdb', 'trakt', 'tvrage', 'tvmaze', 'imdb', 'tmdb']; } diff --git a/Blacklight/utility/Utility.php b/Blacklight/utility/Utility.php index ee62c2529..b752b0228 100755 --- a/Blacklight/utility/Utility.php +++ b/Blacklight/utility/Utility.php @@ -56,23 +56,6 @@ class Utility return $string === '' ? false : $string; } - public static function setCoversConstant($path): void - { - if (! \defined('NN_COVERS')) { - switch (true) { - case $path[0] === '/' || $path[1] === ':' || $path[0] === '\\': - \define('NN_COVERS', Str::finish($path, '/')); - break; - case $path !== '' && $path[0] !== '/' && $path[1] !== ':' && $path[0] !== '\\': - \define('NN_COVERS', realpath(base_path().Str::finish($path, '/'))); - break; - case empty($path): // Default to resources location. - default: - \define('NN_COVERS', NN_RES.'covers/'); - } - } - } - /** * Creates an array to be used with stream_context_create() to verify openssl certificates * when connecting to a tls or ssl connection when using stream functions (fopen/file_get_contents/etc). @@ -126,7 +109,7 @@ class Utility ) ) { $fileSpec = sprintf($fileSpecTemplate, $options['type'], $options['id'], $options['suffix']); - $fileSpec = file_exists(NN_COVERS.$fileSpec) ? $fileSpec : + $fileSpec = file_exists(storage_path('covers').$fileSpec) ? $fileSpec : sprintf($fileSpecTemplate, $options['type'], 'no', $options['suffix']); } diff --git a/app/Console/Commands/NntmuxResetDb.php b/app/Console/Commands/NntmuxResetDb.php index cdd482940..393e48cf4 100644 --- a/app/Console/Commands/NntmuxResetDb.php +++ b/app/Console/Commands/NntmuxResetDb.php @@ -177,7 +177,7 @@ class NntmuxResetDb extends Command $this->info('Deleting all images, previews and samples that still remain.'); - $files = File::allFiles(NN_COVERS); + $files = File::allFiles(storage_path('covers/')); foreach ($files as $file) { if (basename($file) !== '.gitignore' && basename($file) !== 'no-cover.jpg' && basename($file) !== 'no-backdrop.jpg') { File::delete($file); diff --git a/app/Http/Controllers/Admin/AdminGameController.php b/app/Http/Controllers/Admin/AdminGameController.php index 095e63dc1..05efbef37 100644 --- a/app/Http/Controllers/Admin/AdminGameController.php +++ b/app/Http/Controllers/Admin/AdminGameController.php @@ -54,7 +54,7 @@ class AdminGameController extends BasePageController switch ($action) { case 'submit': - $coverLoc = NN_COVERS.'games/'.$id.'.jpg'; + $coverLoc = storage_path('covers/games/').$id.'.jpg'; if ($_FILES['cover']['size'] > 0) { $tmpName = $_FILES['cover']['tmp_name']; diff --git a/app/Http/Controllers/Admin/AdminSiteController.php b/app/Http/Controllers/Admin/AdminSiteController.php index cdbcf1fc6..3fb4932f6 100644 --- a/app/Http/Controllers/Admin/AdminSiteController.php +++ b/app/Http/Controllers/Admin/AdminSiteController.php @@ -133,7 +133,7 @@ class AdminSiteController extends BasePageController $this->smarty->assign('lookup_reqids_ids', [0, 1, 2]); $this->smarty->assign('lookup_reqids_names', ['Disabled', 'Lookup Request IDs', 'Lookup Request IDs Threaded']); - $this->smarty->assign('coversPath', NN_COVERS); + $this->smarty->assign('coversPath', storage_path('covers/')); // return a list of audiobooks, mags, ebooks, technical and foreign books $result = Category::query()->whereIn('id', [Category::MUSIC_AUDIOBOOK, Category::BOOKS_MAGAZINES, Category::BOOKS_TECHNICAL, Category::BOOKS_FOREIGN])->get(['id', 'title']); diff --git a/bootstrap/autoload.php b/bootstrap/autoload.php index 274c50586..eec58a304 100644 --- a/bootstrap/autoload.php +++ b/bootstrap/autoload.php @@ -2,7 +2,6 @@ require_once dirname(__DIR__).DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'autoload.php'; require __DIR__.DIRECTORY_SEPARATOR.'app.php'; -require_once 'constants.php'; require_once dirname(__DIR__).DIRECTORY_SEPARATOR.'app/Extensions/util/PhpYenc.php'; use Dotenv\Dotenv; diff --git a/bootstrap/constants.php b/bootstrap/constants.php deleted file mode 100644 index d7e30b2b9..000000000 --- a/bootstrap/constants.php +++ /dev/null @@ -1,44 +0,0 @@ - 0) { if ($gameData === false) { $colorCli->primary($gameInfo['release'].' not found'); } else { - if (file_exists(NN_COVERS.'games'.DS.$gameData.'.jpg')) { + if (file_exists(storage_path('covers/games/').$gameData.'.jpg')) { $pdo->exec(sprintf('UPDATE gamesinfo SET cover = 1 WHERE id = %d', $arr['id'])); } } diff --git a/misc/testing/PostProc/getXXXSamples.php b/misc/testing/PostProc/getXXXSamples.php index 2abd5b3a9..f5644cfdc 100644 --- a/misc/testing/PostProc/getXXXSamples.php +++ b/misc/testing/PostProc/getXXXSamples.php @@ -9,7 +9,7 @@ use Blacklight\ReleaseImage; $pdo = DB::connection()->getPdo(); $colorCli = new ColorCLI(); -$path2cover = NN_COVERS.'samples'.DS; +$path2cover = storage_path('covers/sample/'); if (isset($argv[1]) && ($argv[1] === 'true' || $argv[1] === 'check')) { $releaseImage = new ReleaseImage(); diff --git a/misc/testing/PostProc/updateBookImages.php b/misc/testing/PostProc/updateBookImages.php index d64a34b5e..f2a0f1c19 100644 --- a/misc/testing/PostProc/updateBookImages.php +++ b/misc/testing/PostProc/updateBookImages.php @@ -14,7 +14,7 @@ if ($argc === 1 || $argv[1] !== 'true') { exit(); } -$path2covers = NN_COVERS.'book'.DS; +$path2covers = storage_path('covers/book/'); $itr = File::allFiles($path2covers); foreach ($itr as $filePath) { diff --git a/misc/testing/PostProc/updateConsoleImages.php b/misc/testing/PostProc/updateConsoleImages.php index 994fa0776..593770c3a 100644 --- a/misc/testing/PostProc/updateConsoleImages.php +++ b/misc/testing/PostProc/updateConsoleImages.php @@ -14,7 +14,7 @@ if ($argc === 1 || $argv[1] !== 'true') { exit(); } -$path2covers = NN_COVERS.'console'.DS; +$path2covers = storage_path('covers/console/'); $itr = File::allFiles($path2covers); foreach ($itr as $filePath) { diff --git a/misc/testing/PostProc/updateGamesImages.php b/misc/testing/PostProc/updateGamesImages.php index 6789a4bb2..d655ec027 100644 --- a/misc/testing/PostProc/updateGamesImages.php +++ b/misc/testing/PostProc/updateGamesImages.php @@ -25,7 +25,7 @@ if ($row !== null) { } else { exit("Unable to set Covers' constant!\n"); } -$path2covers = NN_COVERS.'games'.DS; +$path2covers = storage_path('covers/games/'); $itr = File::allFiles($path2covers); foreach ($itr as $filePath) { diff --git a/misc/testing/PostProc/updateMovieImages.php b/misc/testing/PostProc/updateMovieImages.php index 790a5ab12..78d44bca3 100644 --- a/misc/testing/PostProc/updateMovieImages.php +++ b/misc/testing/PostProc/updateMovieImages.php @@ -22,7 +22,7 @@ if ($row !== null) { } else { exit("Unable to set Covers' constant!\n"); } -$path2covers = NN_COVERS.'movies'.DS; +$path2covers = storage_path('covers/movies'); $itr = File::allFiles($path2covers); foreach ($itr as $filePath) { diff --git a/misc/testing/PostProc/updateMusicImages.php b/misc/testing/PostProc/updateMusicImages.php index 897d68edd..707683691 100644 --- a/misc/testing/PostProc/updateMusicImages.php +++ b/misc/testing/PostProc/updateMusicImages.php @@ -14,7 +14,7 @@ if ($argc === 1 || $argv[1] !== 'true') { exit(); } -$path2covers = NN_COVERS.'music'.DS; +$path2covers = storage_path('covers/music/'); $itr = File::allFiles($path2covers); foreach ($itr as $filePath) { diff --git a/misc/testing/PostProc/updateXXXImages.php b/misc/testing/PostProc/updateXXXImages.php index 5eb74864b..8037db28e 100644 --- a/misc/testing/PostProc/updateXXXImages.php +++ b/misc/testing/PostProc/updateXXXImages.php @@ -14,7 +14,7 @@ if ($argc === 1 || $argv[1] !== 'true') { exit(); } -$path2covers = NN_COVERS.'xxx'.DS; +$path2covers = storage_path('covers/xxx/'); $itr = File::allFiles($path2covers); foreach ($itr as $filePath) { diff --git a/misc/testing/nzb-export.php b/misc/testing/nzb-export.php index d4bdcb01c..d027374ff 100644 --- a/misc/testing/nzb-export.php +++ b/misc/testing/nzb-export.php @@ -18,8 +18,8 @@ if (count($argv) !== 6) { 'arg4 : Group ID for the group or false | number/false'.$n. 'arg5 : Gzip the NZB files (recommended, faster/takes less space) | true/false'.$n.$n. 'Examples: '.$n. - $_SERVER['_'].' '.$argv[0].' '.NN_ROOT.'exportFolder'.DS.' 01/01/2012 01/01/2014 false true'.$n. - $_SERVER['_'].' '.$argv[0].' '.NN_ROOT.'exportFolder'.DS.' false 01/01/2014 12 false'.$n + $_SERVER['_'].' '.$argv[0].' '.base_path('exportFolder/01/01/2012 01/01/2014 false true').$n. + $_SERVER['_'].' '.$argv[0].' '.base_path('exportFolder/ false 01/01/2014 12 false').$n ); } diff --git a/misc/testing/nzb-import.php b/misc/testing/nzb-import.php index b15f7cdef..df6cf8162 100644 --- a/misc/testing/nzb-import.php +++ b/misc/testing/nzb-import.php @@ -18,7 +18,7 @@ if (count($argv) !== 6) { 'arg3 : Delete NZB when unsuccessfully imported.(not recommended) | true/false'.$n. 'arg4 : Use NZB file name as release name.(not recommended) | true/false'.$n. 'arg5 : Import this many NZB files. (RECOMMENDED 100,000) | a number'.$n.$n. - 'ie: '.$_SERVER['_'].' '.__FILE__.' '.NN_ROOT.'nzbToImport'.DS.' true false false 1000'.$n + 'ie: '.$_SERVER['_'].' '.__FILE__.' '.base_path('nzbToImport/ true false false 1000').$n ); }