summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/widgets/widgets/log.widget.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/local/www/widgets/widgets/log.widget.php')
-rw-r--r--src/usr/local/www/widgets/widgets/log.widget.php148
1 files changed, 91 insertions, 57 deletions
diff --git a/src/usr/local/www/widgets/widgets/log.widget.php b/src/usr/local/www/widgets/widgets/log.widget.php
index 2b051c3..62e5104 100644
--- a/src/usr/local/www/widgets/widgets/log.widget.php
+++ b/src/usr/local/www/widgets/widgets/log.widget.php
@@ -1,37 +1,58 @@
<?php
/*
log.widget.php
- Copyright (C) 2013-2015 Electric Sheep Fencing, LP
-
- Copyright 2007 Scott Dale
- Part of pfSense widgets (https://www.pfsense.org)
- originally based on m0n0wall (http://m0n0.ch/wall)
-
- Copyright (C) 2004-2005 T. Lechat <dev@lechat.org>, Manuel Kasper <mk@neon1.net>
- and Jonathan Watt <jwatt@jwatt.org>.
- 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.
*/
+/* ====================================================================
+ * Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
+ * Copyright (c) 2007 Scott Dale
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgment:
+ * "This product includes software developed by the pfSense Project
+ * for use in the pfSense software distribution. (http://www.pfsense.org/).
+ *
+ * 4. The names "pfSense" and "pfSense Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * coreteam@pfsense.org.
+ *
+ * 5. Products derived from this software may not be called "pfSense"
+ * nor may "pfSense" appear in their names without prior written
+ * permission of the Electric Sheep Fencing, LLC.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ *
+ * "This product includes software developed by the pfSense Project
+ * for use in the pfSense software distribution (http://www.pfsense.org/).
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 pfSense PROJECT OR
+ * ITS CONTRIBUTORS 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.
+ *
+ * ====================================================================
+ *
+ */
$nocsrf = true;
@@ -92,17 +113,21 @@ if (isset($_POST['lastsawtime'])) {
$filterlog = conv_log_filter($filter_logfile, $nentries, $nentries + 20);
foreach ($filterlog as $idx => $row) {
- if (strtotime($log_row['time']) <= $_POST['lastsawtime'])
+ if (strtotime($log_row['time']) <= $_POST['lastsawtime']) {
unset($filterlog[$idx]);
+ }
}
-}
-else
+} else {
$filterlog = conv_log_filter($filter_logfile, $nentries, 50, $filterfieldsarray);
+}
?>
-<script>
+<script type="text/javascript">
+//<![CDATA[
var logWidgetLastRefresh = <?=time()?>;
+//]]>
</script>
+
<table class="table table-striped table-hover">
<thead>
<tr>
@@ -124,28 +149,33 @@ else
$dstIP = htmlspecialchars($filterent['dstip']);
}
- if ($filterent['act'] == "block")
- $iconfn = "remove";
- else if ($filterent['act'] == "reject")
- $iconfn = "fire";
- else if ($filterent['act'] == "match")
+ if ($filterent['act'] == "block") {
+ $iconfn = "times text-danger";
+ } else if ($filterent['act'] == "reject") {
+ $iconfn = "hand-stop-o text-warning";
+ } else if ($filterent['act'] == "match") {
$iconfn = "filter";
- else
- $iconfn = "ok";
+ } else {
+ $iconfn = "check text-success";
+ }
$rule = find_rule_by_number($filterent['rulenum'], $filterent['tracker'], $filterent['act']);
+
+ // Putting <wbr> tags after each ':' allows the string to word-wrap at that point
+ $srcIP = str_replace(':', ':<wbr>', $srcIP);
+ $dstIP = str_replace(':', ':<wbr>', $dstIP);
?>
<tr>
- <td><a <a href="#" onclick="javascript:getURL('diag_logs_filter.php?getrulenum=<?php echo "{$filterent['rulenum']},{$filterent['tracker']},{$filterent['act']}"; ?>', outputrule);"
+ <td><a href="#" onclick="javascript:getURL('status_logs_filter.php?getrulenum=<?php echo "{$filterent['rulenum']},{$filterent['tracker']},{$filterent['act']}"; ?>', outputrule);"
role="button" data-toggle="popover" data-trigger="hover"
data-title="Rule that triggered this action"
data-content="<?=htmlspecialchars($rule)?>"> <i
- class="icon icon-<?=$iconfn?>"></i>
+ class="fa fa-<?=$iconfn?>"></i>
</a></td>
<td title="<?=htmlspecialchars($filterent['time'])?>"><?=substr(htmlspecialchars($filterent['time']),0,-3)?></td>
<td><?=htmlspecialchars($filterent['interface']);?></td>
<td><a href="diag_dns.php?host=<?=$filterent['srcip']?>"
- title="<?=gettext("Reverse Resolve with DNS")?>"><?=$srcIP?></a>:<?=htmlspecialchars($filterent['srcport'])?>
+ title="<?=gettext("Reverse Resolve with DNS");?>"><?=$srcIP?></a>
</td>
<td><a href="diag_dns.php?host=<?=$filterent['dstip']?>"
title="<?=gettext("Reverse Resolve with DNS");?>"><?=$dstIP?></a>:<?=htmlspecialchars($filterent['dstport'])?>
@@ -160,11 +190,13 @@ else
<?php
/* for AJAX response, we only need the panel-body */
-if (isset($_GET['lastsawtime']))
+if (isset($_GET['lastsawtime'])) {
exit;
+}
?>
-<script>
+<script type="text/javascript">
+//<![CDATA[
function logWidgetUpdateFromServer(){
$.ajax({
type: 'get',
@@ -184,11 +216,12 @@ function logWidgetUpdateFromServer(){
events.push(function(){
setInterval('logWidgetUpdateFromServer()', 60*1000);
});
+//]]>
</script>
<!-- close the body we're wrapped in and add a configuration-panel -->
</div>
-<div class="panel-footer collapse">
+<div id="widget-<?=$widgetname?>_panel-footer" class="panel-footer collapse">
<form action="/widgets/widgets/log.widget.php" method="post"
class="form-horizontal">
@@ -196,7 +229,7 @@ events.push(function(){
<label for="filterlogentries" class="col-sm-4 control-label">Number
of entries</label>
<div class="col-sm-6">
- <input type="number" name="filterlogentries" value="<?=$nentries?>"
+ <input type="number" name="filterlogentries" id="filterlogentries" value="<?=$nentries?>"
min="1" max="20" class="form-control" />
</div>
</div>
@@ -206,11 +239,11 @@ events.push(function(){
<div class="col-sm-6 checkbox">
<?php $include_acts = explode(" ", strtolower($nentriesacts)); ?>
<label><input name="actpass" type="checkbox" value="Pass"
- <?=(in_array('pass', $include_acts) ? 'checked="checked"':'')?> />Pass</label>
+ <?=(in_array('pass', $include_acts) ? 'checked':'')?> />Pass</label>
<label><input name="actblock" type="checkbox" value="Block"
- <?=(in_array('block', $include_acts) ? 'checked="checked"':'')?> />Block</label>
+ <?=(in_array('block', $include_acts) ? 'checked':'')?> />Block</label>
<label><input name="actreject" type="checkbox" value="Reject"
- <?=(in_array('reject', $include_acts) ? 'checked="checked"':'')?> />Reject</label>
+ <?=(in_array('reject', $include_acts) ? 'checked':'')?> />Reject</label>
</div>
</div>
@@ -218,10 +251,10 @@ events.push(function(){
<label for="filterlogentriesinterfaces"
class="col-sm-4 control-label">Filter interface</label>
<div class="col-sm-6 checkbox">
- <select name="filterlogentriesinterfaces" class="form-control">
+ <select name="filterlogentriesinterfaces" id="filterlogentriesinterfaces" class="form-control">
<?php foreach (array("All" => "ALL") + get_configured_interface_with_descr() as $iface => $ifacename):?>
<option value="<?=$iface?>"
- <?=($nentriesinterfaces==$iface?'selected="selected"':'')?>><?=htmlspecialchars($ifacename)?></option>
+ <?=($nentriesinterfaces==$iface?'selected':'')?>><?=htmlspecialchars($ifacename)?></option>
<?php endforeach;?>
</select>
</div>
@@ -234,7 +267,8 @@ events.push(function(){
</div>
</form>
-<script>
+<script type="text/javascript">
+//<![CDATA[
if (typeof getURL == 'undefined') {
getURL = function(url, callback) {
if (!url)
@@ -247,7 +281,7 @@ if (typeof getURL == 'undefined') {
throw 'No callback function for getURL';
var http_request = null;
if (typeof XMLHttpRequest != 'undefined') {
- http_request = new XMLHttpRequest();
+ http_request = new XMLHttpRequest();
}
else if (typeof ActiveXObject != 'undefined') {
try {
@@ -275,5 +309,5 @@ if (typeof getURL == 'undefined') {
function outputrule(req) {
alert(req.content);
}
-
-</script> \ No newline at end of file
+//]]>
+</script>
OpenPOWER on IntegriCloud