From 65a1e5ff071c955cb243080b4990e752b032b4c1 Mon Sep 17 00:00:00 2001 From: DariusIII Date: Fri, 1 Sep 2017 10:49:35 +0200 Subject: [PATCH] Rename Models/Settings value function into settingValue to prevent collision with query builder value response --- Changelog | 5 +- app/Extensions/util/Versions.php | 2 +- app/Models/Settings.php | 6 +- bootstrap/yenc.php | 2 +- misc/testing/DB/convert_to_tpg.php | 2 +- misc/testing/DB/resetdb.php | 2 +- misc/testing/Dev/clean_nzbs.php | 2 +- misc/testing/Releases/fixReleaseNames.php | 2 +- misc/testing/Tests/test_amazon_API.php | 6 +- misc/testing/Tests/test_fanarttv_API.php | 2 +- .../tpg_delete_triggers_2015-08-14.php | 2 +- misc/testing/_run_once/tpg_fixes.php | 2 +- .../tpg_update_triggers_2014-09-25.php | 2 +- misc/testing/fix_filesize.php | 2 +- .../multiprocessing/.do_not_run/switch.php | 6 +- misc/update/nix/tmux/bin/groupfixrelnames.php | 2 +- misc/update/nix/tmux/monitor.php | 2 +- misc/update/nix/tmux/run.php | 4 +- misc/update/postprocess.php | 2 +- misc/update/update_binaries.php | 2 +- nntmux/Backfill.php | 8 +- nntmux/Binaries.php | 20 ++--- nntmux/Books.php | 14 ++-- nntmux/Categorize.php | 4 +- nntmux/Console.php | 12 +-- nntmux/Games.php | 6 +- nntmux/Logging.php | 4 +- nntmux/MiscSorter.php | 6 +- nntmux/Movie.php | 14 ++-- nntmux/Music.php | 12 +-- nntmux/NNTP.php | 6 +- nntmux/NZB.php | 4 +- nntmux/NZBContents.php | 4 +- nntmux/NZBImport.php | 2 +- nntmux/Nfo.php | 16 ++-- nntmux/ReleaseComments.php | 2 +- nntmux/Releases.php | 6 +- nntmux/RequestIDWeb.php | 4 +- nntmux/SABnzbd.php | 12 +-- nntmux/Steam.php | 2 +- nntmux/TmuxRun.php | 2 +- nntmux/Users.php | 16 ++-- nntmux/XXX.php | 2 +- nntmux/db/DB.php | 2 +- nntmux/db/DbUpdate.php | 4 +- nntmux/db/populate/AniDB.php | 8 +- nntmux/http/Capabilities.php | 10 +-- nntmux/libraries/Forking.php | 52 ++++++------- nntmux/processing/PostProcess.php | 24 +++--- nntmux/processing/ProcessReleases.php | 52 ++++++------- nntmux/processing/post/AniDB.php | 2 +- nntmux/processing/post/ProcessAdditional.php | 76 +++++++++---------- nntmux/processing/tv/TMDB.php | 2 +- nntmux/processing/tv/TV.php | 2 +- nntmux/processing/tv/TraktTv.php | 2 +- nntmux/utility/Utility.php | 8 +- public/admin/site-edit.php | 2 +- public/admin/user-edit.php | 2 +- public/index.php | 4 +- public/pages/BasePage.php | 10 +-- public/pages/Page.php | 2 +- public/pages/ajax_profile.php | 2 +- public/pages/api.php | 2 +- public/pages/contact-us.php | 10 +-- public/pages/details.php | 8 +- public/pages/failed.php | 2 +- public/pages/forgottenpassword.php | 8 +- public/pages/forum.php | 2 +- public/pages/forumpost.php | 2 +- public/pages/getnzb.php | 6 +- public/pages/mymovies.php | 2 +- public/pages/myshows.php | 2 +- public/pages/profile.php | 2 +- public/pages/profileedit.php | 2 +- public/pages/queue.php | 2 +- public/pages/register.php | 4 +- public/pages/rss.php | 6 +- public/pages/sitemap.php | 6 +- public/pages/terms-and-conditions.php | 4 +- 79 files changed, 286 insertions(+), 285 deletions(-) diff --git a/Changelog b/Changelog index baed19854..39bd33863 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 2017-09-01 DariusIII + * Chg: Rename Models/Settings value function into settingValue to prevent collision with query builder value response * Chg: Update laravel/framework to version 5.5.1 * Chg: Trim leading/trailing whitespace in DB->settingsUpdate function * Chg: Use array in where clause of query in value function of Settings model @@ -232,7 +233,7 @@ * Chg: Move tmux starting tmux-ui script to root of the NNTmux install * Chg: Rename misc/update/nix/tmux/tmux-ui.php to just tmux-ui * Chg: Use strict comparisons and cast int where needed in TmuxRun class - * Chg: Cast int type to all Settings::value lines, as that function returns string + * Chg: Cast int type to all Settings::settingValue lines, as that function returns string * Chg: Change error message with no group selected in Backfill class * Chg: Use ColorCLI in update_binaries script * Chg: Slightly improve misc/update/backfill.php script @@ -820,7 +821,7 @@ * Chg: Add user notes to themes and fix notes in admin area 2016-09-07 DariusIII * Chg: Use PHP own decodeIgnore in yenc - * Chg: Make Settings::value more robust + * Chg: Make Settings::settingValue more robust 2016-09-05 DariusIII * Chg: Update XSS vulnerability protection in themes. * Chg: Update composer installer to version 1.2.0 diff --git a/app/Extensions/util/Versions.php b/app/Extensions/util/Versions.php index b03cb5ac1..b96d2d094 100644 --- a/app/Extensions/util/Versions.php +++ b/app/Extensions/util/Versions.php @@ -207,7 +207,7 @@ class Versions extends Collection public function getSQLPatchFromDB() { - $dbVersion = Settings::value('..sqlpatch', true); + $dbVersion = Settings::settingValue('..sqlpatch', true); if (! is_numeric($dbVersion)) { throw new \RuntimeException('Bad sqlpatch value'); diff --git a/app/Models/Settings.php b/app/Models/Settings.php index 389f234c8..c4c83dc36 100644 --- a/app/Models/Settings.php +++ b/app/Models/Settings.php @@ -204,15 +204,15 @@ class Settings extends Model * so it will be slower: Explicitly use the array format if speed it paramount. * Be aware that this method only returns the first of any values found, so make sure your * $setting produces a unique result. - * @param $setting + * @param bool|array $setting * @param bool $returnAlways Indicates if the method should throw an exception (false) or return * null on failure. Defaults to throwing an exception. * * @return string|null The setting's value, or null on failure IF 'returnAlways' is true. * @throws \Exception */ - public static function value($setting, $returnAlways = false) - { + public static function settingValue($setting, $returnAlways = false): ?string + { $setting = self::settingToArray($setting); $result = self::query()->where([ 'section' => $setting['section'], diff --git a/bootstrap/yenc.php b/bootstrap/yenc.php index 69c60fbb4..3510392d9 100644 --- a/bootstrap/yenc.php +++ b/bootstrap/yenc.php @@ -37,7 +37,7 @@ if (defined('NN_INSTALLER') && NN_INSTALLER !== false) { ignored. Please update it to use the extension.', E_USER_WARNING ); } - case ! empty(Settings::value('apps..yydecoderpath')): + case ! empty(Settings::settingValue('apps..yydecoderpath')): $adapter = 'Ydecode'; break; default: diff --git a/misc/testing/DB/convert_to_tpg.php b/misc/testing/DB/convert_to_tpg.php index 7942efb86..44c88d2a0 100644 --- a/misc/testing/DB/convert_to_tpg.php +++ b/misc/testing/DB/convert_to_tpg.php @@ -11,7 +11,7 @@ $debug = false; $pdo = new DB(); $groups = new Groups(['Settings' => $pdo]); $consoletools = new ConsoleTools(['ColorCLI' => $pdo->log]); -$DoPartRepair = (Settings::value('..partrepair') == '0') ? false : true; +$DoPartRepair = (Settings::settingValue('..partrepair') == '0') ? false : true; if ((! isset($argv[1])) || $argv[1] != 'true') { exit($pdo->log->error("\nMandatory argument missing\n\n" diff --git a/misc/testing/DB/resetdb.php b/misc/testing/DB/resetdb.php index cf140f3e9..08687f33d 100644 --- a/misc/testing/DB/resetdb.php +++ b/misc/testing/DB/resetdb.php @@ -61,7 +61,7 @@ $pdo->optimise(false, 'full'); echo ColorCLI::header('Deleting nzbfiles subfolders.'); try { - $files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(Settings::value('..nzbpath'), \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::CHILD_FIRST); + $files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(Settings::settingValue('..nzbpath'), \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::CHILD_FIRST); foreach ($files as $file) { if (basename($file) !== '.gitignore' && basename($file) !== 'tmpunrar') { $todo = ($file->isDir() ? 'rmdir' : 'unlink'); diff --git a/misc/testing/Dev/clean_nzbs.php b/misc/testing/Dev/clean_nzbs.php index 9b0e6008f..401217c84 100644 --- a/misc/testing/Dev/clean_nzbs.php +++ b/misc/testing/Dev/clean_nzbs.php @@ -34,7 +34,7 @@ $couldbe = ($argv[1] === 'true') ? 'could be ' : ''; echo $pdo->log->header('Getting List of nzbs to check against db.'); echo $pdo->log->header("Checked / {$couldbe}moved\n"); -$dirItr = new \RecursiveDirectoryIterator(Settings::value('..nzbpath')); +$dirItr = new \RecursiveDirectoryIterator(Settings::settingValue('..nzbpath')); $itr = new \RecursiveIteratorIterator($dirItr, \RecursiveIteratorIterator::LEAVES_ONLY); foreach ($itr as $filePath) { diff --git a/misc/testing/Releases/fixReleaseNames.php b/misc/testing/Releases/fixReleaseNames.php index f28db8c8b..6799ad658 100755 --- a/misc/testing/Releases/fixReleaseNames.php +++ b/misc/testing/Releases/fixReleaseNames.php @@ -35,7 +35,7 @@ if (isset($argv[1], $argv[2], $argv[3], $argv[4])) { $nntp = null; if ($argv[1] === 7 || $argv[1] === 8) { $nntp = new NNTP(['Settings' => $pdo]); - if ((Settings::value('..alternate_nntp') === 1 ? $nntp->doConnect(true, true) : $nntp->doConnect()) !== true) { + if ((Settings::settingValue('..alternate_nntp') === 1 ? $nntp->doConnect(true, true) : $nntp->doConnect()) !== true) { echo ColorCLI::error('Unable to connect to usenet.'.PHP_EOL); return; diff --git a/misc/testing/Tests/test_amazon_API.php b/misc/testing/Tests/test_amazon_API.php index bda8c6b5f..09f6dd3db 100644 --- a/misc/testing/Tests/test_amazon_API.php +++ b/misc/testing/Tests/test_amazon_API.php @@ -7,9 +7,9 @@ use App\Models\Settings; use ApaiIO\Operations\Search; use ApaiIO\Configuration\GenericConfiguration; -$pubkey = Settings::value('APIs..amazonpubkey'); -$privkey = Settings::value('APIs..amazonprivkey'); -$asstag = Settings::value('APIs..amazonassociatetag'); +$pubkey = Settings::settingValue('APIs..amazonpubkey'); +$privkey = Settings::settingValue('APIs..amazonprivkey'); +$asstag = Settings::settingValue('APIs..amazonassociatetag'); $conf = new GenericConfiguration(); $client = new \GuzzleHttp\Client(); diff --git a/misc/testing/Tests/test_fanarttv_API.php b/misc/testing/Tests/test_fanarttv_API.php index fb71ba6e2..bb77c5208 100644 --- a/misc/testing/Tests/test_fanarttv_API.php +++ b/misc/testing/Tests/test_fanarttv_API.php @@ -6,7 +6,7 @@ use nntmux\ColorCLI; use App\Models\Settings; use nntmux\libraries\FanartTV; -$fanart = new FanartTV(Settings::value('APIs..fanarttvkey')); +$fanart = new FanartTV(Settings::settingValue('APIs..fanarttvkey')); if (! empty($argv[1])) { diff --git a/misc/testing/_run_once/tpg_delete_triggers_2015-08-14.php b/misc/testing/_run_once/tpg_delete_triggers_2015-08-14.php index 9fee670d8..55dc232b9 100644 --- a/misc/testing/_run_once/tpg_delete_triggers_2015-08-14.php +++ b/misc/testing/_run_once/tpg_delete_triggers_2015-08-14.php @@ -25,7 +25,7 @@ use App\Models\Settings; $pdo = new DB(); -if (! Settings::value('..tablepergroup')) { +if (! Settings::settingValue('..tablepergroup')) { exit('Tables per groups is not enabled, quitting!'); } diff --git a/misc/testing/_run_once/tpg_fixes.php b/misc/testing/_run_once/tpg_fixes.php index e63b06843..ab676020e 100644 --- a/misc/testing/_run_once/tpg_fixes.php +++ b/misc/testing/_run_once/tpg_fixes.php @@ -31,7 +31,7 @@ use App\Models\Settings; $pdo = new DB(); -if (! Settings::value('..tablepergroup')) { +if (! Settings::settingValue('..tablepergroup')) { exit('Tables per groups is not enabled, quitting!'); } diff --git a/misc/testing/_run_once/tpg_update_triggers_2014-09-25.php b/misc/testing/_run_once/tpg_update_triggers_2014-09-25.php index 22a3213f3..af1059b5f 100644 --- a/misc/testing/_run_once/tpg_update_triggers_2014-09-25.php +++ b/misc/testing/_run_once/tpg_update_triggers_2014-09-25.php @@ -25,7 +25,7 @@ use App\Models\Settings; $pdo = new DB(); -if (! Settings::value('..tablepergroup')) { +if (! Settings::settingValue('..tablepergroup')) { exit('Tables per groups is not enabled, quitting!'); } diff --git a/misc/testing/fix_filesize.php b/misc/testing/fix_filesize.php index 438ef29f0..4cda0a43f 100644 --- a/misc/testing/fix_filesize.php +++ b/misc/testing/fix_filesize.php @@ -21,7 +21,7 @@ $compl = 0; echo 'Updating file size for '.count($items).' release(s)'.PHP_EOL; while ($item = array_pop($items)) { - $nzbpath = $nzb->getNZBPath($item['guid'], Settings::value('..nzbpath')); + $nzbpath = $nzb->getNZBPath($item['guid'], Settings::settingValue('..nzbpath')); ob_start(); @readgzfile($nzbpath); diff --git a/misc/update/nix/multiprocessing/.do_not_run/switch.php b/misc/update/nix/multiprocessing/.do_not_run/switch.php index cefcc9f61..2e4688b12 100644 --- a/misc/update/nix/multiprocessing/.do_not_run/switch.php +++ b/misc/update/nix/multiprocessing/.do_not_run/switch.php @@ -77,7 +77,7 @@ switch ($options[1]) { } } $binaries = new Binaries(['NNTP' => $nntp, 'Settings' => $pdo, 'Groups' => $groups]); - $return = $binaries->scan($groupMySQL, $options[4], $options[5], (Settings::value('..safepartrepair') == 1 ? 'update' : 'backfill')); + $return = $binaries->scan($groupMySQL, $options[4], $options[5], (Settings::settingValue('..safepartrepair') == 1 ? 'update' : 'backfill')); if (empty($return)) { exit(); } @@ -286,7 +286,7 @@ switch ($options[1]) { */ function processReleases($releases, $groupID) { - $releaseCreationLimit = (Settings::value('..maxnzbsprocessed') != '' ? (int)Settings::value('..maxnzbsprocessed') : 1000); + $releaseCreationLimit = (Settings::settingValue('..maxnzbsprocessed') != '' ? (int)Settings::settingValue('..maxnzbsprocessed') : 1000); $releases->processIncompleteCollections($groupID); $releases->processCollectionSizes($groupID); $releases->deleteUnwantedCollections($groupID); @@ -343,7 +343,7 @@ function collectionCheck(&$pdo, $groupID) function &nntp(&$pdo, $alternate = false) { $nntp = new NNTP(['Settings' => $pdo]); - if (($alternate && (int)Settings::value('..alternate_nntp') === 1 ? $nntp->doConnect(true, true) : $nntp->doConnect()) !== true) { + if (($alternate && (int)Settings::settingValue('..alternate_nntp') === 1 ? $nntp->doConnect(true, true) : $nntp->doConnect()) !== true) { exit('ERROR: Unable to connect to usenet.' . PHP_EOL); } diff --git a/misc/update/nix/tmux/bin/groupfixrelnames.php b/misc/update/nix/tmux/bin/groupfixrelnames.php index 088b0bdfe..1e8a27f43 100644 --- a/misc/update/nix/tmux/bin/groupfixrelnames.php +++ b/misc/update/nix/tmux/bin/groupfixrelnames.php @@ -205,7 +205,7 @@ switch (true) { echo ColorCLI::primaryOver('p'); if (! isset($nzbcontents)) { $nntp = new NNTP(['Settings' => $pdo]); - if (((int) Settings::value('..alternate_nntp') === 1 ? $nntp->doConnect(true, true) : $nntp->doConnect()) !== true) { + if (((int) Settings::settingValue('..alternate_nntp') === 1 ? $nntp->doConnect(true, true) : $nntp->doConnect()) !== true) { ColorCLI::error('Unable to connect to usenet.'); } $Nfo = new Nfo(['Settings' => $pdo, 'Echo' => true]); diff --git a/misc/update/nix/tmux/monitor.php b/misc/update/nix/tmux/monitor.php index b4a241845..ad875ff6f 100644 --- a/misc/update/nix/tmux/monitor.php +++ b/misc/update/nix/tmux/monitor.php @@ -364,7 +364,7 @@ while ($runVar['counts']['iterations'] > 0) { $tRun->runPane('notrunning', $runVar); } - $exit = Settings::value('tmux.running.exit'); + $exit = Settings::settingValue('tmux.running.exit'); if ($exit == 0) { $runVar['counts']['iterations']++; sleep(10); diff --git a/misc/update/nix/tmux/run.php b/misc/update/nix/tmux/run.php index b4d115ad9..105b6b0ba 100644 --- a/misc/update/nix/tmux/run.php +++ b/misc/update/nix/tmux/run.php @@ -12,13 +12,13 @@ $pdo = new DB(); $DIR = NN_TMUX; $t = new Tmux(); $tmux = $t->get(); -$patch = Settings::value('..sqlpatch'); +$patch = Settings::settingValue('..sqlpatch'); $import = $tmux->import ?? 0; $tmux_session = $tmux->tmux_session ?? 0; $seq = $tmux->sequential ?? 0; $powerline = $tmux->powerline ?? 0; $colors = $tmux->colors ?? 0; -$delaytimet = Settings::value('..delaytime'); +$delaytimet = Settings::settingValue('..delaytime'); $delaytimet = $delaytimet ? (int) $delaytimet : 2; Utility::isPatched(); diff --git a/misc/update/postprocess.php b/misc/update/postprocess.php index 380c1be60..b31233066 100644 --- a/misc/update/postprocess.php +++ b/misc/update/postprocess.php @@ -65,7 +65,7 @@ if (! isset($argv[1]) || ! in_array($argv[1], $args, false) || ! isset($argv[2]) $nntp = null; if ($args[$argv[1]] === true) { $nntp = new NNTP(['Settings' => $pdo]); - if ((Settings::value('..alternate_nntp') === 1 ? $nntp->doConnect(true, true) : $nntp->doConnect()) !== true) { + if ((Settings::settingValue('..alternate_nntp') === 1 ? $nntp->doConnect(true, true) : $nntp->doConnect()) !== true) { exit($pdo->log->error('Unable to connect to usenet.'.PHP_EOL)); } } diff --git a/misc/update/update_binaries.php b/misc/update/update_binaries.php index e414823e4..25d873676 100644 --- a/misc/update/update_binaries.php +++ b/misc/update/update_binaries.php @@ -11,7 +11,7 @@ use App\Models\Settings; $pdo = new DB(); -$maxHeaders = (int) Settings::value('max.headers.iteration') ?: 1000000; +$maxHeaders = (int) Settings::settingValue('max.headers.iteration') ?: 1000000; // Create the connection here and pass $nntp = new NNTP(['Settings' => $pdo]); diff --git a/nntmux/Backfill.php b/nntmux/Backfill.php index 2dfc4f018..5423cc6ee 100755 --- a/nntmux/Backfill.php +++ b/nntmux/Backfill.php @@ -114,10 +114,10 @@ class Backfill } } - $this->_compressedHeaders = (int) Settings::value('..compressedheaders') === 1; - $this->_safeBackFillDate = Settings::value('..safebackfilldate') !== '' ? (string) Settings::value('safebackfilldate') : '2008-08-14'; - $this->_safePartRepair = (int) Settings::value('..safepartrepair') === 1 ? 'update' : 'backfill'; - $this->_disableBackfillGroup = (int) Settings::value('..disablebackfillgroup') === 1; + $this->_compressedHeaders = (int) Settings::settingValue('..compressedheaders') === 1; + $this->_safeBackFillDate = Settings::settingValue('..safebackfilldate') !== '' ? (string) Settings::settingValue('safebackfilldate') : '2008-08-14'; + $this->_safePartRepair = (int) Settings::settingValue('..safepartrepair') === 1 ? 'update' : 'backfill'; + $this->_disableBackfillGroup = (int) Settings::settingValue('..disablebackfillgroup') === 1; } /** diff --git a/nntmux/Binaries.php b/nntmux/Binaries.php index 2c263abae..6907cb22b 100755 --- a/nntmux/Binaries.php +++ b/nntmux/Binaries.php @@ -273,16 +273,16 @@ class Binaries } } - $this->messageBuffer = Settings::value('..maxmssgs') !== '' ? - (int) Settings::value('..maxmssgs') : 20000; - $this->_compressedHeaders = Settings::value('..compressedheaders') === 1; - $this->_partRepair = Settings::value('..partrepair') === 1; - $this->_newGroupScanByDays = Settings::value('..newgroupscanmethod') === 1; - $this->_newGroupMessagesToScan = Settings::value('..newgroupmsgstoscan') !== '' ? (int) Settings::value('..newgroupmsgstoscan') : 50000; - $this->_newGroupDaysToScan = Settings::value('..newgroupdaystoscan') !== '' ? (int) Settings::value('..newgroupdaystoscan') : 3; - $this->_partRepairLimit = Settings::value('..maxpartrepair') !== '' ? (int) Settings::value('..maxpartrepair') : 15000; - $this->_partRepairMaxTries = (Settings::value('..partrepairmaxtries') !== '' ? (int) Settings::value('..partrepairmaxtries') : 3); - $this->_showDroppedYEncParts = Settings::value('..showdroppedyencparts') === 1; + $this->messageBuffer = Settings::settingValue('..maxmssgs') !== '' ? + (int) Settings::settingValue('..maxmssgs') : 20000; + $this->_compressedHeaders = Settings::settingValue('..compressedheaders') === 1; + $this->_partRepair = Settings::settingValue('..partrepair') === 1; + $this->_newGroupScanByDays = Settings::settingValue('..newgroupscanmethod') === 1; + $this->_newGroupMessagesToScan = Settings::settingValue('..newgroupmsgstoscan') !== '' ? (int) Settings::settingValue('..newgroupmsgstoscan') : 50000; + $this->_newGroupDaysToScan = Settings::settingValue('..newgroupdaystoscan') !== '' ? (int) Settings::settingValue('..newgroupdaystoscan') : 3; + $this->_partRepairLimit = Settings::settingValue('..maxpartrepair') !== '' ? (int) Settings::settingValue('..maxpartrepair') : 15000; + $this->_partRepairMaxTries = (Settings::settingValue('..partrepairmaxtries') !== '' ? (int) Settings::settingValue('..partrepairmaxtries') : 3); + $this->_showDroppedYEncParts = Settings::settingValue('..showdroppedyencparts') === 1; $this->blackList = $this->whiteList = []; } diff --git a/nntmux/Books.php b/nntmux/Books.php index 0173999d4..32a48026d 100755 --- a/nntmux/Books.php +++ b/nntmux/Books.php @@ -89,16 +89,16 @@ class Books $this->echooutput = ($options['Echo'] && NN_ECHOCLI); $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); - $this->pubkey = Settings::value('APIs..amazonpubkey'); - $this->privkey = Settings::value('APIs..amazonprivkey'); - $this->asstag = Settings::value('APIs..amazonassociatetag'); - $this->bookqty = Settings::value('..maxbooksprocessed') !== '' ? Settings::value('..maxbooksprocessed') : 300; - $this->sleeptime = Settings::value('..amazonsleep') !== '' ? Settings::value('..amazonsleep') : 1000; + $this->pubkey = Settings::settingValue('APIs..amazonpubkey'); + $this->privkey = Settings::settingValue('APIs..amazonprivkey'); + $this->asstag = Settings::settingValue('APIs..amazonassociatetag'); + $this->bookqty = Settings::settingValue('..maxbooksprocessed') !== '' ? Settings::settingValue('..maxbooksprocessed') : 300; + $this->sleeptime = Settings::settingValue('..amazonsleep') !== '' ? Settings::settingValue('..amazonsleep') : 1000; $this->imgSavePath = NN_COVERS.'book'.DS; - $result = Settings::value('..book_reqids'); + $result = Settings::settingValue('..book_reqids'); $this->bookreqids = empty($result) ? Category::BOOKS_EBOOK : $result; $this->renamed = ''; - if ((int) Settings::value('..lookupbooks') === 2) { + if ((int) Settings::settingValue('..lookupbooks') === 2) { $this->renamed = 'AND isrenamed = 1'; } diff --git a/nntmux/Categorize.php b/nntmux/Categorize.php index 624a4de0c..55e6a4e23 100755 --- a/nntmux/Categorize.php +++ b/nntmux/Categorize.php @@ -60,8 +60,8 @@ class Categorize extends Category public function __construct(array $options = []) { parent::__construct($options); - $this->categorizeForeign = (int) Settings::value('indexer.categorise.categorizeforeign'); - $this->catWebDL = (int) Settings::value('indexer.categorise.catwebdl'); + $this->categorizeForeign = (int) Settings::settingValue('indexer.categorise.categorizeforeign'); + $this->catWebDL = (int) Settings::settingValue('indexer.categorise.catwebdl'); $this->regexes = new Regexes(['Settings' => $this->pdo, 'Table_Name' => 'category_regexes']); } diff --git a/nntmux/Console.php b/nntmux/Console.php index 23f87df3a..3cb220e25 100755 --- a/nntmux/Console.php +++ b/nntmux/Console.php @@ -89,13 +89,13 @@ class Console $this->echooutput = ($options['Echo'] && NN_ECHOCLI); $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); - $this->pubkey = Settings::value('APIs..amazonpubkey'); - $this->privkey = Settings::value('APIs..amazonprivkey'); - $this->asstag = Settings::value('APIs..amazonassociatetag'); - $this->gameqty = (Settings::value('..maxgamesprocessed') != '') ? Settings::value('..maxgamesprocessed') : 150; - $this->sleeptime = (Settings::value('..amazonsleep') != '') ? Settings::value('..amazonsleep') : 1000; + $this->pubkey = Settings::settingValue('APIs..amazonpubkey'); + $this->privkey = Settings::settingValue('APIs..amazonprivkey'); + $this->asstag = Settings::settingValue('APIs..amazonassociatetag'); + $this->gameqty = (Settings::settingValue('..maxgamesprocessed') != '') ? Settings::settingValue('..maxgamesprocessed') : 150; + $this->sleeptime = (Settings::settingValue('..amazonsleep') != '') ? Settings::settingValue('..amazonsleep') : 1000; $this->imgSavePath = NN_COVERS.'console'.DS; - $this->renamed = Settings::value('..lookupgames') == 2 ? 'AND isrenamed = 1' : ''; + $this->renamed = Settings::settingValue('..lookupgames') == 2 ? 'AND isrenamed = 1' : ''; $this->catWhere = 'PARTITION (console)'; $this->failCache = []; diff --git a/nntmux/Games.php b/nntmux/Games.php index 8cade65cd..beacfd055 100755 --- a/nntmux/Games.php +++ b/nntmux/Games.php @@ -117,10 +117,10 @@ class Games $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); - $this->publicKey = Settings::value('APIs..giantbombkey'); - $this->gameQty = Settings::value('..maxgamesprocessed') !== '' ? Settings::value('..maxgamesprocessed') : 150; + $this->publicKey = Settings::settingValue('APIs..giantbombkey'); + $this->gameQty = Settings::settingValue('..maxgamesprocessed') !== '' ? Settings::settingValue('..maxgamesprocessed') : 150; $this->imgSavePath = NN_COVERS.'games'.DS; - $this->renamed = Settings::value('..lookupgames') === 2 ? 'AND isrenamed = 1' : ''; + $this->renamed = Settings::settingValue('..lookupgames') === 2 ? 'AND isrenamed = 1' : ''; $this->matchPercentage = 60; $this->maxHitRequest = false; $this->catWhere = 'AND categories_id = '.Category::PC_GAMES.' '; diff --git a/nntmux/Logging.php b/nntmux/Logging.php index a67450938..6489b6a6f 100755 --- a/nntmux/Logging.php +++ b/nntmux/Logging.php @@ -64,8 +64,8 @@ class Logging public function LogBadPasswd($username = '', $host = ''): void { // If logggingopt is = 0, then we do nothing, 0 = logging off. - $loggingOpt = Settings::value('site.main.loggingopt'); - $logFile = Settings::value('site.main.logfile'); + $loggingOpt = Settings::settingValue('site.main.loggingopt'); + $logFile = Settings::settingValue('site.main.logfile'); if ((int) $loggingOpt === 1) { $this->pdo->queryInsert(sprintf('INSERT INTO logging (time, username, host) VALUES (NOW(), %s, %s)', $this->pdo->escapeString($username), $this->pdo->escapeString($host))); diff --git a/nntmux/MiscSorter.php b/nntmux/MiscSorter.php index c5240241e..9f0d482ed 100755 --- a/nntmux/MiscSorter.php +++ b/nntmux/MiscSorter.php @@ -81,9 +81,9 @@ class MiscSorter $this->movie = new Movie(['Echo' => $this->echooutput, 'Settings' => $this->pdo]); $this->music = new Music(['Echo' => $this->echooutput, 'Settings' => $this->pdo]); $this->book = new Books(['Echo' => $this->echooutput, 'Settings' => $this->pdo]); - $this->pubkey = Settings::value('APIs..amazonpubkey'); - $this->privkey = Settings::value('APIs..amazonprivkey'); - $this->asstag = Settings::value('APIs..amazonassociatetag'); + $this->pubkey = Settings::settingValue('APIs..amazonpubkey'); + $this->privkey = Settings::settingValue('APIs..amazonprivkey'); + $this->asstag = Settings::settingValue('APIs..amazonassociatetag'); } // Main function that determines which operation(s) should be run based on the releases NFO file diff --git a/nntmux/Movie.php b/nntmux/Movie.php index 609a31878..3f9226ba2 100755 --- a/nntmux/Movie.php +++ b/nntmux/Movie.php @@ -174,21 +174,21 @@ class Movie $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); $this->releaseImage = ($options['ReleaseImage'] instanceof ReleaseImage ? $options['ReleaseImage'] : new ReleaseImage($this->pdo)); $this->client = new Client(); - $this->tmdbtoken = new ApiToken(Settings::value('APIs..tmdbkey')); + $this->tmdbtoken = new ApiToken(Settings::settingValue('APIs..tmdbkey')); $this->tmdbclient = new TmdbClient($this->tmdbtoken, [ 'cache' => [ 'enabled' => false, ], ] ); - $this->fanartapikey = Settings::value('APIs..fanarttvkey'); + $this->fanartapikey = Settings::settingValue('APIs..fanarttvkey'); $this->fanart = new FanartTV($this->fanartapikey); - $this->omdbapikey = Settings::value('APIs..omdbkey'); + $this->omdbapikey = Settings::settingValue('APIs..omdbkey'); - $this->lookuplanguage = Settings::value('indexer.categorise.imdblanguage') !== '' ? (string) Settings::value('indexer.categorise.imdblanguage') : 'en'; + $this->lookuplanguage = Settings::settingValue('indexer.categorise.imdblanguage') !== '' ? (string) Settings::settingValue('indexer.categorise.imdblanguage') : 'en'; - $this->imdburl = Settings::value('indexer.categorise.imdburl') === 0 ? false : true; - $this->movieqty = Settings::value('..maximdbprocessed') !== '' ? Settings::value('..maximdbprocessed') : 100; + $this->imdburl = Settings::settingValue('indexer.categorise.imdburl') === 0 ? false : true; + $this->movieqty = Settings::settingValue('..maximdbprocessed') !== '' ? Settings::settingValue('..maximdbprocessed') : 100; $this->searchEngines = true; $this->showPasswords = Releases::showPasswords(); @@ -955,7 +955,7 @@ class Movie $this->client->get( 'http://'.($this->imdburl === false ? 'www' : 'akas').'.imdb.com/title/tt'.$imdbId.'/', ['headers' => [ - 'Accept-Language' => ((Settings::value('indexer.categorise.imdblanguage') != '') ? Settings::value('indexer.categorise.imdblanguage') : 'en'), + 'Accept-Language' => ((Settings::settingValue('indexer.categorise.imdblanguage') != '') ? Settings::settingValue('indexer.categorise.imdblanguage') : 'en'), 'useragent' => 'Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) '. 'Version/4.0.4 Mobile/7B334b Safari/531.21.102011-10-16 20:23:10', 'foo=bar', ], diff --git a/nntmux/Music.php b/nntmux/Music.php index 68e08ba07..601246c91 100755 --- a/nntmux/Music.php +++ b/nntmux/Music.php @@ -81,14 +81,14 @@ class Music $this->echooutput = ($options['Echo'] && NN_ECHOCLI); $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); - $this->pubkey = Settings::value('APIs..amazonpubkey'); - $this->privkey = Settings::value('APIs..amazonprivkey'); - $this->asstag = Settings::value('APIs..amazonassociatetag'); - $this->musicqty = Settings::value('..maxmusicprocessed') != '' ? Settings::value('..maxmusicprocessed') : 150; - $this->sleeptime = Settings::value('..amazonsleep') != '' ? Settings::value('..amazonsleep') : 1000; + $this->pubkey = Settings::settingValue('APIs..amazonpubkey'); + $this->privkey = Settings::settingValue('APIs..amazonprivkey'); + $this->asstag = Settings::settingValue('APIs..amazonassociatetag'); + $this->musicqty = Settings::settingValue('..maxmusicprocessed') != '' ? Settings::settingValue('..maxmusicprocessed') : 150; + $this->sleeptime = Settings::settingValue('..amazonsleep') != '' ? Settings::settingValue('..amazonsleep') : 1000; $this->imgSavePath = NN_COVERS.'music'.DS; $this->renamed = ''; - if (Settings::value('..lookupmusic') == 2) { + if (Settings::settingValue('..lookupmusic') == 2) { $this->renamed = 'AND isrenamed = 1'; } diff --git a/nntmux/NNTP.php b/nntmux/NNTP.php index 7742adfa8..0c3b0c655 100755 --- a/nntmux/NNTP.php +++ b/nntmux/NNTP.php @@ -110,7 +110,7 @@ class NNTP extends \Net_NNTP_Client } } - $this->_nntpRetries = Settings::value('..nntpretries') !== '' ? (int) Settings::value('..nntpretries') : 0 + 1; + $this->_nntpRetries = Settings::settingValue('..nntpretries') !== '' ? (int) Settings::settingValue('..nntpretries') : 0 + 1; } /** @@ -262,7 +262,7 @@ class NNTP extends \Net_NNTP_Client // If we are connected and authenticated, try enabling compression if we have it enabled. if ($connected === true && $authenticated === true) { // Check if we should use compression on the connection. - if ($compression === false || (int) Settings::value('..compressedheaders') === 0) { + if ($compression === false || (int) Settings::settingValue('..compressedheaders') === 0) { $this->_compressionSupported = false; } if ($this->_debugBool) { @@ -335,7 +335,7 @@ class NNTP extends \Net_NNTP_Client */ public function enableCompression(): void { - if ((int) Settings::value('..compressedheaders') !== 1) { + if ((int) Settings::settingValue('..compressedheaders') !== 1) { return; } $this->_enableCompression(); diff --git a/nntmux/NZB.php b/nntmux/NZB.php index cf71c538d..746f62633 100755 --- a/nntmux/NZB.php +++ b/nntmux/NZB.php @@ -103,9 +103,9 @@ class NZB { $this->pdo = ($pdo instanceof DB ? $pdo : new DB()); - $nzbSplitLevel = Settings::value('..nzbsplitlevel'); + $nzbSplitLevel = Settings::settingValue('..nzbsplitlevel'); $this->nzbSplitLevel = (empty($nzbSplitLevel) ? 1 : $nzbSplitLevel); - $this->siteNzbPath = (string) Settings::value('..nzbpath'); + $this->siteNzbPath = (string) Settings::settingValue('..nzbpath'); if (substr($this->siteNzbPath, -1) !== DS) { $this->siteNzbPath .= DS; } diff --git a/nntmux/NZBContents.php b/nntmux/NZBContents.php index c2c735548..d463ba443 100755 --- a/nntmux/NZBContents.php +++ b/nntmux/NZBContents.php @@ -92,8 +92,8 @@ class NZBContents : new PostProcess(['Echo' => $this->echooutput, 'Nfo' => $this->nfo, 'Settings' => $this->pdo]) ); $this->nzb = ($options['NZB'] instanceof NZB ? $options['NZB'] : new NZB($this->pdo)); - $this->lookuppar2 = (int) Settings::value('..lookuppar2') === 1 ? true : false; - $this->alternateNNTP = (int) Settings::value('..alternate_nntp') === 1 ? true : false; + $this->lookuppar2 = (int) Settings::settingValue('..lookuppar2') === 1 ? true : false; + $this->alternateNNTP = (int) Settings::settingValue('..alternate_nntp') === 1 ? true : false; } /** diff --git a/nntmux/NZBImport.php b/nntmux/NZBImport.php index aafd451c0..ce2c58f59 100755 --- a/nntmux/NZBImport.php +++ b/nntmux/NZBImport.php @@ -116,7 +116,7 @@ class NZBImport $this->releases = ($options['Releases'] instanceof Releases ? $options['Releases'] : new Releases(['settings' => $this->pdo])); $this->groups = new Groups(['Settings' => $this->pdo]); - $this->crossPostt = Settings::value('..crossposttime') !== '' ? Settings::value('..crossposttime') : 2; + $this->crossPostt = Settings::settingValue('..crossposttime') !== '' ? Settings::settingValue('..crossposttime') : 2; $this->browser = $options['Browser']; $this->retVal = ''; } diff --git a/nntmux/Nfo.php b/nntmux/Nfo.php index f46c56b59..b6858d355 100755 --- a/nntmux/Nfo.php +++ b/nntmux/Nfo.php @@ -78,14 +78,14 @@ class Nfo $options += $defaults; $this->echo = ($options['Echo'] && NN_ECHOCLI); $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); - $this->nzbs = Settings::value('..maxnfoprocessed') !== '' ? (int) Settings::value('..maxnfoprocessed') : 100; - $this->maxsize = Settings::value('..maxsizetoprocessnfo') !== '' ? (int) Settings::value('..maxsizetoprocessnfo') : 100; + $this->nzbs = Settings::settingValue('..maxnfoprocessed') !== '' ? (int) Settings::settingValue('..maxnfoprocessed') : 100; + $this->maxsize = Settings::settingValue('..maxsizetoprocessnfo') !== '' ? (int) Settings::settingValue('..maxsizetoprocessnfo') : 100; $this->maxsize = $this->maxsize > 0 ? ('AND size < '.($this->maxsize * 1073741824)) : ''; - $this->minsize = Settings::value('..minsizetoprocessnfo') !== '' ? (int) Settings::value('..minsizetoprocessnfo') : 100; + $this->minsize = Settings::settingValue('..minsizetoprocessnfo') !== '' ? (int) Settings::settingValue('..minsizetoprocessnfo') : 100; $this->minsize = $this->minsize > 0 ? ('AND size > '.($this->minsize * 1048576)) : ''; - $this->maxRetries = (int) Settings::value('..maxnforetries') >= 0 ? -((int) Settings::value('..maxnforetries') + 1) : self::NFO_UNPROC; + $this->maxRetries = (int) Settings::settingValue('..maxnforetries') >= 0 ? -((int) Settings::settingValue('..maxnforetries') + 1) : self::NFO_UNPROC; $this->maxRetries = $this->maxRetries < -8 ? -8 : $this->maxRetries; - $this->tmpPath = (string) Settings::value('..tmpunrarpath'); + $this->tmpPath = (string) Settings::settingValue('..tmpunrarpath'); if (! preg_match('/[\/\\\\]$/', $this->tmpPath)) { $this->tmpPath .= DS; } @@ -256,9 +256,9 @@ class Nfo */ public static function NfoQueryString() { - $maxSize = (int) Settings::value('..maxsizetoprocessnfo'); - $minSize = (int) Settings::value('..minsizetoprocessnfo'); - $dummy = (int) Settings::value('..maxnforetries'); + $maxSize = (int) Settings::settingValue('..maxsizetoprocessnfo'); + $minSize = (int) Settings::settingValue('..minsizetoprocessnfo'); + $dummy = (int) Settings::settingValue('..maxnforetries'); $maxRetries = ($dummy >= 0 ? -($dummy + 1) : self::NFO_UNPROC); return sprintf( diff --git a/nntmux/ReleaseComments.php b/nntmux/ReleaseComments.php index 153a91a77..e6073af37 100755 --- a/nntmux/ReleaseComments.php +++ b/nntmux/ReleaseComments.php @@ -160,7 +160,7 @@ class ReleaseComments */ public function addComment($id, $gid, $text, $userid, $host) { - if ((int) Settings::value('..storeuserips') !== 1) { + if ((int) Settings::settingValue('..storeuserips') !== 1) { $host = ''; } diff --git a/nntmux/Releases.php b/nntmux/Releases.php index a98c8d364..bf11815aa 100755 --- a/nntmux/Releases.php +++ b/nntmux/Releases.php @@ -71,8 +71,8 @@ class Releases $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); $this->groups = ($options['Groups'] instanceof Groups ? $options['Groups'] : new Groups(['Settings' => $this->pdo])); - $this->updateGrabs = ((int) Settings::value('..grabstatus') !== 0); - $this->passwordStatus = ((int) Settings::value('..checkpasswordedrar') === 1 ? -1 : 0); + $this->updateGrabs = ((int) Settings::settingValue('..grabstatus') !== 0); + $this->passwordStatus = ((int) Settings::settingValue('..checkpasswordedrar') === 1 ? -1 : 0); $this->sphinxSearch = new SphinxSearch(); $this->releaseSearch = new ReleaseSearch($this->pdo); $this->category = new Category(['Settings' => $this->pdo]); @@ -277,7 +277,7 @@ class Releases */ public static function showPasswords(): ?string { - $setting = Settings::value('..showpasswordedrelease', true); + $setting = Settings::settingValue('..showpasswordedrelease', true); $setting = (isset($setting) && is_numeric($setting)) ? $setting : 10; switch ($setting) { diff --git a/nntmux/RequestIDWeb.php b/nntmux/RequestIDWeb.php index 778687150..47665af86 100755 --- a/nntmux/RequestIDWeb.php +++ b/nntmux/RequestIDWeb.php @@ -34,7 +34,7 @@ class RequestIDWeb extends RequestID public function __construct(array $options = []) { parent::__construct($options); - $this->_request_hours = (Settings::value('..request_hours') != '') ? (int) Settings::value('..request_hours') : 1; + $this->_request_hours = (Settings::settingValue('..request_hours') != '') ? (int) Settings::settingValue('..request_hours') : 1; } /** @@ -152,7 +152,7 @@ class RequestIDWeb extends RequestID // Do a web lookup. try { - $returnXml = $this->client->request('POST', Settings::value('..request_url'), + $returnXml = $this->client->request('POST', Settings::settingValue('..request_url'), ['Link' => 'data='.serialize($requestArray)] )->getBody(); } catch (RequestException $e) { diff --git a/nntmux/SABnzbd.php b/nntmux/SABnzbd.php index 47cd86491..5a87ccfd2 100755 --- a/nntmux/SABnzbd.php +++ b/nntmux/SABnzbd.php @@ -97,7 +97,7 @@ class SABnzbd $this->client = new Client(['verify' => false]); // Set up properties. - switch (Settings::value('apps.sabnzbplus.integrationtype')) { + switch (Settings::settingValue('apps.sabnzbplus.integrationtype')) { case self::INTEGRATION_TYPE_USER: if (! empty($_COOKIE['sabnzbd_'.$this->uid.'__apikey']) && ! empty($_COOKIE['sabnzbd_'.$this->uid.'__host'])) { $this->url = $_COOKIE['sabnzbd_'.$this->uid.'__host']; @@ -123,12 +123,12 @@ class SABnzbd break; case self::INTEGRATION_TYPE_SITEWIDE: - if ((Settings::value('apps.sabnzbplus.apikey') !== '') && (Settings::value('apps.sabnzbplus.url') + if ((Settings::settingValue('apps.sabnzbplus.apikey') !== '') && (Settings::settingValue('apps.sabnzbplus.url') !== '')) { - $this->url = Settings::value('apps.sabnzbplus.url'); - $this->apikey = Settings::value('apps.sabnzbplus.apikey'); - $this->priority = Settings::value('apps.sabnzbplus.priority'); - $this->apikeytype = Settings::value('apps.sabnzbplus.apikeytype'); + $this->url = Settings::settingValue('apps.sabnzbplus.url'); + $this->apikey = Settings::settingValue('apps.sabnzbplus.apikey'); + $this->priority = Settings::settingValue('apps.sabnzbplus.priority'); + $this->apikeytype = Settings::settingValue('apps.sabnzbplus.apikeytype'); } $this->integrated = self::INTEGRATION_TYPE_SITEWIDE; $this->integratedBool = true; diff --git a/nntmux/Steam.php b/nntmux/Steam.php index a3bcb85b0..de1dde040 100755 --- a/nntmux/Steam.php +++ b/nntmux/Steam.php @@ -153,7 +153,7 @@ class Steam */ public function populateSteamAppsTable(): void { - $lastUpdate = Settings::value('APIs.Steam.last_update'); + $lastUpdate = Settings::settingValue('APIs.Steam.last_update'); $this->lastUpdate = $lastUpdate > 0 ? $lastUpdate : 0; if ((time() - (int) $this->lastUpdate) > 86400) { // Set time we updated steam_apps table diff --git a/nntmux/TmuxRun.php b/nntmux/TmuxRun.php index ac5364237..921b92b0d 100755 --- a/nntmux/TmuxRun.php +++ b/nntmux/TmuxRun.php @@ -22,7 +22,7 @@ class TmuxRun extends Tmux public function __construct(DB $pdo = null) { parent::__construct($pdo); - $dateFormat = Settings::value( + $dateFormat = Settings::settingValue( [ 'section' => 'shell', 'subsection' => 'date', diff --git a/nntmux/Users.php b/nntmux/Users.php index f1b1fb482..b80b5f86c 100755 --- a/nntmux/Users.php +++ b/nntmux/Users.php @@ -460,7 +460,7 @@ class Users $data = User::query()->whereDate('rolechangedate', '<', (new \DateTime())->format('Y-m-d H:i:s'))->select(['id', 'email'])->get(); foreach ($data as $u) { - Utility::sendEmail($u['email'], $msgsubject, $msgbody, Settings::value('site.main.email')); + Utility::sendEmail($u['email'], $msgsubject, $msgbody, Settings::settingValue('site.main.email')); User::query()->where('id', $u['id'])->update(['role' => self::ROLE_USER, 'rolechangedate' => null]); } @@ -693,7 +693,7 @@ class Users // Make sure this is the last check, as if a further validation check failed, the invite would still have been used up. $invitedBy = 0; - if (! $forceInviteMode && (int) Settings::value('..registerstatus') === Settings::REGISTER_STATUS_INVITE) { + if (! $forceInviteMode && (int) Settings::settingValue('..registerstatus') === Settings::REGISTER_STATUS_INVITE) { if ($inviteCode === '') { return self::ERR_SIGNUP_BADINVITECODE; } @@ -793,7 +793,7 @@ class Users 'email' => $email, 'role' => $role, 'createddate' => new \DateTime('NOW'), - 'host' => (int) Settings::value('..storeuserips') === 1 ? $host : '', + 'host' => (int) Settings::settingValue('..storeuserips') === 1 ? $host : '', 'rsstoken' => md5(Password::getRepository()->createNewToken()), 'invites' => $invites, 'invitedby' => (int) $invitedBy === 0 ? 'NULL' : $invitedBy, @@ -838,7 +838,7 @@ class Users { $_SESSION['uid'] = $userID; - if ((int) Settings::value('..storeuserips') !== 1) { + if ((int) Settings::settingValue('..storeuserips') !== 1) { $host = ''; } @@ -1155,11 +1155,11 @@ class Users { $ipsql = "('-1')"; - if (Settings::value('..userhostexclusion') !== '') { + if (Settings::settingValue('..userhostexclusion') !== '') { $ipsql = ''; - $ips = explode(',', Settings::value('..userhostexclusion')); + $ips = explode(',', Settings::settingValue('..userhostexclusion')); foreach ($ips as $ip) { - $ipsql .= $this->pdo->escapeString($this->getHostHash($ip, Settings::value('..siteseed'))).','; + $ipsql .= $this->pdo->escapeString($this->getHostHash($ip, Settings::settingValue('..siteseed'))).','; } $ipsql = '('.$ipsql." '-1')"; } @@ -1190,7 +1190,7 @@ class Users public function getHostHash($host, string $siteseed = ''): string { if ($siteseed === '') { - $siteseed = Settings::value('..siteseed'); + $siteseed = Settings::settingValue('..siteseed'); } return self::hashSHA1($siteseed.$host.$siteseed); diff --git a/nntmux/XXX.php b/nntmux/XXX.php index 6b9421e5c..16a0991d6 100755 --- a/nntmux/XXX.php +++ b/nntmux/XXX.php @@ -92,7 +92,7 @@ class XXX $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); $this->releaseImage = ($options['ReleaseImage'] instanceof ReleaseImage ? $options['ReleaseImage'] : new ReleaseImage($this->pdo)); - $this->movieqty = (Settings::value('..maxxxxprocessed') !== '') ? Settings::value('..maxxxxprocessed') : 100; + $this->movieqty = (Settings::settingValue('..maxxxxprocessed') !== '') ? Settings::settingValue('..maxxxxprocessed') : 100; $this->showPasswords = Releases::showPasswords(); $this->debug = NN_DEBUG; $this->echooutput = ($options['Echo'] && NN_ECHOCLI); diff --git a/nntmux/db/DB.php b/nntmux/db/DB.php index e45fc0b36..e7a050523 100755 --- a/nntmux/db/DB.php +++ b/nntmux/db/DB.php @@ -1051,7 +1051,7 @@ class DB extends \PDO public function setCovers() { - $path = Settings::value([ + $path = Settings::settingValue([ 'section' => 'site', 'subsection' => 'main', 'name' => 'coverspath', diff --git a/nntmux/db/DbUpdate.php b/nntmux/db/DbUpdate.php index 8b7d08de5..625c00298 100755 --- a/nntmux/db/DbUpdate.php +++ b/nntmux/db/DbUpdate.php @@ -199,7 +199,7 @@ class DbUpdate } else { echo $this->log->header('Processing patch file: '.$file); $this->splitSQL($file, ['local' => $local, 'data' => $options['data']]); - $current = Settings::value('..sqlpatch'); + $current = Settings::settingValue('..sqlpatch'); $current++; Settings::query()->where('setting', '=', 'sqlpatch')->update(['value' => $current]); $newName = $matches['drive'].$matches['path']. @@ -233,7 +233,7 @@ class DbUpdate ]; $options += $defaults; - $currentVersion = Settings::value('..sqlpatch'); + $currentVersion = Settings::settingValue('..sqlpatch'); if (! is_numeric($currentVersion)) { exit("Bad sqlpatch value: '$currentVersion'\n"); } diff --git a/nntmux/db/populate/AniDB.php b/nntmux/db/populate/AniDB.php index 7ae762490..2b779248b 100755 --- a/nntmux/db/populate/AniDB.php +++ b/nntmux/db/populate/AniDB.php @@ -74,11 +74,11 @@ class AniDB $this->echooutput = ($options['Echo'] && NN_ECHOCLI); $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); - $anidbupdint = Settings::value('APIs.AniDB.max_update_frequency'); - $lastupdated = Settings::value('APIs.AniDB.last_full_update'); + $anidbupdint = Settings::settingValue('APIs.AniDB.max_update_frequency'); + $lastupdated = Settings::settingValue('APIs.AniDB.last_full_update'); $this->imgSavePath = NN_COVERS.'anime'.DS; - $this->apiKey = Settings::value('APIs..anidbkey'); + $this->apiKey = Settings::settingValue('APIs..anidbkey'); $this->updateInterval = $anidbupdint ?? '7'; $this->lastUpdate = $lastupdated ?? '0'; @@ -143,7 +143,7 @@ class AniDB */ private function getAniDbAPI($anidbId) { - $timestamp = Settings::value('APIs.AniDB.banned') + 90000; + $timestamp = Settings::settingValue('APIs.AniDB.banned') + 90000; if ($timestamp > time()) { echo 'Banned from AniDB lookups until '.date('Y-m-d H:i:s', $timestamp).PHP_EOL; diff --git a/nntmux/http/Capabilities.php b/nntmux/http/Capabilities.php index c826428b6..159300546 100755 --- a/nntmux/http/Capabilities.php +++ b/nntmux/http/Capabilities.php @@ -134,10 +134,10 @@ abstract class Capabilities 'server' => [ 'appversion' => (new Versions())->getGitTagInFile(), 'version' => (new Versions())->getGitTagInRepo(), - 'title' => Settings::value('site.main.title'), - 'strapline' => Settings::value('site.main.strapline'), - 'email' => Settings::value('site.main.email'), - 'meta' => Settings::value('site.main.metakeywords'), + 'title' => Settings::settingValue('site.main.title'), + 'strapline' => Settings::settingValue('site.main.strapline'), + 'email' => Settings::settingValue('site.main.email'), + 'meta' => Settings::settingValue('site.main.metakeywords'), 'url' => $serverroot, 'image' => $serverroot.'themes/shared/images/tmux_logo.png', ], @@ -147,7 +147,7 @@ abstract class Capabilities ], 'registration' => [ 'available' => 'yes', - 'open' => (int) Settings::value('..registerstatus') === 0 ? 'yes' : 'no', + 'open' => (int) Settings::settingValue('..registerstatus') === 0 ? 'yes' : 'no', ], 'searching' => [ 'search' => ['available' => 'yes', 'supportedParams' => 'q'], diff --git a/nntmux/libraries/Forking.php b/nntmux/libraries/Forking.php index 012720cba..667b02a33 100755 --- a/nntmux/libraries/Forking.php +++ b/nntmux/libraries/Forking.php @@ -282,7 +282,7 @@ class Forking extends \fork_daemon ) ); - return (int) Settings::value('..backfillthreads'); + return (int) Settings::settingValue('..backfillthreads'); } /** @@ -308,7 +308,7 @@ class Forking extends \fork_daemon $this->register_child_run([0 => $this, 1 => 'safeBackfillChildWorker']); $run = $this->pdo->query("SELECT (SELECT value FROM tmux WHERE setting = 'backfill_qty') AS qty, (SELECT value FROM tmux WHERE setting = 'backfill') AS backfill, (SELECT value FROM tmux WHERE setting = 'backfill_order') AS orderby, (SELECT value FROM tmux WHERE setting = 'backfill_days') AS days, (SELECT value FROM settings WHERE setting = 'maxmssgs') AS maxmsgs"); - $threads = Settings::value('..backfillthreads'); + $threads = Settings::settingValue('..backfillthreads'); $orderby = 'ORDER BY a.last_record ASC'; switch ((int) $run[0]['orderby']) { @@ -337,7 +337,7 @@ class Forking extends \fork_daemon if ($run[0]['days'] == 1) { $backfilldays = 'backfill_target'; } elseif ($run[0]['days'] == 2) { - $backfilldays = round(abs(strtotime(date('Y-m-d')) - strtotime(Settings::value('..safebackfilldate'))) / 86400); + $backfilldays = round(abs(strtotime(date('Y-m-d')) - strtotime(Settings::settingValue('..safebackfilldate'))) / 86400); } $data = $this->pdo->queryOneRow( @@ -414,7 +414,7 @@ class Forking extends \fork_daemon ) ); - return Settings::value('..binarythreads'); + return Settings::settingValue('..binarythreads'); } /** @@ -438,9 +438,9 @@ class Forking extends \fork_daemon { $this->register_child_run([0 => $this, 1 => 'safeBinariesChildWorker']); - $maxheaders = Settings::value('max.headers.iteration') ?: 1000000; - $maxmssgs = Settings::value('..maxmssgs'); - $threads = Settings::value('..binarythreads'); + $maxheaders = Settings::settingValue('max.headers.iteration') ?: 1000000; + $maxmssgs = Settings::settingValue('..maxmssgs'); + $threads = Settings::settingValue('..binarythreads'); $groups = $this->pdo->query(' SELECT g.name AS groupname, g.last_record AS our_last, @@ -512,8 +512,8 @@ class Forking extends \fork_daemon { $this->register_child_run([0 => $this, 1 => 'fixRelNamesChildWorker']); - $threads = (int) Settings::value('..fixnamethreads'); - $maxperrun = (int) Settings::value('..fixnamesperrun'); + $threads = (int) Settings::settingValue('..fixnamethreads'); + $maxperrun = (int) Settings::settingValue('..fixnamesperrun'); if ($threads > 16) { $threads = 16; @@ -594,7 +594,7 @@ class Forking extends \fork_daemon } } - return (int) Settings::value('..releasethreads'); + return (int) Settings::settingValue('..releasethreads'); } /** @@ -651,10 +651,10 @@ class Forking extends \fork_daemon private function checkProcessAdditional() { $this->ppAddMinSize = - (Settings::value('..minsizetopostprocess') !== '') ? (int) Settings::value('..minsizetopostprocess') : 1; + (Settings::settingValue('..minsizetopostprocess') !== '') ? (int) Settings::settingValue('..minsizetopostprocess') : 1; $this->ppAddMinSize = ($this->ppAddMinSize > 0 ? ('AND r.size > '.($this->ppAddMinSize * 1048576)) : ''); $this->ppAddMaxSize = - (Settings::value('..maxsizetopostprocess') !== '') ? (int) Settings::value('..maxsizetopostprocess') : 100; + (Settings::settingValue('..maxsizetopostprocess') !== '') ? (int) Settings::settingValue('..maxsizetopostprocess') : 100; $this->ppAddMaxSize = ($this->ppAddMaxSize > 0 ? ('AND r.size < '.($this->ppAddMaxSize * 1073741824)) : ''); return @@ -703,7 +703,7 @@ class Forking extends \fork_daemon $this->ppAddMinSize ) ); - $maxProcesses = (int) Settings::value('..postthreads'); + $maxProcesses = (int) Settings::settingValue('..postthreads'); } return $maxProcesses; @@ -718,7 +718,7 @@ class Forking extends \fork_daemon */ private function checkProcessNfo() { - if (Settings::value('..lookupnfo') == 1) { + if (Settings::settingValue('..lookupnfo') == 1) { $this->nfoQueryString = Nfo::NfoQueryString($this->pdo); return @@ -753,7 +753,7 @@ class Forking extends \fork_daemon $this->nfoQueryString ) ); - $maxProcesses = (int) Settings::value('..nfothreads'); + $maxProcesses = (int) Settings::settingValue('..nfothreads'); } return $maxProcesses; @@ -766,7 +766,7 @@ class Forking extends \fork_daemon */ private function checkProcessMovies() { - if (Settings::value('..lookupimdb') > 0) { + if (Settings::settingValue('..lookupimdb') > 0) { return $this->pdo->queryOneRow( sprintf(' @@ -778,7 +778,7 @@ class Forking extends \fork_daemon %s %s LIMIT 1', NZB::NZB_ADDED, - ((int) Settings::value('..lookupimdb') === 2 ? 'AND isrenamed = 1' : ''), + ((int) Settings::settingValue('..lookupimdb') === 2 ? 'AND isrenamed = 1' : ''), ($this->ppRenamedOnly ? 'AND isrenamed = 1' : '') ) ) === false ? false : true; @@ -809,11 +809,11 @@ class Forking extends \fork_daemon LIMIT 16', ($this->ppRenamedOnly ? 2 : 1), NZB::NZB_ADDED, - ((int) Settings::value('..lookupimdb') === 2 ? 'AND isrenamed = 1' : ''), + ((int) Settings::settingValue('..lookupimdb') === 2 ? 'AND isrenamed = 1' : ''), ($this->ppRenamedOnly ? 'AND isrenamed = 1' : '') ) ); - $maxProcesses = (int) Settings::value('..postthreadsnon'); + $maxProcesses = (int) Settings::settingValue('..postthreadsnon'); } return $maxProcesses; @@ -826,7 +826,7 @@ class Forking extends \fork_daemon */ private function checkProcessTV() { - if (Settings::value('..lookuptvrage') > 0) { + if (Settings::settingValue('..lookuptvrage') > 0) { return $this->pdo->queryOneRow( sprintf(' @@ -839,7 +839,7 @@ class Forking extends \fork_daemon %s %s LIMIT 1', NZB::NZB_ADDED, - (int) Settings::value('..lookuptvrage') === 2 ? 'AND isrenamed = 1' : '', + (int) Settings::settingValue('..lookuptvrage') === 2 ? 'AND isrenamed = 1' : '', $this->ppRenamedOnly ? 'AND isrenamed = 1' : '' ) ) === false ? false : true; @@ -871,11 +871,11 @@ class Forking extends \fork_daemon LIMIT 16', ($this->ppRenamedOnly ? 2 : 1), NZB::NZB_ADDED, - (int) Settings::value('..lookuptvrage') === 2 ? 'AND isrenamed = 1' : '', + (int) Settings::settingValue('..lookuptvrage') === 2 ? 'AND isrenamed = 1' : '', ($this->ppRenamedOnly ? 'AND isrenamed = 1' : '') ) ); - $maxProcesses = (int) Settings::value('..postthreadsnon'); + $maxProcesses = (int) Settings::settingValue('..postthreadsnon'); } return $maxProcesses; @@ -891,7 +891,7 @@ class Forking extends \fork_daemon $sharing = $this->pdo->queryOneRow('SELECT enabled FROM sharing'); if ($sharing !== false && $sharing['enabled'] == 1) { $nntp = new NNTP(['Settings' => $this->pdo]); - if ((int) (Settings::value('..alternate_nntp') === 1 ? $nntp->doConnect(true, true) : $nntp->doConnect()) === true) { + if ((int) (Settings::settingValue('..alternate_nntp') === 1 ? $nntp->doConnect(true, true) : $nntp->doConnect()) === true) { (new PostProcess(['Settings' => $this->pdo, 'ColorCLI' => $this->_colorCLI]))->processSharing($nntp); } @@ -943,7 +943,7 @@ class Forking extends \fork_daemon ) ); - return (int) Settings::value('..reqidthreads'); + return (int) Settings::settingValue('..reqidthreads'); } /** @@ -970,7 +970,7 @@ class Forking extends \fork_daemon $this->register_child_run([0 => $this, 1 => 'updatePerGroupChildWorker']); $this->work = $this->pdo->query('SELECT id FROM groups WHERE (active = 1 OR backfill = 1)'); - return (int) Settings::value('..releasethreads'); + return (int) Settings::settingValue('..releasethreads'); } /** diff --git a/nntmux/processing/PostProcess.php b/nntmux/processing/PostProcess.php index f2a159754..b0e823c0d 100755 --- a/nntmux/processing/PostProcess.php +++ b/nntmux/processing/PostProcess.php @@ -125,8 +125,8 @@ class PostProcess $this->releaseFiles = (($options['ReleaseFiles'] instanceof ReleaseFiles) ? $options['ReleaseFiles'] : new ReleaseFiles($this->pdo)); // Site settings. - $this->addpar2 = (int) Settings::value('..addpar2') !== 0; - $this->alternateNNTP = (int) Settings::value('..alternate_nntp') === 1; + $this->addpar2 = (int) Settings::settingValue('..addpar2') !== 0; + $this->alternateNNTP = (int) Settings::settingValue('..alternate_nntp') === 1; } /** @@ -160,7 +160,7 @@ class PostProcess */ public function processAnime(): void { - if ((int) Settings::value('..lookupanidb') !== 0) { + if ((int) Settings::settingValue('..lookupanidb') !== 0) { (new AniDB(['Echo' => $this->echooutput, 'Settings' => $this->pdo]))->processAnimeReleases(); } } @@ -173,7 +173,7 @@ class PostProcess */ public function processBooks(): void { - if ((int) Settings::value('..lookupbooks') !== 0) { + if ((int) Settings::settingValue('..lookupbooks') !== 0) { (new Books(['Echo' => $this->echooutput, 'Settings' => $this->pdo]))->processBookReleases(); } } @@ -185,7 +185,7 @@ class PostProcess */ public function processConsoles(): void { - if ((int) Settings::value('..lookupgames') !== 0) { + if ((int) Settings::settingValue('..lookupgames') !== 0) { (new Console(['Settings' => $this->pdo, 'Echo' => $this->echooutput]))->processConsoleReleases(); } } @@ -198,7 +198,7 @@ class PostProcess */ public function processGames(): void { - if ((int) Settings::value('..lookupgames') !== 0) { + if ((int) Settings::settingValue('..lookupgames') !== 0) { (new Games(['Echo' => $this->echooutput, 'Settings' => $this->pdo]))->processGamesReleases(); } } @@ -216,7 +216,7 @@ class PostProcess */ public function processMovies($groupID = '', $guidChar = '', $processMovies = ''): void { - $processMovies = (is_numeric($processMovies) ? $processMovies : Settings::value('..lookupimdb')); + $processMovies = (is_numeric($processMovies) ? $processMovies : Settings::settingValue('..lookupimdb')); if ($processMovies > 0) { (new Movie(['Echo' => $this->echooutput, 'Settings' => $this->pdo]))->processMovieReleases($groupID, $guidChar, $processMovies); } @@ -229,7 +229,7 @@ class PostProcess */ public function processMusic(): void { - if ((int) Settings::value('..lookupmusic') !== 0) { + if ((int) Settings::settingValue('..lookupmusic') !== 0) { (new Music(['Echo' => $this->echooutput, 'Settings' => $this->pdo]))->processMusicReleases(); } } @@ -246,8 +246,8 @@ class PostProcess */ public function processNfos(&$nntp, $groupID = '', $guidChar = ''): void { - if ((int) Settings::value('..lookupnfo') === 1) { - $this->Nfo->processNfoFiles($nntp, $groupID, $guidChar, (int) Settings::value('..lookupimdb'), (int) Settings::value('..lookuptvrage')); + if ((int) Settings::settingValue('..lookupnfo') === 1) { + $this->Nfo->processNfoFiles($nntp, $groupID, $guidChar, (int) Settings::settingValue('..lookupimdb'), (int) Settings::settingValue('..lookuptvrage')); } } @@ -274,7 +274,7 @@ class PostProcess */ public function processTv($groupID = '', $guidChar = '', $processTV = ''): void { - $processTV = (is_numeric($processTV) ? $processTV : Settings::value('..lookuptvrage')); + $processTV = (is_numeric($processTV) ? $processTV : Settings::settingValue('..lookuptvrage')); if ($processTV > 0) { (new TVDB(['Echo' => $this->echooutput, 'Settings' => $this->pdo]))->processSite($groupID, $guidChar, $processTV); (new TVMaze(['Echo' => $this->echooutput, 'Settings' => $this->pdo]))->processSite($groupID, $guidChar, $processTV); @@ -311,7 +311,7 @@ class PostProcess */ public function processXXX(): void { - if ((int) Settings::value('..lookupxxx') === 1) { + if ((int) Settings::settingValue('..lookupxxx') === 1) { (new XXX(['Echo' => $this->echooutput, 'Settings' => $this->pdo]))->processXXXReleases(); } } diff --git a/nntmux/processing/ProcessReleases.php b/nntmux/processing/ProcessReleases.php index 0241ee7a6..7ba4e0969 100755 --- a/nntmux/processing/ProcessReleases.php +++ b/nntmux/processing/ProcessReleases.php @@ -145,20 +145,20 @@ class ProcessReleases $this->releases = ($options['Releases'] instanceof Releases ? $options['Releases'] : new Releases(['Settings' => $this->pdo, 'Groups' => $this->groups])); $this->releaseImage = ($options['ReleaseImage'] instanceof ReleaseImage ? $options['ReleaseImage'] : new ReleaseImage($this->pdo)); - $dummy = Settings::value('..delaytime'); + $dummy = Settings::settingValue('..delaytime'); $this->collectionDelayTime = ($dummy !== '' ? (int) $dummy : 2); - $dummy = Settings::value('..crossposttime'); + $dummy = Settings::settingValue('..crossposttime'); $this->crossPostTime = ($dummy !== '' ? (int) $dummy : 2); - $dummy = Settings::value('..maxnzbsprocessed'); + $dummy = Settings::settingValue('..maxnzbsprocessed'); $this->releaseCreationLimit = ($dummy !== '' ? (int) $dummy : 1000); - $dummy = Settings::value('..completionpercent'); + $dummy = Settings::settingValue('..completionpercent'); $this->completion = ($dummy !== '' ? (int) $dummy : 0); - $this->processRequestIDs = (int) Settings::value('lookup_reqids'); + $this->processRequestIDs = (int) Settings::settingValue('lookup_reqids'); if ($this->completion > 100) { $this->completion = 100; echo ColorCLI::error(PHP_EOL.'You have an invalid setting for completion. It cannot be higher than 100.'); } - $this->collectionTimeout = (int) Settings::value('indexer.processing.collection_timeout'); + $this->collectionTimeout = (int) Settings::settingValue('indexer.processing.collection_timeout'); } /** @@ -188,10 +188,10 @@ class ProcessReleases ColorCLI::doEcho(ColorCLI::header('Starting release update process ('.date('Y-m-d H:i:s').')'), true); } - if (! file_exists(Settings::value('..nzbpath'))) { + if (! file_exists(Settings::settingValue('..nzbpath'))) { if ($this->echoCLI) { ColorCLI::doEcho( - ColorCLI::error('Bad or missing nzb directory - '.Settings::value('..nzbpath')), + ColorCLI::error('Bad or missing nzb directory - '.Settings::settingValue('..nzbpath')), true ); } @@ -419,9 +419,9 @@ class ProcessReleases $minSizeDeleted = $maxSizeDeleted = $minFilesDeleted = 0; - $maxSizeSetting = Settings::value('.release.maxsizetoformrelease'); - $minSizeSetting = Settings::value('.release.minsizetoformrelease'); - $minFilesSetting = Settings::value('.release.minfilestoformrelease'); + $maxSizeSetting = Settings::settingValue('.release.maxsizetoformrelease'); + $minSizeSetting = Settings::settingValue('.release.minsizetoformrelease'); + $minFilesSetting = Settings::settingValue('.release.minfilestoformrelease'); foreach ($groupIDs as $grpID) { $groupMinSizeSetting = $groupMinFilesSetting = 0; @@ -841,7 +841,7 @@ class ProcessReleases */ public function processRequestIDs($groupID = '', $limit = 5000, $local = true): void { - if ($local === false && (int) Settings::value('..lookup_reqids') === 0) { + if ($local === false && (int) Settings::settingValue('..lookup_reqids') === 0) { return; } @@ -972,7 +972,7 @@ class ProcessReleases ColorCLI::header('Process Releases -> Delete finished collections.'.PHP_EOL). ColorCLI::primary(sprintf( 'Deleting collections/binaries/parts older than %d hours.', - Settings::value('..partretentionhours') + Settings::settingValue('..partretentionhours') )); } @@ -987,7 +987,7 @@ class ProcessReleases $this->tables['cname'], $this->tables['bname'], $this->tables['pname'], - Settings::value('..partretentionhours') + Settings::settingValue('..partretentionhours') ) ); @@ -1183,9 +1183,9 @@ class ProcessReleases $groupID === '' ? $groupIDs = $this->groups->getActiveIDs() : $groupIDs = [['id' => $groupID]]; - $maxSizeSetting = Settings::value('.release.maxsizetoformrelease'); - $minSizeSetting = Settings::value('.release.minsizetoformrelease'); - $minFilesSetting = Settings::value('.release.minfilestoformrelease'); + $maxSizeSetting = Settings::settingValue('.release.maxsizetoformrelease'); + $minSizeSetting = Settings::settingValue('.release.minsizetoformrelease'); + $minFilesSetting = Settings::settingValue('.release.minfilestoformrelease'); foreach ($groupIDs as $grpID) { $releases = $this->pdo->queryDirect( @@ -1283,11 +1283,11 @@ class ProcessReleases } // Releases past retention. - if ((int) Settings::value('..releaseretentiondays') !== 0) { + if ((int) Settings::settingValue('..releaseretentiondays') !== 0) { $releases = $this->pdo->queryDirect( sprintf( 'SELECT SQL_NO_CACHE id, guid FROM releases WHERE postdate < (NOW() - INTERVAL %d DAY)', - (int) Settings::value('..releaseretentiondays') + (int) Settings::settingValue('..releaseretentiondays') ) ); if ($releases instanceof \Traversable) { @@ -1299,7 +1299,7 @@ class ProcessReleases } // Passworded releases. - if ((int) Settings::value('..deletepasswordedrelease') === 1) { + if ((int) Settings::settingValue('..deletepasswordedrelease') === 1) { $releases = $this->pdo->queryDirect( sprintf( 'SELECT SQL_NO_CACHE id, guid FROM releases WHERE passwordstatus = %d', @@ -1315,7 +1315,7 @@ class ProcessReleases } // Possibly passworded releases. - if ((int) Settings::value('..deletepossiblerelease') === 1) { + if ((int) Settings::settingValue('..deletepossiblerelease') === 1) { $releases = $this->pdo->queryDirect( sprintf( 'SELECT SQL_NO_CACHE id, guid FROM releases WHERE passwordstatus = %d', @@ -1434,7 +1434,7 @@ class ProcessReleases } // Misc other. - if (Settings::value('..miscotherretentionhours') > 0) { + if (Settings::settingValue('..miscotherretentionhours') > 0) { $releases = $this->pdo->queryDirect( sprintf(' SELECT SQL_NO_CACHE id, guid @@ -1442,7 +1442,7 @@ class ProcessReleases WHERE categories_id = %d AND adddate <= NOW() - INTERVAL %d HOUR', Category::OTHER_MISC, - (int) Settings::value('..miscotherretentionhours') + (int) Settings::settingValue('..miscotherretentionhours') ) ); if ($releases instanceof \Traversable) { @@ -1454,7 +1454,7 @@ class ProcessReleases } // Misc hashed. - if ((int) Settings::value('..mischashedretentionhours') > 0) { + if ((int) Settings::settingValue('..mischashedretentionhours') > 0) { $releases = $this->pdo->queryDirect( sprintf(' SELECT SQL_NO_CACHE id, guid @@ -1462,7 +1462,7 @@ class ProcessReleases WHERE categories_id = %d AND adddate <= NOW() - INTERVAL %d HOUR', Category::OTHER_HASHED, - (int) Settings::value('..mischashedretentionhours') + (int) Settings::settingValue('..mischashedretentionhours') ) ); if ($releases instanceof \Traversable) { @@ -1770,7 +1770,7 @@ class ProcessReleases */ private function processStuckCollections($where): void { - $lastRun = Settings::value('indexer.processing.last_run_time'); + $lastRun = Settings::settingValue('indexer.processing.last_run_time'); $obj = $this->pdo->queryExec( sprintf(" diff --git a/nntmux/processing/post/AniDB.php b/nntmux/processing/post/AniDB.php index 1f8759818..89b3a2da9 100755 --- a/nntmux/processing/post/AniDB.php +++ b/nntmux/processing/post/AniDB.php @@ -55,7 +55,7 @@ class AniDB $this->echooutput = ($options['Echo'] && NN_ECHOCLI); $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); - $qty = Settings::value('..maxanidbprocessed'); + $qty = Settings::settingValue('..maxanidbprocessed'); $this->aniqty = $qty ?? 100; $this->status = 'NULL'; diff --git a/nntmux/processing/post/ProcessAdditional.php b/nntmux/processing/post/ProcessAdditional.php index 4c9f8a1f4..44929fed3 100755 --- a/nntmux/processing/post/ProcessAdditional.php +++ b/nntmux/processing/post/ProcessAdditional.php @@ -416,32 +416,32 @@ class ProcessAdditional $this->_nfo = ($options['Nfo'] instanceof Nfo ? $options['Nfo'] : new Nfo(['Echo' => $this->_echoCLI, 'Settings' => $this->pdo])); $this->sphinx = ($options['SphinxSearch'] instanceof SphinxSearch ? $options['SphinxSearch'] : new SphinxSearch()); - $this->_innerFileBlacklist = (Settings::value('indexer.ppa.innerfileblacklist') == '' ? false : Settings::value('indexer.ppa.innerfileblacklist')); - $this->_maxNestedLevels = (Settings::value('..maxnestedlevels') == 0 ? 3 : Settings::value('..maxnestedlevels')); - $this->_extractUsingRarInfo = (Settings::value('..extractusingrarinfo') == 0 ? false : true); - $this->_fetchLastFiles = (Settings::value('archive.fetch.end') == 0 ? false : true); + $this->_innerFileBlacklist = (Settings::settingValue('indexer.ppa.innerfileblacklist') == '' ? false : Settings::settingValue('indexer.ppa.innerfileblacklist')); + $this->_maxNestedLevels = (Settings::settingValue('..maxnestedlevels') == 0 ? 3 : Settings::settingValue('..maxnestedlevels')); + $this->_extractUsingRarInfo = (Settings::settingValue('..extractusingrarinfo') == 0 ? false : true); + $this->_fetchLastFiles = (Settings::settingValue('archive.fetch.end') == 0 ? false : true); $this->_7zipPath = false; $this->_unrarPath = false; // Pass the binary extractors to ArchiveInfo. $clients = []; - if (Settings::value('apps..unrarpath') != '') { - $clients += [ArchiveInfo::TYPE_RAR => Settings::value('apps..unrarpath')]; - $this->_unrarPath = Settings::value('apps..unrarpath'); + if (Settings::settingValue('apps..unrarpath') != '') { + $clients += [ArchiveInfo::TYPE_RAR => Settings::settingValue('apps..unrarpath')]; + $this->_unrarPath = Settings::settingValue('apps..unrarpath'); } - if (Settings::value('apps..7zippath') != '') { - $clients += [ArchiveInfo::TYPE_ZIP => Settings::value('apps..7zippath')]; - $this->_7zipPath = Settings::value('apps..7zippath'); + if (Settings::settingValue('apps..7zippath') != '') { + $clients += [ArchiveInfo::TYPE_ZIP => Settings::settingValue('apps..7zippath')]; + $this->_7zipPath = Settings::settingValue('apps..7zippath'); } $this->_archiveInfo->setExternalClients($clients); $this->_killString = '"'; - if (Settings::value('apps..timeoutpath') != '' && Settings::value('..timeoutseconds') > 0) { + if (Settings::settingValue('apps..timeoutpath') != '' && Settings::settingValue('..timeoutseconds') > 0) { $this->_killString = ( - '"'.Settings::value('apps..timeoutpath'). + '"'.Settings::settingValue('apps..timeoutpath'). '" --foreground --signal=KILL '. - Settings::value('..timeoutseconds').' "' + Settings::settingValue('..timeoutseconds').' "' ); } @@ -449,52 +449,52 @@ class ProcessAdditional // Maximum amount of releases to fetch per run. $this->_queryLimit = - (Settings::value('..maxaddprocessed') != '') ? (int) Settings::value('..maxaddprocessed') : 25; + (Settings::settingValue('..maxaddprocessed') != '') ? (int) Settings::settingValue('..maxaddprocessed') : 25; // Maximum message ID's to download per file type in the NZB (video, jpg, etc). $this->_segmentsToDownload = - (Settings::value('..segmentstodownload') != '') ? (int) Settings::value('..segmentstodownload') : 2; + (Settings::settingValue('..segmentstodownload') != '') ? (int) Settings::settingValue('..segmentstodownload') : 2; // Maximum message ID's to download for a RAR file. $this->_maximumRarSegments = - (Settings::value('..maxpartsprocessed') != '') ? (int) Settings::value('..maxpartsprocessed') : 3; + (Settings::settingValue('..maxpartsprocessed') != '') ? (int) Settings::settingValue('..maxpartsprocessed') : 3; // Maximum RAR files to check for a password before stopping. $this->_maximumRarPasswordChecks = - (Settings::value('..passchkattempts') != '') ? (int) Settings::value('..passchkattempts') : 1; + (Settings::settingValue('..passchkattempts') != '') ? (int) Settings::settingValue('..passchkattempts') : 1; $this->_maximumRarPasswordChecks = ($this->_maximumRarPasswordChecks < 1 ? 1 : $this->_maximumRarPasswordChecks); // Maximum size of releases in GB. $this->_maxSize = - (Settings::value('..maxsizetopostprocess') != '') ? (int) Settings::value('..maxsizetopostprocess') : 100; + (Settings::settingValue('..maxsizetopostprocess') != '') ? (int) Settings::settingValue('..maxsizetopostprocess') : 100; $this->_maxSize = ($this->_maxSize > 0 ? ('AND r.size < '.($this->_maxSize * 1073741824)) : ''); // Minimum size of releases in MB. $this->_minSize = - (Settings::value('..minsizetopostprocess') != '') ? (int) Settings::value('..minsizetopostprocess') : 100; + (Settings::settingValue('..minsizetopostprocess') != '') ? (int) Settings::settingValue('..minsizetopostprocess') : 100; $this->_minSize = ($this->_minSize > 0 ? ('AND r.size > '.($this->_minSize * 1048576)) : ''); // Use the alternate NNTP provider for downloading Message-ID's ? - $this->_alternateNNTP = (Settings::value('..alternate_nntp') == 1 ? true : false); + $this->_alternateNNTP = (Settings::settingValue('..alternate_nntp') == 1 ? true : false); - $this->_ffMPEGDuration = (Settings::value('..ffmpeg_duration') != '') ? (int) Settings::value('..ffmpeg_duration') : 5; + $this->_ffMPEGDuration = (Settings::settingValue('..ffmpeg_duration') != '') ? (int) Settings::settingValue('..ffmpeg_duration') : 5; - $this->_addPAR2Files = (Settings::value('..addpar2') === '0') ? false : true; + $this->_addPAR2Files = (Settings::settingValue('..addpar2') === '0') ? false : true; - if (! Settings::value('apps..ffmpegpath')) { + if (! Settings::settingValue('apps..ffmpegpath')) { $this->_processAudioSample = $this->_processThumbnails = $this->_processVideo = false; } else { - $this->_processAudioSample = (Settings::value('..saveaudiopreview') == 0) ? false : true; - $this->_processThumbnails = (Settings::value('..processthumbnails') == 0 ? false : true); - $this->_processVideo = (Settings::value('..processvideos') == 0) ? false : true; + $this->_processAudioSample = (Settings::settingValue('..saveaudiopreview') == 0) ? false : true; + $this->_processThumbnails = (Settings::settingValue('..processthumbnails') == 0 ? false : true); + $this->_processVideo = (Settings::settingValue('..processvideos') == 0) ? false : true; } - $this->_processJPGSample = (Settings::value('..processjpg') == 0) ? false : true; - $this->_processMediaInfo = (Settings::value('apps..mediainfopath') == '') ? false : true; + $this->_processJPGSample = (Settings::settingValue('..processjpg') == 0) ? false : true; + $this->_processMediaInfo = (Settings::settingValue('apps..mediainfopath') == '') ? false : true; $this->_processAudioInfo = $this->_processMediaInfo; $this->_processPasswords = ( - (((Settings::value('..checkpasswordedrar') == 0) ? false : true)) && - ((Settings::value('apps..unrarpath') == '') ? false : true) + (((Settings::settingValue('..checkpasswordedrar') == 0) ? false : true)) && + ((Settings::settingValue('apps..unrarpath') == '') ? false : true) ); $this->_audioSavePath = NN_COVERS.'audiosample'.DS; @@ -558,7 +558,7 @@ class ProcessAdditional protected function _setMainTempPath(&$guidChar, &$groupID = '') { // Set up the temporary files folder location. - $this->_mainTmpPath = (string) Settings::value('..tmpunrarpath'); + $this->_mainTmpPath = (string) Settings::settingValue('..tmpunrarpath'); // Check if it ends with a dir separator. if (! preg_match('/[\/\\\\]$/', $this->_mainTmpPath)) { @@ -1757,7 +1757,7 @@ class ProcessAdditional // Get the media info for the file. $xmlArray = Utility::runCmd( - $this->_killString.Settings::value('apps..mediainfopath').'" --Output=XML "'.$fileLocation.'"' + $this->_killString.Settings::settingValue('apps..mediainfopath').'" --Output=XML "'.$fileLocation.'"' ); if (is_array($xmlArray)) { @@ -1842,7 +1842,7 @@ class ProcessAdditional // Create an audio sample. Utility::runCmd( $this->_killString. - Settings::value('apps..ffmpegpath'). + Settings::settingValue('apps..ffmpegpath'). '" -t 30 -i "'. $fileLocation. '" -acodec libvorbis -loglevel quiet -y "'. @@ -1945,7 +1945,7 @@ class ProcessAdditional // Get the real duration of the file. $time = Utility::runCmd( $this->_killString. - Settings::value('apps..ffmpegpath'). + Settings::settingValue('apps..ffmpegpath'). '" -i "'.$videoLocation. '" -vcodec copy -y 2>&1 "'. $tmpVideo.'"', @@ -1991,7 +1991,7 @@ class ProcessAdditional // Create the image. Utility::runCmd( $this->_killString. - Settings::value('apps..ffmpegpath'). + Settings::settingValue('apps..ffmpegpath'). '" -i "'. $fileLocation. '" -ss '.($time === '' ? '00:00:03.00' : $time). @@ -2084,7 +2084,7 @@ class ProcessAdditional // Try to get the sample (from the end instead of the start). Utility::runCmd( $this->_killString. - Settings::value('apps..ffmpegpath'). + Settings::settingValue('apps..ffmpegpath'). '" -i "'. $fileLocation. '" -ss '.$lowestLength. @@ -2101,7 +2101,7 @@ class ProcessAdditional // If longer than 60 or we could not get the video length, run the old way. Utility::runCmd( $this->_killString. - Settings::value('apps..ffmpegpath'). + Settings::settingValue('apps..ffmpegpath'). '" -i "'. $fileLocation. '" -vcodec libtheora -filter:v scale=320:-1 -t '. @@ -2176,7 +2176,7 @@ class ProcessAdditional // Run media info on it. $xmlArray = Utility::runCmd( - $this->_killString.Settings::value('apps..mediainfopath').'" --Output=XML "'.$fileLocation.'"' + $this->_killString.Settings::settingValue('apps..mediainfopath').'" --Output=XML "'.$fileLocation.'"' ); // Check if we got it. diff --git a/nntmux/processing/tv/TMDB.php b/nntmux/processing/tv/TMDB.php index 5fbb2a1ba..f3fb68988 100755 --- a/nntmux/processing/tv/TMDB.php +++ b/nntmux/processing/tv/TMDB.php @@ -55,7 +55,7 @@ class TMDB extends TV public function __construct(array $options = []) { parent::__construct($options); - $this->token = new ApiToken(Settings::value('APIs..tmdbkey')); + $this->token = new ApiToken(Settings::settingValue('APIs..tmdbkey')); $this->client = new Client($this->token, [ 'cache' => [ 'enabled' => false, diff --git a/nntmux/processing/tv/TV.php b/nntmux/processing/tv/TV.php index f39c38bcd..cb4d64f5b 100755 --- a/nntmux/processing/tv/TV.php +++ b/nntmux/processing/tv/TV.php @@ -62,7 +62,7 @@ abstract class TV extends Videos { parent::__construct($options); $this->catWhere = 'categories_id BETWEEN '.Category::TV_ROOT.' AND '.Category::TV_OTHER.' AND categories_id != '.Category::TV_ANIME; - $this->tvqty = (Settings::value('..maxrageprocessed') != '') ? Settings::value('..maxrageprocessed') : 75; + $this->tvqty = (Settings::settingValue('..maxrageprocessed') != '') ? Settings::settingValue('..maxrageprocessed') : 75; $this->imgSavePath = NN_COVERS.'tvshows'.DS; $this->siteColumns = ['tvdb', 'trakt', 'tvrage', 'tvmaze', 'imdb', 'tmdb']; } diff --git a/nntmux/processing/tv/TraktTv.php b/nntmux/processing/tv/TraktTv.php index fc969f80e..8c6515ca4 100755 --- a/nntmux/processing/tv/TraktTv.php +++ b/nntmux/processing/tv/TraktTv.php @@ -76,7 +76,7 @@ class TraktTv extends TV public function __construct(array $options = []) { parent::__construct($options); - $this->clientId = Settings::value('APIs..trakttvclientkey'); + $this->clientId = Settings::settingValue('APIs..trakttvclientkey'); $this->requestHeaders = [ 'Content-Type' => 'application/json', 'trakt-api-version' => 2, diff --git a/nntmux/utility/Utility.php b/nntmux/utility/Utility.php index 11fc45905..3012eab02 100755 --- a/nntmux/utility/Utility.php +++ b/nntmux/utility/Utility.php @@ -255,7 +255,7 @@ class Utility if (! ($pdo instanceof DB)) { $pdo = new DB(); } - $patch = Settings::value('..sqlpatch'); + $patch = Settings::settingValue('..sqlpatch'); $ver = $versions->versions->sql->file; // Check database patch version @@ -769,8 +769,8 @@ class Utility } } - $fromEmail = (PHPMAILER_FROM_EMAIL === '') ? Settings::value('site.main.email') : PHPMAILER_FROM_EMAIL; - $fromName = (PHPMAILER_FROM_NAME === '') ? Settings::value('site.main.title') : PHPMAILER_FROM_NAME; + $fromEmail = (PHPMAILER_FROM_EMAIL === '') ? Settings::settingValue('site.main.email') : PHPMAILER_FROM_EMAIL; + $fromName = (PHPMAILER_FROM_NAME === '') ? Settings::settingValue('site.main.title') : PHPMAILER_FROM_NAME; $replyTo = (PHPMAILER_REPLYTO === '') ? $from : PHPMAILER_REPLYTO; (PHPMAILER_BCC !== '') ? $mail->addBCC(PHPMAILER_BCC) : null; @@ -815,7 +815,7 @@ class Utility */ public static function fileInfo($path) { - $magicPath = Settings::value('apps.indexer.magic_file_path'); + $magicPath = Settings::settingValue('apps.indexer.magic_file_path'); if (self::hasCommand('file') && (! self::isWin() || ! empty($magicPath))) { $magicSwitch = empty($magicPath) ? '' : " -m $magicPath"; $output = self::runCmd('file'.$magicSwitch.' -b "'.$path.'"'); diff --git a/public/admin/site-edit.php b/public/admin/site-edit.php index 1127f6a23..2c300a06a 100644 --- a/public/admin/site-edit.php +++ b/public/admin/site-edit.php @@ -157,7 +157,7 @@ $page->smarty->assign('book_reqids_ids', $book_reqids_ids); $page->smarty->assign('book_reqids_names', $book_reqids_names); // convert from a list to an array as we need to use an array, but teh Settings table only saves strings -$books_selected = explode(',', Settings::value('..book_reqids')); +$books_selected = explode(',', Settings::settingValue('..book_reqids')); // convert from a string array to an int array $books_selected = array_map(create_function('$value', 'return (int)$value;'), $books_selected); diff --git a/public/admin/user-edit.php b/public/admin/user-edit.php index b3370393c..d014f304c 100644 --- a/public/admin/user-edit.php +++ b/public/admin/user-edit.php @@ -71,7 +71,7 @@ switch ($action) { if ($_POST['role'] !== '') { $newRole = UserRole::query()->where('id', $_POST['role'])->value('name'); $email = $_POST['email'] ?? $_GET['email']; - Utility::sendEmail($email, 'Account changed', 'Your account role has been changed to '.$newRole, Settings::value('site.main.email')); + Utility::sendEmail($email, 'Account changed', 'Your account role has been changed to '.$newRole, Settings::settingValue('site.main.email')); } } diff --git a/public/index.php b/public/index.php index 5c4501c07..25c31788d 100644 --- a/public/index.php +++ b/public/index.php @@ -65,8 +65,8 @@ switch ($page->page) { case 'xxx': case 'xxxmodal': // Don't show these pages if it's an API-only site. - if (! $page->users->isLoggedIn() && (int) Settings::value('..registerstatus') === Settings::REGISTER_STATUS_API_ONLY) { - header('Location: '.Settings::value('site.main.code')); + if (! $page->users->isLoggedIn() && (int) Settings::settingValue('..registerstatus') === Settings::REGISTER_STATUS_API_ONLY) { + header('Location: '.Settings::settingValue('site.main.code')); break; } case 'api': diff --git a/public/pages/BasePage.php b/public/pages/BasePage.php index 2deeb9fbe..e324fe042 100644 --- a/public/pages/BasePage.php +++ b/public/pages/BasePage.php @@ -148,7 +148,7 @@ class BasePage $this->smarty->assign('loggedin', 'false'); } if ($this->theme === 'None') { - $this->theme = Settings::value('site.main.style'); + $this->theme = Settings::settingValue('site.main.style'); } $this->smarty->assign('theme', $this->theme); @@ -331,13 +331,13 @@ class BasePage $this->userdata['rolecategoryexclusions'] = $this->users->getRoleCategoryExclusion($this->userdata['role']); // Change the theme to user's selected theme if they selected one, else use the admin one. - if ((int) Settings::value('site.main.userselstyle') === 1) { + if ((int) Settings::settingValue('site.main.userselstyle') === 1) { $this->theme = $this->userdata['style'] ?? 'None'; if ($this->theme === 'None') { - $this->theme = Settings::value('site.main.style'); + $this->theme = Settings::settingValue('site.main.style'); } } else { - $this->theme = Settings::value('site.main.style'); + $this->theme = Settings::settingValue('site.main.style'); } // Update last login every 15 mins. @@ -403,6 +403,6 @@ class BasePage */ public function getSettingValue($setting): ?string { - return Settings::value($setting); + return Settings::settingValue($setting); } } diff --git a/public/pages/Page.php b/public/pages/Page.php index 4eddb95c1..d7825e754 100644 --- a/public/pages/Page.php +++ b/public/pages/Page.php @@ -40,7 +40,7 @@ class Page extends BasePage $this->smarty->assign('usefulcontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEUSEFUL, $role)); $this->smarty->assign('articlecontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEARTICLE, $role)); if ($this->userdata != null) { - $this->smarty->assign('recentforumpostslist', $f->getPosts(Settings::value('..showrecentforumposts'))); + $this->smarty->assign('recentforumpostslist', $f->getPosts(Settings::settingValue('..showrecentforumposts'))); } $this->smarty->assign('main_menu', $this->smarty->fetch('mainmenu.tpl')); diff --git a/public/pages/ajax_profile.php b/public/pages/ajax_profile.php index 3f01a025b..a06671df9 100644 --- a/public/pages/ajax_profile.php +++ b/public/pages/ajax_profile.php @@ -8,7 +8,7 @@ if (! $page->users->isLoggedIn()) { if (isset($_GET['action'], $_GET['emailto']) && (int) $_GET['action'] === 1) { $emailto = $_GET['emailto']; - $ret = $page->users->sendInvite(Settings::value('site.main.title'), Settings::value('site.main.email'), $page->serverurl, $page->users->currentUserId(), $emailto); + $ret = $page->users->sendInvite(Settings::settingValue('site.main.title'), Settings::settingValue('site.main.email'), $page->serverurl, $page->users->currentUserId(), $emailto); if (! $ret) { echo 'Invite not sent.'; } else { diff --git a/public/pages/api.php b/public/pages/api.php index 3e7f52b90..08816b802 100644 --- a/public/pages/api.php +++ b/public/pages/api.php @@ -287,7 +287,7 @@ switch ($function) { case 'r': $api->verifyEmptyParameter('email'); - if (! in_array((int) Settings::value('..registerstatus'), [Settings::REGISTER_STATUS_OPEN, Settings::REGISTER_STATUS_API_ONLY], false)) { + if (! in_array((int) Settings::settingValue('..registerstatus'), [Settings::REGISTER_STATUS_OPEN, Settings::REGISTER_STATUS_API_ONLY], false)) { Utility::showApiError(104); } // Check email is valid format. diff --git a/public/pages/contact-us.php b/public/pages/contact-us.php index 6a92ca9ba..9efa21f65 100644 --- a/public/pages/contact-us.php +++ b/public/pages/contact-us.php @@ -14,7 +14,7 @@ if (isset($_POST['useremail'])) { if ($captcha->getError() === false) { $email = $_POST['useremail']; - $mailto = Settings::value('site.main.email'); + $mailto = Settings::settingValue('site.main.email'); $mailsubj = 'Contact Form Submitted'; $mailhead = "From: $email\n"; $mailbody = "Values submitted from contact form:\n"; @@ -28,14 +28,14 @@ if (isset($_POST['useremail'])) { if (! preg_match("/\n/i", $_POST['useremail'])) { Utility::sendEmail($mailto, $mailsubj, $mailbody, $email); } - $msg = "

Thank you for getting in touch with ".Settings::value('site.main.title').'.

'; + $msg = "

Thank you for getting in touch with ".Settings::settingValue('site.main.title').'.

'; } } $page->smarty->assign('msg', $msg); -$page->title = 'Contact '.Settings::value('site.main.title'); -$page->meta_title = 'Contact '.Settings::value('site.main.title'); +$page->title = 'Contact '.Settings::settingValue('site.main.title'); +$page->meta_title = 'Contact '.Settings::settingValue('site.main.title'); $page->meta_keywords = 'contact us,contact,get in touch,email'; -$page->meta_description = 'Contact us at '.Settings::value('site.main.title').' and submit your feedback'; +$page->meta_description = 'Contact us at '.Settings::settingValue('site.main.title').' and submit your feedback'; $page->content = $page->smarty->fetch('contact.tpl'); diff --git a/public/pages/details.php b/public/pages/details.php index 0719d445a..15bd2c983 100644 --- a/public/pages/details.php +++ b/public/pages/details.php @@ -65,13 +65,13 @@ if (isset($_GET['id'])) { $mov['actors'] = $movie->makeFieldLinks($mov, 'actors'); $mov['genre'] = $movie->makeFieldLinks($mov, 'genre'); $mov['director'] = $movie->makeFieldLinks($mov, 'director'); - if (Settings::value('site.trailers.trailers_display')) { + if (Settings::settingValue('site.trailers.trailers_display')) { $trailer = empty($mov['trailer']) || $mov['trailer'] === '' ? $movie->getTrailer($data['imdbid']) : $mov['trailer']; if ($trailer) { $mov['trailer'] = sprintf( '', - Settings::value('site.trailers.trailers_size_x'), - Settings::value('site.trailers.trailers_size_y'), + Settings::settingValue('site.trailers.trailers_size_x'), + Settings::settingValue('site.trailers.trailers_size_y'), $trailer ); } @@ -152,7 +152,7 @@ if (isset($_GET['id'])) { $page->smarty->assign('comments', $comments); $page->smarty->assign('searchname', $releases->getSimilarName($data['searchname'])); $page->smarty->assign('similars', $similars); - $page->smarty->assign('privateprofiles', (int) Settings::value('..privateprofiles') === 1); + $page->smarty->assign('privateprofiles', (int) Settings::settingValue('..privateprofiles') === 1); $page->smarty->assign('failed', $failed); $page->smarty->assign('cpapi', $cpapi); $page->smarty->assign('cpurl', $cpurl); diff --git a/public/pages/failed.php b/public/pages/failed.php index 3dc8fab6d..8adb7e08f 100644 --- a/public/pages/failed.php +++ b/public/pages/failed.php @@ -8,7 +8,7 @@ if ($page->users->isLoggedIn()) { $uid = $page->users->currentUserId(); $rssToken = $page->userdata['rsstoken']; } else { - if ((int) Settings::value('..registerstatus') === Settings::REGISTER_STATUS_API_ONLY) { + if ((int) Settings::settingValue('..registerstatus') === Settings::REGISTER_STATUS_API_ONLY) { if (! isset($_GET['rsstoken'])) { header('X-DNZB-RCode: 400'); header('X-DNZB-RText: Bad request, please supply all parameters!'); diff --git a/public/pages/forgottenpassword.php b/public/pages/forgottenpassword.php index 123c83088..260fe736a 100644 --- a/public/pages/forgottenpassword.php +++ b/public/pages/forgottenpassword.php @@ -33,10 +33,10 @@ switch ($action) { $page->users->updatePassword($ret['id'], $newpass); $to = $ret['email']; - $subject = Settings::value('site.main.title').' Password Reset'; + $subject = Settings::settingValue('site.main.title').' Password Reset'; $contents = 'Your password has been reset to '.$newpass; $onscreen = 'Your password has been reset to '.$newpass.' and sent to your e-mail address.'; - Utility::sendEmail($to, $subject, $contents, Settings::value('site.main.email')); + Utility::sendEmail($to, $subject, $contents, Settings::settingValue('site.main.email')); $page->smarty->assign('notice', $onscreen); $confirmed = true; break; @@ -69,9 +69,9 @@ switch ($action) { // Send the email // $to = $ret['email']; - $subject = Settings::value('site.main.title').' Forgotten Password Request'; + $subject = Settings::settingValue('site.main.title').' Forgotten Password Request'; $contents = 'Someone has requested a password reset for this email address. To reset the password use the following link. '.PHP_EOL.PHP_EOL.$page->serverurl.'forgottenpassword?action=reset&guid='.$guid; - Utility::sendEmail($to, $subject, $contents, Settings::value('site.main.email')); + Utility::sendEmail($to, $subject, $contents, Settings::settingValue('site.main.email')); $sent = true; break; } diff --git a/public/pages/forum.php b/public/pages/forum.php index f350ac4f8..f1875e914 100644 --- a/public/pages/forum.php +++ b/public/pages/forum.php @@ -48,7 +48,7 @@ $page->smarty->assign('pageroffset', $offset); $page->smarty->assign('pageritemsperpage', ITEMS_PER_PAGE); $page->smarty->assign('pagerquerybase', WWW_TOP.'/forum?offset='); $page->smarty->assign('pagerquerysuffix', '#results'); -$page->smarty->assign('privateprofiles', (int) Settings::value('..privateprofiles') === 1); +$page->smarty->assign('privateprofiles', (int) Settings::settingValue('..privateprofiles') === 1); $pager = $page->smarty->fetch('pager.tpl'); $page->smarty->assign('pager', $pager); diff --git a/public/pages/forumpost.php b/public/pages/forumpost.php index cae7c190e..03480cbfe 100644 --- a/public/pages/forumpost.php +++ b/public/pages/forumpost.php @@ -27,7 +27,7 @@ $page->meta_keywords = 'view,forum,post,thread'; $page->meta_description = 'View forum post'; $page->smarty->assign('results', $results); -$page->smarty->assign('privateprofiles', (int) Settings::value('..privateprofiles') === 1); +$page->smarty->assign('privateprofiles', (int) Settings::settingValue('..privateprofiles') === 1); $page->content = $page->smarty->fetch('forumpost.tpl'); $page->render(); diff --git a/public/pages/getnzb.php b/public/pages/getnzb.php index f8e71495b..e947b0d90 100644 --- a/public/pages/getnzb.php +++ b/public/pages/getnzb.php @@ -16,7 +16,7 @@ if ($page->users->isLoggedIn()) { Utility::showApiError(101); } } else { - if (Settings::value('..registerstatus') == Settings::REGISTER_STATUS_API_ONLY) { + if (Settings::settingValue('..registerstatus') == Settings::REGISTER_STATUS_API_ONLY) { $res = $page->users->getById(0); } else { if ((! isset($_GET['i']) || ! isset($_GET['r']))) { @@ -44,8 +44,8 @@ if (isset($_GET['id'])) { // A hash of the users ip to record against the download // $hosthash = ''; -if (Settings::value('..storeuserips') == 1) { - $hosthash = $page->users->getHostHash($_SERVER['REMOTE_ADDR'], Settings::value('..siteseed')); +if (Settings::settingValue('..storeuserips') == 1) { + $hosthash = $page->users->getHostHash($_SERVER['REMOTE_ADDR'], Settings::settingValue('..siteseed')); } // Check download limit on user role. diff --git a/public/pages/mymovies.php b/public/pages/mymovies.php index 300031a9b..b85cf0e56 100755 --- a/public/pages/mymovies.php +++ b/public/pages/mymovies.php @@ -63,7 +63,7 @@ switch ($action) { $categories = []; foreach ($tmpcats as $c) { // If MOVIE WEB-DL categorization is disabled, don't include it as an option - if (Settings::value('indexer.categorise.catwebdl') == 0 && $c['id'] == Category::MOVIE_WEBDL) { + if (Settings::settingValue('indexer.categorise.catwebdl') == 0 && $c['id'] == Category::MOVIE_WEBDL) { continue; } $categories[$c['id']] = $c['title']; diff --git a/public/pages/myshows.php b/public/pages/myshows.php index d706e36c0..8ad03b4b3 100755 --- a/public/pages/myshows.php +++ b/public/pages/myshows.php @@ -63,7 +63,7 @@ switch ($action) { $categories = []; foreach ($tmpcats as $c) { // If TV WEB-DL categorization is disabled, don't include it as an option - if (Settings::value('indexer.categorise.catwebdl') == 0 && $c['id'] == Category::TV_WEBDL) { + if (Settings::settingValue('indexer.categorise.catwebdl') == 0 && $c['id'] == Category::TV_WEBDL) { continue; } $categories[$c['id']] = $c['title']; diff --git a/public/pages/profile.php b/public/pages/profile.php index f63eaf862..fa24a3525 100644 --- a/public/pages/profile.php +++ b/public/pages/profile.php @@ -15,7 +15,7 @@ $nzbget = new NZBGet($page); $userID = $page->users->currentUserId(); $privileged = $page->users->isAdmin($userID) || $page->users->isModerator($userID); -$privateProfiles = (int) Settings::value('..privateprofiles') === 1; +$privateProfiles = (int) Settings::settingValue('..privateprofiles') === 1; $publicView = false; if ($privileged || ! $privateProfiles) { diff --git a/public/pages/profileedit.php b/public/pages/profileedit.php index 816465536..84b799527 100644 --- a/public/pages/profileedit.php +++ b/public/pages/profileedit.php @@ -108,7 +108,7 @@ switch ($action) { default: break; } -if ((int) Settings::value('site.main.userselstyle') === 1) { +if ((int) Settings::settingValue('site.main.userselstyle') === 1) { // Get the list of themes. $page->smarty->assign('themelist', Utility::getThemesList()); } diff --git a/public/pages/queue.php b/public/pages/queue.php index 0118ce92b..009ac1689 100644 --- a/public/pages/queue.php +++ b/public/pages/queue.php @@ -16,7 +16,7 @@ $page->smarty->assign('user', $userData); $queueType = $error = ''; $queue = null; -switch (Settings::value('apps.sabnzbplus.integrationtype')) { +switch (Settings::settingValue('apps.sabnzbplus.integrationtype')) { case SABnzbd::INTEGRATION_TYPE_NONE: if ($userData['queuetype'] === 2) { $queueType = 'NZBGet'; diff --git a/public/pages/register.php b/public/pages/register.php index ca6077db3..37ec3393f 100644 --- a/public/pages/register.php +++ b/public/pages/register.php @@ -12,10 +12,10 @@ if ($page->users->isLoggedIn()) { $error = $userName = $password = $confirmPassword = $email = $inviteCode = $inviteCodeQuery = ''; $showRegister = 1; -if ((int) Settings::value('..registerstatus') === Settings::REGISTER_STATUS_CLOSED || (int) Settings::value('..registerstatus') === Settings::REGISTER_STATUS_API_ONLY) { +if ((int) Settings::settingValue('..registerstatus') === Settings::REGISTER_STATUS_CLOSED || (int) Settings::settingValue('..registerstatus') === Settings::REGISTER_STATUS_API_ONLY) { $error = 'Registrations are currently disabled.'; $showRegister = 0; -} elseif (Settings::value('..registerstatus') === Settings::REGISTER_STATUS_INVITE && (! isset($_REQUEST['invitecode']) || empty($_REQUEST['invitecode']))) { +} elseif (Settings::settingValue('..registerstatus') === Settings::REGISTER_STATUS_INVITE && (! isset($_REQUEST['invitecode']) || empty($_REQUEST['invitecode']))) { $error = 'Registrations are currently invite only.'; $showRegister = 0; } diff --git a/public/pages/rss.php b/public/pages/rss.php index d61ef7065..5e7130d3a 100755 --- a/public/pages/rss.php +++ b/public/pages/rss.php @@ -13,10 +13,10 @@ $offset = 0; if (! isset($_GET['t']) && ! isset($_GET['show']) && ! isset($_GET['anidb'])) { // User has to either be logged in, or using rsskey. if (! $page->users->isLoggedIn()) { - if (Settings::value('..registerstatus') != Settings::REGISTER_STATUS_API_ONLY) { + if (Settings::settingValue('..registerstatus') != Settings::REGISTER_STATUS_API_ONLY) { Utility::showApiError(100); } else { - header('Location: '.Settings::value('site.main.code')); + header('Location: '.Settings::settingValue('site.main.code')); } } @@ -56,7 +56,7 @@ if (! isset($_GET['t']) && ! isset($_GET['show']) && ! isset($_GET['anidb'])) { $rssToken = $page->userdata['rsstoken']; $maxRequests = $page->userdata['apirequests']; } else { - if (Settings::value('..registerstatus') == Settings::REGISTER_STATUS_API_ONLY) { + if (Settings::settingValue('..registerstatus') == Settings::REGISTER_STATUS_API_ONLY) { $res = $page->users->getById(0); } else { if (! isset($_GET['i']) || ! isset($_GET['r'])) { diff --git a/public/pages/sitemap.php b/public/pages/sitemap.php index 1916c7990..4d5958460 100644 --- a/public/pages/sitemap.php +++ b/public/pages/sitemap.php @@ -71,10 +71,10 @@ $page->smarty->assign([ if (isset($_GET['type']) && $_GET['type'] == 'xml') { echo $page->smarty->fetch('sitemap-xml.tpl'); } else { - $page->title = Settings::value('site.main.title').' site map'; - $page->meta_title = Settings::value('site.main.title').' site map'; + $page->title = Settings::settingValue('site.main.title').' site map'; + $page->meta_title = Settings::settingValue('site.main.title').' site map'; $page->meta_keywords = 'sitemap,site,map'; - $page->meta_description = Settings::value('site.main.title').' site map shows all our pages.'; + $page->meta_description = Settings::settingValue('site.main.title').' site map shows all our pages.'; $page->content = $page->smarty->fetch('sitemap.tpl'); $page->render(); } diff --git a/public/pages/terms-and-conditions.php b/public/pages/terms-and-conditions.php index 952e267af..1443bd94f 100644 --- a/public/pages/terms-and-conditions.php +++ b/public/pages/terms-and-conditions.php @@ -3,9 +3,9 @@ use App\Models\Settings; $page->title = 'Terms and Conditions'; -$page->meta_title = Settings::value('site.main.title').' - Terms and conditions'; +$page->meta_title = Settings::settingValue('site.main.title').' - Terms and conditions'; $page->meta_keywords = 'terms,conditions'; -$page->meta_description = 'Terms and Conditions for '.Settings::value('site.main.title'); +$page->meta_description = 'Terms and Conditions for '.Settings::settingValue('site.main.title'); $page->content = $page->smarty->fetch('terms.tpl');