• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP OCP\IConfig类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中OCP\IConfig的典型用法代码示例。如果您正苦于以下问题:PHP IConfig类的具体用法?PHP IConfig怎么用?PHP IConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了IConfig类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct(IConfig $config, ITimeFactory $timeFactory)
 {
     $this->timeFactory = $timeFactory;
     $this->retentionObligation = $config->getSystemValue('trashbin_retention_obligation', 'auto');
     if ($this->retentionObligation !== 'disabled') {
         $this->parseRetentionObligation();
     }
 }
开发者ID:evanjt,项目名称:core,代码行数:8,代码来源:expiration.php


示例2: run

 /**
  * Enables the files app if it is disabled
  */
 public function run()
 {
     if ($this->config->getAppValue('files', 'enabled', 'no') !== 'yes') {
         $this->config->setAppValue('files', 'enabled', 'yes');
         $this->emit('\\OC\\Repair', 'info', ['Files app was disabled - re-enabled']);
     }
 }
开发者ID:yheric455042,项目名称:owncloud82,代码行数:10,代码来源:enablefilesapp.php


示例3: index

 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  *
  * @return TemplateResponse
  */
 public function index()
 {
     $userId = $this->userSession->getUser()->getUID();
     $appVersion = $this->config->getAppValue($this->appName, 'installed_version');
     $defaultView = $this->config->getUserValue($userId, $this->appName, 'currentView', 'month');
     return new TemplateResponse('calendar', 'main', ['appVersion' => $appVersion, 'defaultView' => $defaultView]);
 }
开发者ID:dominicrico,项目名称:calendar-rework,代码行数:13,代码来源:viewcontroller.php


示例4: validateUserPass

 /**
  * Validates a username and password
  *
  * This method should return true or false depending on if login
  * succeeded.
  *
  * @param string $username
  * @param string $password
  *
  * @return bool
  */
 protected function validateUserPass($username, $password)
 {
     $linkItem = \OCP\Share::getShareByToken($username, false);
     \OC_User::setIncognitoMode(true);
     $this->share = $linkItem;
     if (!$linkItem) {
         return false;
     }
     // check if the share is password protected
     if (isset($linkItem['share_with'])) {
         if ($linkItem['share_type'] == \OCP\Share::SHARE_TYPE_LINK) {
             // Check Password
             $forcePortable = CRYPT_BLOWFISH != 1;
             $hasher = new \PasswordHash(8, $forcePortable);
             if (!$hasher->CheckPassword($password . $this->config->getSystemValue('passwordsalt', ''), $linkItem['share_with'])) {
                 return false;
             } else {
                 return true;
             }
         } else {
             return false;
         }
     } else {
         return true;
     }
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:37,代码来源:publicauth.php


示例5: run

 /**
  * @param $argument
  * @throws \Exception
  */
 protected function run($argument)
 {
     $maxAge = $this->expiration->getMaxAgeAsTimestamp();
     if (!$maxAge) {
         return;
     }
     $offset = $this->config->getAppValue('files_trashbin', 'cronjob_user_offset', 0);
     $users = $this->userManager->search('', self::USERS_PER_SESSION, $offset);
     if (!count($users)) {
         // No users found, reset offset and retry
         $offset = 0;
         $users = $this->userManager->search('', self::USERS_PER_SESSION);
     }
     $offset += self::USERS_PER_SESSION;
     $this->config->setAppValue('files_trashbin', 'cronjob_user_offset', $offset);
     foreach ($users as $user) {
         $uid = $user->getUID();
         if (!$this->setupFS($uid)) {
             continue;
         }
         $dirContent = Helper::getTrashFiles('/', $uid, 'mtime');
         Trashbin::deleteExpiredFiles($dirContent, $uid);
     }
     \OC_Util::tearDownFS();
 }
开发者ID:loulancn,项目名称:core,代码行数:29,代码来源:expiretrash.php


示例6: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $includeExpensive = $input->getOption('include-expensive');
     if ($includeExpensive) {
         foreach ($this->repair->getExpensiveRepairSteps() as $step) {
             $this->repair->addStep($step);
         }
     }
     $maintenanceMode = $this->config->getSystemValue('maintenance', false);
     $this->config->setSystemValue('maintenance', true);
     $this->repair->listen('\\OC\\Repair', 'step', function ($description) use($output) {
         $output->writeln(' - ' . $description);
     });
     $this->repair->listen('\\OC\\Repair', 'info', function ($description) use($output) {
         $output->writeln('     - ' . $description);
     });
     $this->repair->listen('\\OC\\Repair', 'warning', function ($description) use($output) {
         $output->writeln('     - WARNING: ' . $description);
     });
     $this->repair->listen('\\OC\\Repair', 'error', function ($description) use($output) {
         $output->writeln('     - ERROR: ' . $description);
     });
     $this->repair->run();
     $this->config->setSystemValue('maintenance', $maintenanceMode);
 }
开发者ID:kenwi,项目名称:core,代码行数:25,代码来源:repair.php


示例7: createKey

 /**
  * Generate a keypair
  *
  * @return array ['privatekey' => $privateKey, 'publickey' => $publicKey]
  */
 public function createKey()
 {
     $rsa = new RSACrypt();
     $rsa->setPublicKeyFormat(RSACrypt::PUBLIC_FORMAT_OPENSSH);
     $rsa->setPassword($this->config->getSystemValue('secret', ''));
     return $rsa->createKey(self::CREATE_KEY_BITS);
 }
开发者ID:farukuzun,项目名称:core-1,代码行数:12,代码来源:rsa.php


示例8: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $importFile = $input->getArgument('file');
     if ($importFile !== null) {
         $content = $this->getArrayFromFile($importFile);
     } else {
         $content = $this->getArrayFromStdin();
     }
     try {
         $configs = $this->validateFileContent($content);
     } catch (\UnexpectedValueException $e) {
         $output->writeln('<error>' . $e->getMessage() . '</error>');
         return;
     }
     if (!empty($configs['system'])) {
         $this->config->setSystemValues($configs['system']);
     }
     if (!empty($configs['apps'])) {
         foreach ($configs['apps'] as $app => $appConfigs) {
             foreach ($appConfigs as $key => $value) {
                 if ($value === null) {
                     $this->config->deleteAppValue($app, $key);
                 } else {
                     $this->config->setAppValue($app, $key, $value);
                 }
             }
         }
     }
     $output->writeln('<info>Config successfully imported from: ' . $importFile . '</info>');
 }
开发者ID:evanjt,项目名称:core,代码行数:30,代码来源:import.php


示例9: testSetException

 public function testSetException()
 {
     $this->config->expects($this->once())->method('setUserValue')->with('JohnDoe', 'contacts', 'keyValue', 'valueValue')->will($this->throwException(new \Exception()));
     $expected = new JSONResponse();
     $expected->setStatus(Http::STATUS_INTERNAL_SERVER_ERROR);
     $this->assertEquals($expected, $this->controller->set('keyValue', 'valueValue'));
 }
开发者ID:HomeThings,项目名称:contacts,代码行数:7,代码来源:SettingsControllerTest.php


示例10: format

 /**
  * @param IEvent $event
  * @param string $parameter The parameter to be formatted
  * @param bool $allowHtml   Should HTML be used to format the parameter?
  * @param bool $verbose     Should paths, names, etc be shortened or full length
  * @return string The formatted parameter
  */
 public function format(IEvent $event, $parameter, $allowHtml, $verbose = false)
 {
     // If the username is empty, the action has been performed by a remote
     // user, or via a public share. We don't know the username in that case
     if ($parameter === '') {
         if ($allowHtml === null) {
             return '<user display-name="' . Util::sanitizeHTML($this->l->t('"remote user"')) . '">' . Util::sanitizeHTML('') . '</user>';
         }
         if ($allowHtml) {
             return '<strong>' . $this->l->t('"remote user"') . '</strong>';
         } else {
             return $this->l->t('"remote user"');
         }
     }
     $user = $this->manager->get($parameter);
     $displayName = $user ? $user->getDisplayName() : $parameter;
     $parameter = Util::sanitizeHTML($parameter);
     if ($allowHtml === null) {
         return '<user display-name="' . Util::sanitizeHTML($displayName) . '">' . Util::sanitizeHTML($parameter) . '</user>';
     }
     if ($allowHtml) {
         $avatarPlaceholder = '';
         if ($this->config->getSystemValue('enable_avatars', true)) {
             $avatarPlaceholder = '<div class="avatar" data-user="' . $parameter . '"></div>';
         }
         return $avatarPlaceholder . '<strong>' . Util::sanitizeHTML($displayName) . '</strong>';
     } else {
         return $displayName;
     }
 }
开发者ID:ynott,项目名称:activity,代码行数:37,代码来源:userformatter.php


示例11: deleteAppValue

 /**
  * @param array $parameters
  * @return \OC_OCS_Result
  */
 public function deleteAppValue($parameters)
 {
     $app = $parameters['appid'];
     $configKey = $parameters['configkey'];
     $this->config->deleteAppValue($app, $configKey);
     return new \OC_OCS_Result();
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:11,代码来源:Config.php


示例12: show

 /**
  * @PublicPage
  * @NoCSRFRequired
  *
  * @return TemplateResponse
  */
 public function show()
 {
     try {
         $user = $this->activityManager->getCurrentUserId();
         $userLang = $this->config->getUserValue($user, 'core', 'lang');
         // Overwrite user and language in the helper
         $l = Util::getL10N('activity', $userLang);
         $l->forceLanguage($userLang);
         $this->helper->setL10n($l);
         $this->helper->setUser($user);
         $description = (string) $l->t('Personal activity feed for %s', $user);
         $activities = $this->data->read($this->helper, $this->settings, 0, self::DEFAULT_PAGE_SIZE, 'all', $user);
     } catch (\UnexpectedValueException $e) {
         $l = Util::getL10N('activity');
         $description = (string) $l->t('Your feed URL is invalid');
         $activities = [['activity_id' => -1, 'timestamp' => time(), 'subject' => true, 'subjectformatted' => ['full' => $description]]];
     }
     $response = new TemplateResponse('activity', 'rss', ['rssLang' => $l->getLanguageCode(), 'rssLink' => $this->urlGenerator->linkToRouteAbsolute('activity.Feed.show'), 'rssPubDate' => date('r'), 'description' => $description, 'activities' => $activities], '');
     if ($this->request->getHeader('accept') !== null && stristr($this->request->getHeader('accept'), 'application/rss+xml')) {
         $response->addHeader('Content-Type', 'application/rss+xml');
     } else {
         $response->addHeader('Content-Type', 'text/xml; charset=UTF-8');
     }
     return $response;
 }
开发者ID:samj1912,项目名称:repo,代码行数:31,代码来源:feed.php


示例13: linkTo

 /**
  * Creates an url
  * @param string $app app
  * @param string $file file
  * @param array $args array with param=>value, will be appended to the returned url
  *    The value of $args will be urlencoded
  * @return string the url
  *
  * Returns a url to the given app and file.
  */
 public function linkTo($app, $file, $args = array())
 {
     $frontControllerActive = $this->config->getSystemValue('front_controller_active', 'false') == 'true';
     if ($app != '') {
         $app_path = \OC_App::getAppPath($app);
         // Check if the app is in the app folder
         if ($app_path && file_exists($app_path . '/' . $file)) {
             if (substr($file, -3) == 'php') {
                 $urlLinkTo = \OC::$WEBROOT . '/index.php/apps/' . $app;
                 if ($frontControllerActive) {
                     $urlLinkTo = \OC::$WEBROOT . '/apps/' . $app;
                 }
                 $urlLinkTo .= $file != 'index.php' ? '/' . $file : '';
             } else {
                 $urlLinkTo = \OC_App::getAppWebPath($app) . '/' . $file;
             }
         } else {
             $urlLinkTo = \OC::$WEBROOT . '/' . $app . '/' . $file;
         }
     } else {
         if (file_exists(\OC::$SERVERROOT . '/core/' . $file)) {
             $urlLinkTo = \OC::$WEBROOT . '/core/' . $file;
         } else {
             if ($frontControllerActive && $file === 'index.php') {
                 $urlLinkTo = \OC::$WEBROOT;
             } else {
                 $urlLinkTo = \OC::$WEBROOT . '/' . $file;
             }
         }
     }
     if ($args && ($query = http_build_query($args, '', '&'))) {
         $urlLinkTo .= '?' . $query;
     }
     return $urlLinkTo;
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:45,代码来源:urlgenerator.php


示例14: upgrade

 public function upgrade()
 {
     $previousVersion = $this->config->getAppValue($this->appName, 'installed_version');
     if (version_compare($previousVersion, '7', '<')) {
         $this->itemService->generateSearchIndices();
     }
 }
开发者ID:cs-team,项目名称:news,代码行数:7,代码来源:upgrade.php


示例15: runStep

 /**
  * Send an email to {$limit} users
  *
  * @param int $limit Number of users we want to send an email to
  * @param int $sendTime The latest send time
  * @return int Number of users we sent an email to
  */
 protected function runStep($limit, $sendTime)
 {
     // Get all users which should receive an email
     $affectedUsers = $this->mqHandler->getAffectedUsers($limit, $sendTime);
     if (empty($affectedUsers)) {
         // No users found to notify, mission abort
         return 0;
     }
     $userLanguages = $this->config->getUserValueForUsers('core', 'lang', $affectedUsers);
     $userTimezones = $this->config->getUserValueForUsers('core', 'timezone', $affectedUsers);
     $userEmails = $this->config->getUserValueForUsers('settings', 'email', $affectedUsers);
     // Send Email
     $default_lang = $this->config->getSystemValue('default_language', 'en');
     $defaultTimeZone = date_default_timezone_get();
     foreach ($affectedUsers as $user) {
         if (empty($userEmails[$user])) {
             // The user did not setup an email address
             // So we will not send an email :(
             $this->logger->debug("Couldn't send notification email to user '" . $user . "' (email address isn't set for that user)", ['app' => 'activity']);
             continue;
         }
         $language = !empty($userLanguages[$user]) ? $userLanguages[$user] : $default_lang;
         $timezone = !empty($userTimezones[$user]) ? $userTimezones[$user] : $defaultTimeZone;
         $this->mqHandler->sendEmailToUser($user, $userEmails[$user], $language, $timezone, $sendTime);
     }
     // Delete all entries we dealt with
     $this->mqHandler->deleteSentItems($affectedUsers, $sendTime);
     return sizeof($affectedUsers);
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:36,代码来源:emailnotification.php


示例16: loadCommands

 /**
  * @param OutputInterface $output
  */
 public function loadCommands(OutputInterface $output)
 {
     // $application is required to be defined in the register_command scripts
     $application = $this->application;
     require_once \OC::$SERVERROOT . '/core/register_command.php';
     if ($this->config->getSystemValue('installed', false)) {
         if (!\OCP\Util::needUpgrade()) {
             OC_App::loadApps();
             foreach (OC_App::getAllApps() as $app) {
                 $file = OC_App::getAppPath($app) . '/appinfo/register_command.php';
                 if (file_exists($file)) {
                     require $file;
                 }
             }
         } else {
             $output->writeln("ownCloud or one of the apps require upgrade - only a limited number of commands are available");
         }
     } else {
         $output->writeln("ownCloud is not installed - only a limited number of commands are available");
     }
     $input = new ArgvInput();
     if ($input->getFirstArgument() !== 'check') {
         $errors = \OC_Util::checkServer(\OC::$server->getConfig());
         if (!empty($errors)) {
             foreach ($errors as $error) {
                 $output->writeln($error['error']);
                 $output->writeln($error['hint']);
                 $output->writeln('');
             }
             throw new \Exception("Environment not properly prepared.");
         }
     }
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:36,代码来源:application.php


示例17: listCertificates

 /**
  * Returns all certificates trusted by the user
  *
  * @return \OCP\ICertificate[]
  */
 public function listCertificates()
 {
     if (!$this->config->getSystemValue('installed', false)) {
         return array();
     }
     $path = $this->getPathToCertificates() . 'uploads/';
     if (!$this->view->is_dir($path)) {
         return array();
     }
     $result = array();
     $handle = $this->view->opendir($path);
     if (!is_resource($handle)) {
         return array();
     }
     while (false !== ($file = readdir($handle))) {
         if ($file != '.' && $file != '..') {
             try {
                 $result[] = new Certificate($this->view->file_get_contents($path . $file), $file);
             } catch (\Exception $e) {
             }
         }
     }
     closedir($handle);
     return $result;
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:30,代码来源:CertificateManager.php


示例18: 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)
 {
     // We don't use time() but "time() - 1" here, so we don't run into
     // runtime issues later and delete emails, which were created in the
     // same second, but were not collected for the emails.
     $sendTime = time() - 1;
     // Get all users which should receive an email
     $affectedUsers = $this->mqHandler->getAffectedUsers($limit, $sendTime);
     if (empty($affectedUsers)) {
         // No users found to notify, mission abort
         return 0;
     }
     $userLanguages = $this->config->getUserValueForUsers('core', 'lang', $affectedUsers);
     $userTimezones = $this->config->getUserValueForUsers('core', 'timezone', $affectedUsers);
     $userEmails = $this->config->getUserValueForUsers('settings', 'email', $affectedUsers);
     // Get all items for these users
     $mailData = $this->mqHandler->getItemsForUsers($affectedUsers, $sendTime);
     // Send Email
     $default_lang = $this->config->getSystemValue('default_language', 'en');
     $defaultTimeZone = date_default_timezone_get();
     foreach ($mailData as $user => $data) {
         if (empty($userEmails[$user])) {
             // The user did not setup an email address
             // So we will not send an email :(
             $this->logger->debug("Couldn't send notification email to user '" . $user . "' (email address isn't set for that user)", ['app' => 'activity']);
             continue;
         }
         $language = !empty($userLanguages[$user]) ? $userLanguages[$user] : $default_lang;
         $timezone = !empty($userTimezones[$user]) ? $userTimezones[$user] : $defaultTimeZone;
         $this->mqHandler->sendEmailToUser($user, $userEmails[$user], $language, $timezone, $data);
     }
     // Delete all entries we dealt with
     $this->mqHandler->deleteSentItems($affectedUsers, $sendTime);
     return sizeof($affectedUsers);
 }
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:41,代码来源:emailnotification.php


示例19: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if ($this->config->getAppValue('core', 'encryption_enabled', 'no') === 'yes') {
         $output->writeln('Encryption is already enabled');
     } else {
         $this->config->setAppValue('core', 'encryption_enabled', 'yes');
         $output->writeln('<info>Encryption enabled</info>');
     }
     $output->writeln('');
     $modules = $this->encryptionManager->getEncryptionModules();
     if (empty($modules)) {
         $output->writeln('<error>No encryption module is loaded</error>');
     } else {
         $defaultModule = $this->config->getAppValue('core', 'default_encryption_module', null);
         if ($defaultModule === null) {
             $output->writeln('<error>No default module is set</error>');
         } else {
             if (!isset($modules[$defaultModule])) {
                 $output->writeln('<error>The current default module does not exist: ' . $defaultModule . '</error>');
             } else {
                 $output->writeln('Default module: ' . $defaultModule);
             }
         }
     }
 }
开发者ID:kenwi,项目名称:core,代码行数:25,代码来源:enable.php


示例20: trustedDomains

 /**
  * Add a new trusted domain
  * @param string $newTrustedDomain The newly to add trusted domain
  * @return array
  */
 public function trustedDomains($newTrustedDomain)
 {
     $trustedDomains = $this->config->getSystemValue('trusted_domains');
     $trustedDomains[] = $newTrustedDomain;
     $this->config->setSystemValue('trusted_domains', $trustedDomains);
     return $this->returnSuccess();
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:12,代码来源:SecuritySettingsController.php



注:本文中的OCP\IConfig类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP OCP\IDBConnection类代码示例发布时间:2022-05-23
下一篇:
PHP OCP\Files类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap