当前位置: 首页>>代码示例>>PHP>>正文


PHP DispatchManager::redirect方法代码示例

本文整理汇总了PHP中DispatchManager::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP DispatchManager::redirect方法的具体用法?PHP DispatchManager::redirect怎么用?PHP DispatchManager::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DispatchManager的用法示例。


在下文中一共展示了DispatchManager::redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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);
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:32,代码来源:DisplayAtomSyndicationController.class.php

示例2: execute

 public function execute(HTTPRequestCustom $request)
 {
     $id = $request->get_getint('id', 0);
     if (!empty($id) && AppContext::get_current_user()->check_level(User::MEMBER_LEVEL)) {
         try {
             $this->downloadfile = DownloadService::get_downloadfile('WHERE download.id = :id', array('id' => $id));
         } catch (RowNotFoundException $e) {
             $error_controller = PHPBoostErrors::unexisting_page();
             DispatchManager::redirect($error_controller);
         }
     }
     if ($this->downloadfile !== null && $this->downloadfile->is_visible()) {
         if (!PersistenceContext::get_querier()->row_exists(PREFIX . 'events', 'WHERE id_in_module=:id_in_module AND module=\'download\' AND current_status = 0', array('id_in_module' => $this->downloadfile->get_id()))) {
             $contribution = new Contribution();
             $contribution->set_id_in_module($this->downloadfile->get_id());
             $contribution->set_entitled(StringVars::replace_vars(LangLoader::get_message('contribution.deadlink', 'common'), array('link_name' => $this->downloadfile->get_name())));
             $contribution->set_fixing_url(DownloadUrlBuilder::edit($this->downloadfile->get_id())->relative());
             $contribution->set_description(LangLoader::get_message('contribution.deadlink_explain', 'common'));
             $contribution->set_poster_id(AppContext::get_current_user()->get_id());
             $contribution->set_module('download');
             $contribution->set_type('alert');
             $contribution->set_auth(Authorizations::capture_and_shift_bit_auth(DownloadService::get_categories_manager()->get_heritated_authorizations($this->downloadfile->get_id_category(), Category::MODERATION_AUTHORIZATIONS, Authorizations::AUTH_CHILD_PRIORITY), Category::MODERATION_AUTHORIZATIONS, Contribution::CONTRIBUTION_AUTH_BIT));
             ContributionService::save_contribution($contribution);
         }
         DispatchManager::redirect(new UserContributionSuccessController());
     } else {
         $error_controller = PHPBoostErrors::unexisting_page();
         DispatchManager::redirect($error_controller);
     }
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:30,代码来源:DownloadDeadLinkController.class.php

示例3: 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);
         }
     }
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:26,代码来源:WebVisitWebLinkController.class.php

示例4: check_authorizations

 private function check_authorizations()
 {
     if (!BugtrackerAuthorizationsService::check_authorizations()->read()) {
         $error_controller = PHPBoostErrors::user_not_authorized();
         DispatchManager::redirect($error_controller);
     }
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:7,代码来源:BugtrackerStatsListController.class.php

示例5: execute

 public function execute(HTTPRequestCustom $request)
 {
     $id = $request->get_int('id', 0);
     $id_stream = $request->get_int('id_stream', 0);
     $db_querier = PersistenceContext::get_querier();
     if ($this->subscriber_exist($id) || $id_stream !== 0 && $id !== 0) {
         if (!NewsletterAuthorizationsService::id_stream($id_stream)->moderation_subscribers()) {
             NewsletterAuthorizationsService::get_errors()->moderation_subscribers();
         }
         $condition = "WHERE subscriber_id = :id AND stream_id = :id_stream";
         $parameters = array('id' => $id, 'id_stream' => $id_stream);
         $db_querier->delete(NewsletterSetup::$newsletter_table_subscriptions, $condition, $parameters);
         $condition = "WHERE subscriber_id = :id";
         $parameters = array('id' => $id);
         $is_last = PersistenceContext::get_querier()->count(NewsletterSetup::$newsletter_table_subscriptions, $condition, $parameters) == 0;
         if ($is_last) {
             $condition = "WHERE id = :id";
             $parameters = array('id' => $id);
             $db_querier->delete(NewsletterSetup::$newsletter_table_subscribers, $condition, $parameters);
         }
         NewsletterStreamsCache::invalidate();
         $controller = new UserErrorController(LangLoader::get_message('success', 'status-messages-common'), LangLoader::get_message('process.success', 'status-messages-common'), UserErrorController::SUCCESS);
         DispatchManager::redirect($controller);
     } else {
         $controller = new UserErrorController(LangLoader::get_message('error', 'status-messages-common'), LangLoader::get_message('error-subscriber-not-existed', 'common', 'newsletter'));
         DispatchManager::redirect($controller);
     }
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:28,代码来源:NewsletterDeleteSubscriberController.class.php

示例6: check_authorizations

 private function check_authorizations()
 {
     if (!NewsletterAuthorizationsService::check_authorizations()->subscribe()) {
         $error_controller = PHPBoostErrors::user_not_authorized();
         DispatchManager::redirect($error_controller);
     }
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:7,代码来源:NewsletterSubscribeController.class.php

示例7: 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']);
    }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:34,代码来源:AdminExtendedFieldMemberEditController.class.php

示例8: 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

示例9: execute

 public function execute(HTTPRequestCustom $request)
 {
     $this->init();
     if (!$this->user->check_level(User::MEMBER_LEVEL)) {
         $error_controller = PHPBoostErrors::user_not_authorized();
         DispatchManager::redirect($error_controller);
     }
     $this->build_form();
     return $this->build_response($this->tpl);
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:10,代码来源:UserHomeProfileController.class.php

示例10: check_authorizations

 private function check_authorizations()
 {
     if (!BugtrackerAuthorizationsService::check_authorizations()->moderation() && $this->current_user->get_id() != $this->bug->get_assigned_to_id()) {
         $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);
     }
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:11,代码来源:BugtrackerChangeBugStatusController.class.php

示例11: get_pagination

 private function get_pagination($number_users_online)
 {
     $page = AppContext::get_request()->get_getint('page', 1);
     $pagination = new ModulePagination($page, $number_users_online, (int) $this->config->get_number_members_per_page());
     $pagination->set_url(OnlineUrlBuilder::home('%d'));
     if ($pagination->current_page_is_empty() && $page > 1) {
         $error_controller = PHPBoostErrors::unexisting_page();
         DispatchManager::redirect($error_controller);
     }
     return $pagination;
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:11,代码来源:OnlineHomeController.class.php

示例12: check_authorizations

 private function check_authorizations(ShoutboxMessage $message)
 {
     if (!$message->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);
     }
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:11,代码来源:ShoutboxDeleteController.class.php

示例13: check_authorizations

 private function check_authorizations()
 {
     if (!$this->downloadfile->is_authorized_to_delete()) {
         $error_controller = PHPBoostErrors::user_not_authorized();
         DispatchManager::redirect($error_controller);
     }
     if (AppContext::get_current_user()->is_readonly()) {
         $error_controller = PHPBoostErrors::user_in_read_only();
         DispatchManager::redirect($error_controller);
     }
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:11,代码来源:DownloadDeleteController.class.php

示例14: get_pagination

 private function get_pagination()
 {
     $nbr_streams = PersistenceContext::get_querier()->count(NewsletterSetup::$newsletter_table_streams);
     $page = AppContext::get_request()->get_getint('page', 1);
     $pagination = new ModulePagination($page, $nbr_streams, $this->nbr_streams_per_page);
     $pagination->set_url(NewsletterUrlBuilder::home('%d'));
     if ($pagination->current_page_is_empty() && $page > 1) {
         $error_controller = PHPBoostErrors::unexisting_page();
         DispatchManager::redirect($error_controller);
     }
     return $pagination;
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:12,代码来源:NewsletterHomeController.class.php

示例15: get_article

 private function get_article(HTTPRequestCustom $request)
 {
     $id = $request->get_getint('id', 0);
     if (!empty($id)) {
         try {
             return ArticlesService::get_article('WHERE articles.id=:id', array('id' => $id));
         } catch (RowNotFoundException $e) {
             $error_controller = PHPBoostErrors::unexisting_page();
             DispatchManager::redirect($error_controller);
         }
     }
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:12,代码来源:ArticlesDeleteController.class.php


注:本文中的DispatchManager::redirect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。