private function build_form()
 {
     $this->form = new HTMLForm('smtp_config');
     $fieldset = new FormFieldsetHTML('mail_properties', $this->lang['mail.title']);
     $this->form->add_fieldset($fieldset);
     $sender_mail = new FormFieldMailEditor('sender_mail', $this->lang['mail.sender_mail'], '');
     $fieldset->add_field($sender_mail);
     $fieldset->add_field(new FormFieldTextEditor('sender_name', $this->lang['mail.sender_name'], '', array(), array(new FormFieldConstraintNotEmpty())));
     $recipient_mail = new FormFieldMailEditor('recipient_mail', $this->lang['mail.recipient_mail'], '');
     $fieldset->add_field($recipient_mail);
     $fieldset->add_field(new FormFieldTextEditor('recipient_name', $this->lang['mail.recipient_name'], '', array(), array(new FormFieldConstraintNotEmpty())));
     $fieldset->add_field(new FormFieldTextEditor('mail_subject', $this->lang['mail.subject'], '', array(), array(new FormFieldConstraintNotEmpty())));
     $fieldset->add_field(new FormFieldMultiLineTextEditor('mail_content', $this->lang['mail.content'], ''));
     $fieldset = new FormFieldsetHTML('send_configuration', $this->lang['mail.smtp_config'], array('description' => $this->lang['mail.smtp_config.explain']));
     $this->form->add_fieldset($fieldset);
     $fieldset->add_field(new FormFieldCheckbox('use_smtp', $this->lang['mail.use_smtp'], false, array('events' => array('click' => 'if ($FF("use_smtp").getValue()) { $FFS("smtp_configuration").enable(); } else { $FFS("smtp_configuration").disable(); }'))));
     $fieldset = new FormFieldsetHTML('smtp_configuration', $this->lang['mail.smtp_configuration'], array('disabled' => true));
     $this->form->add_fieldset($fieldset);
     $fieldset->add_field(new FormFieldTextEditor('smtp_host', $this->lang['mail.smtp.host'], '', array('disabled' => true), array(new FormFieldConstraintRegex('`^[a-z0-9-]+(?:\\.[a-z0-9-]+)*$`i'))));
     $fieldset->add_field(new FormFieldTextEditor('smtp_port', $this->lang['mail.smtp.port'], 25, array('disabled' => true), array(new FormFieldConstraintIntegerRange(0, 65535))));
     $fieldset->add_field(new FormFieldTextEditor('smtp_login', $this->lang['mail.smtp.login'], '', array('disabled' => true), array(new FormFieldConstraintNotEmpty())));
     $fieldset->add_field(new FormFieldPasswordEditor('smtp_password', $this->lang['mail.smtp.password'], '', array('disabled' => true)));
     $select_option = new FormFieldSelectChoiceOption($this->lang['mail.smtp.secure_protocol.none'], 'none');
     $fieldset->add_field(new FormFieldSimpleSelectChoice('secure_protocol', $this->lang['mail.smtp.secure_protocol'], $select_option, array($select_option, new FormFieldSelectChoiceOption($this->lang['mail.smtp.secure_protocol.tls'], 'tls'), new FormFieldSelectChoiceOption($this->lang['mail.smtp.secure_protocol.ssl'], 'ssl')), array('disabled' => true)));
     $this->submit_button = new FormButtonDefaultSubmit();
     $this->form->add_button($this->submit_button);
     $this->form->add_constraint(new FormConstraintFieldsInequality($recipient_mail, $sender_mail));
 }
 public function build_form()
 {
     $form = new HTMLForm(__CLASS__);
     // Fieldset to configure path
     $fieldsetPath = new FormFieldsetHTML('wpimport-path', $this->lang['wpimport.fieldset-path']);
     $form->add_fieldset($fieldsetPath);
     $fieldsetPath->add_field(new FormFieldTextEditor('phpboostpath', $this->lang['wpimport.phpboostpath'], realpath(__DIR__ . '/../../')));
     $fieldsetPath->add_field(new FormFieldTextEditor('wppath', $this->lang['wpimport.wppath'], realpath(__DIR__ . '/../../../'), array(), array(new FormFieldConstraintWordPressPath($this->lang['constraint.wp-path']))));
     // Fieldset to configure which data are import
     $fieldsetImporter = new FormFieldsetHTML('wpimport-importer', $this->lang['wpimport.fieldset-importer']);
     $form->add_fieldset($fieldsetImporter);
     $importers = $this->listImporters();
     foreach ($importers as $importer) {
         $fieldsetImporter->add_field(new FormFieldCheckbox('importer_' . $importer['name'], $importer['name'], FormFieldCheckbox::UNCHECKED, array('description' => $this->lang['wpimport.description'] . ': ' . utf8_decode($importer['description']) . '<br />' . $this->lang['wpimport.version'] . ': ' . $importer['version'])));
     }
     // Fieldset to confgure options
     $fieldsetOptions = new FormFieldsetHTML('wpimport-options', $this->lang['wpimport.fieldset-options']);
     $form->add_fieldset($fieldsetOptions);
     // Default Author
     $fieldsetOptions->add_field(new FormFieldAjaxUserAutoComplete('default_author', $this->lang['wpimport.default_author'], AppContext::get_current_user()->get_login(), array('description' => $this->lang['wpimport.default_author.decription']), array(new FormFieldConstraintUserExist($this->lang['wpimport.default_author.error_user_exist']))));
     // Default Image
     $fieldsetOptions->add_field(new FormFieldUploadFile('default_cat_image', $this->lang['wpimport.default_cat_image'], $this->getDefaultConfiguration()['PHPBOOST_CAT_IMAGE'], array('description' => $this->lang['wpimport.default_cat_image.description'])));
     $fieldsetOptions->add_field(new FormFieldTextEditor('import_location', $this->lang['wpimport.import_location'], $this->getDefaultConfiguration()['FILESYSTEM_IMPORT_LOCATION'], array('description' => $this->lang['wpimport.import_location.description'])));
     $this->submit_button = new FormButtonSubmit($this->lang['wpimport.submit_configuration'], 'submit_configuration');
     $form->add_button($this->submit_button);
     $form->add_button(new FormButtonReset($this->lang['wpimport.reset']));
     $this->form = $form;
 }
    private function build_form()
    {
        $mail_request = AppContext::get_request()->get_string('mail_newsletter', '');
        if (AppContext::get_current_user()->check_level(User::MEMBER_LEVEL) && empty($mail_request)) {
            $email = AppContext::get_current_user()->get_email();
        } else {
            $email = $mail_request;
        }
        $form = new HTMLForm(__CLASS__);
        $fieldset = new FormFieldsetHTML('unsubscribe.newsletter', $this->lang['unsubscribe.newsletter']);
        $form->add_fieldset($fieldset);
        $fieldset->add_field(new FormFieldMailEditor('mail', $this->lang['subscribe.mail'], $email, array('required' => true)));
        $fieldset->add_field(new FormFieldCheckbox('delete_all_streams', $this->lang['newsletter.delete_all_streams'], FormFieldCheckbox::UNCHECKED, array('events' => array('click' => '
		if (HTMLForms.getField("delete_all_streams").getValue()) {
			HTMLForms.getField("choice").disable();
		} else { 
			HTMLForms.getField("choice").enable();
		}'))));
        $newsletter_subscribe = AppContext::get_current_user()->check_level(User::MEMBER_LEVEL) ? NewsletterService::get_member_id_streams(AppContext::get_current_user()->get_id()) : array();
        $fieldset->add_field(new FormFieldMultipleCheckbox('choice', $this->lang['unsubscribe.newsletter_choice'], $newsletter_subscribe, $this->get_streams(), array('required' => true)));
        $this->submit_button = new FormButtonDefaultSubmit();
        $form->add_button($this->submit_button);
        $form->add_button(new FormButtonReset());
        $this->form = $form;
    }
 private function build_form()
 {
     $form = new HTMLForm(__CLASS__);
     $fieldset = new FormFieldsetHTML('config', $this->lang['config.title']);
     $form->add_fieldset($fieldset);
     $fieldset->add_field(new QuestionCaptchaFormFieldQuestions('questions', $this->lang['form.questions'], $this->config->get_questions(), array('description' => $this->lang['form.questions.explain'])));
     $this->submit_button = new FormButtonDefaultSubmit();
     $form->add_button($this->submit_button);
     $form->add_button(new FormButtonReset());
     $this->form = $form;
 }
 private function build_form()
 {
     $this->form = new HTMLForm('sitemap_global_config', SitemapUrlBuilder::get_general_config()->rel());
     $fieldset = new FormFieldsetHTML('general_config', $this->lang['general_config']);
     $this->form->add_fieldset($fieldset);
     $fieldset->add_field(new FormFieldCheckbox('enable_sitemap_xml', $this->lang['auto_generate_xml_file'], SitemapXMLFileService::is_xml_file_generation_enabled() ? FormFieldCheckbox::CHECKED : FormFieldCheckbox::UNCHECKED, array('events' => array('click' => 'if ($FF("enable_sitemap_xml").getValue()) { $FF("file_life_time").enable(); } else { $FF("file_life_time").disable(); }'))));
     $fieldset->add_field(new FormFieldNumberEditor('file_life_time', $this->lang['xml_file_life_time'], SitemapXMLFileService::get_life_time(), array('required' => true, 'min' => 0, 'description' => $this->lang['xml_file_life_time_explain'], 'hidden' => !SitemapXMLFileService::is_xml_file_generation_enabled()), array(new FormFieldConstraintIntegerRange(1, 50))));
     $this->submit_button = new FormButtonDefaultSubmit();
     $this->form->add_button($this->submit_button);
     $this->form->add_button(new FormButtonReset());
 }
 protected function create_form()
 {
     $form = new HTMLForm('comments', REWRITED_SCRIPT . '#comments-list');
     $fieldset = new FormFieldsetHTML('edit_comment', $this->comments_lang['comment.edit']);
     $form->add_fieldset($fieldset);
     $fieldset->add_field(new FormFieldRichTextEditor('message', $this->lang['message'], $this->get_contents(), array('formatter' => $this->get_formatter(), 'rows' => 10, 'cols' => 47, 'required' => $this->lang['require_text']), array(new FormFieldConstraintMaxLinks($this->comments_configuration->get_max_links_comment()))));
     $form->add_button($submit_button = new FormButtonDefaultSubmit());
     $form->add_button(new FormButtonReset());
     $this->set_form($form);
     $this->set_submit_button($submit_button);
     return $form;
 }
 private function build_form()
 {
     $form = new HTMLForm(__CLASS__);
     $fieldset = new FormFieldsetHTML('config', $this->lang['config.title']);
     $form->add_fieldset($fieldset);
     $fieldset->add_field(new FormFieldFree('explain', '', $this->lang['config.recaptcha-explain']));
     $fieldset->add_field(new FormFieldTextEditor('site_key', $this->lang['config.site_key'], $this->config->get_site_key(), array('required' => true), array(new FormFieldConstraintLengthMin(30))));
     $fieldset->add_field(new FormFieldPasswordEditor('secret_key', $this->lang['config.secret_key'], $this->config->get_secret_key(), array('required' => true), array(new FormFieldConstraintLengthMin(30))));
     $this->submit_button = new FormButtonDefaultSubmit();
     $form->add_button($this->submit_button);
     $form->add_button(new FormButtonReset());
     $this->form = $form;
 }
 private function build_form($id)
 {
     $form = new HTMLForm(__CLASS__);
     $columns = array('*');
     $condition = "WHERE id = '" . $id . "' AND user_id = -1";
     $row = PersistenceContext::get_querier()->select_single_row(NewsletterSetup::$newsletter_table_subscribers, $columns, $condition);
     $fieldset = new FormFieldsetHTML('edit-subscriber', $this->lang['subscriber.edit']);
     $form->add_fieldset($fieldset);
     $fieldset->add_field(new FormFieldMailEditor('mail', $this->lang['subscribe.mail'], $row['mail'], array('required' => true)));
     $this->submit_button = new FormButtonDefaultSubmit();
     $form->add_button($this->submit_button);
     $form->add_button(new FormButtonReset());
     $this->form = $form;
 }
 protected function create_form()
 {
     $form = new HTMLForm('comments', TextHelper::htmlentities($this->comments_topic->get_url()) . '#comments-list');
     $fieldset = new FormFieldsetHTML('add_comment', $this->comments_lang['comment.add']);
     $form->add_fieldset($fieldset);
     if (!$this->user->check_level(User::MEMBER_LEVEL)) {
         $fieldset->add_field(new FormFieldTextEditor('name', $this->common_lang['form.name'], LangLoader::get_message('visitor', 'user-common'), array('maxlength' => 25)));
     }
     $fieldset->add_field(new FormFieldRichTextEditor('message', $this->lang['message'], '', array('formatter' => $this->get_formatter(), 'rows' => 10, 'cols' => 47, 'required' => $this->lang['require_text']), array(new FormFieldConstraintMaxLinks($this->comments_configuration->get_max_links_comment(), true), new FormFieldConstraintAntiFlood(CommentsManager::get_last_comment_added($this->user->get_id())))));
     $form->add_button($submit_button = new FormButtonDefaultSubmit());
     $form->add_button(new FormButtonReset());
     $this->set_form($form);
     $this->set_submit_button($submit_button);
     return $form;
 }
 private function build_form()
 {
     $form = new HTMLForm(__CLASS__);
     $fieldset = new FormFieldsetHTML('language-config', $this->lang['content.config.language']);
     $form->add_fieldset($fieldset);
     $fieldset->add_field(new FormFieldEditors('formatting_language', $this->lang['content.config.default-formatting-language'], $this->content_formatting_config->get_default_editor(), array('description' => $this->lang['content.config.default-formatting-language-explain'])));
     $fieldset->add_field(new FormFieldMultipleSelectChoice('forbidden_tags', $this->lang['comments.config.forbidden-tags'], $this->content_formatting_config->get_forbidden_tags(), $this->generate_forbidden_tags_option(), array('size' => 10)));
     $fieldset = new FormFieldsetHTML('html-language-config', $this->lang['content.config.html-language']);
     $form->add_fieldset($fieldset);
     $auth_settings = new AuthorizationsSettings(array(new ActionAuthorization($this->lang['content.config.html-language-use-authorization'], self::HTML_USAGE_AUTHORIZATIONS, $this->lang['content.config.html-language-use-authorization-explain'])));
     $auth_settings->build_from_auth_array($this->content_formatting_config->get_html_tag_auth());
     $auth_setter = new FormFieldAuthorizationsSetter('authorizations', $auth_settings);
     $fieldset->add_field($auth_setter);
     $fieldset = new FormFieldsetHTML('post-management', $this->lang['content.config.post-management']);
     $form->add_fieldset($fieldset);
     $fieldset->add_field(new FormFieldNumberEditor('max_pm_number', $this->lang['content.config.max-pm-number'], $this->user_accounts_config->get_max_private_messages_number(), array('required' => true, 'description' => $this->lang['content.config.max-pm-number-explain']), array(new FormFieldConstraintRegex('`^([0-9]+)$`i', '', LangLoader::get_message('form.doesnt_match_number_regex', 'status-messages-common')))));
     $fieldset->add_field(new FormFieldCheckbox('anti_flood_enabled', $this->lang['content.config.anti-flood-enabled'], $this->content_management_config->is_anti_flood_enabled(), array('description' => $this->lang['content.config.anti-flood-enabled-explain'])));
     $fieldset->add_field(new FormFieldNumberEditor('delay_flood', $this->lang['content.config.delay-flood'], $this->content_management_config->get_anti_flood_duration(), array('required' => true, 'description' => $this->lang['content.config.delay-flood-explain']), array(new FormFieldConstraintRegex('`^([0-9]+)$`i', '', LangLoader::get_message('form.doesnt_match_number_regex', 'status-messages-common')))));
     $fieldset = new FormFieldsetHTML('captcha', $this->lang['content.config.captcha']);
     $form->add_fieldset($fieldset);
     $fieldset->add_field(new FormFieldSimpleSelectChoice('captcha_used', $this->lang['content.config.captcha-used'], $this->content_management_config->get_used_captcha_module(), $this->generate_captcha_available_option(), array('description' => $this->lang['content.config.captcha-used-explain'])));
     $this->submit_button = new FormButtonDefaultSubmit();
     $form->add_button($this->submit_button);
     $form->add_button(new FormButtonReset());
     $this->form = $form;
 }
    private function build_form()
    {
        $form = new HTMLForm(__CLASS__);
        $fieldset = new FormFieldsetHTML('config', $this->admin_common_lang['configuration']);
        $form->add_fieldset($fieldset);
        $fieldset->add_field(new FormFieldCheckbox('database_tables_optimization_enabled', $this->lang['config.database-tables-optimization-enabled'], $this->config->is_database_tables_optimization_enabled(), array('events' => array('change' => '
				if (HTMLForms.getField("database_tables_optimization_enabled").getValue()) { 
					HTMLForms.getField("database_tables_optimization_day").enable();
				} else { 
					HTMLForms.getField("database_tables_optimization_day").disable();
				}'))));
        $date_lang = LangLoader::get('date-common');
        $fieldset->add_field(new FormFieldSimpleSelectChoice('database_tables_optimization_day', $this->lang['config.database-tables-optimization-day'], $this->config->get_database_tables_optimization_day(), array(new FormFieldSelectChoiceOption($date_lang['sunday'], 0), new FormFieldSelectChoiceOption($date_lang['monday'], 1), new FormFieldSelectChoiceOption($date_lang['tuesday'], 2), new FormFieldSelectChoiceOption($date_lang['wednesday'], 3), new FormFieldSelectChoiceOption($date_lang['thursday'], 4), new FormFieldSelectChoiceOption($date_lang['friday'], 5), new FormFieldSelectChoiceOption($date_lang['saturday'], 6), new FormFieldSelectChoiceOption($date_lang['every_month'], 7)), array('description' => $this->lang['config.database-tables-optimization-day.explain'], 'hidden' => !$this->config->is_database_tables_optimization_enabled())));
        $this->submit_button = new FormButtonDefaultSubmit();
        $form->add_button($this->submit_button);
        $form->add_button(new FormButtonReset());
        $this->form = $form;
    }
 private function build_form()
 {
     $form = new HTMLForm(__CLASS__, AdminErrorsUrlBuilder::clear_logged_errors()->rel(), false);
     $fieldset = new FormFieldsetHTML('clear_errors', $this->lang['clear_list']);
     $form->add_fieldset($fieldset);
     $submit_button = new FormButtonSubmit($this->lang['clear_list'], 'clear', '', 'submit', $this->lang['logged_errors_clear_confirmation']);
     $form->add_button($submit_button);
     return $form;
 }
 private function build_form()
 {
     //Creation of a new form
     $form = new HTMLForm(__CLASS__);
     //Add a fieldset
     $fieldset_authorizations = new FormFieldsetHTML('authorizations', LangLoader::get_message('authorizations', 'common'));
     $form->add_fieldset($fieldset_authorizations);
     //Authorizations list
     $auth_settings = new AuthorizationsSettings(array(new ActionAuthorization($this->lang['config.auth.read'], BugtrackerAuthorizationsService::READ_AUTHORIZATIONS), new ActionAuthorization($this->lang['config.auth.create'], BugtrackerAuthorizationsService::WRITE_AUTHORIZATIONS), new ActionAuthorization($this->lang['config.auth.create_advanced'], BugtrackerAuthorizationsService::ADVANCED_WRITE_AUTHORIZATIONS, $this->lang['config.auth.create_advanced_explain']), new ActionAuthorization($this->lang['config.auth.moderate'], BugtrackerAuthorizationsService::MODERATION_AUTHORIZATIONS)));
     //Load the authorizations in the configuration
     $auth_settings->build_from_auth_array(BugtrackerConfig::load()->get_authorizations());
     $fieldset_authorizations->add_field(new FormFieldAuthorizationsSetter('authorizations', $auth_settings));
     //Submit and reset buttons
     $this->submit_button = new FormButtonDefaultSubmit();
     $form->add_button($this->submit_button);
     $form->add_button(new FormButtonReset());
     $this->form = $form;
 }
 private function build_form()
 {
     $form = new HTMLForm(__CLASS__);
     $newsletter_config = NewsletterConfig::load();
     $fieldset_config = new FormFieldsetHTML('configuration', LangLoader::get_message('configuration', 'admin'));
     $form->add_fieldset($fieldset_config);
     $fieldset_config->add_field(new FormFieldMailEditor('mail_sender', $this->lang['admin.mail-sender'], $newsletter_config->get_mail_sender(), array('description' => $this->lang['admin.mail-sender-explain'], 'required' => true)));
     $fieldset_config->add_field(new FormFieldTextEditor('newsletter_name', $this->lang['admin.newsletter-name'], $newsletter_config->get_newsletter_name(), array('maxlength' => 255, 'description' => $this->lang['admin.newsletter-name-explain'], 'required' => true)));
     $fieldset_authorizations = new FormFieldsetHTML('authorizations', $this->lang['admin.newsletter-authorizations']);
     $form->add_fieldset($fieldset_authorizations);
     $auth_settings = new AuthorizationsSettings(array(new ActionAuthorization($this->lang['auth.read'], NewsletterAuthorizationsService::AUTH_READ), new ActionAuthorization($this->lang['auth.subscribe'], NewsletterAuthorizationsService::AUTH_SUBSCRIBE), new ActionAuthorization($this->lang['auth.subscribers-read'], NewsletterAuthorizationsService::AUTH_READ_SUBSCRIBERS), new ActionAuthorization($this->lang['auth.subscribers-moderation'], NewsletterAuthorizationsService::AUTH_MODERATION_SUBSCRIBERS), new ActionAuthorization($this->lang['auth.create-newsletter'], NewsletterAuthorizationsService::AUTH_CREATE_NEWSLETTERS), new ActionAuthorization($this->lang['auth.archives-read'], NewsletterAuthorizationsService::AUTH_READ_ARCHIVES), new ActionAuthorization($this->lang['auth.archives-moderation'], NewsletterAuthorizationsService::AUTH_MODERATION_ARCHIVES)));
     $auth_settings->build_from_auth_array($newsletter_config->get_authorizations());
     $auth_setter = new FormFieldAuthorizationsSetter('authorizations', $auth_settings);
     $fieldset_authorizations->add_field($auth_setter);
     $this->submit_button = new FormButtonDefaultSubmit();
     $form->add_button($this->submit_button);
     $form->add_button(new FormButtonReset());
     $this->form = $form;
 }
 private function build_form()
 {
     $form = new HTMLForm(__CLASS__);
     $fieldset = new FormFieldsetHTML('fieldset', $this->lang['forget-password']);
     $form->add_fieldset($fieldset);
     $fieldset->add_field(new FormFieldMailEditor('email', $this->lang['email'], '', array('required' => true)));
     $this->submit_button = new FormButtonDefaultSubmit();
     $form->add_button($this->submit_button);
     $this->form = $form;
 }
 private function upload_form()
 {
     $form = new HTMLForm('upload_module', '', false);
     $fieldset = new FormFieldsetHTML('upload', $this->lang['modules.update_module']);
     $form->add_fieldset($fieldset);
     $fieldset->add_field(new FormFieldFilePicker('file', $this->lang['modules.upload_description']));
     $this->submit_button = new FormButtonDefaultSubmit();
     $form->add_button($this->submit_button);
     $this->form = $form;
 }
 protected function build_form()
 {
     $form = new HTMLForm(__CLASS__);
     $fieldset = new FormFieldsetHTML('syndication_cache', $this->lang['syndication_cache']);
     $form->add_fieldset($fieldset);
     $fieldset->add_field(new FormFieldHTML('explain', $this->lang['explain_syndication_cache']));
     $this->submit_button = new FormButtonSubmit($this->lang['clear_cache'], 'button');
     $form->add_button($this->submit_button);
     $this->form = $form;
 }
 private function build_form()
 {
     $extensions = $this->get_extensions_list();
     $form = new HTMLForm(__CLASS__);
     $fieldset = new FormFieldsetHTML('files-config', LangLoader::get_message('files_config', 'main'));
     $form->add_fieldset($fieldset);
     $auth_settings = new AuthorizationsSettings(array(new ActionAuthorization($this->lang['auth_files'], FileUploadConfig::AUTH_FILES_BIT)));
     $auth_settings->build_from_auth_array($this->file_upload_config->get_authorization_enable_interface_files());
     $auth_setter = new FormFieldAuthorizationsSetter('authorizations', $auth_settings);
     $fieldset->add_field($auth_setter);
     $fieldset->add_field(new FormFieldDecimalNumberEditor('size_limit', $this->lang['size_limit'], NumberHelper::round($this->file_upload_config->get_maximum_size_upload() / 1024, 2), array('min' => 0, 'step' => 0.05, 'description' => $this->lang['size_limit_explain'], 'required' => true)));
     $fieldset->add_field(new FormFieldCheckbox('bandwidth_protect', $this->lang['bandwidth_protect'], $this->file_upload_config->get_enable_bandwidth_protect(), array('description' => $this->lang['bandwidth_protect_explain'])));
     $fieldset->add_field(new FormFieldMultipleSelectChoice('authorized_extensions', $this->lang['auth_extensions'], $this->file_upload_config->get_authorized_extensions(), $extensions['authorized_extensions_select'], array('size' => 12)));
     $fieldset->add_field(new FormFieldTextEditor('extend_extensions', $this->lang['extend_extensions'], $extensions['extend_extensions'], array('description' => $this->lang['extend_extensions_explain'])));
     $this->submit_button = new FormButtonDefaultSubmit();
     $form->add_button($this->submit_button);
     $form->add_button(new FormButtonReset());
     $this->form = $form;
 }
 private function build_form()
 {
     $form = new HTMLForm(__CLASS__);
     $fieldset = new FormFieldsetHTML('delete_theme', $this->lang['themes.delete_theme']);
     $form->add_fieldset($fieldset);
     $fieldset->add_field(new FormFieldRadioChoice('drop_files', $this->lang['themes.drop_files'], '0', array(new FormFieldRadioChoiceOption(LangLoader::get_message('yes', 'common'), '1'), new FormFieldRadioChoiceOption(LangLoader::get_message('no', 'common'), '0'))));
     $this->submit_button = new FormButtonDefaultSubmit();
     $form->add_button($this->submit_button);
     $this->form = $form;
 }
 private function build_form()
 {
     $form = new HTMLForm(__CLASS__);
     $fieldset_config = new FormFieldsetHTML('configuration', LangLoader::get_message('configuration', 'admin-common'));
     $form->add_fieldset($fieldset_config);
     $fieldset_config->add_field(new FormFieldNumberEditor('number_member_displayed', $this->lang['admin.nbr-displayed'], $this->config->get_number_member_displayed(), array('min' => 1, 'max' => 1000, 'required' => true), array(new FormFieldConstraintIntegerRange(1, 1000))));
     $fieldset_config->add_field(new FormFieldNumberEditor('number_members_per_page', $this->lang['admin.nbr-members-per-page'], $this->config->get_number_members_per_page(), array('min' => 1, 'max' => 50, 'required' => true), array(new FormFieldConstraintIntegerRange(1, 50))));
     $fieldset_config->add_field(new FormFieldSimpleSelectChoice('display_order', $this->lang['admin.display-order'], $this->config->get_display_order(), array(new FormFieldSelectChoiceOption(LangLoader::get_message('ranks', 'main'), OnlineConfig::LEVEL_DISPLAY_ORDER), new FormFieldSelectChoiceOption($this->lang['online.last_update'], OnlineConfig::SESSION_TIME_DISPLAY_ORDER), new FormFieldSelectChoiceOption(LangLoader::get_message('ranks', 'main') . ' ' . LangLoader::get_message('and', 'main') . ' ' . $this->lang['online.last_update'], OnlineConfig::LEVEL_AND_SESSION_TIME_DISPLAY_ORDER))));
     $fieldset_authorizations = new FormFieldsetHTML('authorizations', LangLoader::get_message('authorizations', 'common'));
     $form->add_fieldset($fieldset_authorizations);
     //Authorizations list
     $auth_settings = new AuthorizationsSettings(array(new ActionAuthorization($this->lang['admin.authorizations.read'], OnlineAuthorizationsService::READ_AUTHORIZATIONS)));
     $auth_settings->build_from_auth_array($this->config->get_authorizations());
     $fieldset_authorizations->add_field(new FormFieldAuthorizationsSetter('authorizations', $auth_settings));
     $this->submit_button = new FormButtonDefaultSubmit();
     $form->add_button($this->submit_button);
     $form->add_button(new FormButtonReset());
     $this->form = $form;
 }
 private function build_form($type)
 {
     $form = new HTMLForm(__CLASS__);
     $fieldset = new FormFieldsetHTML('add-newsletter', $this->lang['newsletter-add']);
     $form->add_fieldset($fieldset);
     if (NewsletterConfig::load()->get_mail_sender()) {
         $fieldset->add_field(new FormFieldMultipleCheckbox('newsletter_choice', $this->lang['add.choice_streams'], array(), $this->get_streams(), array('required' => true)));
         $fieldset->add_field(new FormFieldTextEditor('title', $this->lang['newsletter.title'], NewsletterConfig::load()->get_newsletter_name(), array('required' => true)));
         $fieldset->add_field($this->return_editor($type));
         $this->submit_button = new FormButtonDefaultSubmit();
         $this->send_test_button = new FormButtonSubmit($this->lang['add.send_test'], 'send_test');
         $form->add_button($this->submit_button);
         $form->add_button($this->send_test_button);
         $form->add_button(new FormButtonReset());
     } else {
         $fieldset->add_field(new FormFieldHTML('mail_sender_not_configured_msg', MessageHelper::display($this->lang['error.sender-mail-not-configured' . (AppContext::get_current_user()->is_admin() ? '-for-admin' : '')], MessageHelper::WARNING)->render()));
         $this->submit_button = new FormButtonDefaultSubmit();
     }
     $this->form = $form;
 }
 private function build_form(HTTPRequestCustom $request)
 {
     $form = new HTMLForm(__CLASS__);
     $fieldset = new FormFieldsetHTML('delete_serie', $this->lang['calendar.titles.delete_event']);
     $form->add_fieldset($fieldset);
     $fieldset->add_field(new FormFieldRadioChoice('delete_serie', LangLoader::get_message('delete', 'common'), 0, array(new FormFieldRadioChoiceOption($this->lang['calendar.titles.delete_occurrence'], 0), new FormFieldRadioChoiceOption($this->lang['calendar.titles.delete_all_events_of_the_serie'], 1))));
     $fieldset->add_field(new FormFieldHidden('referrer', $request->get_url_referrer()));
     $this->submit_button = new FormButtonDefaultSubmit();
     $form->add_button($this->submit_button);
     $this->form = $form;
 }
 private function build_form()
 {
     $form = new HTMLForm(__CLASS__);
     $fieldset = new FormFieldsetHTML('comments-config', $this->lang['comments.config']);
     $form->add_fieldset($fieldset);
     $fieldset->add_field(new FormFieldNumberEditor('number_comments_display', $this->lang['comments.config.number-comments-display'], $this->configuration->get_number_comments_display(), array('required' => true), array(new FormFieldConstraintRegex('`^([0-9]+)$`i', '', LangLoader::get_message('form.doesnt_match_number_regex', 'status-messages-common')))));
     $fieldset->add_field(new FormFieldNumberEditor('max_links_comment', $this->lang['comments.config.max-links-comment'], $this->configuration->get_max_links_comment(), array('required' => true), array(new FormFieldConstraintRegex('`^([0-9]+)$`i', '', LangLoader::get_message('form.doesnt_match_number_regex', 'status-messages-common')))));
     $fieldset->add_field(new FormFieldSimpleSelectChoice('order_display_comments', $this->lang['comments.config.order-display-comments'], $this->configuration->get_order_display_comments(), array(new FormFieldSelectChoiceOption($this->lang['comments.config.order-display-comments.asc'], CommentsConfig::ASC_ORDER), new FormFieldSelectChoiceOption($this->lang['comments.config.order-display-comments.desc'], CommentsConfig::DESC_ORDER))));
     $fieldset->add_field(new FormFieldMultipleSelectChoice('forbidden_tags', $this->lang['comments.config.forbidden-tags'], $this->configuration->get_forbidden_tags(), $this->generate_forbidden_tags_option(), array('size' => 10)));
     $fieldset = new FormFieldsetHTML('authorization', $this->lang['comments.config.authorization']);
     $form->add_fieldset($fieldset);
     $auth_settings = new AuthorizationsSettings(array(new ActionAuthorization($this->lang['comments.config.authorization-read'], CommentsAuthorizations::READ_AUTHORIZATIONS), new ActionAuthorization($this->lang['comments.config.authorization-post'], CommentsAuthorizations::POST_AUTHORIZATIONS), new ActionAuthorization($this->lang['comments.config.authorization-moderation'], CommentsAuthorizations::MODERATE_AUTHORIZATIONS)));
     $auth_settings->build_from_auth_array($this->configuration->get_authorizations());
     $auth_setter = new FormFieldAuthorizationsSetter('authorizations', $auth_settings);
     $fieldset->add_field($auth_setter);
     $this->submit_button = new FormButtonDefaultSubmit();
     $form->add_button($this->submit_button);
     $form->add_button(new FormButtonReset());
     $this->form = $form;
 }
 private function build_form()
 {
     $form = new HTMLForm(__CLASS__);
     $fieldset = new FormFieldsetHTML('config', $this->admin_common_lang['configuration']);
     $form->add_fieldset($fieldset);
     $fieldset->add_field(new FormFieldNumberEditor('categories_number_per_page', $this->admin_common_lang['config.categories_number_per_page'], $this->config->get_categories_number_per_page(), array('min' => 1, 'max' => 50, 'required' => true), array(new FormFieldConstraintIntegerRange(1, 50))));
     $fieldset->add_field(new FormFieldNumberEditor('columns_number_per_line', $this->admin_common_lang['config.columns_number_per_line'], $this->config->get_columns_number_per_line(), array('min' => 1, 'max' => 4, 'required' => true), array(new FormFieldConstraintIntegerRange(1, 4))));
     $fieldset->add_field(new FormFieldSimpleSelectChoice('display_type', $this->admin_common_lang['config.display_type'], $this->config->get_display_type(), array(new FormFieldSelectChoiceOption($this->lang['config.display_type.answers_hidden'], FaqConfig::DISPLAY_TYPE_ANSWERS_HIDDEN), new FormFieldSelectChoiceOption($this->lang['config.display_type.display_all_answers'], FaqConfig::DISPLAY_TYPE_ALL_ANSWERS))));
     $fieldset->add_field(new FormFieldRichTextEditor('root_category_description', $this->admin_common_lang['config.root_category_description'], $this->config->get_root_category_description(), array('rows' => 8, 'cols' => 47)));
     $common_lang = LangLoader::get('common');
     $fieldset_authorizations = new FormFieldsetHTML('authorizations_fieldset', $common_lang['authorizations'], array('description' => $this->admin_common_lang['config.authorizations.explain']));
     $form->add_fieldset($fieldset_authorizations);
     $auth_settings = new AuthorizationsSettings(array(new ActionAuthorization($common_lang['authorizations.read'], Category::READ_AUTHORIZATIONS), new ActionAuthorization($common_lang['authorizations.write'], Category::WRITE_AUTHORIZATIONS), new ActionAuthorization($common_lang['authorizations.contribution'], Category::CONTRIBUTION_AUTHORIZATIONS), new ActionAuthorization($common_lang['authorizations.moderation'], Category::MODERATION_AUTHORIZATIONS)));
     $auth_setter = new FormFieldAuthorizationsSetter('authorizations', $auth_settings);
     $auth_settings->build_from_auth_array($this->config->get_authorizations());
     $fieldset_authorizations->add_field($auth_setter);
     $this->submit_button = new FormButtonDefaultSubmit();
     $form->add_button($this->submit_button);
     $form->add_button(new FormButtonReset());
     $this->form = $form;
 }
 private function build_form()
 {
     $security_config = SecurityConfig::load();
     $form = new HTMLForm(__CLASS__);
     $fieldset = new FormFieldsetHTML('fieldset', $this->lang['change-password']);
     $form->add_fieldset($fieldset);
     $fieldset->add_field($password = new FormFieldPasswordEditor('password', $this->lang['password.new'], '', array('description' => StringVars::replace_vars($this->lang['password.explain'], array('number' => $security_config->get_internal_password_min_length())), 'required' => true, 'maxlength' => 500), 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, 'maxlength' => 500), array(new FormFieldConstraintLengthMin($security_config->get_internal_password_min_length()), new FormFieldConstraintPasswordStrength())));
     $this->submit_button = new FormButtonDefaultSubmit();
     $form->add_button($this->submit_button);
     $form->add_constraint(new FormConstraintFieldsEquality($password, $password_bis));
     $this->form = $form;
 }
 private function build_form()
 {
     $form = new HTMLForm(__CLASS__);
     $fieldset = new FormFieldsetHTML('choices-fieldset');
     $form->add_fieldset($fieldset);
     if (NewsletterConfig::load()->get_mail_sender()) {
         $fieldset->add_field(new FormFieldHTML('choices_table', $this->build_choices_table()->render()));
         $this->submit_button = new FormButtonDefaultSubmit($this->lang['newsletter.types.next']);
         $form->add_button($this->submit_button);
     } else {
         $fieldset->add_field(new FormFieldHTML('mail_sender_not_configured_msg', MessageHelper::display($this->lang['error.sender-mail-not-configured' . (AppContext::get_current_user()->is_admin() ? '-for-admin' : '')], MessageHelper::WARNING)->render()));
         $this->submit_button = new FormButtonDefaultSubmit();
     }
     $this->form = $form;
 }
Exemplo n.º 27
0
 private function build_form()
 {
     $form = new HTMLForm(__CLASS__);
     $fieldset = new FormFieldsetHTML('send_a_mail', $this->config->get_title());
     $form->add_fieldset($fieldset);
     foreach ($this->config->get_fields() as $id => $properties) {
         $field = new ContactField();
         $field->set_properties($properties);
         if ($field->is_displayed() && $field->is_authorized()) {
             if ($field->get_field_name() == 'f_sender_mail') {
                 $field->set_default_value(AppContext::get_current_user()->get_email());
             }
             $field->set_fieldset($fieldset);
             ContactFieldsService::display_field($field);
         }
     }
     $this->submit_button = new FormButtonDefaultSubmit();
     $form->add_button($this->submit_button);
     $form->add_button(new FormButtonReset());
     $this->form = $form;
 }
    protected function build_form()
    {
        $form = new HTMLForm(__CLASS__);
        $fieldset = new FormFieldsetHTML('explain', $this->lang['cache_configuration']);
        $form->add_fieldset($fieldset);
        $fieldset->add_field(new FormFieldHTML('exp_php_cache', $this->lang['explain_php_cache']));
        $fieldset->add_field(new FormFieldBooleanInformation('apc_available', $this->lang['apc_available'], $this->is_apc_available(), array('description' => $this->lang['explain_apc_available'])));
        if ($this->is_apc_available()) {
            $fieldset->add_field(new FormFieldCheckbox('enable_apc', $this->lang['enable_apc'], $this->is_apc_enabled()));
        }
        $fieldset->add_field(new FormFieldHTML('exp_css_cache', '<hr><br />' . $this->lang['explain_css_cache_config']));
        $fieldset->add_field(new FormFieldCheckbox('enable_css_cache', $this->lang['enable_css_cache'], $this->css_cache_config->is_enabled(), array('events' => array('click' => '
			if (HTMLForms.getField("enable_css_cache").getValue()) {
				HTMLForms.getField("level_css_cache").enable();
			} else { 
				HTMLForms.getField("level_css_cache").disable();
			}'))));
        $fieldset->add_field(new FormFieldSimpleSelectChoice('level_css_cache', $this->lang['level_css_cache'], $this->css_cache_config->get_optimization_level(), array(new FormFieldSelectChoiceOption($this->lang['low_level_css_cache'], CSSFileOptimizer::LOW_OPTIMIZATION), new FormFieldSelectChoiceOption($this->lang['high_level_css_cache'], CSSFileOptimizer::HIGH_OPTIMIZATION)), array('description' => $this->lang['level_css_cache'], 'hidden' => !$this->css_cache_config->is_enabled())));
        $this->submit_button = new FormButtonDefaultSubmit();
        $form->add_button($this->submit_button);
        $this->form = $form;
    }
    private function build_smiley_form()
    {
        $form = new HTMLForm('smiley', '', false);
        $fieldset = new FormFieldsetHTML('smiley', !$this->smiley['idsmiley'] ? $this->lang['add_smiley'] : $this->lang['edit_smiley']);
        $form->add_fieldset($fieldset);
        $fieldset->add_field(new FormFieldTextEditor('code_smiley', $this->lang['smiley_code'], $this->smiley['code_smiley'], array('maxlength' => 50, 'required' => true)));
        $fieldset->add_field(new FormFieldSimpleSelectChoice('url_smiley', $this->lang['smiley_available'], $this->smiley['url_smiley'], $this->generate_available_smileys_pictures_list(), array('events' => array('change' => '
				if (HTMLForms.getField("url_smiley").getValue() != \'\') {
					jQuery(\'#smiley-img\').attr(\'src\', \'' . Url::to_rel('/images/smileys/') . '\' + HTMLForms.getField("url_smiley").getValue());
					HTMLForms.getField("img_smiley").enable();
				} else {
					HTMLForms.getField("img_smiley").disable();
				}'))));
        $img_smiley = new ImgHTMLElement($this->smiley['idsmiley'] ? Url::to_rel('/images/smileys/') . $this->smiley['url_smiley'] : '', array('id' => 'smiley-img', 'alt' => ''));
        $fieldset->add_field(new FormFieldFree('img_smiley', LangLoader::get_message('form.picture.preview', 'common'), $img_smiley->display(), array('hidden' => !$this->smiley['idsmiley'])));
        $this->smiley_submit_button = new FormButtonDefaultSubmit();
        $form->add_button($this->smiley_submit_button);
        $this->smiley_form = $form;
    }
    private function build_form()
    {
        $form = new HTMLForm(__CLASS__);
        $fieldset = new FormFieldsetHTML('maintain', LangLoader::get_message('maintain', 'user-common'));
        $form->add_fieldset($fieldset);
        $fieldset->add_field(new FormFieldSimpleSelectChoice('maintain_type', $this->lang['maintain_type'], $this->get_maintain_type(), $this->build_maintain_select_options(), array('events' => array('change' => 'if (HTMLForms.getField("maintain_type").getValue() == "during") {
					HTMLForms.getField("maintain_during").enable();
					HTMLForms.getField("maintain_until").disable();
				} else if (HTMLForms.getField("maintain_type").getValue() == "until") {
					HTMLForms.getField("maintain_during").disable();
					HTMLForms.getField("maintain_until").enable();
				} else {
					HTMLForms.getField("maintain_during").disable();
					HTMLForms.getField("maintain_until").disable();
				}'))));
        $fieldset->add_field(new FormFieldSimpleSelectChoice('maintain_during', LangLoader::get_message('during', 'main'), $this->get_maintain_during_select_option(), $this->build_maintain_during_select_options(), array('hidden' => $this->get_maintain_type() != 'during')));
        $fieldset->add_field(new FormFieldDate('maintain_until', LangLoader::get_message('until', 'main'), $this->get_maintain_until_date(), array('required' => true, 'hidden' => $this->get_maintain_type() != 'until')));
        $fieldset->add_field(new FormFieldCheckbox('display_duration', $this->lang['display_duration'], $this->maintenance_config->get_display_duration(), array('events' => array('click' => 'if (HTMLForms.getField("display_duration").getValue()) {
					HTMLForms.getField("display_duration_for_admin").enable();
				} else {
					HTMLForms.getField("display_duration_for_admin").disable();
				}'))));
        $fieldset->add_field(new FormFieldCheckbox('display_duration_for_admin', $this->lang['display_duration_for_admin'], $this->maintenance_config->get_display_duration_for_admin(), array('hidden' => !$this->maintenance_config->get_display_duration())));
        $fieldset->add_field(new FormFieldRichTextEditor('message', $this->lang['maintain_text'], $this->maintenance_config->get_message(), array('rows' => 14, 'cols' => 47)));
        $auth_settings = new AuthorizationsSettings(array(new ActionAuthorization($this->lang['maintain_authorization'], MaintenanceConfig::ACCESS_WHEN_MAINTAIN_ENABLED_AUTHORIZATIONS)));
        $auth_setter = new FormFieldAuthorizationsSetter('authorizations', $auth_settings);
        $auth_settings->build_from_auth_array($this->maintenance_config->get_auth());
        $fieldset->add_field($auth_setter);
        $this->submit_button = new FormButtonDefaultSubmit();
        $form->add_button($this->submit_button);
        $form->add_button(new FormButtonReset());
        $this->form = $form;
    }