summaryrefslogtreecommitdiffstats
path: root/usr/local/www/diag_backup.php
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2013-02-24 10:39:45 -0300
committerRenato Botelho <garga@FreeBSD.org>2013-02-24 10:39:45 -0300
commit73ed069b8aacb47db4fd11e4f5030c9cea5325d9 (patch)
treedfbb68dbf08fc97a6b4939d58ca6492a4f76e8cf /usr/local/www/diag_backup.php
parent1970b50e7208779db3a776cd618473bacd47fae8 (diff)
downloadpfsense-73ed069b8aacb47db4fd11e4f5030c9cea5325d9.zip
pfsense-73ed069b8aacb47db4fd11e4f5030c9cea5325d9.tar.gz
Fix indent and whitespaces
Diffstat (limited to 'usr/local/www/diag_backup.php')
-rwxr-xr-xusr/local/www/diag_backup.php76
1 files changed, 38 insertions, 38 deletions
diff --git a/usr/local/www/diag_backup.php b/usr/local/www/diag_backup.php
index 2fe7b60..9027137 100755
--- a/usr/local/www/diag_backup.php
+++ b/usr/local/www/diag_backup.php
@@ -61,7 +61,7 @@ $rrdtool = "/usr/bin/nice -n20 /usr/local/bin/rrdtool";
function rrd_data_xml() {
global $rrddbpath;
global $rrdtool;
-
+
$result = "\t<rrddata>\n";
$rrd_files = glob("{$rrddbpath}/*.rrd");
$xml_files = array();
@@ -176,7 +176,7 @@ function check_and_returnif_section_exists($section) {
function spit_out_select_items($name, $showall) {
global $config;
-
+
$areas = array("aliases" => gettext("Aliases"),
"captiveportal" => gettext("Captive Portal"),
"voucher" => gettext("Captive Portal Vouchers"),
@@ -203,7 +203,7 @@ function spit_out_select_items($name, $showall) {
$select = "<select name=\"{$name}\" id=\"{$name}\">";
$select .= "<option VALUE=\"\">" . gettext("ALL") . "</option>";
-
+
if($showall == true)
foreach($areas as $area => $areaname)
$select .= "<option value='{$area}'>{$areaname}</option>\n";
@@ -225,18 +225,18 @@ function spit_out_select_items($name, $showall) {
</script>
END_SCRIPT_BLOCK;
}
-
+
echo $select;
-
+
}
if ($_POST['apply']) {
- ob_flush();
- flush();
+ ob_flush();
+ flush();
conf_mount_rw();
clear_subsystem_dirty("restore");
conf_mount_ro();
- exit;
+ exit;
}
if ($_POST) {
@@ -251,32 +251,32 @@ if ($_POST) {
$mode = "download";
else if (stristr($_POST['Submit'], gettext("Restore version")))
$mode = "restore_ver";
-
+
if ($_POST["nopackages"] <> "")
$options = "nopackages";
-
+
if ($_POST["ver"] <> "")
$ver2restore = $_POST["ver"];
-
+
if ($mode) {
-
+
if ($mode == "download") {
-
+
if ($_POST['encrypt']) {
if(!$_POST['encrypt_password'] || !$_POST['encrypt_passconf'])
$input_errors[] = gettext("You must supply and confirm the password for encryption.");
if($_POST['encrypt_password'] != $_POST['encrypt_passconf'])
$input_errors[] = gettext("The supplied 'Password' and 'Confirm' field values must match.");
}
-
+
if (!$input_errors) {
-
+
//$lockbckp = lock('config');
-
+
$host = "{$config['system']['hostname']}.{$config['system']['domain']}";
$name = "config-{$host}-".date("YmdHis").".xml";
$data = "";
-
+
if($options == "nopackages") {
if(!$_POST['backuparea']) {
/* backup entire configuration */
@@ -303,14 +303,14 @@ if ($_POST) {
$name = "{$_POST['backuparea']}-{$name}";
}
}
-
+
//unlock($lockbckp);
-
+
if ($_POST['encrypt']) {
$data = encrypt_data($data, $_POST['encrypt_password']);
tagfile_reformat($data, $data, "config.xml");
}
-
+
/*
* Backup RRD Data
*/
@@ -319,7 +319,7 @@ if ($_POST) {
$closing_tag = "</" . $g['xml_rootobj'] . ">";
$data = str_replace($closing_tag, $rrd_data_xml . $closing_tag, $data);
}
-
+
$size = strlen($data);
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename={$name}");
@@ -332,31 +332,31 @@ if ($_POST) {
header("Cache-Control: private, must-revalidate");
}
echo $data;
-
+
exit;
}
}
-
+
if ($mode == "restore") {
-
+
if ($_POST['decrypt']) {
if(!$_POST['decrypt_password'] || !$_POST['decrypt_passconf'])
$input_errors[] = gettext("You must supply and confirm the password for decryption.");
if($_POST['decrypt_password'] != $_POST['decrypt_passconf'])
$input_errors[] = gettext("The supplied 'Password' and 'Confirm' field values must match.");
}
-
+
if (!$input_errors) {
-
+
if (is_uploaded_file($_FILES['conffile']['tmp_name'])) {
-
+
/* read the file contents */
$data = file_get_contents($_FILES['conffile']['tmp_name']);
if(!$data) {
log_error(sprintf(gettext("Warning, could not read file %s"), $_FILES['conffile']['tmp_name']));
return 1;
}
-
+
if ($_POST['decrypt']) {
if (!tagfile_deformat($data, $data, "config.xml")) {
$input_errors[] = gettext("The uploaded file does not appear to contain an encrypted pfsense configuration.");
@@ -364,7 +364,7 @@ if ($_POST) {
}
$data = decrypt_data($data, $_POST['decrypt_password']);
}
-
+
if(stristr($data, "<m0n0wall>")) {
log_error(gettext("Upgrading m0n0wall configuration to pfsense."));
/* m0n0wall was found in config. convert it. */
@@ -549,15 +549,15 @@ if ($_POST) {
}
}
}
-
+
if ($mode == "reinstallpackages") {
-
+
header("Location: pkg_mgr_install.php?mode=reinstallall");
exit;
} else if ($mode == "clearpackagelock") {
clear_subsystem_dirty('packagelock');
$savemsg = "Package Lock Cleared";
- } else if ($mode == "restore_ver") {
+ } else if ($mode == "restore_ver") {
$input_errors[] = gettext("XXX - this feature may hose your config (do NOT backrev configs!) - billm");
if ($ver2restore <> "") {
$conf_file = "{$g['cf_conf_path']}/bak/config-" . strtotime($ver2restore) . ".xml";
@@ -606,11 +606,11 @@ function decrypt_change() {
function backuparea_change(obj) {
if (obj.value == "rrddata") {
- document.getElementById("nopackages").disabled = true;
- document.getElementById("dotnotbackuprrd").disabled = true;
+ document.getElementById("nopackages").disabled = true;
+ document.getElementById("dotnotbackuprrd").disabled = true;
} else {
- document.getElementById("nopackages").disabled = false;
- document.getElementById("dotnotbackuprrd").disabled = false;
+ document.getElementById("nopackages").disabled = false;
+ document.getElementById("dotnotbackuprrd").disabled = false;
}
}
//-->
@@ -698,8 +698,8 @@ function backuparea_change(obj) {
</tr>
<tr>
<td colspan="2" class="list" height="12">&nbsp;</td>
- </tr>
- <tr>
+ </tr>
+ <tr>
<td colspan="2" class="listtopic"><?=gettext("Restore configuration"); ?></td>
</tr>
<tr>
OpenPOWER on IntegriCloud