本文整理汇总了PHP中OCP\Config类的典型用法代码示例。如果您正苦于以下问题:PHP Config类的具体用法?PHP Config怎么用?PHP Config使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Config类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: set
/**
* @NoAdminRequired
*/
public function set()
{
\OCP\Config::setUserValue($this->api->getUserId(), 'tasks_enhanced', $this->params('type') . '_' . $this->params('setting'), $this->params('value'));
$response = new JSONResponse();
$response->setData();
return $response;
}
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:10,代码来源:settingscontroller.php
示例2: getGroups
/**
* @NoAdminRequired
*/
public function getGroups() {
$tags = $this->tags->getTags();
foreach ($tags as &$tag) {
try {
$ids = $this->tags->getIdsForTag($tag['id']);
$tag['contacts'] = $ids;
$tag['displayname'] = $this->displayName($tag);
} catch(\Exception $e) {
\OCP\Util::writeLog('contacts', __METHOD__ . ', ' . $e->getMessage(), \OCP\Util::ERROR);
}
}
$favorites = $this->tags->getFavorites();
$shares = \OCP\Share::getItemsSharedWith('addressbook', \OCA\Contacts\Share\Addressbook::FORMAT_ADDRESSBOOKS);
$addressbookShare = new \OCA\Contacts\Share\Addressbook();
foreach ($shares as $key => $share) {
$children = $addressbookShare->getChildren($share['id']); // FIXME: This should be cheaper!
$shares[$key]['length'] = count($children);
}
$groups = array(
'categories' => $tags,
'favorites' => $favorites,
'shared' => $shares,
'lastgroup' => \OCP\Config::getUserValue(\OCP\User::getUser(), 'contacts', 'lastgroup', 'all'),
'sortorder' => \OCP\Config::getUserValue(\OCP\User::getUser(), 'contacts', 'groupsort', ''),
);
return new JSONResponse($groups);
}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:35,代码来源:groupcontroller.php
示例3: getShortFooter
public function getShortFooter()
{
$baseUrl = "<a href=\"" . $this->getBaseUrl() . "\" target=\"_blank\">" . $this->getEntity() . "</a>";
$slogan = $this->getSlogan();
// === GTU
$cguUrl = '';
if (OC_APP::isEnabled('gtu')) {
$cguUrl = \OCP\Config::getAppvalue('gtu', 'url', '');
}
if (empty($cguUrl)) {
$cguUrl = \OCP\Config::getSystemvalue('custom_termsofserviceurl', '');
}
$cgu = '';
if (!empty($cguUrl)) {
$cgu = '<a href="' . $cguUrl . '" target="_blank">CGU</a>';
}
// === Help
$helpUrl = '';
if (empty($helpUrl)) {
$helpUrl = $this->getHelpUrl();
}
$help = '';
if (!empty($helpUrl)) {
$help = '<a href="' . $helpUrl . '" target="_blank">Aide</a>';
}
// === contact
$contact = ' – ' . '<a href="http://ods.cnrs.fr/contacts.html" target="_blank">Contacts</a>';
// =========================
$footer = $baseUrl . ' – ' . $slogan . ' – ' . $cgu . ' – ' . $help . $contact;
return $footer;
}
开发者ID:Victor-Bordage-Gorry,项目名称:mycore,代码行数:31,代码来源:defaults.php
示例4: __construct
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;
}
开发者ID:samosito,项目名称:ocdownloader,代码行数:31,代码来源:ftpdownloader.php
示例5: getThumbnail
/**
* {@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;
}
开发者ID:loulancn,项目名称:core,代码行数:38,代码来源:office.php
示例6: __construct
public function __construct($Table = 'admin')
{
if (strcmp(Config::getSystemValue('dbtype'), 'pgsql') == 0) {
$this->DbType = 1;
}
$this->Table = $Table;
}
开发者ID:venjek,项目名称:ocdownloader,代码行数:7,代码来源:settings.php
示例7: deleteUser_hook
/**
* @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);
}
}
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:14,代码来源:hooks.php
示例8: getThumbnail
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;
}
开发者ID:olucao,项目名称:owncloud-core,代码行数:29,代码来源:office-cl.php
示例9: runStep
/**
* 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);
}
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:38,代码来源:emailnotification.php
示例10: scan
protected function scan($fileView, $filepath)
{
$this->status = new Status();
if ($this->useSocket) {
$av_socket = \OCP\Config::getAppValue('files_antivirus', 'av_socket', '');
$shandler = stream_socket_client('unix://' . $av_socket, $errno, $errstr, 5);
if (!$shandler) {
throw new \RuntimeException('Cannot connect to "' . $av_socket . '": ' . $errstr . ' (code ' . $errno . ')');
}
} else {
$av_host = \OCP\Config::getAppValue('files_antivirus', 'av_host', '');
$av_port = \OCP\Config::getAppValue('files_antivirus', 'av_port', '');
$shandler = $av_host && $av_port ? @fsockopen($av_host, $av_port) : false;
if (!$shandler) {
throw new \RuntimeException('The clamav module is not configured for daemon mode.');
}
}
$fhandler = $this->getFileHandle($fileView, $filepath);
\OCP\Util::writeLog('files_antivirus', 'Exec scan: ' . $filepath, \OCP\Util::DEBUG);
// request scan from the daemon
fwrite($shandler, "nINSTREAM\n");
while (!feof($fhandler)) {
$chunk = fread($fhandler, $this->chunkSize);
$chunk_len = pack('N', strlen($chunk));
fwrite($shandler, $chunk_len . $chunk);
}
fwrite($shandler, pack('N', 0));
$response = fgets($shandler);
\OCP\Util::writeLog('files_antivirus', 'Response :: ' . $response, \OCP\Util::DEBUG);
fclose($shandler);
fclose($fhandler);
$this->status->parseResponse($response);
return $this->status->getNumericStatus();
}
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:34,代码来源:external.php
示例11: __construct
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;
}
开发者ID:venjek,项目名称:ocdownloader,代码行数:26,代码来源:index.php
示例12: getSites
public static function getSites()
{
if (($sites = json_decode(\OCP\Config::getAppValue("external", "sites", ''))) != null) {
return $sites;
}
return array();
}
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:7,代码来源:external.php
示例13: __construct
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('');
}
开发者ID:noci2012,项目名称:owncloud,代码行数:33,代码来源:webdav.php
示例14: __construct
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);
}
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:7,代码来源:scanner.php
示例15: write_hook
/**
* 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='" . $user . "', path='" . $path . "' matched to '" . $pat . "', excluding!", \OCP\Util::INFO);
$excluded = true;
break;
}
}
unset($pat);
}
if ($excluded) {
return;
}
if ($path != '') {
Storage::store($path);
}
}
}
开发者ID:mnefedov,项目名称:core,代码行数:30,代码来源:hooks.php
示例16: Load
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;
}
}
开发者ID:samosito,项目名称:ocdownloader,代码行数:31,代码来源:api.php
示例17: run
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);
}
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:7,代码来源:expireactivities.php
示例18: scan
public static function scan($id, $path, $storage)
{
$file = $storage->getLocalFile($path);
$result = OC_Files_Antivirus::clamav_scan($file);
switch ($result) {
case CLAMAV_SCANRESULT_UNCHECKED:
\OCP\Util::writeLog('files_antivirus', 'File "' . $path . '" from user "' . $user . '": is not checked', \OCP\Util::ERROR);
break;
case CLAMAV_SCANRESULT_INFECTED:
$infected_action = \OCP\Config::getAppValue('files_antivirus', 'infected_action', 'only_log');
if ($infected_action == 'delete') {
\OCP\Util::writeLog('files_antivirus', 'File "' . $path . '" from user "' . $user . '": is infected, file deleted', \OCP\Util::ERROR);
unlink($file);
} else {
\OCP\Util::writeLog('files_antivirus', 'File "' . $path . '" from user "' . $user . '": is infected', \OCP\Util::ERROR);
}
break;
case CLAMAV_SCANRESULT_CLEAN:
$stmt = OCP\DB::prepare('INSERT INTO `*PREFIX*files_antivirus` (`fileid`, `check_time`) VALUES (?, ?)');
try {
$result = $stmt->execute(array($id, time()));
if (\OC_DB::isError($result)) {
\OC_Log::write('files_antivirus', __METHOD__ . ', DB error: ' . \OC_DB::getErrorMessage($result), \OCP\Util::ERROR);
return;
}
} catch (\Exception $e) {
\OCP\Util::writeLog('files_antivirus', __METHOD__ . ', exception: ' . $e->getMessage(), \OCP\Util::ERROR);
}
break;
}
}
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:31,代码来源:scanner.php
示例19: testSetGetShareFolder
/**
* test set and get share folder
*/
function testSetGetShareFolder()
{
$this->assertSame('/', \OCA\Files_Sharing\Helper::getShareFolder());
\OCA\Files_Sharing\Helper::setShareFolder('/Shared');
$this->assertSame('/Shared', \OCA\Files_Sharing\Helper::getShareFolder());
// cleanup
\OCP\Config::deleteSystemValue('share_folder');
}
开发者ID:Romua1d,项目名称:core,代码行数:11,代码来源:helper.php
示例20: testSetAppValueIfSetToNull
public function testSetAppValueIfSetToNull()
{
$key = $this->getUniqueID('key-');
$result = \OCP\Config::setAppValue('unit-test', $key, null);
$this->assertTrue($result);
$result = \OCP\Config::setAppValue('unit-test', $key, '12');
$this->assertTrue($result);
}
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:8,代码来源:OCPConfigTest.php
注:本文中的OCP\Config类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论