private function build_form() { $security_config = SecurityConfig::load(); $this->form = new HTMLForm('adminForm', '', false); $fieldset = new FormFieldsetHTML('adminAccount', $this->lang['admin.account']); $this->form->add_fieldset($fieldset); $fieldset->add_field(new FormFieldTextEditor('display_name', LangLoader::get_message('display_name', 'user-common'), '', 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, $this->lang['admin.login.length'])))); $fieldset->add_field(new FormFieldMailEditor('email', $this->lang['admin.email'], '', array('required' => true))); $fieldset->add_field(new FormFieldCheckbox('custom_login', LangLoader::get_message('login.custom', 'user-common'), false, array('description' => LangLoader::get_message('login.custom.explain', 'user-common'), 'events' => array('click' => ' if (HTMLForms.getField("custom_login").getValue()) { HTMLForms.getField("login").enable(); } else { HTMLForms.getField("login").disable(); }')))); $fieldset->add_field(new FormFieldTextEditor('login', LangLoader::get_message('login', 'user-common'), '', array('required' => true, 'hidden' => true, 'maxlength' => 25), array(new FormFieldConstraintLengthRange(3, 25), new FormFieldConstraintPHPBoostAuthLoginExists()))); $fieldset->add_field($password = new FormFieldPasswordEditor('password', $this->lang['admin.password'], '', array('description' => StringVars::replace_vars($this->lang['admin.password.explanation'], array('number' => $security_config->get_internal_password_min_length())), 'required' => true), array(new FormFieldConstraintLengthMin($security_config->get_internal_password_min_length(), StringVars::replace_vars($this->lang['admin.password.length'], array('number' => $security_config->get_internal_password_min_length()))), new FormFieldConstraintPasswordStrength()))); $fieldset->add_field($repeatPassword = new FormFieldPasswordEditor('repeatPassword', $this->lang['admin.password.repeat'], '', array('required' => true), array(new FormFieldConstraintLengthMin($security_config->get_internal_password_min_length()), new FormFieldConstraintPasswordStrength()))); $this->form->add_constraint(new FormConstraintFieldsEquality($password, $repeatPassword)); $fieldset->add_field(new FormFieldCheckbox('createSession', $this->lang['admin.connectAfterInstall'], true)); $fieldset->add_field(new FormFieldCheckbox('autoconnect', $this->lang['admin.autoconnect'], true)); $action_fieldset = new FormFieldsetSubmit('actions'); $back = new FormButtonLinkCssImg($this->lang['step.previous'], InstallUrlBuilder::website(), 'fa fa-arrow-left'); $action_fieldset->add_element($back); $this->submit_button = new FormButtonSubmitCssImg($this->lang['step.next'], 'fa fa-arrow-right', 'admin'); $action_fieldset->add_element($this->submit_button); $this->form->add_fieldset($action_fieldset); }
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 add_navigation(Template $view) { $form = new HTMLForm('preambleForm', InstallUrlBuilder::license()->rel(), false); $action_fieldset = new FormFieldsetSubmit('actions'); $next = new FormButtonSubmitCssImg($this->lang['step.next'], 'fa fa-arrow-right', 'welcome'); $action_fieldset->add_element($next); $form->add_fieldset($action_fieldset); $view->put('LICENSE_FORM', $form->display()); }
public function __construct($step_number, $step_title, Template $view) { $this->load_language_resources(); $this->init_response($step_number, $view); $env = new InstallDisplayGraphicalEnvironment(); $this->add_language_bar(); $this->init_steps(); $this->update_progress_bar(); $this->full_view->put_all(array('RESTART' => InstallUrlBuilder::welcome()->rel(), 'STEP_TITLE' => $step_title, 'C_HAS_PREVIOUS_STEP' => false, 'C_HAS_NEXT_STEP' => false, 'L_XML_LANGUAGE' => LangLoader::get_message('xml_lang', 'main'), 'PROGRESSION' => floor(100 * $this->current_step / ($this->nb_steps - 1)), 'PHPBOOST_VERSION' => GeneralConfig::load()->get_phpboost_major_version())); parent::__construct($env, $this->full_view); }
private function build_form() { $this->form = new HTMLForm('licenseForm', '', false); $fieldset = new FormFieldsetHTML('agreementFieldset', $this->lang['step.license.terms.title']); $this->form->add_fieldset($fieldset); $agreement = new FormFieldHTML('agreementExplanation', $this->lang['step.license.require.agreement'] . '<br /><br />'); $fieldset->add_field($agreement); $license_content = file_get_contents('gpl-license.txt'); $license_block = '<div class="licence-container"><div class="license-content">' . $license_content . '</div></div>'; $license = new FormFieldHTML('licenseContent', $license_block); $fieldset->add_field($license); $agree_checkbox = new FormFieldCheckbox('agree', $this->lang['step.license.please_agree'], FormFieldCheckbox::UNCHECKED, array('required' => $this->lang['step.license.submit.alert'])); $fieldset->add_field($agree_checkbox); $action_fieldset = new FormFieldsetSubmit('actions'); $back = new FormButtonLinkCssImg($this->lang['step.previous'], InstallUrlBuilder::welcome(), 'fa fa-arrow-left'); $action_fieldset->add_element($back); $this->submit = new FormButtonSubmitCssImg($this->lang['step.next'], 'fa fa-arrow-right', 'license'); $action_fieldset->add_element($this->submit); $this->form->add_fieldset($action_fieldset); }
private function handle_form() { $installation_services = new InstallationServices(); $installation_services->configure_website($this->form->get_value('host'), $this->form->get_value('path'), $this->form->get_value('name'), $this->form->get_value('slogan'), $this->form->get_value('description'), $this->form->get_value('timezone')->get_raw_value()); $this->security_config->set_internal_password_min_length($this->form->get_value('internal_password_min_length')); $this->security_config->set_internal_password_strength($this->form->get_value('internal_password_strength')->get_raw_value()); if ($this->form->get_value('login_and_email_forbidden_in_password')) { $this->security_config->forbid_login_and_email_in_password(); } else { $this->security_config->allow_login_and_email_in_password(); } SecurityConfig::save(); if ($this->server_configuration->has_curl_library()) { if ($this->form->get_value('fb_auth_enabled')) { $this->authentication_config->enable_fb_auth(); $this->authentication_config->set_fb_app_id($this->form->get_value('fb_app_id')); $this->authentication_config->set_fb_app_key($this->form->get_value('fb_app_key')); } else { $this->authentication_config->disable_fb_auth(); } if ($this->form->get_value('google_auth_enabled')) { $this->authentication_config->enable_google_auth(); $this->authentication_config->set_google_client_id($this->form->get_value('google_client_id')); $this->authentication_config->set_google_client_secret($this->form->get_value('google_client_secret')); } else { $this->authentication_config->disable_google_auth(); } AuthenticationConfig::save(); } AppContext::get_response()->redirect(InstallUrlBuilder::admin()); }
public static function set_locale($locale) { self::$locale = $locale; }
private function handle_form() { if ($this->server_conf->is_php_compatible() && PHPBoostFoldersPermissions::validate()) { AppContext::get_response()->redirect(InstallUrlBuilder::database()); } }
private function create_tables(InstallationServices $service, $host, $port, $login, $password, $schema, $tables_prefix) { if (!$service->is_already_installed() || !$this->overwrite_field->is_disabled() && $this->overwrite_field->is_checked()) { PersistenceContext::close_db_connection(); $service->create_phpboost_tables(DBFactory::MYSQL, $host, $port, $schema, $login, $password, $tables_prefix); AppContext::get_response()->redirect(InstallUrlBuilder::website()); } else { $this->overwrite_fieldset->enable(); $this->error = $this->lang['phpboost.alreadyInstalled.explanation']; } }