summaryrefslogtreecommitdiffstats
path: root/etc/inc/xmlparse.inc
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2010-05-24 18:10:50 +0000
committerErmal <eri@pfsense.org>2010-05-24 18:10:50 +0000
commit70d6b5c49167c6f35f421c11dccdf8b951bf209f (patch)
treef058be813fe09768a9a3c89a998b662190d6d3d6 /etc/inc/xmlparse.inc
parent0914b6bbe52483115638d0240e74112cac8cec96 (diff)
downloadpfsense-70d6b5c49167c6f35f421c11dccdf8b951bf209f.zip
pfsense-70d6b5c49167c6f35f421c11dccdf8b951bf209f.tar.gz
Ticket #612. Correctly show the number of users as 0 on a group with no users. Also handle the case of empty arrays on the xmlparser.
Diffstat (limited to 'etc/inc/xmlparse.inc')
-rw-r--r--etc/inc/xmlparse.inc22
1 files changed, 13 insertions, 9 deletions
diff --git a/etc/inc/xmlparse.inc b/etc/inc/xmlparse.inc
index c19a3ae..59b0eb4 100644
--- a/etc/inc/xmlparse.inc
+++ b/etc/inc/xmlparse.inc
@@ -246,27 +246,31 @@ function dump_xml_config_sub($arr, $indent) {
if (in_array(strtolower($ent), $listtags)) {
foreach ($val as $cval) {
if (is_array($cval)) {
- $xmlconfig .= str_repeat("\t", $indent);
- $xmlconfig .= "<$ent>\n";
- $xmlconfig .= dump_xml_config_sub($cval, $indent + 1);
- $xmlconfig .= str_repeat("\t", $indent);
- $xmlconfig .= "</$ent>\n";
+ if (empty($cval)) {
+ $xmlconfig .= str_repeat("\t", $indent);
+ $xmlconfig .= "<$ent/>\n";
+ } else {
+ $xmlconfig .= str_repeat("\t", $indent);
+ $xmlconfig .= "<$ent>\n";
+ $xmlconfig .= dump_xml_config_sub($cval, $indent + 1);
+ $xmlconfig .= str_repeat("\t", $indent);
+ $xmlconfig .= "</$ent>\n";
+ }
} else {
- $xmlconfig .= str_repeat("\t", $indent);
if($cval === false) continue;
- if(($cval === true) || ($cval === "")) {
+ $xmlconfig .= str_repeat("\t", $indent);
+ if((is_bool($cval) && $cval == true) || ($cval === "")) {
$xmlconfig .= "<$ent/>\n";
} else if (substr($ent, 0, 5) == "descr") {
$xmlconfig .= "<$ent><![CDATA[" . htmlentities($cval) . "]]></$ent>\n";
} else {
$xmlconfig .= "<$ent>" . htmlentities($cval) . "</$ent>\n";
+ }
}
}
- }
} else if (empty($val)) {
$xmlconfig .= str_repeat("\t", $indent);
$xmlconfig .= "<$ent/>\n";
- $xmlconfig .= str_repeat("\t", $indent);
} else {
/* it's an array */
$xmlconfig .= str_repeat("\t", $indent);
OpenPOWER on IntegriCloud