From 330d4acae1727401eef2face8041df4195fcc8a9 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Thu, 6 Aug 2015 17:22:24 +0545 Subject: Backup package code style --- config/backup/backup.php | 110 +++++++++++++++++++++-------------------------- 1 file changed, 50 insertions(+), 60 deletions(-) (limited to 'config/backup/backup.php') diff --git a/config/backup/backup.php b/config/backup/backup.php index 3cada9b3..d4debcd3 100644 --- a/config/backup/backup.php +++ b/config/backup/backup.php @@ -32,7 +32,6 @@ require("/usr/local/pkg/backup.inc"); $a_backup = &$config['installedpackages']['backup']['config']; - if ($_GET['act'] == "del") { if ($_GET['type'] == 'backup') { if ($a_backup[$_GET['id']]) { @@ -58,13 +57,13 @@ if ($_GET['a'] == "download") { if (count($a_backup) > 0) { $backup_cmd = 'tar --create --verbose --gzip --file '.$tmp.$filename.' --directory / '; foreach ($a_backup as $ent) { - if ($ent['enabled'] =="true"){ + if ($ent['enabled'] == "true") { //htmlspecialchars($ent['name']); //htmlspecialchars($ent['path']); //htmlspecialchars($ent['description']); $backup_cmd .= htmlspecialchars($ent['path']).' '; } - $i++; + $i++; } //echo $backup_cmd; //exit; system($backup_cmd); @@ -74,7 +73,7 @@ if ($_GET['a'] == "download") { $fd = fopen($tmp.$filename, "rb"); header("Content-Type: binary/octet-stream"); header("Content-Length: " . filesize($tmp.$filename)); - header('Content-Disposition: attachment; filename="'.$filename.'"'); + header('Content-Disposition: attachment; filename="' . $filename . '"'); fpassthru($fd); conf_mount_ro(); @@ -90,13 +89,12 @@ if ($_GET['a'] == "other") { //extract the tgz file if (file_exists('/root/backup/'.$filename)) { - //echo "The file $filename exists"; - system('cd /; tar xvpfz /root/backup/'.$filename.' '); - header( 'Location: backup.php?savemsg=Backup+has+been+restored.' ) ; - } - else { + //echo "The file $filename exists"; + system('cd /; tar xvpfz /root/backup/'.$filename.' '); + header( 'Location: backup.php?savemsg=Backup+has+been+restored.' ) ; + } else { header( 'Location: backup.php?savemsg=Restore+failed.+Backup+file+not+found.' ) ; - } + } conf_mount_ro(); exit; } @@ -111,7 +109,6 @@ if (($_POST['submit'] == "Upload") && is_uploaded_file($_FILES['ulfile']['tmp_na conf_mount_ro(); } - include("head.inc"); ?> @@ -210,91 +207,85 @@ echo "
\n"; if ($config_change == 1) { write_config(); - $config_change = 0; + $config_change = 0; } -//if ($savemsg) print_info_box($savemsg); +//if ($savemsg) print_info_box($savemsg); //if (file_exists($d_hostsdirty_path)): echo"

"; //print_info_box_np("This is an info box."); //echo"
"; -//endif; +//endif; ?> - +
+ 0) { foreach ($a_backup as $ent) { ?> - - - - -
Name Enabled Description - - - - - - -
- + + + + + +
-   - -   - -   - - + + + + + - - + + + - - + + - - - + + -
+   + +   + +   + + - - + + -
-
- - - - - -
-
+ + + + + +
+
+

-


@@ -310,7 +301,6 @@ if ($config_change == 1) { - -- cgit v1.2.3