private function build_form(HTTPRequestCustom $request) { $security_config = SecurityConfig::load(); $form = new HTMLForm(__CLASS__); $fieldset = new FormFieldsetHTML('add_member', LangLoader::get_message('members.add-member', 'admin-user-common')); $form->add_fieldset($fieldset); $fieldset->add_field(new FormFieldTextEditor('display_name', $this->lang['display_name'], '', array('maxlength' => 100, 'required' => true, 'events' => array('blur' => ' if (!HTMLForms.getField("login").getValue() && HTMLForms.getField("display_name").validate() == "") { HTMLForms.getField("login").setValue(HTMLForms.getField("display_name").getValue().replace(/\\s/g, \'\')); HTMLForms.getField("login").enableValidationMessage(); HTMLForms.getField("login").liveValidate(); }')), array(new FormFieldConstraintLengthRange(3, 100), new FormFieldConstraintDisplayNameExists()))); $fieldset->add_field($email = new FormFieldMailEditor('email', $this->lang['email'], '', array('required' => true), array(new FormFieldConstraintMailExist()))); $fieldset->add_field(new FormFieldCheckbox('custom_login', $this->lang['login.custom'], false, array('events' => array('click' => ' if (HTMLForms.getField("custom_login").getValue()) { HTMLForms.getField("login").enable(); } else { HTMLForms.getField("login").disable(); }')))); $fieldset->add_field($login = new FormFieldTextEditor('login', $this->lang['login'], '', array('required' => true, 'hidden' => true, 'maxlength' => 25), array(new FormFieldConstraintLengthRange(3, 25), new FormFieldConstraintPHPBoostAuthLoginExists()))); $fieldset->add_field($password = new FormFieldPasswordEditor('password', $this->lang['password'], '', array('required' => true), array(new FormFieldConstraintLengthMin($security_config->get_internal_password_min_length()), new FormFieldConstraintPasswordStrength()))); $fieldset->add_field($password_bis = new FormFieldPasswordEditor('password_bis', $this->lang['password.confirm'], '', array('required' => true), array(new FormFieldConstraintLengthMin($security_config->get_internal_password_min_length()), new FormFieldConstraintPasswordStrength()))); $form->add_constraint(new FormConstraintFieldsEquality($password, $password_bis)); if ($security_config->are_login_and_email_forbidden_in_password()) { $form->add_constraint(new FormConstraintFieldsInequality($email, $password)); $form->add_constraint(new FormConstraintFieldsInequality($login, $password)); } $fieldset->add_field(new FormFieldRanksSelect('rank', $this->lang['rank'], FormFieldRanksSelect::MEMBER)); $fieldset->add_field(new FormFieldHidden('referrer', $request->get_url_referrer())); $this->submit_button = new FormButtonDefaultSubmit(); $form->add_constraint(new FormConstraintFieldsEquality($password, $password_bis)); $form->add_button($this->submit_button); $form->add_button(new FormButtonReset()); $this->form = $form; }
public function build_view(HTTPRequestCustom $request) { $authorized_categories = FaqService::get_authorized_categories(Category::ROOT_CATEGORY); $mode = $request->get_getstring('sort', FaqUrlBuilder::DEFAULT_SORT_MODE); $field = $request->get_getstring('field', FaqUrlBuilder::DEFAULT_SORT_FIELD); $sort_mode = $mode == 'asc' ? 'ASC' : 'DESC'; switch ($field) { case 'question': $sort_field = FaqQuestion::SORT_ALPHABETIC; break; default: $sort_field = FaqQuestion::SORT_DATE; break; } $result = PersistenceContext::get_querier()->select('SELECT * FROM ' . FaqSetup::$faq_table . ' faq LEFT JOIN ' . DB_TABLE_MEMBER . ' member ON member.user_id = faq.author_user_id WHERE approved = 0 AND faq.id_category IN :authorized_categories ' . (!FaqAuthorizationsService::check_authorizations()->moderation() ? ' AND faq.author_user_id = :user_id' : '') . ' ORDER BY ' . $sort_field . ' ' . $sort_mode, array('authorized_categories' => $authorized_categories, 'user_id' => AppContext::get_current_user()->get_id())); $this->tpl->put_all(array('C_QUESTIONS' => $result->get_rows_count() > 0, 'C_PENDING' => true, 'C_MORE_THAN_ONE_QUESTION' => $result->get_rows_count() > 1, 'C_DISPLAY_TYPE_ANSWERS_HIDDEN' => FaqConfig::load()->is_display_type_answers_hidden(), 'QUESTIONS_NUMBER' => $result->get_rows_count())); while ($row = $result->fetch()) { $faq_question = new FaqQuestion(); $faq_question->set_properties($row); $this->tpl->assign_block_vars('questions', $faq_question->get_array_tpl_vars()); } $result->dispose(); $this->build_sorting_form($field, $mode); }
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); }
public function execute(HTTPRequestCustom $request) { $this->load_lang(); $id_theme = $request->get_value('id_theme', ''); $id_module = ''; $file_selected = $request->get_value('file_name', ''); if (preg_match('`/`', $file_selected)) { $split = explode('/', $file_selected); $id_module = $split[0]; $file_name = $split[1] . '.tpl'; } else { $file_name = $file_selected . '.tpl'; } $this->build_form($id_theme, $id_module, $file_name, $file_selected); $tpl = new StringTemplate('# INCLUDE MSG # # INCLUDE FORM #'); $tpl->add_lang($this->lang); if (!empty($id_theme) && !empty($file_selected)) { if ($this->submit_button->has_been_submited() && $this->form->validate()) { $this->save(); $tpl->put('MSG', MessageHelper::display(LangLoader::get_message('process.success', 'status-messages-common'), MessageHelper::SUCCESS, 4)); } } $tpl->put('FORM', $this->form->display()); return new AdminCustomizationDisplayResponse($tpl, $this->lang['customization.editor.tpl-files']); }
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); } }
protected function load_lang(HTTPRequestCustom $request) { $locale = TextHelper::htmlspecialchars($request->get_string('lang', UpdateController::DEFAULT_LOCALE)); LangLoader::set_locale($locale); UpdateUrlBuilder::set_locale($locale); $this->lang = LangLoader::get('update', 'update'); }
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); } } }
private function build_view(HTTPRequestCustom $request) { $id = $request->get_value('id', 0); $status = $request->get_value('status', ''); $old_status = $request->get_value('old_status', ''); $this->view->put('RESULT', (int) (!empty($id) && $old_status == $status)); }
public function execute(HTTPRequestCustom $request) { $lang = LangLoader::get('common'); $is_admin = AppContext::get_current_user()->check_level(User::ADMIN_LEVEL); $number_admins = UserService::count_admin_members(); $suggestions = array(); try { $result = PersistenceContext::get_querier()->select("SELECT user_id, display_name, level, groups FROM " . DB_TABLE_MEMBER . " WHERE display_name LIKE '" . str_replace('*', '%', $request->get_value('value', '')) . "%'"); while ($row = $result->fetch()) { $user_group_color = User::get_group_color($row['groups'], $row['level']); $suggestion = ''; if ($is_admin) { $edit_link = new LinkHTMLElement(UserUrlBuilder::edit_profile($row['user_id']), '', array('title' => $lang['edit']), 'fa fa-edit'); if ($row['level'] != User::ADMIN_LEVEL || $row['level'] == User::ADMIN_LEVEL && $number_admins > 1) { $delete_link = new LinkHTMLElement(AdminMembersUrlBuilder::delete($row['user_id']), '', array('title' => $lang['delete'], 'data-confirmation' => 'delete-element'), 'fa fa-delete'); } else { $delete_link = new LinkHTMLElement('', '', array('title' => $lang['delete'], 'onclick' => 'return false;'), 'fa fa-delete icon-disabled'); } $suggestion .= $edit_link->display() . ' ' . $delete_link->display() . ' '; } $profile_link = new LinkHTMLElement(UserUrlBuilder::profile($row['user_id'])->rel(), $row['display_name'], array('style' => !empty($user_group_color) ? 'color:' . $user_group_color : ''), UserService::get_level_class($row['level'])); $suggestion .= $profile_link->display(); $suggestions[] = $suggestion; } $result->dispose(); } catch (Exception $e) { } return new JSONResponse(array('suggestions' => $suggestions)); }
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']); }
private function build_view(HTTPRequestCustom $request) { $current_page = $request->get_getint('page', 1); $config = ArticlesConfig::load(); $this->category = $this->article->get_category(); $article_contents = $this->article->get_contents(); //If article doesn't begin with a page, we insert one if (substr(trim($article_contents), 0, 6) != '[page]') { $article_contents = '[page] [/page]' . $article_contents; } //Removing [page] bbcode $article_contents_clean = preg_split('`\\[page\\].+\\[/page\\](.*)`Us', $article_contents, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); //Retrieving pages preg_match_all('`\\[page\\]([^[]+)\\[/page\\]`U', $article_contents, $array_page); $nbr_pages = count($array_page[1]); if ($nbr_pages > 1) { $this->build_form($array_page, $current_page); } $this->build_sources_view(); $this->build_keywords_view(); $page_name = isset($array_page[1][$current_page - 1]) && $array_page[1][$current_page - 1] != ' ' ? $array_page[1][$current_page - 1] : ''; $this->tpl->put_all(array_merge($this->article->get_tpl_vars(), array('C_COMMENTS_ENABLED' => $config->are_comments_enabled(), 'C_NOTATION_ENABLED' => $config->is_notation_enabled(), 'KERNEL_NOTATION' => NotationService::display_active_image($this->article->get_notation()), 'CONTENTS' => isset($article_contents_clean[$current_page - 1]) ? FormatingHelper::second_parse($article_contents_clean[$current_page - 1]) : '', 'PAGE_NAME' => $page_name, 'U_EDIT_ARTICLE' => $page_name !== '' ? ArticlesUrlBuilder::edit_article($this->article->get_id(), $current_page)->rel() : ArticlesUrlBuilder::edit_article($this->article->get_id())->rel()))); $this->build_pages_pagination($current_page, $nbr_pages, $array_page); //Affichage commentaires if ($config->are_comments_enabled()) { $comments_topic = new ArticlesCommentsTopic($this->article); $comments_topic->set_id_in_module($this->article->get_id()); $comments_topic->set_url(ArticlesUrlBuilder::display_article($this->category->get_id(), $this->category->get_rewrited_name(), $this->article->get_id(), $this->article->get_rewrited_title())); $this->tpl->put('COMMENTS', $comments_topic->display()); } }
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); } }
public function execute(HTTPRequestCustom $request) { $id = $request->get_int('id', 0); $code = -1; if (!empty($id)) { $config = ContactConfig::load(); $fields = $config->get_fields(); if (isset($fields[$id])) { $field = new ContactField(); $field->set_properties($fields[$id]); if ($field->is_deletable()) { unset($fields[$id]); $new_fields_list = array(); $position = 1; foreach ($fields as $key => $f) { $new_fields_list[$position] = $f; $position++; } $config->set_fields($new_fields_list); ContactConfig::save(); $code = $id; } } } return new JSONResponse(array('code' => $code)); }
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); } }
public function execute(HTTPRequestCustom $request) { $this->stream = NewsletterStreamsCache::load()->get_stream($request->get_int('id_stream', 0)); $this->init(); $this->build_form($request); return $this->build_response($this->view); }
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))); } } } }
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()); }
public function execute(HTTPRequestCustom $request) { $this->module_id = $request->get_poststring('module_id', ''); $this->id_in_module = $request->get_poststring('id_in_module', ''); $this->topic_identifier = $request->get_poststring('topic_identifier', ''); $this->provider = CommentsProvidersService::get_provider($this->module_id, $this->topic_identifier); $this->provider->set_id_in_module($this->id_in_module); }
protected function load_lang(HTTPRequestCustom $request) { $locale = TextHelper::htmlspecialchars($request->get_string('lang', self::DEFAULT_LOCALE)); $locale = in_array($locale, InstallationServices::get_available_langs()) ? $locale : self::DEFAULT_LOCALE; LangLoader::set_locale($locale); InstallUrlBuilder::set_locale($locale); $this->lang = LangLoader::get('install', 'install'); }
private function get_faq_question(HTTPRequestCustom $request) { $id = $request->get_int('id', 0); if (!empty($id)) { try { $this->faq_question = FaqService::get_question('WHERE id=:id', array('id' => $id)); } catch (RowNotFoundException $e) { } } }
private function get_shoutbox_message(HTTPRequestCustom $request) { $id = $request->get_int('id', 0); if (!empty($id)) { try { $this->shoutbox_message = ShoutboxService::get_message('WHERE id=:id', array('id' => $id)); } catch (RowNotFoundException $e) { } } }
public function execute(HTTPRequestCustom $request) { $id = $request->get_int('id', 0); $display = $request->get_bool('display', true); if ($id !== 0) { PersistenceContext::get_querier()->update(DB_TABLE_MEMBER_EXTENDED_FIELDS_LIST, array('display' => (int) $display), 'WHERE id = :id', array('id' => $id)); ExtendedFieldsCache::invalidate(); } return new JSONResponse(array('id' => $id, 'display' => (int) $display)); }
public function execute(HTTPRequestCustom $request) { $group_id = $request->get_getint('id', 0); $this->init(); if ($group_id !== 0 && !$this->groups_cache->group_exists($group_id)) { AppContext::get_response()->redirect(UserUrlBuilder::home()); } $this->build_view($group_id); return $this->build_response(); }
public function execute(HTTPRequestCustom $request) { $this->stream = NewsletterStreamsCache::load()->get_stream($request->get_int('id_stream', 0)); if ($this->stream->get_id() == 0) { AppContext::get_response()->redirect(NewsletterUrlBuilder::home()); } $this->init(); $this->build_form($request); return $this->build_response($this->view); }
public function build_view(HTTPRequestCustom $request) { $now = new Date(); $config = WebConfig::load(); $authorized_categories = WebService::get_authorized_categories(Category::ROOT_CATEGORY); $mode = $request->get_getstring('sort', WebUrlBuilder::DEFAULT_SORT_MODE); $field = $request->get_getstring('field', WebUrlBuilder::DEFAULT_SORT_FIELD); $condition = 'WHERE relation.id_keyword = :id_keyword AND id_category IN :authorized_categories AND (approbation_type = 1 OR (approbation_type = 2 AND start_date < :timestamp_now AND (end_date > :timestamp_now OR end_date = 0)))'; $parameters = array('id_keyword' => $this->get_keyword()->get_id(), 'authorized_categories' => $authorized_categories, 'timestamp_now' => $now->get_timestamp()); $page = AppContext::get_request()->get_getint('page', 1); $pagination = $this->get_pagination($condition, $parameters, $field, $mode, $page); $sort_mode = $mode == 'asc' ? 'ASC' : 'DESC'; switch ($field) { case 'name': $sort_field = WebLink::SORT_ALPHABETIC; break; case 'visits': $sort_field = WebLink::SORT_NUMBER_VISITS; break; case 'com': $sort_field = WebLink::SORT_NUMBER_COMMENTS; break; case 'note': $sort_field = WebLink::SORT_NOTATION; break; default: $sort_field = WebLink::SORT_DATE; break; } $result = PersistenceContext::get_querier()->select('SELECT web.*, member.*, com.number_comments, notes.average_notes, notes.number_notes, note.note FROM ' . WebSetup::$web_table . ' web LEFT JOIN ' . DB_TABLE_KEYWORDS_RELATIONS . ' relation ON relation.module_id = \'web\' AND relation.id_in_module = web.id LEFT JOIN ' . DB_TABLE_MEMBER . ' member ON member.user_id = web.author_user_id LEFT JOIN ' . DB_TABLE_COMMENTS_TOPIC . ' com ON com.id_in_module = web.id AND com.module_id = \'web\' LEFT JOIN ' . DB_TABLE_AVERAGE_NOTES . ' notes ON notes.id_in_module = web.id AND notes.module_name = \'web\' LEFT JOIN ' . DB_TABLE_NOTE . ' note ON note.id_in_module = web.id AND note.module_name = \'web\' AND note.user_id = :user_id ' . $condition . ' ORDER BY web.privileged_partner DESC, ' . $sort_field . ' ' . $sort_mode . ' LIMIT :number_items_per_page OFFSET :display_from', array_merge($parameters, array('user_id' => AppContext::get_current_user()->get_id(), 'number_items_per_page' => $pagination->get_number_items_per_page(), 'display_from' => $pagination->get_display_from()))); $this->tpl->put_all(array('C_WEBLINKS' => $result->get_rows_count() > 0, 'C_MORE_THAN_ONE_WEBLINK' => $result->get_rows_count() > 1, 'C_CATEGORY_DISPLAYED_SUMMARY' => $config->is_category_displayed_summary(), 'C_CATEGORY_DISPLAYED_TABLE' => $config->is_category_displayed_table(), 'C_COMMENTS_ENABLED' => $config->are_comments_enabled(), 'C_NOTATION_ENABLED' => $config->is_notation_enabled(), 'C_PAGINATION' => $pagination->has_several_pages(), 'PAGINATION' => $pagination->display(), 'TABLE_COLSPAN' => 3 + (int) $config->are_comments_enabled() + (int) $config->is_notation_enabled(), 'CATEGORY_NAME' => $this->get_keyword()->get_name())); while ($row = $result->fetch()) { $weblink = new WebLink(); $weblink->set_properties($row); $keywords = $weblink->get_keywords(); $has_keywords = count($keywords) > 0; $this->tpl->assign_block_vars('weblinks', array_merge($weblink->get_array_tpl_vars(), array('C_KEYWORDS' => $has_keywords))); if ($has_keywords) { $this->build_keywords_view($keywords); } } $result->dispose(); $this->build_sorting_form($field, $mode); }
public function execute(HTTPRequestCustom $request) { $id = $request->get_int('id', 0); $code = -1; if (!empty($id)) { //Delete filter BugtrackerService::delete_filter("WHERE id=:id", array('id' => $id)); $code = $id; } return new JSONResponse(array('code' => $code)); }
private function update_position(HTTPRequestCustom $request) { $fields = $this->config->get_fields(); $sorted_fields = array(); $fields_list = json_decode(TextHelper::html_entity_decode($request->get_value('tree'))); foreach ($fields_list as $position => $tree) { $sorted_fields[$position + 1] = $fields[$tree->id]; } $this->config->set_fields($sorted_fields); ContactConfig::save(); }
private function get_downloadfile(HTTPRequestCustom $request) { $id = $request->get_getint('id', 0); if (!empty($id)) { 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); } } }
private function get_message(HTTPRequestCustom $request) { $id = $request->get_getint('id', 0); if (!empty($id)) { try { return ShoutboxService::get_message('WHERE id=:id', array('id' => $id)); } catch (RowNotFoundException $e) { $error_controller = PHPBoostErrors::unexisting_page(); DispatchManager::redirect($error_controller); } } }
public function execute(HTTPRequestCustom $request) { $this->init(); $this->upload_form(); $this->upgrade_module($request->get_string('module_id', '')); if ($this->submit_button->has_been_submited() && $this->form->validate()) { $this->upload_module(); } $this->build_view(); $this->view->put('UPLOAD_FORM', $this->form->display()); return new AdminModulesDisplayResponse($this->view, $this->lang['modules.update_module']); }