declared class properties
This commit is contained in:
@@ -8,7 +8,7 @@ Search for torrents within the app from mutiple BT sites;
|
||||
Control Aria2 and manage download tasks from the web;
|
||||
download videos from 700+ video sites(youtube,youku,vimo,dailymotion,twitter,facebook and the likes
|
||||
</description>
|
||||
<version>1.0.6</version>
|
||||
<version>1.0.7</version>
|
||||
<licence>agpl</licence>
|
||||
<author mail="freefallbenson@gmail.com" homepage="https://github.com/shiningw">jiaxinhuang</author>
|
||||
<namespace>NCDownloader</namespace>
|
||||
|
||||
@@ -16,7 +16,7 @@ class Aria2
|
||||
//optional token for authenticating with Aria2
|
||||
private $token = null;
|
||||
//the aria2 method being invoked
|
||||
private $method = null;
|
||||
public $methodName = null;
|
||||
//the aria2c binary path
|
||||
private $bin = null;
|
||||
// return the following items when getting downloads info by default
|
||||
@@ -35,6 +35,13 @@ class Aria2
|
||||
private $rpcUrl;
|
||||
//php binary path;
|
||||
private $php;
|
||||
//curl handle
|
||||
private $ch;
|
||||
//aria2 global options
|
||||
private $onDownloadStart;
|
||||
|
||||
private $content;
|
||||
private $torrentsDir;
|
||||
public function __construct($options = array())
|
||||
{
|
||||
$options += [
|
||||
|
||||
@@ -25,6 +25,16 @@ class MainController extends Controller
|
||||
private $config;
|
||||
private $aria2Opts;
|
||||
private $l10n;
|
||||
private $urlGenerator;
|
||||
private $uid;
|
||||
private $isAdmin;
|
||||
private $hideError;
|
||||
private $disable_bt_nonadmin;
|
||||
private $aria2;
|
||||
private $dbconn;
|
||||
private $counters;
|
||||
private $ytdl;
|
||||
private $accessDenied;
|
||||
|
||||
public function __construct($appName, IRequest $request, $UserId, IL10N $IL10N, Aria2 $aria2, Ytdl $ytdl)
|
||||
{
|
||||
@@ -55,7 +65,7 @@ class MainController extends Controller
|
||||
//$config = \OC::$server->getAppConfig();
|
||||
OC_Util::addScript($this->appName, 'app');
|
||||
OC_Util::addStyle($this->appName, 'app');
|
||||
|
||||
|
||||
$params = $this->buildParams();
|
||||
$response = new TemplateResponse($this->appName, 'Index', $params);
|
||||
|
||||
|
||||
@@ -10,10 +10,13 @@ use OCA\NCDownloader\Tools\Helper;
|
||||
|
||||
class SearchController extends Controller
|
||||
{
|
||||
private $userId;
|
||||
private $uid;
|
||||
private $settings = null;
|
||||
//@config OC\AppConfig
|
||||
private $l10n;
|
||||
private $urlGenerator;
|
||||
private $search;
|
||||
|
||||
|
||||
public function __construct($appName, IRequest $request, $UserId)
|
||||
{
|
||||
|
||||
@@ -15,13 +15,15 @@ class SettingsController extends Controller
|
||||
|
||||
//@config OC\AppConfig
|
||||
private $config;
|
||||
public function __construct($AppName, IRequest $Request, $UserId) //, IL10N $L10N)
|
||||
private $uid;
|
||||
private $settings;
|
||||
public function __construct($AppName, IRequest $Request, $uid) //, IL10N $L10N)
|
||||
|
||||
{
|
||||
parent::__construct($AppName, $Request);
|
||||
$this->UserId = $UserId;
|
||||
$this->uid = $uid;
|
||||
//$this->L10N = $L10N;
|
||||
$this->settings = new Settings($UserId);
|
||||
$this->settings = new Settings($uid);
|
||||
//$this->config = \OC::$server->getAppConfig();
|
||||
}
|
||||
|
||||
@@ -94,7 +96,7 @@ class SettingsController extends Controller
|
||||
public function saveCustomAria2()
|
||||
{
|
||||
$noAria2Settings = (bool) Helper::getAdminSettings("disallow_aria2_settings");
|
||||
if ($noAria2Settings && !\OC_User::isAdminUser($this->UserId)) {
|
||||
if ($noAria2Settings && !\OC_User::isAdminUser($this->uid)) {
|
||||
$resp = ["error" => "forbidden", "status" => false];
|
||||
return new JSONResponse($resp);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,15 @@ class YtdlController extends Controller
|
||||
//@config OC\AppConfig
|
||||
private $l10n;
|
||||
private $audio_extensions = array("mp3", "m4a", "vorbis");
|
||||
private $video_extensions = array("mp4", "webm", "mkv");
|
||||
private $uid;
|
||||
private $downloadDir;
|
||||
private $dbconn;
|
||||
private $ytdl;
|
||||
private $aria2;
|
||||
private $urlGenerator;
|
||||
private $tablename;
|
||||
private $dataDir;
|
||||
|
||||
public function __construct($appName, IRequest $request, $UserId, IL10N $IL10N, Aria2 $aria2, Ytdl $ytdl)
|
||||
{
|
||||
|
||||
@@ -7,6 +7,8 @@ class Helper
|
||||
//@var OC\DB\ConnectionAdapter
|
||||
private $conn;
|
||||
private $table = "ncdownloader_info";
|
||||
private $prefixedTable;
|
||||
public $queryBuilder;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
@@ -86,7 +86,7 @@ class Settings extends AllConfig
|
||||
$this->allConfig->setAppValue($this->appName, $key, $value);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return ['error' => $e->getMessage];
|
||||
return ['error' => $e->getMessage()];
|
||||
}
|
||||
return ['message' => "Saved!"];
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ use Symfony\Component\HttpClient\HttpClient;
|
||||
|
||||
final class Client
|
||||
{
|
||||
private $client;
|
||||
public function __construct(?array $options = null)
|
||||
{
|
||||
$this->client = HttpClient::create($this->configure($options));
|
||||
|
||||
@@ -8,6 +8,9 @@ abstract class searchBase
|
||||
protected $tableTitles = [];
|
||||
protected $rows = [];
|
||||
protected $errors = [];
|
||||
protected $searchUrl;
|
||||
protected $crawler;
|
||||
protected $client;
|
||||
protected $actionLinks = [["name" => 'download', 'path' => '/index.php/apps/ncdownloader/new'], ['name' => 'clipboard']];
|
||||
|
||||
public function getTableTitles(): array
|
||||
|
||||
@@ -29,8 +29,6 @@ class Admin implements ISettings
|
||||
$this->connection = $connection;
|
||||
$this->timeFactory = $timeFactory;
|
||||
$this->config = $config;
|
||||
$this->UserId = \OC::$server->getUserSession()->getUser()->getUID();
|
||||
$this->settings = new Settings($this->UserId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,6 +19,8 @@ class Personal implements ISettings
|
||||
private $timeFactory;
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
private $uid;
|
||||
private $settings;
|
||||
|
||||
public function __construct(
|
||||
IDBConnection $connection,
|
||||
@@ -28,8 +30,8 @@ class Personal implements ISettings
|
||||
$this->connection = $connection;
|
||||
$this->timeFactory = $timeFactory;
|
||||
$this->config = $config;
|
||||
$this->UserId = \OC::$server->getUserSession()->getUser()->getUID();
|
||||
$this->settings = new Settings($this->UserId);
|
||||
$this->uid = \OC::$server->getUserSession()->getUser()->getUID();
|
||||
$this->settings = new Settings($this->uid);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,7 +48,7 @@ class Personal implements ISettings
|
||||
'ncd_seed_time' => $this->settings->get("ncd_seed_time"),
|
||||
"path" => '/apps/ncdownloader/personal/save',
|
||||
"disallow_aria2_settings" => Helper::getAdminSettings("disallow_aria2_settings"),
|
||||
"is_admin" => \OC_User::isAdminUser($this->UserId),
|
||||
"is_admin" => \OC_User::isAdminUser($this->uid),
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
@@ -8,6 +8,9 @@ use OCA\NCDownloader\Db\Helper as DbHelper;
|
||||
class Counters
|
||||
{
|
||||
private $minmax = [0, 999];
|
||||
private $aria2;
|
||||
private $dbconn;
|
||||
private $uid;
|
||||
|
||||
public function __construct(Aria2 $aria2, DbHelper $dbconn, $uid)
|
||||
{
|
||||
|
||||
@@ -11,6 +11,8 @@ class folderScan
|
||||
private $user;
|
||||
private $path;
|
||||
private $realDir;
|
||||
private $logger;
|
||||
private $scanner;
|
||||
public function __construct($path = null, $user = null)
|
||||
{
|
||||
$this->user = $user ?? Helper::getUID();
|
||||
|
||||
@@ -8,6 +8,13 @@ class Helper
|
||||
{
|
||||
public $file = null;
|
||||
protected $pid = 0;
|
||||
protected $dbconn;
|
||||
protected $tablename;
|
||||
protected $user;
|
||||
protected $tools;
|
||||
protected $gid;
|
||||
protected $ytdl;
|
||||
protected $status;
|
||||
public function __construct()
|
||||
{
|
||||
$this->dbconn = new DbHelper();
|
||||
|
||||
@@ -20,6 +20,8 @@ class Ytdl
|
||||
private $defaultDir = "/tmp/downloads";
|
||||
private $env = [];
|
||||
private $bin;
|
||||
private $cmd;
|
||||
public $helper;
|
||||
|
||||
public function __construct(array $options)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user