aboutsummaryrefslogtreecommitdiffstats
path: root/config/backup/backup.tmp
diff options
context:
space:
mode:
authormcrane <mctch@yahoo.com>2009-10-02 19:21:05 -0600
committermcrane <mctch@yahoo.com>2009-10-02 19:22:32 -0600
commit31d4f4e0a177725f98d8e670de3170f0fb47ee3e (patch)
tree0591e18a3417f99e9e03de124cdb77085e90e16a /config/backup/backup.tmp
parentec204945983f8570c57d64d7a4358e7db59a7011 (diff)
downloadpfsense-packages-31d4f4e0a177725f98d8e670de3170f0fb47ee3e.tar.gz
pfsense-packages-31d4f4e0a177725f98d8e670de3170f0fb47ee3e.tar.bz2
pfsense-packages-31d4f4e0a177725f98d8e670de3170f0fb47ee3e.zip
Backup package make changes so that it will work on nano version and some white space clean up.
Diffstat (limited to 'config/backup/backup.tmp')
-rw-r--r--config/backup/backup.tmp257
1 files changed, 132 insertions, 125 deletions
diff --git a/config/backup/backup.tmp b/config/backup/backup.tmp
index 10e03db3..3cada9b3 100644
--- a/config/backup/backup.tmp
+++ b/config/backup/backup.tmp
@@ -30,26 +30,30 @@
require("guiconfig.inc");
require("/usr/local/pkg/backup.inc");
-$a_backup = &$config['installedpackages']['backup']['config'];
+$a_backup = &$config['installedpackages']['backup']['config'];
if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'backup') {
- if ($a_backup[$_GET['id']]) {
- unset($a_backup[$_GET['id']]);
- write_config();
- header("Location: backup.php");
- exit;
- }
- }
+ if ($_GET['type'] == 'backup') {
+ if ($a_backup[$_GET['id']]) {
+ conf_mount_rw();
+ unset($a_backup[$_GET['id']]);
+ write_config();
+ header("Location: backup.php");
+ conf_mount_ro();
+ exit;
+ }
+ }
}
if ($_GET['a'] == "download") {
if ($_GET['t'] == "backup") {
+ conf_mount_rw();
+
$tmp = '/root/backup/';
$filename = 'pfsense.bak.tgz';
//system('cd /usr/local/;tar cvzf /root/backup/pfsense.bak.tgz freeswitch');
-
+
$i = 0;
if (count($a_backup) > 0) {
$backup_cmd = 'tar --create --verbose --gzip --file '.$tmp.$filename.' --directory / ';
@@ -59,48 +63,52 @@ if ($_GET['a'] == "download") {
//htmlspecialchars($ent['path']);
//htmlspecialchars($ent['description']);
$backup_cmd .= htmlspecialchars($ent['path']).' ';
-
- }
+ }
$i++;
- }
- //echo $backup_cmd; //exit;
- system($backup_cmd);
- }
-
+ }
+ //echo $backup_cmd; //exit;
+ system($backup_cmd);
+ }
+
session_cache_limiter('public');
$fd = fopen($tmp.$filename, "rb");
header("Content-Type: binary/octet-stream");
header("Content-Length: " . filesize($tmp.$filename));
header('Content-Disposition: attachment; filename="'.$filename.'"');
fpassthru($fd);
+
+ conf_mount_ro();
exit;
}
}
if ($_GET['a'] == "other") {
- if ($_GET['t'] == "restore") {
- $tmp = '/root/backup/';
- $filename = 'pfsense.bak.tgz';
-
- //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 {
- header( 'Location: backup.php?savemsg=Restore+failed.+Backup+file+not+found.' ) ;
- }
-
- exit;
- }
+ if ($_GET['t'] == "restore") {
+ conf_mount_rw();
+ $tmp = '/root/backup/';
+ $filename = 'pfsense.bak.tgz';
+
+ //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 {
+ header( 'Location: backup.php?savemsg=Restore+failed.+Backup+file+not+found.' ) ;
+ }
+ conf_mount_ro();
+ exit;
+ }
}
if (($_POST['submit'] == "Upload") && is_uploaded_file($_FILES['ulfile']['tmp_name'])) {
- $filename = 'pfsense.bak.tgz';
+ conf_mount_rw();
+ $filename = 'pfsense.bak.tgz';
move_uploaded_file($_FILES['ulfile']['tmp_name'], "/root/backup/" . $filename);
$savemsg = "Uploaded file to /root/backup/" . htmlentities($_FILES['ulfile']['name']);
system('cd /; tar xvpfz /root/backup/'.$filename.' ');
+ conf_mount_ro();
}
@@ -115,7 +123,7 @@ include("head.inc");
<?php
if ($_GET["savemsg"]) {
- print_info_box($_GET["savemsg"]);
+ print_info_box($_GET["savemsg"]);
}
?>
@@ -123,60 +131,59 @@ if ($_GET["savemsg"]) {
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td class="tabnavtbl">
<?php
-
+
$tab_array = array();
$tab_array[] = array(gettext("Settings"), true, "/packages/backup/backup.php");
display_top_tabs($tab_array);
-
+
?>
</td></tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
+ <tr>
+ <td class="tabcont" >
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
- <p>
+ <p>
Use this to tool to backup files and directories. The following directories
are recommended for backup.
-
+
<table>
<tr><td><strong>pfSense Config</strong></td><td>/cf/conf</td></tr>
<tr><td><strong>RRD Graph Data Files</strong></td><td>/var/db/rrd</td></tr>
</table>
- </p>
+ </p>
</td>
</tr>
</table>
<br/>
<br/>
-
+
<div id="niftyOutter">
-
+
<form action="backup.php" method="POST" enctype="multipart/form-data" name="frmUpload" onSubmit="">
- <table width='100%' width='690' cellpadding='0' cellspacing='0' border='0'>
- <tr><td align='left' colspan='4'><strong>Upload and Restore</strong></td></tr>
- <tr>
- <td colspan='2'>Use this to upload and restore your backup file.</td>
- <td align="right">File to upload:</td>
- <td width='50%' valign="top" align='right' class="label">
- <input name="ulfile" type="file" class="button" id="ulfile">
- </td>
- <td valign="top" class="label">
- <input name="submit" type="submit" class="button" id="upload" value="Upload">
- </td>
- </tr>
-
- </table>
- <br />
- <br />
+ <table width='100%' width='690' cellpadding='0' cellspacing='0' border='0'>
+ <tr><td align='left' colspan='4'><strong>Upload and Restore</strong></td></tr>
+ <tr>
+ <td colspan='2'>Use this to upload and restore your backup file.</td>
+ <td align="right">File to upload:</td>
+ <td width='50%' valign="top" align='right' class="label">
+ <input name="ulfile" type="file" class="button" id="ulfile">
+ </td>
+ <td valign="top" class="label">
+ <input name="submit" type="submit" class="button" id="upload" value="Upload">
+ </td>
+ </tr>
+ </table>
+ <br />
+ <br />
</div>
</form>
-
+
<?php
echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n";
@@ -197,7 +204,7 @@ if ($_GET["savemsg"]) {
echo "</table>\n";
echo "<br /><br />\n\n";
-
+
echo " <form action='backup.php' method='post' name='iform' id='iform'>\n";
@@ -213,22 +220,22 @@ if ($config_change == 1) {
//endif;
?>
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="30%" class="listhdrr">Name</td>
- <td width="20%" class="listhdrr">Enabled</td>
- <td width="40%" class="listhdr">Description</td>
- <td width="10%" class="list">
-
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="backup_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
-
- </td>
+
+ <table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td width="30%" class="listhdrr">Name</td>
+ <td width="20%" class="listhdrr">Enabled</td>
+ <td width="40%" class="listhdr">Description</td>
+ <td width="10%" class="list">
+
+ <table border="0" cellspacing="0" cellpadding="1">
+ <tr>
+ <td width="17"></td>
+ <td valign="middle"><a href="backup_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
+ </tr>
+ </table>
+
+ </td>
</tr>
@@ -236,55 +243,55 @@ if ($config_change == 1) {
$i = 0;
if (count($a_backup) > 0) {
-
- foreach ($a_backup as $ent) {
-
+
+ foreach ($a_backup as $ent) {
+
?>
- <tr>
- <td class="listr" ondblclick="document.location='backup_edit.php?id=<?=$i;?>';">
- <?=$ent['name'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='backup_edit.php?id=<?=$i;?>';">
- <?=$ent['enabled'];?>&nbsp;
- </td>
- <td class="listbg" ondblclick="document.location='backup_edit.php?id=<?=$i;?>';">
- <font color="#FFFFFF"><?=htmlspecialchars($ent['description']);?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="backup_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="backup_edit.php?type=backup&act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
-
- $i++;
- }
+ <tr>
+ <td class="listr" ondblclick="document.location='backup_edit.php?id=<?=$i;?>';">
+ <?=$ent['name'];?>&nbsp;
+ </td>
+ <td class="listr" ondblclick="document.location='backup_edit.php?id=<?=$i;?>';">
+ <?=$ent['enabled'];?>&nbsp;
+ </td>
+ <td class="listbg" ondblclick="document.location='backup_edit.php?id=<?=$i;?>';">
+ <font color="#FFFFFF"><?=htmlspecialchars($ent['description']);?>&nbsp;
+ </td>
+ <td valign="middle" nowrap class="list">
+ <table border="0" cellspacing="0" cellpadding="1">
+ <tr>
+ <td valign="middle"><a href="backup_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
+ <td><a href="backup_edit.php?type=backup&act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <?php
+
+ $i++;
+ }
}
- ?>
-
- <tr>
- <td class="list" colspan="3"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="backup_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
-
- <tr>
- <td class="list" colspan="3"></td>
- <td class="list"></td>
- </tr>
- </table>
-
+ ?>
+
+ <tr>
+ <td class="list" colspan="3"></td>
+ <td class="list">
+ <table border="0" cellspacing="0" cellpadding="1">
+ <tr>
+ <td width="17"></td>
+ <td valign="middle"><a href="backup_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+
+ <tr>
+ <td class="list" colspan="3"></td>
+ <td class="list"></td>
+ </tr>
+ </table>
+
</form>