X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=install%2Fsave.php;h=2b7d7ed83c44ab006e7f3878981914eb0aba1259;hb=380ae03e2df9602d07d156ae93b87cbe59b01b3a;hp=facba388023fd0d12373970195782b271b0d1f04;hpb=36b424339d64978875abbca17352370b54249cab;p=fa-stable.git diff --git a/install/save.php b/install/save.php index facba388..2b7d7ed8 100644 --- a/install/save.php +++ b/install/save.php @@ -27,7 +27,8 @@ if (!function_exists("_")) { // function display_error($message) { - global $_POST; + global $_POST, $path_to_root; + if(isset($message) AND $message != '') { // Copy values entered into session so user doesn't have to re-enter everything @@ -53,6 +54,7 @@ function display_error($message) // Specify that session support is enabled $_SESSION['session_support'] = 'Enabled'; // Redirect to first page again and exit + @unlink($path_to_root."/config.php"); // remove just created config file header('Location: index.php?sessions_checked=true'); exit(); } @@ -263,7 +265,7 @@ if (!isset($_POST['admin_email']) || $_POST['admin_email'] == '') } else { - if (eregi("^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$", $_POST['admin_email'])) + if (preg_match("/^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$/i", $_POST['admin_email'])) { $admin_email = $_POST['admin_email']; } @@ -295,9 +297,31 @@ if ($admin_password != $admin_repassword) } // End admin user details code +copy($path_to_root. "/config.default.php", $path_to_root. "/config.php"); + include_once($path_to_root . "/includes/db/connect_db.inc"); include_once($path_to_root . "/admin/db/maintenance_db.inc"); -include_once($path_to_root . "/config_db.php"); + +if (!file_exists($path_to_root . "/installed_extensions.php")) { + $next_extension_id = 1; + write_extensions(array()); + write_extensions(array(),0); +} +if (!file_exists($path_to_root . "/lang/installed_languages.inc")) { + $installed_languages = array ( + 0 => array ('code' => 'en_GB', 'name' => 'English', 'encoding' => 'iso-8859-1')); + $dflt_lang = 'en_GB'; + write_lang(); +} + +if (file_exists($path_to_root . "/config_db.php")) + include_once($path_to_root . "/config_db.php"); + else +{ + $def_coy = 0; + $tb_pref_counter = 0; + $db_connections = array (); +} $id = count($db_connections); if ($table_prefix != "" && $id > 0) @@ -344,7 +368,7 @@ if (!$db) if ($result) { $sql = "UPDATE ".$table_prefix."users SET password = '" . md5($admin_password) . "', email = ".db_escape($admin_email)." WHERE user_id = 'admin'"; db_query($sql, "could not update admin account"); - $sql = "UPDATE ".$table_prefix."company SET coy_name = ".db_escape($company_name)." WHERE coy_code = 1"; + $sql = "UPDATE ".$table_prefix."sys_prefs SET value = ".db_escape($company_name)." WHERE name='coy_name'"; db_query($sql, "could not update company name. Do it manually later in Setup"); $err = write_config_db($table_prefix != ""); @@ -358,6 +382,7 @@ if (!$db) } session_unset(); +session_regenerate_id(); session_destroy(); $_SESSION = array();