Esempio n. 1
0
 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;
     $this->Settings = new Settings();
     $this->Settings->SetKey('ProxyAddress');
     $this->ProxyAddress = $this->Settings->GetValue();
     $this->Settings->SetKey('ProxyPort');
     $this->ProxyPort = intval($this->Settings->GetValue());
     $this->Settings->SetKey('ProxyUser');
     $this->ProxyUser = $this->Settings->GetValue();
     $this->Settings->SetKey('ProxyPasswd');
     $this->ProxyPasswd = $this->Settings->GetValue();
     $this->Settings->SetKey('ProxyOnlyWithYTDL');
     $this->ProxyOnlyWithYTDL = $this->Settings->GetValue();
     $this->ProxyOnlyWithYTDL = is_null($this->ProxyOnlyWithYTDL) ? false : strcmp($this->ProxyOnlyWithYTDL, 'Y') == 0;
     $this->Settings->SetKey('MaxDownloadSpeed');
     $this->MaxDownloadSpeed = $this->Settings->GetValue();
     $this->Settings->SetKey('BTMaxUploadSpeed');
     $this->BTMaxUploadSpeed = $this->Settings->GetValue();
     $this->Settings->SetKey('AllowProtocolBT');
     $this->AllowProtocolBT = $this->Settings->GetValue();
     $this->AllowProtocolBT = is_null($this->AllowProtocolBT) ? true : strcmp($this->AllowProtocolBT, 'Y') == 0;
     $this->Settings->SetTable('personal');
     $this->Settings->SetUID($this->CurrentUID);
     $this->Settings->SetKey('DownloadsFolder');
     $this->DownloadsFolder = $this->Settings->GetValue();
     $this->Settings->SetKey('TorrentsFolder');
     $this->TorrentsFolder = $this->Settings->GetValue();
     $this->Settings->SetKey('BTRatioToReach');
     $this->BTRatioToReach = $this->Settings->GetValue();
     $this->BTRatioToReach = is_null($this->BTRatioToReach) ? '0.0' : $this->BTRatioToReach;
     $this->Settings->SetKey('BTSeedTimeToReach_BTSeedTimeToReachUnit');
     $this->SeedTime = $this->Settings->GetValue();
     if (!is_null($this->SeedTime)) {
         $this->SeedTime = explode('_', $this->SeedTime);
         if (count($this->SeedTime) == 2) {
             $this->SeedTime = Tools::GetMinutes($this->SeedTime[0], $this->SeedTime[1]);
         }
     } else {
         $this->SeedTime = 10080;
         // minutes in 1 week - default
     }
     $this->DownloadsFolder = '/' . (is_null($this->DownloadsFolder) ? 'Downloads' : $this->DownloadsFolder);
     $this->TorrentsFolder = '/' . (is_null($this->TorrentsFolder) ? 'Downloads/Files/Torrents' : $this->TorrentsFolder);
     $this->AbsoluteDownloadsFolder = \OC\Files\Filesystem::getLocalFolder($this->DownloadsFolder);
     $this->AbsoluteTorrentsFolder = \OC\Files\Filesystem::getLocalFolder($this->TorrentsFolder);
     $this->L10N = $L10N;
 }