From bcad40a05ab2dc2a341a3227e30b96668bce4500 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Thu, 9 Jun 2005 16:34:40 +0000 Subject: New Import --- install.php | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 install.php (limited to 'install.php') diff --git a/install.php b/install.php new file mode 100644 index 00000000..45a9b96f --- /dev/null +++ b/install.php @@ -0,0 +1,132 @@ + $prefix,'font_size' => '12', 'bg_color1' => '#c0c0c0', 'font' => 'Verdana', 'error_color' => 'red'); +$conf_array['base_color1'] = "#a0a0a0"; +$conf_array['bg_color2'] = "#000000"; +conf($conf_array); + +/* First things first we must be sure that they actually still need to + install ampache +*/ +if (!install_check_status($configfile)) { + access_denied(); +} + +/* Clean up incomming variables */ +$action = scrub_in($_REQUEST['action']); +$web_path = scrub_in($_REQUEST['web_path']); +$username = scrub_in($_REQUEST['local_username']); +$password = scrub_in($_REQUEST['local_pass']); +$hostname = scrub_in($_REQUEST['local_host']); +$database = scrub_in($_REQUEST['local_db']); + +/* Catch the Current Action */ +switch ($action) { + + case 'create_db': + if (!install_insert_db($username,$password,$hostname,$database)) { + require_once('templates/show_install.inc'); + break; + } + + header ("Location: " . $_SERVER['PHP_SELF'] . "?action=show_create_config&local_db=$database&local_host=$hostname"); + + break; + case 'create_config': + $created_config = install_create_config($web_path,$username,$password,$hostname,$database); + + require_once('templates/show_install_config.inc'); + break; + case 'show_create_config': + + /* Attempt to Guess the Web_path */ + $web_path = dirname($_SERVER['PHP_SELF']); + $web_path = rtrim($web_path,"\/"); + + require_once('templates/show_install_config.inc'); + break; + case 'create_account': + if (!install_create_account($username,$password)) { + require_once('templates/show_install_account.inc.php'); + break; + } + $results = read_config($configfile, 0, 0); + if ($_SERVER['HTTPS'] == 'on') { $http_type = "https://"; } + else { $http_type = "http://"; } + + libglue_param($results['libglue']); + /* Setup Preferences */ + $temp_user = new User($username); + $temp_user->fix_preferences(); + $temp_user = new User(0); + $temp_user->fix_preferences(); + + + $web_path = $http_type . $_SERVER['HTTP_HOST'] . $results['conf']['web_path']; + + header ("Location: " . $web_path . "/login.php"); + + case 'show_create_account': + + $results = read_config($configfile, 0, 0); + + /* Make sure we've got a valid config file */ + if (!read_config_file($configfile) OR !check_config_values($results)) { + require_once('templates/show_install_config.inc'); + break; + } + + require_once('templates/show_install_account.inc.php'); + break; + default: + require_once('templates/show_install.inc'); + break; + +} // end action switch + + +?> -- cgit