summaryrefslogtreecommitdiffstats
path: root/etc/inc/xmlparse.inc
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2010-05-18 20:03:25 +0000
committerErmal <eri@pfsense.org>2010-05-18 20:03:25 +0000
commit2e6a43a13c449ae0c486989cb60fd47e9fe541f1 (patch)
treedc394fe0dba317149989217ae64cfb967506a021 /etc/inc/xmlparse.inc
parente490f9950c965a878481dc830e99330fdb82837b (diff)
downloadpfsense-2e6a43a13c449ae0c486989cb60fd47e9fe541f1.zip
pfsense-2e6a43a13c449ae0c486989cb60fd47e9fe541f1.tar.gz
Encode/decode special characters with htmlentities/html_entity_decode combo to make the parser not bail on special characters.
Diffstat (limited to 'etc/inc/xmlparse.inc')
-rw-r--r--etc/inc/xmlparse.inc13
1 files changed, 9 insertions, 4 deletions
diff --git a/etc/inc/xmlparse.inc b/etc/inc/xmlparse.inc
index 22cb5d6..89c3a95 100644
--- a/etc/inc/xmlparse.inc
+++ b/etc/inc/xmlparse.inc
@@ -144,10 +144,10 @@ function cData($parser, $data) {
}
if (is_string($ptr)) {
- $ptr .= $data;
+ $ptr .= html_entity_decode($data);
} else {
if (trim($data, " ") != "") {
- $ptr = $data;
+ $ptr = html_entity_decode($data);
$havedata++;
}
}
@@ -256,8 +256,10 @@ function dump_xml_config_sub($arr, $indent) {
if($cval === false) continue;
if(($cval === true) || ($cval === "")) {
$xmlconfig .= "<$ent/>\n";
+ } else if (substr($ent, 0, 5) == "descr") {
+ $xmlconfig .= "<$ent><![CDATA[ " . htmlentities($cval) . " ]]></$ent>\n";
} else {
- $xmlconfig .= "<$ent>" . htmlspecialchars($cval) . "</$ent>\n";
+ $xmlconfig .= "<$ent>" . htmlentities($cval) . "</$ent>\n";
}
}
}
@@ -279,7 +281,10 @@ function dump_xml_config_sub($arr, $indent) {
$xmlconfig .= "<$ent/>\n";
} else if (!is_bool($val)) {
$xmlconfig .= str_repeat("\t", $indent);
- $xmlconfig .= "<$ent>" . htmlspecialchars($val) . "</$ent>\n";
+ if (substr($ent, 0, 5) == "descr")
+ $xmlconfig .= "<$ent><![CDATA[ " . htmlentities($val) . " ]]></$ent>\n";
+ else
+ $xmlconfig .= "<$ent>" . htmlentities($val) . "</$ent>\n";
}
}
}
OpenPOWER on IntegriCloud