diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2005-09-19 17:22:59 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2005-09-19 17:22:59 +0000 |
commit | ab7cb0182dc7123e957e1a4fc68343cb960ad2c2 (patch) | |
tree | ee93303bf2d06f7a503c9fb423ac2854b6b89a95 /usr/local/www/system_firmware.php | |
parent | 8d27a5fef5d99d4d1daf54130f098967c9685f28 (diff) | |
download | pfsense-ab7cb0182dc7123e957e1a4fc68343cb960ad2c2.zip pfsense-ab7cb0182dc7123e957e1a4fc68343cb960ad2c2.tar.gz |
Temporary fix until Lighty Uploads are working.
* Spawn a mini_httpd server on port 8041 for System Firmware upgrades
Diffstat (limited to 'usr/local/www/system_firmware.php')
-rwxr-xr-x | usr/local/www/system_firmware.php | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/usr/local/www/system_firmware.php b/usr/local/www/system_firmware.php index e711fda..b79133c 100755 --- a/usr/local/www/system_firmware.php +++ b/usr/local/www/system_firmware.php @@ -64,16 +64,22 @@ if ($_POST && !file_exists($d_firmwarelock_path)) { $mode = "upgrade"; else if ($_POST['sig_no']) { if(file_exists("{$g['tmp_path']}/firmware.tgz")) - unlink("{$g['tmp_path']}/firmware.tgz"); + unlink("{$g['tmp_path']}/firmware.tgz"); } if ($mode) { if ($mode == "enable") { exec_rc_script("/etc/rc.firmware enable"); + chdir($g['www_path']); + $command = "/usr/local/sbin/mini_httpd " . + " -c \"**.php|**.cgi\" -u root -maxproc 2 -p 8041" . + " -i {$g['varrun_path']}/mini_httpd.pid"; + $res = mwexec($command); touch($d_fwupenabled_path); } else if ($mode == "disable") { exec_rc_script("/etc/rc.firmware disable"); if (file_exists($d_fwupenabled_path)) unlink($d_fwupenabled_path); + system("/usr/bin/killall mini_httpd"); } else if ($mode == "upgrade") { if (is_uploaded_file($_FILES['ulfile']['tmp_name'])) { /* verify firmware image(s) */ @@ -154,10 +160,16 @@ print_info_box($sig_warning); ?> <input name="sig_override" type="submit" class="formbtn" id="sig_override" value=" Yes "> <input name="sig_no" type="submit" class="formbtn" id="sig_no" value=" No "> -</form> + <?php else: ?> <?php if (!file_exists($d_firmwarelock_path)): ?> -<form action="system_firmware.php" method="post" enctype="multipart/form-data"> + <?php + + $ip = split(":", $_SERVER['PHP_SELF']); + $myip = $ip[0] . $ip[1]; + + ?> + <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td> @@ -179,6 +191,7 @@ print_info_box($sig_warning); </tr> <td width="22%" valign="baseline" class="vncell"> </td> <td width="78%" class="vtable"> + <form action="system_firmware.php" method="post"> <p>Click "Enable firmware upload" below, then choose the image file (<?=$g['platform'];?>-*.tgz) to be uploaded.<br>Click "Upgrade firmware" @@ -189,6 +202,12 @@ print_info_box($sig_warning); <?php else: ?> <input name="Submit" type="submit" class="formbtn" value="Disable firmware upload"> <br><br> + </form> + <?php + if(file_exists($d_fwupenabled_path)) { + echo "<form action=\"http:/{$myip}:8041\" method=\"post\" enctype=\"multipart/form-data\">"; + } + ?> <strong>Firmware image file: </strong> <input type="hidden" name="UPLOAD_IDENTIFIER" value="<?=$id?>"> <input name="ulfile" type="file" class="formfld"> |