diff options
Diffstat (limited to 'src/usr')
-rw-r--r-- | src/usr/local/www/firewall_nat.php | 29 | ||||
-rw-r--r-- | src/usr/local/www/firewall_nat_1to1.php | 8 | ||||
-rw-r--r-- | src/usr/local/www/firewall_nat_npt.php | 8 | ||||
-rw-r--r-- | src/usr/local/www/firewall_nat_npt_edit.php | 5 | ||||
-rw-r--r-- | src/usr/local/www/firewall_nat_out.php | 2 | ||||
-rw-r--r-- | src/usr/local/www/firewall_rules.php | 86 |
6 files changed, 116 insertions, 22 deletions
diff --git a/src/usr/local/www/firewall_nat.php b/src/usr/local/www/firewall_nat.php index 0d0d3a6..287133b 100644 --- a/src/usr/local/www/firewall_nat.php +++ b/src/usr/local/www/firewall_nat.php @@ -164,6 +164,19 @@ if (isset($_POST['del_x'])) { header("Location: firewall_nat.php"); exit; } +} else if ($_GET['act'] == "toggle") { + if ($a_nat[$_GET['id']]) { + if (isset($a_nat[$_GET['id']]['disabled'])) { + unset($a_nat[$_GET['id']]['disabled']); + } else { + $a_nat[$_GET['id']]['disabled'] = true; + } + if (write_config(gettext("Firewall: NAT: Port forward, enable/disable NAT rule"))) { + mark_subsystem_dirty('natconf'); + } + header("Location: firewall_nat.php"); + exit; + } } $pgtitle = array(gettext("Firewall"), gettext("NAT"), gettext("Port Forward")); @@ -194,6 +207,7 @@ display_top_tabs($tab_array); <thead> <tr> <th><!-- Checkbox --></th> + <th><!-- Icon --></th> <th><!-- Rule type --></th> <th><?=gettext("Interface")?></th> <th><?=gettext("Protocol")?></th> @@ -225,13 +239,26 @@ foreach ($a_nat as $natent): if (!have_natpfruleint_access($natent['interface'])) { continue; } + + if (isset($natent['disabled'])) { + $iconfn = "pass_d"; + $trclass = 'class="disabled"'; + } else { + $iconfn = "pass"; + $trclass = ''; + } ?> - <tr id="fr<?=$nnats;?>" onClick="fr_toggle(<?=$nnats;?>)" ondblclick="document.location='firewall_nat_edit.php?id=<?=$i;?>';"> + <tr id="fr<?=$nnats;?>" <?=$trclass?> onClick="fr_toggle(<?=$nnats;?>)" ondblclick="document.location='firewall_nat_edit.php?id=<?=$i;?>';"> <td > <input type="checkbox" id="frc<?=$nnats;?>" onClick="fr_toggle(<?=$nnats;?>)" name="rule[]" value="<?=$i;?>"/> </td> <td> + <a href="?act=toggle&id=<?=$i?>"> + <i class="fa <?= ($iconfn == "pass") ? "fa-check":"fa-times"?>" title="<?=gettext("click to toggle enabled/disabled status")?>"></i> + </a> + </td> + <td> <?php if ($natent['associated-rule-id'] == "pass"): ?> diff --git a/src/usr/local/www/firewall_nat_1to1.php b/src/usr/local/www/firewall_nat_1to1.php index 1fc1593..3042a70 100644 --- a/src/usr/local/www/firewall_nat_1to1.php +++ b/src/usr/local/www/firewall_nat_1to1.php @@ -265,8 +265,12 @@ display_top_tabs($tab_array); </div> <nav class="action-buttons"> - <a href="firewall_nat_1to1_edit.php?after=-1" class="btn btn-sm btn-success" title="<?=gettext('Add new mapping')?>"> - <i class="fa fa-plus icon-embed-btn"></i> + <a href="firewall_nat_1to1_edit.php?after=-1" class="btn btn-sm btn-success" title="<?=gettext('Add mapping to the top of the list')?>"> + <i class="fa fa-level-up icon-embed-btn"></i> + <?=gettext('Add')?> + </a> + <a href="firewall_nat_1to1_edit.php" class="btn btn-sm btn-success" title="<?=gettext('Add mapping to the end of the list')?>"> + <i class="fa fa-level-down icon-embed-btn"></i> <?=gettext('Add')?> </a> <button name="del_x" type="submit" class="btn btn-danger btn-sm" title="<?=gettext('Delete selected mappings')?>"> diff --git a/src/usr/local/www/firewall_nat_npt.php b/src/usr/local/www/firewall_nat_npt.php index 034017f..89179ce 100644 --- a/src/usr/local/www/firewall_nat_npt.php +++ b/src/usr/local/www/firewall_nat_npt.php @@ -254,8 +254,12 @@ endforeach; </div> <nav class="action-buttons"> - <a href="firewall_nat_npt_edit.php" class="btn btn-sm btn-success" title="<?=gettext('Add new mapping')?>"> - <i class="fa fa-plus icon-embed-btn"></i> + <a href="firewall_nat_npt_edit.php?after=-1" class="btn btn-sm btn-success" title="<?=gettext('Add mapping to the top of the list')?>"> + <i class="fa fa-level-up icon-embed-btn"></i> + <?=gettext('Add')?> + </a> + <a href="firewall_nat_npt_edit.php" class="btn btn-sm btn-success" title="<?=gettext('Add mapping to the end of the list')?>"> + <i class="fa fa-level-down icon-embed-btn"></i> <?=gettext('Add')?> </a> <button name="del_x" type="submit" class="btn btn-danger btn-sm" title="<?=gettext('Delete selected mappings')?>"> diff --git a/src/usr/local/www/firewall_nat_npt_edit.php b/src/usr/local/www/firewall_nat_npt_edit.php index 4025605..249159e 100644 --- a/src/usr/local/www/firewall_nat_npt_edit.php +++ b/src/usr/local/www/firewall_nat_npt_edit.php @@ -88,6 +88,11 @@ if (isset($_POST['id']) && is_numericint($_POST['id'])) { $id = $_POST['id']; } +$after = $_GET['after']; +if (isset($_POST['after'])) { + $after = $_POST['after']; +} + if (isset($_GET['dup'])) { $id = $_GET['dup']; $after = $_GET['dup']; diff --git a/src/usr/local/www/firewall_nat_out.php b/src/usr/local/www/firewall_nat_out.php index 29dce5a..cb31869 100644 --- a/src/usr/local/www/firewall_nat_out.php +++ b/src/usr/local/www/firewall_nat_out.php @@ -354,7 +354,7 @@ print($form); else: ?> <a href="?act=toggle&id=<?=$i?>"> - <i class="fa <?= ($iconfn == "pass") ? "fa-check":"fa-hidden"?>" title="<?=gettext("Click to toggle enabled/disabled status")?>"></i> + <i class="fa <?= ($iconfn == "pass") ? "fa-check":"fa-times"?>" title="<?=gettext("Click to toggle enabled/disabled status")?>"></i> </a> <?php diff --git a/src/usr/local/www/firewall_rules.php b/src/usr/local/www/firewall_rules.php index eccde1d..6af5008 100644 --- a/src/usr/local/www/firewall_rules.php +++ b/src/usr/local/www/firewall_rules.php @@ -155,6 +155,7 @@ if (!$if || !isset($iflist[$if])) { } if ($_POST) { + $pconfig = $_POST; if ($_POST['apply']) { @@ -233,6 +234,16 @@ if (isset($_POST['del_x'])) { } $a_filter = $a_filter_new; + + $config['filter']['separator'][$if] = ""; + + if ($_POST['separator']) { + $idx = 0; + foreach ($_POST['separator'] as $separator) { + $config['filter']['separator'][$separator['if']]['sep' . $idx++] = $separator; + } + } + if (write_config()) { mark_subsystem_dirty('filter'); } @@ -297,8 +308,8 @@ display_top_tabs($tab_array); <?php // Show the anti-lockout rule if it's enabled, and we are on LAN with an if count > 1, or WAN with an if count of 1. if (!isset($config['system']['webgui']['noantilockout']) && - (((count($config['interfaces']) > 1) && ($if == 'lan')) || - ((count($config['interfaces']) == 1) && ($if == 'wan')))): + (((count($config['interfaces']) > 1) && ($if == 'lan')) || + ((count($config['interfaces']) == 1) && ($if == 'wan')))): $alports = implode('<br />', filter_get_antilockout_ports(true)); ?> <tr id="antilockout"> @@ -359,6 +370,7 @@ display_top_tabs($tab_array); <tbody class="user-entries"> <?php $nrules = 0; +$seps = 0; for ($i = 0; isset($a_filter[$i]); $i++): $filterent = $a_filter[$i]; @@ -367,6 +379,7 @@ for ($i = 0; isset($a_filter[$i]); $i++): } else { $display = ""; } + ?> <tr id="fr<?=$nrules;?>" <?=$display?> onClick="fr_toggle(<?=$nrules;?>)" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';" <?=(isset($filterent['disabled']) ? ' class="disabled"' : '')?>> <td > @@ -517,7 +530,7 @@ for ($i = 0; isset($a_filter[$i]); $i++): #FIXME $sched_caption_escaped = str_replace("'", "\'", $schedule['descr']); $schedule_span_begin = '<a href="/firewall_schedule_edit.php?id=' . $idx . '" data-toggle="popover" data-trigger="hover focus" title="' . $schedule['name'] . '" data-content="' . - $sched_caption_escaped . '" data-html="true">'; + $sched_caption_escaped . '" data-html="true">'; $schedule_span_end = ""; } } @@ -653,6 +666,17 @@ for ($i = 0; isset($a_filter[$i]); $i++): </td> </tr> <?php + if (isset($config['filter']['separator'][strtolower($if)]['sep0'])) { + foreach ($config['filter']['separator'][strtolower($if)] as $rulesep) { + if ($rulesep['row']['0'] == "fr" . $nrules) { + print('<tr class="ui-sortable-handle separator">' . + '<td bgcolor="#cce5ff" colspan="11">' . '<font color="#002699">' . $rulesep['text'] . '</font></td>' . + '<td bgcolor="#cce5ff"><a href="#"><i class="fa fa-trash no-confirm sepdel" title="delete this separator"></i></a></td>' . + '</tr>' . "\n"); + } + } + } + $nrules++; endfor; ?> @@ -754,13 +778,14 @@ events.push(function() { // Separator bar stuff ------------------------------------------------------------------------ $("#addsep").prop('type' ,'button'); - $("#addsep").click(function() { - alert("This feature is not yet complete. (Nothing is saved)\nIncluded for review only."); - // Inset a temporary bar in which hte user can enter some optional text - $('#ruletable > tbody:last').append('<tr>' + - '<td bgcolor="#cce5ff" colspan="10"><input id="newsep" placeholder="<?=gettext("Enter a description, Save, then drag to final location.")?>" class="col-md-12" type="text"></input></td>' + - '<td bgcolor="#cce5ff" colspan="2"><button class="btn btn-default btn-sm" id="btnnewsep"><?=gettext("Save")?></button></td>' + - '</tr>'); + $("#addsep").click(function() { +// alert("This feature is not yet complete. (Nothing is saved)\nIncluded for review only."); + + // Inset a temporary bar in which hte user can enter some optional text + $('#ruletable > tbody:last').append('<tr>' + + '<td bgcolor="#cce5ff" colspan="10"><input id="newsep" placeholder="<?=gettext("Enter a description, Save, then drag to final location.")?>" class="col-md-12" type="text"></input></td>' + + '<td bgcolor="#cce5ff" colspan="2"><button class="btn btn-default btn-sm" id="btnnewsep"><?=gettext("Save")?></button></td>' + + '</tr>'); $("#btnnewsep").prop('type' ,'button'); @@ -769,23 +794,52 @@ events.push(function() { $("#btnnewsep").click(function() { var septext = escapeHtml($('#newsep').val()); $('#ruletable > tbody:last >tr:last').remove(); - $('#ruletable > tbody:last').append('<tr class="ui-sortable-handle">' + - '<td bgcolor="#cce5ff" colspan="11">' + '<font color="#002699">' + septext + '</font></td>' + - '<td bgcolor="#cce5ff"><a href="#"><i class="fa fa-trash sepdel"></i></a></td>' + - '</tr>'); + $('#ruletable > tbody:last').append('<tr class="ui-sortable-handle separator">' + + '<td bgcolor="#cce5ff" colspan="11">' + '<font color="#002699">' + septext + '</font></td>' + + '<td bgcolor="#cce5ff"><a href="#"><i class="fa fa-trash sepdel"></i></a></td>' + + '</tr>'); + + $('#order-store').removeAttr('disabled'); }); - }); + }); // Delete a sepaator row $(function(){ $('table').on('click','tr a .sepdel',function(e){ e.preventDefault(); $(this).parents('tr').remove(); + $('#order-store').removeAttr('disabled'); }); }); + // Compose an inout array containing the row # and text for each separator function save_separators() { - return(true); + var seprow = 0; + var sepinput; + var sepnum = 0; + + $('#ruletable > tbody > tr').each(function() { + if ($(this).hasClass('separator')) { + seprow = $(this).prev('tr').attr("id"); + if (isNaN(seprow)) { + seprow = 0; + } + + sepinput = '<input type="hidden" name="separator[' + sepnum + '][row]" value="' + seprow + '"></input>'; + $('form').append(sepinput); + sepinput = '<input type="hidden" name="separator[' + sepnum + '][text]" value="' + $(this).find('td').text() + '"></input>'; + $('form').append(sepinput); + sepinput = '<input type="hidden" name="separator[' + sepnum + '][color]" value="' + 'blue' + '"></input>'; + $('form').append(sepinput); + sepinput = '<input type="hidden" name="separator[' + sepnum + '][if]" value="<?=$if?>"></input>'; + $('form').append(sepinput); + sepnum++; + } + + if ($(this).parent('tbody').hasClass('user-entries')) { + seprow++; + } + }); } //JS equivalent to PHP htmlspecialchars() |