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)
 {
     $this->init();
     $this->build_form();
     $tpl = new StringTemplate('# INCLUDE MSG # # INCLUDE FORM #');
     $tpl->add_lang($this->lang);
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         $this->save();
         $this->form->get_field_by_id('admin_alerts_levels')->set_hidden(!$this->config->are_admin_alerts_enabled());
         $this->form->get_field_by_id('admin_alerts_fix_action')->set_hidden(!$this->config->are_admin_alerts_enabled());
         foreach ($this->config->get_status_list() as $key => $value) {
             $this->form->get_field_by_id($key)->set_hidden(!$this->config->is_progress_bar_displayed());
         }
         $this->form->get_field_by_id('stats_top_posters_enabled')->set_hidden(!$this->config->are_stats_enabled());
         $this->form->get_field_by_id('stats_top_posters_number')->set_hidden(!$this->config->are_stats_top_posters_enabled());
         $this->form->get_field_by_id('pm_edit_enabled')->set_hidden(!$this->config->are_pm_enabled());
         $this->form->get_field_by_id('pm_delete_enabled')->set_hidden(!$this->config->are_pm_enabled());
         $this->form->get_field_by_id('pm_comment_enabled')->set_hidden(!$this->config->are_pm_enabled());
         $this->form->get_field_by_id('pm_in_progress_enabled')->set_hidden(!$this->config->are_pm_enabled());
         $this->form->get_field_by_id('pm_pending_enabled')->set_hidden(!$this->config->are_pm_enabled());
         $this->form->get_field_by_id('pm_assign_enabled')->set_hidden(!$this->config->are_pm_enabled());
         $this->form->get_field_by_id('pm_fix_enabled')->set_hidden(!$this->config->are_pm_enabled());
         $this->form->get_field_by_id('pm_reject_enabled')->set_hidden(!$this->config->are_pm_enabled());
         $this->form->get_field_by_id('pm_reopen_enabled')->set_hidden(!$this->config->are_pm_enabled());
         $this->form->get_field_by_id('types_table')->set_value($this->build_types_table()->render());
         $this->form->get_field_by_id('categories_table')->set_value($this->build_categories_table()->render());
         $this->form->get_field_by_id('severities_table')->set_value($this->build_severities_table()->render());
         $this->form->get_field_by_id('priorities_table')->set_value($this->build_priorities_table()->render());
         $this->form->get_field_by_id('versions_table')->set_value($this->build_versions_table()->render());
         $tpl->put('MSG', MessageHelper::display(LangLoader::get_message('message.success.config', 'status-messages-common'), MessageHelper::SUCCESS, 5));
     }
     $tpl->put('FORM', $this->form->display());
     return new AdminBugtrackerDisplayResponse($tpl, $this->lang['titles.admin.module_config']);
 }
    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']);
    }
    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']);
    }
 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']);
 }
 public function execute(HTTPRequestCustom $request)
 {
     $this->init();
     $this->build_form();
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         $result = $this->send_mail();
         $this->view->put_all(array('C_MAIL_SENT' => true, 'C_SUCCESS' => empty($result), 'ERROR' => $result));
     }
     $this->view->put('SMTP_FORM', $this->form->display());
     return $this->generate_response();
 }
 public function execute(HTTPRequestCustom $request)
 {
     $this->get_right_controller_regarding_authorizations();
     $this->init();
     $this->build_form();
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         $this->save();
     }
     $this->tpl->put('FORM', $this->form->display());
     return $this->build_response($this->tpl);
 }
 public function execute(HTTPRequestCustom $request)
 {
     $this->init();
     $this->build_form();
     $tpl = new StringTemplate('# INCLUDE MSG # # INCLUDE FORM #');
     $tpl->add_lang($this->lang);
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         $this->save();
         $tpl->put('MSG', MessageHelper::display(LangLoader::get_message('message.success.config', 'status-messages-common'), MessageHelper::SUCCESS, 5));
     }
     $tpl->put('FORM', $this->form->display());
     return new AdminNewsletterDisplayResponse($tpl, LangLoader::get_message('configuration', 'admin'));
 }
 public function execute(HTTPRequestCustom $request)
 {
     AppContext::get_session()->csrf_get_protect();
     $this->init($request);
     $this->check_authorizations();
     $this->build_form($request);
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         $this->save();
         AppContext::get_response()->redirect($this->form->get_value('referrer') ? $this->form->get_value('referrer') : BugtrackerUrlBuilder::unsolved(), StringVars::replace_vars(LangLoader::get_message('success.delete', 'common', 'bugtracker'), array('id' => $this->bug->get_id())));
     }
     $this->view->put('FORM', $this->form->display());
     return $this->build_response($this->view);
 }
 public function execute(HTTPRequestCustom $request)
 {
     $this->init();
     $this->build_form();
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         $this->save();
         $this->form->get_field_by_id('other_start_page')->set_hidden($this->general_config->get_module_home_page() != 'other');
         $this->clear_cache();
         $this->tpl->put('MSG', MessageHelper::display(LangLoader::get_message('message.success.config', 'status-messages-common'), MessageHelper::SUCCESS, 5));
     }
     $this->tpl->put('FORM', $this->form->display());
     return new AdminConfigDisplayResponse($this->tpl, $this->lang['general-config']);
 }
 public function execute(HTTPRequestCustom $request)
 {
     $this->build_form();
     $tpl = new StringTemplate('# INCLUDE MSG # # INCLUDE FORM #');
     $tpl->add_lang($this->lang);
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         $this->handle_form();
         $this->form->get_field_by_id('file_life_time')->set_hidden(!SitemapXMLFileService::is_xml_file_generation_enabled());
         $tpl->put('MSG', MessageHelper::display(LangLoader::get_message('message.success.config', 'status-messages-common'), MessageHelper::SUCCESS, 5));
     }
     $tpl->put('FORM', $this->form->display());
     return $this->build_response($tpl);
 }
 public function execute(HTTPRequestCustom $request)
 {
     $this->init();
     $this->build_form($request);
     $tpl = new StringTemplate('# INCLUDE MSG # # INCLUDE FORM #');
     $tpl->add_lang($this->lang);
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         $display_name = $this->save();
         AppContext::get_response()->redirect($this->form->get_value('referrer') ? $this->form->get_value('referrer') : AdminMembersUrlBuilder::management(), StringVars::replace_vars($this->lang['user.message.success.add'], array('name' => $display_name)));
     }
     $tpl->put('FORM', $this->form->display());
     return new AdminMembersDisplayResponse($tpl, LangLoader::get_message('members.add-member', 'admin-user-common'));
 }
Пример #13
0
 public function build_view()
 {
     $this->build_form();
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         if ($this->send_mail()) {
             $this->view->put('MSG', MessageHelper::display($this->lang['message.success_mail'] . ($this->config->is_sender_acknowledgment_enabled() ? ' ' . $this->lang['message.acknowledgment'] : ''), MessageHelper::SUCCESS));
             $this->view->put('C_MAIL_SENT', true);
         } else {
             $this->view->put('MSG', MessageHelper::display($this->lang['message.error_mail'], MessageHelper::ERROR, 5));
         }
     }
     $this->view->put('FORM', $this->form->display());
     $this->view->put_all(array('C_INFORMATIONS_LEFT' => $this->config->are_informations_enabled() && $this->config->are_informations_left(), 'C_INFORMATIONS_TOP' => $this->config->are_informations_enabled() && $this->config->are_informations_top(), 'C_INFORMATIONS_RIGHT' => $this->config->are_informations_enabled() && $this->config->are_informations_right(), 'C_INFORMATIONS_BOTTOM' => $this->config->are_informations_enabled() && $this->config->are_informations_bottom(), 'C_INFORMATIONS_SIDE' => $this->config->are_informations_enabled() && ($this->config->are_informations_left() || $this->config->are_informations_right()), 'INFORMATIONS' => FormatingHelper::second_parse($this->config->get_informations())));
 }
 public function execute(HTTPRequestCustom $request)
 {
     $this->init();
     $this->build_form();
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         $this->save();
         $this->form->get_field_by_id('maintain_during')->set_hidden($this->get_maintain_type() != 'during');
         $this->form->get_field_by_id('maintain_until')->set_hidden($this->get_maintain_type() != 'until');
         $this->form->get_field_by_id('display_duration_for_admin')->set_hidden(!$this->maintenance_config->get_display_duration());
         $this->tpl->put('MSG', MessageHelper::display(LangLoader::get_message('message.success.config', 'status-messages-common'), MessageHelper::SUCCESS, 5));
     }
     $this->tpl->put('FORM', $this->form->display());
     return new AdminMaintainDisplayResponse($this->tpl, LangLoader::get_message('maintain', 'user-common'));
 }
 public function execute(HTTPRequestCustom $request)
 {
     $this->init();
     $this->build_form();
     $tpl = new StringTemplate('# INCLUDE MSG # # INCLUDE FORM #');
     $tpl->add_lang($this->lang);
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         $this->save();
         $this->form->get_field_by_id('forbidden_tags')->set_selected_options($this->content_formatting_config->get_forbidden_tags());
         $tpl->put('MSG', MessageHelper::display(LangLoader::get_message('message.success.config', 'status-messages-common'), MessageHelper::SUCCESS, 5));
     }
     $tpl->put('FORM', $this->form->display());
     return new AdminContentDisplayResponse($tpl, $this->lang['content.config']);
 }
 public function execute(HTTPRequestCustom $request)
 {
     $this->init();
     $form = $this->build_form();
     if ($this->submit_button->has_been_submited() || $this->preview_button->has_been_submited()) {
         if ($form->validate()) {
             $this->view->put_all(array('C_RESULT' => true, 'TEXT' => $form->get_value('text'), 'MAIL' => $form->get_value('mail'), 'WEB' => $form->get_value('siteweb'), 'AGE' => $form->get_value('age'), 'MULTI_LINE_TEXT' => $form->get_value('multi_line_text'), 'RICH_TEXT' => $form->get_value('rich_text'), 'RADIO' => $form->get_value('radio')->get_label(), 'CHECKBOX' => var_export($form->get_value('checkbox'), true), 'SELECT' => $form->get_value('select')->get_label(), 'HIDDEN' => $form->get_value('hidden'), 'DATE' => $form->get_value('date')->format(Date::FORMAT_DAY_MONTH_YEAR), 'DATE_TIME' => $form->get_value('date_time')->format(Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE), 'H_T_TEXT_FIELD' => $form->get_value('alone'), 'C_PREVIEW' => $this->preview_button->has_been_submited()));
             $file = $form->get_value('file');
             if ($file !== null) {
                 $this->view->put_all(array('FILE' => $file->get_name() . ' - ' . $file->get_size() . 'b - ' . $file->get_mime_type()));
             }
         }
     }
     $this->view->put('form', $form->display());
     return $this->generate_response();
 }
 public function execute(HTTPRequestCustom $request)
 {
     $this->check_authorizations();
     $this->init();
     $this->build_form();
     $tpl = new StringTemplate('# INCLUDE FORM #');
     $tpl->add_lang($this->lang);
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         $type = $request->get_value('type', '');
         if ($type !== '' && ($type == 'html' || $type == 'bbcode' || $type == 'text')) {
             AppContext::get_response()->redirect(NewsletterUrlBuilder::add_newsletter($type));
         }
     }
     $tpl->put('FORM', $this->form->display());
     return $this->build_response($tpl);
 }
 public function execute(HTTPRequestCustom $request)
 {
     $this->init($request);
     $this->check_authorizations();
     $this->build_form();
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         $this->save();
         $this->form->get_field_by_id('assigned_to')->set_hidden(!$this->bug->is_assigned());
         if ($this->config->get_versions_fix()) {
             $this->form->get_field_by_id('fixed_in')->set_hidden(!$this->bug->is_fixed() && !$this->bug->is_in_progress());
         }
         $this->form->get_field_by_id('comments_message')->set_value('');
         $this->view->put('MSG', MessageHelper::display($this->lang['success.' . $this->bug->get_status()], MessageHelper::SUCCESS, 5));
     }
     $this->view->put('FORM', $this->form->display());
     return $this->build_response($this->view);
 }
 public function execute(HTTPRequestCustom $request)
 {
     $this->init();
     //Form building
     $this->build_form();
     //Creation of the template
     $tpl = new StringTemplate('# INCLUDE MSG # # INCLUDE FORM #');
     $tpl->add_lang($this->lang);
     //Saving of the configuration if the submit button has been submitted
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         $this->save();
         $tpl->put('MSG', MessageHelper::display(LangLoader::get_message('message.success.config', 'status-messages-common'), MessageHelper::SUCCESS, 5));
     }
     //Display the form on the template
     $tpl->put('FORM', $this->form->display());
     //Display the generated page
     return new AdminBugtrackerDisplayResponse($tpl, $this->lang['titles.admin.module_authorizations']);
 }
 public function execute(HTTPRequestCustom $request)
 {
     $this->init();
     $this->build_form();
     $tpl = new StringTemplate('# INCLUDE MSG # # INCLUDE FORM #');
     $tpl->add_lang($this->lang);
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         $this->save();
         $this->form->get_field_by_id('type_activation_members')->set_hidden(!$this->user_account_config->is_registration_enabled());
         $this->form->get_field_by_id('unactivated_accounts_timeout')->set_hidden(!$this->user_account_config->is_registration_enabled() || $this->user_account_config->get_member_accounts_validation_method() == UserAccountsConfig::ADMINISTRATOR_USER_ACCOUNTS_VALIDATION);
         $this->form->get_field_by_id('fb_app_id')->set_hidden(!$this->authentication_config->is_fb_auth_enabled());
         $this->form->get_field_by_id('fb_app_key')->set_hidden(!$this->authentication_config->is_fb_auth_enabled());
         $this->form->get_field_by_id('google_client_id')->set_hidden(!$this->authentication_config->is_google_auth_enabled());
         $this->form->get_field_by_id('google_client_secret')->set_hidden(!$this->authentication_config->is_google_auth_enabled());
         $tpl->put('MSG', MessageHelper::display(LangLoader::get_message('message.success.config', 'status-messages-common'), MessageHelper::SUCCESS, 5));
     }
     $tpl->put('FORM', $this->form->display());
     return new AdminMembersDisplayResponse($tpl, $this->lang['members.members-management']);
 }
 public function execute(HTTPRequestCustom $request)
 {
     $this->init();
     $user_id = $request->get_getint('user_id', AppContext::get_current_user()->get_id());
     try {
         $this->user = UserService::get_user($user_id);
     } catch (RowNotFoundException $e) {
         $error_controller = PHPBoostErrors::unexisting_element();
         DispatchManager::redirect($error_controller);
     }
     try {
         $this->internal_auth_infos = PHPBoostAuthenticationMethod::get_auth_infos($user_id);
     } catch (RowNotFoundException $e) {
     }
     $this->user_auth_types = AuthenticationService::get_user_types_authentication($user_id);
     if (!$this->check_authorizations($user_id)) {
         $error_controller = PHPBoostErrors::user_not_authorized();
         DispatchManager::redirect($error_controller);
     }
     $associate_type = $request->get_getvalue('associate', false);
     if ($associate_type) {
         if (!in_array($associate_type, $this->user_auth_types)) {
             $authentication_method = AuthenticationService::get_authentication_method($associate_type);
             AuthenticationService::associate($authentication_method, $user_id);
             AppContext::get_response()->redirect(UserUrlBuilder::edit_profile($user_id));
         }
     }
     $dissociate_type = $request->get_getvalue('dissociate', false);
     if ($dissociate_type) {
         if (in_array($dissociate_type, $this->user_auth_types) && count($this->user_auth_types) > 1) {
             $authentication_method = AuthenticationService::get_authentication_method($dissociate_type);
             AuthenticationService::dissociate($authentication_method, $user_id);
             AppContext::get_response()->redirect(UserUrlBuilder::edit_profile($user_id));
         }
     }
     $this->build_form();
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         $this->save($request);
     }
     $this->tpl->put('FORM', $this->form->display());
     return $this->build_response();
 }
 public function execute(HTTPRequestCustom $request)
 {
     $this->init($request);
     $this->build_form($request);
     $this->tpl = new FileTemplate('contact/AdminContactFieldFormController.tpl');
     $this->tpl->add_lang($this->lang);
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         $this->save();
         if ($this->is_new_field) {
             AppContext::get_response()->redirect(ContactUrlBuilder::manage_fields(), StringVars::replace_vars($this->lang['message.success.add'], array('name' => $this->get_field()->get_name())));
         } else {
             AppContext::get_response()->redirect($this->form->get_value('referrer') ? $this->form->get_value('referrer') : ContactUrlBuilder::manage_fields(), StringVars::replace_vars($this->lang['message.success.edit'], array('name' => $this->get_field()->get_name())));
         }
     }
     $this->tpl->put('FORM', $this->form->display());
     if (!$this->get_field()->is_readonly()) {
         $this->tpl->put('JS_EVENT_SELECT_TYPE', $this->get_events_select_type());
     }
     return new AdminContactDisplayResponse($this->tpl, !empty($this->id) ? $this->lang['admin.fields.title.edit_field.page_title'] : $this->lang['admin.fields.title.add_field.page_title']);
 }
 public function execute(HTTPRequestCustom $request)
 {
     if (!NewsletterAuthorizationsService::default_authorizations()->moderation_subscribers()) {
         NewsletterAuthorizationsService::get_errors()->moderation_subscribers();
     }
     $id = $request->get_getint('id', 0);
     $this->init();
     $verificate_is_edit = PersistenceContext::get_querier()->count(NewsletterSetup::$newsletter_table_subscribers, "WHERE id = '" . $id . "' AND user_id = -1") > 0;
     if (!$this->subscriber_exist($id) || !$verificate_is_edit) {
         $controller = new UserErrorController(LangLoader::get_message('error', 'status-messages-common'), LangLoader::get_message('error-subscriber-not-existed', 'common', 'newsletter'));
         DispatchManager::redirect($controller);
     }
     $this->build_form($id);
     $tpl = new StringTemplate('# INCLUDE MSG # # INCLUDE FORM #');
     $tpl->add_lang($this->lang);
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         $this->save($id);
         $tpl->put('MSG', MessageHelper::display(LangLoader::get_message('process.success', 'status-messages-common'), MessageHelper::SUCCESS, 4));
     }
     $tpl->put('FORM', $this->form->display());
     return $this->build_response($tpl);
 }
 public function execute(HTTPRequestCustom $request)
 {
     if (!NewsletterAuthorizationsService::default_authorizations()->create_newsletters()) {
         NewsletterAuthorizationsService::get_errors()->create_newsletters();
     }
     $type = $request->get_value('type', '');
     $this->init();
     $this->build_form($type);
     $tpl = new StringTemplate('# INCLUDE MSG # # INCLUDE FORM #');
     $tpl->add_lang($this->lang);
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         $this->send_mail($type);
         $tpl->put('MSG', MessageHelper::display($this->lang['newsletter.message.success.add'], MessageHelper::SUCCESS, 5));
     } else {
         if ($this->send_test_button->has_been_submited() && $this->form->validate()) {
             $this->send_test($type);
             $tpl->put('MSG', MessageHelper::display($this->lang['newsletter.success-send-test'], MessageHelper::SUCCESS, 5));
         }
     }
     $tpl->put('FORM', $this->form->display());
     return $this->build_response($tpl, $type);
 }
 public function execute(HTTPRequestCustom $request)
 {
     $this->load_lang();
     $this->load_config();
     $this->build_form();
     $tpl = new StringTemplate('# INCLUDE MSG # # INCLUDE FORM #');
     $tpl->add_lang($this->lang);
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         $favicon = $this->form->get_value('favicon', null);
         if ($favicon !== null) {
             $file_type = new FileType(new File($favicon->get_name()));
             if ($file_type->is_picture()) {
                 $this->save($favicon);
                 $tpl->put('MSG', MessageHelper::display(LangLoader::get_message('process.success', 'status-messages-common'), MessageHelper::SUCCESS, 4));
             } else {
                 $tpl->put('MSG', MessageHelper::display(LangLoader::get_message('process.error', 'status-messages-common'), MessageHelper::ERROR, 4));
             }
         } else {
             $tpl->put('MSG', MessageHelper::display($this->lang['customization.favicon.error'], MessageHelper::ERROR, 4));
         }
     }
     $tpl->put('FORM', $this->form->display());
     return new AdminCustomizationDisplayResponse($tpl, $this->lang['customization.interface']);
 }