summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xusr/local/www/system_firmware.php82
-rwxr-xr-xusr/local/www/system_firmware_auto.php100
-rwxr-xr-xusr/local/www/system_firmware_check.php78
-rwxr-xr-xusr/local/www/system_firmware_restorefullbackup.php22
4 files changed, 142 insertions, 140 deletions
diff --git a/usr/local/www/system_firmware.php b/usr/local/www/system_firmware.php
index ff80bd3..794a247 100755
--- a/usr/local/www/system_firmware.php
+++ b/usr/local/www/system_firmware.php
@@ -31,7 +31,7 @@
POSSIBILITY OF SUCH DAMAGE.
*/
/*
- pfSense_BUILDER_BINARIES: /usr/bin/tar
+ pfSense_BUILDER_BINARIES: /usr/bin/tar
pfSense_MODULE: firmware
*/
@@ -68,11 +68,11 @@ function file_is_for_platform($filename, $ul_name) {
if(stristr($ul_name, "nanobsd"))
return true;
else
- return false;
+ return false;
}
$_gb = exec("/usr/bin/tar xzf $filename -C /tmp/ etc/platform");
unset($_gb);
- if(!file_exists("/tmp/etc/platform"))
+ if(!file_exists("/tmp/etc/platform"))
return false;
$upgrade_is_for_platform = trim(file_get_contents("/tmp/etc/platform", " \n\t\r"));
if ($g['platform'] == $upgrade_is_for_platform) {
@@ -83,24 +83,24 @@ function file_is_for_platform($filename, $ul_name) {
}
function file_upload_error_message($error_code) {
- switch ($error_code) {
- case UPLOAD_ERR_INI_SIZE:
- return gettext('The uploaded file exceeds the upload_max_filesize directive in php.ini');
- case UPLOAD_ERR_FORM_SIZE:
- return gettext('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form');
- case UPLOAD_ERR_PARTIAL:
- return gettext('The uploaded file was only partially uploaded');
- case UPLOAD_ERR_NO_FILE:
- return gettext('No file was uploaded');
- case UPLOAD_ERR_NO_TMP_DIR:
- return gettext('Missing a temporary folder');
- case UPLOAD_ERR_CANT_WRITE:
- return gettext('Failed to write file to disk');
- case UPLOAD_ERR_EXTENSION:
- return gettext('File upload stopped by extension');
- default:
- return gettext('Unknown upload error');
- }
+ switch ($error_code) {
+ case UPLOAD_ERR_INI_SIZE:
+ return gettext('The uploaded file exceeds the upload_max_filesize directive in php.ini');
+ case UPLOAD_ERR_FORM_SIZE:
+ return gettext('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form');
+ case UPLOAD_ERR_PARTIAL:
+ return gettext('The uploaded file was only partially uploaded');
+ case UPLOAD_ERR_NO_FILE:
+ return gettext('No file was uploaded');
+ case UPLOAD_ERR_NO_TMP_DIR:
+ return gettext('Missing a temporary folder');
+ case UPLOAD_ERR_CANT_WRITE:
+ return gettext('Failed to write file to disk');
+ case UPLOAD_ERR_EXTENSION:
+ return gettext('File upload stopped by extension');
+ default:
+ return gettext('Unknown upload error');
+ }
}
/* if upgrade in progress, alert user */
@@ -118,7 +118,7 @@ if(is_subsystem_dirty('firmwarelock')) {
exit;
}
-if($_POST['backupbeforeupgrade'])
+if($_POST['backupbeforeupgrade'])
touch("/tmp/perform_full_backup.txt");
if ($_POST['kerneltype'] && in_array($_POST['kerneltype'], array_keys($kerneltypes)))
@@ -126,7 +126,7 @@ if ($_POST['kerneltype'] && in_array($_POST['kerneltype'], array_keys($kerneltyp
/* Handle manual upgrade */
if ($_POST && !is_subsystem_dirty('firmwarelock')) {
-
+
unset($input_errors);
unset($sig_warning);
@@ -149,7 +149,7 @@ if ($_POST && !is_subsystem_dirty('firmwarelock')) {
clear_subsystem_dirty('firmware');
} else if ($mode == "upgrade") {
if ($_FILES['ulfile']['error'])
- $errortext = "(" . file_upload_error_message($_FILES['ulfile']['error']) . ")";
+ $errortext = "(" . file_upload_error_message($_FILES['ulfile']['error']) . ")";
if (is_uploaded_file($_FILES['ulfile']['tmp_name'])) {
/* verify firmware image(s) */
if (file_is_for_platform($_FILES['ulfile']['tmp_name'], $_FILES['ulfile']['name']) == false && !$_POST['sig_override'])
@@ -211,7 +211,7 @@ $pgtitle = array(gettext("System"),gettext("Firmware"));
include("head.inc");
?>
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<form action="system_firmware.php" method="post" enctype="multipart/form-data">
<?php
/* Construct an upload_id for this session */
@@ -220,7 +220,7 @@ include("head.inc");
else
$upload_id = session_id();
?>
-<input type="hidden" name="UPLOAD_IDENTIFIER" value="<?php echo $upload_id;?>" />
+<input type="hidden" name="UPLOAD_IDENTIFIER" value="<?php echo $upload_id;?>" />
<?php include("fbegin.inc"); ?>
<?php if ($input_errors) print_input_errors($input_errors); ?>
<?php if ($savemsg) print_info_box($savemsg); ?>
@@ -258,12 +258,12 @@ if(stristr($_FILES['ulfile']['name'],"nanobsd"))
<td>
<div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
+ <tr>
<td colspan="2" class="listtopic"><?=gettext("Invoke") ." ". $g['product_name'] ." ". gettext("Manual Upgrade"); ?></td>
</tr>
<tr>
- <td width="22%" valign="baseline" class="vncell">&nbsp;</td>
- <td width="78%" class="vtable">
+ <td width="22%" valign="baseline" class="vncell">&nbsp;</td>
+ <td width="78%" class="vtable">
<?php if (!is_subsystem_dirty('rebootreq')): ?>
<?php if (!is_subsystem_dirty('firmware')): ?>
<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Enable firmware upload");?>">
@@ -271,24 +271,24 @@ if(stristr($_FILES['ulfile']['name'],"nanobsd"))
<?php printf(gettext('Click "Enable firmware upload" to begin.'),$g['firmware_update_text']);?>
<br/>
<?php else: ?>
- <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Disable firmware upload");?>">
+ <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Disable firmware upload");?>">
</td>
</tr>
<tr>
- <td width="22%" valign="baseline" class="vncell">&nbsp;</td>
- <td width="78%" class="vtable">
- <?php
- if ($g['platform'] == "nanobsd")
- $type = "*.img.gz";
+ <td width="22%" valign="baseline" class="vncell">&nbsp;</td>
+ <td width="78%" class="vtable">
+ <?php
+ if ($g['platform'] == "nanobsd")
+ $type = "*.img.gz";
else
- $type = "*.tgz";
- ?>
+ $type = "*.tgz";
+ ?>
<strong><?=gettext("Firmware image file ($type):");?> </strong>
<input name="ulfile" type="file" class="formfld">
<br>
<?php
- if(!file_exists("/boot/kernel/pfsense_kernel.txt")) {
- if($g['platform'] == "pfSense") {
+ if(!file_exists("/boot/kernel/pfsense_kernel.txt")) {
+ if($g['platform'] == "pfSense") {
echo gettext("Please select kernel type") , ": ";
echo "<select name='kerneltype'>";
foreach($kerneltypes as $kerntype => $kerndescr) {
@@ -321,8 +321,8 @@ if(stristr($_FILES['ulfile']['name'],"nanobsd"))
</strong>
</span>
<?=gettext("DO NOT abort the firmware upgrade once it " .
- "has started. The firewall will reboot automatically after " .
- "storing the new firmware. The configuration will be maintained.");?>
+ "has started. The firewall will reboot automatically after " .
+ "storing the new firmware. The configuration will be maintained.");?>
</span>
<?php endif; ?>
</td>
diff --git a/usr/local/www/system_firmware_auto.php b/usr/local/www/system_firmware_auto.php
index 88b42f0..b2cba9f 100755
--- a/usr/local/www/system_firmware_auto.php
+++ b/usr/local/www/system_firmware_auto.php
@@ -5,8 +5,8 @@
Copyright (C) 2008 Scott Ullrich <sullrich@gmail.com>
Copyright (C) 2005 Scott Ullrich
- Based originally on system_firmware.php
- (C)2003-2004 Manuel Kasper
+ Based originally on system_firmware.php
+ (C)2003-2004 Manuel Kasper
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -54,9 +54,9 @@ if(isset($curcfg['alturl']['enable']))
else
$updater_url = $g['update_url'];
-if($_POST['backupbeforeupgrade'])
+if($_POST['backupbeforeupgrade'])
touch("/tmp/perform_full_backup.txt");
-
+
$pgtitle = array(gettext("Diagnostics"),gettext("Firmware"),gettext("Auto Update"));
include("head.inc");
@@ -74,53 +74,55 @@ include("head.inc");
<table width="100%" border="0" cellpadding="6" cellspacing="0">
<tr>
<td>
-<?php
- $tab_array = array();
- $tab_array[] = array(gettext("Manual Update"), false, "system_firmware.php");
- $tab_array[] = array(gettext("Auto Update"), true, "system_firmware_check.php");
- $tab_array[] = array(gettext("Updater Settings"), false, "system_firmware_settings.php");
- if($g['hidedownloadbackup'] == false)
- $tab_array[] = array(gettext("Restore Full Backup"), false, "system_firmware_restorefullbackup.php");
- display_top_tabs($tab_array);
-?>
+ <?php
+ $tab_array = array();
+ $tab_array[] = array(gettext("Manual Update"), false, "system_firmware.php");
+ $tab_array[] = array(gettext("Auto Update"), true, "system_firmware_check.php");
+ $tab_array[] = array(gettext("Updater Settings"), false, "system_firmware_settings.php");
+ if($g['hidedownloadbackup'] == false)
+ $tab_array[] = array(gettext("Restore Full Backup"), false, "system_firmware_restorefullbackup.php");
+ display_top_tabs($tab_array);
+ ?>
</td>
</tr>
<tr>
- <td class="tabcont">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td class="tabcont">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td>
- <center>
- <table height='15' width='420' border='0' colspacing='0' cellpadding='0' cellspacing='0'>
-
- <tr>
- <td background="./themes/the_wall/images/misc/bar_left.gif" height='15' width='5'>
- </td>
- <td>
- <table id="progholder" name="progholder" height='15' width='410' border='0' colspacing='0' cellpadding='0' cellspacing='0'>
- <td background="./themes/the_wall/images/misc/bar_gray.gif" valign="top" align="left">
- <img src='./themes/the_wall/images/misc/bar_blue.gif' width='0' height='15' name='progressbar' id='progressbar'>
- </td>
+ <td class="tabcont">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td class="tabcont">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td>
+ <center>
+ <table height='15' width='420' border='0' colspacing='0' cellpadding='0' cellspacing='0'>
+
+ <tr>
+ <td background="./themes/the_wall/images/misc/bar_left.gif" height='15' width='5'>
+ </td>
+ <td>
+ <table id="progholder" name="progholder" height='15' width='410' border='0' colspacing='0' cellpadding='0' cellspacing='0'>
+ <td background="./themes/the_wall/images/misc/bar_gray.gif" valign="top" align="left">
+ <img src='./themes/the_wall/images/misc/bar_blue.gif' width='0' height='15' name='progressbar' id='progressbar'>
+ </td>
+ </table>
+ </td>
+ <td background="./themes/the_wall/images/misc/bar_right.gif" height='15' width='5'>
+ </td>
+ </tr>
</table>
- </td>
- <td background="./themes/the_wall/images/misc/bar_right.gif" height='15' width='5'>
+ <br>
+ <!-- status box -->
+ <textarea cols="90" rows="1" name="status" id="status" wrap="hard"><?=gettext("Beginning firmware upgrade"); ?>.</textarea>
+ <!-- command output box -->
+ <textarea cols="90" rows="25" name="output" id="output" wrap="hard"></textarea>
+ </center>
</td>
</tr>
</table>
- <br>
- <!-- status box -->
- <textarea cols="90" rows="1" name="status" id="status" wrap="hard"><?=gettext("Beginning firmware upgrade"); ?>.</textarea>
- <!-- command output box -->
- <textarea cols="90" rows="25" name="output" id="output" wrap="hard"></textarea>
- </center>
</td>
</tr>
- </table>
- </table>
- </td>
+ </table>
+ </td>
</tr>
</table>
</form>
@@ -166,7 +168,7 @@ if(!$latest_version) {
} else {
$update_filename = "latest.tgz";
}
- $status = download_file_with_progress_bar("{$updater_url}/{$update_filename}", "{$g['upload_path']}/latest.tgz", "read_body_firmware");
+ $status = download_file_with_progress_bar("{$updater_url}/{$update_filename}", "{$g['upload_path']}/latest.tgz", "read_body_firmware");
$status = download_file_with_progress_bar("{$updater_url}/{$update_filename}.sha256", "{$g['upload_path']}/latest.tgz.sha256");
conf_mount_ro();
update_output_window("{$g['product_name']} " . gettext("download complete."));
@@ -210,13 +212,13 @@ if ($sigchk == 1) {
}
if ($exitstatus) {
- update_status($sig_warning);
- update_output_window(gettext("Update cannot continue. You can disable this check on the Updater Settings tab."));
- require("fend.inc");
- exit;
+ update_status($sig_warning);
+ update_output_window(gettext("Update cannot continue. You can disable this check on the Updater Settings tab."));
+ require("fend.inc");
+ exit;
} else if ($sigchk == 2) {
- update_status("Upgrade in progress...");
- update_output_window("\n" . gettext("Upgrade Image does not contain a signature but the system has been configured to allow unsigned images. One moment please...") . "\n");
+ update_status("Upgrade in progress...");
+ update_output_window("\n" . gettext("Upgrade Image does not contain a signature but the system has been configured to allow unsigned images. One moment please...") . "\n");
}
if (!verify_gzip_file("{$g['upload_path']}/latest.tgz")) {
diff --git a/usr/local/www/system_firmware_check.php b/usr/local/www/system_firmware_check.php
index 8aaa5a3..9e439f8 100755
--- a/usr/local/www/system_firmware_check.php
+++ b/usr/local/www/system_firmware_check.php
@@ -61,54 +61,54 @@ include("head.inc");
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
-<?php
- $tab_array = array();
- $tab_array[] = array(gettext("Manual Update"), false, "system_firmware.php");
- $tab_array[] = array(gettext("Auto Update"), true, "system_firmware_check.php");
- $tab_array[] = array(gettext("Updater Settings"), false, "system_firmware_settings.php");
- if($g['hidedownloadbackup'] == false)
- $tab_array[] = array(gettext("Restore Full Backup"), false, "system_firmware_restorefullbackup.php");
- display_top_tabs($tab_array);
-?>
+ <?php
+ $tab_array = array();
+ $tab_array[] = array(gettext("Manual Update"), false, "system_firmware.php");
+ $tab_array[] = array(gettext("Auto Update"), true, "system_firmware_check.php");
+ $tab_array[] = array(gettext("Updater Settings"), false, "system_firmware_settings.php");
+ if($g['hidedownloadbackup'] == false)
+ $tab_array[] = array(gettext("Restore Full Backup"), false, "system_firmware_restorefullbackup.php");
+ display_top_tabs($tab_array);
+ ?>
</td>
</tr>
<tr>
- <td class="tabcont">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td>
- <!-- progress bar -->
- <center>
- <table height='15' width='420' border='0' colspacing='0' cellpadding='0' cellspacing='0'>
+ <td class="tabcont">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td>
+ <!-- progress bar -->
+ <center>
+ <table height='15' width='420' border='0' colspacing='0' cellpadding='0' cellspacing='0'>
<tr>
<td background="./themes/the_wall/images/misc/bar_left.gif" height='15' width='5'>
</td>
<td>
- <table id="progholder" name="progholder" height='15' width='410' border='0' colspacing='0' cellpadding='0' cellspacing='0'>
- <td background="./themes/the_wall/images/misc/bar_gray.gif" valign="top" align="left">
+ <table id="progholder" name="progholder" height='15' width='410' border='0' colspacing='0' cellpadding='0' cellspacing='0'>
+ <td background="./themes/the_wall/images/misc/bar_gray.gif" valign="top" align="left">
<img src='./themes/the_wall/images/misc/bar_blue.gif' width='0' height='15' name='progressbar' id='progressbar'>
- </td>
- </table>
- </td>
- <td background="./themes/the_wall/images/misc/bar_right.gif" height='15' width='5'>
- </td>
- </tr>
- </table>
- <br>
- <!-- command output box -->
- <textarea border='1' bordercolordark='#000000' bordercolorlight='#000000' cols='90' rows='9' name='output' id='output' wrap='hard'>
- </textarea>
- <div id='backupdiv' name='backupdiv' style='visibility:hidden'>
- <br/><input type="checkbox" name='backupbeforeupgrade' id='backupbeforeupgrade'> <?=gettext("Perform full backup prior to upgrade");?>
- </div>
- </center>
- <p>
- <center><input id='invokeupgrade' style='visibility:hidden' type="submit" value="<?=gettext("Invoke Auto Upgrade"); ?>">
- </td>
- </tr>
- </table>
- </td>
+ </td>
+ </table>
+ </td>
+ <td background="./themes/the_wall/images/misc/bar_right.gif" height='15' width='5'>
+ </td>
+ </tr>
+ </table>
+ <br>
+ <!-- command output box -->
+ <textarea border='1' bordercolordark='#000000' bordercolorlight='#000000' cols='90' rows='9' name='output' id='output' wrap='hard'>
+ </textarea>
+ <div id='backupdiv' name='backupdiv' style='visibility:hidden'>
+ <br/><input type="checkbox" name='backupbeforeupgrade' id='backupbeforeupgrade'> <?=gettext("Perform full backup prior to upgrade");?>
+ </div>
+ </center>
+ <p>
+ <center><input id='invokeupgrade' style='visibility:hidden' type="submit" value="<?=gettext("Invoke Auto Upgrade"); ?>"></center>
+ </td>
+ </tr>
+ </table>
+ </td>
</tr>
</table>
diff --git a/usr/local/www/system_firmware_restorefullbackup.php b/usr/local/www/system_firmware_restorefullbackup.php
index 2c15c9a..c23b45e 100755
--- a/usr/local/www/system_firmware_restorefullbackup.php
+++ b/usr/local/www/system_firmware_restorefullbackup.php
@@ -52,18 +52,18 @@ require("guiconfig.inc");
require_once("filter.inc");
require_once("shaper.inc");
-if($_POST['overwriteconfigxml'])
+if($_POST['overwriteconfigxml'])
touch("/tmp/do_not_restore_config.xml");
-if($_GET['backupnow'])
+if($_GET['backupnow'])
mwexec_bg("/etc/rc.create_full_backup");
if($_GET['downloadbackup']) {
$filename = $_GET['downloadbackup'];
$path = "/root/{$filename}";
if(file_exists("/root/{$filename}")) {
- session_write_close();
- ob_end_clean();
+ session_write_close();
+ ob_end_clean();
session_cache_limiter('public');
//$fd = fopen("/root/{$filename}", "rb");
$filesize = filesize("/root/{$filename}");
@@ -74,11 +74,11 @@ if($_GET['downloadbackup']) {
header('Content-Disposition: attachment; filename="'.$filename.'"');
header("Content-Transfer-Encoding: binary\n");
if($file = fopen("/root/{$filename}", 'rb')){
- while( (!feof($file)) && (connection_status()==0) ){
- print(fread($file, 1024*8));
- flush();
- }
- fclose($file);
+ while( (!feof($file)) && (connection_status()==0) ){
+ print(fread($file, 1024*8));
+ flush();
+ }
+ fclose($file);
}
exit;
@@ -175,13 +175,13 @@ include("head.inc");
echo "</td>";
echo "</tr>";
}
- ?>
+?>
<tr>
<td width="78%" colspan="3">
&nbsp;<br/>
<input type="checkbox" name="overwriteconfigxml" id="overwriteconfigxml" CHECKED> do not restore config.xml.
<p/>
- <input name="Restore" type="submit" class="formbtn" id="restore" value="<?=gettext("Restore"); ?>">
+ <input name="Restore" type="submit" class="formbtn" id="restore" value="<?=gettext("Restore"); ?>">
</td>
</tr>
</table>
OpenPOWER on IntegriCloud