diff options
author | Ermal <eri@pfsense.org> | 2010-05-24 18:10:50 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-05-24 18:10:50 +0000 |
commit | 70d6b5c49167c6f35f421c11dccdf8b951bf209f (patch) | |
tree | f058be813fe09768a9a3c89a998b662190d6d3d6 | |
parent | 0914b6bbe52483115638d0240e74112cac8cec96 (diff) | |
download | pfsense-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.
-rw-r--r-- | etc/inc/xmlparse.inc | 22 | ||||
-rw-r--r-- | usr/local/www/system_groupmanager.php | 4 |
2 files changed, 16 insertions, 10 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); diff --git a/usr/local/www/system_groupmanager.php b/usr/local/www/system_groupmanager.php index 579a735..9c37c99 100644 --- a/usr/local/www/system_groupmanager.php +++ b/usr/local/www/system_groupmanager.php @@ -137,7 +137,9 @@ if ($_POST) { $group['name'] = $_POST['groupname']; $group['description'] = $_POST['description']; - if ($group['gid'] != 1998) // all group + if (empty($_POST['members'])) + unset($group['member']); + else if ($group['gid'] != 1998) // all group $group['member'] = $_POST['members']; if (isset($id) && $a_group[$id]) |