Commit 36fea88a authored by Franco Fichtner's avatar Franco Fichtner

logs: tab conversion

Shuffled three of them back to status for the last round of
fire bombing before 15.7.17.  This is not going to be in the
stable version, but I want to have this ready for development
version feedback.  This is so much nicer without the tick
wrapping of tabs and pills and what not...
parent 0528a90a
<menu> <menu>
<User order="0" cssClass="glyphicon glyphicon-user"> <User order="0" cssClass="glyphicon glyphicon-user">
<ChangePassword VisibleName="Change password" url="/system_usermanager_passwordmg.php" cssClass="fa fa-key"/> <ChangePassword VisibleName="Change password" url="/system_usermanager_passwordmg.php" cssClass="fa fa-key"/>
<Logout VisibleName="Logout" url="/index.php?logout" cssClass="fa fa-sign-out"/> <Logout url="/index.php?logout" cssClass="fa fa-sign-out"/>
</User> </User>
<System order="1" VisibleName="System" cssClass="glyphicon glyphicon-dashboard"> <System order="1" VisibleName="System" cssClass="glyphicon glyphicon-dashboard">
<CertificateManager VisibleName="Certificate Manager" cssClass="fa fa-certificate"> <CertificateManager VisibleName="Certificate Manager" cssClass="fa fa-certificate">
...@@ -45,20 +45,12 @@ ...@@ -45,20 +45,12 @@
<Groups url="/status_gateway_groups.php"/> <Groups url="/status_gateway_groups.php"/>
</Status> </Status>
</Gateways> </Gateways>
<LogFiles VisibleName="Log Files" url="/diag_logs.php" cssClass="fa fa-eye"> <LogFiles VisibleName="Log Files" cssClass="fa fa-eye">
<System url="/diag_logs.php"> <General url="/diag_logs.php"/>
<Gateways url="/diag_logs_gateways.php"/> <Gateways url="/diag_logs_gateways.php"/>
<Routing url="/diag_logs_routing.php"/> <Routing url="/diag_logs_routing.php"/>
<Resolver url="/diag_logs_resolver.php"/> <Resolver url="/diag_logs_resolver.php"/>
<Wireless url="/diag_logs_wireless.php"/> <Wireless url="/diag_logs_wireless.php"/>
</System>
<Firewall url="/diag_logs_filter.php">
<DynamicView url="/diag_logs_filter_dynamic.php"/>
<SummaryView url="/diag_logs_filter_summary.php"/>
</Firewall>
<DHCP url="/diag_logs_dhcp.php"/>
<PPP url="/diag_logs_ppp.php"/>
<VPN url="/diag_logs_vpn.php*"/>
</LogFiles> </LogFiles>
<Settings cssClass="fa fa-cogs"> <Settings cssClass="fa fa-cogs">
<General url="/system_general.php"/> <General url="/system_general.php"/>
...@@ -141,6 +133,11 @@ ...@@ -141,6 +133,11 @@
<URLs order="400" url="/firewall_aliases.php?tab=url"/> <URLs order="400" url="/firewall_aliases.php?tab=url"/>
<Import order="500" url="/firewall_aliases_import.php"/> <Import order="500" url="/firewall_aliases_import.php"/>
</Aliases> </Aliases>
<LogFiles VisibleName="Log Files" cssClass="fa fa-eye">
<Normal VisibleName="Normal View" order="100" url="/diag_logs_filter.php"/>
<Dynamic VisibleName="Dynamic View" order="200" url="/diag_logs_filter_dynamic.php"/>
<Summary VisibleName="Summary View" order="300" url="/diag_logs_filter_summary.php"/>
</LogFiles>
<NAT cssClass="fa fa-exchange"> <NAT cssClass="fa fa-exchange">
<PortForward order="100" VisibleName="Port Forward" url="/firewall_nat.php"> <PortForward order="100" VisibleName="Port Forward" url="/firewall_nat.php">
<NatEdit url="/firewall_nat_edit.php*"/> <NatEdit url="/firewall_nat_edit.php*"/>
...@@ -316,6 +313,13 @@ ...@@ -316,6 +313,13 @@
<DHCPv6Leases VisibleName="DHCP IPv6 Leases" url="/status_dhcpv6_leases.php"> <DHCPv6Leases VisibleName="DHCP IPv6 Leases" url="/status_dhcpv6_leases.php">
<DHCPv6LeasesDetails url="/status_dhcpv6_leases.php?*"/> <DHCPv6LeasesDetails url="/status_dhcpv6_leases.php?*"/>
</DHCPv6Leases> </DHCPv6Leases>
<LogFiles VisibleName="Log Files" cssClass="fa fa-eye">
<DHCP url="/diag_logs_dhcp.php"/>
<PPP url="/diag_logs_ppp.php"/>
<VPN url="/diag_logs_vpn.php?vpntype=pptp">
<Type url="/diag_logs_vpn.php*"/>
</VPN>
</LogFiles>
</Status> </Status>
<Help order="8" cssClass="glyphicon glyphicon-question-sign"> <Help order="8" cssClass="glyphicon glyphicon-question-sign">
<AboutThisPage VisibleName="About this Page" url="/help.php" IsExternal="Y"/> <AboutThisPage VisibleName="About this Page" url="/help.php" IsExternal="Y"/>
......
...@@ -44,19 +44,11 @@ if (isset($_POST['clear'])) { ...@@ -44,19 +44,11 @@ if (isset($_POST['clear'])) {
clear_clog($system_logfile); clear_clog($system_logfile);
} }
if ($_GET['filtertext']) { if (isset($_POST['filtertext'])) {
$filtertext = htmlspecialchars($_GET['filtertext']);
}
if ($_POST['filtertext']) {
$filtertext = htmlspecialchars($_POST['filtertext']); $filtertext = htmlspecialchars($_POST['filtertext']);
} }
if ($filtertext) { $pgtitle = array(gettext('System'), gettext('Log Files'), gettext('General'));
$filtertextmeta = "?filtertext={$filtertext}";
}
$pgtitle = array(gettext("Status"),gettext("System logs"),gettext("General"));
include("head.inc"); include("head.inc");
?> ?>
...@@ -73,39 +65,31 @@ include("head.inc"); ...@@ -73,39 +65,31 @@ include("head.inc");
<section class="col-xs-12"> <section class="col-xs-12">
<? include('diag_logs_tabs.inc'); ?>
<div class="tab-content content-box col-xs-12"> <div class="tab-content content-box col-xs-12">
<div class="container-fluid">
<? include('diag_logs_pills.inc'); ?>
</div>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-sort"> <table class="table table-striped table-sort">
<tr><td colspan="2">
<form id="clearform" name="clearform" action="diag_logs.php" method="post" class="__mt">
<input id="filtertext" name="filtertext" value="<?=$filtertext;?>" />
<input id="filtersubmit" name="filtersubmit" type="submit" class="btn btn-primary" value="<?=gettext("Filter");?>" />
</form>
</td></tr>
<?php <?php
if ($filtertext) { if (isset($filtertext)) {
dump_clog($system_logfile, $nentries, true, array("$filtertext"), array("ppp")); dump_clog($system_logfile, $nentries, true, array("$filtertext"), array("ppp"));
} else { } else {
dump_clog($system_logfile, $nentries, true, array(), array("ppp")); dump_clog($system_logfile, $nentries, true, array(), array("ppp"));
} }
?> ?>
</table> <tr><td colspan="2">
</div>
<div class="container-fluid">
<form action="diag_logs.php" method="post"> <form action="diag_logs.php" method="post">
<input name="clear" type="submit" class="btn btn-default" value="<?= gettext("Clear log");?>" /> <input name="clear" type="submit" class="btn btn-default" value="<?= gettext("Clear log");?>" />
</form> </form>
</td></tr>
<form id="clearform" name="clearform" action="diag_logs.php" method="post" class="__mt"> </table>
<input id="filtertext" name="filtertext" value="<?=$filtertext;?>" /> </div>
<input id="filtersubmit" name="filtersubmit" type="submit" class="btn btn-primary" value="<?=gettext("Filter");?>" />
</form>
</div>
</div> </div>
</div> </div>
......
...@@ -64,27 +64,19 @@ include("head.inc"); ...@@ -64,27 +64,19 @@ include("head.inc");
<section class="col-xs-12"> <section class="col-xs-12">
<? include('diag_logs_tabs.inc'); ?>
<div class="tab-content content-box col-xs-12"> <div class="tab-content content-box col-xs-12">
<div class="container-fluid">
<?php printf(gettext('Last %s DHCP service log entries'), $nentries); ?>
</div>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-sort"> <table class="table table-striped table-sort">
<tr><td colspan="2"><?= sprintf(gettext('Last %s DHCP service log entries'), $nentries); ?></strong></td><tr>
<?php dump_clog($dhcpd_logfile, $nentries, true); ?> <?php dump_clog($dhcpd_logfile, $nentries, true); ?>
<tr><td colspan="2">
<form action="diag_logs_dhcp.php" method="post">
<input name="clear" type="submit" class="btn" value="<?= gettext("Clear log");?>" />
</form>
</td><tr>
<tr><td colspan="2">NOTE: Clearing the log file will restart the DHCP daemon.</td></tr>
</table> </table>
</div> </div>
<div class="container-fluid">
<form action="diag_logs_dhcp.php" method="post">
<input name="clear" type="submit" class="btn" value="<?= gettext("Clear log");?>" />
</form>
<p>NOTE: Clearing the log file will restart the DHCP daemon.</p>
</div>
</div> </div>
</section> </section>
</div> </div>
......
...@@ -590,7 +590,7 @@ if (isset($_POST['clear'])) { ...@@ -590,7 +590,7 @@ if (isset($_POST['clear'])) {
clear_clog($filter_logfile); clear_clog($filter_logfile);
} }
$pgtitle = array(gettext("Status"),gettext("System logs"),gettext("Firewall")); $pgtitle = array(gettext('Firewall'), gettext('Log Files'), gettext('Normal View'));
$shortcut_section = "firewall"; $shortcut_section = "firewall";
include("head.inc"); include("head.inc");
...@@ -609,15 +609,7 @@ include("head.inc"); ...@@ -609,15 +609,7 @@ include("head.inc");
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?> <?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<section class="col-xs-12"> <section class="col-xs-12">
<? $active_tab = "/diag_logs_filter.php"; include('diag_logs_tabs.inc'); ?>
<div class="tab-content content-box col-xs-12"> <div class="tab-content content-box col-xs-12">
<div class="container-fluid">
<? $tab_group = 'firewall'; include('diag_logs_pills.inc'); ?>
<form id="filterlogentries" name="filterlogentries" action="diag_logs_filter.php" method="post"> <form id="filterlogentries" name="filterlogentries" action="diag_logs_filter.php" method="post">
<?php <?php
$Include_Act = explode(",", str_replace(" ", ",", $filterfieldsarray['act'])); $Include_Act = explode(",", str_replace(" ", ",", $filterfieldsarray['act']));
...@@ -671,21 +663,25 @@ include("head.inc"); ...@@ -671,21 +663,25 @@ include("head.inc");
</td> </td>
</tr> </tr>
<tr> <tr>
<td></td><td></td><td></td><td></td><td></td> <td colspan="6">
<td><input id="filtersubmit" name="filtersubmit" type="submit" class="btn btn-primary" style="vertical-align:top;" value="<?=gettext("Filter");?>" /></td> <span class="vexpl"><a href="http://en.wikipedia.org/wiki/Transmission_Control_Protocol">TCP Flags</a>: F - FIN, S - SYN, A or . - ACK, R - RST, P - PSH, U - URG, E - ECE, W - CWR</span>
</td>
</tr>
<tr>
<td colspan="6">
<input id="filtersubmit" name="filtersubmit" type="submit" class="btn btn-primary" style="vertical-align:top;" value="<?=gettext("Filter");?>" />
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</form> </form>
</div>
</div> </div>
</section> </section>
<section class="col-xs-12"> <section class="col-xs-12">
<div class="tab-content content-box col-xs-12"> <div class="tab-content content-box col-xs-12">
<div class="container-fluid">
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-sort"> <table class="table table-striped table-sort">
...@@ -703,11 +699,12 @@ include("head.inc"); ...@@ -703,11 +699,12 @@ include("head.inc");
?> ?>
<tr> <tr>
<td colspan="<?=isset($config['syslog']['filterdescriptions']) && $config['syslog']['filterdescriptions']==="1"?7:6?>" class="listtopic"> <td colspan="<?=isset($config['syslog']['filterdescriptions']) && $config['syslog']['filterdescriptions']==="1"?7:6?>" class="listtopic">
<strong>
<?php if ( (!$filtertext) && (!$filterfieldsarray) ) <?php if ( (!$filtertext) && (!$filterfieldsarray) )
printf(gettext("Last %s firewall log entries."),count($filterlog)); printf(gettext("Last %s firewall log entries."),count($filterlog));
else else
echo count($filterlog). ' ' . gettext("matched log entries."); echo sprintf(gettext('Showing %s matching log entries (maximum is %s).'), count($filterlog), $nentries);?>
printf(gettext("Max(%s)"),$nentries);?> </strong>
</td> </td>
</tr> </tr>
<tr class="sortableHeaderRowIdentifier"> <tr class="sortableHeaderRowIdentifier">
...@@ -810,7 +807,7 @@ include("head.inc"); ...@@ -810,7 +807,7 @@ include("head.inc");
<?php else: ?> <?php else: ?>
<tr> <tr>
<td colspan="2" class="listtopic"> <td colspan="2" class="listtopic">
<?php printf(gettext("Last %s firewall log entries"),$nentries);?></td> <strong><?php printf(gettext("Last %s firewall log entries"),$nentries);?></strong></td>
</tr> </tr>
<?php <?php
if($filtertext) if($filtertext)
...@@ -818,6 +815,11 @@ include("head.inc"); ...@@ -818,6 +815,11 @@ include("head.inc");
else else
dump_clog($filter_logfile, $nentries); dump_clog($filter_logfile, $nentries);
?> ?>
<tr><td colspan="2">
<form id="clearform" name="clearform" action="diag_logs_filter.php" method="post" style="margin-top: 14px;">
<input id="submit" name="clear" type="submit" class="btn btn-primary" value="<?=gettext("Clear log");?>" />
</form>
</td></tr>
<?php endif; ?> <?php endif; ?>
</table> </table>
...@@ -825,16 +827,6 @@ include("head.inc"); ...@@ -825,16 +827,6 @@ include("head.inc");
</td> </td>
</tr> </tr>
</table> </table>
<form id="clearform" name="clearform" action="diag_logs_filter.php" method="post" style="margin-top: 14px;">
<input id="submit" name="clear" type="submit" class="btn btn-primary" value="<?=gettext("Clear log");?>" />
</form>
<p><span class="vexpl"><a href="http://en.wikipedia.org/wiki/Transmission_Control_Protocol">TCP Flags</a>: F - FIN, S - SYN, A or . - ACK, R - RST, P - PSH, U - URG, E - ECE, W - CWR</span></p>
</div>
</div> </div>
</section> </section>
</div> </div>
......
...@@ -47,7 +47,7 @@ if (isset($_POST['clear'])) { ...@@ -47,7 +47,7 @@ if (isset($_POST['clear'])) {
$filterlog = conv_log_filter($filter_logfile, $nentries, $nentries + 100); $filterlog = conv_log_filter($filter_logfile, $nentries, $nentries + 100);
$pgtitle = array(gettext("Status"),gettext("System logs"),gettext("Firewall (Dynamic View)")); $pgtitle = array(gettext('Firewall'), gettext('Log Files'), gettext('Dynamic View'));
$shortcut_section = "firewall"; $shortcut_section = "firewall";
include("head.inc"); include("head.inc");
...@@ -91,22 +91,19 @@ include("head.inc"); ...@@ -91,22 +91,19 @@ include("head.inc");
<section class="col-xs-12"> <section class="col-xs-12">
<? $active_tab = "/diag_logs_filter.php"; include('diag_logs_tabs.inc'); ?>
<div class="tab-content content-box col-xs-12"> <div class="tab-content content-box col-xs-12">
<div class="container-fluid">
<? $tab_group = 'firewall'; include('diag_logs_pills.inc'); ?>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-sort"> <table class="table table-striped table-sort">
<thead> <thead>
<tr> <tr>
<td colspan="6" class="listtopic"> <td colspan="6" class="listtopic">
<?php printf(gettext("Last %s records"),$nentries);?>. &nbsp;&nbsp;&nbsp;<input type="checkbox" onclick="javascript:toggle_pause();" />&nbsp;<?=gettext("Pause");?> <strong><?php printf(gettext("Showing last %s records."),$nentries);?></strong>
</td>
</tr>
<tr>
<td colspan="6" class="listtopic">
<input type="checkbox" onclick="javascript:toggle_pause();" />&nbsp;<?=gettext("Pause");?>
</td> </td>
</tr> </tr>
<tr> <tr>
...@@ -156,9 +153,6 @@ include("head.inc"); ...@@ -156,9 +153,6 @@ include("head.inc");
<tr style="display:none;"><td></td></tr> <tr style="display:none;"><td></td></tr>
</tbody> </tbody>
</table> </table>
</div>
<p><span class="vexpl"><a href="http://en.wikipedia.org/wiki/Transmission_Control_Protocol"><?=gettext("TCP Flags"); ?></a>: F - FIN, S - SYN, A or . - ACK, R - RST, P - PSH, U - URG, E - ECE, C - CWR</span></p></div>
</div> </div>
</section> </section>
</div> </div>
......
...@@ -27,8 +27,9 @@ ...@@ -27,8 +27,9 @@
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
$pgtitle = gettext("Status").": ".gettext("System logs").": ".gettext("Firewall Log Summary"); $pgtitle = array(gettext('Firewall'), gettext('Log Files'), gettext('Summary View'));
$shortcut_section = "firewall"; $shortcut_section = "firewall";
require_once("guiconfig.inc"); require_once("guiconfig.inc");
require_once("filter_log.inc"); require_once("filter_log.inc");
require_once("interfaces.inc"); require_once("interfaces.inc");
...@@ -115,11 +116,14 @@ include("head.inc"); ?> ...@@ -115,11 +116,14 @@ include("head.inc"); ?>
<div class="row"> <div class="row">
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?> <?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<section class="col-xs-12"> <section class="col-xs-12">
<? $active_tab = "/diag_logs_filter.php"; include('diag_logs_tabs.inc'); ?>
<div class="tab-content content-box col-xs-12"> <div class="tab-content content-box col-xs-12">
<div class="container-fluid"> <div class="table-responsive">
<? $tab_group = 'firewall'; include('diag_logs_pills.inc'); ?> <table class="table table-striped table-sort">
<p><?php printf (gettext('This is a firewall log summary, of the last %1$s lines of the firewall log (Max %2$s).'), $gotlines, $lines)?><br /></p> <tr>
<td>
<strong><?= sprintf(gettext('The following summaries have been collected from the last %s lines of the firewall log (maximum is %s).'), $gotlines, $lines)?></strong>
</tr></td>
</table>
</div> </div>
</div> </div>
</section> </section>
......
...@@ -46,19 +46,11 @@ if ($_POST['clear']) { ...@@ -46,19 +46,11 @@ if ($_POST['clear']) {
clear_clog($system_logfile); clear_clog($system_logfile);
} }
if ($_GET['filtertext']) { if (isset($_POST['filtertext'])) {
$filtertext = htmlspecialchars($_GET['filtertext']);
}
if ($_POST['filtertext']) {
$filtertext = htmlspecialchars($_POST['filtertext']); $filtertext = htmlspecialchars($_POST['filtertext']);
} }
if ($filtertext) { $pgtitle = array(gettext('System'), gettext('Log Files'), gettext('Gateways'));
$filtertextmeta = "?filtertext={$filtertext}";
}
$pgtitle = array(gettext("Status"),gettext("System logs"),gettext("Gateways"));
$shortcut_section = "gateways"; $shortcut_section = "gateways";
include("head.inc"); include("head.inc");
...@@ -75,38 +67,30 @@ include("head.inc"); ...@@ -75,38 +67,30 @@ include("head.inc");
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?> <?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<section class="col-xs-12"> <section class="col-xs-12">
<? $active_tab = "/diag_logs.php"; include('diag_logs_tabs.inc'); ?>
<div class="tab-content content-box col-xs-12"> <div class="tab-content content-box col-xs-12">
<div class="container-fluid">
<? include('diag_logs_pills.inc'); ?>
</div>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-sort"> <table class="table table-striped table-sort">
<tr><td colspan="2">
<form id="clearform" name="clearform" action="diag_logs_gateways.php" method="post" class="__mt">
<input id="filtertext" name="filtertext" value="<?=$filtertext;?>"/>
<input id="filtersubmit" name="filtersubmit" type="submit" class="btn btn-primary" value="<?=gettext("Filter");?>" />
</form>
</td></tr>
<?php <?php
if($filtertext) if (isset($filtertext))
dump_clog($system_logfile, $nentries, true, array("$filtertext")); dump_clog($system_logfile, $nentries, true, array("$filtertext"));
else else
dump_clog($system_logfile, $nentries, true, array()); dump_clog($system_logfile, $nentries, true, array());
?> ?>
</table> <tr><td colspan="2">
</div>
<div class="container-fluid">
<form action="diag_logs_gateways.php" method="post"> <form action="diag_logs_gateways.php" method="post">
<input name="clear" type="submit" class="btn" value="<?= gettext("Clear log");?>" /> <input name="clear" type="submit" class="btn" value="<?= gettext("Clear log");?>" />
</form> </form>
<form id="clearform" name="clearform" action="diag_logs_gateways.php" method="post" class="__mt"> </td></tr>
<input id="filtertext" name="filtertext" value="<?=$filtertext;?>" type="text" class="pull-left __mr"/>
<input id="filtersubmit" name="filtersubmit" type="submit" class="btn btn-primary" value="<?=gettext("Filter");?>" /> </table>
</form> </div>
</div>
</div> </div>
</div> </div>
......
...@@ -36,19 +36,9 @@ if ($tab_group == 'vpn') { ...@@ -36,19 +36,9 @@ if ($tab_group == 'vpn') {
$tab_array[] = array(gettext("PPPoE Raw"), (($vpntype == "poes") && ($mode == "raw")), "/diag_logs_vpn.php?vpntype=poes&amp;mode=raw"); $tab_array[] = array(gettext("PPPoE Raw"), (($vpntype == "poes") && ($mode == "raw")), "/diag_logs_vpn.php?vpntype=poes&amp;mode=raw");
$tab_array[] = array(gettext("L2TP Logins"), (($vpntype == "l2tp") && ($mode != "raw")), "/diag_logs_vpn.php?vpntype=l2tp"); $tab_array[] = array(gettext("L2TP Logins"), (($vpntype == "l2tp") && ($mode != "raw")), "/diag_logs_vpn.php?vpntype=l2tp");
$tab_array[] = array(gettext("L2TP Raw"), (($vpntype == "l2tp") && ($mode == "raw")), "/diag_logs_vpn.php?vpntype=l2tp&amp;mode=raw"); $tab_array[] = array(gettext("L2TP Raw"), (($vpntype == "l2tp") && ($mode == "raw")), "/diag_logs_vpn.php?vpntype=l2tp&amp;mode=raw");
} elseif ($tab_group == 'firewall') { } else {
$tab_array[] = array(gettext("Normal View"), true, "/diag_logs_filter.php");
$tab_array[] = array(gettext("Dynamic View"), false, "/diag_logs_filter_dynamic.php");
$tab_array[] = array(gettext("Summary View"), false, "/diag_logs_filter_summary.php");
} elseif ($tab_group == 'proxy') {
$tab_array[] = array(gettext('Cache'), true, '/diag_logs_proxy.php?type=cache'); $tab_array[] = array(gettext('Cache'), true, '/diag_logs_proxy.php?type=cache');
$tab_array[] = array(gettext('Access'), false, '/diag_logs_proxy.php?type=access'); $tab_array[] = array(gettext('Access'), false, '/diag_logs_proxy.php?type=access');
} else {
$tab_array[] = array(gettext("General"), true, "/diag_logs.php");
$tab_array[] = array(gettext("Gateways"), false, "/diag_logs_gateways.php");
$tab_array[] = array(gettext("Routing"), false, "/diag_logs_routing.php");
$tab_array[] = array(gettext("Resolver"), false, "/diag_logs_resolver.php");
$tab_array[] = array(gettext("Wireless"), false, "/diag_logs_wireless.php");
} }
?><ul class="nav nav-pills" role="tablist"> ?><ul class="nav nav-pills" role="tablist">
......
...@@ -60,27 +60,21 @@ include("head.inc"); ...@@ -60,27 +60,21 @@ include("head.inc");
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?> <?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<section class="col-xs-12"> <section class="col-xs-12">
<? include('diag_logs_tabs.inc'); ?>
<div class="tab-content content-box col-xs-12"> <div class="tab-content content-box col-xs-12">
<div class="container-fluid">
<p> <?php printf(gettext("Last %s PPP log entries"),$nentries);?></p>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-sort"> <table class="table table-striped table-sort">
<tr><td colspan="2"><?= sprintf(gettext("Last %s PPP log entries"),$nentries);?></strong></td></tr>
<?php dump_clog($ppps_logfile, $nentries); ?> <?php dump_clog($ppps_logfile, $nentries); ?>
<tr><td colspan="2">
<form action="diag_logs_ppp.php" method="post">
<input name="clear" type="submit" class="btn" value="<?= gettext("Clear log");?>" />
</form>
</td></tr>
</table> </table>
</div> </div>
<form action="diag_logs_ppp.php" method="post">
<input name="clear" type="submit" class="btn" value="<?= gettext("Clear log");?>" />
</form>
</div>
</div> </div>
</section> </section>
</div> </div>
......
...@@ -46,19 +46,11 @@ if ($_POST['clear']) { ...@@ -46,19 +46,11 @@ if ($_POST['clear']) {
clear_clog($system_logfile); clear_clog($system_logfile);
} }
if ($_GET['filtertext']) { if (isset($_POST['filtertext'])) {
$filtertext = htmlspecialchars($_GET['filtertext']);
}
if ($_POST['filtertext']) {
$filtertext = htmlspecialchars($_POST['filtertext']); $filtertext = htmlspecialchars($_POST['filtertext']);
} }
if ($filtertext) { $pgtitle = array(gettext('System'), gettext('Log Files'), gettext('Resolver'));
$filtertextmeta = "?filtertext={$filtertext}";
}
$pgtitle = array(gettext("Status"),gettext("System logs"),gettext("Resolver"));
$shortcut_section = "resolver"; $shortcut_section = "resolver";
include("head.inc"); include("head.inc");
...@@ -75,38 +67,30 @@ include("head.inc"); ...@@ -75,38 +67,30 @@ include("head.inc");
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?> <?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<section class="col-xs-12"> <section class="col-xs-12">
<? $active_tab = "/diag_logs.php"; include('diag_logs_tabs.inc'); ?>
<div class="tab-content content-box col-xs-12"> <div class="tab-content content-box col-xs-12">
<div class="container-fluid">
<? include('diag_logs_pills.inc'); ?>
</div>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-sort"> <table class="table table-striped table-sort">
<tr><td colspan="2">
<form id="clearform" name="clearform" action="diag_logs_resolver.php" method="post" class="__mt">
<input id="filtertext" name="filtertext" value="<?=$filtertext;?>" />
<input id="filtersubmit" name="filtersubmit" type="submit" class="btn btn-primary" value="<?=gettext("Filter");?>" />
</form>
</td></tr>
<?php <?php
if($filtertext) if (isset($filtertext))
dump_clog($system_logfile, $nentries, true, array("$filtertext"), array("ppp")); dump_clog($system_logfile, $nentries, true, array("$filtertext"), array("ppp"));
else else
dump_clog($system_logfile, $nentries, true, array(), array("ppp")); dump_clog($system_logfile, $nentries, true, array(), array("ppp"));
?> ?>
</table> <tr><td colspan="2">
</div>
<div class="container-fluid">
<form action="diag_logs_resolver.php" method="post"> <form action="diag_logs_resolver.php" method="post">
<input name="clear" type="submit" class="btn" value="<?= gettext("Clear log");?>" /> <input name="clear" type="submit" class="btn" value="<?= gettext("Clear log");?>" />
</form> </form>
</td></tr>
</table>
</div>
<form id="clearform" name="clearform" action="diag_logs_resolver.php" method="post" class="__mt">
<input id="filtertext" name="filtertext" value="<?=$filtertext;?>" type="text" class="pull-left __mr" />
<input id="filtersubmit" name="filtersubmit" type="submit" class="btn btn-primary" value="<?=gettext("Filter");?>" />
</form>
</div>
</div> </div>
</section> </section>
</div> </div>
......
...@@ -43,7 +43,11 @@ if ($_POST['clear']) { ...@@ -43,7 +43,11 @@ if ($_POST['clear']) {
clear_clog($routing_logfile); clear_clog($routing_logfile);
} }
$pgtitle = array(gettext("Status"),gettext("System logs"),gettext("Routing")); if (isset($_POST['filtertext'])) {
$filtertext = htmlspecialchars($_POST['filtertext']);
}
$pgtitle = array(gettext('System'), gettext('Log Files'), gettext('Routing'));
$shortcut_section = "routing"; $shortcut_section = "routing";
include("head.inc"); include("head.inc");
...@@ -61,26 +65,31 @@ include("head.inc"); ...@@ -61,26 +65,31 @@ include("head.inc");
<section class="col-xs-12"> <section class="col-xs-12">
<? $active_tab = "/diag_logs.php"; include('diag_logs_tabs.inc'); ?>
<div class="tab-content content-box col-xs-12"> <div class="tab-content content-box col-xs-12">
<div class="container-fluid">
<? include('diag_logs_pills.inc'); ?>
</div>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-sort"> <table class="table table-striped table-sort">
<?php dump_clog($routing_logfile, $nentries); ?> <tr><td colspan="2">
</table> <form id="clearform" name="clearform" action="diag_logs_routing.php" method="post" class="__mt">
</div> <input id="filtertext" name="filtertext" value="<?=$filtertext;?>"/>
<div class="container-fluid"> <input id="filtersubmit" name="filtersubmit" type="submit" class="btn btn-primary" value="<?=gettext("Filter");?>" />
</form>
</td></tr>
<?php
if (isset($filtertext))
dump_clog($routing_logfile, $nentries, true, array("$filtertext"));
else
dump_clog($routing_logfile, $nentries, true, array());
?>
<tr><td colspan="2">
<form action="diag_logs_routing.php" method="post"> <form action="diag_logs_routing.php" method="post">
<input name="clear" type="submit" class="btn" value="<?= gettext("Clear log");?>" /> <input name="clear" type="submit" class="btn" value="<?= gettext("Clear log");?>" />
</form> </form>
</td></tr>
</table>
</div>
</div>
</div> </div>
</section> </section>
</div> </div>
......
<?php
/*
Copyright (C) 2014 Deciso B.V.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
$active_tab = isset($active_tab) ? $active_tab : $_SERVER['PHP_SELF'];
$tab_array = array();
$tab_array[] = array(gettext("System"), $active_tab == "/diag_logs.php", "diag_logs.php");
$tab_array[] = array(gettext("Firewall"), $active_tab == "/diag_logs_filter.php", "diag_logs_filter.php");
$tab_array[] = array(gettext("DHCP"), $active_tab == "/diag_logs_dhcp.php", "diag_logs_dhcp.php");
$tab_array[] = array(gettext("PPP"), $active_tab == "/diag_logs_ppp.php", "diag_logs_ppp.php");
$tab_array[] = array(gettext("VPN"), $active_tab == "/diag_logs_vpn.php", "diag_logs_vpn.php");
display_top_tabs($tab_array);
...@@ -119,17 +119,12 @@ include("head.inc"); ...@@ -119,17 +119,12 @@ include("head.inc");
<section class="col-xs-12"> <section class="col-xs-12">
<? $active_tab = "/diag_logs_vpn.php"; include('diag_logs_tabs.inc'); ?>
<div class="tab-content content-box col-xs-12"> <div class="tab-content content-box col-xs-12">
<div class="container-fluid">
<? $tab_group = 'vpn'; include('diag_logs_pills.inc'); ?>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-sort"> <table class="table table-striped table-sort">
<tr><td colspan="4"><? $tab_group = 'vpn'; include('diag_logs_pills.inc'); ?></td></tr>
<?php if ($mode != "raw"): ?> <?php if ($mode != "raw"): ?>
<tr> <tr>
<td class="listhdrr"><?=gettext("Time");?></td> <td class="listhdrr"><?=gettext("Time");?></td>
...@@ -141,17 +136,17 @@ include("head.inc"); ...@@ -141,17 +136,17 @@ include("head.inc");
<?php else: <?php else:
dump_clog("/var/log/{$logname}.log", $nentries); dump_clog("/var/log/{$logname}.log", $nentries);
endif; ?> endif; ?>
</table> <tr><td colspan="4">
</div>
<form action="diag_logs_vpn.php" method="post"> <form action="diag_logs_vpn.php" method="post">
<input type="hidden" name="vpntype" id="vpntype" value="<?=$vpntype;?>" /> <input type="hidden" name="vpntype" id="vpntype" value="<?=$vpntype;?>" />
<input type="hidden" name="mode" id="mode" value="<?=$mode;?>" /> <input type="hidden" name="mode" id="mode" value="<?=$mode;?>" />
<input name="clear" type="submit" class="btn" value="<?= gettext("Clear log");?>" /> <input name="clear" type="submit" class="btn" value="<?= gettext("Clear log");?>" />
</form> </form>
</td></tr>
</table>
</div>
</div>
</div> </div>
</section> </section>
</div> </div>
......
...@@ -45,7 +45,11 @@ if ($_POST['clear']) { ...@@ -45,7 +45,11 @@ if ($_POST['clear']) {
clear_clog($wireless_logfile); clear_clog($wireless_logfile);
} }
$pgtitle = array(gettext("Status"),gettext("System logs"),gettext("Wireless")); if (isset($_POST['filtertext'])) {
$filtertext = htmlspecialchars($_POST['filtertext']);
}
$pgtitle = array(gettext('System'),gettext('Log Files'),gettext('Wireless'));
include("head.inc"); include("head.inc");
...@@ -62,28 +66,30 @@ include("head.inc"); ...@@ -62,28 +66,30 @@ include("head.inc");
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?> <?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<section class="col-xs-12"> <section class="col-xs-12">
<? $active_tab = "/diag_logs.php"; include('diag_logs_tabs.inc'); ?>
<div class="tab-content content-box col-xs-12"> <div class="tab-content content-box col-xs-12">
<div class="container-fluid">
<? include('diag_logs_pills.inc'); ?>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-sort"> <table class="table table-striped table-sort">
<?php dump_clog($wireless_logfile, $nentries); ?> <tr><td colspan="2">
<form id="clearform" name="clearform" action="diag_logs_wireless.php" method="post" class="__mt">
<input id="filtertext" name="filtertext" value="<?=$filtertext;?>"/>
<input id="filtersubmit" name="filtersubmit" type="submit" class="btn btn-primary" value="<?=gettext("Filter");?>" />
</form>
</td></tr>
<?php
if (isset($filtertext))
dump_clog($wireless_logfile, $nentries, true, array("$filtertext"));
else
dump_clog($wireless_logfile, $nentries, true, array());
?>
<tr><td colspan="2">
<form action="diag_logs_wireless.php" method="post">
<input name="clear" type="submit" class="btn" value="<?= gettext("Clear log");?>" />
</form>
</td></tr>
</table> </table>
</div> </div>
<form action="diag_logs_wireless.php" method="post">
<input name="clear" type="submit" class="btn" value="<?= gettext("Clear log");?>" />
</form>
</div>
</div> </div>
</section> </section>
</div> </div>
......
...@@ -425,7 +425,7 @@ function dump_clog($logfile, $tail, $withorig = true, $grepfor = '', $grepinvert ...@@ -425,7 +425,7 @@ function dump_clog($logfile, $tail, $withorig = true, $grepfor = '', $grepinvert
} }
if (!count($logarr)) { if (!count($logarr)) {
$logarr[] = sprintf(gettext('File %s is empty.'), $logfile); $logarr[] = sprintf(gettext('File %s yielded no results.'), $logfile);
} }
print_dump($logarr, $withorig); print_dump($logarr, $withorig);
...@@ -456,7 +456,7 @@ function dump_log($logfile, $tail, $withorig = true, $grepfor = '', $grepinvert ...@@ -456,7 +456,7 @@ function dump_log($logfile, $tail, $withorig = true, $grepfor = '', $grepinvert
} }
if (!count($logarr)) { if (!count($logarr)) {
$logarr[] = sprintf(gettext('File %s is empty.'), $logfile); $logarr[] = sprintf(gettext('File %s yielded no results.'), $logfile);
} }
print_dump($logarr, $withorig); print_dump($logarr, $withorig);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment