Changeset 1711

Show
Ignore:
Timestamp:
08/30/08 12:49:26 (3 months ago)
Author:
vollmerk
Message:

improve error reporting on install and add in use existing database option

Location:
branches/3.4
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • branches/3.4/install.php

    r1634 r1711  
    6262if ($_SERVER['HTTPS'] == 'on') { $http_type = "https://"; } 
    6363else { $http_type = "http://"; } 
    64 $php_self = $http_type . $_SERVER['HTTP_HOST'] . "/" . preg_replace("/^\/(.+\.php)\/?.*/","$1",$_SERVER['PHP_SELF']); 
     64define('WEB_PATH',$http_type . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/' . basename($_SERVER['PHP_SELF']));   
     65define('WEB_ROOT',$http_type . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']));  
    6566 
    6667/* Catch the Current Action */ 
     
    7677                $charset  = $_REQUEST['charset']; 
    7778                 
    78                 header ("Location: " . $php_self . "?action=show_create_config&local_db=$database&local_host=$hostname&htmllang=$htmllang&charset=$charset"); 
     79                header ("Location: " . WEB_PATH . "?action=show_create_config&local_db=$database&local_host=$hostname&htmllang=$htmllang&charset=$charset"); 
    7980                 
    8081        break; 
     
    132133                } 
    133134 
    134                 if ($_SERVER['HTTPS'] == 'on') { $http_type = "https://"; } 
    135                 else { $http_type = "http://"; } 
    136  
    137                 $web_path = $http_type . $_SERVER['HTTP_HOST'] . $results['web_path']; 
    138  
    139                 header ("Location: " . $web_path . "/login.php"); 
     135                header ("Location: " . WEB_ROOT . "/login.php"); 
    140136        break;   
    141137        case 'show_create_account': 
     
    145141                /* Make sure we've got a valid config file */ 
    146142                if (!check_config_values($results)) {  
     143                        Error::add('general',_('Error: Config file not found or Unreadable'));  
    147144                        require_once Config::get('prefix') . '/templates/show_install_config.inc.php';  
    148145                        break; 
     
    212209                /* Do some basic tests here... most common error, no mysql */ 
    213210                if (!function_exists('mysql_query')) {  
    214                         header ("Location: test.php"); 
     211                        header ("Location: " . WEB_PATH . "/test.php"); 
    215212                } 
    216213                $htmllang = "en_US"; 
  • branches/3.4/lib/init.php

    r1645 r1711  
    8282 
    8383/** This is the version.... fluf nothing more... **/ 
    84 $results['version']             = '3.4.2'; 
     84$results['version']             = '3.4.3-RC1'; 
    8585$results['int_config_version']  = '7';  
    8686 
  • branches/3.4/lib/install.php

    r1537 r1711  
    107107        }  
    108108 
    109  
    110109        $data['database_username'] = $username;  
    111110        $data['database_password'] = $password;  
     
    113112        $data['database_name']     = $database; 
    114113 
    115         if (!strlen($data['database_password'])) {  
    116                 Error::add('general','Error: Password required for Database creation');  
    117                 return false;  
    118         }  
    119          
    120114        Config::set_by_array($data,'1');  
    121115         
     
    133127        $db_selected = @mysql_select_db($database, $dbh); 
    134128 
    135         if ($db_selected && !$_POST['overwrite_db']) {  
     129        if ($db_selected && $_POST['existing_db']) {  
     130                // Rien a faire, we've got the db just blow through 
     131        }  
     132        elseif ($db_selected && !$_POST['overwrite_db']) {  
    136133                Error::add('general','Error: Database Already exists and Overwrite not checked');  
    137134                return false;  
  • branches/3.4/templates/footer.inc.php

    r1687 r1711  
    2121*/ 
    2222?> 
    23 <div style="clear:both;"></div> 
    24 <?php echo Config::get('sample_rate'); ?> 
    25 </div> <!-- end id="content"--> 
    26 <!-- I really hate IE 
    27 </td></tr></table> --> 
     23<div style="clear:both;"></div> <!-- Clear things out --> 
     24</div><!-- end id="content"--> 
    2825</div> <!-- end id="maincontainer"--> 
    2926<div id="footer"> 
  • branches/3.4/templates/show_install.inc.php

    r1304 r1711  
    22/* 
    33 
    4  Copyright (c) 2001 - 2007 Ampache.org 
     4 Copyright (c) Ampache.org 
    55 All rights reserved. 
    66 
     
    6060                <br /> 
    6161                <span class="header2"><?php echo _('Insert Ampache Database'); ?></span> 
    62                 <form method="post" action="<?php echo $http_type . $_SERVER['HTTP_HOST'] .  $_SERVER['PHP_SELF'] . "?action=create_db&amp;htmllang=$htmllang&amp;charset=$charset"; ?>" enctype="multipart/form-data" > 
     62                <form method="post" action="<?php echo WEB_PATH . "?action=create_db&amp;htmllang=$htmllang&amp;charset=$charset"; ?>" enctype="multipart/form-data" > 
    6363<table> 
    6464<tr> 
     
    9595</tr> 
    9696<tr> 
     97        <td class="align"><?php echo _('Use Existing Database'); ?></td> 
     98        <td><input type="checkbox" name="existing_db" value="1" /></td> 
     99</tr> 
     100<tr> 
    97101        <td>&nbsp;</td> 
    98102        <td><input type="submit" value="<?php echo _("Insert Database"); ?>" /></td> 
  • branches/3.4/templates/show_install_account.inc.php

    r1436 r1711  
    22/* 
    33 
    4  Copyright (c) 2001 - 2007 Ampache.org 
     4 Copyright (c) Ampache.org 
    55 All rights reserved. 
    66 
     
    5555        <br /> 
    5656        <span class="header2"><?php echo _('Create Admin Account'); ?></span> 
    57         <form method="post" action="<?php echo $GLOBALS['php_self'] . "?action=create_account"; ?>" enctype="multipart/form-data" > 
     57        <form method="post" action="<?php echo WEB_PATH . "?action=create_account"; ?>" enctype="multipart/form-data" > 
    5858<table> 
    5959<tr> 
  • branches/3.4/templates/show_install_config.inc.php

    r1495 r1711  
    22/* 
    33 
    4  Copyright (c) 2001 - 2007 Ampache.org 
     4 Copyright (c) Ampache.org 
    55 All rights reserved. 
    66 
     
    5555                <br /> 
    5656                <span class="header2"><?php echo _('Generate Config File'); ?></span> 
    57                 <form method="post" action="<?php echo $_SERVER['PHP_SELF'] . "?action=create_config"; ?>" enctype="multipart/form-data" > 
     57                <form method="post" action="<?php echo WEB_PATH . "?action=create_config"; ?>" enctype="multipart/form-data" > 
    5858                <table> 
    5959<tr> 
    6060        <td class="align"><?php echo _('Web Path'); ?></td> 
    61         <td class="align"><input type="text" name="web_path" value="<?php echo $web_path; ?>" /></td> 
     61        <td class="align"><input type="text" name="web_path" value="<?php echo dirname($_SERVER['PHP_SELF']); ?>" /></td> 
    6262</tr> 
    6363<tr> 
     
    123123        <td>&nbsp;</td> 
    124124        <td> 
    125         <?php $check_url = $GLOBALS['php_self'] . "?action=show_create_config&amp;htmllang=$htmllang&amp;charset=$charset&amp;local_db=" . $_REQUEST['local_db'] . "&amp;local_host=" . $_REQUEST['local_host']; ?> 
     125        <?php $check_url = WEB_PATH . "?action=show_create_config&amp;htmllang=$htmllang&amp;charset=$charset&amp;local_db=" . $_REQUEST['local_db'] . "&amp;local_host=" . $_REQUEST['local_host']; ?> 
    126126        <a href="<?php echo $check_url; ?>">[<?php echo _('Check for Config'); ?>]</a> 
    127127        </td> 
     
    129129                </table> 
    130130                <br /> 
    131                 <form method="post" action="<?php echo $GLOBALS['php_self'] . "?action=show_create_account&amp;htmllang=$htmllang&amp;charset=$charset"; ?>" enctype="multipart/form-data"> 
     131                <form method="post" action="<?php echo WEB_PATH . "?action=show_create_account&amp;htmllang=$htmllang&amp;charset=$charset"; ?>" enctype="multipart/form-data"> 
    132132                <input type="submit" value="<?php echo _('Continue to Step 3'); ?>" /> 
    133133                </form> 
  • branches/3.4/templates/show_install_lang.inc.php

    r942 r1711  
    22/* 
    33 
    4  Copyright (c) 2001 - 2007 Ampache.org 
     4 Copyright (c) Ampache.org 
    55 All rights reserved. 
    66 
     
    5353                <?php Error::display('general'); ?> 
    5454                </p> 
    55 <form method="post" action="<?php echo $http_type . $_SERVER['HTTP_HOST'] .  $_SERVER['PHP_SELF'] . "?action=init"; ?>" enctype="multipart/form-data" > 
     55<form method="post" action="<?php echo WEB_PATH . "?action=init"; ?>" enctype="multipart/form-data" > 
    5656 
    5757<?php