new helper function to retrieve settings
This commit is contained in:
@@ -32,8 +32,7 @@ class Aria2Controller extends Controller
|
||||
$this->l10n = $IL10N;
|
||||
$this->rootFolder = $rootFolder;
|
||||
$this->urlGenerator = \OC::$server->getURLGenerator();
|
||||
$this->settings = new Settings($UserId);
|
||||
$this->downloadDir = $this->settings->get('ncd_downloader_dir') ?? "/Downloads";
|
||||
$this->downloadDir = Helper::getDownloadDir();
|
||||
OC_Util::setupFS();
|
||||
//$this->config = \OC::$server->getAppConfig();
|
||||
$this->aria2 = $aria2;
|
||||
|
||||
@@ -38,10 +38,9 @@ class MainController extends Controller
|
||||
$this->dbconn = new DbHelper();
|
||||
$this->counters = new Counters($aria2, $this->dbconn, $UserId);
|
||||
$this->youtube = $youtube;
|
||||
$this->settings = new Settings($this->uid);
|
||||
$this->isAdmin = \OC_User::isAdminUser($this->uid);
|
||||
$this->hideError = $this->settings->get("ncd_hide_errors", false);
|
||||
$this->disable_bt_nonadmin = $this->settings->setType($this->settings::TYPE['SYSTEM'])->get("ncd_disable_bt", false);
|
||||
$this->hideError = Helper::getSettings("ncd_hide_errors", false);
|
||||
$this->disable_bt_nonadmin = Helper::getSettings("ncd_disable_bt", false, Settings::TYPE["SYSTEM"]);
|
||||
$this->accessDenied = $this->l10n->t("Sorry,only admin users can download files via BT!");
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -111,7 +111,7 @@ class SettingsController extends Controller
|
||||
{
|
||||
$saved = json_decode($this->settings->get("custom_youtube_dl_settings"), 1);
|
||||
$params = $this->request->getParams();
|
||||
foreach ($data as $key => $value) {
|
||||
foreach ($params as $key => $value) {
|
||||
unset($saved[$key]);
|
||||
}
|
||||
$resp = $this->settings->save("custom_youtube_dl_settings", json_encode($saved));
|
||||
|
||||
@@ -5,7 +5,6 @@ use OCA\NCDownloader\Tools\Aria2;
|
||||
use OCA\NCDownloader\Tools\DbHelper;
|
||||
use OCA\NCDownloader\Tools\folderScan;
|
||||
use OCA\NCDownloader\Tools\Helper;
|
||||
use OCA\NCDownloader\Tools\Settings;
|
||||
use OCA\NCDownloader\Tools\Youtube;
|
||||
use OCP\AppFramework\Controller;
|
||||
use OCP\AppFramework\Http\JSONResponse;
|
||||
@@ -26,8 +25,7 @@ class YoutubeController extends Controller
|
||||
$this->uid = $UserId;
|
||||
$this->urlGenerator = \OC::$server->getURLGenerator();
|
||||
$this->l10n = $IL10N;
|
||||
$this->settings = new Settings($UserId);
|
||||
$this->downloadDir = $this->settings->get('ncd_downloader_dir') ?? "/Downloads";
|
||||
$this->downloadDir = Helper::getDownloadDir();
|
||||
$this->dbconn = new DbHelper();
|
||||
$this->youtube = $youtube;
|
||||
$this->aria2 = $aria2;
|
||||
|
||||
Reference in New Issue
Block a user