X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=install%2Fsave.php;h=1e568b653d8d6a9f4a399fccb0f899d1bb1b4712;hb=85faf95991945b3f5c570e57e232562a1a137408;hp=2df68e9f96cee8de2a1442480b32a3548d28c90f;hpb=86e4d1627183fb4d97fe145a5dd33b43b03284ee;p=fa-stable.git diff --git a/install/save.php b/install/save.php index 2df68e9f..1e568b65 100644 --- a/install/save.php +++ b/install/save.php @@ -1,13 +1,10 @@ . + This installer is based on code from the + Website Baker Project + Copyright (C) 2004-2007, Ryan Djurovich. + The code is released under GPLv3 + modified by FrontAcounting, LLC. ***********************************************************************/ error_reporting(E_ALL); ini_set("display_errors", "On"); @@ -30,49 +27,23 @@ 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 if(isset($_POST['company_name'])) { $_SESSION['ba_url'] = $_POST['ba_url']; - if(!isset($_POST['operating_system'])) - { - $_SESSION['operating_system'] = 'linux'; - } - else - { - $_SESSION['operating_system'] = $_POST['operating_system']; - } - if(!isset($_POST['world_writeable'])) - { - $_SESSION['world_writeable'] = false; - } - else - { - $_SESSION['world_writeable'] = true; - } + $_SESSION['operating_system'] = isset($_POST['operating_system']); + $_SESSION['world_writeable'] = isset($_POST['world_writeable']); $_SESSION['database_host'] = $_POST['database_host']; $_SESSION['database_username'] = $_POST['database_username']; $_SESSION['database_password'] = $_POST['database_password']; $_SESSION['database_name'] = $_POST['database_name']; - if(!isset($_POST['table_prefix'])) - { - $_SESSION['table_prefix'] = false; - } - else - { - $_SESSION['table_prefix'] = true; - } - if(!isset($_POST['install_tables'])) - { - $_SESSION['install_tables'] = false; - } - else - { - $_SESSION['install_tables'] = true; - } + $_SESSION['demo_data'] = isset($_POST['demo_data']); + $_SESSION['table_prefix'] = isset($_POST['table_prefix']); + $_SESSION['install_tables'] = isset($_POST['install_tables']); $_SESSION['company_name'] = $_POST['company_name']; $_SESSION['admin_email'] = $_POST['admin_email']; $_SESSION['admin_password'] = $_POST['admin_password']; @@ -83,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(); } @@ -281,7 +253,7 @@ else // End website company name // Check if the user has entered a correct path -if (!file_exists($path_to_root.'/sql/en_US-demo.sql')) +if (!file_exists($path_to_root.'/sql/en_US-'.(isset($_POST['demo_data']) ? 'demo':'new').'.sql')) { display_error('It appears the Absolute path that you entered is incorrect'); } @@ -293,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']; } @@ -325,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) @@ -363,7 +357,7 @@ if (!$db) $result = mysql_select_db($database_name, $db); } if($result) { - $import_filename = $path_to_root."/sql/en_US-demo.sql"; + $import_filename = $path_to_root.'/sql/en_US-'.(isset($_POST['demo_data']) ? 'demo':'new').'.sql'; db_import($import_filename, $db_connections[$id]); } } @@ -388,6 +382,7 @@ if (!$db) } session_unset(); +session_regenerate_id(); session_destroy(); $_SESSION = array();