summaryrefslogtreecommitdiffstats
path: root/usr/local/www/edit.php
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2006-09-26 22:49:53 +0000
committerScott Ullrich <sullrich@pfsense.org>2006-09-26 22:49:53 +0000
commitad6eae25dcd2aa4137f603a3e4b6fd14978a9c7f (patch)
tree01018b78b63945ac1450e702ccf4677222eb6275 /usr/local/www/edit.php
parent9996eff6ced362469991a9eaad5fc3beebb716bd (diff)
downloadpfsense-ad6eae25dcd2aa4137f603a3e4b6fd14978a9c7f.zip
pfsense-ad6eae25dcd2aa4137f603a3e4b6fd14978a9c7f.tar.gz
Allow loading of text from outside scripts such as snort.
Diffstat (limited to 'usr/local/www/edit.php')
-rwxr-xr-xusr/local/www/edit.php22
1 files changed, 21 insertions, 1 deletions
diff --git a/usr/local/www/edit.php b/usr/local/www/edit.php
index 0f53953..073105c 100755
--- a/usr/local/www/edit.php
+++ b/usr/local/www/edit.php
@@ -29,6 +29,24 @@
require("guiconfig.inc");
+if (($_GET['submit'] == "Load") && file_exists($_GET['savetopath'])) {
+ $fd = fopen($_GET['savetopath'], "r");
+ $content = fread($fd, filesize($_GET['savetopath']));
+ fclose($fd);
+ $edit_area="";
+ $loadmsg = gettext("Loaded text from")." " . $_GET['savetopath'];
+ if(stristr($_GET['savetopath'], ".php") == true)
+ $language = "php";
+ else if(stristr($_GET['savetopath'], ".inc") == true)
+ $language = "php";
+ else if(stristr($_GET['savetopath'], ".sh") == true)
+ $language = "core";
+ else if(stristr($_GET['savetopath'], ".xml") == true)
+ $language = "xml";
+
+ $savetopath = $_GET['savetopath'];
+}
+
if (($_POST['submit'] == "Load") && file_exists($_POST['savetopath'])) {
$fd = fopen($_POST['savetopath'], "r");
$content = fread($fd, filesize($_POST['savetopath']));
@@ -43,6 +61,7 @@ if (($_POST['submit'] == "Load") && file_exists($_POST['savetopath'])) {
$language = "core";
else if(stristr($_POST['savetopath'], ".xml") == true)
$language = "xml";
+ $savetopath = $_POST['savetopath'];
} else if (($_POST['submit'] == "Save")) {
conf_mount_rw();
$content = ereg_replace("\r","",$_POST['code']) ;
@@ -54,6 +73,7 @@ if (($_POST['submit'] == "Load") && file_exists($_POST['savetopath'])) {
if($_POST['savetopath'] == "/cf/conf/config.xml")
unlink_if_exists("/tmp/config.cache");
conf_mount_ro();
+ $savetopath = $_POST['savetopath'];
} else if (($_POST['submit'] == "Load") && !file_exists($_POST['savetopath'])) {
$savemsg = "File not found " . $_POST['savetopath'];
$content = "";
@@ -132,7 +152,7 @@ function sf() { document.forms[0].savetopath.focus(); }
<tr>
<td>
<center>
- Save/Load from path: <input size="42" id="savetopath" name="savetopath" value="<?php echo $_POST['savetopath']; ?>">
+ Save/Load from path: <input size="42" id="savetopath" name="savetopath" value="<?php echo $savetopath; ?>">
<input name="submit" type="submit" class="button" id="Load" value="Load"> <input name="submit" type="submit" class="button" id="Save" value="Save">
<hr noshade>
<?php if($_POST['highlight'] == "no"): ?>
OpenPOWER on IntegriCloud