diff options
author | Sjon Hortensius <sjon@hortensius.net> | 2015-01-17 17:16:36 +0100 |
---|---|---|
committer | Sjon Hortensius <sjon@hortensius.net> | 2015-01-17 17:16:36 +0100 |
commit | 69b397ddbe64ca496ce623cf6ba85ec98a244777 (patch) | |
tree | 9c33cd8b803e2b4f34c2ba06657876370e1855e4 /usr | |
parent | a42e7aa249d21d1a8bfbf70a27c903b18283c6dd (diff) | |
download | pfsense-69b397ddbe64ca496ce623cf6ba85ec98a244777.zip pfsense-69b397ddbe64ca496ce623cf6ba85ec98a244777.tar.gz |
updated firewall WIP, fixed widget ordering
* ipsec - replaced manual panel with simple alert
Diffstat (limited to 'usr')
-rw-r--r-- | usr/local/www/firewall_rules.php | 23 | ||||
-rw-r--r-- | usr/local/www/index.php | 8 | ||||
-rw-r--r-- | usr/local/www/jquery/pfSense.js | 4 | ||||
-rw-r--r-- | usr/local/www/widgets/widgets/ipsec.widget.php | 6 | ||||
-rw-r--r-- | usr/local/www/widgets/widgets/log.widget.php | 195 | ||||
-rw-r--r-- | usr/local/www/widgets/widgets/picture.widget.php | 3 | ||||
-rw-r--r-- | usr/local/www/widgets/widgets/services_status.widget.php | 6 |
7 files changed, 120 insertions, 125 deletions
diff --git a/usr/local/www/firewall_rules.php b/usr/local/www/firewall_rules.php index 6f93db9..a3e720e 100644 --- a/usr/local/www/firewall_rules.php +++ b/usr/local/www/firewall_rules.php @@ -340,7 +340,7 @@ display_top_tabs($tab_array); ?> <tr id="antilockout"> <td></td> - <td title="<?=gettext("This rule passes traffic")?>"><i class="icon icon-ok"></i></td> + <td title="<?=gettext("traffic is passed")?>"><i class="icon icon-ok"></i></td> <td></td> <?php pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_id_tr_antilockout"); @@ -363,7 +363,7 @@ display_top_tabs($tab_array); <?php if (isset($config['interfaces'][$if]['blockpriv'])): ?> <tr id="frrfc1918"> <td></td> - <td title="<?=gettext("This rule blocks traffic")?>"><i class="icon icon-remove"></i></td> + <td title="<?=gettext("traffic is blocked")?>"><i class="icon icon-remove"></i></td> <td></td> <td>*</td> <td><?=gettext("RFC 1918 networks");?></td> @@ -382,7 +382,7 @@ display_top_tabs($tab_array); <?php if (isset($config['interfaces'][$if]['blockbogons'])): ?> <tr id="frrfc1918"> <td></td> - <td title="<?=gettext("This rule blocks traffic")?>"><i class="icon icon-remove"></i></td> + <td title="<?=gettext("traffic is blocked")?>"><i class="icon icon-remove"></i></td> <td></td> <td>*</td> <td><?=gettext("Reserved/not assigned by IANA");?></td> @@ -413,7 +413,7 @@ display_top_tabs($tab_array); <td> <input type="checkbox" id="frc<?=$i?>" name="rule[]" value="<?=$i?>" /> </td> - <td> + <td title="<?=gettext("traffic is ").$filterent['type']."ed"?>"> <?php if ($filterent['type'] == "block") $iconfn = "remove"; @@ -424,19 +424,15 @@ display_top_tabs($tab_array); else $iconfn = "ok"; ?> - <a href="?if=<?=htmlspecialchars($if);?>&act=toggle&id=<?=$i;?>" title="Toggle"> - <i class="icon icon-<?=$iconfn?>"></i> - </a> + <i class="icon icon-<?=$iconfn?>"></i> <?php $isadvset = firewall_check_for_advanced_options($filterent); - if($isadvset) - print '<i class="icon icon-cog" title="'. gettext("advanced settings set") .': '. $isadvset .'"></i>'; + if ($isadvset) + print '<i class="icon icon-cog" title="'. gettext("advanced setting") .': '. $isadvset .'"></i>'; - if (isset($filterent['log'])): + if (isset($filterent['log'])) print '<i class="icon icon-tasks" title="'. gettext("traffic is logged") .'"></i>'; ?> - -<?php endif;?> </td> <?php $alias = rule_columns_with_alias( @@ -684,7 +680,8 @@ display_top_tabs($tab_array); <td> <a href="firewall_rules_edit.php?id=<?=$i;?>" class="btn btn-primary">edit</a> <a href="firewall_rules_edit.php?dup=<?=$i;?>" class="btn btn-default">copy</a> - <a href="firewall_rules.php?act=del&if=<?=htmlspecialchars($if);?>&id=<?=$i;?>" class="btn btn-danger">delete</a> + <a href="?act=toggle&if=<?=htmlspecialchars($if);?>&id=<?=$i;?>" class="btn btn-default">disable</a> + <a href="?act=del&if=<?=htmlspecialchars($if);?>&id=<?=$i;?>" class="btn btn-danger">delete</a> </td> </tr> <?php endfor;?> diff --git a/usr/local/www/index.php b/usr/local/www/index.php index ccf7dcc..edb246e 100644 --- a/usr/local/www/index.php +++ b/usr/local/www/index.php @@ -99,7 +99,7 @@ if (!is_array($config['widgets'])) { } if ($_POST && $_POST['sequence']) { - $config['widgets']['sequence'] = $_POST['sequence']; + $config['widgets']['sequence'] = rtrim($_POST['sequence'], ','); foreach($widgets as $widgetname => $widgetconfig){ if ($_POST[$widgetname . '-config']){ @@ -108,7 +108,7 @@ if ($_POST && $_POST['sequence']) { } write_config(gettext("Widget configuration has been changed.")); - header("Location: index.php"); + header("Location: /"); exit; } @@ -210,7 +210,7 @@ if ($config['widgets'] && $config['widgets']['sequence'] != "") { } ##add widgets that may not be in the saved configuration, in case they are to be displayed later - $widgets = array_merge($widgets, $widgetsfromconfig); + $widgets = $widgetsfromconfig + $widgets; ##find custom configurations of a particular widget and load its info to $pconfig foreach($widgets as $widgetname => $widgetconfig){ @@ -251,7 +251,7 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard"); <div class="col-md-12"> <div class="panel panel-default"> - <div class="panel-heading"><h4><?=gettext("Available Widgets"); ?></h4></div> + <div class="panel-heading"><?=gettext("Available Widgets"); ?></div> <div class="panel-body"> <?php foreach($widgets as $widgetname => $widgetconfig): ?> <?php if ($widgetconfig['display'] == 'none'): ?> diff --git a/usr/local/www/jquery/pfSense.js b/usr/local/www/jquery/pfSense.js index 89ec197..ede6fa3 100644 --- a/usr/local/www/jquery/pfSense.js +++ b/usr/local/www/jquery/pfSense.js @@ -1,4 +1,7 @@ $(function() { + // Enable popovers globally + $('[data-toggle="popover"]').popover() + switch ($(document.body).attr('id')) { case 'index': // Hide configuration button for panels without configuration @@ -36,6 +39,7 @@ $(function() { $('.container .col-md-6').each(function(idx, col){ $('.panel', col).each(function(idx, widget){ isOpen = $('.panel-body', widget).hasClass('in'); + sequence += widget.id.split('-')[1] +':'+ col.id.split('-')[1] +':'+ (isOpen ? 'open' : 'close') +','; }); }); diff --git a/usr/local/www/widgets/widgets/ipsec.widget.php b/usr/local/www/widgets/widgets/ipsec.widget.php index fe9e701..1f95514 100644 --- a/usr/local/www/widgets/widgets/ipsec.widget.php +++ b/usr/local/www/widgets/widgets/ipsec.widget.php @@ -205,8 +205,8 @@ if (isset($config['ipsec']['phase2'])): ?> </table> <?php endif;?> <?php else: ?> - <div class="panel panel-warning"> - <div class="panel-heading"><h3 class="panel-title">There are no configured IPsec Tunnels</h3></div> - <div class="panel-body">You can configure your IPsec <a href="vpn_ipsec.php">here</a>.</div> + <div class="alert alert-warning"> + <h3>There are no configured IPsec Tunnels</h3> + <p>You can configure your IPsec <a href="vpn_ipsec.php">here</a>.</p> </div> <?php endif; ?>
\ No newline at end of file diff --git a/usr/local/www/widgets/widgets/log.widget.php b/usr/local/www/widgets/widgets/log.widget.php index 86ac261..07d722a 100644 --- a/usr/local/www/widgets/widgets/log.widget.php +++ b/usr/local/www/widgets/widgets/log.widget.php @@ -69,7 +69,6 @@ if(is_numeric($_POST['filterlogentries'])) { $nentries = isset($config['widgets']['filterlogentries']) ? $config['widgets']['filterlogentries'] : 5; //set variables for log - $nentriesacts = isset($config['widgets']['filterlogentriesacts']) ? $config['widgets']['filterlogentriesacts'] : 'All'; $nentriesinterfaces = isset($config['widgets']['filterlogentriesinterfaces']) ? $config['widgets']['filterlogentriesinterfaces'] : 'All'; @@ -85,7 +84,6 @@ $filterlog = conv_log_filter($filter_logfile, $nentries, 50, $filterfieldsarray) handle_ajax($nentries, $nentries + 20); ?> - <script type="text/javascript"> //<![CDATA[ lastsawtime = '<?php echo time(); ?>'; @@ -144,116 +142,107 @@ function format_log_line(row) { //]]> </script> <script src="/javascript/filter_log.js" type="text/javascript"></script> -<input type="hidden" id="log-config" name="log-config" value="" /> - -<div id="log-settings" class="widgetconfigdiv" style="display:none;"> - <form action="/widgets/widgets/log.widget.php" method="post" name="iforma"> - Number of lines to display: - <select name="filterlogentries" class="formfld unknown" id="filterlogentries"> - <?php for ($i = 1; $i <= 20; $i++) { ?> - <option value="<?php echo $i;?>" <?php if ($nentries == $i) echo "selected=\"selected\"";?>><?php echo $i;?></option> - <?php } ?> - </select> -<?php - $Include_Act = explode(" ", $nentriesacts); - if ($nentriesinterfaces == "All") $nentriesinterfaces = ""; -?> - <input id="actpass" name="actpass" type="checkbox" value="Pass" <?php if (in_arrayi('Pass', $Include_Act)) echo "checked=\"checked\""; ?> /> Pass - <input id="actblock" name="actblock" type="checkbox" value="Block" <?php if (in_arrayi('Block', $Include_Act)) echo "checked=\"checked\""; ?> /> Block - <input id="actreject" name="actreject" type="checkbox" value="Reject" <?php if (in_arrayi('Reject', $Include_Act)) echo "checked=\"checked\""; ?> /> Reject - <br /> - Interfaces: - <select id="filterlogentriesinterfaces" name="filterlogentriesinterfaces" class="formselect"> - <option value="All">ALL</option> -<?php - $interfaces = get_configured_interface_with_descr(); - foreach ($interfaces as $iface => $ifacename): -?> - <option value="<?=$iface;?>" <?php if ($nentriesinterfaces == $iface) echo "selected=\"selected\"";?>> - <?=htmlspecialchars($ifacename);?> - </option> -<?php - endforeach; - unset($interfaces); - unset($Include_Act); -?> - </select> - - <input id="submita" name="submita" type="submit" class="formbtn" value="Save" /> - </form> -</div> - -<table> - <colgroup> - <col style='width: 7%;' /> - <col style='width: 23%;' /> - <col style='width: 11%;' /> - <col style='width: 28%;' /> - <col style='width: 31%;' /> - </colgroup> +<table class="table table-striped"> <thead> <tr> - <th><?=gettext("Act");?></td> - <th><?=gettext("Time");?></td> - <th><?=gettext("IF");?></td> - <th><?=gettext("Source");?></td> - <th><?=gettext("Destination");?></td> + <th><?=gettext("Act");?></th> + <th><?=gettext("Time");?></th> + <th><?=gettext("IF");?></th> + <th><?=gettext("Source");?></th> + <th><?=gettext("Destination");?></th> </tr> </thead> - <tbody id='filter-log-entries'> - <?php - $rowIndex = 0; + <tbody> +<?php foreach ($filterlog as $filterent): - $evenRowClass = $rowIndex % 2 ? " listMReven" : " listMRodd"; - $rowIndex++; - if ($filterent['version'] == '6') { - $srcIP = "[" . htmlspecialchars($filterent['srcip']) . "]"; - $dstIP = "[" . htmlspecialchars($filterent['dstip']) . "]"; - } else { - $srcIP = htmlspecialchars($filterent['srcip']); - $dstIP = htmlspecialchars($filterent['dstip']); - } - - if ($filterent['srcport']) - $srcPort = ":" . htmlspecialchars($filterent['srcport']); - else - $srcPort = ""; - - if ($filterent['dstport']) - $dstPort = ":" . htmlspecialchars($filterent['dstport']); - else - $dstPort = ""; - - ?> - <tr class="<?=$evenRowClass?>"> - <td class="listMRlr nowrap" align="center"> - <a href="#" onclick="javascript:getURL('diag_logs_filter.php?getrulenum=<?php echo "{$filterent['rulenum']},{$filterent['tracker']},{$filterent['act']}"; ?>', outputrule);"> - <img border="0" src="<?php echo find_action_image($filterent['act']);?>" width="11" height="11" alt="<?php echo $filterent['act'];?>" title="<?php echo $filterent['act'];?>" /> - </a> + if ($filterent['version'] == '6') { + $srcIP = "[" . htmlspecialchars($filterent['srcip']) . "]"; + $dstIP = "[" . htmlspecialchars($filterent['dstip']) . "]"; + } else { + $srcIP = htmlspecialchars($filterent['srcip']); + $dstIP = htmlspecialchars($filterent['dstip']); + } + + if ($filterent['srcport']) + $srcPort = ":" . htmlspecialchars($filterent['srcport']); + else + $srcPort = ""; + + if ($filterent['dstport']) + $dstPort = ":" . htmlspecialchars($filterent['dstport']); + else + $dstPort = ""; + + if ($filterent['act'] == "block") + $iconfn = "remove"; + else if ($filterent['act'] == "reject") + $iconfn = "fire"; + else if ($filterent['act'] == "match") + $iconfn = "filter"; + else + $iconfn = "ok"; + + $rule = find_rule_by_number($filterent['rulenum'], $filterent['tracker'], $filterent['act']); +?> + <tr> + <td> + <a 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> + </a> + </td> + <td><?=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>:<?=$srcPort?> + </td> + <td> + <a href="diag_dns.php?host=<?=$filterent['dstip']?>" title="<?=gettext("Reverse Resolve with DNS");?>"> + <?=$dstIP?> + </a>:<?=$dstPort?> </td> - <td class="listMRr ellipsis nowrap" title="<?php echo htmlspecialchars($filterent['time']);?>"><?php echo substr(htmlspecialchars($filterent['time']),0,-3);?></td> - <td class="listMRr ellipsis nowrap" title="<?php echo htmlspecialchars($filterent['interface']);?>"><?php echo htmlspecialchars($filterent['interface']);?></td> - <td class="listMRr ellipsis nowrap" title="<?php echo $srcIP . $srcPort;?>"> - <a href="diag_dns.php?host=<?php echo "{$filterent['srcip']}"; ?>" title="<?=gettext("Reverse Resolve with DNS");?>"> - <?php echo $srcIP;?></a></td> - <td class="listMRr ellipsis nowrap" title="<?php echo $dstIP . $dstPort;?>"> - <a href="diag_dns.php?host=<?php echo "{$filterent['dstip']}"; ?>" title="<?=gettext("Reverse Resolve with DNS");?>"> - <?php echo $dstIP;?></a><?php echo $dstPort;?></td> - <?php - if ($filterent['proto'] == "TCP") - $filterent['proto'] .= ":{$filterent['tcpflags']}"; - ?> </tr> <?php endforeach; ?> </tbody> </table> -<!-- needed to display the widget settings menu --> -<script type="text/javascript"> -//<![CDATA[ - selectIntLink = "log-configure"; - textlink = document.getElementById(selectIntLink); - textlink.style.display = "inline"; -//]]> -</script> +<!-- close the body we're wrapped in and add a configuration-panel --> +</div><div class="panel-footer collapse"> + +<form action="/widgets/widgets/log.widget.php" method="post"> + Number of lines to display: + <select name="filterlogentries" class="formfld unknown" id="filterlogentries"> + <?php for ($i = 1; $i <= 20; $i++) { ?> + <option value="<?php echo $i;?>" <?php if ($nentries == $i) echo "selected=\"selected\"";?>><?php echo $i;?></option> + <?php } ?> + </select> + +<?php + $Include_Act = explode(" ", $nentriesacts); + if ($nentriesinterfaces == "All") $nentriesinterfaces = ""; +?> + <input id="actpass" name="actpass" type="checkbox" value="Pass" <?php if (in_arrayi('Pass', $Include_Act)) echo "checked=\"checked\""; ?> /> Pass + <input id="actblock" name="actblock" type="checkbox" value="Block" <?php if (in_arrayi('Block', $Include_Act)) echo "checked=\"checked\""; ?> /> Block + <input id="actreject" name="actreject" type="checkbox" value="Reject" <?php if (in_arrayi('Reject', $Include_Act)) echo "checked=\"checked\""; ?> /> Reject + <br /> + Interfaces: + <select id="filterlogentriesinterfaces" name="filterlogentriesinterfaces" class="formselect"> + <option value="All">ALL</option> +<?php + $interfaces = get_configured_interface_with_descr(); + foreach ($interfaces as $iface => $ifacename): +?> + <option value="<?=$iface;?>" <?php if ($nentriesinterfaces == $iface) echo "selected=\"selected\"";?>> + <?=htmlspecialchars($ifacename);?> + </option> +<?php + endforeach; + unset($interfaces); + unset($Include_Act); +?> + </select> + + <input id="submita" name="submita" type="submit" class="formbtn" value="Save" /> +</form>
\ No newline at end of file diff --git a/usr/local/www/widgets/widgets/picture.widget.php b/usr/local/www/widgets/widgets/picture.widget.php index 154baf5..26eb551 100644 --- a/usr/local/www/widgets/widgets/picture.widget.php +++ b/usr/local/www/widgets/widgets/picture.widget.php @@ -73,6 +73,7 @@ if($_POST) { </div><div class="panel-footer collapse"> <form action="/widgets/widgets/picture.widget.php" method="post" enctype="multipart/form-data" class="form-inline"> - <input name="pictfile" type="file" class="form-control" placeholder="Upload picture"/> + <label for="pictfile">New picture: </label> + <input name="pictfile" type="file" class="form-control" /> <button type="submit" class="btn btn-default">Upload</button> </form> diff --git a/usr/local/www/widgets/widgets/services_status.widget.php b/usr/local/www/widgets/widgets/services_status.widget.php index 58abe2a..d27345f 100644 --- a/usr/local/www/widgets/widgets/services_status.widget.php +++ b/usr/local/www/widgets/widgets/services_status.widget.php @@ -43,7 +43,11 @@ require_once("/usr/local/www/widgets/include/services_status.inc"); $services = get_services(); if(isset($_POST['servicestatusfilter'])) { - $config['widgets']['servicestatusfilter'] = htmlspecialchars(implode(',', $_POST['servicestatusfilter']), ENT_QUOTES | ENT_HTML401); + $validNames = array(); + foreach ($services as $service) + array_push($validNames, $service['name']); + + $config['widgets']['servicestatusfilter'] = implode(',', array_intersect($validNames, $_POST['servicestatusfilter'])); write_config("Saved Service Status Filter via Dashboard"); header("Location: /"); } |