当前位置: 首页>>代码示例>>PHP>>正文


PHP IConfig::getUserValue方法代码示例

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


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

示例1: 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

示例2: 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

示例3: getUserSetting

 /**
  * Get a setting for a user
  *
  * Falls back to some good default values if the user does not have a preference
  *
  * @param string $user
  * @param string $method Should be one of 'stream', 'email' or 'setting'
  * @param string $type One of the activity types, 'batchtime' or 'self'
  * @return bool|int
  */
 public function getUserSetting($user, $method, $type)
 {
     $defaultSetting = $this->getDefaultSetting($method, $type);
     if (is_bool($defaultSetting)) {
         return (bool) $this->config->getUserValue($user, 'activity', 'notify_' . $method . '_' . $type, $defaultSetting);
     } else {
         return (int) $this->config->getUserValue($user, 'activity', 'notify_' . $method . '_' . $type, $defaultSetting);
     }
 }
开发者ID:drognisep,项目名称:Portfolio-Site,代码行数:19,代码来源:UserSettings.php

示例4: sendInternalShareMail

 /**
  * inform users if a file was shared with them
  *
  * @param array $recipientList list of recipients
  * @param string $itemSource shared item source
  * @param string $itemType shared item type
  * @return array list of user to whom the mail send operation failed
  */
 public function sendInternalShareMail($recipientList, $itemSource, $itemType)
 {
     $noMail = [];
     foreach ($recipientList as $recipient) {
         $recipientDisplayName = \OCP\User::getDisplayName($recipient);
         $to = $this->config->getUserValue($recipient, 'settings', 'email', '');
         if ($to === '') {
             $noMail[] = $recipientDisplayName;
             continue;
         }
         $items = \OCP\Share::getItemSharedWithUser($itemType, $itemSource, $recipient);
         $filename = trim($items[0]['file_target'], '/');
         $subject = (string) $this->l->t('%s shared »%s« with you', array($this->senderDisplayName, $filename));
         $expiration = null;
         if (isset($items[0]['expiration'])) {
             try {
                 $date = new DateTime($items[0]['expiration']);
                 $expiration = $date->getTimestamp();
             } catch (\Exception $e) {
                 $this->logger->error("Couldn't read date: " . $e->getMessage(), ['app' => 'sharing']);
             }
         }
         // Link to folder, or root folder if a file
         if ($itemType === 'folder') {
             $args = array('dir' => $filename);
         } else {
             if (strpos($filename, '/')) {
                 $args = array('dir' => '/' . dirname($filename), 'scrollto' => basename($filename));
             } else {
                 $args = array('dir' => '/', 'scrollto' => $filename);
             }
         }
         $link = \OCP\Util::linkToAbsolute('files', 'index.php', $args);
         list($htmlBody, $textBody) = $this->createMailBody($filename, $link, $expiration);
         // send it out now
         try {
             $message = $this->mailer->createMessage();
             $message->setSubject($subject);
             $message->setTo([$to => $recipientDisplayName]);
             $message->setHtmlBody($htmlBody);
             $message->setPlainBody($textBody);
             $message->setFrom([\OCP\Util::getDefaultEmailAddress('sharing-noreply') => (string) $this->l->t('%s via %s', [$this->senderDisplayName, $this->defaults->getName()])]);
             if (!is_null($this->replyTo)) {
                 $message->setReplyTo([$this->replyTo]);
             }
             $this->mailer->send($message);
         } catch (\Exception $e) {
             $this->logger->error("Can't send mail to inform the user about an internal share: " . $e->getMessage(), ['app' => 'sharing']);
             $noMail[] = $recipientDisplayName;
         }
     }
     return $noMail;
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:61,代码来源:mailnotifications.php

示例5: getDirtyShares

 /**
  * Get all shares we need to update the etag for
  *
  * @param array $shares the shares for the users
  * @return string[]
  */
 protected function getDirtyShares($shares)
 {
     $dirty = [];
     $userTime = $this->config->getUserValue($this->userId, 'files_sharing', 'last_propagate', 0);
     foreach ($shares as $share) {
         $updateTime = $this->config->getAppValue('files_sharing', $share['id'], 0);
         if ($updateTime >= $userTime) {
             $dirty[] = $share;
         }
     }
     return $dirty;
 }
开发者ID:brunomilet,项目名称:owncloud-core,代码行数:18,代码来源:recipientpropagator.php

示例6: getPrincipalByPath

 /**
  * Returns a specific principal, specified by it's path.
  * The returned structure should be the exact same as from
  * getPrincipalsByPrefix.
  *
  * @param string $path
  * @return array
  */
 public function getPrincipalByPath($path)
 {
     list($prefix, $name) = explode('/', $path);
     $user = $this->userManager->get($name);
     if ($prefix === 'principals' && !is_null($user)) {
         $principal = ['uri' => 'principals/' . $user->getUID(), '{DAV:}displayname' => $user->getUID()];
         $email = $this->config->getUserValue($user->getUID(), 'settings', 'email');
         if ($email) {
             $principal['{http://sabredav.org/ns}email-address'] = $email;
         }
         return $principal;
     }
     return null;
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:22,代码来源:principal.php

示例7: __construct

 /**
  * @param string $uid
  * @param \OC_User_Interface $backend
  * @param \OC\Hooks\Emitter $emitter
  * @param \OCP\IConfig $config
  */
 public function __construct($uid, $backend, $emitter = null, IConfig $config = null)
 {
     $this->uid = $uid;
     $this->backend = $backend;
     $this->emitter = $emitter;
     $this->config = $config;
     if ($this->config) {
         $enabled = $this->config->getUserValue($uid, 'core', 'enabled', 'true');
         $this->enabled = $enabled === 'true';
         $this->lastLogin = $this->config->getUserValue($uid, 'login', 'lastLogin', 0);
     } else {
         $this->enabled = true;
         $this->lastLogin = \OC::$server->getConfig()->getUserValue($uid, 'login', 'lastLogin', 0);
     }
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:21,代码来源:user.php

示例8: getDirtyMountPoints

 /**
  * Get all mountpoints we need to update the etag for
  *
  * @return string[]
  */
 protected function getDirtyMountPoints()
 {
     $dirty = array();
     $mountPoints = $this->config->getAppKeys('files_external');
     foreach ($mountPoints as $mountPoint) {
         if (substr($mountPoint, 0, 1) === '/') {
             $updateTime = $this->config->getAppValue('files_external', $mountPoint);
             $userTime = $this->config->getUserValue($this->user->getUID(), 'files_external', $mountPoint);
             if ($updateTime > $userTime) {
                 $dirty[] = $mountPoint;
             }
         }
     }
     return $dirty;
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:20,代码来源:etagpropagator.php

示例9: index

 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  *
  * @return TemplateResponse
  */
 public function index()
 {
     $lastViewedNote = (int) $this->settings->getUserValue($this->userId, $this->appName, 'notesLastViewedNote');
     // check if note exists
     try {
         $this->notesService->get($lastViewedNote, $this->userId);
     } catch (NoteDoesNotExistException $ex) {
         $lastViewedNote = 0;
     }
     $response = new TemplateResponse($this->appName, 'main', ['lastViewedNote' => $lastViewedNote]);
     $csp = new ContentSecurityPolicy();
     $csp->addAllowedImageDomain('*');
     $response->setContentSecurityPolicy($csp);
     return $response;
 }
开发者ID:cg19910712,项目名称:notes,代码行数:21,代码来源:pagecontroller.php

示例10: formatUserForIndex

 /**
  * @param IUser $user
  * @param array $userGroups
  * @return array
  */
 private function formatUserForIndex(IUser $user, array $userGroups = null)
 {
     // TODO: eliminate this encryption specific code below and somehow
     // hook in additional user info from other apps
     // recovery isn't possible if admin or user has it disabled and encryption
     // is enabled - so we eliminate the else paths in the conditional tree
     // below
     $restorePossible = false;
     if ($this->isEncryptionAppEnabled) {
         if ($this->isRestoreEnabled) {
             // check for the users recovery setting
             $recoveryMode = $this->config->getUserValue($user->getUID(), 'encryption', 'recoveryEnabled', '0');
             // method call inside empty is possible with PHP 5.5+
             $recoveryModeEnabled = !empty($recoveryMode);
             if ($recoveryModeEnabled) {
                 // user also has recovery mode enabled
                 $restorePossible = true;
             }
         }
     } else {
         // recovery is possible if encryption is disabled (plain files are
         // available)
         $restorePossible = true;
     }
     $subAdminGroups = $this->groupManager->getSubAdmin()->getSubAdminsGroups($user);
     foreach ($subAdminGroups as $key => $subAdminGroup) {
         $subAdminGroups[$key] = $subAdminGroup->getGID();
     }
     return ['name' => $user->getUID(), 'displayname' => $user->getDisplayName(), 'groups' => empty($userGroups) ? $this->groupManager->getUserGroupIds($user) : $userGroups, 'subadmin' => $subAdminGroups, 'quota' => $this->config->getUserValue($user->getUID(), 'files', 'quota', 'default'), 'storageLocation' => $user->getHome(), 'lastLogin' => $user->getLastLogin() * 1000, 'backend' => $user->getBackendClassName(), 'email' => $this->config->getUserValue($user->getUID(), 'settings', 'email', ''), 'isRestoreDisabled' => !$restorePossible];
 }
开发者ID:evanjt,项目名称:core,代码行数:35,代码来源:userscontroller.php

示例11: 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
         $this->l = $this->l10nFactory->get('activity', $userLang);
         $parser = new PlainTextParser($this->l);
         $this->helper->setL10n($this->l);
         $this->helper->setUser($user);
         $description = (string) $this->l->t('Personal activity feed for %s', $user);
         $response = $this->data->get($this->helper, $this->settings, $user, 0, self::DEFAULT_PAGE_SIZE, 'desc', 'all');
         $data = $response['data'];
         $activities = [];
         foreach ($data as $activity) {
             $activity['subject_prepared'] = $parser->parseMessage($activity['subject_prepared']);
             $activity['message_prepared'] = $parser->parseMessage($activity['message_prepared']);
             $activities[] = $activity;
         }
     } catch (\UnexpectedValueException $e) {
         $this->l = $this->l10nFactory->get('activity');
         $description = (string) $this->l->t('Your feed URL is invalid');
         $activities = [['activity_id' => -1, 'timestamp' => time(), 'subject' => true, 'subject_prepared' => $description]];
     }
     $response = new TemplateResponse('activity', 'rss', ['rssLang' => $this->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:drognisep,项目名称:Portfolio-Site,代码行数:38,代码来源:Feed.php

示例12: getMultiBucketObjectStoreConfig

 /**
  * @param IUser $user
  * @return array|null
  */
 private function getMultiBucketObjectStoreConfig(IUser $user)
 {
     $config = $this->config->getSystemValue('objectstore_multibucket');
     if (!is_array($config)) {
         return null;
     }
     // sanity checks
     if (empty($config['class'])) {
         \OCP\Util::writeLog('files', 'No class given for objectstore', \OCP\Util::ERROR);
     }
     if (!isset($config['arguments'])) {
         $config['arguments'] = [];
     }
     $config['arguments']['user'] = $user;
     $bucket = $this->config->getUserValue($user->getUID(), 'homeobjectstore', 'bucket', null);
     if ($bucket === null) {
         /*
          * Use any provided bucket argument as prefix
          * and add the mapping from username => bucket
          */
         if (!isset($config['arguments']['bucket'])) {
             $config['arguments']['bucket'] = '';
         }
         $mapper = new \OC\Files\ObjectStore\Mapper($user);
         $config['arguments']['bucket'] .= $mapper->getBucket();
         $this->config->setUserValue($user->getUID(), 'homeobjectstore', 'bucket', $config['arguments']['bucket']);
     } else {
         $config['arguments']['bucket'] = $bucket;
     }
     // instantiate object store implementation
     $config['arguments']['objectstore'] = new $config['class']($config['arguments']);
     return $config;
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:37,代码来源:ObjectHomeMountProvider.php

示例13: getUser

 /**
  * gets user info
  *
  * @param array $parameters
  * @return OC_OCS_Result
  */
 public function getUser($parameters)
 {
     $userId = $parameters['userid'];
     // Check if user is logged in
     $user = $this->userSession->getUser();
     if ($user === null) {
         return new OC_OCS_Result(null, \OCP\API::RESPOND_UNAUTHORISED);
     }
     $data = [];
     // Admin? Or SubAdmin?
     if ($this->groupManager->isAdmin($user->getUID()) || OC_SubAdmin::isUserAccessible($user->getUID(), $userId)) {
         // Check they exist
         if (!$this->userManager->userExists($userId)) {
             return new OC_OCS_Result(null, \OCP\API::RESPOND_NOT_FOUND, 'The requested user could not be found');
         }
         $data['enabled'] = $this->config->getUserValue($userId, 'core', 'enabled', 'true');
     } else {
         // Check they are looking up themselves
         if ($user->getUID() !== $userId) {
             return new OC_OCS_Result(null, \OCP\API::RESPOND_UNAUTHORISED);
         }
     }
     // Find the data
     $data['quota'] = self::fillStorageInfo($userId);
     $data['email'] = $this->config->getUserValue($userId, 'settings', 'email');
     $data['displayname'] = $this->userManager->get($userId)->getDisplayName();
     return new OC_OCS_Result($data);
 }
开发者ID:jincreator,项目名称:core,代码行数:34,代码来源:users.php

示例14: sendEmail

 /**
  * @param string $user
  * @throws \Exception
  */
 protected function sendEmail($user)
 {
     if (!$this->userManager->userExists($user)) {
         throw new \Exception($this->l10n->t('Couldn\'t send reset email. Please make sure your username is correct.'));
     }
     $email = $this->config->getUserValue($user, 'settings', 'email');
     if (empty($email)) {
         throw new \Exception($this->l10n->t('Couldn\'t send reset email because there is no ' . 'email address for this username. Please ' . 'contact your administrator.'));
     }
     $token = $this->secureRandom->getMediumStrengthGenerator()->generate(21, ISecureRandom::CHAR_DIGITS . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER);
     $this->config->setUserValue($user, 'owncloud', 'lostpassword', $token);
     $link = $this->urlGenerator->linkToRouteAbsolute('core.lost.resetform', array('userId' => $user, 'token' => $token));
     $tmpl = new \OC_Template('core/lostpassword', 'email');
     $tmpl->assign('link', $link, false);
     $msg = $tmpl->fetchPage();
     try {
         $message = $this->mailer->createMessage();
         $message->setTo([$email => $user]);
         $message->setSubject($this->l10n->t('%s password reset', [$this->defaults->getName()]));
         $message->setPlainBody($msg);
         $message->setFrom([$this->from => $this->defaults->getName()]);
         $this->mailer->send($message);
     } catch (\Exception $e) {
         throw new \Exception($this->l10n->t('Couldn\'t send reset email. Please contact your administrator.'));
     }
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:30,代码来源:lostcontroller.php

示例15: getUser

 /**
  * gets user info
  *
  * @param array $parameters
  * @return OC_OCS_Result
  */
 public function getUser($parameters)
 {
     $userId = $parameters['userid'];
     // Check if user is logged in
     $currentLoggedInUser = $this->userSession->getUser();
     if ($currentLoggedInUser === null) {
         return new OC_OCS_Result(null, \OCP\API::RESPOND_UNAUTHORISED);
     }
     $data = [];
     // Check if the target user exists
     $targetUserObject = $this->userManager->get($userId);
     if ($targetUserObject === null) {
         return new OC_OCS_Result(null, \OCP\API::RESPOND_NOT_FOUND, 'The requested user could not be found');
     }
     // Admin? Or SubAdmin?
     if ($this->groupManager->isAdmin($currentLoggedInUser->getUID()) || $this->groupManager->getSubAdmin()->isUserAccessible($currentLoggedInUser, $targetUserObject)) {
         $data['enabled'] = $this->config->getUserValue($userId, 'core', 'enabled', 'true');
     } else {
         // Check they are looking up themselves
         if ($currentLoggedInUser->getUID() !== $userId) {
             return new OC_OCS_Result(null, \OCP\API::RESPOND_UNAUTHORISED);
         }
     }
     // Find the data
     $data['quota'] = $this->fillStorageInfo($userId);
     $data['email'] = $targetUserObject->getEMailAddress();
     $data['displayname'] = $targetUserObject->getDisplayName();
     return new OC_OCS_Result($data);
 }
开发者ID:kenwi,项目名称:core,代码行数:35,代码来源:users.php


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