if ($access) { require_once 'includes/configuration.php'; $configs = load_configs(); $configs_post = array(); if ($_POST['submitted']) { foreach ($_POST as $key => $currentPOST) { if (trim($currentPOST) != "" && $key != "no_js" && $key != "token" && $key != "submitted") { $configs_post[$key] = $currentPOST; } } $success = true; foreach ($configs as $key => $currentConfig) { if (!isset($configs_post[$key])) { $configs_post[$key] = "0"; } $result = Configuration::SetConfig($key, $configs_post[$key]); if (!$result) { $message = "<p class=\"error\">" . T_("Error when assigning the config variables") . "</p>"; $success = false; break; } } if ($success) { $message = T_("Configuration has been saved"); } if ($message != null && !isset($_POST['no_js'])) { if ($success) { $classMsg = "success"; $widthDiv = " style=\"width: 200px; text-align: center; margin:0px auto;\""; } else { $classMsg = "error";
} } } if (!$errorCreatingStructure) { // Add config vars $SETTINGS['path_mod'] = "../"; require_once '../includes/configuration.php'; $cachedir = dirname(__FILE__) . '/cache/'; $cachedir = str_replace('\\', '/', $cachedir); $cachedir = str_replace('/install', '', $cachedir); $website_dir = dirname(__FILE__); $website_dir = str_replace('\\', '/', $website_dir); $website_dir = str_replace('/install', '', $website_dir); $configVars = array("WEBSITE_NAME" => $website_name, "WEBSITE_LOCALE" => $website_locale, "WEBSITE_ROOT" => $website_root, "WEBSITE_DIR" => $website_dir, "USECACHE" => $usecache, "USE_DEMO" => $use_demo, "CURL_AVAILABLE" => $curl_available, "ANTI_SPAM" => $anti_spam, "CACHE_DIR" => $cachedir, "VERSION" => VERSION_NUMBER); foreach ($configVars as $key => $configVar) { $result = Configuration::SetConfig($key, $configVar, "../"); if (!$result) { $errors[] = "Error when assigning the config variables"; break; } } // Create admin account $passencrypt = $user->encryptPassword($admin_password); $Query = "insert into " . TABLE_PREFIX . "session (Name, Pass, Email, LastLog, DateJoin, Status, Style) " . "values('{$admin_username}','{$passencrypt}','{$admin_email}', now(), now(), 'admin', 'Auto')"; //echo($Query . "<br>\n"); $AffectedRows = $dblink->exec($Query); $Query = "INSERT INTO " . TABLE_PREFIX . "activation values ('{$admin_username}', '0', 'Y', NULL, '{$admin_email}')"; $dbResult = $dblink->exec($Query); $AffectedRows += $dbResult; if ($AffectedRows != 2) { $errors[] = "Error when creating the admin user";