當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ISession::get方法代碼示例

本文整理匯總了PHP中OCP\ISession::get方法的典型用法代碼示例。如果您正苦於以下問題:PHP ISession::get方法的具體用法?PHP ISession::get怎麽用?PHP ISession::get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OCP\ISession的用法示例。


在下文中一共展示了ISession::get方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: isPrivateKeySet

 /**
  * check if private key is set
  *
  * @return boolean
  */
 public function isPrivateKeySet()
 {
     $key = $this->session->get('privateKey');
     if (is_null($key)) {
         return false;
     }
     return true;
 }
開發者ID:brunomilet,項目名稱:owncloud-core,代碼行數:13,代碼來源:session.php

示例2: getToken

 /**
  * Returns the current token or throws an exception if none is found.
  *
  * @return string
  * @throws \Exception
  */
 public function getToken()
 {
     $token = $this->session->get('requesttoken');
     if (empty($token)) {
         throw new \Exception('Session does not contain a requesttoken');
     }
     return $token;
 }
開發者ID:rchicoli,項目名稱:owncloud-core,代碼行數:14,代碼來源:SessionStorage.php

示例3: initializeSession

 protected function initializeSession()
 {
     $encryptedSessionData = $this->session->get(self::encryptedSessionName);
     try {
         $this->sessionValues = json_decode($this->crypto->decrypt($encryptedSessionData, $this->passphrase), true);
     } catch (\Exception $e) {
         $this->sessionValues = [];
     }
 }
開發者ID:hyb148,項目名稱:core,代碼行數:9,代碼來源:cryptosessiondata.php

示例4: testUnwrappingGet

 public function testUnwrappingGet()
 {
     $unencryptedValue = 'foobar';
     $encryptedValue = $this->crypto->encrypt($unencryptedValue);
     $this->wrappedSession->expects($this->once())->method('get')->with('encrypted_session_data')->willReturnCallback(function () use($encryptedValue) {
         return $encryptedValue;
     });
     $this->assertSame($unencryptedValue, $this->wrappedSession->get('encrypted_session_data'));
 }
開發者ID:evanjt,項目名稱:core,代碼行數:9,代碼來源:cryptowrappingtest.php

示例5: manipulateStorageConfig

 public function manipulateStorageConfig(StorageConfig &$storage)
 {
     $encrypted = $this->session->get('password::sessioncredentials/credentials');
     if (!isset($encrypted)) {
         throw new InsufficientDataForMeaningfulAnswerException('No session credentials saved');
     }
     $credentials = json_decode($this->crypto->decrypt($encrypted), true);
     $storage->setBackendOption('user', $this->session->get('loginname'));
     $storage->setBackendOption('password', $credentials['password']);
 }
開發者ID:kenwi,項目名稱:core,代碼行數:10,代碼來源:sessioncredentials.php

示例6: get

 /**
  * Get a value from the session
  *
  * @param string $key
  * @return string|null Either the value or null
  */
 public function get($key)
 {
     $encryptedValue = $this->session->get($key);
     if ($encryptedValue === null) {
         return null;
     }
     try {
         $value = $this->crypto->decrypt($encryptedValue, $this->passphrase);
         return json_decode($value);
     } catch (\Exception $e) {
         return null;
     }
 }
開發者ID:rosarion,項目名稱:core,代碼行數:19,代碼來源:cryptosessiondata.php

示例7: getTimeZone

 /**
  * Get the timezone of the current user, based on his session information and config data
  *
  * @param bool|int $timestamp
  * @return \DateTimeZone
  */
 public function getTimeZone($timestamp = false)
 {
     $timeZone = $this->config->getUserValue($this->session->get('user_id'), 'core', 'timezone', null);
     if ($timeZone === null) {
         if ($this->session->exists('timezone')) {
             return $this->guessTimeZoneFromOffset($this->session->get('timezone'), $timestamp);
         }
         $timeZone = $this->getDefaultTimeZone();
     }
     try {
         return new \DateTimeZone($timeZone);
     } catch (\Exception $e) {
         \OCP\Util::writeLog('datetimezone', 'Failed to created DateTimeZone "' . $timeZone . "'", \OCP\Util::DEBUG);
         return new \DateTimeZone($this->getDefaultTimeZone());
     }
 }
開發者ID:GitHubUser4234,項目名稱:core,代碼行數:22,代碼來源:DateTimeZone.php

示例8: checkSession

 /**
  * Makes sure the user is already properly authenticated when a password is required and none
  * was provided
  *
  * @param array|bool $linkItem
  *
  * @throws CheckException
  */
 private function checkSession($linkItem)
 {
     // Not authenticated ?
     if (!$this->session->exists('public_link_authenticated') || $this->session->get('public_link_authenticated') !== $linkItem['id']) {
         throw new CheckException("Missing password", Http::STATUS_UNAUTHORIZED);
     }
 }
開發者ID:enoch85,項目名稱:owncloud-testserver,代碼行數:15,代碼來源:envcheckmiddleware.php

示例9: checkSession

 /**
  * Makes sure the user is already properly authenticated when a password is required and none
  * was provided
  *
  * @param IShare $share
  *
  * @throws CheckException
  */
 private function checkSession($share)
 {
     // Not authenticated ?
     if (!$this->session->exists('public_link_authenticated') || $this->session->get('public_link_authenticated') !== (string) $share->getId()) {
         throw new CheckException("Missing password", Http::STATUS_UNAUTHORIZED);
     }
 }
開發者ID:drognisep,項目名稱:Portfolio-Site,代碼行數:15,代碼來源:envcheckmiddleware.php

示例10: getDecryptAllKey

 /**
  * get private key for decrypt all operation
  *
  * @return string
  * @throws PrivateKeyMissingException
  */
 public function getDecryptAllKey()
 {
     $privateKey = $this->session->get('decryptAllKey');
     if (is_null($privateKey) && $this->decryptAllModeActivated()) {
         throw new PrivateKeyMissingException('No private key found while in decrypt all mode');
     } elseif (is_null($privateKey)) {
         throw new PrivateKeyMissingException('Please activate decrypt all mode first');
     }
     return $privateKey;
 }
開發者ID:evanjt,項目名稱:core,代碼行數:16,代碼來源:session.php

示例11: updateToken

 /**
  * @param IToken $token
  */
 private function updateToken(IToken $token)
 {
     // To save unnecessary DB queries, this is only done once a minute
     $lastTokenUpdate = $this->session->get('last_token_update') ?: 0;
     $now = $this->timeFacory->getTime();
     if ($lastTokenUpdate < $now - 60) {
         $this->tokenProvider->updateToken($token);
         $this->session->set('last_token_update', $now);
     }
 }
開發者ID:rchicoli,項目名稱:owncloud-core,代碼行數:13,代碼來源:Session.php

示例12: getTimeZone

 /**
  * Get the timezone of the current user, based on his session information and config data
  *
  * @return \DateTimeZone
  */
 public function getTimeZone()
 {
     $timeZone = $this->config->getUserValue($this->session->get('user_id'), 'core', 'timezone', null);
     if ($timeZone === null) {
         if ($this->session->exists('timezone')) {
             $offsetHours = $this->session->get('timezone');
             // Note: the timeZone name is the inverse to the offset,
             // so a positive offset means negative timeZone
             // and the other way around.
             if ($offsetHours > 0) {
                 return new \DateTimeZone('Etc/GMT-' . $offsetHours);
             } else {
                 return new \DateTimeZone('Etc/GMT+' . abs($offsetHours));
             }
         } else {
             return new \DateTimeZone('UTC');
         }
     }
     return new \DateTimeZone($timeZone);
 }
開發者ID:heldernl,項目名稱:owncloud8-extended,代碼行數:25,代碼來源:datetimezone.php

示例13: auth

 /**
  * @param \Sabre\DAV\Server $server
  * @param $realm
  * @return bool
  */
 private function auth(\Sabre\DAV\Server $server, $realm)
 {
     if (\OC_User::handleApacheAuth() || $this->userSession->isLoggedIn() && is_null($this->session->get(self::DAV_AUTHENTICATED))) {
         $user = $this->userSession->getUser()->getUID();
         \OC_Util::setupFS($user);
         $this->currentUser = $user;
         $this->session->close();
         return true;
     }
     return parent::authenticate($server, $realm);
 }
開發者ID:leechan530,項目名稱:calendar,代碼行數:16,代碼來源:auth.php

示例14: 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
  * @throws \Sabre\DAV\Exception\NotAuthenticated
  */
 protected function validateUserPass($username, $password)
 {
     try {
         $share = $this->shareManager->getShareByToken($username);
     } catch (ShareNotFound $e) {
         return false;
     }
     $this->share = $share;
     \OC_User::setIncognitoMode(true);
     // check if the share is password protected
     if ($share->getPassword() !== null) {
         if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) {
             if ($this->shareManager->checkPassword($share, $password)) {
                 return true;
             } else {
                 if ($this->session->exists('public_link_authenticated') && $this->session->get('public_link_authenticated') === $share->getId()) {
                     return true;
                 } else {
                     if (in_array('XMLHttpRequest', explode(',', $this->request->getHeader('X-Requested-With')))) {
                         // do not re-authenticate over ajax, use dummy auth name to prevent browser popup
                         http_response_code(401);
                         header('WWW-Authenticate', 'DummyBasic real="ownCloud"');
                         throw new \Sabre\DAV\Exception\NotAuthenticated('Cannot authenticate over ajax calls');
                     }
                     return false;
                 }
             }
         } else {
             if ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE) {
                 return true;
             } else {
                 return false;
             }
         }
     } else {
         return true;
     }
 }
開發者ID:stweil,項目名稱:owncloud-core,代碼行數:50,代碼來源:publicauth.php

示例15: getLoginName

 /**
  * get the login name of the current user
  *
  * @return string
  */
 public function getLoginName()
 {
     if ($this->activeUser) {
         return $this->session->get('loginname');
     } else {
         $uid = $this->session->get('user_id');
         if ($uid) {
             $this->activeUser = $this->manager->get($uid);
             return $this->session->get('loginname');
         } else {
             return null;
         }
     }
 }
開發者ID:drognisep,項目名稱:Portfolio-Site,代碼行數:19,代碼來源:Session.php


注:本文中的OCP\ISession::get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。