r4303 install.php: convert into pure library, add inline style
authorDenis Ovsienko <infrastation@yandex.ru>
Tue, 8 Mar 2011 21:06:34 +0000 (21:06 +0000)
committerDenis Ovsienko <infrastation@yandex.ru>
Tue, 8 Mar 2011 21:06:34 +0000 (21:06 +0000)
index.php: add "installer" case

wwwroot/inc/init.php
wwwroot/inc/install.php [moved from wwwroot/install.php with 99% similarity]
wwwroot/index.php

index 7911460a6cccc8474bf6cb72ad181f11d5ed82db..322e23370241f6dcdce6d28925cb5dda123dcec4 100644 (file)
@@ -53,7 +53,7 @@ if (FALSE === @include_once 'secret.php')
        (
                "Database connection parameters are read from inc/secret.php file, " .
                "which cannot be found.<br>You probably need to complete the installation " .
-               "procedure by following <a href='install.php'>this link</a>.",
+               "procedure by following <a href='?module=installer'>this link</a>.",
                RackTablesError::MISCONFIGURED
        );
 }
similarity index 99%
rename from wwwroot/install.php
rename to wwwroot/inc/install.php
index 205c942fe2c4eb3fabdd8d0912282625e82d6ff3..f7d088ce289a7d4f4c666b3a3230f6e1f30de3b6 100644 (file)
@@ -1,9 +1,7 @@
 <?php
 
-// This script is intended for execution through a web-browser, e.g.:
-// https://example.com/racktables/install.php
-// See README file for more information.
-
+function renderInstallerHTML()
+{
 $stepfunc[1] = 'not_already_installed';
 $stepfunc[2] = 'platform_is_ok';
 $stepfunc[3] = 'init_config';
@@ -33,13 +31,27 @@ if ($step > count ($stepfunc))
        exit;
 }
 $title = "RackTables installation: step ${step} of " . count ($stepfunc);
-require_once ('inc/dictionary.php');
 header ('Content-Type: text/html; charset=UTF-8');
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head><title><?php echo $title; ?></title>
-<link rel=stylesheet type='text/css' href='css/pi.css' />
+<style type="text/css">
+.tdleft {
+       text-align: left;
+}
+
+.trok {
+       background-color: #80FF80;
+}
+
+.trwarning {
+       background-color: #FFFF80;
+}
+
+.trerror {
+       background-color: #FF8080;
+}
+</style>
 </head>
 <body>
 <center>
@@ -67,6 +79,8 @@ echo "<input type=hidden name=step value='${next_step}'>\n";
 </html>
 
 <?php
+}
+
 // Check if the software is already installed.
 function not_already_installed()
 {
index 0d5ca024c0de4b02866919d03ea394075f222db7..316754bfda39f0eac404c96d159a4168f13c7ed1 100644 (file)
@@ -160,7 +160,7 @@ try {
                // Enforce default value for now, releases prior to 0.17.0 didn't support 'httpd' auth source.
                $user_auth_src = 'database';
                if (FALSE === @include_once 'inc/secret.php')
-                       die ('<center>There is no working RackTables instance here, <a href="install.php">install</a>?</center>');
+                       die ('<center>There is no working RackTables instance here, <a href="?module=installer">install</a>?</center>');
                try
                {
                        $dbxlink = new PDO ($pdo_dsn, $db_username, $db_password);
@@ -171,6 +171,11 @@ try {
                }
                renderUpgraderHTML();
                break;
+       case 'installer':
+               require_once 'inc/dictionary.php';
+               require_once 'inc/install.php';
+               renderInstallerHTML();
+               break;
        default:
                throw new InvalidRequestArgException ('module', $_REQUEST['module']);
        }