private function get_weblink() { if ($this->weblink === null) { $this->weblink = WebService::get_weblink('WHERE web.id=:id', array('id' => $this->get_id_in_module())); } return $this->weblink; }
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); } } }
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->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 && $this->weblink->is_visible()) { if (!PersistenceContext::get_querier()->row_exists(PREFIX . 'events', 'WHERE id_in_module=:id_in_module AND module=\'web\' AND current_status = 0', array('id_in_module' => $this->weblink->get_id()))) { $contribution = new Contribution(); $contribution->set_id_in_module($this->weblink->get_id()); $contribution->set_entitled(StringVars::replace_vars(LangLoader::get_message('contribution.deadlink', 'common'), array('link_name' => $this->weblink->get_name()))); $contribution->set_fixing_url(WebUrlBuilder::edit($this->weblink->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('web'); $contribution->set_type('alert'); $contribution->set_auth(Authorizations::capture_and_shift_bit_auth(WebService::get_categories_manager()->get_heritated_authorizations($this->weblink->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); } }
private function get_weblink(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); } } }
private function get_weblink() { if ($this->weblink === null) { $id = AppContext::get_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); } } else { $this->weblink = new WebLink(); } } return $this->weblink; }
private function get_weblink() { if ($this->weblink === null) { $id = AppContext::get_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); } } else { $this->is_new_weblink = true; $this->weblink = new WebLink(); $this->weblink->init_default_properties(AppContext::get_request()->get_getint('id_category', Category::ROOT_CATEGORY)); } } return $this->weblink; }