本文整理汇总了PHP中AppContext::get_response方法的典型用法代码示例。如果您正苦于以下问题:PHP AppContext::get_response方法的具体用法?PHP AppContext::get_response怎么用?PHP AppContext::get_response使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppContext
的用法示例。
在下文中一共展示了AppContext::get_response方法的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: execute
public function execute(HTTPRequestCustom $request)
{
$this->init();
$this->build_form();
$this->tpl = new StringTemplate('
# INCLUDE MSG #
# INCLUDE FORM #
<script>
<!--
jQuery(document).ready(function() {
' . $this->get_events_select_type() . '
});
-->
</script>');
$this->tpl->add_lang($this->lang);
if ($this->submit_button->has_been_submited() && $this->form->validate()) {
$extended_field = $this->save();
$error = ExtendedFieldsService::get_error();
if (!empty($error)) {
$this->tpl->put('MSG', MessageHelper::display($error, MessageHelper::ERROR, 5));
} else {
AppContext::get_response()->redirect(AdminExtendedFieldsUrlBuilder::fields_list(), StringVars::replace_vars($this->lang['message.success.add'], array('name' => $extended_field->get_name())));
}
}
$this->tpl->put('FORM', $this->form->display());
return new AdminExtendedFieldsDisplayResponse($this->tpl, $this->lang['extended-field-add']);
}
示例3: get_right_controller_regarding_authorizations
public function get_right_controller_regarding_authorizations()
{
if (AppContext::get_current_user()->check_level(User::MEMBER_LEVEL)) {
AppContext::get_response()->redirect(Environment::get_home_page());
}
return $this;
}
示例4: execute
public function execute(HTTPRequestCustom $request)
{
$this->load_lang();
$this->load_config();
$theme = $request->get_value('theme', 'all');
if ($theme !== 'all' && !ThemesManager::get_theme_existed($theme)) {
AppContext::get_response()->redirect(AdminCustomizeUrlBuilder::customize_interface());
}
$this->build_form($theme);
$tpl = new StringTemplate('# INCLUDE MSG # # INCLUDE FORM #');
$tpl->add_lang($this->lang);
if ($this->submit_button->has_been_submited() && $this->form->validate()) {
$header_logo = $this->form->get_value('header_logo', null);
if ($header_logo !== null) {
$file_type = new FileType(new File($header_logo->get_name()));
if ($file_type->is_picture()) {
$this->save($header_logo, $theme);
AppContext::get_response()->redirect(AdminCustomizeUrlBuilder::customize_interface());
} else {
$tpl->put('MSG', MessageHelper::display(LangLoader::get_message('process.error', 'status-messages-common'), MessageHelper::ERROR, 4));
}
} elseif ($this->form->get_value('use_default_logo')) {
$this->delete_pictures_saved($theme);
AppContext::get_response()->redirect(AdminCustomizeUrlBuilder::customize_interface());
} else {
$tpl->put('MSG', MessageHelper::display(LangLoader::get_message('process.error', 'status-messages-common'), MessageHelper::ERROR, 4));
}
}
$tpl->put('FORM', $this->form->display());
return new AdminCustomizationDisplayResponse($tpl, $this->lang['customization.interface']);
}
示例5: execute
public function execute(HTTPRequestCustom $request)
{
$id = $request->get_getint('id');
$this->init();
$extended_field = new ExtendedField();
$extended_field->set_id($id);
$exist_field = ExtendedFieldsDatabaseService::check_field_exist_by_id($extended_field);
if ($exist_field) {
$this->extended_field = ExtendedFieldsCache::load()->get_extended_field($id);
$this->build_form($request);
} else {
$error_controller = PHPBoostErrors::unexisting_page();
DispatchManager::redirect($error_controller);
}
$this->tpl = new StringTemplate('# INCLUDE MSG #
# INCLUDE FORM #
<script>
jQuery(document).ready(function() {
' . $this->get_events_select_type() . '});
</script>');
$this->tpl->add_lang($this->lang);
$this->tpl->put_all(array('FIELD_TYPE' => $this->extended_field['field_type']));
if ($this->submit_button->has_been_submited() && $this->form->validate()) {
$extended_field = $this->save($id);
$error = ExtendedFieldsService::get_error();
if (!empty($error)) {
$this->tpl->put('MSG', MessageHelper::display($error, MessageHelper::ERROR, 5));
} else {
AppContext::get_response()->redirect($this->form->get_value('referrer') ? $this->form->get_value('referrer') : AdminExtendedFieldsUrlBuilder::fields_list(), StringVars::replace_vars($this->lang['message.success.edit'], array('name' => $extended_field->get_name())));
}
}
$this->tpl->put('FORM', $this->form->display());
return new AdminExtendedFieldsDisplayResponse($this->tpl, $this->lang['extended-field-edit']);
}
示例6: execute
public function execute(HTTPRequestCustom $request)
{
$id = $request->get_getint('id', 0);
if (!empty($id)) {
try {
$this->weblink = WebService::get_weblink('WHERE web.id = :id', array('id' => $id));
} catch (RowNotFoundException $e) {
$error_controller = PHPBoostErrors::unexisting_page();
DispatchManager::redirect($error_controller);
}
}
if ($this->weblink !== null && !DownloadAuthorizationsService::check_authorizations($this->weblink->get_id_category())->read()) {
$error_controller = PHPBoostErrors::user_not_authorized();
DispatchManager::redirect($error_controller);
} else {
if ($this->weblink !== null && $this->weblink->is_visible()) {
$this->weblink->set_number_views($this->weblink->get_number_views() + 1);
WebService::update_number_views($this->weblink);
WebCache::invalidate();
AppContext::get_response()->redirect($this->weblink->get_url()->absolute());
} else {
$error_controller = PHPBoostErrors::unexisting_page();
DispatchManager::redirect($error_controller);
}
}
}
示例7: execute
public function execute(HTTPRequestCustom $request)
{
$module_id = $request->get_getstring('module_id', '');
if (empty($module_id)) {
AppContext::get_response()->redirect(Environment::get_home_page());
}
$this->init();
$module_category_id = $request->get_getint('module_category_id', 0);
$feed_name = $request->get_getstring('feed_name', Feed::DEFAULT_FEED_NAME);
$feed = new ATOM($module_id, $feed_name, $module_category_id);
if ($feed !== null && $feed->is_in_cache()) {
$this->tpl->put('SYNDICATION', $feed->read());
} else {
$eps = AppContext::get_extension_provider_service();
if ($eps->provider_exists($module_id, FeedProvider::EXTENSION_POINT)) {
$provider = $eps->get_provider($module_id);
$feeds = $provider->feeds();
$data = $feeds->get_feed_data_struct($module_category_id, $feed_name);
if ($data === null) {
AppContext::get_response()->set_header('content-type', 'text/html');
DispatchManager::redirect(PHPBoostErrors::unexisting_element());
} else {
$feed->load_data($data);
$feed->cache();
$this->tpl->put('SYNDICATION', $feed->export());
}
} else {
DispatchManager::redirect(PHPBoostErrors::module_not_installed());
}
}
return $this->build_response($this->tpl);
}
示例8: execute
function execute(HTTPRequestCustom $request)
{
// Define template
$this->views = new FileTemplate('wpimport/import.tpl');
// Load lang
$this->lang = LangLoader::get('common', 'wpimport');
// Add lang
$this->views->add_lang($this->lang);
// Build Form
$this->build_form();
// Add Form to template
$this->views->put('FORM', $this->form->display());
// Check max_execution_time
$maxExecutionTime = ini_get('max_execution_time');
$this->views->put('CAN_SET_EXECUTION_TIME', false);
$this->views->put('MAX_EXECUTION_TIME', $maxExecutionTime);
@ini_set('max_execution_time', 0);
if (ini_get('max_execution_time') == 0) {
$this->views->put('CAN_SET_EXECUTION_TIME', true);
}
if ($this->submit_button->has_been_submited() && $this->form->validate()) {
$importer = array();
$listImporter = self::listImporters();
foreach ($listImporter as $i) {
if ($this->form->get_field_by_id('importer_' . $i['name'])->get_value()) {
$importer[] = $i['name'];
}
}
session_start();
$_SESSION['wpimport'] = array('phpboostpath' => $this->form->get_field_by_id('phpboostpath')->get_value(), 'wppath' => $this->form->get_field_by_id('wppath')->get_value(), 'default_author' => $this->form->get_field_by_id('default_author')->get_value(), 'default_cat_image' => $this->form->get_field_by_id('default_cat_image')->get_value(), 'import_location' => $this->form->get_field_by_id('import_location')->get_value(), 'importer' => implode(',', $importer));
AppContext::get_response()->redirect(DispatchManager::get_url('../wpimport', '/admin/import/start'));
}
return $this->build_response();
}
示例9: save
private function save(HTTPRequestCustom $request)
{
$installed_modules = ModulesManager::get_installed_modules_map();
foreach ($installed_modules as $module) {
if ($request->get_string('delete-' . $module->get_id(), '')) {
AppContext::get_response()->redirect(AdminModulesUrlBuilder::delete_module($module->get_id()));
}
}
if ($request->get_bool('update', false)) {
$errors = array();
foreach ($installed_modules as $module) {
$module_id = $module->get_id();
$activated = $request->get_bool('activated-' . $module_id, false);
$error = ModulesManager::update_module($module_id, $activated);
if (!empty($error)) {
$errors[$module->get_configuration()->get_name()] = $error;
}
}
if (empty($errors)) {
AppContext::get_response()->redirect(AdminModulesUrlBuilder::list_installed_modules());
} else {
foreach ($errors as $module_name => $error) {
$this->view->assign_block_vars('errors', array('MSG' => MessageHelper::display($module_name . ' : ' . $error, MessageHelper::WARNING, 10)));
}
}
}
}
示例10: __construct
public function __construct(Exception $exception)
{
$this->exception = $exception;
$this->type = get_class($this->exception);
$this->message = str_replace("\n", "<br />", $this->exception->getMessage());
$this->ob_content = AppContext::get_response()->get_previous_ob_content();
}
示例11: 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
示例12: __static
public static function __static()
{
$config = SessionsConfig::load();
self::$DATA_COOKIE_NAME = $config->get_cookie_name() . '_data';
self::$AUTOCONNECT_COOKIE_NAME = $config->get_cookie_name() . '_autoconnect';
self::$request = AppContext::get_request();
self::$response = AppContext::get_response();
}
示例13: 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())));
}
示例14: execute
public function execute(HTTPRequestCustom $request)
{
$id = $request->get_getint('id', 0);
PersistenceContext::get_querier()->delete(DB_TABLE_SMILEYS, 'WHERE idsmiley = :id', array('id' => $id));
###### Régénération du cache des smileys #######
SmileysCache::invalidate();
AppContext::get_response()->redirect(AdminSmileysUrlBuilder::management());
}
示例15: 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'));
}