Changeset 1499

Show
Ignore:
Timestamp:
06/15/06 15:43:33 (2 years ago)
Author:
mdodoo
Message:

Streamlined installer (instantly go to the admin section after successful writing of dbinit.php!). Fixes #372.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/gregarius/install.php

    r1246 r1499  
    2626############################################################################### 
    2727 
    28 define('GREGARIUS_RELEASE', '0.5.4'); 
    29 define('GREGARIUS_CODENAME', 'Coots'); 
     28define('GREGARIUS_RELEASE', '0.5.5'); 
     29define('GREGARIUS_CODENAME', 'null'); 
    3030 
    3131define('DBINIT', dirname(__FILE__) . '/dbinit.php'); 
     
    5050define('ADMIN_PASSWORD_HELP', 'The administrator password used to connect to the database. Make sure this user has GRANT privileges!'); 
    5151define('WEBSERVER_HELP', 'The location of the webserver. If in doubt, leave the default. Default: ' . WEB_SERVER_DEFAULT . ''); 
     52 
     53global $hasWritePerm; 
    5254 
    5355function install_main() { 
     
    246248    . "<p><input type=\"hidden\" name=\"process\" value=\"1\" /></p>\n" 
    247249    . "</form>\n" 
    248     . "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">\n" 
    249     . "<h2>Step 5: Activate mod-rewrite (optional)</h2>\n" 
    250     . "<p><input type=\"submit\" name=\"action\" value=\"" . ($hasWritePerm ? "Activate mod-rewrite" : "Download .htaccess file") . "\" /></p>\n" 
    251     . "<p><input type=\"hidden\" name=\"process\" value=\"2\" /></p>\n" 
    252     . "</form>\n" 
    253     . "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">\n" 
    254     . "<h2>Step 6: Goto Admin Section</h2>\n" 
    255     . "<p><input type=\"submit\" name=\"action\" value=\"Start Using Gregarius!\" /></p>\n" 
    256     . "<p><input type=\"hidden\" name=\"process\" value=\"3\" /></p>\n" 
    257     . "</form>\n" 
    258250    . "</div>\n" 
    259251    . "</body>\n" 
     
    261253} 
    262254 
    263 if(file_exists(DBINIT)) { 
     255if(file_exists(DBINIT) && empty($_POST['process'])) { 
    264256    print("The dbinit.php file already exists in the Gregarius directory! Please remove it if you would like to use this installer."); 
    265 } else if(!empty($_POST['process'])){ 
    266 // process the post data 
    267     if(3 == $_POST['process']) { 
    268         header('Location: admin/'); 
    269         exit(); 
    270     } else if(2 == $_POST['process']) { 
    271         $success = @rename('.htaccess.disabled', '.htaccess'); 
    272         if(false == $success) { 
    273             $htaccess = file('.htaccess.disabled', 'r'); 
    274             header('Content-type: application/text'); 
    275             header('Content-Disposition: attachment; filename=".htaccess"'); 
    276             echo($htaccess); 
    277         } 
    278  
    279         exit(); 
    280     } else if(1 == $_POST['process']) { 
     257} else if(1 == $_POST['process']) { 
    281258        if(empty($_POST['server']) || 
    282259            empty($_POST['database']) || 
     
    304281                if(!$sql) { 
    305282                    print("Unable to connect to database! Please create manually."); 
    306                 } else { 
    307             } 
     283                } 
    308284            } else { 
    309285                print("Invalid SQL Type!"); 
     
    382358                fclose($fp); 
    383359 
    384                 exit(); 
    385             } 
    386        
     360               header('Location: admin/'); 
     361                exit(); 
     362           
    387363    } 
    388364} else { // dbinit.php does not exist and we are not asked to process