本文整理汇总了PHP中SessionCache类的典型用法代码示例。如果您正苦于以下问题:PHP SessionCache类的具体用法?PHP SessionCache怎么用?PHP SessionCache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SessionCache类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: __construct
/**
* Identical to the parent constructor, except that
* we start a PHP session to store the user ID and
* access token if during the course of execution
* we discover them.
*
* @param Array $config the application configuration.
* @see BaseFacebook::__construct in facebook.php
*/
public function __construct($config)
{
if (!session_id()) {
SessionCache::init();
}
parent::__construct($config);
}
开发者ID:dgw,项目名称:ThinkUp,代码行数:16,代码来源:facebook.php
示例3: clear
static function clear()
{
SessionCache::clear();
SiteCache::clear();
PageCache::clear();
return;
}
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:7,代码来源:Cache.php
示例4: 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
示例5: 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
示例6: 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
示例7: 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
示例8: 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
示例9: 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
示例10: 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
示例11: 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'] = '[email protected]';
$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'] = '[email protected]';
$_GET['as'] = 'c9089f3c9adaf0186f6ffb1ee8d6501c';
$results = $controller->go();
$this->assertPattern('/{"result":"success"}/', $results);
$config = Config::getInstance();
$this->assertEqual(SessionCache::get('user'), '[email protected]');
// 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
示例12: 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
示例13: go
/**
* Override the parent's go method because there is no view manager here--we're outputting the image directly.
*/
public function go()
{
$config = Config::getInstance();
$random_num = rand(1000, 99999);
SessionCache::put('ckey', md5($random_num));
$img = rand(1, 4);
Utils::defineConstants();
$captcha_bg_image_path = THINKUP_WEBAPP_PATH . "assets/img/captcha/bg" . $img . ".PNG";
$img_handle = imageCreateFromPNG($captcha_bg_image_path);
if ($img_handle === false) {
echo 'CAPTCHA image could not be created from ' . $captcha_bg_image_path;
} else {
$this->setContentType('image/png');
$color = ImageColorAllocate($img_handle, 0, 0, 0);
ImageString($img_handle, 5, 20, 13, $random_num, $color);
ImagePng($img_handle);
ImageDestroy($img_handle);
}
}
开发者ID:hendrasaputra,项目名称:ThinkUp,代码行数:22,代码来源:class.CaptchaImageController.php
示例14: 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
示例15: 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
示例16: 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
示例17: 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'] = '[email protected]';
$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'] = '[email protected]';
$_GET['as'] = Session::getAPISecretFromPassword('XXX');
$results = $controller->go();
$this->assertPattern('/{"result":"success"}/', $results);
$config = Config::getInstance();
$this->assertEqual(SessionCache::get('user'), '[email protected]');
// 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
示例18: check
public function check()
{
switch ($this->type) {
case 1:
$resp = recaptcha_check_answer($this->prikey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
$this->msg = $resp->error;
return false;
} else {
return true;
}
break;
default:
if (strcmp(md5($_POST['user_code']), SessionCache::get('ckey'))) {
$this->msg = "Wrong text, try again";
return false;
} else {
return true;
}
break;
}
}
开发者ID:raycornelius,项目名称:ThinkUp,代码行数:22,代码来源:class.Captcha.php
示例19: testPutGetIsset
public function testPutGetIsset()
{
$config = Config::getInstance();
//nothing is set
$this->assertNull(SessionCache::get('my_key'));
$this->assertFalse(SessionCache::isKeySet('my_key'));
//set a key
SessionCache::put('my_key', 'my_value');
$this->assertTrue(isset($_SESSION[$config->getValue('source_root_path')]));
$this->assertEqual($_SESSION[$config->getValue('source_root_path')]['my_key'], 'my_value');
$this->assertEqual(SessionCache::get('my_key'), 'my_value');
//overwrite existing key
SessionCache::put('my_key', 'my_value2');
$this->assertTrue($_SESSION[$config->getValue('source_root_path')]['my_key'] != 'my_value');
$this->assertEqual($_SESSION[$config->getValue('source_root_path')]['my_key'], 'my_value2');
//set another key
SessionCache::put('my_key2', 'my_other_value');
$this->assertEqual($_SESSION[$config->getValue('source_root_path')]['my_key2'], 'my_other_value');
//unset first key
SessionCache::unsetKey('my_key');
$this->assertNull(SessionCache::get('my_key'));
$this->assertFalse(SessionCache::isKeySet('my_key'));
}
开发者ID:randi2kewl,项目名称:ThinkUp,代码行数:23,代码来源:TestOfSessionCache.php
示例20: setInstance
/**
* Set the instance variable based on request and logged-in status
* Add the list of avaiable instances to the view you can switch to in the dropdown based on logged-in status
*/
private function setInstance()
{
$instance_dao = DAOFactory::getDAO('InstanceDAO');
$config = Config::getInstance();
if ($this->isLoggedIn()) {
$owner_dao = DAOFactory::getDAO('OwnerDAO');
$owner = $owner_dao->getByEmail($this->getLoggedInUser());
if (isset($_GET["u"]) && isset($_GET['n'])) {
$instance = $instance_dao->getByUsernameOnNetwork(stripslashes($_GET["u"]), $_GET['n']);
if (isset($instance)) {
$owner_instance_dao = DAOFactory::getDAO('OwnerInstanceDAO');
if ($owner_instance_dao->doesOwnerHaveAccessToInstance($owner, $instance)) {
$this->instance = $instance;
} else {
$this->instance = null;
$this->addErrorMessage("Insufficient privileges");
}
} else {
$this->addErrorMessage(stripslashes($_GET["u"]) . " on " . ucfirst($_GET['n']) . " is not in ThinkUp.");
}
} else {
$this->instance = $instance_dao->getFreshestByOwnerId($owner->id);
}
$this->addToView('instances', $instance_dao->getByOwner($owner));
} else {
if (isset($_GET["u"]) && isset($_GET['n'])) {
$instance = $instance_dao->getByUsernameOnNetwork(stripslashes($_GET["u"]), $_GET['n']);
if (isset($instance)) {
if ($instance->is_public) {
$this->instance = $instance;
} else {
$this->addErrorMessage("Insufficient privileges");
}
} else {
$this->addErrorMessage(stripslashes($_GET["u"]) . " on " . ucfirst($_GET['n']) . " is not in ThinkUp.");
}
}
$this->addToView('instances', $instance_dao->getPublicInstances());
}
if (!isset($this->instance)) {
// A specific instance wasn't passed in the URL (or isn't accessible), get a default one
$instance_id_to_display = $config->getValue('default_instance');
$instance_id_to_display = intval($instance_id_to_display);
if ($instance_id_to_display != 0) {
$this->instance = $instance_dao->get($instance_id_to_display);
}
if (!isset($this->instance) || !$this->instance->is_public) {
$this->instance = $instance_dao->getInstanceFreshestPublicOne();
}
}
if (isset($this->instance)) {
//user
$user_dao = DAOFactory::getDAO('UserDAO');
$user = $user_dao->getDetails($this->instance->network_user_id, $this->instance->network);
$this->addToView('user_details', $user);
if (Session::isLoggedIn() && !isset($user)) {
$this->addInfoMessage("Oops! There's no information about " . $this->instance->network_username . " on " . ucfirst($this->instance->network) . " to display.");
$this->addToView('show_update_now_button', true);
}
SessionCache::put('selected_instance_network', $this->instance->network);
SessionCache::put('selected_instance_username', $this->instance->network_username);
//check Realtime last update and overwrite instance->last_update
$stream_proc_dao = DAOFactory::getDAO('StreamProcDAO');
$process = $stream_proc_dao->getProcessInfoForInstance($this->instance->id);
if (isset($process)) {
//$this->instance->crawler_last_run = $process['last_report'];
$this->instance->crawler_last_run = 'realtime';
}
$this->addToView('instance', $this->instance);
} else {
SessionCache::put('selected_instance_network', null);
SessionCache::put('selected_instance_username', null);
}
$this->addToView('developer_log', $config->getValue('is_log_verbose'));
}
开发者ID:nix4,项目名称:ThinkUp,代码行数:79,代码来源:class.DashboardController.php
注:本文中的SessionCache类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论