From 5e3249f00dd8417a8de7f20f6a40605405409b88 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Fri, 11 Sep 2009 14:30:34 -0400 Subject: Sort by item name and include packages in the sorting order --- usr/local/www/fbegin.inc | 264 ++++++++++++++++++++++++++--------------------- 1 file changed, 144 insertions(+), 120 deletions(-) (limited to 'usr/local/www/fbegin.inc') diff --git a/usr/local/www/fbegin.inc b/usr/local/www/fbegin.inc index 6a5b0cb..87212ae 100755 --- a/usr/local/www/fbegin.inc +++ b/usr/local/www/fbegin.inc @@ -10,6 +10,7 @@ require_once("functions.inc"); function return_ext_menu($section) { global $config; $htmltext = ""; + $extarray = array(); if($config['installedpackages']['menu'] <> "") { foreach($config['installedpackages']['menu'] as $menuitem) { if($menuitem['section'] != $section) continue; @@ -29,12 +30,145 @@ function return_ext_menu($section) { } else { $description = '/pkg.php?xml=' . $menuitem['configfile']; } - $htmltext .= '
  • ' . $menuitem['name'] . '
  • ' . "\n"; + $extarray[] = array($menuitem['name'], $description); } } - return $htmltext; + return $extarray; } +function output_menu($arrayitem) { + foreach($arrayitem as $item) { + echo '
  • ' . $item[0] . '
  • ' . "\n"; + } +} + +// System +$system = array(); +$system[] = array("Advanced", "/system_advanced_admin.php"); +$system[] = array("Firmware", "/system_firmware.php"); +$system[] = array("General Setup", "/system.php"); +$system[] = array("Logout", "/index.php?logout"); +if ($g['platform'] == "pfSense" or $g['platform'] == "nanobsd") + $system[] = array("Packages", "/pkg_mgr.php"); +$system[] = array("Setup Wizard", "/wizard.php?xml=setup_wizard.xml"); +$system[] = array("Routing", "/system_gateways.php"); +$system[] = array("Cert Manager", "/system_camanager.php"); +$system[] = array("User Manager", "/system_usermanager.php"); +$system = msort(array_merge($system, return_ext_menu("System")),0); + +// Interfaces +$interfaces = array(); +if (!isset($config['system']['webgui']['noassigninterfaces'])) + $interfaces[] = array("(assign)", "/interfaces_assign.php"); +$opts = get_configured_interface_with_descr(false, true); +foreach ($opts as $oif => $odescr) + if (!isset($config['interfaces'][$oif]['ovpn'])) + $interfaces[] = array(htmlspecialchars($odescr), "/interfaces.php?if={$oif}"); +$interfaces = msort(array_merge($interfaces, return_ext_menu("Interfaces")),0); + +// Firewall +$firewall = array(); +$firewall[] = array("Aliases", "/firewall_aliases.php"); +if($config['interfaces']['lan']) + $firewall[] = array("NAT", "/firewall_nat.php"); +$firewall[] = array("Rules", "/firewall_rules.php"); +$firewall[] = array("Schedules", "/firewall_schedule.php"); +if($config['interfaces']['lan']) + $firewall[] = array("Traffic Shaper", "/firewall_shaper.php"); +$firewall[] = array("Virtual IPs", "/firewall_virtual_ip.php"); +$firewall = msort(array_merge($firewall, return_ext_menu("Firewall")),0); + +// Services +$services = array(); +$services[] = array("Captive Portal", "/services_captiveportal.php"); +$services[] = array("DNS Forwarder", "/services_dnsmasq.php"); +$services[] = array("DHCP Relay", "/services_dhcp_relay.php"); +if($g['services_dhcp_server_enable']) + $services[] = array("DHCP Server", "/services_dhcp.php"); +$services[] = array("Dynamic DNS", "/services_dyndns.php"); +$services[] = array("IGMP proxy", "/services_igmpproxy.php"); +$services[] = array("Load Balancer", "/load_balancer_pool.php"); +$services[] = array("OLSR", "/pkg_edit.php?xml=olsrd.xml&id=0"); +$services[] = array("PPPoE Server", "/vpn_pppoe.php"); +$services[] = array("RIP", "/pkg_edit.php?xml=routed/routed.xml&id=0"); +$services[] = array("SNMP", "/services_snmp.php"); +if($config['interfaces']['lan']) { + /* no use for UPnP in single-interface deployments + remove to reduce user confusion + */ + $services[] = array("UPnP", "/pkg_edit.php?xml=miniupnpd.xml&id=0"); +} +$services[] = array("OpenNTPD", "/pkg_edit.php?xml=openntpd.xml&id=0"); +$services[] = array("Wake on LAN", "/services_wol.php"); +$services = msort(array_merge($services, return_ext_menu("Services")),0); + +// VPN +$vpn = array(); +$vpn[] = array("IPsec", "/vpn_ipsec.php"); +$vpn[] = array("OpenVPN", "/vpn_openvpn_server.php"); +$vpn[] = array("PPTP", "/vpn_pptp.php"); +$vpn[] = array("L2TP", "/vpn_l2tp.php"); +$vpn = msort(array_merge($vpn, return_ext_menu("VPN")),0); + +// Status +$status_menu = array(); +if (isset($config['captiveportal']['enable'])) + $status_menu[] = array("Captive Portal", "/status_captiveportal.php"); +$status_menu[] = array("CARP (failover)", "/carp_status.php"); +$status_menu[] = array("Dashboard", "/index.php"); +$status_menu[] = array("Gateways", "/status_gateways.php"); +$status_menu[] = array("DHCP Leases", "/diag_dhcp_leases.php"); +$status_menu[] = array("Filter Reload", "/status_filter_reload.php"); +$status_menu[] = array("Interfaces", "/status_interfaces.php"); +$status_menu[] = array("IPsec", "/diag_ipsec.php"); +$status_menu[] = array("Load Balancer", "/status_slbd_pool.php"); +$status_menu[] = array("OpenVPN", "/status_openvpn.php"); +if ($g['platform'] == "pfSense") + $status_menu[] = array("Package Logs", "/diag_pkglogs.php"); +$status_menu[] = array("Queues", "/status_queues.php"); +$status_menu[] = array("RRD Graphs", "/status_rrd_graph.php"); +$status_menu[] = array("Services", "/status_services.php"); +$status_menu[] = array("System Logs", "/diag_logs.php"); +$status_menu[] = array("Traffic Graph", "/status_graph.php?if=wan"); +if($config['interfaces']['lan']) + $status_menu[] = array("UPnP", "/status_upnp.php"); +$ifentries = get_configured_interface_with_descr(); +foreach ($ifentries as $ent => $entdesc) { + if (is_array($config['interfaces'][$ent]['wireless']) && + preg_match($g['wireless_regex'], $config['interfaces'][$ent]['if'])) + $ifdescrs[$ent] = $entdesc; +} +if (count($ifdescrs) > 0) + $status_menu[] = array("Wireless", "/status_wireless.php"); +$status_menu = msort(array_merge($status_menu, return_ext_menu("Status")),0); + +// Diagnostics +$diagnostics = array(); +$diagnostics[] = array("ARP Tables", "/diag_arp.php"); +$diagnostics[] = array("Backup/Restore", "/diag_backup.php"); +$diagnostics[] = array("Command Prompt", "/exec.php"); +$diagnostics[] = array("DNS Lookup", "/diag_dns.php"); +$diagnostics[] = array("Edit File", "/edit.php"); +$diagnostics[] = array("Factory Defaults", "/diag_defaults.php"); +$diagnostics[] = array("Halt System", "/halt.php" ); +$diagnostics[] = array("Ping", "/diag_ping.php"); +$diagnostics[] = array("pfTOP", "/diag_system_pftop.php"); +$diagnostics[] = array("Reboot", "/reboot.php"); +$diagnostics[] = array("Routes", "/diag_routes.php"); +$diagnostics[] = array("Show Bogons", "/diag_showbogons.php"); +$diagnostics[] = array("States", "/diag_dump_states.php"); +$diagnostics[] = array("System Activity", "/diag_system_activity.php"); +$diagnostics[] = array("Traceroute", "/diag_traceroute.php"); +$diagnostics[] = array("Packet Capture", "/diag_packet_capture.php"); +if($g['platform'] == "nanobsd") + $diagnostics[] = array("/diag_nanobsd.php", "NanoBSD"); + +if (isset($config['system']['developer'])) { + echo "

  • "; + $diagnostics[] = array("/restart_httpd.php", "Restart HTTPD"); +} +$diagnostics = msort(array_merge($diagnostics, return_ext_menu("Diagnostics")),0); + /* NOTICE ACKNOWLEDGE CODE by Erik Kristensen */ if ($_REQUEST['noticeaction'] == 'acknowledge') { $notice_id = $_REQUEST['noticeid']; @@ -123,30 +257,15 @@ if ($_REQUEST['noticeaction'] == 'acknowledge') {
    System
  • Interfaces
  • @@ -154,24 +273,7 @@ if ($_REQUEST['noticeaction'] == 'acknowledge') {
    Firewall
    @@ -179,27 +281,7 @@ if ($_REQUEST['noticeaction'] == 'acknowledge') {
    Services
    @@ -207,11 +289,7 @@ if ($_REQUEST['noticeaction'] == 'acknowledge') {
    VPN
    @@ -219,39 +297,7 @@ if ($_REQUEST['noticeaction'] == 'acknowledge') {
    Status
    @@ -259,29 +305,7 @@ if ($_REQUEST['noticeaction'] == 'acknowledge') {
    Diagnostics
    @@ -316,7 +340,7 @@ if ($_REQUEST['noticeaction'] == 'acknowledge') { echo ""; } -function output_menu_item($url, $name) { +function add_to_menu($url, $name) { if (isAllowedPage($url)) echo "
  • {$name}
  • \n"; } -- cgit v1.1