From 5d4f96c68949c2b26c95c474ddf69f773a50d945 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sat, 29 May 2010 15:17:05 -0400 Subject: Refactor code --- usr/local/www/installer.php | 279 +++++++++++++++++++++----------------------- 1 file changed, 135 insertions(+), 144 deletions(-) (limited to 'usr') diff --git a/usr/local/www/installer.php b/usr/local/www/installer.php index e3663bd..9c2ddf5 100644 --- a/usr/local/www/installer.php +++ b/usr/local/www/installer.php @@ -34,6 +34,20 @@ if($g['platform'] == "pfSense" or $g['platform'] == "nanobsd") { exit; } +// Main switch dispatcher +switch ($_REQUEST['state']) { + case "quickeasyinstall": + quickeasyinstall_gui(); + break; + case "update_installer_status": + update_installer_status(); + exit; + case "quickeasyinstall": + begin_quick_easy_install(); + default: + installer_main(); +} + function write_out_pc_sysinstaller_config($disk) { $fd = fopen("/PCBSD/pc-sysinstall/examples/pfSense-install.cfg", "w"); if(!$fd) { @@ -78,6 +92,10 @@ EOF; function start_installation() { $fd = fopen("/tmp/installer.sh", "w"); + if(!$fd) { + die("Could not open /tmp/installer.sh for writing"); + exit; + } fwrite($fd, "/PCBSD/pc-sysinstall/pc-sysinstall -c /PCBSD/pc-sysinstall/examples/pfSense-install.cfg && touch /tmp/install_complete"); fclose($fd); exec("chmod a+rx /tmp/installer.sh"); @@ -120,166 +138,139 @@ function begin_quick_easy_install() { start_installation(); } -if($_REQUEST['state'] == "update_installer_status") { - update_installer_status(); - exit; -} - -if($_REQUEST['step1_post']) { - -} +function body_html() { + $pfSversion = str_replace("\n", "", file_get_contents("/etc/version")); + if(strstr($pfSversion, "1.2")) + $one_two = true; + $pgtitle = "pfSense: Installer"; + include("head.inc"); + echo << + + +EOF; + include("fbegin.inc"); -if($_REQUEST['step2_post']) { - -} + if($one_two): + echo "

{$pgtitle}

"; -if($_REQUEST['step3_post']) { - + if ($savemsg) print_info_box($savemsg); } -if($_REQUEST['step4_post']) { - -} - -$pfSversion = str_replace("\n", "", file_get_contents("/etc/version")); -if(strstr($pfSversion, "1.2")) - $one_two = true; - -$pgtitle = "pfSense: Installer"; -include("head.inc"); - -?> - - - - - - -

- - - - -"; + include("fend.inc"); + echo ""; + echo ""; } function template() { -echo << - - - - -
-
- - - - -
-
-
- - -
-
-
-
- + body_html(); + echo << + + + + +
+
+ + + + +
+ +
+ + +
+
+
+
+ EOF; - + end_html(); } function quickeasyinstall_gui() { + body_html(); echo << - - - - -
-
- - - - -
- -
- Starting Installer... Please wait...

- {{ Insert progressbar here }}

- -

-
-
-
- - +
+ + + + +
+
+ + + + +
+ +
+ Starting Installer... Please wait...

+ {{ Insert progressbar here }}

+ +

+
+
+
+
+ EOF; - + end_html(); } - function installer_main() { -echo << - - - - -
-
- - - - -
- - -
-
-
- + body_html(); + $disk = installer_find_first_disk(); + if(!$disk) + echo "WARNING: Could not find any suitable disks for installation."; + echo << + + + + +
+ +
+ EOF; - + end_html(); } -?> - - - - - - - +?> \ No newline at end of file -- cgit v1.1