diff options
Diffstat (limited to 'packages/autoconfigbackup')
-rw-r--r-- | packages/autoconfigbackup/autoconfigbackup.php | 61 |
1 files changed, 35 insertions, 26 deletions
diff --git a/packages/autoconfigbackup/autoconfigbackup.php b/packages/autoconfigbackup/autoconfigbackup.php index 6395caae..d2f28297 100644 --- a/packages/autoconfigbackup/autoconfigbackup.php +++ b/packages/autoconfigbackup/autoconfigbackup.php @@ -78,31 +78,6 @@ if($_POST['backup']) { if($_REQUEST['savemsg']) $savemsg = htmlentities($_REQUEST['savemsg']); -if($_REQUEST['download']) { - // Phone home and obtain backups - $curl_session = curl_init(); - curl_setopt($curl_session, CURLOPT_URL, $get_url); - curl_setopt($curl_session, CURLOPT_POST, 3); - curl_setopt($curl_session, CURLOPT_SSL_VERIFYPEER, 0); - curl_setopt($curl_session, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($curl_session, CURLOPT_POSTFIELDS, "action=restore" . - "&hostname=" . urlencode($hostname) . - "&revision=" . urlencode($_REQUEST['download'])); - $data = curl_exec($curl_session); - if (!tagfile_deformat($data, $data1, "config.xml")) - $input_errors[] = "The downloaded file does not appear to contain an encrypted pfSense configuration."; - if ($input_errors) { - print_input_errors($input_errors); - } else { - $ds = split("\+\+\+\+", $data); - echo "<h1>SHA256 summary</h1>"; - echo "<textarea rows='1' cols='70'>{$ds[0]}</textarea>"; - echo "<h1>Encrypted config.xml</h1>"; - echo "<textarea rows='40' cols='70'>{$ds[1]}</textarea>"; - } - exit; -} - if($_REQUEST['newver'] != "") { // Phone home and obtain backups $curl_session = curl_init(); @@ -261,7 +236,13 @@ include("head.inc"); <?php $tab_array = array(); $tab_array[0] = array("Settings", false, "/pkg_edit.php?xml=autoconfigbackup.xml&id=0"); - $tab_array[1] = array("Restore", true, "/autoconfigbackup.php"); + if($_REQUEST['download']) + $active = false; + else + $active = true; + $tab_array[1] = array("Restore", $active, "/autoconfigbackup.php"); + if($_REQUEST['download']) + $tab_array[] = array("Revision", true, "/autoconfigbackup.php?download={$_REQUEST['download']}"); display_top_tabs($tab_array); ?> </td></tr> @@ -270,6 +251,34 @@ include("head.inc"); <table id="backuptable" class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td colspan="2" align="left"> +<?php + if($_REQUEST['download']) { + // Phone home and obtain backups + $curl_session = curl_init(); + curl_setopt($curl_session, CURLOPT_URL, $get_url); + curl_setopt($curl_session, CURLOPT_POST, 3); + curl_setopt($curl_session, CURLOPT_SSL_VERIFYPEER, 0); + curl_setopt($curl_session, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curl_session, CURLOPT_POSTFIELDS, "action=restore" . + "&hostname=" . urlencode($hostname) . + "&revision=" . urlencode($_REQUEST['download'])); + $data = curl_exec($curl_session); + if (!tagfile_deformat($data, $data1, "config.xml")) + $input_errors[] = "The downloaded file does not appear to contain an encrypted pfSense configuration."; + if ($input_errors) { + print_input_errors($input_errors); + } else { + $ds = split("\+\+\+\+", $data); + echo "<h1>SHA256 summary</h1>"; + echo "<textarea rows='1' cols='70'>{$ds[0]}</textarea>"; + echo "<h1>Encrypted config.xml</h1>"; + echo "<textarea rows='40' cols='70'>{$ds[1]}</textarea>"; + } + echo "</td></tr></table></div></td></td></tr></tr></table></form>"; + require("fend.inc"); + exit; + } +?> <form method="post" action="autoconfigbackup.php"> <input type="button" onClick='backupnow()' name="backup" value="Backup Now"> </form> |