$zone_string .= '<option value="-1"' . setSelected('-1', $_POST['store_zone']) . '>' . '-- Please Select --' . '</option>'; $zone_string .= '<option value="0"' . setSelected('0', $_POST['store_zone']) . '>' . '-None-' . '</option>'; while (!$zone->EOF) { $zone_string .= '<option value="' . $zone->fields['zone_id'] . '"' . setSelected($zone->fields['zone_id'], $_POST['store_zone']) . '>' . $zone->fields['zone_name'] . '</option>'; $zone->MoveNext(); } $sql = "select code, name from " . DB_PREFIX . "languages"; $store_language = $db->Execute($sql); $language_string = ''; while (!$store_language->EOF) { $language_string .= '<option value="' . $store_language->fields['code'] . '"' . setSelected($store_language->fields['code'], $_POST['store_default_language']) . '>' . $store_language->fields['name'] . '</option>'; $store_language->MoveNext(); } $sql = "select title, code from " . DB_PREFIX . "currencies"; $currency = $db->Execute($sql) or die("error in {$sql}" . $db->ErrorMsg()); $currency_string = ''; while (!$currency->EOF) { $currency_string .= '<option value="' . $currency->fields['code'] . '"' . setSelected($currency->fields['code'], $_POST['store_default_currency']) . '>' . $currency->fields['title'] . '</option>'; $currency->MoveNext(); } $db->Close(); if (!isset($_POST['demo_install'])) { $_POST['demo_install'] = false; } setInputValue($_POST['store_name'], 'STORE_NAME_VALUE', ''); setInputValue($_POST['store_owner'], 'STORE_OWNER_VALUE', ''); setInputValue($_POST['store_owner_email'], 'STORE_OWNER_EMAIL_VALUE', ''); setInputValue($_POST['store_address'], 'STORE_ADDRESS_VALUE', STORE_ADDRESS_DEFAULT_VALUE); setRadioChecked($_POST['demo_install'], 'DEMO_INSTALL', 'false'); // this sets the first field to email address on login - setting in /common/tpl_main_page.php $zc_first_field = 'onload="document.getElementById(\'store_name\').focus()"';
// @TODO: actually *test* the HTTPS URL if supplied, to determine whether it's actually valid or not. $zc_install->isEmpty($_POST['virtual_https_path'], ERROR_TEXT_VIRTUAL_HTTPS_ISEMPTY, ERROR_CODE_VIRTUAL_HTTPS_ISEMPTY); $zc_install->isEmpty($_POST['virtual_https_server'], ERROR_TEXT_VIRTUAL_HTTPS_SERVER_ISEMPTY, ERROR_CODE_VIRTUAL_HTTPS_SERVER_ISEMPTY); } if (!$zc_install->fatal_error) { $zc_install->setConfigKey('DIR_FS_CATALOG', $zc_install->trimTrailingSlash($_POST['physical_path'])); $zc_install->setConfigKey('virtual_http_path', $zc_install->trimTrailingSlash($_POST['virtual_http_path'])); $zc_install->setConfigKey('virtual_https_path', $zc_install->trimTrailingSlash($_POST['virtual_https_path'])); $zc_install->setConfigKey('virtual_https_server', $zc_install->trimTrailingSlash($_POST['virtual_https_server'])); $zc_install->setConfigKey('ENABLE_SSL', $_POST['enable_ssl']); $zc_install->setConfigKey('ENABLE_SSL_ADMIN', $_POST['enable_ssl_admin']); header('location: index.php?main_page=config_checkup&action=write' . zcInstallAddSID()); exit; } } // quick sanitization foreach ($_POST as $key => $val) { if (is_array($val)) { foreach ($val as $key2 => $val2) { $_POST[$key][$key2] = htmlspecialchars($val2, ENT_COMPAT, CHARSET, TRUE); } } else { $_POST[$key] = htmlspecialchars($val, ENT_COMPAT, CHARSET, TRUE); } } setInputValue($_POST['physical_path'], 'PHYSICAL_PATH_VALUE', $dir_fs_www_root); setInputValue($_POST['virtual_http_path'], 'VIRTUAL_HTTP_PATH_VALUE', 'http://' . $virtual_path); setInputValue($_POST['virtual_https_path'], 'VIRTUAL_HTTPS_PATH_VALUE', 'https://' . $virtual_https_path); setInputValue($_POST['virtual_https_server'], 'VIRTUAL_HTTPS_SERVER_VALUE', 'https://' . $virtual_https_server); setRadioChecked($_POST['enable_ssl'], 'ENABLE_SSL', $enable_ssl); setRadioChecked($_POST['enable_ssl_admin'], 'ENABLE_SSL_ADMIN', $enable_ssl_admin);
if (!isset($_POST['db_username'])) { $_POST['db_username'] = $zdb_user; } if (!isset($_POST['db_name'])) { $_POST['db_name'] = $zdb_name; } if (!isset($_POST['sql_cache'])) { $_POST['sql_cache'] = $zdb_sql_cache; } if (!isset($_POST['db_conn'])) { $_POST['db_conn'] = $zdb_persistent; } if (!isset($_POST['db_sess'])) { $_POST['db_sess'] = $zdb_sessions; } if (!isset($_POST['db_prefix'])) { $_POST['db_prefix'] = $zdb_prefix; } if (!isset($_POST['db_type'])) { $_POST['db_type'] = $zdb_type; } if (!isset($_POST['cache_type'])) { $_POST['cache_type'] = $zdb_cache_type; } setInputValue($_POST['db_host'], 'DATABASE_HOST_VALUE', $zdb_server); setInputValue($_POST['db_username'], 'DATABASE_USERNAME_VALUE', $zdb_user); setInputValue($_POST['db_name'], 'DATABASE_NAME_VALUE', $zdb_name); setInputValue($_POST['sql_cache'], 'SQL_CACHE_VALUE', $zdb_sql_cache); setInputValue($_POST['db_prefix'], 'DATABASE_NAME_PREFIX', $zdb_prefix); setRadioChecked($_POST['db_conn'], 'DB_CONN', $zdb_persistent); setRadioChecked($_POST['db_sess'], 'DB_SESS', $zdb_sessions);
} if (!isset($_POST['admin_pass_confirm'])) { $_POST['admin_pass_confirm'] = ''; } if (!isset($_POST['check_for_updates'])) { $_POST['check_for_updates'] = 'True'; } $zc_install->validateAdminSetup($_POST); $zc_install->isEqual($zc_install->configInfo['admin_pass'], zen_db_prepare_input($_POST['admin_pass_confirm']), ERROR_TEXT_ADMIN_PASS_NOTEQUAL, ERROR_CODE_ADMIN_PASS_NOTEQUAL); if (!$zc_install->error) { $zc_install->dbAdminSetup(); $zc_install->resetConfigKeys(); $zc_install->resetConfigInfo(); header('location: index.php?main_page=finished' . zcInstallAddSID()); exit; } } // quick sanitization foreach ($_POST as $key => $val) { if (is_array($val)) { foreach ($val as $key2 => $val2) { $_POST[$key][$key2] = htmlspecialchars($val2, ENT_COMPAT, CHARSET, TRUE); } } else { $_POST[$key] = htmlspecialchars($val, ENT_COMPAT, CHARSET, TRUE); } } setInputValue($_POST['admin_username'], 'ADMIN_USERNAME_VALUE', ''); setInputValue($_POST['admin_email'], 'ADMIN_EMAIL_VALUE', ''); // this sets the first field to email address on login - setting in /common/tpl_main_page.php $zc_first_field = 'onload="document.getElementById(\'admin_username\').focus()"';
$phpbb_suggest_dir = $docroot . str_replace($docroot, '', $_GET['physical_path']) . $testpath; break; } } $phpbb_suggest_dir = substr($phpbb_suggest_dir, -1) == '/' ? substr($phpbb_suggest_dir, 0, strlen($phpbb_suggest_dir) - 1) : $phpbb_suggest_dir; //remove any trailing slashes $phpbb_suggest_dir = str_replace('//', '/', $phpbb_suggest_dir); // remove any double-slashes if (isset($_POST['submit'])) { if ($_POST['phpbb_use'] == 'true') { $zc_install->fileExists($_POST['phpbb_dir'] . '/config.php', ERROR_TEXT_PHPBB_CONFIG_NOTEXIST . ' :' . $_POST['phpbb_dir'] . '/config.php', ERROR_CODE_PHPBB_CONFIG_NOTEXIST); // } else { // $_POST['phpbb_dir'] = ''; // if option set to "false", then do not enter a path in the configure.php file. } if (!$zc_install->fatal_error) { header('location: index.php?main_page=database_setup&language=' . $language . '&physical_path=' . $_GET['physical_path'] . '&physical_https_path=' . $_GET['physical_https_path'] . '&virtual_http_path=' . $_GET['virtual_http_path'] . '&virtual_https_path=' . $_GET['virtual_https_path'] . '&virtual_https_server=' . $_GET['virtual_https_server'] . '&enable_ssl=' . $_GET['enable_ssl'] . '&enable_ssl_admin=' . $_GET['enable_ssl_admin'] . '&sql_cache=' . $_GET['sql_cache'] . '&phpbb_dir=' . $_POST['phpbb_dir'] . '&is_upgrade=' . $_GET['is_upgrade'] . '&use_phpbb=' . $_POST['phpbb_use']); } } //endif 'submit' //future use (2 lines): // if (!isset($_POST['phpbb_db_name'])) $_POST['phpbb_db_name'] = ''; // if (!isset($_POST['phpbb_db_prefix'])) $_POST['phpbb_db_prefix'] = ''; // set defaults if (!isset($_POST['phpbb_dir'])) { $_POST['phpbb_dir'] = $phpbb_suggest_dir; } if (!isset($_POST['phpbb_use'])) { $_POST['phpbb_use'] = ''; } setInputValue($_POST['phpbb_dir'], 'PHPBB_DIR_VALUE', $phpbb_suggest_dir); setRadioChecked($_POST['phpbb_use'], 'PHPBB_USE', 'false');