diff options
-rw-r--r-- | src/usr/local/www/status_logs_common.inc | 16 | ||||
-rw-r--r-- | src/usr/local/www/status_logs_vpn.php | 2 | ||||
-rw-r--r-- | src/usr/local/www/widgets/widgets/gateways.widget.php | 31 |
3 files changed, 28 insertions, 21 deletions
diff --git a/src/usr/local/www/status_logs_common.inc b/src/usr/local/www/status_logs_common.inc index 56bbdd7..f82176c 100644 --- a/src/usr/local/www/status_logs_common.inc +++ b/src/usr/local/www/status_logs_common.inc @@ -92,14 +92,18 @@ function status_logs_common_code() { function tab_array_logs_common() { global $tab_array, $logfile, $vpntype, $view; + $is_system_log = in_array($logfile, array('system', 'gateways', 'routing', 'resolver', 'wireless')); + $is_filter_log = in_array($logfile, array('filter')); + $is_pppoe_l2tp_vpn_log = in_array($logfile, array('poes', 'l2tps', 'vpn')); + $tab_array = array(); - $tab_array[] = array(gettext("System"), ($logfile == 'system'), "status_logs.php"); - $tab_array[] = array(gettext("Firewall"), ($logfile == 'filter'), "status_logs_filter.php"); + $tab_array[] = array(gettext("System"), $is_system_log, "status_logs.php"); + $tab_array[] = array(gettext("Firewall"), $is_filter_log, "status_logs_filter.php"); $tab_array[] = array(gettext("DHCP"), ($logfile == 'dhcpd'), "status_logs.php?logfile=dhcpd"); $tab_array[] = array(gettext("Portal Auth"), ($logfile == 'portalauth'), "status_logs.php?logfile=portalauth"); $tab_array[] = array(gettext("IPsec"), ($logfile == 'ipsec'), "status_logs.php?logfile=ipsec"); $tab_array[] = array(gettext("PPP"), ($logfile == 'ppp'), "status_logs.php?logfile=ppp"); - $tab_array[] = array(gettext("VPN"), ($logfile == 'vpn'), "status_logs_vpn.php"); + $tab_array[] = array(gettext("VPN"), $is_pppoe_l2tp_vpn_log, "status_logs_vpn.php"); $tab_array[] = array(gettext("Load Balancer"), ($logfile == 'relayd'), "status_logs.php?logfile=relayd"); $tab_array[] = array(gettext("OpenVPN"), ($logfile == 'openvpn'), "status_logs.php?logfile=openvpn"); $tab_array[] = array(gettext("NTP"), ($logfile == 'ntpd'), "status_logs.php?logfile=ntpd"); @@ -107,19 +111,19 @@ function tab_array_logs_common() { display_top_tabs($tab_array); $tab_array = array(); - if (in_array($logfile, array('system', 'gateways', 'routing', 'resolver', 'wireless'))) { + if ($is_system_log) { $tab_array[] = array(gettext("General"), ($logfile == 'system'), "/status_logs.php"); $tab_array[] = array(gettext("Gateways"), ($logfile == 'gateways'), "/status_logs.php?logfile=gateways"); $tab_array[] = array(gettext("Routing"), ($logfile == 'routing'), "/status_logs.php?logfile=routing"); $tab_array[] = array(gettext("Resolver"), ($logfile == 'resolver'), "/status_logs.php?logfile=resolver"); $tab_array[] = array(gettext("Wireless"), ($logfile == 'wireless'), "/status_logs.php?logfile=wireless"); } - else if (in_array($logfile, array('filter'))) { + else if ($is_filter_log) { $tab_array[] = array(gettext("Normal View"), ($view == 'normal'), "/status_logs_filter.php"); $tab_array[] = array(gettext("Dynamic View"), ($view == 'dynamic'), "/status_logs_filter_dynamic.php?logfile=filter&view=dynamic"); $tab_array[] = array(gettext("Summary View"), ($view == 'summary'), "/status_logs_filter_summary.php?logfile=filter&view=summary"); } - else if (in_array($logfile, array('poes', 'l2tps', 'vpn'))) { + else if ($is_pppoe_l2tp_vpn_log) { $tab_array[] = array(gettext("PPPoE Logins"), (($logfile == 'vpn') && ($vpntype == "poes")), "/status_logs_vpn.php?logfile=vpn&vpntype=poes"); diff --git a/src/usr/local/www/status_logs_vpn.php b/src/usr/local/www/status_logs_vpn.php index 2f9873d..152af55 100644 --- a/src/usr/local/www/status_logs_vpn.php +++ b/src/usr/local/www/status_logs_vpn.php @@ -114,7 +114,7 @@ if ($filtertext) { $filtertextmeta="?filtertext=$filtertext"; } -$pgtitle = array(gettext("Status"), gettext("System logs"), gettext($allowed_logs[$logfile]["name"])); +$pgtitle = array(gettext("Status"), gettext("System logs"), gettext("VPN"), gettext($allowed_logs[$logfile]["name"])); include("head.inc"); if (!$input_errors && $savemsg) { diff --git a/src/usr/local/www/widgets/widgets/gateways.widget.php b/src/usr/local/www/widgets/widgets/gateways.widget.php index 399a85e..2b9958e 100644 --- a/src/usr/local/www/widgets/widgets/gateways.widget.php +++ b/src/usr/local/www/widgets/widgets/gateways.widget.php @@ -66,7 +66,7 @@ require_once("/usr/local/www/widgets/include/gateways.inc"); // Compose the table contents and pass it back to the ajax caller if ($_REQUEST && $_REQUEST['ajax']) { - compose_table_body_contents(); + print(compose_table_body_contents()); exit; } @@ -94,7 +94,7 @@ if ($_POST) { </thead> <tbody id="gwtblbody"> <?PHP - compose_table_body_contents(); + print(compose_table_body_contents()); ?> </tbody> </table> @@ -167,6 +167,8 @@ if ($_POST) { function compose_table_body_contents() { global $config; + $rtnstr = ''; + $a_gateways = return_gateways_array(); $gateways_status = array(); $gateways_status = return_gateways_status(true); @@ -178,10 +180,10 @@ function compose_table_body_contents() { } foreach ($a_gateways as $gname => $gateway) { - print("<tr>\n"); - print( "<td>\n"); - print(htmlspecialchars($gateway['name']) . "<br />"); - print('<div id="gateway' . $counter . '" style="display:inline"><b>'); + $rtnstr .= "<tr>\n"; + $rtnstr .= "<td>\n"; + $rtnstr .= htmlspecialchars($gateway['name']) . "<br />"; + $rtnstr .= '<div id="gateway' . $counter . '" style="display:inline"><b>'; $monitor_address = ""; $monitor_address_disp = ""; @@ -217,15 +219,15 @@ function compose_table_body_contents() { $monitor_address_disp = ""; } - print($if_gw . $monitor_address_disp); + $rtnstr .= $if_gw . $monitor_address_disp; unset ($if_gw); unset ($monitor_address); unset ($monitor_address_disp); $counter++; - print( "</b>"); - print( "</div>\n"); - print( "</td>\n"); + $rtnstr .= "</b>"; + $rtnstr .= "</div>\n"; + $rtnstr .= "</td>\n"; if ($gateways_status[$gname]) { if (stristr($gateways_status[$gname]['status'], "force_down")) { @@ -252,10 +254,11 @@ function compose_table_body_contents() { $bgcolor = "info"; // lightblue } - print( "<td>" . ($gateways_status[$gname] ? htmlspecialchars($gateways_status[$gname]['delay']) : gettext("Pending")) . "</td>\n"); - print( "<td>" . ($gateways_status[$gname] ? htmlspecialchars($gateways_status[$gname]['loss']) : gettext("Pending")) . "</td>\n"); - print('<td class="bg-' . $bgcolor . '">' . $online . "</td>\n"); - print("</tr>\n"); + $rtnstr .= "<td>" . ($gateways_status[$gname] ? htmlspecialchars($gateways_status[$gname]['delay']) : gettext("Pending")) . "</td>\n"; + $rtnstr .= "<td>" . ($gateways_status[$gname] ? htmlspecialchars($gateways_status[$gname]['loss']) : gettext("Pending")) . "</td>\n"; + $rtnstr .= '<td class="bg-' . $bgcolor . '">' . $online . "</td>\n"; + $rtnstr .= "</tr>\n"; } + return($rtnstr); } ?>
\ No newline at end of file |