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


PHP SessionCache::get方法代码示例

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


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

示例1: __construct

 public function __construct($session_started = false)
 {
     parent::__construct($session_started);
     //$this->setViewTemplate('_user_register.tpl');
     $this->addToView('first_name', SessionCache::get('first_name'));
     $this->setPageTitle('User Registeration');
 }
开发者ID:prabhatse,项目名称:olx_hack,代码行数:7,代码来源:class.UserController.php

示例2: getLoggedInUser

 /**
  * @return str Currently logged-in ThinkUp username (email address)
  */
 public static function getLoggedInUser()
 {
     if (self::isLoggedIn()) {
         return SessionCache::get('user');
     } else {
         return null;
     }
 }
开发者ID:raycornelius,项目名称:ThinkUp,代码行数:11,代码来源:class.Session.php

示例3: verifySignatureFirebase

 private static function verifySignatureFirebase($jwt)
 {
     $jwtCertsJSON = SessionCache::get(self::$JWT_CERTS_CACHE_KEY);
     if ($jwtCertsJSON === FALSE) {
         $jwtCertsJSON = HttpUtil::processRequest('https://www.googleapis.com/oauth2/v1/certs');
         SessionCache::set(self::$JWT_CERTS_CACHE_KEY, $jwtCertsJSON);
     }
     $jwtCerts = json_decode($jwtCertsJSON, TRUE);
     return JWT::decode($jwt, $jwtCerts);
 }
开发者ID:RobBosman,项目名称:bransom.RestServer-PHP,代码行数:10,代码来源:OpenIDTokenVerifier.class.php

示例4: insertCompanyName

 public function insertCompanyName($company_name)
 {
     $q = "INSERT INTO #prefix#company SET name=:company_name, ";
     $q .= "added_by=:added_by, added_date=NOW();";
     $vars = array(':company_name' => $company_name, ':added_by' => SessionCache::get('user_id'));
     if ($this->profiler_enabled) {
         Profiled::setDAOMethod(__METHOD__);
     }
     $ps = $this->execute($q, $vars);
     return $this->getUpdateCount($ps);
 }
开发者ID:prabhatse,项目名称:olx_hack,代码行数:11,代码来源:class.CompanyMySQLDAO.php

示例5: getAccountIdByName

 private function getAccountIdByName($accountName)
 {
     $accountIdCacheKey = array('id' => 'ACCOUND_ID_FOR_' . strtolower($accountName), 'exp' => 3600);
     // 1 hour
     $accountId = SessionCache::get($accountIdCacheKey);
     if ($accountId == NULL) {
         $accountId = $this->getAccountIdByNameFromDB($accountName);
         SessionCache::set($accountIdCacheKey, $accountId);
     }
     return $accountId;
 }
开发者ID:RobBosman,项目名称:bransom.RestServer-PHP,代码行数:11,代码来源:OpenIDConnectHandler.class.php

示例6: disableLocation

 public function disableLocation($location_id)
 {
     $modified_by = SessionCache::get('user_id');
     $q = " UPDATE #prefix#city SET status=:status , modified_by = :modified_by, modified_date = NOW() WHERE id=:city_id";
     $vars = array(':city_id' => $city_id, ':modified_by' => $modified_by, ':status' => 0);
     if ($this->profiler_enabled) {
         Profiler::setDAOMethod(__METHOD__);
     }
     $ps = $this->execute($q, $vars);
     return $this->getUpdateCount($ps);
 }
开发者ID:prabhatse,项目名称:olx_hack,代码行数:11,代码来源:class.LocationMySQLDAO.php

示例7: authControl

 public function authControl()
 {
     if (!$this->is_missing_param) {
         $request_token = $_GET['oauth_token'];
         $request_token_secret = SessionCache::get('oauth_request_token_secret');
         // get oauth values
         $plugin_option_dao = DAOFactory::GetDAO('PluginOptionDAO');
         $options = $plugin_option_dao->getOptionsHash('twitter', true);
         //get cached
         $to = new TwitterOAuth($options['oauth_consumer_key']->option_value, $options['oauth_consumer_secret']->option_value, $request_token, $request_token_secret);
         $tok = $to->getAccessToken();
         if (isset($tok['oauth_token']) && isset($tok['oauth_token_secret'])) {
             $api = new TwitterAPIAccessorOAuth($tok['oauth_token'], $tok['oauth_token_secret'], $options['oauth_consumer_key']->option_value, $options['oauth_consumer_secret']->option_value, $options['num_twitter_errors']->option_value, $options['max_api_calls_per_crawl']->option_value, false);
             $authed_twitter_user = $api->verifyCredentials();
             //                echo "User ID: ". $authed_twitter_user['user_id'];
             //                echo "User name: ". $authed_twitter_user['user_name'];
             $owner_dao = DAOFactory::getDAO('OwnerDAO');
             $owner = $owner_dao->getByEmail($this->getLoggedInUser());
             if ((int) $authed_twitter_user['user_id'] > 0) {
                 $instance_dao = DAOFactory::getDAO('TwitterInstanceDAO');
                 $instance = $instance_dao->getByUsername($authed_twitter_user['user_name'], 'twitter');
                 $owner_instance_dao = DAOFactory::getDAO('OwnerInstanceDAO');
                 if (isset($instance)) {
                     $owner_instance = $owner_instance_dao->get($owner->id, $instance->id);
                     if ($owner_instance != null) {
                         $owner_instance_dao->updateTokens($owner->id, $instance->id, $tok['oauth_token'], $tok['oauth_token_secret']);
                         $this->addSuccessMessage($authed_twitter_user['user_name'] . " on Twitter is already set up in ThinkUp! To add a different Twitter account, " . "log out of Twitter.com in your browser and authorize ThinkUp again.");
                     } else {
                         if ($owner_instance_dao->insert($owner->id, $instance->id, $tok['oauth_token'], $tok['oauth_token_secret'])) {
                             $this->addSuccessMessage("Success! " . $authed_twitter_user['user_name'] . " on Twitter has been added to ThinkUp!");
                         } else {
                             $this->addErrorMessage("Error: Could not create an owner instance.");
                         }
                     }
                 } else {
                     $instance_dao->insert($authed_twitter_user['user_id'], $authed_twitter_user['user_name']);
                     $instance = $instance_dao->getByUsername($authed_twitter_user['user_name']);
                     if ($owner_instance_dao->insert($owner->id, $instance->id, $tok['oauth_token'], $tok['oauth_token_secret'])) {
                         $this->addSuccessMessage("Success! " . $authed_twitter_user['user_name'] . " on Twitter has been added to ThinkUp!");
                     } else {
                         $this->addErrorMessage("Error: Could not create an owner instance.");
                     }
                 }
             }
         } else {
             $msg = "Error: Twitter authorization did not complete successfully. Check if your account already " . " exists. If not, please try again.";
             $this->addErrorMessage($msg);
         }
         $this->view_mgr->clear_all_cache();
     }
     return $this->generateView();
 }
开发者ID:JWFoxJr,项目名称:ThinkUp,代码行数:52,代码来源:class.TwitterAuthController.php

示例8: userLogoutUpdate

 public function userLogoutUpdate($reason = 1)
 {
     $user_id = SessionCache::get('user_id');
     $cookie = SessionCache::get('cookie');
     $q = "UPDATE #prefix#user_logon_info SET logout=NOW(), working_time = (logout-login)/60, logout_reason=:logout_reason ";
     $q .= "WHERE user_id=:user_id AND cookie=:cookie";
     $vars = array(':user_id' => $user_id, ':cookie' => $cookie, ':logout_reason' => $reason);
     $ps = $this->execute($q, $vars);
     $loginTime = explode(":", SessionCache::get('login_time'));
     $logoutTime = explode(":", date('H:i'));
     $totalTime = 60 * $logoutTime[0] + $logoutTime[1] - (60 * $loginTime[0] + $loginTime[1]);
     $this->updateWorkingHour($user_id, $totalTime);
     SessionCache::unsetKey('login_time');
     SessionCache::unsetKey('cookie');
 }
开发者ID:prabhatse,项目名称:olx_hack,代码行数:15,代码来源:class.UserLogonMySQLDAO.php

示例9: control

 public function control()
 {
     if ($this->isLoggedIn()) {
         $config = Config::getInstance();
         $this->setViewTemplate($this->tpl_name);
         $first_name = SessionCache::get('first_name');
         //$first_name = 'Session';
         $this->addToView('first_name', $first_name);
         //flush();
         return $this->generateView();
     } else {
         $controller = new LoginController(true);
         return $controller->go();
     }
 }
开发者ID:prabhatse,项目名称:olx_hack,代码行数:15,代码来源:class.DashboardController.php

示例10: testControl

 public function testControl()
 {
     $builders = $this->buildData();
     $config = Config::getInstance();
     $escaped_site_root_path = str_replace('/', '\\/', $config->getValue('site_root_path'));
     $controller = new TestAuthAPIController(true);
     // No username, no API secret provided
     // This isn't an API call, so present HTML error output
     $results = $controller->go();
     $this->assertPattern('/session\\/login.php\\?redirect\\=/', $controller->redirect_destination);
     // No API secret provided
     // This isn't an API call, so present HTML error output
     $_GET['un'] = 'me@example.com';
     $results = $controller->go();
     $this->assertPattern('/session\\/login.php\\?redirect\\=/', $controller->redirect_destination);
     // Wrong API secret provided
     $_GET['as'] = 'fail_me';
     $results = $controller->go();
     $this->assertPattern("/UnauthorizedUserException/", $results);
     $this->assertPattern("/Unauthorized API call/", $results);
     $controller = new TestAuthAPIController(true);
     // Wrong username provided
     $_GET['as'] = 'c9089f3c9adaf0186f6ffb1ee8d6501c';
     $_GET['un'] = 'fail_me';
     $results = $controller->go();
     $this->assertPattern("/UnauthorizedUserException/", $results);
     $this->assertPattern("/Unauthorized API call/", $results);
     // Working request
     $_GET['un'] = 'me@example.com';
     $_GET['as'] = 'c9089f3c9adaf0186f6ffb1ee8d6501c';
     $results = $controller->go();
     $this->assertPattern('/{"result":"success"}/', $results);
     $config = Config::getInstance();
     $this->assertEqual(SessionCache::get('user'), 'me@example.com');
     // Now that _SESSION['user'] is set, we shouldn't need to provide un/as to use this controller
     // Also, the result will be returned as HTML, not JSON
     unset($_GET['as']);
     $results = $controller->go();
     $this->assertPattern('/<html><body>Success<\\/body><\\/html>/', $results);
     // And just to make sure, if we 'logout', we should be denied access now
     Session::logout();
     $results = $controller->go();
     $this->assertPattern('/ControllerAuthException/', $results);
     $this->assertPattern('/You must/', $results);
     $this->assertPattern('/log in/', $results);
 }
开发者ID:pepeleproso,项目名称:ThinkUp,代码行数:46,代码来源:TestOfTestAuthAPIController.php

示例11: addNotify

 public function addNotify($what, $type = 0)
 {
     $notify_dao = DAOFactory::getDAO('NotifyDAO');
     $notify = array();
     $notify['notify_type'] = $type;
     $notify['user_id'] = SessionCache::get('user_id');
     $notify['title'] = "<a href=#>Prabhat</a> added You a" . $what;
     $notify['body'] = makeNotifyBody($what);
     // will contain user Image + Title + Date/Time.
     if ($notify_dao->insertNotification($notify)) {
         $notify_id = $notify_dao->getInsertId();
         unset($notify['notify_type']);
         unset($notify['event_class']);
         //$notify['user_id'] = $this->getLoggedInUser();
         $notify['user_id'] = $who;
         $notify_dao->insertMakeNotification($notify);
     }
 }
开发者ID:prabhatse,项目名称:olx_hack,代码行数:18,代码来源:class.NotifyController.php

示例12: modifyCountry

 public function modifyCountry($country_id, $update_arr)
 {
     $modified_by = SessionCache::get('user_id');
     $q = " UPDATE #prefix#country SET modified_by=:modified_by,modified_date=NOW ";
     $vars = array();
     foreach ($update_arr as $key => $value) {
         $q .= ", " . $key . "=:" . $value;
         $field = ":" . $key;
         $vars[$field] = $value;
     }
     $vars[':modified_by'] = $modified_by;
     $vars[':country_id'] = $country_id;
     $q .= " WHERE id =:country_id";
     if ($this->profiler_enabled) {
         Profiler::setDAOMethod(__METHOD__);
     }
     $ps = $this->execute($q, $vars);
     return $this->getUpdateCount($ps);
 }
开发者ID:prabhatse,项目名称:olx_hack,代码行数:19,代码来源:class.CountryMySQLDAO.php

示例13: authControl

 public function authControl()
 {
     if (!$this->is_missing_param) {
         $username = $_GET['u'];
         $network = $_GET['n'];
         $user_dao = DAOFactory::getDAO('UserDAO');
         $page = isset($_GET['page']) && is_numeric($_GET['page']) ? $_GET['page'] : 1;
         if ($user_dao->isUserInDBByName($username, $network)) {
             $this->setPageTitle('User Details: ' . $username);
             $user = $user_dao->getUserByName($username, $network);
             $owner_dao = DAOFactory::getDAO('OwnerDAO');
             $owner = $owner_dao->getByEmail($this->getLoggedInUser());
             $instance_dao = DAOFactory::getDAO('InstanceDAO');
             $this->addToView('instances', $instance_dao->getByOwner($owner));
             $this->addToView('profile', $user);
             $post_dao = DAOFactory::getDAO('PostDAO');
             $user_posts = $post_dao->getAllPosts($user->user_id, $user->network, 20, $page);
             $this->addToView('user_statuses', $user_posts);
             if (sizeof($user_posts) == 20) {
                 $this->addToView('next_page', $page + 1);
             }
             $this->addToView('last_page', $page - 1);
             $this->addToView('sources', $post_dao->getStatusSources($user->user_id, $user->network));
             if (SessionCache::isKeySet('selected_instance_username') && SessionCache::isKeySet('selected_instance_network')) {
                 $i = $instance_dao->getByUsername(SessionCache::get('selected_instance_username'), SessionCache::get('selected_instance_network'));
                 if (isset($i)) {
                     $this->addToView('instance', $i);
                     $exchanges = $post_dao->getExchangesBetweenUsers($i->network_user_id, $i->network, $user->user_id);
                     $this->addToView('exchanges', $exchanges);
                     $this->addToView('total_exchanges', count($exchanges));
                     $follow_dao = DAOFactory::getDAO('FollowDAO');
                     $mutual_friends = $follow_dao->getMutualFriends($user->user_id, $i->network_user_id, $i->network);
                     $this->addToView('mutual_friends', $mutual_friends);
                     $this->addToView('total_mutual_friends', count($mutual_friends));
                 }
             }
         } else {
             $this->addErrorMessage($username . ' is not in the system.');
         }
     }
     return $this->generateView();
 }
开发者ID:JWFoxJr,项目名称:ThinkUp,代码行数:42,代码来源:class.UserController.php

示例14: addCompany

 public static function addCompany($company_data, $client_setup = false)
 {
     if (isset($branch_data)) {
         //Checking the required params.
         foreach (self::$REQUIRED_PARAMS as $param) {
             if (!isset($branch_data[$param]) || $branch_data[$param] == '') {
                 self::$is_missing_param = true;
                 break;
             }
         }
         if (!$this->is_missing_param) {
             $branch_data['added_by'] = SessionCache::get('user_id');
             $company_dao = DAOFactory::getDAO('CompanyDAO');
             $ret = $company_dao->insertCompanyBranch($branch_data);
             return $ret;
         } else {
             //$this->sendJsonResponse(0,$msg);
         }
     }
 }
开发者ID:prabhatse,项目名称:olx_hack,代码行数:20,代码来源:class.CompanyController.php

示例15: testControl

 public function testControl()
 {
     $builders = $this->buildData();
     $config = Config::getInstance();
     $escaped_site_root_path = str_replace('/', '\\/', $config->getValue('site_root_path'));
     $controller = new TestAuthAPIController(true);
     // No username, no API secret provided
     // This isn't an API call, so present HTML error output
     $results = $controller->go();
     $this->assertPattern('/You must <a href="' . $escaped_site_root_path . 'session\\/login.php">log in<\\/a> to do this./', $results);
     // No API secret provided
     // This isn't an API call, so present HTML error output
     $_GET['un'] = 'me@example.com';
     $results = $controller->go();
     $this->assertPattern('/You must <a href="' . $escaped_site_root_path . 'session\\/login.php">log in<\\/a> to do this./', $results);
     // Wrong API secret provided
     $_GET['as'] = 'fail_me';
     $results = $controller->go();
     $this->assertPattern("/UnauthorizedUserException: Unauthorized API call/", $results);
     // Wrong username provided
     $_GET['as'] = Session::getAPISecretFromPassword('XXX');
     $_GET['un'] = 'fail_me';
     $results = $controller->go();
     $this->assertPattern("/UnauthorizedUserException: Unauthorized API call/", $results);
     // Working request
     $_GET['un'] = 'me@example.com';
     $_GET['as'] = Session::getAPISecretFromPassword('XXX');
     $results = $controller->go();
     $this->assertPattern('/{"result":"success"}/', $results);
     $config = Config::getInstance();
     $this->assertEqual(SessionCache::get('user'), 'me@example.com');
     // Now that _SESSION['user'] is set, we shouldn't need to provide un/as to use this controller
     // Also, the result will be returned as HTML, not JSON
     unset($_GET['as']);
     $results = $controller->go();
     $this->assertPattern('/<html/', $results);
     // And just to make sure, if we 'logout', we should be denied access now
     Session::logout();
     $results = $controller->go();
     $this->assertPattern('/You must <a href="' . $escaped_site_root_path . 'session\\/login.php">log in<\\/a> to do this./', $results);
 }
开发者ID:narpaldhillon,项目名称:ThinkUp,代码行数:41,代码来源:TestOfTestAuthAPIController.php


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