diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-08-30 19:49:39 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-08-30 19:49:39 +0000 |
commit | 3267cf14b9fa2ffdf1918fe68dd067ee932a5867 (patch) | |
tree | 4f9ff7f027b61d52f5620943ccd66a22ee1a796d | |
parent | 96d7639ca1e320019e870c109e42f0618c16cf6b (diff) | |
download | ampache-3267cf14b9fa2ffdf1918fe68dd067ee932a5867.tar.gz ampache-3267cf14b9fa2ffdf1918fe68dd067ee932a5867.tar.bz2 ampache-3267cf14b9fa2ffdf1918fe68dd067ee932a5867.zip |
sync from branch
-rw-r--r-- | install.php | 16 | ||||
-rw-r--r-- | lib/install.php | 11 | ||||
-rw-r--r-- | templates/show_install.inc.php | 8 | ||||
-rw-r--r-- | templates/show_install_account.inc.php | 4 | ||||
-rw-r--r-- | templates/show_install_config.inc.php | 8 | ||||
-rw-r--r-- | templates/show_install_lang.inc.php | 4 |
6 files changed, 25 insertions, 26 deletions
diff --git a/install.php b/install.php index 0c6873ef..b7249318 100644 --- a/install.php +++ b/install.php @@ -62,7 +62,9 @@ $hostname = scrub_in($_REQUEST['local_host']); $database = scrub_in($_REQUEST['local_db']); if ($_SERVER['HTTPS'] == 'on') { $http_type = "https://"; } else { $http_type = "http://"; } -$php_self = $http_type . $_SERVER['HTTP_HOST'] . "/" . preg_replace("/^\/(.+\.php)\/?.*/","$1",$_SERVER['PHP_SELF']); + +define('WEB_PATH',$http_type . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/' . basename($_SERVER['PHP_SELF'])); +define('WEB_ROOT',$http_type . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF'])); /* Catch the Current Action */ switch ($_REQUEST['action']) { @@ -81,7 +83,7 @@ switch ($_REQUEST['action']) { break; } - header ("Location: " . $php_self . "?action=show_create_config&local_db=$database&local_host=$hostname&htmllang=$htmllang&charset=$charset"); + header ("Location: " . WEB_PATH . "?action=show_create_config&local_db=$database&local_host=$hostname&htmllang=$htmllang&charset=$charset"); break; case 'create_config': @@ -146,12 +148,7 @@ switch ($_REQUEST['action']) { break; } - if ($_SERVER['HTTPS'] == 'on') { $http_type = "https://"; } - else { $http_type = "http://"; } - - $web_path = $http_type . $_SERVER['HTTP_HOST'] . $results['web_path']; - - header ("Location: " . $web_path . "/login.php"); + header ("Location: " . WEB_ROOT . "/login.php"); break; case 'show_create_account': @@ -168,6 +165,7 @@ switch ($_REQUEST['action']) { /* Make sure we've got a valid config file */ if (!check_config_values($results)) { + Error::add('general',_('Error: Config file not found or Unreadable')); require_once Config::get('prefix') . '/templates/show_install_config.inc.php'; break; } @@ -249,7 +247,7 @@ switch ($_REQUEST['action']) { Config::set('lang',$htmllang,'1'); Config::set('site_charset', $charset, '1'); load_gettext(); - //header ("Content-Type: text/html; charset=$charset"); + /* Show the language options first */ require_once 'templates/show_install_lang.inc.php'; break; diff --git a/lib/install.php b/lib/install.php index e0c19ae9..c8fbb1ab 100644 --- a/lib/install.php +++ b/lib/install.php @@ -106,17 +106,11 @@ function install_insert_db($username,$password,$hostname,$database) { return false; } - $data['database_username'] = $username; $data['database_password'] = $password; $data['database_hostname'] = $hostname; $data['database_name'] = $database; - if (!strlen($data['database_password'])) { - Error::add('general','Error: Password required for Database creation'); - return false; - } - Config::set_by_array($data,'1'); unset($data); @@ -132,7 +126,10 @@ function install_insert_db($username,$password,$hostname,$database) { /* Check/Create Database as needed */ $db_selected = @mysql_select_db($database, $dbh); - if ($db_selected && !$_POST['overwrite_db']) { + if ($db_selected && $_POST['existing_db']) { + // Rien a faire, we've got the db just blow through + } + elseif ($db_selected && !$_POST['overwrite_db']) { Error::add('general','Error: Database Already exists and Overwrite not checked'); return false; } diff --git a/templates/show_install.inc.php b/templates/show_install.inc.php index 5c0ebb90..b42b6769 100644 --- a/templates/show_install.inc.php +++ b/templates/show_install.inc.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2007 Ampache.org + Copyright (c) Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -60,7 +60,7 @@ if (INSTALL != '1') { exit; } <?php Error::display('general'); ?> <br /> <span class="header2"><?php echo _('Insert Ampache Database'); ?></span> - <form method="post" action="<?php echo $http_type . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "?action=create_db&htmllang=$htmllang&charset=$charset"; ?>" enctype="multipart/form-data" > + <form method="post" action="<?php echo WEB_PATH . "?action=create_db&htmllang=$htmllang&charset=$charset"; ?>" enctype="multipart/form-data" > <table> <tr> <td class="align"><?php echo _("Desired Database Name"); ?></td> @@ -95,6 +95,10 @@ if (INSTALL != '1') { exit; } <td><input type="checkbox" name="overwrite_db" value="1" /></td> </tr> <tr> + <td class="align"><?php echo _('Use Existing Database'); ?></td> + <td><input type="checkbox" name="existing_db" value="1" /></td> +</tr> +<tr> <td> </td> <td><input type="submit" value="<?php echo _("Insert Database"); ?>" /></td> </tr> diff --git a/templates/show_install_account.inc.php b/templates/show_install_account.inc.php index e751a1bd..1e6991d3 100644 --- a/templates/show_install_account.inc.php +++ b/templates/show_install_account.inc.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2007 Ampache.org + Copyright (c) Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -55,7 +55,7 @@ if (INSTALL != '1') { exit; } <?php Error::display('general'); ?> <br /> <span class="header2"><?php echo _('Create Admin Account'); ?></span> - <form method="post" action="<?php echo $GLOBALS['php_self'] . "?action=create_account&htmllang=$htmllang&charset=$charset"; ?>" enctype="multipart/form-data" > + <form method="post" action="<?php echo WEB_PATH . "?action=create_account&htmllang=$htmllang&charset=$charset"; ?>" enctype="multipart/form-data" > <table> <tr> <td class="align"><?php echo _('Username'); ?></td> diff --git a/templates/show_install_config.inc.php b/templates/show_install_config.inc.php index 2c8f630c..43c55c3b 100644 --- a/templates/show_install_config.inc.php +++ b/templates/show_install_config.inc.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2007 Ampache.org + Copyright (c) Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -55,7 +55,7 @@ if (INSTALL != '1') { exit; } <?php Error::display('general'); ?> <br /> <span class="header2"><?php echo _('Generate Config File'); ?></span> - <form method="post" action="<?php echo $_SERVER['PHP_SELF'] . "?action=create_config"; ?>" enctype="multipart/form-data" > + <form method="post" action="<?php echo WEB_PATH . "?action=create_config"; ?>" enctype="multipart/form-data" > <table> <tr> <td class="align"><?php echo _('Web Path'); ?></td> @@ -123,13 +123,13 @@ if (INSTALL != '1') { exit; } <tr> <td> </td> <td> - <?php $check_url = $GLOBALS['php_self'] . "?action=show_create_config&htmllang=$htmllang&charset=$charset&local_db=" . $_REQUEST['local_db'] . "&local_host=" . $_REQUEST['local_host']; ?> + <?php $check_url = WEB_PATH . "?action=show_create_config&htmllang=$htmllang&charset=$charset&local_db=" . $_REQUEST['local_db'] . "&local_host=" . $_REQUEST['local_host']; ?> <a href="<?php echo $check_url; ?>">[<?php echo _('Check for Config'); ?>]</a> </td> </tr> </table> <br /> - <form method="post" action="<?php echo $GLOBALS['php_self'] . "?action=show_create_account&htmllang=$htmllang&charset=$charset"; ?>" enctype="multipart/form-data"> + <form method="post" action="<?php echo WEB_PATH . "?action=show_create_account&htmllang=$htmllang&charset=$charset"; ?>" enctype="multipart/form-data"> <input type="submit" value="<?php echo _('Continue to Step 3'); ?>" /> </form> </div> diff --git a/templates/show_install_lang.inc.php b/templates/show_install_lang.inc.php index c9686b10..a813d80f 100644 --- a/templates/show_install_lang.inc.php +++ b/templates/show_install_lang.inc.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2007 Ampache.org + Copyright (c) Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -142,7 +142,7 @@ <p> <?php Error::display('general'); ?> </p> -<form method="post" action="<?php echo $http_type . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "?action=init"; ?>" enctype="multipart/form-data" > +<form method="post" action="<?php echo WEB_PATH . "?action=init"; ?>" enctype="multipart/form-data" > <?php $languages = get_languages(); |