From 7c4cfa35ca8c15e647f91ed3bcdc8a806fd5ebaa Mon Sep 17 00:00:00 2001 From: jim-p Date: Tue, 23 May 2017 12:51:03 -0400 Subject: [PATCH] Add download button/function directly on status.php to ease confusion. (cherry picked from commit f7a72733f8c482e230e0042a6c65f4935a2b723a) (cherry picked from commit b44ee60da886ae7eb7862d298d8018e94515d945) --- src/usr/local/www/status.php | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/src/usr/local/www/status.php b/src/usr/local/www/status.php index fc2c6328b1..baa596d659 100644 --- a/src/usr/local/www/status.php +++ b/src/usr/local/www/status.php @@ -74,6 +74,25 @@ require_once("gwlb.inc"); $output_path = "/tmp/status_output/"; $output_file = "/tmp/status_output.tgz"; +if ($_POST['submit'] == "DOWNLOAD" && file_exists($output_file)) { + session_cache_limiter('public'); + $fd = fopen($output_file, "rb"); + header("Content-Type: application/octet-stream"); + header("Content-Length: " . filesize($output_file)); + header("Content-Disposition: attachment; filename=\"" . + trim(htmlentities(basename($output_file))) . "\""); + if (isset($_SERVER['HTTPS'])) { + header('Pragma: '); + header('Cache-Control: '); + } else { + header("Pragma: private"); + header("Cache-Control: private, must-revalidate"); + } + + fpassthru($fd); + exit; +} + if (is_dir($output_path)) { unlink_if_exists("{$output_path}/*"); @rmdir($output_path); @@ -371,17 +390,24 @@ exec("/bin/date", $dateOutput, $dateStatus); $currentDate = $dateOutput[0]; $pgtitle = array($g['product_name'], "Status"); -include("head.inc"); +include("head.inc"); ?> -print_info_box( +
+ +' . gettext("Common password fields in config.xml have been automatically redacted.") . '
' . - sprintf(gettext('When the page has finished loading, the output will be stored in %1$s. It may be downloaded via scp or %2$sDiagnostics > Command Prompt%3$s.'), - $output_file, '', '')); + sprintf(gettext('When the page has finished loading, the output is stored in %1$s. It may be downloaded via scp or using this button: '), $output_file) . + ' '); ?> -print_info_box(get_firewall_info(), 'info', false); +
+ +