本文整理汇总了PHP中AppContext::get_session方法的典型用法代码示例。如果您正苦于以下问题:PHP AppContext::get_session方法的具体用法?PHP AppContext::get_session怎么用?PHP AppContext::get_session使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppContext
的用法示例。
在下文中一共展示了AppContext::get_session方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute(HTTPRequestCustom $request)
{
AppContext::get_session()->no_session_location();
AppContext::get_response()->set_status_code(404);
AdminError404Service::register_404();
return parent::execute($request);
}
示例2: menu_admin_link
function menu_admin_link($menu, $mode)
{
$link = '';
switch ($mode) {
case 'edit':
if ($menu instanceof LinksMenu) {
$link = 'links.php?';
} elseif ($menu instanceof ContentMenu) {
$link = 'content.php?';
} elseif ($menu instanceof FeedMenu) {
$link = 'feed.php?';
} else {
$link = 'auth.php?';
}
break;
case 'delete':
if ($menu instanceof ContentMenu || $menu instanceof LinksMenu || $menu instanceof FeedMenu) {
$link = 'menus.php?action=delete&';
} else {
return '';
}
break;
case 'up':
$link = 'menus.php?action=up&';
break;
case 'down':
$link = 'menus.php?action=down&';
break;
}
return $link . 'id=' . $menu->get_id() . '&token=' . AppContext::get_session()->get_token();
}
示例3: execute
public function execute(HTTPRequestCustom $request)
{
AppContext::get_session()->csrf_get_protect();
$config = BugtrackerConfig::load();
$parameter = $request->get_string('parameter', '');
if (in_array($parameter, array('type', 'category', 'severity', 'priority', 'version'))) {
switch ($parameter) {
case 'type':
$config->set_default_type(0);
break;
case 'category':
$config->set_default_category(0);
break;
case 'severity':
$config->set_default_severity(0);
break;
case 'priority':
$config->set_default_priority(0);
break;
case 'version':
$config->set_default_version(0);
break;
}
BugtrackerConfig::save();
AppContext::get_response()->redirect(BugtrackerUrlBuilder::configuration());
} else {
$controller = new UserErrorController(LangLoader::get_message('error', 'status-messages-common'), LangLoader::get_message('error.e_unexist_parameter', 'common', 'bugtracker'));
$controller->set_response_classname(UserErrorController::ADMIN_RESPONSE);
DispatchManager::redirect($controller);
}
}
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:31,代码来源:AdminBugtrackerDeleteDefaultParameterController.class.php
示例4: execute
public function execute(HTTPRequestCustom $request)
{
AppContext::get_session()->csrf_get_protect();
$message = $this->get_message($request);
$this->check_authorizations($message);
ShoutboxService::delete('WHERE id=:id', array('id' => $message->get_id()));
AppContext::get_response()->redirect($request->get_url_referrer() ? $request->get_url_referrer() : ShoutboxUrlBuilder::home(), LangLoader::get_message('shoutbox.message.success.delete', 'common', 'shoutbox'));
}
示例5: execute
public function execute(HTTPRequestCustom $request)
{
AppContext::get_session()->csrf_get_protect();
$question = $this->get_faq_question($request);
$this->check_authorizations($question);
$this->delete_question($question);
AppContext::get_response()->redirect($request->get_url_referrer() ? $request->get_url_referrer() : FaqUrlBuilder::home(), StringVars::replace_vars(LangLoader::get_message('faq.message.success.delete', 'common', 'faq'), array('question' => $question->get_question())));
}
示例6: delete_question
private function delete_question()
{
AppContext::get_session()->csrf_post_protect();
FaqService::delete('WHERE id=:id', array('id' => $this->faq_question->get_id()));
PersistenceContext::get_querier()->delete(DB_TABLE_EVENTS, 'WHERE module=:module AND id_in_module=:id', array('module' => 'faq', 'id' => $this->faq_question->get_id()));
Feed::clear_cache('faq');
FaqCache::invalidate();
}
示例7: 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());
}
示例8: execute
public function execute(HTTPRequestCustom $request)
{
AppContext::get_session()->csrf_get_protect();
$file_path = PATH_TO_ROOT . '/cache/error.log';
$error_log_file = new File($file_path);
try {
$error_log_file->delete();
} catch (IOException $exception) {
echo $exception->getMessage();
}
AppContext::get_response()->redirect(AdminErrorsUrlBuilder::logged_errors());
}
示例9: execute
public function execute(HTTPRequestCustom $request)
{
AppContext::get_session()->csrf_get_protect();
$this->init($request);
$this->check_authorizations();
$this->build_form($request);
if ($this->submit_button->has_been_submited() && $this->form->validate()) {
$this->save();
AppContext::get_response()->redirect($this->form->get_value('referrer') ? $this->form->get_value('referrer') : BugtrackerUrlBuilder::unsolved(), StringVars::replace_vars(LangLoader::get_message('success.delete', 'common', 'bugtracker'), array('id' => $this->bug->get_id())));
}
$this->view->put('FORM', $this->form->display());
return $this->build_response($this->view);
}
示例10: 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;
}
示例11: display
public function display($tpl = false)
{
global $LANG;
if (!Url::is_current_url('/user/login')) {
$tpl = new FileTemplate('connect/connect_mini.tpl');
$user = AppContext::get_current_user();
MenuService::assign_positions_conditions($tpl, $this->get_block());
if ($user->check_level(User::MEMBER_LEVEL)) {
$unread_contributions = UnreadContributionsCache::load();
//Vaut 0 si l'utilisateur n'a aucune contribution. Est > 0 si on connait le nombre de contributions
//Vaut -1 si l'utilisateur a au moins une contribution (mais on ne sait pas combien à cause des recoupements entre les groupes)
$contribution_number = 0;
if ($user->check_level(User::ADMIN_LEVEL)) {
$contribution_number = $unread_contributions->get_admin_unread_contributions_number();
} elseif ($user->check_level(User::MODERATOR_LEVEL)) {
if ($unread_contributions->have_moderators_unread_contributions()) {
$contribution_number = -1;
}
} else {
if ($unread_contributions->have_members_unread_contributions()) {
$contribution_number = -1;
} else {
if ($unread_contributions->has_user_unread_contributions($user->get_id())) {
$contribution_number = -1;
} else {
foreach ($user->get_groups() as $group_id) {
if ($unread_contributions->has_group_unread_contributions($group_id)) {
$contribution_number = -1;
break;
}
}
}
}
}
$user_accounts_config = UserAccountsConfig::load();
$user_avatar = AppContext::get_session()->get_cached_data('user_avatar');
if (empty($user_avatar)) {
$user_avatar = '/templates/' . AppContext::get_current_user()->get_theme() . '/images/' . $user_accounts_config->get_default_avatar_name();
}
$total_alert = $user->get_unread_pm() + $contribution_number + ($user->check_level(User::ADMIN_LEVEL) ? AdministratorAlertService::get_number_unread_alerts() : 0);
$user_group_color = User::get_group_color($user->get_groups(), $user->get_level(), true);
$tpl->put_all(array('C_ADMIN_AUTH' => $user->check_level(User::ADMIN_LEVEL), 'C_MODERATOR_AUTH' => $user->check_level(User::MODERATOR_LEVEL), 'C_UNREAD_CONTRIBUTION' => $contribution_number != 0, 'C_KNOWN_NUMBER_OF_UNREAD_CONTRIBUTION' => $contribution_number > 0, 'C_UNREAD_ALERT' => (bool) AdministratorAlertService::get_number_unread_alerts(), 'C_HAS_PM' => $user->get_unread_pm() > 0, 'C_USER_GROUP_COLOR' => !empty($user_group_color), 'NUMBER_UNREAD_CONTRIBUTIONS' => $contribution_number, 'NUMBER_UNREAD_ALERTS' => AdministratorAlertService::get_number_unread_alerts(), 'NUMBER_PM' => $user->get_unread_pm(), 'NUMBER_TOTAL_ALERT' => $total_alert, 'PSEUDO' => $user->get_display_name(), 'USER_LEVEL_CLASS' => UserService::get_level_class($user->get_level()), 'USER_GROUP_COLOR' => $user_group_color, 'U_USER_PROFILE' => UserUrlBuilder::profile($user->get_id())->rel(), 'U_USER_PM' => UserUrlBuilder::personnal_message($user->get_id())->rel(), 'U_AVATAR_IMG' => Url::to_rel($user_avatar), 'L_NBR_PM' => $user->get_unread_pm() > 0 ? $user->get_unread_pm() . ' ' . ($user->get_unread_pm() > 1 ? $LANG['message_s'] : $LANG['message']) : $LANG['private_messaging'], 'L_PROFIL' => LangLoader::get_message('profile', 'user-common'), 'L_ADMIN_PANEL' => $LANG['admin_panel'], 'L_MODO_PANEL' => $LANG['modo_panel'], 'L_PRIVATE_PROFIL' => $LANG['my_private_profile'], 'L_DISCONNECT' => LangLoader::get_message('disconnect', 'user-common'), 'L_CONTRIBUTION_PANEL' => $LANG['contribution_panel']));
} else {
$authentication_config = AuthenticationConfig::load();
$tpl->put_all(array('C_USER_NOTCONNECTED' => true, 'C_USER_REGISTER' => UserAccountsConfig::load()->is_registration_enabled(), 'C_FB_AUTH_ENABLED' => $authentication_config->is_fb_auth_available(), 'C_GOOGLE_AUTH_ENABLED' => $authentication_config->is_google_auth_available(), 'L_REQUIRE_PSEUDO' => $LANG['require_pseudo'], 'L_REQUIRE_PASSWORD' => $LANG['require_password'], 'L_CONNECT' => LangLoader::get_message('connection', 'user-common'), 'L_PSEUDO' => LangLoader::get_message('login', 'user-common'), 'L_PASSWORD' => LangLoader::get_message('password', 'user-common'), 'L_AUTOCONNECT' => LangLoader::get_message('autoconnect', 'user-common'), 'L_FORGOT_PASS' => LangLoader::get_message('forget-password', 'user-common'), 'L_REGISTER' => LangLoader::get_message('register', 'user-common'), 'U_CONNECT' => UserUrlBuilder::connect()->rel(), 'SITE_REWRITED_SCRIPT' => substr(REWRITED_SCRIPT, strlen(GeneralConfig::load()->get_site_path()))));
}
return $tpl->render();
}
return '';
}
示例12: execute
public function execute(HTTPRequestCustom $request)
{
AppContext::get_session()->csrf_get_protect();
$this->get_downloadfile($request);
$this->check_authorizations();
DownloadService::delete('WHERE id=:id', array('id' => $this->downloadfile->get_id()));
DownloadService::get_keywords_manager()->delete_relations($this->downloadfile->get_id());
PersistenceContext::get_querier()->delete(DB_TABLE_EVENTS, 'WHERE module=:module AND id_in_module=:id', array('module' => 'download', 'id' => $this->downloadfile->get_id()));
CommentsService::delete_comments_topic_module('download', $this->downloadfile->get_id());
NotationService::delete_notes_id_in_module('download', $this->downloadfile->get_id());
Feed::clear_cache('download');
DownloadCache::invalidate();
AppContext::get_response()->redirect($request->get_url_referrer() ? $request->get_url_referrer() : DownloadUrlBuilder::home(), StringVars::replace_vars(LangLoader::get_message('download.message.success.delete', 'common', 'download'), array('name' => $this->downloadfile->get_name())));
}
示例13: 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);
}
}
示例14: execute
public function execute(HTTPRequestCustom $request)
{
AppContext::get_session()->csrf_get_protect();
$this->init();
$this->get_event($request);
$this->check_authorizations();
$tpl = new StringTemplate('# INCLUDE FORM #');
$tpl->add_lang($this->lang);
if ($this->event->belongs_to_a_serie()) {
$this->build_form($request);
}
if ($this->event->belongs_to_a_serie() && $this->submit_button->has_been_submited() && $this->form->validate() || !$this->event->belongs_to_a_serie()) {
$this->delete_event($this->event->belongs_to_a_serie() ? $this->form->get_value('delete_serie')->get_raw_value() : false);
$this->redirect($request);
}
$tpl->put('FORM', $this->form->display());
return $this->generate_response($tpl);
}
示例15: execute
public function execute(HTTPRequestCustom $request)
{
AppContext::get_session()->csrf_get_protect();
$news = $this->get_news($request);
if (!$news->is_authorized_to_delete()) {
$error_controller = PHPBoostErrors::user_not_authorized();
DispatchManager::redirect($error_controller);
}
if (AppContext::get_current_user()->is_readonly()) {
$controller = PHPBoostErrors::user_in_read_only();
DispatchManager::redirect($controller);
}
NewsService::delete('WHERE id=:id', array('id' => $news->get_id()));
NewsService::get_keywords_manager()->delete_relations($news->get_id());
PersistenceContext::get_querier()->delete(DB_TABLE_EVENTS, 'WHERE module=:module AND id_in_module=:id', array('module' => 'news', 'id' => $news->get_id()));
CommentsService::delete_comments_topic_module('news', $news->get_id());
Feed::clear_cache('news');
AppContext::get_response()->redirect($request->get_url_referrer() ? $request->get_url_referrer() : NewsUrlBuilder::home(), StringVars::replace_vars(LangLoader::get_message('news.message.success.delete', 'common', 'news'), array('name' => $news->get_name())));
}