_sServerHttpHost = false === $sServerHttpHost ? $_SERVER['HTTP_HOST'] : $sServerHttpHost; $this->_sServerPhpSelf = false === $sServerPhpSelf ? $_SERVER['PHP_SELF'] : $sServerPhpSelf; $this->_sServerDocumentRoot = false === $sServerDocumentRoot ? $_SERVER['DOCUMENT_ROOT'] : $sServerDocumentRoot; $this->_isAutologin = $isAutologin; $this->_sSqlDb = BX_INSTALL_DIR . 'sql/system.sql'; $this->_sSqlAddon = BX_INSTALL_DIR . 'sql/addon.sql'; $this->_sPatternHeader = BX_INSTALL_DIR . 'patterns/header.inc.php'; $this->_aDbErrorMap = array ( 'Database connect failed' => array ('fields' => array('db_host', 'db_user', 'db_password'), 'msg' => _t('_sys_inst_msg_db_err_connect')), 'Database select failed' => array ('fields' => array('db_name'), 'msg' => _t('_sys_inst_msg_db_err_select')), ); $this->_aConfig = array ( // path config 'section_site_paths_open' => array( 'name' => _t('_sys_inst_conf_section_paths'), 'func' => 'rowSectionOpen', ), 'site_url' => array( 'name' => _t('_sys_inst_conf_field_site_url'), 'ex' => 'http://www.mydomain.com/path/', 'desc' => _t('_sys_inst_conf_desc_site_url'), 'def' => 'http://', 'def_exp' => array('defUrl', ''), 'check' => array('checkLength', 10), ), 'root_dir' => array( 'name' => _t('_sys_inst_conf_field_root_dir'), 'ex' => '/home/mydomain/public_html/', 'desc' => _t('_sys_inst_conf_desc_root_dir'), 'def_exp' => array('defPath', ''), 'check' => array('checkLength', 1), ), 'section_site_paths_close' => array( 'func' => 'rowSectionClose', ), // db config 'section_db_config_open' => array( 'name' => _t('_sys_inst_conf_section_db_config'), 'func' => 'rowSectionOpen', ), 'db_host' => array( 'name' => _t('_sys_inst_conf_field_db_host'), 'ex' => 'localhost', 'desc' => _t('_sys_inst_conf_desc_db_host'), 'def' => 'localhost', 'check' => array('checkLength', 1), 'db_conf' => 'host', ), 'db_port' => array( 'name' => _t('_sys_inst_conf_field_db_port'), 'ex' => '5506', 'desc' => _t('_sys_inst_conf_desc_db_port'), 'db_conf' => 'port', ), 'db_sock' => array( 'name' => _t('_sys_inst_conf_field_db_sock'), 'ex' => '/tmp/mysql.sock', 'desc' => _t('_sys_inst_conf_desc_db_sock'), 'db_conf' => 'sock', ), 'db_name' => array( 'name' => _t('_sys_inst_conf_field_db_name'), 'ex' => 'mydomian_tri', 'desc' => _t('_sys_inst_conf_desc_db_name'), 'check' => array('checkLength', 1), 'db_conf' => 'name', ), 'db_user' => array( 'name' => _t('_sys_inst_conf_field_db_user'), 'ex' => 'mydomian_tri', 'desc' => _t('_sys_inst_conf_desc_db_user'), 'check' => array('checkLength', 1), 'db_conf' => 'user', ), 'db_password' => array( 'name' => _t('_sys_inst_conf_field_db_pwd'), 'ex' => 'Super*Secret#Word_1234', 'desc' => _t('_sys_inst_conf_desc_db_pwd'), 'db_conf' => 'pwd', ), 'db_engine' => array( 'name' => _t('_sys_inst_conf_field_db_engine'), 'ex' => 'INNODB', 'desc' => _t('_sys_inst_conf_desc_db_engine'), 'def' => 'MYISAM', ), 'section_db_config_close' => array( 'func' => 'rowSectionClose', ), // site config 'section_site_info_open' => array( 'name' => _t('_sys_inst_conf_section_site_info'), 'func' => 'rowSectionOpen', ), 'site_title' => array( 'name' => _t('_sys_inst_conf_field_site_title'), 'ex' => 'The Best Community', 'desc' => _t('_sys_inst_conf_desc_site_title'), 'check' => array('checkLength', 1), ), 'site_email' => array( 'name' => _t('_sys_inst_conf_field_site_email'), 'ex' => 'no-reply@youdomain.here', 'desc' => _t('_sys_inst_conf_desc_site_email'), 'check' => array('checkEmail', 3), ), 'admin_email' => array( 'name' => _t('_sys_inst_conf_field_admin_email'), 'ex' => 'admin@email.here', 'desc' => _t('_sys_inst_conf_desc_admin_email'), 'check' => array('checkEmail', 3), ), 'admin_username' => array( 'name' => _t('_sys_inst_conf_field_admin_username'), 'ex' => 'admin', 'desc' => _t('_sys_inst_conf_desc_admin_username'), 'check' => array('checkLength', 1), ), 'admin_password' => array( 'name' => _t('_sys_inst_conf_field_admin_pwd'), 'ex' => 'Super*Secret#Word_1234', 'desc' => _t('_sys_inst_conf_desc_admin_pwd'), 'check' => array('checkLength', 1), ), 'section_site_info_close' => array( 'func' => 'rowSectionClose', ), // link with boonex market 'section_link_to_market_open' => array( 'name' => _t('_sys_inst_conf_section_link_with_market'), 'func' => 'rowSectionOpen', ), 'oauth_key' => array( 'name' => _t('_sys_inst_conf_field_oauth_key'), 'ex' => '123abc4d', 'desc' => _t('_sys_inst_conf_desc_oauth_key_secret'), 'check' => array('checkLengthExactOrEmpty', 10), ), 'oauth_secret' => array( 'name' => _t('_sys_inst_conf_field_oauth_secret'), 'ex' => '45de12368a9b367abc23512a', 'desc' => _t('_sys_inst_conf_desc_oauth_key_secret'), 'check' => array('checkLengthExactOrEmpty', 32), ), 'section_link_to_market_close' => array( 'func' => 'rowSectionClose', ), // modules 'section_modules_open' => array( 'name' => _t('_sys_inst_conf_section_modules'), 'func' => 'rowSectionOpen', ), BX_DOL_MODULE_TYPE_LANGUAGE => array( 'name' => _t('_sys_inst_conf_field_language'), 'desc' => _t('_sys_inst_conf_desc_language'), 'def' => isset($_COOKIE['lang']) ? $_COOKIE['lang'] : (isset($_GET['lang']) ? $_GET['lang'] : 'en'), 'func' => 'rowSelect', 'vals' => $this->getSelectValues(BX_DOL_MODULE_TYPE_LANGUAGE), ), BX_DOL_MODULE_TYPE_TEMPLATE => array( 'name' => _t('_sys_inst_conf_field_template'), 'desc' => _t('_sys_inst_conf_desc_template'), 'def' => 'artificer', 'func' => 'rowSelect', 'vals' => $this->getSelectValues(BX_DOL_MODULE_TYPE_TEMPLATE), ), BX_DOL_MODULE_TYPE_MODULE => array( 'name' => _t('_sys_inst_conf_field_profiles'), 'desc' => _t('_sys_inst_conf_desc_profiles'), 'def' => 'persons', 'func' => 'rowSelect', 'vals' => $this->getSelectValues(BX_DOL_MODULE_TYPE_MODULE), ), 'section_modules_close' => array( 'func' => 'rowSectionClose', ), ); } public function getAutoValues($aData = array()) { $aRet = array(); foreach($this->_aConfig as $sKey => $a) { $sAutoMessage = ''; $aRet[$sKey] = $this->def ($aData, $sKey, $a, $sAutoMessage); } return $aRet; } public function getFormHtml($aData = false, $bRedirectOnSuccess = true, &$sOutputErrorMessage = null) { if (false === $aData) $aData = $_POST; $aErrorFields = array(); if (isset($aData['site_config'])) { $aErrorFields = $this->processConfigData($this->processInputData($aData)); if (empty($aErrorFields)) { if ($bRedirectOnSuccess) { $sHost = $this->_sServerHttpHost; $sUri = rtrim(dirname($this->_sServerPhpSelf), '/\\'); $sPage = 'index.php?action=finish'; $sProto = $this->proto(); header("Location: {$sProto}{$sHost}{$sUri}/{$sPage}"); exit; } else { return true; } } } $sErrorMessage = ''; if (isset($aErrorFields[BX_INSTALL_ERR_GENERAL]) && $aErrorFields[BX_INSTALL_ERR_GENERAL]) { $sErrorMessage = '
'; if (null !== $sOutputErrorMessage) $sOutputErrorMessage = $aErrorFields[BX_INSTALL_ERR_GENERAL] . (empty($aErrorFields) ? '' : ' / Fields: ' . join(',', array_keys($aErrorFields))); } $sRows = $this->getFormFields($aErrorFields, $aData); $sSubmitTitle = _t('_Submit'); return <<