本文整理汇总了PHP中SessionCache::init方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionCache::init方法的具体用法?PHP SessionCache::init怎么用?PHP SessionCache::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SessionCache
的用法示例。
在下文中一共展示了SessionCache::init方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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);
}
示例2: testVerifyDBness
public function testVerifyDBness()
{
$config = Config::getInstance();
$config->setValue('use_db_sessions', true);
session_id(md5(time()));
SessionCache::init();
SessionCache::put('my_key', 'my_value2');
$dao = DAOFactory::getDAO('SessionDAO');
$data = $dao->read(session_id());
$this->assertEqual('', $data);
session_write_close();
$data = $dao->read(session_id());
$this->assertPattern('/my_key/', $data);
$this->assertPattern('/my_value2/', $data);
$this->assertNotEqual('', $data);
// Retrieve it manually just to make sure
$sql = "SELECT * FROM tu_sessions";
$stmt = SessionMySQLDAO::$PDO->query($sql);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$this->assertPattern('/my_key/', $row['data']);
$this->assertPattern('/my_value2/', $row['data']);
}
示例3: __construct
/**
* Constructs ThinkUpController
*
* Adds email address of currently logged in ThinkUp user, '' if not logged in, to view
* {$logged_in_user}
* @return ThinkUpController
*/
public function __construct($session_started = false)
{
try {
$config = Config::getInstance();
$this->profiler_enabled = Profiler::isEnabled();
if ($this->profiler_enabled) {
$this->start_time = microtime(true);
}
if ($config->getValue('timezone')) {
date_default_timezone_set($config->getValue('timezone'));
}
if (!$session_started) {
SessionCache::init();
}
$this->view_mgr = new ViewManager();
if (SessionCache::isKeySet('selected_instance_network') && SessionCache::isKeySet('selected_instance_username')) {
$this->addToView('selected_instance_network', SessionCache::get('selected_instance_network'));
$this->addToView('selected_instance_username', SessionCache::get('selected_instance_username'));
}
if ($this->isLoggedIn()) {
$this->addToView('logged_in_user', $this->getLoggedInUser());
}
if ($this->isAdmin()) {
$this->addToView('user_is_admin', true);
}
$THINKUP_VERSION = $config->getValue('THINKUP_VERSION');
$this->addToView('thinkup_version', $THINKUP_VERSION);
} catch (Exception $e) {
Loader::definePathConstants();
//echo 'sending this to Smarty:'.THINKUP_WEBAPP_PATH.'data/';
$cfg_array = array('site_root_path' => Utils::getSiteRootPathFromFileSystem(), 'source_root_path' => THINKUP_ROOT_PATH, 'datadir_path' => THINKUP_WEBAPP_PATH . 'data/', 'debug' => false, 'app_title_prefix' => "", 'cache_pages' => false);
$this->view_mgr = new ViewManager($cfg_array);
}
}
示例4: __construct
/**
* Constructs ThinkUpController
*
* Adds email address of currently logged in ThinkUp user, '' if not logged in, to view
* {$logged_in_user}
* @return ThinkUpController
*/
public function __construct($session_started = false)
{
try {
$config = Config::getInstance();
$this->profiler_enabled = Profiler::isEnabled();
if ($this->profiler_enabled) {
$this->start_time = microtime(true);
}
if ($config->getValue('timezone')) {
date_default_timezone_set($config->getValue('timezone'));
}
if (!$session_started) {
SessionCache::init();
}
$this->view_mgr = new ViewManager();
if (SessionCache::isKeySet('selected_instance_network') && SessionCache::isKeySet('selected_instance_username')) {
$this->addToView('selected_instance_network', SessionCache::get('selected_instance_network'));
$this->addToView('selected_instance_username', SessionCache::get('selected_instance_username'));
}
if ($this->isLoggedIn()) {
$this->addToView('logged_in_user', $this->getLoggedInUser());
}
if ($this->isAdmin()) {
$this->addToView('user_is_admin', true);
}
$THINKUP_VERSION = $config->getValue('THINKUP_VERSION');
$this->addToView('thinkup_version', $THINKUP_VERSION);
if (Utils::isThinkUpLLC()) {
$thinkupllc_endpoint = $config->getValue('thinkupllc_endpoint');
$this->addToView('thinkupllc_endpoint', $thinkupllc_endpoint);
}
if (SessionCache::isKeySet('selected_instance_network') && SessionCache::isKeySet('selected_instance_username')) {
$this->addToView('selected_instance_network', SessionCache::get('selected_instance_network'));
$this->addToView('selected_instance_username', SessionCache::get('selected_instance_username'));
}
} catch (Exception $e) {
Loader::definePathConstants();
//echo 'sending this to Smarty:'.THINKUP_WEBAPP_PATH.'data/';
$cfg_array = array('site_root_path' => Utils::getSiteRootPathFromFileSystem(), 'source_root_path' => THINKUP_ROOT_PATH, 'datadir_path' => THINKUP_WEBAPP_PATH . 'data/', 'debug' => false, 'app_title_prefix' => "", 'cache_pages' => false);
$this->view_mgr = new ViewManager($cfg_array);
$this->setErrorTemplateState();
$this->addToView('error_type', get_class($e));
$disable_xss = false;
// if we are an installer exception, don't filter XSS, we have markup, and we trust this content
if (get_class($e) == 'InstallerException') {
$disable_xss = true;
}
$this->addErrorMessage($e->getMessage(), null, $disable_xss);
}
}
示例5: __construct
/**
* Constructs EFCController
*
* Adds email address of currently logged in EFC user, '' if not logged in, to view
* {$logged_in_user}
* @return EFCController
*/
public function __construct($session_started = false)
{
try {
//$this->baseMem = memory_get_usage(true);
$this->redis = new Redis();
$this->redis->connect('127.0.0.1', 6379);
$this->memcache = new Memcache();
$this->memcache->connect('127.0.0.1', 11211);
$config = Config::getInstance();
$this->profiler_enabled = Profiler::isEnabled();
if ($this->profiler_enabled) {
$this->start_time = microtime(true);
}
if ($config->getValue('timezone')) {
date_default_timezone_set($config->getValue('timezone'));
}
if (!$session_started) {
SessionCache::init();
}
$this->view_mgr = new ViewManager();
$this->facebook = new Facebook\Facebook(['app_id' => $config->getValue('fb_app_id'), 'app_secret' => $config->getValue('fb_app_secret'), 'default_graph_version' => 'v2.2']);
if ($this->isLoggedIn()) {
$this->addToView('logged_in_user', $this->getLoggedInUser());
}
if ($this->isSuperAdmin()) {
$this->addToView('user_is_admin', true);
}
$EFC_VERSION = $config->getValue('EFC_VERSION');
$this->addToView('EFC_VERSION', $EFC_VERSION);
if (Utils::isEmpoddyLabs()) {
$empoddy_endpoint = $config->getValue('empoddy_endpoint');
$this->addToView('empoddy_endpoint', $empoddy_endpoint);
}
if (SessionCache::isKeySet('selected_instance_network') && SessionCache::isKeySet('selected_instance_username')) {
$this->addToView('selected_instance_network', SessionCache::get('selected_instance_network'));
$this->addToView('selected_instance_username', SessionCache::get('selected_instance_username'));
}
} catch (Exception $e) {
Loader::definePathConstants();
//echo 'sending this to Smarty:'.EFC_WEBAPP_PATH.'data/';
$cfg_array = array('site_root_path' => Utils::getSiteRootPathFromFileSystem(), 'source_root_path' => EFC_ROOT_PATH, 'datadir_path' => EFC_WEBAPP_PATH . 'data/', 'debug' => false, 'app_title_prefix' => "", 'cache_pages' => false);
$this->view_mgr = new ViewManager($cfg_array);
$this->setErrorTemplateState();
$this->addToView('error_type', get_class($e));
$disable_xss = false;
// if we are an installer exception, don't filter XSS, we have markup, and we trust this content
if (get_class($e) == 'InstallerException') {
$disable_xss = true;
}
$this->addErrorMessage($e->getMessage(), null, $disable_xss);
}
}