diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2008-08-30 03:49:07 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2008-08-30 03:49:07 +0000 |
commit | b3277798e5f6f3e02468f58e315e37362d932d02 (patch) | |
tree | d9de0d87d156c9e4b46fa63bc270670bf3271112 /usr/local/www | |
parent | cc0ef90eaa9f4e5631ec8bb2eff18b2672ac3824 (diff) | |
download | pfsense-b3277798e5f6f3e02468f58e315e37362d932d02.zip pfsense-b3277798e5f6f3e02468f58e315e37362d932d02.tar.gz |
Only show areas that have data in them in the backup selection screen.
Noticed-by: mgrooms
Diffstat (limited to 'usr/local/www')
-rwxr-xr-x | usr/local/www/diag_backup.php | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/usr/local/www/diag_backup.php b/usr/local/www/diag_backup.php index 29d5474..22494a4 100755 --- a/usr/local/www/diag_backup.php +++ b/usr/local/www/diag_backup.php @@ -51,25 +51,40 @@ function remove_bad_chars($string) { return preg_replace('/[^a-z|_|0-9]/i','',$string); } +function check_and_returnif_section_exists($section) { + global $config; + if(is_array($config[$section])) + return true; + return false; +} + function spit_out_select_items($area) { - $select = <<<EOD - <select name="{$area}"> - <option VALUE="">ALL</option> - <option VALUE="aliases">Aliases</option> - <option VALUE="shaper">Traffic Shaper</option> - <option VALUE="filter">Firewall Rules</option> - <option VALUE="nat">NAT</option> - <option VALUE="pptpd">PPTP Server</option> - <option VALUE="ipsec">IPsec VPN</option> - <option VALUE="captiveportal">Captive Portal</option> - <option VALUE="installedpackages">Package Manager</option> - <option VALUE="interfaces">Interfaces</option> - <option VALUE="dhcpd">DHCP Server</option> - <option VALUE="syslog">Syslog</option> - <option VALUE="system">System</option> - <option VALUE="staticroutes">Static routes</option> - </select> -EOD; + global $config; + + $areas = array("aliases" => "Aliases", + "shaper" => "Traffic Shaper", + "filter" => "Firewall Rules", + "nat" => "NAT", + "pptpd" => "PPTP Server", + "ipsec" => "IPSEC", + "captiveportal" => "Captive Portal", + "installedpackages" => "Package Manager", + "interfaces" => "Interfaces", + "dhcpd" => "DHCP Server", + "syslog" => "Syslog", + "system" => "System", + "staticroutes" => "Static routes" + ); + + $select .= "<select name=\"{$area}\">\n"; + $select .= "<option VALUE=\"\">ALL</option>"; + + foreach($areas as $area => $areaname) + if(check_and_returnif_section_exists($area) == true) + $select .= "<option value='{$area}'>{$areaname}</option>\n"; + + $select .= "</select>\n"; + echo $select; } |