summaryrefslogtreecommitdiffstats
path: root/usr/local/www/services_captiveportal.php
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2013-12-02 17:35:01 -0200
committerRenato Botelho <garga@FreeBSD.org>2013-12-02 17:35:01 -0200
commitaa87cf1108532f083761a5d2da4ff518cc398356 (patch)
treee4e360a62267b0e25612e86cbdf696c4c5a4fa5f /usr/local/www/services_captiveportal.php
parent61422dd487c2646c21b09b8bb3588ed3e49e3223 (diff)
downloadpfsense-aa87cf1108532f083761a5d2da4ff518cc398356.zip
pfsense-aa87cf1108532f083761a5d2da4ff518cc398356.tar.gz
Fix #3339. Add a way to download CP portal, error and logout html pages
Diffstat (limited to 'usr/local/www/services_captiveportal.php')
-rwxr-xr-xusr/local/www/services_captiveportal.php43
1 files changed, 42 insertions, 1 deletions
diff --git a/usr/local/www/services_captiveportal.php b/usr/local/www/services_captiveportal.php
index 9c2e47d..b30b330 100755
--- a/usr/local/www/services_captiveportal.php
+++ b/usr/local/www/services_captiveportal.php
@@ -38,12 +38,16 @@
##|*MATCH=services_captiveportal.php*
##|-PRIV
-require_once("guiconfig.inc");
require_once("functions.inc");
require_once("filter.inc");
require_once("shaper.inc");
require_once("captiveportal.inc");
+if (substr($_GET['act'], 0, 3) == "get")
+ $nocsrf = true;
+
+require_once("guiconfig.inc");
+
global $cpzone;
global $cpzoneid;
@@ -68,14 +72,45 @@ if ($_GET['act'] == "viewhtml") {
if ($a_cp[$cpzone] && $a_cp[$cpzone]['page']['htmltext'])
echo base64_decode($a_cp[$cpzone]['page']['htmltext']);
exit;
+} else if ($_GET['act'] == "gethtmlhtml" && $a_cp[$cpzone] && $a_cp[$cpzone]['page']['htmltext']) {
+ $file_data = base64_decode($a_cp[$cpzone]['page']['htmltext']);
+ $file_size = strlen($file_data);
+
+ header("Content-Type: text/html");
+ header("Content-Disposition: attachment; filename=portal.html");
+ header("Content-Length: $file_size");
+ echo $file_data;
+
+ exit;
} else if ($_GET['act'] == "viewerrhtml") {
if ($a_cp[$cpzone] && $a_cp[$cpzone]['page']['errtext'])
echo base64_decode($a_cp[$cpzone]['page']['errtext']);
exit;
+} else if ($_GET['act'] == "geterrhtml" && $a_cp[$cpzone] && $a_cp[$cpzone]['page']['errtext']) {
+ $file_data = base64_decode($a_cp[$cpzone]['page']['errtext']);
+ $file_size = strlen($file_data);
+
+ header("Content-Type: text/html");
+ header("Content-Disposition: attachment; filename=err.html");
+ header("Content-Length: $file_size");
+ echo $file_data;
+
+ exit;
} else if ($_GET['act'] == "viewlogouthtml") {
if ($a_cp[$cpzone] && $a_cp[$cpzone]['page']['logouttext'])
echo base64_decode($a_cp[$cpzone]['page']['logouttext']);
exit;
+} else if ($_GET['act'] == "getlogouthtml" && $a_cp[$cpzone] && $a_cp[$cpzone]['page']['logouttext']) {
+ $file_data = base64_decode($a_cp[$cpzone]['page']['logouttext']);
+ $file_size = strlen($file_data);
+ file_put_contents("/tmp/lala", $file_data);
+
+ header("Content-Type: text/html");
+ header("Content-Disposition: attachment; filename=logout.html");
+ header("Content-Length: $file_size");
+ echo $file_data;
+
+ exit;
}
if (!is_array($config['ca']))
@@ -938,6 +973,8 @@ function enable_change(enable_change) {
?>
<?php if ($pconfig['page']['htmltext']): ?>
<a href="<?=$href?>" target="_new"><?=gettext("View current page"); ?></a>
+ <br />
+ <a href="?zone=<?=$cpzone?>&amp;act=gethtmlhtml" target="_blank"><?=gettext("Download current page"); ?></a>
<br>
<br>
<?php endif; ?>
@@ -972,6 +1009,8 @@ function enable_change(enable_change) {
<input name="errfile" type="file" class="formfld file" id="errfile"><br>
<?php if ($pconfig['page']['errtext']): ?>
<a href="?zone=<?=$cpzone?>&amp;act=viewerrhtml" target="_blank"><?=gettext("View current page"); ?></a>
+ <br />
+ <a href="?zone=<?=$cpzone?>&amp;act=geterrhtml" target="_blank"><?=gettext("Download current page"); ?></a>
<br>
<br>
<?php endif; ?>
@@ -986,6 +1025,8 @@ function enable_change(enable_change) {
<input name="logoutfile" type="file" class="formfld file" id="logoutfile"><br>
<?php if ($pconfig['page']['logouttext']): ?>
<a href="?zone=<?=$cpzone?>&amp;act=viewlogouthtml" target="_blank"><?=gettext("View current page"); ?></a>
+ <br />
+ <a href="?zone=<?=$cpzone?>&amp;act=getlogouthtml" target="_blank"><?=gettext("Download current page"); ?></a>
<br>
<br>
<?php endif; ?>
OpenPOWER on IntegriCloud