summaryrefslogtreecommitdiffstats
path: root/install.php
diff options
context:
space:
mode:
Diffstat (limited to 'install.php')
-rw-r--r--install.php424
1 files changed, 212 insertions, 212 deletions
diff --git a/install.php b/install.php
index b78d31ef..ed16ea5f 100644
--- a/install.php
+++ b/install.php
@@ -1,5 +1,5 @@
<?php
-/* vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab: */
+/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
@@ -30,9 +30,9 @@ set_error_handler('ampache_error_handler');
install ampache
*/
if (!install_check_status($configfile)) {
- $redirect_url = "login.php";
- require_once Config::get('prefix') . '/templates/error_page.inc.php';
- exit;
+ $redirect_url = "login.php";
+ require_once Config::get('prefix') . '/templates/error_page.inc.php';
+ exit;
}
define('INSTALL','1');
@@ -54,218 +54,218 @@ unset($safe_dirname);
/* Catch the Current Action */
switch ($_REQUEST['action']) {
- case 'create_db':
- /* Get the variables for the language */
- $htmllang = $_REQUEST['htmllang'];
- $charset = $_REQUEST['charset'];
-
- // Set the lang in the conf array
- Config::set('lang', $htmllang, true);
- Config::set('site_charset', $charset, true);
- load_gettext();
-
- if (!install_insert_db($username,$password,$hostname,$database)) {
- require_once 'templates/show_install.inc.php';
- break;
- }
-
- // Now that it's inserted save the lang preference
- Preference::update('lang','-1',$htmllang);
-
- header ("Location: " . WEB_PATH . "?action=show_create_config&local_db=$database&local_host=$hostname&htmllang=$htmllang&charset=$charset");
-
- break;
- case 'create_config':
-
- $htmllang = $_REQUEST['htmllang'];
- $charset = $_REQUEST['charset'];
- // Test and make sure that the values they give us actually work
- Config::set_by_array(array(
- 'database_username' => $username,
- 'database_password' => $password,
- 'database_hostname' => $hostname
- ), true
- );
- if (!Dba::check_database()) {
- Error::add('config', T_('Error: Unable to make Database Connection: ') . Dba::error());
- }
-
- // Was download pressed?
- $download = (!isset($_POST['write']));
-
- if (!Error::occurred()) {
- $created_config = install_create_config($web_path,$username,$password,$hostname,$database,$download);
- }
-
- require_once 'templates/show_install_config.inc.php';
- break;
- case 'show_create_config':
+ case 'create_db':
+ /* Get the variables for the language */
+ $htmllang = $_REQUEST['htmllang'];
+ $charset = $_REQUEST['charset'];
+
+ // Set the lang in the conf array
+ Config::set('lang', $htmllang, true);
+ Config::set('site_charset', $charset, true);
+ load_gettext();
+
+ if (!install_insert_db($username,$password,$hostname,$database)) {
+ require_once 'templates/show_install.inc.php';
+ break;
+ }
+
+ // Now that it's inserted save the lang preference
+ Preference::update('lang','-1',$htmllang);
+
+ header ("Location: " . WEB_PATH . "?action=show_create_config&local_db=$database&local_host=$hostname&htmllang=$htmllang&charset=$charset");
+
+ break;
+ case 'create_config':
+
+ $htmllang = $_REQUEST['htmllang'];
+ $charset = $_REQUEST['charset'];
+ // Test and make sure that the values they give us actually work
+ Config::set_by_array(array(
+ 'database_username' => $username,
+ 'database_password' => $password,
+ 'database_hostname' => $hostname
+ ), true
+ );
+ if (!Dba::check_database()) {
+ Error::add('config', T_('Error: Unable to make Database Connection: ') . Dba::error());
+ }
+
+ // Was download pressed?
+ $download = (!isset($_POST['write']));
+
+ if (!Error::occurred()) {
+ $created_config = install_create_config($web_path,$username,$password,$hostname,$database,$download);
+ }
+
+ require_once 'templates/show_install_config.inc.php';
+ break;
+ case 'show_create_config':
/* Attempt to Guess the Web_path */
- $web_path = dirname($_SERVER['PHP_SELF']);
- $web_path = rtrim($web_path,"\/");
-
- /* Get the variables for the language */
- $htmllang = $_REQUEST['htmllang'];
- $charset = $_REQUEST['charset'];
-
- // Set the lang in the conf array
- Config::set('lang', $htmllang, true);
-
- // We need the charset for the different languages
- $charsets = array(
- 'ar_SA' => 'UTF-8',
- 'de_DE' => 'ISO-8859-15',
- 'en_US' => 'iso-8859-1',
- 'en_GB' => 'UTF-8',
- 'ja_JP' => 'UTF-8',
- 'es_ES' => 'iso-8859-1',
- 'fr_FR' => 'iso-8859-1',
- 'el_GR' => 'el_GR.utf-8',
- 'it_IT' => 'UTF-8',
- 'nl_NL' => 'ISO-8859-15',
- 'tr_TR' => 'iso-8859-9',
- 'zh_CN' => 'GBK');
- $charset = $charsets[$_REQUEST['htmllang']];
-
- // Set the site_charset in the conf array
- Config::set('site_charset', $charsets[$_REQUEST['htmllang']], true);
-
- /* load_gettext mojo */
- load_gettext();
- header ("Content-Type: text/html; charset=" . Config::get('site_charset'));
-
- require_once 'templates/show_install_config.inc.php';
- break;
- case 'create_account':
-
- $results = parse_ini_file($configfile);
- Config::set_by_array($results, true);
-
- /* Get the variables for the language */
- $htmllang = $_REQUEST['htmllang'];
- $charset = $_REQUEST['charset'];
-
- // Set the lang in the conf array
- Config::set('lang', $htmllang, true);
- Config::set('site_charset', $charset, true);
- load_gettext();
-
- $password2 = scrub_in($_REQUEST['local_pass2']);
-
- if (!install_create_account($username,$password,$password2)) {
- require_once Config::get('prefix') . '/templates/show_install_account.inc.php';
- break;
- }
-
- header ("Location: " . WEB_ROOT . "/login.php");
- break;
- case 'show_create_account':
-
- $results = parse_ini_file($configfile);
-
- /* Get the variables for the language */
- $htmllang = $_REQUEST['htmllang'];
- $charset = $_REQUEST['charset'];
-
- // Set the lang in the conf array
- Config::set('lang', $htmllang, true);
- Config::set('site_charset', $charset, true);
- load_gettext();
-
- /* Make sure we've got a valid config file */
- if (!check_config_values($results)) {
- Error::add('general', T_('Error: Config file not found or Unreadable'));
- require_once Config::get('prefix') . '/templates/show_install_config.inc.php';
- break;
- }
-
- /* Get the variables for the language */
- $htmllang = $_REQUEST['htmllang'];
- $charset = $_REQUEST['charset'];
-
- // Set the lang in the conf array
- Config::set('lang', $htmllang, true);
-
- // We need the charset for the different languages
- $charsets = array(
- 'ar_SA' => 'UTF-8',
- 'de_DE' => 'ISO-8859-15',
- 'en_US' => 'iso-8859-1',
- 'ja_JP' => 'UTF-8',
- 'en_GB' => 'UTF-8',
- 'es_ES' => 'iso-8859-1',
- 'fr_FR' => 'iso-8859-1',
- 'it_IT' => 'UTF-8',
- 'nl_NL' => 'ISO-8859-15',
- 'tr_TR' => 'iso-8859-9',
- 'zh_CN' => 'GBK');
- $charset = $charsets[$_REQUEST['htmllang']];
-
- // Set the site_charset in the conf array
- Config::set('site_charset', $charsets[$_REQUEST['htmllang']], true);
-
- /* load_gettext mojo */
- load_gettext();
- header ("Content-Type: text/html; charset=" . Config::get('site_charset'));
-
- require_once Config::get('prefix') . '/templates/show_install_account.inc.php';
- break;
+ $web_path = dirname($_SERVER['PHP_SELF']);
+ $web_path = rtrim($web_path,"\/");
+
+ /* Get the variables for the language */
+ $htmllang = $_REQUEST['htmllang'];
+ $charset = $_REQUEST['charset'];
+
+ // Set the lang in the conf array
+ Config::set('lang', $htmllang, true);
+
+ // We need the charset for the different languages
+ $charsets = array(
+ 'ar_SA' => 'UTF-8',
+ 'de_DE' => 'ISO-8859-15',
+ 'en_US' => 'iso-8859-1',
+ 'en_GB' => 'UTF-8',
+ 'ja_JP' => 'UTF-8',
+ 'es_ES' => 'iso-8859-1',
+ 'fr_FR' => 'iso-8859-1',
+ 'el_GR' => 'el_GR.utf-8',
+ 'it_IT' => 'UTF-8',
+ 'nl_NL' => 'ISO-8859-15',
+ 'tr_TR' => 'iso-8859-9',
+ 'zh_CN' => 'GBK');
+ $charset = $charsets[$_REQUEST['htmllang']];
+
+ // Set the site_charset in the conf array
+ Config::set('site_charset', $charsets[$_REQUEST['htmllang']], true);
+
+ /* load_gettext mojo */
+ load_gettext();
+ header ("Content-Type: text/html; charset=" . Config::get('site_charset'));
+
+ require_once 'templates/show_install_config.inc.php';
+ break;
+ case 'create_account':
+
+ $results = parse_ini_file($configfile);
+ Config::set_by_array($results, true);
+
+ /* Get the variables for the language */
+ $htmllang = $_REQUEST['htmllang'];
+ $charset = $_REQUEST['charset'];
+
+ // Set the lang in the conf array
+ Config::set('lang', $htmllang, true);
+ Config::set('site_charset', $charset, true);
+ load_gettext();
+
+ $password2 = scrub_in($_REQUEST['local_pass2']);
+
+ if (!install_create_account($username,$password,$password2)) {
+ require_once Config::get('prefix') . '/templates/show_install_account.inc.php';
+ break;
+ }
+
+ header ("Location: " . WEB_ROOT . "/login.php");
+ break;
+ case 'show_create_account':
+
+ $results = parse_ini_file($configfile);
+
+ /* Get the variables for the language */
+ $htmllang = $_REQUEST['htmllang'];
+ $charset = $_REQUEST['charset'];
+
+ // Set the lang in the conf array
+ Config::set('lang', $htmllang, true);
+ Config::set('site_charset', $charset, true);
+ load_gettext();
+
+ /* Make sure we've got a valid config file */
+ if (!check_config_values($results)) {
+ Error::add('general', T_('Error: Config file not found or Unreadable'));
+ require_once Config::get('prefix') . '/templates/show_install_config.inc.php';
+ break;
+ }
+
+ /* Get the variables for the language */
+ $htmllang = $_REQUEST['htmllang'];
+ $charset = $_REQUEST['charset'];
+
+ // Set the lang in the conf array
+ Config::set('lang', $htmllang, true);
+
+ // We need the charset for the different languages
+ $charsets = array(
+ 'ar_SA' => 'UTF-8',
+ 'de_DE' => 'ISO-8859-15',
+ 'en_US' => 'iso-8859-1',
+ 'ja_JP' => 'UTF-8',
+ 'en_GB' => 'UTF-8',
+ 'es_ES' => 'iso-8859-1',
+ 'fr_FR' => 'iso-8859-1',
+ 'it_IT' => 'UTF-8',
+ 'nl_NL' => 'ISO-8859-15',
+ 'tr_TR' => 'iso-8859-9',
+ 'zh_CN' => 'GBK');
+ $charset = $charsets[$_REQUEST['htmllang']];
+
+ // Set the site_charset in the conf array
+ Config::set('site_charset', $charsets[$_REQUEST['htmllang']], true);
+
+ /* load_gettext mojo */
+ load_gettext();
+ header ("Content-Type: text/html; charset=" . Config::get('site_charset'));
+
+ require_once Config::get('prefix') . '/templates/show_install_account.inc.php';
+ break;
case 'init':
- /* First step of installation */
- // Get the language
- $htmllang = $_POST['htmllang'];
-
- // Set the lang in the conf array
- Config::set('lang', $htmllang, true);
-
- // We need the charset for the different languages
- $charsets = array(
- 'ar_SA' => 'UTF-8',
- 'de_DE' => 'ISO-8859-15',
- 'en_US' => 'iso-8859-1',
- 'cs_CZ' => 'UTF-8',
- 'ja_JP' => 'UTF-8',
- 'en_GB' => 'UTF-8',
- 'es_ES' => 'iso-8859-1',
- 'fr_FR' => 'iso-8859-1',
- 'it_IT' => 'UTF-8',
- 'nl_NL' => 'ISO-8859-15',
- 'tr_TR' => 'iso-8859-9',
- 'zh_CN' => 'GBK');
- $charset = $charsets[$_POST['htmllang']];
-
- // Set the site_charset in the conf array
- Config::set('site_charset', $charsets[$_POST['htmllang']], true);
-
- // Now we make voodoo with the Load gettext mojo
- load_gettext();
-
- // Page ready :)
- header ("Content-Type: text/html; charset=$charset");
- require_once 'templates/show_install.inc.php';
- break;
+ /* First step of installation */
+ // Get the language
+ $htmllang = $_POST['htmllang'];
+
+ // Set the lang in the conf array
+ Config::set('lang', $htmllang, true);
+
+ // We need the charset for the different languages
+ $charsets = array(
+ 'ar_SA' => 'UTF-8',
+ 'de_DE' => 'ISO-8859-15',
+ 'en_US' => 'iso-8859-1',
+ 'cs_CZ' => 'UTF-8',
+ 'ja_JP' => 'UTF-8',
+ 'en_GB' => 'UTF-8',
+ 'es_ES' => 'iso-8859-1',
+ 'fr_FR' => 'iso-8859-1',
+ 'it_IT' => 'UTF-8',
+ 'nl_NL' => 'ISO-8859-15',
+ 'tr_TR' => 'iso-8859-9',
+ 'zh_CN' => 'GBK');
+ $charset = $charsets[$_POST['htmllang']];
+
+ // Set the site_charset in the conf array
+ Config::set('site_charset', $charsets[$_POST['htmllang']], true);
+
+ // Now we make voodoo with the Load gettext mojo
+ load_gettext();
+
+ // Page ready :)
+ header ("Content-Type: text/html; charset=$charset");
+ require_once 'templates/show_install.inc.php';
+ break;
default:
- if ($_ENV['LANG']) {
- $lang = $_ENV['LANG'];
- } else {
- $lang = "en_US";
- }
- if(strpos($lang, ".")) {
- $langtmp = explode(".", $lang);
- $htmllang = $langtmp[0];
- $charset = $langtmp[1];
- } else {
- $htmllang = $lang;
- $charset = "UTF-8";
- }
- Config::set('lang', $htmllang, true);
- Config::set('site_charset', $charset, true);
- load_gettext();
-
- /* Show the language options first */
- require_once 'templates/show_install_lang.inc.php';
- break;
+ if ($_ENV['LANG']) {
+ $lang = $_ENV['LANG'];
+ } else {
+ $lang = "en_US";
+ }
+ if(strpos($lang, ".")) {
+ $langtmp = explode(".", $lang);
+ $htmllang = $langtmp[0];
+ $charset = $langtmp[1];
+ } else {
+ $htmllang = $lang;
+ $charset = "UTF-8";
+ }
+ Config::set('lang', $htmllang, true);
+ Config::set('site_charset', $charset, true);
+ load_gettext();
+
+ /* Show the language options first */
+ require_once 'templates/show_install_lang.inc.php';
+ break;
} // end action switch
?>