public function __construct($AppName, IRequest $Request, $CurrentUID, IL10N $L10N) { parent::__construct($AppName, $Request); $this->CurrentUID = $CurrentUID; $this->L10N = $L10N; if (strcmp(Config::getSystemValue('dbtype'), 'pgsql') == 0) { $this->DbType = 1; } $this->CanCheckForUpdate = Tools::CanCheckForUpdate(); $this->Settings = new Settings(); $this->Settings->SetKey('WhichDownloader'); $this->WhichDownloader = $this->Settings->GetValue(); $this->WhichDownloader = is_null($this->WhichDownloader) ? 'ARIA2' : $this->WhichDownloader; $this->Settings->SetKey('AllowProtocolHTTP'); $this->AllowProtocolHTTP = $this->Settings->GetValue(); $this->AllowProtocolHTTP = is_null($this->AllowProtocolHTTP) || \OC_User::isAdminUser($this->CurrentUID) ? true : strcmp($this->AllowProtocolHTTP, 'Y') == 0; $this->Settings->SetKey('AllowProtocolFTP'); $this->AllowProtocolFTP = $this->Settings->GetValue(); $this->AllowProtocolFTP = is_null($this->AllowProtocolFTP) || \OC_User::isAdminUser($this->CurrentUID) ? true : strcmp($this->AllowProtocolFTP, 'Y') == 0; $this->Settings->SetKey('AllowProtocolYT'); $this->AllowProtocolYT = $this->Settings->GetValue(); $this->AllowProtocolYT = is_null($this->AllowProtocolYT) || \OC_User::isAdminUser($this->CurrentUID) ? true : strcmp($this->AllowProtocolYT, 'Y') == 0; $this->Settings->SetKey('AllowProtocolBT'); $this->AllowProtocolBT = $this->Settings->GetValue(); $this->AllowProtocolBT = is_null($this->AllowProtocolBT) || \OC_User::isAdminUser($this->CurrentUID) ? true : strcmp($this->AllowProtocolBT, 'Y') == 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; $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; }
/** * @brief clean up user specific settings if user gets deleted * @param array with uid * * This function is connected to the pre_deleteUser signal of OC_Users * to remove the used space for versions stored in the database */ public static function deleteUser_hook($params) { if (\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED) == 'true') { $uid = $params['uid']; Storage::deleteUser($uid); } }
public function __construct($Table = 'admin') { if (strcmp(Config::getSystemValue('dbtype'), 'pgsql') == 0) { $this->DbType = 1; } $this->Table = $Table; }
public function __construct($params) { $host = $params['host']; //remove leading http[s], will be generated in createBaseUri() if (substr($host, 0, 8) == "https://") { $host = substr($host, 8); } else { if (substr($host, 0, 7) == "http://") { $host = substr($host, 7); } } $this->host = $host; $this->user = $params['user']; $this->password = $params['password']; $this->secure = isset($params['secure']) && $params['secure'] == 'true' ? true : false; $this->root = isset($params['root']) ? $params['root'] : '/'; if (!$this->root || $this->root[0] != '/') { $this->root = '/' . $this->root; } if (substr($this->root, -1, 1) != '/') { $this->root .= '/'; } $settings = array('baseUri' => $this->createBaseUri(), 'userName' => $this->user, 'password' => $this->password); $this->client = new OC_Connector_Sabre_Client($settings); if ($caview = \OCP\Files::getStorage('files_external')) { $certPath = \OCP\Config::getSystemValue('datadirectory') . $caview->getAbsolutePath("") . 'rootcerts.crt'; if (file_exists($certPath)) { $this->client->addTrustedCertificates($certPath); } } //create the root folder if necesary $this->mkdir(''); }
/** * listen to write event. */ public static function write_hook($params) { if (\OCP\App::isEnabled('files_versions')) { $path = $params[\OC\Files\Filesystem::signal_param_path]; $user = \OCP\User::getUser(); $excluded = false; $excludes = \OCP\Config::getSystemValue('files_versions_excludes', NULL); if (isset($excludes) && array_key_exists($user, $excludes)) { $user_excludes = $excludes[$user]; foreach ($user_excludes as &$pat) { if (fnmatch($pat, $path)) { // TODO: Not certain if logging of the files names and patters is allowed. \OCP\Util::writeLog('files_versions', "write_hook: user='******', path='" . $path . "' matched to '" . $pat . "', excluding!", \OCP\Util::INFO); $excluded = true; break; } } unset($pat); } if ($excluded) { return; } if ($path != '') { Storage::store($path); } } }
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(\OC\Files\Storage\Storage $storage) { $this->storage = $storage; $this->storageId = $this->storage->getId(); $this->cache = $storage->getCache(); $this->cacheActive = !Config::getSystemValue('filesystem_cache_readonly', false); }
protected function run($argument) { // Remove activities that are older then one year $expireDays = \OCP\Config::getSystemValue('activity_expire_days', 365); $data = new \OCA\Activity\Data(\OC::$server->getActivityManager()); $data->expire($expireDays); }
/** * Send an email to {$limit} users * * @param int $limit Number of users we want to send an email to * @return int Number of users we sent an email to */ protected function runStep($limit) { // Get all users which should receive an email $affectedUsers = $this->mqHandler->getAffectedUsers($limit); if (empty($affectedUsers)) { // No users found to notify, mission abort return 0; } $preferences = new \OC\Preferences(\OC_DB::getConnection()); $userLanguages = $preferences->getValueForUsers('core', 'lang', $affectedUsers); $userEmails = $preferences->getValueForUsers('settings', 'email', $affectedUsers); // Get all items for these users // We don't use time() but "time() - 1" here, so we don't run into // runtime issues and delete emails later, which were created in the // same second, but were not collected for the emails. $sendTime = time() - 1; $mailData = $this->mqHandler->getItemsForUsers($affectedUsers, $sendTime); // Send Email $default_lang = \OCP\Config::getSystemValue('default_language', 'en'); foreach ($mailData as $user => $data) { if (!isset($userEmails[$user])) { // The user did not setup an email address // So we will not send an email :( continue; } $language = isset($userLanguages[$user]) ? $userLanguages[$user] : $default_lang; $this->mqHandler->sendEmailToUser($user, $userEmails[$user], $language, $data); } // Delete all entries we dealt with $this->mqHandler->deleteSentItems($affectedUsers, $sendTime); return sizeof($affectedUsers); }
/** * {@inheritDoc} */ public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { $this->initCmd(); if (is_null($this->cmd)) { return false; } $absPath = $fileview->toTmpFile($path); $tmpDir = \OC::$server->getTempManager()->getTempBaseDir(); $defaultParameters = ' -env:UserInstallation=file://' . escapeshellarg($tmpDir . '/owncloud-' . \OC_Util::getInstanceId() . '/') . ' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to pdf --outdir '; $clParameters = \OCP\Config::getSystemValue('preview_office_cl_parameters', $defaultParameters); $exec = $this->cmd . $clParameters . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath); shell_exec($exec); //create imagick object from pdf $pdfPreview = null; try { list($dirname, , , $filename) = array_values(pathinfo($absPath)); $pdfPreview = $dirname . '/' . $filename . '.pdf'; $pdf = new \imagick($pdfPreview . '[0]'); $pdf->setImageFormat('jpg'); } catch (\Exception $e) { unlink($absPath); unlink($pdfPreview); \OCP\Util::writeLog('core', $e->getmessage(), \OCP\Util::ERROR); return false; } $image = new \OC_Image(); $image->loadFromData($pdf); unlink($absPath); unlink($pdfPreview); if ($image->valid()) { $image->scaleDownToFit($maxX, $maxY); return $image; } return false; }
public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { $this->initCmd(); if (is_null($this->cmd)) { return false; } $absPath = $fileview->toTmpFile($path); $tmpDir = get_temp_dir(); $defaultParameters = ' --headless --nologo --nofirststartwizard --invisible --norestore -convert-to pdf -outdir '; $clParameters = \OCP\Config::getSystemValue('preview_office_cl_parameters', $defaultParameters); $exec = $this->cmd . $clParameters . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath); $export = 'export HOME=/' . $tmpDir; shell_exec($export . "\n" . $exec); //create imagick object from pdf try { $pdf = new \imagick($absPath . '.pdf' . '[0]'); $pdf->setImageFormat('jpg'); } catch (\Exception $e) { unlink($absPath); unlink($absPath . '.pdf'); \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); return false; } $image = new \OC_Image(); $image->loadFromData($pdf); unlink($absPath); unlink($absPath . '.pdf'); return $image->valid() ? $image : false; }
public function __construct($AppName, IRequest $Request, IL10N $L10N) { parent::__construct($AppName, $Request); if (strcmp(Config::getSystemValue('dbtype'), 'pgsql') == 0) { $this->DbType = 1; } $this->L10N = $L10N; $this->Settings = new Settings(); }
function thumb($path) { $thumb_path = \OCP\Config::getSystemValue('datadirectory') . '/' . \OC_User::getUser() . '/reader'; if (file_exists($thumb_path . $path)) { return new \OC_Image($thumb_path . $path); } if (!\OC\Files\Filesystem::file_exists($path)) { return false; } }
private function hostKeysPath() { try { $storage_view = \OCP\Files::getStorage('files_external'); if ($storage_view) { return \OCP\Config::getSystemValue('datadirectory') . $storage_view->getAbsolutePath('') . 'ssh_hostKeys'; } } catch (\Exception $e) { } return false; }
public function __construct($user = false, array $urlParams = array()) { parent::__construct(self::$appname, $urlParams); $container = $this->getContainer(); // Add the FBID field CardDavBackend::$indexProperties[] = 'FBID'; // Fix for userID if (!$user) { $this->user = \OCP\User::getUser(); } else { $this->user = $user; } /** * CardDavBackend */ $container->registerService('CardDavBackend', function (IContainer $c) { $db = $c->getServer()->getDatabaseConnection(); $dispatcher = $c->getServer()->getEventDispatcher(); $principal = new \OCA\DAV\Connector\Sabre\Principal($c->getServer()->getUserManager(), $c->getServer()->getGroupManager()); return new CardDavBackend($db, $principal, $dispatcher); }); /** * User home folder */ $container->registerService('userHome', function (IContainer $c) { $datadir = \OCP\Config::getSystemValue('datadirectory'); return $datadir . '/' . $this->user; }); /** * Controller */ $container->registerService('FacebookController', function (IContainer $c) { return new FacebookController($c->query('AppName'), $c->query('Request'), $c->query('OCP\\ICache'), $c->query('userHome')); }); /** * Contacts */ $container->registerService('Contacts', function (IContainer $c) { return new Contacts($c->query('FacebookController'), $c->query('CardDavBackend'), $this->user); }); /** * PageController */ $container->registerService('PageController', function (IContainer $c) { return new PageController($c->query('AppName'), $c->query('Request'), $c->query('Contacts'), $c->query('FacebookController')); }); /** * ContactsController */ $container->registerService('ContactsController', function (IContainer $c) { return new ContactsController($c->query('AppName'), $c->query('Request'), $c->query('Contacts')); }); }
/** * Clean already done migration requests, older than xxx days * @param OutputInterface $output */ protected function CleanRequests($output) { $cleanDelay = \OCP\Config::getSystemValue('ufr_clean_delay', 7); $datetime = new \DateTime(); $datetime->sub(new \dateInterval('P' . (int) $cleanDelay . 'D')); $datetime->setTime(23, 59, 59); try { $requests = $this->requestMapper->deleteBefore($datetime); } catch (\Exception $e) { $this->consoleDisplay('Server error: ' . $e->getMessage(), self::ERROR); } }
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; }
/** * Generate unique backup path * or return existing one * @return string */ public static function getPath() { if (!self::$path) { $backupBase = App::getBackupBase(); $currentVersion = \OCP\Config::getSystemValue('version', '0.0.0'); $path = $backupBase . $currentVersion . '-'; do { $salt = substr(md5(time()), 0, 8); } while (file_exists($path . $salt)); self::$path = $path . $salt; } return self::$path; }
/** * Do what's needed to get the image from storage * depending on the type. */ protected function processImage() { $localPath = \OCP\Config::getSystemValue('datadirectory') . '/' . $this->userId . '/avatar.'; if (file_exists($localPath . 'png')) { $localPath .= 'png'; } else { if (file_exists($localPath . 'jpg')) { $localPath .= 'jpg'; } } $this->image = new \OCP\Image(); $this->image->loadFromFile($localPath); }
/** * This method is called before any HTTP method and returns http status code 503 * in case the system is in maintenance mode. * * @throws \Sabre\DAV\Exception\ServiceUnavailable * @internal param string $method * @return bool */ public function checkMaintenanceMode() { if (\OCP\Config::getSystemValue('singleuser', false)) { throw new \Sabre\DAV\Exception\ServiceUnavailable(); } if (OC_Config::getValue('maintenance', false)) { throw new \Sabre\DAV\Exception\ServiceUnavailable(); } if (OC::checkUpgrade(false)) { throw new \Sabre\DAV\Exception\ServiceUnavailable('Upgrade needed'); } return true; }
public function __construct($AppName, IRequest $Request, $CurrentUID, IL10N $L10N) { parent::__construct($AppName, $Request); $this->CurrentUID = $CurrentUID; $this->L10N = $L10N; if (strcmp(Config::getSystemValue('dbtype'), 'pgsql') == 0) { $this->DbType = 1; } $this->CanCheckForUpdate = Tools::CanCheckForUpdate(); $this->Settings = new Settings(); $this->Settings->SetKey('WhichDownloader'); $this->WhichDownloader = $this->Settings->GetValue(); $this->WhichDownloader = is_null($this->WhichDownloader) ? 'ARIA2' : $this->WhichDownloader; }
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; }
protected function filterOld($pathArray) { $skip = array_values(Helper::getDirectories()); $skip[] = rtrim(App::getBackupBase(), '/'); $skip[] = \OCP\Config::getSystemValue("datadirectory", \OC::$SERVERROOT . "/data"); // Skip 3rdparty | apps | backup | datadir | config | themes foreach ($pathArray as $key => $path) { if ($path === 'config' || $path === 'themes') { unset($pathArray[$key]); } if (in_array($this->oldBase . '/' . $path, $skip)) { unset($pathArray[$key]); } } return $pathArray; }
private function init() { if ($this->ready) { return; } $this->ready = true; $settings = array('baseUri' => $this->createBaseUri(), 'userName' => $this->user, 'password' => $this->password); $this->client = new \Sabre_DAV_Client($settings); $caview = \OCP\Files::getStorage('files_external'); if ($caview) { $certPath = \OCP\Config::getSystemValue('datadirectory') . $caview->getAbsolutePath("") . 'rootcerts.crt'; if (file_exists($certPath)) { $this->client->addTrustedCertificates($certPath); } } }
/** * This function can't work properly. * You can't get the cache instance within the cron because no user is connected. * Possible solution: access the cache directly in the filesystem */ private function updateFriends() { $users = \OC::$server->getUserManager()->search(''); $cache = \OCP\ICacheFactory::create('test'); $datadir = \OCP\Config::getSystemValue('datadirectory'); \OCP\Util::writeLog('fbsync', "Cron launched: caching friends...", \OCP\Util::INFO); foreach ($users as $user) { $fbsync = new FacebookController('fbsync', $cache, $datadir . '/' . $user->getUID()); $friends = $fbsync->reload(); if (!$friends) { \OCP\Util::writeLog('fbsync', "Failed to update friends cache for user " . $user->getUID(), \OCP\Util::INFO); } else { \OCP\Util::writeLog('fbsync', count($friends) . " cached for user " . $user->getUID(), \OCP\Util::INFO); } } \OCP\Util::writeLog('fbsync', "Cron finished.", \OCP\Util::INFO); }
/** * @brief rename/move versions of renamed/moved files * @param array with oldpath and newpath * * This function is connected to the rename signal of OC_Filesystem and adjust the name and location * of the stored versions along the actual file */ public static function rename_hook($params) { $versions_fileview = \OCP\Files::getStorage('files_versions'); $rel_oldpath = $params['oldpath']; $abs_oldpath = \OCP\Config::getSystemValue('datadirectory') . $versions_fileview->getAbsolutePath('') . $rel_oldpath . '.v'; $abs_newpath = \OCP\Config::getSystemValue('datadirectory') . $versions_fileview->getAbsolutePath('') . $params['newpath'] . '.v'; if (Storage::isversioned($rel_oldpath)) { $info = pathinfo($abs_newpath); if (!file_exists($info['dirname'])) { mkdir($info['dirname'], 0750, true); } $versions = Storage::getVersions($rel_oldpath); foreach ($versions as $v) { rename($abs_oldpath . $v['version'], $abs_newpath . $v['version']); } } }
/** * send push notifications. Currently only pushover.net is supported * */ public static function send($subject, $url) { $app_key = \OCP\Config::getSystemValue('pushnotifications_pushover_app', ''); $pushid = trim(\OCP\Config::getUserValue(\OCP\User::getUser(), 'pushnotifications', 'pushid', '')); if (!empty($pushid)) { $push = new \Pushover(); $push->setToken($app_key); $push->setUser($pushid); $push->setMessage($subject); $push->setUrl($url); $push->setUrlTitle('ownCloud'); $push->setCallback($url); $push->setTimestamp(time()); $push->setDebug(true); $go = $push->send(); unset($push); } }
public function getFileData($path) { $gallery_path = \OCP\Config::getSystemValue('datadirectory') . '/' . \OC_User::getUser() . '/gallery'; $path = $gallery_path . $path; $dir = dirname($path); if (!isset($this->cache[$dir])) { $this->getPathData($dir); } if (isset($this->cache[$dir][$path])) { return $this->cache[$dir][$path]; } $image = new \OC_Image(); if (!$image->loadFromFile($path)) { return false; } $ret = $this->setFileData($path, $image->width(), $image->height()); unset($image); $this->cache[$dir][$path] = $ret; return $ret; }
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; }