public function __construct($AppName, IRequest $Request, $CurrentUID, IL10N $L10N) { parent::__construct($AppName, $Request); $this->DbType = 0; if (strcmp(Config::getSystemValue('dbtype'), 'pgsql') == 0) { $this->DbType = 1; } $this->CurrentUID = $CurrentUID; $Settings = new Settings(); $Settings->SetKey('WhichDownloader'); $this->WhichDownloader = $Settings->GetValue(); $this->WhichDownloader = is_null($this->WhichDownloader) ? 0 : (strcmp($this->WhichDownloader, 'ARIA2') == 0 ? 0 : 1); // 0 means ARIA2, 1 means CURL $this->L10N = $L10N; }
private static function Load() { if (strcmp(Config::getSystemValue('dbtype'), 'pgsql') == 0) { self::$DbType = 1; } self::$CurrentUID = \OC::$server->getUserSession()->getUser(); self::$CurrentUID = self::$CurrentUID ? self::$CurrentUID->getUID() : ''; self::$L10N = \OC::$server->getL10N('ocdownloader'); $Settings = new Settings(); $Settings->SetKey('ProxyAddress'); self::$ProxyAddress = $Settings->GetValue(); $Settings->SetKey('ProxyPort'); self::$ProxyPort = intval($Settings->GetValue()); $Settings->SetKey('ProxyUser'); self::$ProxyUser = $Settings->GetValue(); $Settings->SetKey('ProxyPasswd'); self::$ProxyPasswd = $Settings->GetValue(); $Settings->SetTable('personal'); $Settings->SetUID(self::$CurrentUID); $Settings->SetKey('DownloadsFolder'); self::$DownloadsFolder = $Settings->GetValue(); self::$DownloadsFolder = '/' . (is_null(self::$DownloadsFolder) ? 'Downloads' : self::$DownloadsFolder); self::$AbsoluteDownloadsFolder = \OC\Files\Filesystem::getLocalFolder(self::$DownloadsFolder); $Settings->SetKey('YTDLBinary'); $YTDLBinary = $Settings->GetValue(); self::$YTDLBinary = '/usr/local/bin/youtube-dl'; // default path if (!is_null($YTDLBinary)) { self::$YTDLBinary = $YTDLBinary; } }
public function __construct($AppName, IRequest $Request, $CurrentUID, IL10N $L10N) { parent::__construct($AppName, $Request); if (strcmp(Config::getSystemValue('dbtype'), 'pgsql') == 0) { $this->DbType = 1; } $this->CurrentUID = $CurrentUID; $Settings = new Settings(); $Settings->SetKey('YTDLBinary'); $YTDLBinary = $Settings->GetValue(); $this->YTDLBinary = '/usr/local/bin/youtube-dl'; // default path if (!is_null($YTDLBinary)) { $this->YTDLBinary = $YTDLBinary; } $Settings->SetKey('ProxyAddress'); $this->ProxyAddress = $Settings->GetValue(); $Settings->SetKey('ProxyPort'); $this->ProxyPort = intval($Settings->GetValue()); $Settings->SetKey('ProxyUser'); $this->ProxyUser = $Settings->GetValue(); $Settings->SetKey('ProxyPasswd'); $this->ProxyPasswd = $Settings->GetValue(); $Settings->SetKey('WhichDownloader'); $this->WhichDownloader = $Settings->GetValue(); $this->WhichDownloader = is_null($this->WhichDownloader) ? 0 : (strcmp($this->WhichDownloader, 'ARIA2') == 0 ? 0 : 1); // 0 means ARIA2, 1 means CURL $Settings->SetKey('MaxDownloadSpeed'); $this->MaxDownloadSpeed = $Settings->GetValue(); $Settings->SetKey('AllowProtocolYT'); $this->AllowProtocolYT = $Settings->GetValue(); $this->AllowProtocolYT = is_null($this->AllowProtocolYT) ? true : strcmp($this->AllowProtocolYT, 'Y') == 0; $Settings->SetTable('personal'); $Settings->SetUID($this->CurrentUID); $Settings->SetKey('DownloadsFolder'); $this->DownloadsFolder = $Settings->GetValue(); $this->DownloadsFolder = '/' . (is_null($this->DownloadsFolder) ? 'Downloads' : $this->DownloadsFolder); $this->AbsoluteDownloadsFolder = \OC\Files\Filesystem::getLocalFolder($this->DownloadsFolder); $this->L10N = $L10N; }
public static function CanCheckForUpdate() { // Is the user in the admin group ? if (\OC_User::isAdminUser(\OC_User::getUser())) { // Is the ocdownloader option to automatically check is enable ? $Settings = new Settings(); $Settings->SetKey('CheckForUpdates'); $CheckForUpdates = $Settings->GetValue(); if (strcmp($CheckForUpdates, 'Y') == 0 || is_null($CheckForUpdates)) { return true; } } return false; }
public function __construct($AppName, IRequest $Request, $CurrentUID, IL10N $L10N) { parent::__construct($AppName, $Request); if (strcmp(Config::getSystemValue('dbtype'), 'pgsql') == 0) { $this->DbType = 1; } $this->CurrentUID = $CurrentUID; $Settings = new Settings(); $Settings->SetKey('ProxyAddress'); $this->ProxyAddress = $Settings->GetValue(); $Settings->SetKey('ProxyPort'); $this->ProxyPort = intval($Settings->GetValue()); $Settings->SetKey('ProxyUser'); $this->ProxyUser = $Settings->GetValue(); $Settings->SetKey('ProxyPasswd'); $this->ProxyPasswd = $Settings->GetValue(); $Settings->SetKey('ProxyOnlyWithYTDL'); $this->ProxyOnlyWithYTDL = $Settings->GetValue(); $this->ProxyOnlyWithYTDL = is_null($this->ProxyOnlyWithYTDL) ? false : strcmp($this->ProxyOnlyWithYTDL, 'Y') == 0; $Settings->SetKey('WhichDownloader'); $this->WhichDownloader = $Settings->GetValue(); $this->WhichDownloader = is_null($this->WhichDownloader) ? 0 : (strcmp($this->WhichDownloader, 'ARIA2') == 0 ? 0 : 1); // 0 means ARIA2, 1 means CURL $Settings->SetTable('personal'); $Settings->SetUID($this->CurrentUID); $Settings->SetKey('DownloadsFolder'); $this->DownloadsFolder = $Settings->GetValue(); $this->DownloadsFolder = '/' . (is_null($this->DownloadsFolder) ? 'Downloads' : $this->DownloadsFolder); $this->AbsoluteDownloadsFolder = \OC\Files\Filesystem::getLocalFolder($this->DownloadsFolder); $this->L10N = $L10N; }
<?php /** * ownCloud - ocDownloader * * This file is licensed under the Creative Commons BY-SA License version 3 or * later. See the COPYING file. * * @author Xavier Beurois <www.sgc-univ.net> * @copyright Xavier Beurois 2015 */ use OCA\ocDownloader\Controller\Lib\Settings; \OCP\User::checkLoggedIn(); // Display template style('ocdownloader', 'settings/personal'); script('ocdownloader', 'settings/personal'); $Tmpl = new OCP\Template('ocdownloader', 'settings/personal'); $Settings = new Settings(); $Settings->SetKey('AllowProtocolBT'); $AllowProtocolBT = $Settings->GetValue(); $AllowProtocolBT = is_null($AllowProtocolBT) ? true : strcmp($AllowProtocolBT, 'Y') == 0; $Tmpl->assign('AllowProtocolBT', $AllowProtocolBT); $Settings->SetTable('personal'); $Settings->SetUID(OC_User::getUser()); $Rows = $Settings->GetAllValues(); while ($Row = $Rows->fetchRow()) { $Tmpl->assign('OCDS_' . $Row['KEY'], $Row['VAL']); } return $Tmpl->fetchPage();
<?php /** * ownCloud - ocDownloader * * This file is licensed under the Creative Commons BY-SA License version 3 or * later. See the COPYING file. * * @author Xavier Beurois <www.sgc-univ.net> * @copyright Xavier Beurois 2015 */ use OCA\ocDownloader\Controller\Lib\Settings; \OC_Util::checkAdminUser(); // Display template style('ocdownloader', 'settings/admin'); script('ocdownloader', 'settings/admin'); $Tmpl = new OCP\Template('ocdownloader', 'settings/admin'); $Settings = new Settings(); $Rows = $Settings->GetAllValues(); while ($Row = $Rows->fetchRow()) { $Tmpl->assign('OCDS_' . $Row['KEY'], $Row['VAL']); } return $Tmpl->fetchPage();
<?php /** * ownCloud - ocDownloader * * This file is licensed under the Affero General Public License version 3 or * later. See the COPYING file. * * @author Xavier Beurois <www.sgc-univ.net> * @copyright Xavier Beurois 2015 */ use OCA\ocDownloader\Controller\Lib\Settings; \OCP\User::checkLoggedIn(); // Display template style('ocdownloader', 'settings/personal'); script('ocdownloader', 'settings/personal'); $Tmpl = new OCP\Template('ocdownloader', 'settings/personal'); $Settings = new Settings('personal'); $Settings->SetUID(OC_User::getUser()); $Rows = $Settings->GetAllValues(); while ($Row = $Rows->fetchRow()) { $Tmpl->assign('OCDS_' . $Row['KEY'], $Row['VAL']); } return $Tmpl->fetchPage();
private static function Load() { if (strcmp(Config::getSystemValue('dbtype'), 'pgsql') == 0) { self::$DbType = 1; } self::$CurrentUID = \OC::$server->getUserSession()->getUser(); self::$CurrentUID = self::$CurrentUID ? self::$CurrentUID->getUID() : ''; self::$L10N = \OC::$server->getL10N('ocdownloader'); $Settings = new Settings(); $Settings->SetKey('ProxyAddress'); self::$ProxyAddress = $Settings->GetValue(); $Settings->SetKey('ProxyPort'); self::$ProxyPort = intval($Settings->GetValue()); $Settings->SetKey('ProxyUser'); self::$ProxyUser = $Settings->GetValue(); $Settings->SetKey('ProxyPasswd'); self::$ProxyPasswd = $Settings->GetValue(); $Settings->SetKey('WhichDownloader'); self::$WhichDownloader = $Settings->GetValue(); self::$WhichDownloader = is_null(self::$WhichDownloader) ? 0 : (strcmp(self::$WhichDownloader, 'ARIA2') == 0 ? 0 : 1); // 0 means ARIA2, 1 means CURL $Settings->SetKey('AllowProtocolHTTP'); self::$AllowProtocolHTTP = $Settings->GetValue(); self::$AllowProtocolHTTP = is_null(self::$AllowProtocolHTTP) ? true : strcmp(self::$AllowProtocolHTTP, 'Y') == 0; $Settings->SetKey('AllowProtocolFTP'); self::$AllowProtocolFTP = $Settings->GetValue(); self::$AllowProtocolFTP = is_null(self::$AllowProtocolFTP) ? true : strcmp(self::$AllowProtocolFTP, 'Y') == 0; $Settings->SetKey('AllowProtocolYT'); self::$AllowProtocolYT = $Settings->GetValue(); self::$AllowProtocolYT = is_null(self::$AllowProtocolYT) ? true : strcmp(self::$AllowProtocolYT, 'Y') == 0; $Settings->SetKey('AllowProtocolBT'); self::$AllowProtocolBT = $Settings->GetValue(); self::$AllowProtocolBT = is_null(self::$AllowProtocolBT) ? true : strcmp(self::$AllowProtocolBT, 'Y') == 0; $Settings->SetTable('personal'); $Settings->SetUID(self::$CurrentUID); $Settings->SetKey('DownloadsFolder'); self::$DownloadsFolder = $Settings->GetValue(); self::$DownloadsFolder = '/' . (is_null(self::$DownloadsFolder) ? 'Downloads' : self::$DownloadsFolder); self::$AbsoluteDownloadsFolder = \OC\Files\Filesystem::getLocalFolder(self::$DownloadsFolder); $Settings->SetKey('YTDLBinary'); $YTDLBinary = $Settings->GetValue(); self::$YTDLBinary = '/usr/local/bin/youtube-dl'; // default path if (!is_null($YTDLBinary)) { self::$YTDLBinary = $YTDLBinary; } }