本文整理汇总了PHP中PHPBoostErrors类的典型用法代码示例。如果您正苦于以下问题:PHP PHPBoostErrors类的具体用法?PHP PHPBoostErrors怎么用?PHP PHPBoostErrors使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PHPBoostErrors类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
}
示例2: 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']);
}
示例3: check_authorizations
private function check_authorizations()
{
if (!NewsletterAuthorizationsService::check_authorizations()->subscribe()) {
$error_controller = PHPBoostErrors::user_not_authorized();
DispatchManager::redirect($error_controller);
}
}
示例4: 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);
}
}
示例5: check_authorizations
private function check_authorizations()
{
if (!BugtrackerAuthorizationsService::check_authorizations()->read()) {
$error_controller = PHPBoostErrors::user_not_authorized();
DispatchManager::redirect($error_controller);
}
}
示例6: 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);
}
示例7: 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);
}
示例8: 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);
}
}
示例9: 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;
}
示例10: 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);
}
}
示例11: 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);
}
}
示例12: 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;
}
示例13: 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);
}
}
}
示例14: get_right_controller_regarding_authorizations
public final function get_right_controller_regarding_authorizations()
{
if (ModulesManager::is_module_installed(Environment::get_running_module_name())) {
$module = ModulesManager::get_module(Environment::get_running_module_name());
if (!$module->is_activated()) {
return PHPBoostErrors::module_not_activated();
}
} else {
return PHPBoostErrors::module_not_installed();
}
return $this;
}
示例15: execute
public function execute(HTTPRequestCustom $request)
{
$this->init();
$user_id = $request->get_getint('user_id', AppContext::get_current_user()->get_id());
try {
$this->user_infos = PersistenceContext::get_querier()->select_single_row(PREFIX . 'member', array('*'), 'WHERE user_id=:user_id', array('user_id' => $user_id));
} catch (RowNotFoundException $e) {
$error_controller = PHPBoostErrors::unexisting_element();
DispatchManager::redirect($error_controller);
}
$this->build_form($this->user_infos['user_id']);
$this->tpl->put('FORM', $this->form->display());
return $this->build_response($this->tpl, $user_id);
}