本文整理汇总了PHP中AppContext::set_session方法的典型用法代码示例。如果您正苦于以下问题:PHP AppContext::set_session方法的具体用法?PHP AppContext::set_session怎么用?PHP AppContext::set_session使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppContext
的用法示例。
在下文中一共展示了AppContext::set_session方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: change_password
private function change_password($user_id, $change_password_pass, $password)
{
PHPBoostAuthenticationMethod::update_auth_infos($user_id, null, null, KeyGenerator::string_hash($password), null, '');
$session = AppContext::get_session();
if ($session != null) {
Session::delete($session);
}
AppContext::set_session(Session::create($user_id, true));
AppContext::get_response()->redirect(Environment::get_home_page());
}
示例2: authenticate
/**
* @desc Tries to authenticate the user using the given authentication method.
* @param AuthenticationMethod $authentication the authentication method to use
* @param bool $autoconnect If true, an autoconnect cookie will be created
* @return int $user_id, if authentication has been performed successfully
*/
public static function authenticate(AuthenticationMethod $authentication, $autoconnect = false)
{
$user_id = $authentication->authenticate();
if ($user_id) {
$session = AppContext::get_session();
if ($session != null) {
Session::delete($session);
}
$session_data = Session::create($user_id, $autoconnect);
AppContext::set_session($session_data);
}
return $user_id;
}
示例3: init
public static function init()
{
Debug::enabled_current_script_debug();
Debug::set_plain_text_output_mode();
set_exception_handler(array('Debug', 'fatal'));
self::setup_server_env();
self::fit_to_php_configuration();
self::load_static_constants();
self::load_dynamic_constants();
AppContext::set_request(new HTTPRequestCustom());
AppContext::set_session(SessionData::admin_session());
AppContext::set_current_user(new AdminUser());
AppContext::init_extension_provider_service();
AppContext::set_response(new HTTPResponseCustom());
}
示例4: check_activation
private function check_activation($registration_pass)
{
$user_id = PHPBoostAuthenticationMethod::registration_pass_exists($registration_pass);
if ($user_id) {
PHPBoostAuthenticationMethod::update_auth_infos($user_id, null, true, null, '');
$session = AppContext::get_session();
if ($session != null) {
Session::delete($session);
}
AppContext::set_session(Session::create($user_id, true));
AppContext::get_response()->redirect(Environment::get_home_page());
} else {
$controller = new UserErrorController($this->lang['profile'], LangLoader::get_message('process.error', 'status-messages-common'), UserErrorController::WARNING);
DispatchManager::redirect($controller);
}
}
示例5: confirm_registration
private function confirm_registration($user_id)
{
if ($this->user_accounts_config->get_member_accounts_validation_method() == UserAccountsConfig::MAIL_USER_ACCOUNTS_VALIDATION) {
$this->tpl->put('MSG', MessageHelper::display($this->lang['registration.success.mail-validation'], MessageHelper::SUCCESS));
} elseif ($this->user_accounts_config->get_member_accounts_validation_method() == UserAccountsConfig::ADMINISTRATOR_USER_ACCOUNTS_VALIDATION) {
$this->tpl->put('MSG', MessageHelper::display($this->lang['registration.success.administrator-validation'], MessageHelper::SUCCESS));
} else {
$session = AppContext::get_session();
if ($session != null) {
Session::delete($session);
}
AppContext::set_session(Session::create($user_id, true));
AppContext::get_response()->redirect(Environment::get_home_page());
}
}
示例6: connect_admin
private function connect_admin($user_id, $auto_connect)
{
$session = Session::create($user_id, $auto_connect);
AppContext::set_session($session);
}
示例7: init_admin_role
private static function init_admin_role()
{
AppContext::set_session(new AdminSessionData());
AppContext::set_current_user(new AdminUser());
}
示例8: init_session
public static function init_session()
{
Session::gc();
$session_data = Session::start();
AppContext::set_session($session_data);
AppContext::init_current_user();
$current_user = AppContext::get_current_user();
$user_accounts_config = UserAccountsConfig::load();
$user_theme = ThemesManager::get_theme($current_user->get_theme());
$default_theme = $user_accounts_config->get_default_theme();
if ($user_theme === null || (!$user_theme->check_auth() || !$user_theme->is_activated()) && $user_theme->get_id() !== $default_theme) {
AppContext::get_current_user()->update_theme($default_theme);
}
$user_lang = LangsManager::get_lang($current_user->get_locale());
$default_lang = $user_accounts_config->get_default_lang();
if ($user_lang === null || (!$user_lang->check_auth() || !$user_lang->is_activated()) && $user_lang->get_id() !== $default_lang) {
AppContext::get_current_user()->update_lang($default_lang);
}
}
示例9: define
<?php
define('PATH_TO_ROOT', '..');
define('DEBUG', TRUE);
require_once PATH_TO_ROOT . '/kernel/framework/core/environment/Environment.class.php';
Environment::load_imports();
Environment::load_static_constants();
AppContext::set_request(new HTTPRequestCustom());
Session::gc();
$session_data = Session::start();
AppContext::set_session($session_data);
AppContext::init_current_user();
require_once PATH_TO_ROOT . '/test/PHPUnit/Framework.php';
if (isset($argv)) {
array_shift($argv);
$_REQUEST['params'] = implode(' ', $argv);
$_REQUEST['is_html'] = false;
}
if (!empty($_REQUEST['params'])) {
// Fake command line environment
$argv = $_REQUEST['params'];
$_SERVER['argv'] = explode(' ', '--configuration ./phpunit.cfg.xml ' . $argv);
} else {
$_SERVER['argv'] = array();
}
$is_html = isset($_REQUEST['is_html']) && $_REQUEST['is_html'] == true;
if (!$is_html) {
echo '<pre>';
}
//Debug::dump($_SERVER['argv']);
require_once PATH_TO_ROOT . '/test/phpunit.php';