Commit e78874a7 authored by Franco Fichtner's avatar Franco Fichtner

firewall: apply whitespace cleanups

parent 30ed9e9f
......@@ -161,28 +161,28 @@ include("head.inc");
$main_buttons = array(
array('href'=>'firewall_aliases_edit.php?tab='.$tab, 'label'=>gettext("Add a new alias")),
array('href'=>'firewall_aliases_import.php', 'label'=>gettext("Bulk import aliases from list")),
);
?>
<body>
<?php include("fbegin.inc"); ?>
<section class="page-content-main">
<div class="container-fluid">
<div class="container-fluid">
<div class="row">
<?php if ($savemsg) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('aliases')): ?><p>
<?php print_info_box_np(gettext("The alias list has been changed.") . "<br />" . gettext("You must apply the changes in order for them to take effect."));?>
<?php endif; ?>
<?php pfSense_handle_custom_code("/usr/local/pkg/firewall_aliases/pre_table"); ?>
<section class="col-xs-12">
<?php
<?php
$tab_array = array();
$tab_array[] = array(gettext("IP"),($tab=="ip" ? true : ($tab=="host" ? true : ($tab == "network" ? true : false))), "/firewall_aliases.php?tab=ip");
$tab_array[] = array(gettext("Ports"), ($tab=="port"? true : false), "/firewall_aliases.php?tab=port");
......@@ -190,14 +190,14 @@ $main_buttons = array(
$tab_array[] = array(gettext("All"), ($tab=="all"? true : false), "/firewall_aliases.php?tab=all");
display_top_tabs($tab_array);
?>
<div class="tab-content content-box col-xs-12">
<div class="tab-content content-box col-xs-12">
<form action="firewall_aliases.php" method="post" name="iform" id="iform">
<input type="hidden" name="tab" value="<?=htmlspecialchars($tab);?>" />
<input type="hidden" name="tab" value="<?=htmlspecialchars($tab);?>" />
<div class="table-responsive">
<table class="table table-striped table-sort">
<tr>
......@@ -205,7 +205,7 @@ $main_buttons = array(
<td width="43%" class="listhdrr"><?=gettext("Values"); ?></td>
<td width="30%" class="listhdr"><?=gettext("Description"); ?></td>
<td width="7%" class="list">
</td>
</tr>
<?php
......@@ -267,9 +267,9 @@ $main_buttons = array(
<tr>
<td valign="middle">
<a href="firewall_aliases_edit.php?id=<?=$i;?>" class="btn btn-default"><span class="glyphicon glyphicon-edit" title="<?=gettext("Edit alias")." ".$alias['name'];?>"></span></a>
<a href="firewall_aliases.php?act=del&amp;tab=<?=$tab;?>&amp;id=<?=$i;?>" class="btn btn-default" onclick="return confirm('<?=gettext("Do you really want to delete this alias? All elements that still use it will become invalid (e.g. filter rules)!");?>')"><span class="glyphicon glyphicon-remove"></span></a>
</td>
</tr>
</table>
......@@ -278,7 +278,7 @@ $main_buttons = array(
<?php
} // if ($show_alias)
} // foreach
?>
?>
</table>
</div>
<div class="container-fluid">
......@@ -290,4 +290,4 @@ $main_buttons = array(
</div>
</div>
</section>
<?php include("foot.inc"); ?>
\ No newline at end of file
<?php include("foot.inc"); ?>
......@@ -624,26 +624,26 @@ EOD;
<section class="page-content-main">
<div class="container-fluid">
<div class="container-fluid">
<div class="row">
<?php pfSense_handle_custom_code("/usr/local/pkg/firewall_aliases_edit/pre_input_errors"); ?>
<?php if ($input_errors) print_input_errors($input_errors); ?>
<div id="inputerrors"></div>
<section class="col-xs-12">
<div class="content-box">
<header class="content-box-head container-fluid">
<h3><?=gettext("Alias Edit");?></h3>
</header>
<div class="content-box-main">
<form action="firewall_aliases_edit.php" method="post" name="iform" id="iform">
<?php
<div class="content-box">
<header class="content-box-head container-fluid">
<h3><?=gettext("Alias Edit");?></h3>
</header>
<div class="content-box-main">
<form action="firewall_aliases_edit.php" method="post" name="iform" id="iform">
<?php
if (empty($tab)) {
if (preg_match("/url/i", $pconfig['type']))
$tab = 'url';
......@@ -655,7 +655,7 @@ EOD;
?>
<input name="tab" type="hidden" id="tab" value="<?=htmlspecialchars($tab);?>" />
<div class="table-responsive">
<table class="table table-striped table-sort">
<tr>
......@@ -713,7 +713,7 @@ EOD;
<td><div id="twocolumn">CIDR</div></td>
<td><div id="threecolumn"><?=gettext("Description"); ?></div></td>
</tr>
<?php
$counter = 0;
if ($pconfig['address'] <> ""):
......@@ -748,7 +748,7 @@ EOD;
</tr>
<?php
$counter++;
endwhile;
endif;
?>
......@@ -770,14 +770,14 @@ EOD;
</tr>
</table>
</div>
</form>
</div>
</div>
</form>
</div>
</div>
</section>
</div>
</div>
</section>
<script type="text/javascript">
//<![CDATA[
......@@ -801,4 +801,4 @@ EOD;
//]]>
</script>
<?php include("foot.inc"); ?>
\ No newline at end of file
<?php include("foot.inc"); ?>
......@@ -162,25 +162,25 @@ include("head.inc");
<section class="page-content-main">
<div class="container-fluid">
<div class="container-fluid">
<div class="row">
<?php if ($input_errors) print_input_errors($input_errors); ?>
<div id="inputerrors"></div>
<section class="col-xs-12">
<div class="content-box">
<header class="content-box-head container-fluid">
<h3><?=gettext("Alias Import");?></h3>
</header>
<div class="content-box-main">
<form action="firewall_aliases_import.php" method="post" name="iform" id="iform">
<div class="content-box">
<header class="content-box-head container-fluid">
<h3><?=gettext("Alias Import");?></h3>
</header>
<div class="content-box-main">
<form action="firewall_aliases_import.php" method="post" name="iform" id="iform">
<div class="table-responsive">
<table class="table table-striped table-sort">
<tr>
......@@ -230,9 +230,9 @@ include("head.inc");
</tr>
</table>
</div>
</form>
</div>
</div>
</form>
</div>
</div>
</section>
</div>
</div>
......@@ -240,4 +240,4 @@ include("head.inc");
<?php include("foot.inc"); ?>
\ No newline at end of file
<?php include("foot.inc"); ?>
......@@ -107,7 +107,7 @@ if (isset($_POST['del_x'])) {
// Check for filter rule associations
if (isset($a_nat[$rulei]['associated-rule-id'])){
delete_id($a_nat[$rulei]['associated-rule-id'], $config['filter']['rule']);
mark_subsystem_dirty('filter');
}
unset($a_nat[$rulei]);
......@@ -179,13 +179,13 @@ $main_buttons = array(
body.dragging, body.dragging * {
cursor: move !important;
}
.dragged {
position: absolute;
opacity: 0.5;
z-index: 2000;
}
ol.example li.placeholder {
position: relative;
/** More li styles **/
......@@ -193,29 +193,29 @@ $main_buttons = array(
ol.example li.placeholder:before {
position: absolute;
/** Define arrowhead **/
}
}
</style>
</head>
<body>
<?php include("fbegin.inc"); ?>
<section class="page-content-main">
<div class="container-fluid">
<div class="container-fluid">
<div class="row">
<?php if ($savemsg) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('natconf')): ?>
<?php print_info_box_np(gettext("The NAT configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?><br />
<?php endif; ?>
<section class="col-xs-12">
<?php
<?php
$tab_array = array();
$tab_array[] = array(gettext("Port Forward"), true, "firewall_nat.php");
$tab_array[] = array(gettext("1:1"), false, "firewall_nat_1to1.php");
......@@ -223,68 +223,68 @@ $main_buttons = array(
$tab_array[] = array(gettext("NPt"), false, "firewall_nat_npt.php");
display_top_tabs($tab_array);
?>
<div class="tab-content content-box col-xs-12">
<div class="tab-content content-box col-xs-12">
<form action="firewall_nat.php" method="post" name="iform" id="iform">
<input type="hidden" id="id" name="id" value="<?php echo htmlspecialchars($id); ?>" />
<input type="hidden" id="id" name="id" value="<?php echo htmlspecialchars($id); ?>" />
<div class="table-responsive">
<table class="table table-striped table-sort">
<thead>
<tr id="frheader">
<th width="2%" class="list">&nbsp;</th>
<th width="2%" class="list">&nbsp;</th>
<th class="listhdrr"><?=gettext("If");?></th>
<th class="listhdrr"><?=gettext("Proto");?></th>
<th class="listhdrr nowrap"><?=gettext("Src. addr");?></th>
<th class="listhdrr nowrap"><?=gettext("Src. ports");?></th>
<th class="listhdrr nowrap"><?=gettext("Dest. addr");?></th>
<th class="listhdrr nowrap"><?=gettext("Dest. ports");?></th>
<th class="listhdrr nowrap"><?=gettext("NAT IP");?></th>
<th class="listhdrr nowrap"><?=gettext("NAT Ports");?></th>
<th class="listhdr"><?=gettext("Description");?></th>
<th class="list"></th>
</tr>
</thead>
<tbody>
<thead>
<tr id="frheader">
<th width="2%" class="list">&nbsp;</th>
<th width="2%" class="list">&nbsp;</th>
<th class="listhdrr"><?=gettext("If");?></th>
<th class="listhdrr"><?=gettext("Proto");?></th>
<th class="listhdrr nowrap"><?=gettext("Src. addr");?></th>
<th class="listhdrr nowrap"><?=gettext("Src. ports");?></th>
<th class="listhdrr nowrap"><?=gettext("Dest. addr");?></th>
<th class="listhdrr nowrap"><?=gettext("Dest. ports");?></th>
<th class="listhdrr nowrap"><?=gettext("NAT IP");?></th>
<th class="listhdrr nowrap"><?=gettext("NAT Ports");?></th>
<th class="listhdr"><?=gettext("Description");?></th>
<th class="list"></th>
</tr>
</thead>
<tbody>
<?php $nnats = $i = 0; foreach ($a_nat as $natent): ?>
<?php
<?php
//build Alias popup box
$span_end = "</U></span>";
$alias_popup = rule_popup($natent['source']['address'], pprint_port($natent['source']['port']), $natent['destination']['address'], pprint_port($natent['destination']['port']));
$alias_src_span_begin = $alias_popup["src"];
$alias_src_port_span_begin = $alias_popup["srcport"];
$alias_dst_span_begin = $alias_popup["dst"];
$alias_dst_port_span_begin = $alias_popup["dstport"];
$alias_src_span_end = $alias_popup["src_end"];
$alias_src_port_span_end = $alias_popup["srcport_end"];
$alias_dst_span_end = $alias_popup["dst_end"];
$alias_dst_port_span_end = $alias_popup["dstport_end"];
$alias_popup = rule_popup("","",$natent['target'], pprint_port($natent['local-port']));
$alias_target_span_begin = $alias_popup["dst"];
$alias_local_port_span_begin = $alias_popup["dstport"];
$alias_target_span_end = $alias_popup["dst_end"];
$alias_local_port_span_end = $alias_popup["dstport_end"];
if (isset($natent['disabled']))
$textss = "<span class=\"gray\">";
else
$textss = "<span>";
$textse = "</span>";
/* if user does not have access to edit an interface skip on to the next record */
if(!have_natpfruleint_access($natent['interface']))
if(!have_natpfruleint_access($natent['interface']))
continue;
?>
<tr valign="top" id="fr<?=$nnats;?>">
......@@ -292,10 +292,10 @@ $main_buttons = array(
<td class="listt" align="center">
<?php if($natent['associated-rule-id'] == "pass"): ?>
<span class="glyphicon glyphicon-play text-success"></span>
<?php elseif (!empty($natent['associated-rule-id'])): ?>
<span class="glyphicon glyphicon-resize-horizontal text-success"></span>
<?php endif; ?>
</td>
<td class="listlr" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_edit.php?id=<?=$nnats;?>';">
......@@ -308,34 +308,34 @@ $main_buttons = array(
?>
<?=$textse;?>
</td>
<td class="listr" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_edit.php?id=<?=$nnats;?>';">
<?=$textss;?><?=strtoupper($natent['protocol']);?><?=$textse;?>
</td>
<td class="listr" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_edit.php?id=<?=$nnats;?>';">
<?=$textss;?><?php echo $alias_src_span_begin;?><?php echo htmlspecialchars(pprint_address($natent['source']));?><?php echo $alias_src_span_end;?><?=$textse;?>
</td>
<td class="listr" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_edit.php?id=<?=$nnats;?>';">
<?=$textss;?><?php echo $alias_src_port_span_begin;?><?php echo htmlspecialchars(pprint_port($natent['source']['port']));?><?php echo $alias_src_port_span_end;?><?=$textse;?>
</td>
<td class="listr" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_edit.php?id=<?=$nnats;?>';">
<?=$textss;?><?php echo $alias_dst_span_begin;?><?php echo htmlspecialchars(pprint_address($natent['destination']));?><?php echo $alias_dst_span_end;?><?=$textse;?>
</td>
<td class="listr" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_edit.php?id=<?=$nnats;?>';">
<?=$textss;?><?php echo $alias_dst_port_span_begin;?><?php echo htmlspecialchars(pprint_port($natent['destination']['port']));?><?php echo $alias_dst_port_span_end;?><?=$textse;?>
</td>
<td class="listr" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_edit.php?id=<?=$nnats;?>';">
<?=$textss;?><?php echo $alias_target_span_begin;?><?php echo htmlspecialchars($natent['target']);?><?php echo $alias_target_span_end;?><?=$textse;?>
</td>
<td class="listr" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_edit.php?id=<?=$nnats;?>';">
<?php
$localport = $natent['local-port'];
list($dstbeginport, $dstendport) = explode("-", $natent['destination']['port']);
if ($dstendport) {
$localendport = $natent['local-port'] + $dstendport - $dstbeginport;
$localport .= '-' . $localendport;
......@@ -343,37 +343,37 @@ $main_buttons = array(
?>
<?=$textss;?><?php echo $alias_local_port_span_begin;?><?php echo htmlspecialchars(pprint_port($localport));?><?php echo $alias_local_port_span_end;?><?=$textse;?>
</td>
<td class="listbg" ondblclick="document.location='firewall_nat_edit.php?id=<?=$nnats;?>';">
<?=$textss;?><?=htmlspecialchars($natent['descr']);?>&nbsp;<?=$textse;?>
</td>
<td valign="middle" class="list nowrap">
<button type="submit" onmouseover="fr_insline(<?=$nnats;?>, true)" onmouseout="fr_insline(<?=$nnats;?>, false)" name="move_<?=$i;?>_x" title="<?=gettext("move selected rules before this rule");?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-arrow-left"></span></button>
<a href="firewall_nat_edit.php?id=<?=$i;?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-pencil"></span></a>
<a href="firewall_nat.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this rule?");?>')" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-remove"></span></a>
<a href="firewall_nat_edit.php?dup=<?=$i;?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span></a></td>
<button type="submit" onmouseover="fr_insline(<?=$nnats;?>, true)" onmouseout="fr_insline(<?=$nnats;?>, false)" name="move_<?=$i;?>_x" title="<?=gettext("move selected rules before this rule");?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-arrow-left"></span></button>
<a href="firewall_nat_edit.php?id=<?=$i;?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-pencil"></span></a>
<a href="firewall_nat.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this rule?");?>')" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-remove"></span></a>
<a href="firewall_nat_edit.php?dup=<?=$i;?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span></a></td>
</tr>
<?php $i++; $nnats++; endforeach; ?>
<?php $i++; $nnats++; endforeach; ?>
<tr>
<td class="list" colspan="8"></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td class="list nowrap" valign="middle">
<?php if ($nnats == 0): ?><span class="btn btn-default btn-xs text-muted"><span class="glyphicon glyphicon-arrow-left"></span></span><?php else: ?><button name="move_<?=$i;?>_x" value="<?=$i;?>" type="submit" title="<?=gettext("move selected rules to end");?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-arrow-left"></span></button><?php endif; ?>
<?php if (count($a_nat) == 0): ?>
<span class="btn btn-default btn-xs text-muted" title="<?=gettext("delete selected rules");?>"><span class="glyphicon glyphicon-remove" ></span></span>
<?php else: ?>
<button name="del_<?=$i;?>_x" type="submit" title="<?=gettext("delete selected rules"); ?>" onclick="return confirm('<?=gettext("Do you really want to delete the selected rules?");?>')" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-remove"></span></button>
<?php endif; ?>
<a href="firewall_nat_edit.php" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span></a></td>
</td>
</tr>
</tbody>
......@@ -405,4 +405,4 @@ $main_buttons = array(
<?php include("foot.inc"); ?>
\ No newline at end of file
<?php include("foot.inc"); ?>
......@@ -154,13 +154,13 @@ $main_buttons = array(
?>
<body>
<?php include("fbegin.inc"); ?>
<script type="text/javascript" src="/javascript/row_toggle.js"></script>
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
<div class="container-fluid">
<div class="row">
<?php
if ($savemsg)
print_info_box($savemsg);
......@@ -169,9 +169,9 @@ $main_buttons = array(
"<br />" .
gettext("You must apply the changes in order for them to take effect."));
?>
<section class="col-xs-12">
<section class="col-xs-12">
<?php
$tab_array = array();
$tab_array[] = array(gettext("Port Forward"), false, "firewall_nat.php");
......@@ -180,16 +180,16 @@ $main_buttons = array(
$tab_array[] = array(gettext("NPt"), false, "firewall_nat_npt.php");
display_top_tabs($tab_array);
?>
<div class="tab-content content-box col-xs-12">
<div class="tab-content content-box col-xs-12">
<form action="firewall_nat_1to1.php" method="post" name="iform" id="iform">
<input type="hidden" id="id" name="id" value="<?php echo htmlspecialchars($id); ?>" />
<input type="hidden" id="id" name="id" value="<?php echo htmlspecialchars($id); ?>" />
<div class="table-responsive">
<table class="table table-striped table-sort">
<thead>
<thead>
<tr id="frheader">
<th width="3%" class="list">&nbsp;</th>
<th width="3%" class="list">&nbsp;</th>
......@@ -200,8 +200,8 @@ $main_buttons = array(
<th class="listhdr"><?=gettext("Description"); ?></th>
<th class="list"></th>
</tr>
</thead>
<tbody>
</thead>
<tbody>
<?php
$textse = "";
$i = 0;
......@@ -223,12 +223,12 @@ $main_buttons = array(
</td>
<td class="listlr" onclick="fr_toggle(<?=$i;?>)" id="frd<?=$i;?>" ondblclick="document.location='firewall_nat_1to1_edit.php?id=<?=$i;?>';">
<?php
if (!$natent['interface'])
echo htmlspecialchars(convert_friendly_interface_to_friendly_descr("wan"));
else
echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface']));
?>
</td>
<td class="listr" id="frd<?=$i;?>" ondblclick="document.location='firewall_nat_1to1_edit.php?id=<?=$i;?>';">
......@@ -257,7 +257,7 @@ $main_buttons = array(
<button name="move_<?=$i;?>_x"
title="<?=gettext("move selected rules before this rule");?>"
type="submit" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-arrow-left"></span></button>
<a href="firewall_nat_1to1_edit.php?id=<?=$i;?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-pencil"></span></a>
<a href="firewall_nat_1to1.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this rule?");?>')" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-remove"></span></a>
<a href="firewall_nat_1to1_edit.php?dup=<?=$i;?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span></a>
......@@ -270,7 +270,7 @@ $main_buttons = array(
<tr>
<td class="list" colspan="7"></td>
<td class="list nowrap" valign="middle">
<?php
if ($i == 0):
?>
......@@ -282,9 +282,9 @@ $main_buttons = array(
<?php
endif;
?>
<a href="firewall_nat_1to1_edit.php" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span></a>
<?php
if ($i == 0):
?>
......@@ -312,7 +312,7 @@ $main_buttons = array(
</span></p>
</td>
</tr>
</tbody>
</tbody>
</table>
</div>
</form>
......@@ -322,4 +322,4 @@ $main_buttons = array(
</div>
</section>
<?php include("foot.inc"); ?>
\ No newline at end of file
<?php include("foot.inc"); ?>
......@@ -229,7 +229,7 @@ include("head.inc");
<body>
<?php include("fbegin.inc"); ?>
<script type="text/javascript" src="/javascript/suggestions.js"></script>
<script type="text/javascript" src="/javascript/autosuggest.js"></script>
<script type="text/javascript">
......@@ -276,22 +276,22 @@ include("head.inc");
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
<div class="row">
<?php
if ($input_errors)
print_input_errors($input_errors);
?>
<section class="col-xs-12">
<div class="content-box">
<form action="firewall_nat_1to1_edit.php" method="post" name="iform" id="iform">
<div class="table-responsive">
<table class="table table-striped table-sort">
<div class="content-box">
<form action="firewall_nat_1to1_edit.php" method="post" name="iform" id="iform">
<div class="table-responsive">
<table class="table table-striped table-sort">
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("Edit NAT 1:1 entry"); ?></td>
</tr>
......@@ -311,27 +311,27 @@ include("head.inc");
foreach ($ifdisp as $if => $ifdesc)
if(have_ruleint_access($if))
$interfaces[$if] = $ifdesc;
if ($config['l2tp']['mode'] == "server")
if(have_ruleint_access("l2tp"))
$interfaces['l2tp'] = "L2TP VPN";
if ($config['pptpd']['mode'] == "server")
if(have_ruleint_access("pptp"))
$interfaces['pptp'] = "PPTP VPN";
if (is_pppoe_server_enabled() && have_ruleint_access("pppoe"))
$interfaces['pppoe'] = "PPPoE VPN";
/* add ipsec interfaces */
if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enable']))
if(have_ruleint_access("enc0"))
$interfaces["enc0"] = "IPsec";
/* add openvpn/tun interfaces */
if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
$interfaces["openvpn"] = "OpenVPN";
foreach ($interfaces as $iface => $ifacename):
?>
<option value="<?=$iface;?>" <?php if ($iface == $pconfig['interface']) echo "selected=\"selected\""; ?>>
......@@ -418,7 +418,7 @@ include("head.inc");
<?php
for ($i = 31; $i > 0; $i--):
?>
<option value="<?=$i;?>" <?php if ($i == $pconfig['srcmask']) echo "selected=\"selected\""; ?>><?=$i;?></option>
<option value="<?=$i;?>" <?php if ($i == $pconfig['srcmask']) echo "selected=\"selected\""; ?>><?=$i;?></option>
<?php
endfor;
?>
......@@ -475,7 +475,7 @@ include("head.inc");
</option>
<?php
endif;
foreach ($ifdisp as $if => $ifdesc):
if(have_ruleint_access($if)):
?>
......@@ -553,9 +553,9 @@ include("head.inc");
</td>
</tr>
</table>
</div>
</div>
</form>
</div>
</div>
</section>
</div>
</div>
......@@ -572,4 +572,4 @@ include("head.inc");
var oTextbox1 = new AutoSuggestControl(document.getElementById("dst"), new StateSuggestions(addressarray));
//]]>
</script>
<?php include("foot.inc"); ?>
\ No newline at end of file
<?php include("foot.inc"); ?>
......@@ -247,7 +247,7 @@ if ($_POST) {
}
/* if user enters an alias and selects "network" then disallow. */
if( ($_POST['srctype'] == "network" && is_alias($_POST['src']) )
if( ($_POST['srctype'] == "network" && is_alias($_POST['src']) )
|| ($_POST['dsttype'] == "network" && is_alias($_POST['dst']) ) ) {
$input_errors[] = gettext("You must specify single host or alias for alias entries.");
}
......@@ -310,7 +310,7 @@ if ($_POST) {
}
}
// Allow extending of the firewall edit page and include custom input validation
// Allow extending of the firewall edit page and include custom input validation
pfSense_handle_custom_code("/usr/local/pkg/firewall_nat/input_validation");
if (!$input_errors) {
......@@ -429,7 +429,7 @@ if ($_POST) {
$natent['updated'] = make_config_revision_entry();
// Allow extending of the firewall edit page and include custom input validation
// Allow extending of the firewall edit page and include custom input validation
pfSense_handle_custom_code("/usr/local/pkg/firewall_nat/pre_write_config");
// Update the NAT entry now
......@@ -461,25 +461,25 @@ include("head.inc");
<body>
<?php include("fbegin.inc"); ?>
<script src="/javascript/chosen/chosen.jquery.js" type="text/javascript"></script>
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
<div class="row">
<?php if ($input_errors) print_input_errors($input_errors); ?>
<section class="col-xs-12">
<div class="content-box">
<form action="firewall_nat_edit.php" method="post" name="iform" id="iform">
<div class="table-responsive">
<table class="table table-striped table-sort">
<div class="content-box">
<form action="firewall_nat_edit.php" method="post" name="iform" id="iform">
<div class="table-responsive">
<table class="table table-striped table-sort">
......@@ -487,7 +487,7 @@ include("head.inc");
<td colspan="2" valign="top" class="listtopic"><?=gettext("Edit Redirect entry"); ?></td>
</tr>
<?php
// Allow extending of the firewall edit page and include custom input validation
// Allow extending of the firewall edit page and include custom input validation
pfSense_handle_custom_code("/usr/local/pkg/firewall_nat/htmlphpearly");
?>
<tr>
......@@ -511,34 +511,34 @@ include("head.inc");
<td width="78%" class="vtable">
<select name="interface" class="formselect" onchange="dst_change(this.value,iface_old,document.iform.dsttype.value);iface_old = document.iform.interface.value;typesel_change();">
<?php
$iflist = get_configured_interface_with_descr(false, true);
// Allow extending of the firewall edit interfaces
// Allow extending of the firewall edit interfaces
pfSense_handle_custom_code("/usr/local/pkg/firewall_nat/pre_interfaces_edit");
foreach ($iflist as $if => $ifdesc)
if(have_ruleint_access($if))
$interfaces[$if] = $ifdesc;
if ($config['l2tp']['mode'] == "server")
if(have_ruleint_access("l2tp"))
$interfaces['l2tp'] = "L2TP VPN";
if ($config['pptpd']['mode'] == "server")
if(have_ruleint_access("pptp"))
$interfaces['pptp'] = "PPTP VPN";
if (is_pppoe_server_enabled() && have_ruleint_access("pppoe"))
$interfaces['pppoe'] = "PPPoE VPN";
/* add ipsec interfaces */
if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enable']))
if(have_ruleint_access("enc0"))
$interfaces["enc0"] = "IPsec";
/* add openvpn/tun interfaces */
if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
$interfaces["openvpn"] = "OpenVPN";
foreach ($interfaces as $iface => $ifacename): ?>
<option value="<?=$iface;?>" <?php if ($iface == $pconfig['interface']) echo "selected=\"selected\""; ?>>
<?=htmlspecialchars($ifacename);?>
......@@ -601,7 +601,7 @@ include("head.inc");
<?=$ifdesc?> <?=gettext("address");?>
</option>
<?php endif; ?>
<?php endforeach; ?>
<?php endforeach; ?>
</select>
</td>
</tr>
......@@ -612,7 +612,7 @@ include("head.inc");
<select name="srcmask" class="formselect" id="srcmask">
<?php for ($i = 31; $i > 0; $i--): ?>
<option value="<?=$i;?>" <?php if ($i == $pconfig['srcmask']) echo "selected=\"selected\""; ?>><?=$i;?></option>
<?php endfor; ?>
<?php endfor; ?>
</select>
</td>
</tr>
......@@ -629,9 +629,9 @@ include("head.inc");
<select name="srcbeginport" class="formselect" onchange="src_rep_change();ext_change()">
<option value="">(<?=gettext("other"); ?>)</option>
<option value="any" <?php $bfound = 0; if ($pconfig['srcbeginport'] == "any") { echo "selected=\"selected\""; $bfound = 1; } ?>><?=gettext("any"); ?></option>
<?php foreach ($wkports as $wkport => $wkportdesc): ?>
<?php foreach ($wkports as $wkport => $wkportdesc): ?>
<option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['srcbeginport']) { echo "selected=\"selected\""; $bfound = 1; } ?>><?=htmlspecialchars($wkportdesc);?></option>
<?php endforeach; ?>
<?php endforeach; ?>
</select>
<input autocomplete='off' class="formfldalias" name="srcbeginport_cust" id="srcbeginport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['srcbeginport']) echo htmlspecialchars($pconfig['srcbeginport']); ?>" />
</td>
......@@ -683,16 +683,16 @@ include("head.inc");
<?php if(have_ruleint_access("l2tp")): ?>
<option value="l2tp" <?php if ($pconfig['dst'] == "l2tp") { echo "selected=\"selected\""; } ?>><?=gettext("L2TP clients"); ?></option>
<?php endif; ?>
<?php foreach ($ifdisp as $if => $ifdesc): ?>
<?php foreach ($ifdisp as $if => $ifdesc): ?>
<?php if(have_ruleint_access($if)): ?>
<option value="<?=$if;?>" <?php if ($pconfig['dst'] == $if) { echo "selected=\"selected\""; } ?>><?=htmlspecialchars($ifdesc);?> <?=gettext("net"); ?></option>
<option value="<?=$if;?>ip"<?php if ($pconfig['dst'] == $if . "ip") { echo "selected=\"selected\""; } ?>>
<?=$ifdesc;?> <?=gettext("address");?>
</option>
<?php endif; ?>
<?php endforeach; ?>
<?php endforeach; ?>
<?php if (is_array($config['virtualip']['vip'])):
foreach ($config['virtualip']['vip'] as $sn):
if (isset($sn['noexpand']))
......@@ -741,10 +741,10 @@ include("head.inc");
<td>
<select name="dstbeginport" id="dstbeginport" class="formselect" onchange="dst_rep_change();ext_change()">
<option value="">(<?=gettext("other"); ?>)</option>
<?php $bfound = 0;
<?php $bfound = 0;
foreach ($wkports as $wkport => $wkportdesc): ?>
<option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['dstbeginport']) { echo "selected=\"selected\""; $bfound = 1; }?>><?=htmlspecialchars($wkportdesc);?></option>
<?php endforeach; ?>
<?php endforeach; ?>
</select>
<input autocomplete='off' class="formfldalias" name="dstbeginport_cust" id="dstbeginport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['dstbeginport']) echo htmlspecialchars($pconfig['dstbeginport']); ?>" />
</td>
......@@ -757,7 +757,7 @@ include("head.inc");
<?php $bfound = 0;
foreach ($wkports as $wkport => $wkportdesc): ?>
<option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['dstendport']) { echo "selected=\"selected\""; $bfound = 1; } ?>><?=htmlspecialchars($wkportdesc);?></option>
<?php endforeach; ?>
<?php endforeach; ?>
</select>
<input autocomplete='off' class="formfldalias" name="dstendport_cust" id="dstendport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['dstendport']) echo htmlspecialchars($pconfig['dstendport']); ?>" />
</td>
......@@ -844,7 +844,7 @@ include("head.inc");
$linkedrule = "<br /><a href=\"firewall_rules_edit.php?id={$filter_id}\">" . gettext("View the filter rule") . "</a><br />";
}
echo ">". htmlspecialchars('Rule ' . $filter_rule['descr']) . "</option>\n";
}
}
}
......@@ -870,7 +870,7 @@ include("head.inc");
</td>
</tr><?php endif; ?>
<?php
// Allow extending of the firewall edit page and include custom input validation
// Allow extending of the firewall edit page and include custom input validation
pfSense_handle_custom_code("/usr/local/pkg/firewall_nat/htmlphplate");
?>
<?php
......@@ -954,4 +954,4 @@ include("head.inc");
var oTextbox8 = new AutoSuggestControl(document.getElementById("localbeginport_cust"), new StateSuggestions(customarray));
//]]>
</script>
<?php include("foot.inc"); ?>
\ No newline at end of file
<?php include("foot.inc"); ?>
......@@ -86,20 +86,20 @@ $main_buttons = array(
<body>
<?php include("fbegin.inc"); ?>
<script type="text/javascript" src="/javascript/row_toggle.js"></script>
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
<div class="container-fluid">
<div class="row">
<?php if ($savemsg) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('natconf')): ?>
<?php print_info_box_np(gettext("The NAT configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?><br />
<?php endif; ?>
<section class="col-xs-12">
<section class="col-xs-12">
<?php
$tab_array = array();
$tab_array[] = array(gettext("Port Forward"), false, "firewall_nat.php");
......@@ -108,30 +108,30 @@ $main_buttons = array(
$tab_array[] = array(gettext("NPt"), true, "firewall_nat_npt.php");
display_top_tabs($tab_array);
?>
<div class="tab-content content-box col-xs-12">
<div class="tab-content content-box col-xs-12">
<form action="firewall_nat_npt.php" method="post" name="iform" id="iform">
<div class="table-responsive">
<table class="table table-striped table-sort">
<div class="table-responsive">
<table class="table table-striped table-sort">
<thead>
<tr>
<th width="10%" class="listhdrr"><?=gettext("Interface"); ?></th>
<th width="20%" class="listhdrr"><?=gettext("External Prefix"); ?></th>
<th width="15%" class="listhdrr"><?=gettext("Internal prefix"); ?></th>
<th width="30%" class="listhdr"><?=gettext("Description"); ?></th>
<th class="list"></th>
</tr>
<tr>
<th width="10%" class="listhdrr"><?=gettext("Interface"); ?></th>
<th width="20%" class="listhdrr"><?=gettext("External Prefix"); ?></th>
<th width="15%" class="listhdrr"><?=gettext("Internal prefix"); ?></th>
<th width="30%" class="listhdr"><?=gettext("Description"); ?></th>
<th class="list"></th>
</tr>
</thead>
<tbody>
<?php
<?php
$textse = "</span>";
$i = 0; foreach ($a_npt as $natent):
if (isset($natent['disabled']))
$textss = "<span class=\"gray\">";
else
......@@ -147,17 +147,17 @@ $main_buttons = array(
echo $textse;
?>
</td>
<?php
<?php
$source_net = pprint_address($natent['source']);
$source_cidr = strstr($source_net, '/');
$destination_net = pprint_address($natent['destination']);
$destination_cidr = strstr($destination_net, '/');
?>
<td class="listr" ondblclick="document.location='firewall_nat_npt_edit.php?id=<?=$i;?>';">
<?php echo $textss . $destination_net . $textse; ?>
<?php echo $textss . $destination_net . $textse; ?>
</td>
<td class="listr" ondblclick="document.location='firewall_nat_npt_edit.php?id=<?=$i;?>';">
<?php echo $textss . $source_net . $textse; ?>
<?php echo $textss . $source_net . $textse; ?>
</td>
<td class="listbg" ondblclick="document.location='firewall_nat_npt_edit.php?id=<?=$i;?>';">
<?=$textss;?>
......@@ -169,15 +169,15 @@ $main_buttons = array(
</td>
</tr>
<?php $i++; endforeach; ?>
</tbody>
</tbody>
</table>
</div>
</div>
</form>
</div>
</section>
</div>
</div>
</section>
<?php include("foot.inc"); ?>
\ No newline at end of file
<?php include("foot.inc"); ?>
<?php
<?php
/* $Id$ */
/*
firewall_nat_npt_edit.php
part of pfSense (https://www.pfsense.org)
Copyright (C) 2011 Seth Mos <seth.mos@dds.nl>.
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
......@@ -98,7 +98,7 @@ if (isset($id) && $a_npt[$id]) {
if ($_POST) {
unset($input_errors);
$pconfig = $_POST;
......@@ -109,7 +109,7 @@ if ($_POST) {
$reqdfieldsn[] = gettext("Source prefix");
$reqdfields[] = "dst";
$reqdfieldsn[] = gettext("Destination prefix");
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
if (!$input_errors) {
......@@ -157,23 +157,23 @@ include("head.inc");
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
<div class="row">
<?php if ($input_errors) print_input_errors($input_errors); ?>
<section class="col-xs-12">
<div class="content-box">
<form action="firewall_nat_npt_edit.php" method="post" name="iform" id="iform">
<div class="table-responsive">
<table class="table table-striped table-sort">
<div class="content-box">
<form action="firewall_nat_npt_edit.php" method="post" name="iform" id="iform">
<div class="table-responsive">
<table class="table table-striped table-sort">
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("Edit NAT NPt entry"); ?></td>
</tr>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Disabled"); ?></td>
<td width="78%" class="vtable">
......@@ -190,29 +190,29 @@ include("head.inc");
foreach ($ifdisp as $if => $ifdesc)
if(have_ruleint_access($if))
$interfaces[$if] = $ifdesc;
if ($config['l2tp']['mode'] == "server")
if(have_ruleint_access("l2tp"))
$interfaces['l2tp'] = "L2TP VPN";
if ($config['pptpd']['mode'] == "server")
if(have_ruleint_access("pptp"))
$interfaces['pptp'] = "PPTP VPN";
if ($config['pppoe']['mode'] == "server")
if(have_ruleint_access("pppoe"))
$interfaces['pppoe'] = "PPPoE VPN";
/* add ipsec interfaces */
if (isset($config['ipsec']['enable']) || isset($config['ipsec']['mobileclients']['enable']))
if(have_ruleint_access("enc0"))
$interfaces["enc0"] = "IPsec";
/* add openvpn/tun interfaces */
if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
$interfaces["openvpn"] = "OpenVPN";
foreach ($interfaces as $iface => $ifacename):
foreach ($interfaces as $iface => $ifacename):
?>
<option value="<?=$iface;?>" <?php if ($iface == $pconfig['interface']) echo "selected=\"selected\""; ?>>
<?=htmlspecialchars($ifacename);?>
......@@ -245,8 +245,8 @@ include("head.inc");
</tr>
</table>
<br />
<span class="vexpl"><?=gettext("Enter the internal (LAN) ULA IPv6 Prefix for the Network Prefix translation. The prefix size specified for the internal IPv6 prefix will be applied to the
external prefix.");
<span class="vexpl"><?=gettext("Enter the internal (LAN) ULA IPv6 Prefix for the Network Prefix translation. The prefix size specified for the internal IPv6 prefix will be applied to the
external prefix.");
?></span>
</td>
</tr>
......@@ -278,16 +278,16 @@ include("head.inc");
<span class="vexpl"><?=gettext("Enter the Global Unicast routable IPv6 prefix here"); ?><br /></span>
</td>
</tr>
<tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
<td width="78%" class="vtable">
<td width="78%" class="vtable">
<input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>" />
<br /> <span class="vexpl"><?=gettext("You may enter a description here " .
"for your reference (not parsed)."); ?></span></td>
</tr>
<tr>
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
<td width="78%">
<input name="Submit" type="submit" class="btn btn-primary" value="<?=gettext("Save"); ?>" />
<input type="button" class="btn btn-default" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" />
<?php if (isset($id) && $a_npt[$id]): ?>
......@@ -296,12 +296,12 @@ include("head.inc");
</td>
</tr>
</table>
</div>
</div>
</form>
</div>
</div>
</section>
</div>
</div>
</section>
<?php include("foot.inc"); ?>
\ No newline at end of file
<?php include("foot.inc"); ?>
......@@ -218,22 +218,22 @@ include("head.inc");
<body>
<?php include("fbegin.inc"); ?>
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
<div class="container-fluid">
<div class="row">
<?php
if ($savemsg)
print_info_box($savemsg);
if (is_subsystem_dirty('natconf'))
print_info_box_np(gettext("The NAT configuration has been changed.")."<br />".gettext("You must apply the changes in order for them to take effect."));
?>
<form action="firewall_nat_out.php" method="post" name="iform" id="iform">
<section class="col-xs-12">
<section class="col-xs-12">
<?php
$tab_array = array();
$tab_array[] = array(gettext("Port Forward"), false, "firewall_nat.php");
......@@ -242,17 +242,17 @@ include("head.inc");
$tab_array[] = array(gettext("NPt"), false, "firewall_nat_npt.php");
display_top_tabs($tab_array);
?>
<div class="tab-content content-box col-xs-12">
<div class="table-responsive">
<table class="table table-striped table-sort">
<thead>
<thead>
<tr>
<th colspan="4"><?=gettext("Mode:"); ?></th>
</tr>
</thead>
<tbody>
</thead>
<tbody>
<tr>
<td>
<input name="mode" type="radio" id="automatic" value="automatic" <?php if ($mode == "automatic") echo "checked=\"checked\"";?> />
......@@ -273,7 +273,7 @@ include("head.inc");
</strong>
</td>
</tr>
<tr>
<td>
<input name="mode" type="radio" id="advanced" value="advanced" <?php if ($mode == "advanced") echo "checked=\"checked\"";?> />
......@@ -296,45 +296,45 @@ include("head.inc");
</tr>
<tr>
<td colspan="4">
<input name="save" type="submit" class="btn btn-primary" value="<?=gettext("Save");?>" />
</td>
</tr>
</tbody>
</tbody>
</table>
</div>
</div>
</section>
<section class="col-xs-12">
<div class=" content-box ">
<section class="col-xs-12">
<div class=" content-box ">
<div class="table-responsive">
<table class="table table-striped table-sort">
<thead>
<tr><th colspan="12"><?=gettext("Mappings:"); ?></th></tr>
<tr id="frheader">
<th width="2%" class="list">&nbsp;</th>
<th width="3%" class="list">&nbsp;</th>
<th width="10%" class="listhdrr"><?=gettext("Interface");?></th>
<th width="10%" class="listhdrr"><?=gettext("Source");?></th>
<th width="5%" class="listhdrr"><?=gettext("Source Port");?></th>
<th width="10%" class="listhdrr"><?=gettext("Destination");?></th>
<th width="10%" class="listhdrr"><?=gettext("Destination Port");?></th>
<th width="10%" class="listhdrr"><?=gettext("NAT Address");?></th>
<th width="10%" class="listhdrr"><?=gettext("NAT Port");?></th>
<th width="10%" class="listhdrr"><?=gettext("Static Port");?></th>
<th width="10%" class="listhdr"><?=gettext("Description");?></th>
<th class="list">
<a href="firewall_nat_out_edit.php?after=-1" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span></a>
</th>
</tr>
</thead>
<tbody>
<thead>
<tr><th colspan="12"><?=gettext("Mappings:"); ?></th></tr>
<tr id="frheader">
<th width="2%" class="list">&nbsp;</th>
<th width="3%" class="list">&nbsp;</th>
<th width="10%" class="listhdrr"><?=gettext("Interface");?></th>
<th width="10%" class="listhdrr"><?=gettext("Source");?></th>
<th width="5%" class="listhdrr"><?=gettext("Source Port");?></th>
<th width="10%" class="listhdrr"><?=gettext("Destination");?></th>
<th width="10%" class="listhdrr"><?=gettext("Destination Port");?></th>
<th width="10%" class="listhdrr"><?=gettext("NAT Address");?></th>
<th width="10%" class="listhdrr"><?=gettext("NAT Port");?></th>
<th width="10%" class="listhdrr"><?=gettext("Static Port");?></th>
<th width="10%" class="listhdr"><?=gettext("Description");?></th>
<th class="list">
<a href="firewall_nat_out_edit.php?after=-1" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span></a>
</th>
</tr>
</thead>
<tbody>
<?php
$i = 0;
foreach ($a_out as $natent):
......@@ -343,20 +343,20 @@ include("head.inc");
if ($mode == "disabled" || $mode == "automatic" || isset($natent['disabled'])) {
$textss = "text-muted";
}
//build Alias popup box
$alias_src_span_begin = "";
$alias_src_port_span_begin = "";
$alias_dst_span_begin = "";
$alias_dst_port_span_begin = "";
$alias_popup = rule_popup($natent['source']['network'],pprint_port($natent['sourceport']),$natent['destination']['address'],pprint_port($natent['dstport']));
$alias_src_span_begin = $alias_popup["src"];
$alias_src_port_span_begin = $alias_popup["srcport"];
$alias_dst_span_begin = $alias_popup["dst"];
$alias_dst_port_span_begin = $alias_popup["dstport"];
$alias_src_span_end = $alias_popup["src_end"];
$alias_src_port_span_end = $alias_popup["srcport_end"];
$alias_dst_span_end = $alias_popup["dst_end"];
......@@ -370,7 +370,7 @@ include("head.inc");
<?php
if ($mode == "disabled" || $mode == "automatic"):
?>
<span title="<?=gettext("This rule is being ignored");?>" class="<?=$iconfn;?> <?=$textss;?>"></span>
<?php
......@@ -391,7 +391,7 @@ include("head.inc");
</td>
<td class="listr" onclick="fr_toggle(<?=$i;?>)" id="frd<?=$i;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$i;?>';">
<?php
echo ($natent['protocol']) ? $natent['protocol'] . '/' : "" ;
if (!$natent['sourceport'])
echo "*";
......@@ -402,7 +402,7 @@ include("head.inc");
</td>
<td class="listr" id="frd<?=$i;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$i;?>';">
<?php
if (isset($natent['destination']['any']))
echo "*";
else {
......@@ -415,7 +415,7 @@ include("head.inc");
</td>
<td class="listr" id="frd<?=$i;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$i;?>';">
<?php
echo ($natent['protocol']) ? $natent['protocol'] . '/' : "" ;
if (!$natent['dstport'])
echo "*";
......@@ -426,7 +426,7 @@ include("head.inc");
</td>
<td class="listr" id="frd<?=$i;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$i;?>';">
<?php
if (isset($natent['nonat']))
echo '<I>NO NAT</I>';
elseif (!$natent['target'])
......@@ -440,7 +440,7 @@ include("head.inc");
</td>
<td class="listr" id="frd<?=$i;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$i;?>';">
<?php
if (!$natent['natport'])
echo "*";
else
......@@ -450,7 +450,7 @@ include("head.inc");
</td>
<td class="listr" id="frd<?=$i;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$i;?>';" align="center">
<?php
if(isset($natent['staticnatport']))
echo gettext("YES");
else
......@@ -463,7 +463,7 @@ include("head.inc");
</td>
<td class="list nowrap" valign="middle">
<button onmouseover="fr_insline(<?=$i;?>, true)" onmouseout="fr_insline(<?=$i;?>, false)" name="move_<?=$i;?>_x" title="<?=gettext("move selected rules before this rule");?>" type="submit" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-arrow-left"></span></button>
<a href="firewall_nat_out_edit.php?id=<?=$i;?>" title="<?=gettext("edit mapping");?>" alt="edit" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-pencil"></span></a>
<a href="firewall_nat_out.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this rule?");?>')" title="<?=gettext("delete rule");?>" alt="delete" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-remove"></span></a>
<a href="firewall_nat_out_edit.php?dup=<?=$i;?>" title="<?=gettext("add a new NAT based on this one");?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span></a>
......@@ -476,14 +476,14 @@ include("head.inc");
<tr valign="top" id="fr<?=$i;?>">
<td class="list" colspan="11"></td>
<td class="list nowrap" valign="middle">
<?php
if ($i == 0):
?>
<span class="btn btn-default btn-xs"><span class="glyphicon glyphicon-arrow-left"></span></span>
<?php
else:
?>
......@@ -491,9 +491,9 @@ include("head.inc");
<?php
endif;
?>
<a href="firewall_nat_out_edit.php" title="<?=gettext("add new mapping");?>" alt="add" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span></a>
<?php
if ($i == 0):
?>
......@@ -505,7 +505,7 @@ include("head.inc");
<?php
endif;
?>
</td>
</tr>
</tbody>
......@@ -640,7 +640,7 @@ include("head.inc");
</tr>
</tbody>
</table>
</div>
</div>
</div>
</section>
</form>
......@@ -648,4 +648,4 @@ include("head.inc");
</div>
</section>
<?php include("foot.inc"); ?>
\ No newline at end of file
<?php include("foot.inc"); ?>
......@@ -248,7 +248,7 @@ if ($_POST) {
}
}
// Allow extending of the firewall edit page and include custom input validation
// Allow extending of the firewall edit page and include custom input validation
pfSense_handle_custom_code("/usr/local/pkg/firewall_aon/input_validation");
if (!$input_errors) {
......@@ -268,7 +268,7 @@ if ($_POST) {
} else {
unset($natent['staticnatport']);
}
if(isset($_POST['disabled'])) {
$natent['disabled'] = true;
} else {
......@@ -293,7 +293,7 @@ if ($_POST) {
$natent['destination']['address'] = $ext;
}
if($_POST['natport'] != "" && $protocol_uses_ports && !isset($_POST['nonat'])) {
$natent['natport'] = $_POST['natport'];
$natent['natport'] = $_POST['natport'];
} else {
unset($natent['natport']);
}
......@@ -318,7 +318,7 @@ if ($_POST) {
$natent['updated'] = make_config_revision_entry();
// Allow extending of the firewall edit page and include custom input validation
// Allow extending of the firewall edit page and include custom input validation
pfSense_handle_custom_code("/usr/local/pkg/firewall_aon/pre_write_config");
if (isset($id) && $a_out[$id]) {
......@@ -443,24 +443,24 @@ function poolopts_change() {
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
<div class="row">
<?php if ($input_errors) print_input_errors($input_errors); ?>
<section class="col-xs-12">
<div class="content-box">
<form action="firewall_nat_out_edit.php" method="post" name="iform" id="iform">
<div class="table-responsive">
<table class="table table-striped table-sort">
<div class="content-box">
<form action="firewall_nat_out_edit.php" method="post" name="iform" id="iform">
<div class="table-responsive">
<table class="table table-striped table-sort">
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("Edit Advanced Outbound NAT entry");?></td>
</tr>
<?php
// Allow extending of the firewall edit page and include custom input validation
// Allow extending of the firewall edit page and include custom input validation
pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/htmlphpearly");
?>
<tr>
......@@ -488,27 +488,27 @@ function poolopts_change() {
foreach ($iflist as $if => $ifdesc)
if(have_ruleint_access($if))
$interfaces[$if] = $ifdesc;
if ($config['l2tp']['mode'] == "server")
if(have_ruleint_access("l2tp"))
$interfaces['l2tp'] = "L2TP VPN";
if ($config['pptpd']['mode'] == "server")
if(have_ruleint_access("pptp"))
$interfaces['pptp'] = "PPTP VPN";
if (is_pppoe_server_enabled() && have_ruleint_access("pppoe"))
$interfaces['pppoe'] = "PPPoE VPN";
/* add ipsec interfaces */
if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enable']))
if(have_ruleint_access("enc0"))
$interfaces["enc0"] = "IPsec";
/* add openvpn/tun interfaces */
if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
$interfaces["openvpn"] = "OpenVPN";
foreach ($interfaces as $iface => $ifacename):
?>
<option value="<?=$iface;?>" <?php if ($iface == $pconfig['interface']) echo "selected=\"selected\""; ?>>
......@@ -700,7 +700,7 @@ function poolopts_change() {
</select>
</td>
</tr>
<tr id="target_network">
<td><?=gettext("Other Subnet:");?>&nbsp;&nbsp;</td>
<td>
......@@ -716,7 +716,7 @@ function poolopts_change() {
</select>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
......@@ -821,7 +821,7 @@ function poolopts_change() {
</tr>
<?php
endif;
if ($has_updated_time):
?>
<tr>
......@@ -833,7 +833,7 @@ function poolopts_change() {
<?php
endif;
endif;
// Allow extending of the firewall edit page and include custom input validation
// Allow extending of the firewall edit page and include custom input validation
pfSense_handle_custom_code("/usr/local/pkg/firewall_aon/htmlphplate");
?>
<tr>
......@@ -852,16 +852,16 @@ function poolopts_change() {
</td>
</tr>
</table>
</div>
</div>
</form>
</div>
</div>
</section>
</div>
</div>
</section>
<script type="text/javascript">
//<![CDATA[
sourcesel_change();
......@@ -880,4 +880,4 @@ function poolopts_change() {
var oTextbox4 = new AutoSuggestControl(document.getElementById("dstport"), new StateSuggestions(customarray));
//]]>
</script>
<?php include("foot.inc"); ?>
\ No newline at end of file
<?php include("foot.inc"); ?>
......@@ -77,10 +77,10 @@ $ifdescs = get_configured_interface_with_descr();
// Drag and drop reordering
if($_REQUEST['dragdroporder']) {
// First create a new ruleset array and tmp arrays
$a_filter_before = array();
$a_filter_order = array();
......@@ -256,9 +256,9 @@ if (isset($_POST['del_x'])) {
break;
}
}
/* move selected rules before this rule */
if (isset($movebtn) && is_array($_POST['rule']) && count($_POST['rule'])) {
$a_filter_new = array();
......@@ -305,13 +305,13 @@ include("head.inc");
body.dragging, body.dragging * {
cursor: move !important;
}
.dragged {
position: absolute;
opacity: 0.5;
z-index: 2000;
}
ol.example li.placeholder {
position: relative;
/** More li styles **/
......@@ -319,7 +319,7 @@ include("head.inc");
ol.example li.placeholder:before {
position: absolute;
/** Define arrowhead **/
}
}
</style>
</head>
<body>
......@@ -329,17 +329,17 @@ include("head.inc");
jQuery(window).load(
function(){
var originalLeave=jQuery.fn.popover.Constructor.prototype.leave;
jQuery.fn.popover.Constructor.prototype.leave=function(obj)
jQuery.fn.popover.Constructor.prototype.leave=function(obj)
{
var self=obj instanceof this.constructor?obj:jQuery(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.'+this.type)
var container,timeout;originalLeave.call(this,obj);
if(obj.currentTarget){container=jQuery(obj.currentTarget).siblings('.popover')
timeout=self.timeout;
container.one('mouseenter',function()
{
{
clearTimeout(timeout);
container.one('mouseleave',function()
{
{
jQuery.fn.popover.Constructor.prototype.leave.call(self,self);
});
})
......@@ -356,9 +356,9 @@ include("head.inc");
<section class="page-content-main">
<div class="container-fluid">
<div class="container-fluid">
<div class="row">
<?php if ($savemsg) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('filter')): ?><p>
<?php
......@@ -374,9 +374,9 @@ include("head.inc");
<?php endif; ?>
<section class="col-xs-12">
<?php
<?php
/* active tabs */
$tab_array = array();
if ("FloatingRules" == $if)
......@@ -393,13 +393,13 @@ include("head.inc");
}
display_top_tabs($tab_array);
?>
<div class="tab-content content-box col-xs-12">
<div class="tab-content content-box col-xs-12">
<form action="firewall_rules.php<? if (!empty($if)): ?>?if=<?=$if;?><? endif; ?>" method="post" name="iform" id="iform">
<div class="table-responsive">
<table class="table table-striped table-sort dragable">
<thead>
......@@ -416,7 +416,7 @@ include("head.inc");
<th class="listhdrr"><?=gettext("Schedule");?></th>
<th class="listhdr"><?=gettext("Description");?></th>
<th class="list">
<?php
$nrules = 0;
for ($i = 0; isset($a_filter[$i]); $i++) {
......@@ -428,7 +428,7 @@ include("head.inc");
$nrules++;
}
?>
<?php if ($nrules): ?>
<button name="del" type="submit" title="<?=gettext("delete selected rules");?>" onclick="return confirm('<?=gettext('Do you really want to delete the selected rules?');?>')" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-remove"></span></button>
<?php endif; ?>
......@@ -441,7 +441,7 @@ include("head.inc");
if (!isset($config['system']['webgui']['noantilockout']) &&
(((count($config['interfaces']) > 1) && ($if == 'lan'))
|| ((count($config['interfaces']) == 1) && ($if == 'wan')))):
$alports = implode('<br />', filter_get_antilockout_ports(true));
?>
<tr valign="top" id="antilockout">
......@@ -460,17 +460,17 @@ include("head.inc");
<td valign="middle" class="list nowrap">
<span title="<?=gettext("move selected rules before this rule");?>" alt="move" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-arrow-left"></span></span>
<a href="system_advanced_admin.php" title="<?=gettext("edit rule");?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-pencil"></span></a>
<span title="<?=gettext("add a new rule based on this one");?>" width="17" height="17" border="0" alt="add" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span></span>
</td>
</tr>
<?php endif; ?>
<?php if (isset($config['interfaces'][$if]['blockpriv'])): ?>
<tr valign="top" id="frrfc1918">
<td class="list">&nbsp;</td>
<td class="listt" align="center"><span class="glyphicon glyphicon-remove text-danger"></span></td>
<td class="listr">*</td>
<td class="listr"><?=gettext("RFC 1918 networks");?></td>
<td class="listr">*</td>
......@@ -482,9 +482,9 @@ include("head.inc");
<td class="listbg"><?=gettext("Block private networks");?></td>
<td valign="middle" class="list nowrap">
<span title="<?=gettext("move selected rules before this rule");?>" alt="move" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-arrow-left"></span></span>
<a href="interfaces.php?if=<?=htmlspecialchars($if)?>#rfc1918" title="<?=gettext("edit rule");?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-pencil"></span></a>
<span title="<?=gettext("add a new rule based on this one");?>" width="17" height="17" border="0" alt="add" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span></span>
</td>
</tr>
......@@ -493,7 +493,7 @@ include("head.inc");
<tr valign="top" id="frrfc1918">
<td class="list">&nbsp;</td>
<td class="listt" align="center"><span class="glyphicon glyphicon-remove text-danger"></span></td>
<td class="listr">*</td>
<td class="listr"><?=gettext("Reserved/not assigned by IANA");?></td>
<td class="listr">*</td>
......@@ -505,11 +505,11 @@ include("head.inc");
<td class="listbg"><?=gettext("Block bogon networks");?></td>
<td valign="middle" class="list nowrap">
<span title="<?=gettext("move selected rules before this rule");?>" alt="move" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-arrow-left"></span></span>
<a href="interfaces.php?if=<?=htmlspecialchars($if)?>#rfc1918" title="<?=gettext("edit rule");?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-pencil"></span></a>
<span title="<?=gettext("add a new rule based on this one");?>" width="17" height="17" border="0" alt="add" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span></span>
</td>
</tr>
</tbody>
......@@ -570,14 +570,14 @@ include("head.inc");
//$alias_src_port_span_begin = "";
//$alias_dst_span_begin = "";
//$alias_dst_port_span_begin = "";
$alias_popup = rule_popup($filterent['source']['address'],pprint_port($filterent['source']['port']),$filterent['destination']['address'],pprint_port($filterent['destination']['port']));
//var_dump($alias_popup);
//$alias_src_span_begin = $alias_popup["src"];
//$alias_src_port_span_begin = $alias_popup["srcport"];
//$alias_dst_span_begin = $alias_popup["dst"];
//$alias_dst_port_span_begin = $alias_popup["dstport"];
$alias_src_span_end = ""; //$alias_popup["src_end"];
//$alias_src_port_span_end = $alias_popup["srcport_end"];
//$alias_dst_span_end = $alias_popup["dst_end"];
......@@ -609,7 +609,7 @@ include("head.inc");
{
if ($schedule['name'] == $filterent['sched'] ){
$schedstatus = filter_get_time_based_rule_status($schedule);
foreach($schedule['timerange'] as $timerange) {
$tempFriendlyTime = "";
$tempID = "";
......@@ -617,14 +617,14 @@ include("head.inc");
if ($timerange){
$dayFriendly = "";
$tempFriendlyTime = "";
//get hours
$temptimerange = $timerange['hour'];
$temptimeseparator = strrpos($temptimerange, "-");
$starttime = substr ($temptimerange, 0, $temptimeseparator);
$stoptime = substr ($temptimerange, $temptimeseparator+1);
if ($timerange['month']){
$tempmontharray = explode(",", $timerange['month']);
$tempdayarray = explode(",",$timerange['day']);
......@@ -634,14 +634,14 @@ include("head.inc");
foreach ($tempmontharray as $monthtmp){
$month = $tempmontharray[$arraycounter];
$day = $tempdayarray[$arraycounter];
if (!$firstDayFound)
{
$firstDay = $day;
$firstmonth = $month;
$firstDayFound = true;
}
$currentDay = $day;
$nextDay = $tempdayarray[$arraycounter+1];
$currentDay++;
......@@ -798,7 +798,7 @@ include("head.inc");
<td valign="middle" class="list nowrap">
<button name="move_<?=$i;?>_x" type="submit" title="<?=gettext("move selected rules before this rule"); ?>" onmouseover="fr_insline(<?=$nrules;?>, true)" onmouseout="fr_insline(<?=$nrules;?>, false)" class="btn btn-default btn-xs" value="<?=$i;?>"><span class="glyphicon glyphicon-arrow-left"></span></button>
<a href="firewall_rules_edit.php?id=<?=$i;?>" title="<?=gettext("edit rule"); ?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-pencil"></span></a>
<a href="firewall_rules.php?act=del&amp;if=<?=htmlspecialchars($if);?>&amp;id=<?=$i;?>" title="<?=gettext("delete rule"); ?>" onclick="return confirm('Do you really want to delete this rule?')" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-remove"></span></a>
<a href="firewall_rules_edit.php?dup=<?=$i;?>" title="<?=gettext("add a new rule based on this one"); ?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span></a>
</td>
......@@ -834,9 +834,9 @@ include("head.inc");
<td class="list">&nbsp;</td>
<td class="list">&nbsp;</td>
<td class="list">
<?php if ($nrules): ?><button name="move_<?=$i;?>_x" type="submit" value="<?=$i;?>" title="<?=gettext("move selected rules to end");?>" onmouseover="fr_insline(<?=$nrules;?>, true)" onmouseout="fr_insline(<?=$nrules;?>, false)" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-arrow-left"></span></button><?php endif; ?>
<?php if ($nrules): ?>
<button name="del" type="submit" title="<?=gettext("delete selected rules");?>" onclick="return confirm('<?=gettext('Do you really want to delete the selected rules?');?>')" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-remove"></span></button>
<?php endif; ?>
......@@ -845,8 +845,8 @@ include("head.inc");
</tr>
</tbody>
</table>
<div class="container-fluid">
<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="icons">
<tr>
......@@ -915,13 +915,13 @@ include("head.inc");
</div>
</div>
</section>
<input type="hidden" name="if" value="<?=htmlspecialchars($if);?>" />
<!-- <script type="text/javascript">
//<![CDATA[
var number_of_rules = <?=$nrules?>;
<?php $nrules = 0; for ($i = 0; isset($a_filter[$i]); $i++): ?>
Sortable.create("dragtable", {
tag:"tr",
format:"fr([0-9999999])",
......@@ -934,15 +934,15 @@ include("head.inc");
updateOrder(Sortable.serialize('dragtable', 'tr'));
}
});
<?php endfor; ?>
jQuery('#loading').hide();
//]]>
</script> -->
<script type="text/javascript">
$(function () {
$('table.dragable').sortable({
containerSelector: 'table',
......@@ -952,31 +952,31 @@ include("head.inc");
onDrop: function(item,container,_super, event) {
item.removeClass("dragged").removeAttr("style");
$("body").removeClass("dragging");
updateOrder(container);
}
})
});
function updateOrder(container) {
if(document.getElementById("redboxtable"))
//jQuery('#redboxtable').hide();
//jQuery('#loading').show();
document.body.style.cursor = 'wait';
var drag_url = '';
$('tbody#dragtable tr').each(function(i, obj) {
drag_url += '&dragtable[]='+$(obj).attr('id').replace('fr','');
});
document.location = 'firewall_rules.php?if=<?=htmlspecialchars($if);?>&dragdroporder=true' + drag_url;
return;
}
</script>
<?php include("foot.inc"); ?>
\ No newline at end of file
<?php include("foot.inc"); ?>
......@@ -583,7 +583,7 @@ if ($_POST) {
if (($_POST['statetimeout'] != "") && !is_posnumericint($_POST['statetimeout']))
$input_errors[] = gettext("State timeout (advanced option) must be a positive integer");
if ((($_POST['max-src-conn-rate'] <> "" and $_POST['max-src-conn-rates'] == "")) ||
if ((($_POST['max-src-conn-rate'] <> "" and $_POST['max-src-conn-rates'] == "")) ||
(($_POST['max-src-conn-rate'] == "" and $_POST['max-src-conn-rates'] <> "")))
$input_errors[] = gettext("Both maximum new connections per host and the interval (per second(s)) must be specified");
......@@ -810,24 +810,24 @@ include("head.inc");
<?php include("fbegin.inc"); ?>
<script type="text/javascript" src="/javascript/jquery.ipv4v6ify.js"></script>
<script src="/javascript/chosen/chosen.jquery.js" type="text/javascript"></script>
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
<div class="row">
<?php pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_input_errors"); ?>
<?php if ($input_errors) print_input_errors($input_errors); ?>
<section class="col-xs-12">
<div class="content-box">
<form action="firewall_rules_edit.php" method="post" name="iform" id="iform">
<input type='hidden' name="ruleid" value="<?=(isset($pconfig['ruleid'])&&$pconfig['ruleid']>0)?htmlspecialchars($pconfig['ruleid']):''?>" />
<div class="table-responsive">
<table class="table table-striped table-sort">
<div class="content-box">
<form action="firewall_rules_edit.php" method="post" name="iform" id="iform">
<input type='hidden' name="ruleid" value="<?=(isset($pconfig['ruleid'])&&$pconfig['ruleid']>0)?htmlspecialchars($pconfig['ruleid']):''?>" />
<div class="table-responsive">
<table class="table table-striped table-sort">
<tr>
<th colspan="2" valign="top" class="listtopic"><?=gettext("Edit Firewall rule");?></th>
</tr>
......@@ -930,7 +930,7 @@ include("head.inc");
if ($config['pptpd']['mode'] == "server")
if(have_ruleint_access("pptp"))
$interfaces['pptp'] = "PPTP VPN";
if (is_pppoe_server_enabled() && have_ruleint_access("pppoe"))
$interfaces['pppoe'] = "PPPoE VPN";
/* add ipsec interfaces */
......@@ -945,7 +945,7 @@ include("head.inc");
$selected_interfaces = explode(",", $pconfig['interface']);
foreach ($interfaces as $iface => $ifacename): ?>
<option value="<?=$iface;?>" <?php if ($pconfig['interface'] <> "" && ( strcasecmp($pconfig['interface'], $iface) == 0 || in_array($iface, $selected_interfaces) )) echo "selected=\"selected\""; ?>><?=$ifacename?></option>
<?php endforeach; ?>
<?php endforeach; ?>
</select>
<br />
<span class="vexpl"><?=gettext("Choose on which interface packets must come in to match this rule.");?></span>
......@@ -995,7 +995,7 @@ include("head.inc");
$protocols = explode(" ", "TCP UDP TCP/UDP ICMP ESP AH GRE IPV6 IGMP PIM OSPF any carp pfsync");
foreach ($protocols as $proto): ?>
<option value="<?=strtolower($proto);?>" <?php if (strtolower($proto) == $pconfig['proto']) echo "selected=\"selected\""; ?>><?=htmlspecialchars($proto);?></option>
<?php endforeach; ?>
<?php endforeach; ?>
</select>
<br />
<span class="vexpl"><?=gettext("Choose which IP protocol this rule should match.");?> <br /> <?=gettext("Hint: in most cases, you should specify ");?><em>TCP</em> &nbsp;<?=gettext("here.");?></span>
......@@ -1025,10 +1025,10 @@ include("head.inc");
"maskreq" => gettext("Address mask request"),
"maskrep" => gettext("Address mask reply")
);
foreach ($icmptypes as $icmptype => $descr): ?>
<option value="<?=$icmptype;?>" <?php if ($icmptype == $pconfig['icmptype']) echo "selected=\"selected\""; ?>><?=htmlspecialchars($descr);?></option>
<?php endforeach; ?>
<?php endforeach; ?>
</select>
<br />
<span class="vexpl"><?=gettext("If you selected ICMP for the protocol above, you may specify an ICMP type here.");?></span>
......@@ -1079,7 +1079,7 @@ include("head.inc");
<?=$ifdesc?> <?=gettext("address");?>
</option>
<?php endif; ?>
<?php endforeach; ?>
<?php endforeach; ?>
</select>
</td>
</tr>
......@@ -1090,7 +1090,7 @@ include("head.inc");
<select <?=$edit_disabled;?> name="srcmask" class="formselect ipv4v6" id="srcmask">
<?php for ($i = 127; $i > 0; $i--): ?>
<option value="<?=$i;?>" <?php if ($i == $pconfig['srcmask']) echo "selected=\"selected\""; ?>><?=$i;?></option>
<?php endfor; ?>
<?php endfor; ?>
</select>
</td>
</tr>
......@@ -1112,9 +1112,9 @@ include("head.inc");
<select <?=$edit_disabled;?> name="srcbeginport" class="formselect" onchange="src_rep_change();ext_change()">
<option value="">(<?=gettext("other"); ?>)</option>
<option value="any" <?php $bfound = 0; if ($pconfig['srcbeginport'] == "any") { echo "selected=\"selected\""; $bfound = 1; } ?>><?=gettext("any");?></option>
<?php foreach ($wkports as $wkport => $wkportdesc): ?>
<?php foreach ($wkports as $wkport => $wkportdesc): ?>
<option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['srcbeginport']) { echo "selected=\"selected\""; $bfound = 1; } ?>><?=htmlspecialchars("{$wkportdesc} ({$wkport})");?></option>
<?php endforeach; ?>
<?php endforeach; ?>
</select>
<input <?=$edit_disabled;?> autocomplete='off' class="formfldalias" name="srcbeginport_cust" id="srcbeginport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['srcbeginport']) echo htmlspecialchars($pconfig['srcbeginport']); ?>" />
</td>
......@@ -1172,15 +1172,15 @@ include("head.inc");
<?php if(have_ruleint_access("l2tp")): ?>
<option value="l2tp" <?php if ($pconfig['dst'] == "l2tp") { echo "selected=\"selected\""; } ?>><?=gettext("L2TP clients");?></option>
<?php endif; ?>
<?php foreach ($ifdisp as $if => $ifdesc): ?>
<?php foreach ($ifdisp as $if => $ifdesc): ?>
<?php if(have_ruleint_access($if)): ?>
<option value="<?=$if;?>" <?php if ($pconfig['dst'] == $if) { echo "selected=\"selected\""; } ?>><?=htmlspecialchars($ifdesc);?> <?=gettext("net");?></option>
<option value="<?=$if;?>ip"<?php if ($pconfig['dst'] == $if . "ip") { echo "selected=\"selected\""; } ?>>
<?=$ifdesc;?> <?=gettext("address");?>
</option>
<?php endif; ?>
<?php endforeach; ?>
<?php endforeach; ?>
</select>
</td>
</tr>
......@@ -1211,9 +1211,9 @@ include("head.inc");
<select <?=$edit_disabled;?> name="dstbeginport" class="formselect" onchange="dst_rep_change();ext_change()">
<option value="">(<?=gettext("other"); ?>)</option>
<option value="any" <?php $bfound = 0; if ($pconfig['dstbeginport'] == "any") { echo "selected=\"selected\""; $bfound = 1; } ?>><?=gettext("any");?></option>
<?php foreach ($wkports as $wkport => $wkportdesc): ?>
<?php foreach ($wkports as $wkport => $wkportdesc): ?>
<option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['dstbeginport']) { echo "selected=\"selected\""; $bfound = 1; }?>><?=htmlspecialchars("{$wkportdesc} ({$wkport})");?></option>
<?php endforeach; ?>
<?php endforeach; ?>
</select>
<input <?=$edit_disabled;?> autocomplete='off' class="formfldalias" name="dstbeginport_cust" id="dstbeginport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['dstbeginport']) echo htmlspecialchars($pconfig['dstbeginport']); ?>" />
</td>
......@@ -1226,7 +1226,7 @@ include("head.inc");
<option value="any" <?php $bfound = 0; if ($pconfig['dstendport'] == "any") { echo "selected=\"selected\""; $bfound = 1; } ?>><?=gettext("any");?></option>
<?php foreach ($wkports as $wkport => $wkportdesc): ?>
<option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['dstendport']) { echo "selected=\"selected\""; $bfound = 1; } ?>><?=htmlspecialchars("{$wkportdesc} ({$wkport})");?></option>
<?php endforeach; ?>
<?php endforeach; ?>
</select>
<input <?=$edit_disabled;?> autocomplete='off' class="formfldalias" name="dstendport_cust" id="dstendport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['dstendport']) echo htmlspecialchars($pconfig['dstendport']); ?>" />
</td>
......@@ -1266,7 +1266,7 @@ include("head.inc");
<input type="button" class="btn btn-default" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" />
<?php if (isset($id) && $a_filter[$id]): ?>
<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
<?php endif; ?>
<?php endif; ?>
<input name="after" type="hidden" value="<?=htmlspecialchars($after);?>" />
</td>
</tr>
......@@ -1458,7 +1458,7 @@ include("head.inc");
else
$opts .= "<option value=\"{$vprio}\" {$selected}>" . strtoupper($vprio) . "</option>\n";
}
$optsset = "";
foreach($vlanprio as $vprioset) {
if ($vprioset == $pconfig['vlanprioset'])
......@@ -1618,7 +1618,7 @@ include("head.inc");
</div>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Ackqueue/Queue");?></td>
<td width="78%" class="vtable">
......@@ -1745,7 +1745,7 @@ include("head.inc");
<input type="button" class="btn btn-default" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" />
<?php if (isset($id) && $a_filter[$id]): ?>
<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
<?php endif; ?>
<?php endif; ?>
<input name="after" type="hidden" value="<?=htmlspecialchars($after);?>" />
</td>
</tr>
......@@ -1779,4 +1779,4 @@ include("head.inc");
var oTextbox6 = new AutoSuggestControl(document.getElementById("dstendport_cust"), new StateSuggestions(customarray));
//]]>
</script>
<?php include("foot.inc"); ?>
\ No newline at end of file
<?php include("foot.inc"); ?>
......@@ -96,34 +96,34 @@ $main_buttons = array(
<?php include("fbegin.inc"); ?>
<section class="page-content-main">
<div class="container-fluid">
<div class="container-fluid">
<div class="row">
<?php if ($savemsg) print_info_box($savemsg); ?>
<section class="col-xs-12">
<div class="content-box">
<div class="content-box-main ">
<form action="firewall_schedule.php" method="post" name="iform" id="iform">
<div class="content-box">
<div class="content-box-main ">
<form action="firewall_schedule.php" method="post" name="iform" id="iform">
<div class="table-responsive">
<table class="table table-striped table-sort">
<thead>
<table class="table table-striped table-sort">
<thead>
<tr>
<td width="25%" class="listhdrr"><?=gettext("Name");?></td>
<td width="35%" class="listhdrr"><?=gettext("Time Range(s)");?></td>
<td width="35%" class="listhdr"><?=gettext("Description");?></td>
<td width="5%" class="list sort_ignore">
</td>
</tr>
</thead>
<tbody>
</thead>
<tbody>
<?php $i = 0; foreach ($a_schedules as $schedule): ?>
<tr>
<td class="listlr" ondblclick="document.location='firewall_schedule_edit.php?id=<?=$i;?>';">
......@@ -131,14 +131,14 @@ $main_buttons = array(
<?php
$schedstatus = filter_get_time_based_rule_status($schedule);
if ($schedstatus) { ?>
&nbsp;<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_frmfld_time.png" title="<?=gettext("Schedule is currently active");?>" width="17" height="17" border="0" alt="schedule" />
&nbsp;<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_frmfld_time.png" title="<?=gettext("Schedule is currently active");?>" width="17" height="17" border="0" alt="schedule" />
<?php } ?>
</td>
<td class="listlr" ondblclick="document.location='firewall_schedule_edit.php?id=<?=$i;?>';">
<table width="98%" border="0" cellpadding="0" cellspacing="0" summary="schedule">
</td>
<td class="listlr" ondblclick="document.location='firewall_schedule_edit.php?id=<?=$i;?>';">
<table width="98%" border="0" cellpadding="0" cellspacing="0" summary="schedule">
<?php
foreach($schedule['timerange'] as $timerange) {
$tempFriendlyTime = "";
$tempID = "";
......@@ -146,14 +146,14 @@ $main_buttons = array(
if ($timerange){
$dayFriendly = "";
$tempFriendlyTime = "";
//get hours
$temptimerange = $timerange['hour'];
$temptimeseparator = strrpos($temptimerange, "-");
$starttime = substr ($temptimerange, 0, $temptimeseparator);
$stoptime = substr ($temptimerange, $temptimeseparator+1);
if ($timerange['month']){
$tempmontharray = explode(",", $timerange['month']);
$tempdayarray = explode(",",$timerange['day']);
......@@ -163,14 +163,14 @@ $main_buttons = array(
foreach ($tempmontharray as $monthtmp){
$month = $tempmontharray[$arraycounter];
$day = $tempdayarray[$arraycounter];
if (!$firstDayFound)
{
$firstDay = $day;
$firstmonth = $month;
$firstDayFound = true;
}
$currentDay = $day;
$nextDay = $tempdayarray[$arraycounter+1];
$currentDay++;
......@@ -225,15 +225,15 @@ $main_buttons = array(
}
$timeFriendly = $starttime . "-" . $stoptime;
$description = $timerange['rangedescr'];
?><tr><td><?=$dayFriendly;?></td><td><?=$timeFriendly;?></td><td><?=$description;?></td></tr><?php
}
}//end for?></table>
</td>
<td class="listbg" ondblclick="document.location='firewall_schedule_edit.php?id=<?=$i;?>';">
<?=htmlspecialchars($schedule['descr']);?>&nbsp;
</td>
<td valign="middle" class="list nowrap">
<?=htmlspecialchars($schedule['descr']);?>&nbsp;
</td>
<td valign="middle" class="list nowrap">
<table border="0" cellspacing="0" cellpadding="1" summary="buttons">
<tr>
<td valign="middle"><a href="firewall_schedule_edit.php?id=<?=$i;?>" title="<?=gettext("edit alias");?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-pencil"></span></a></td>
......@@ -243,17 +243,17 @@ $main_buttons = array(
</td>
</tr>
<?php $i++; endforeach; ?>
</tbody>
</tbody>
</table>
</div>
<div class="container-fluid">
<p><span class="vexpl"><span class="text-danger"><strong><?=gettext("Note:");?><br /></strong></span><?=gettext("Schedules act as placeholders for time ranges to be used in Firewall Rules.");?></span></p>
</div>
</form>
</div>
</div>
</form>
</div>
</div>
</section>
</div>
</div>
</section>
<?php include("foot.inc"); ?>
\ No newline at end of file
<?php include("foot.inc"); ?>
......@@ -84,7 +84,7 @@ if (isset($id) && $a_schedules[$id]) {
}
if ($_POST) {
if(strtolower($_POST['name']) == "lan")
$input_errors[] = gettext("Schedule may not be named LAN.");
if(strtolower($_POST['name']) == "wan")
......@@ -99,7 +99,7 @@ if ($_POST) {
if (is_validaliasname($_POST['name']) == false)
$input_errors[] = gettext("The schedule name may only consist of the characters a-z, A-Z, 0-9");
}
/* check for name conflicts */
foreach ($a_schedules as $schedule) {
if (isset($id) && ($a_schedules[$id]) && ($a_schedules[$id] === $schedule))
......@@ -111,10 +111,10 @@ if ($_POST) {
}
}
$schedule = array();
$schedule['name'] = $_POST['name'];
$schedule['descr'] = htmlentities($_POST['descr'], ENT_QUOTES, 'UTF-8');
$schedule['descr'] = htmlentities($_POST['descr'], ENT_QUOTES, 'UTF-8');
$timerangeFound = false;
for ($x=0; $x<99; $x++){
if($_POST['schedule' . $x]) {
......@@ -133,7 +133,7 @@ if ($_POST) {
$timehourstr = $_POST['starttime' . $x];
$timehourstr .= "-";
$timehourstr .= $_POST['stoptime' . $x];
$timedescrstr = htmlentities($_POST['timedescr' . $x], ENT_QUOTES, 'UTF-8');
$timedescrstr = htmlentities($_POST['timedescr' . $x], ENT_QUOTES, 'UTF-8');
$dashpos = strpos($timestr, '-');
if ($dashpos === false)
{
......@@ -151,30 +151,30 @@ if ($_POST) {
if ($firstprint)
{
$monthstr .= ",";
$daystr .= ",";
$daystr .= ",";
}
$tempstr = "";
$monthpos = strpos($currentselection, "m");
$daypos = strpos($currentselection, "d");
$monthstr .= substr($currentselection, $monthpos+1, $daypos-$monthpos-1);
$daystr .= substr($currentselection, $daypos+1);
$daystr .= substr($currentselection, $daypos+1);
$firstprint = true;
}
}
$timeparts['month'] = $monthstr;
$timeparts['day'] = $daystr;
}
}
$timeparts['hour'] = $timehourstr;
$timeparts['rangedescr'] = $timedescrstr;
$schedule['timerange'][$x] = $timeparts;
}
}
if (!$timerangeFound)
$input_errors[] = gettext("The schedule must have at least one time range configured.");
if (!$input_errors) {
if (!$input_errors) {
if (!empty($pconfig['schedlabel']))
$schedule['schedlabel'] = $pconfig['schedlabel'];
else
......@@ -192,7 +192,7 @@ if ($_POST) {
header("Location: firewall_schedule.php");
exit;
}
//we received input errors, copy data to prevent retype
else
......@@ -204,7 +204,7 @@ if ($_POST) {
$pconfig['name'] = $schedule['name'];
$pconfig['descr'] = $schedule['descr'];
$pconfig['timerange'] = $schedule['timerange'];
}
}
}
include("head.inc");
......@@ -231,17 +231,17 @@ function rgb2hex(rgb) {
function repeatExistingDays(){
var tempstr, tempstrdaypos, week, daypos, dayposdone = "";
var dayarray = daysSelected.split(",");
for (i=0; i<=dayarray.length; i++){
tempstr = dayarray[i];
tempstrdaypos = tempstr.search("p");
week = tempstr.substring(1,tempstrdaypos);
week = parseInt(week);
dashpos = tempstr.search("-");
dashpos = tempstr.search("-");
daypos = tempstr.substring(tempstrdaypos+1, dashpos);
daypos = parseInt(daypos);
daydone = dayposdone.search(daypos);
tempstr = 'w' + week + 'p' + daypos;
daycell = eval('document.getElementById(tempstr)');
......@@ -252,67 +252,67 @@ function repeatExistingDays(){
daytogglerepeating(week,daypos,false);
dayposdone += daypos + ",";
}
}
}
}
function daytogglerepeating(week,daypos,bExists){
var tempstr, daycell, dayoriginal = "";
for (j=1; j<=53; j++)
{
{
tempstr = 'w' + j + 'p' + daypos;
daycell = eval('document.getElementById(tempstr)');
dayoriginalpos = daysSelected.indexOf(tempstr);
//if bExists set to true, means cell is already select it
//unselect it and remove original day from daysSelected string
//unselect it and remove original day from daysSelected string
if (daycell != null)
{
if (bExists){
if (bExists){
daycell.style.backgroundColor = "#FFFFFF"; // white
}
else
{
daycell.style.backgroundColor = "#F08080"; // lightcoral
}
daycell.style.backgroundColor = "#F08080"; // lightcoral
}
if (dayoriginalpos != "-1")
{
{
dayoriginalend = daysSelected.indexOf(',', dayoriginalpos);
tempstr = daysSelected.substring(dayoriginalpos, dayoriginalend+1);
daysSelected = daysSelected.replace(tempstr, "");
}
}
}
}
}
}
}
function daytoggle(id) {
var runrepeat, tempstr = "";
var bFoundValid = false;
iddashpos = id.search("-");
var tempstrdaypos = id.search("p");
var week = id.substring(1,tempstrdaypos);
week = parseInt(week);
if (iddashpos == "-1")
{
idmod = id;
runrepeat = true;
var daypos = id.substr(tempstrdaypos+1);
var daypos = id.substr(tempstrdaypos+1);
}
else
{
{
idmod = id.substring(0,iddashpos);
var daypos = id.substring(tempstrdaypos+1,iddashpos);
}
daypos = parseInt(daypos);
while (!bFoundValid){
var daycell = document.getElementById(idmod);
var daycell = document.getElementById(idmod);
if (daycell != null){
if (rgb2hex(daycell.style.backgroundColor) == "#FF0000"){ // red
daycell.style.backgroundColor = "#FFFFFF"; // white
......@@ -332,7 +332,7 @@ function daytoggle(id) {
else
{
daycell.style.backgroundColor = "#F08080"; // lightcoral
daytogglerepeating(week,daypos,false);
daytogglerepeating(week,daypos,false);
}
daysSelected += id + ",";
}
......@@ -343,7 +343,7 @@ function daytoggle(id) {
//we found an invalid cell when column was clicked, move up to the next week
week++;
tempstr = "w" + week + "p" + daypos;
idmod = tempstr;
idmod = tempstr;
}
}
}
......@@ -355,7 +355,7 @@ function update_month(){
for (i=0; i<=11; i++){
option = document.forms[0].monthsel.options[i].text;
document.popupMonthLayer = eval('document.getElementById (option)');
if(selected == option) {
document.popupMonthLayer.style.display="block";
}
......@@ -379,7 +379,7 @@ function checkForRanges(){
function processEntries(){
var tempstr, starttimehour, starttimemin, stoptimehour, stoptimemin, errors = "";
var passedValidiation = true;
//get time specified
starttimehour = parseInt(document.getElementById("starttimehour").value);
starttimemin = parseInt(document.getElementById("starttimemin").value);
......@@ -387,12 +387,12 @@ function processEntries(){
stoptimemin = parseInt(document.getElementById("stoptimemin").value);
//do time checks
//do time checks
if (starttimehour > stoptimehour)
{
errors = "Error: Start Hour cannot be greater than Stop Hour.";
passedValidiation = false;
}
else if (starttimehour == stoptimehour)
{
......@@ -400,8 +400,8 @@ function processEntries(){
errors = "Error: Start Minute cannot be greater than Stop Minute.";
passedValidiation = false;
}
}
}
if (passedValidiation){
addTimeRange();
}
......@@ -421,11 +421,11 @@ function addTimeRange(){
rtempID = "";
nrtempTime = "";
rtempTime = "";
tempdayarray.sort();
tempdayarray.sort();
rtempFriendlyDay = "";
monthstr = "";
daystr = "";
//check for existing entries
var findCurrentCounter;
for (u=0; u<99; u++){
......@@ -436,25 +436,25 @@ function addTimeRange(){
break;
}
}
if (daysSelected != ""){
//get days selected
for (i=0; i<tempdayarray.length; i++)
{
tempstr = tempdayarray[i];
if (tempstr != "")
{
{
tempstrdaypos = tempstr.search("p");
week = tempstr.substring(1,tempstrdaypos);
week = parseInt(week);
dashpos = tempstr.search("-");
dashpos = tempstr.search("-");
if (dashpos != "-1")
{
{
var nonrepeatingfound = true;
daypos = tempstr.substring(tempstrdaypos+1, dashpos);
daypos = parseInt(daypos);
monthpos = tempstr.search("m");
daypos = parseInt(daypos);
monthpos = tempstr.search("m");
tempstrdaypos = tempstr.search("d");
month = tempstr.substring(monthpos+1, tempstrdaypos);
month = parseInt(month);
......@@ -465,16 +465,16 @@ function addTimeRange(){
nrtempID += tempstr + ",";
}
else
{
{
var repeatingfound = true;
daypos = tempstr.substr(tempstrdaypos+1);
daypos = parseInt(daypos);
daypos = parseInt(daypos);
rtempFriendlyDay += daypos + ",";
rtempID += daypos + ",";
}
}
}
rtempID += daypos + ",";
}
}
}
//code below spits out friendly look format for nonrepeating schedules
var foundEnd = false;
var firstDayFound = false;
......@@ -499,8 +499,8 @@ function addTimeRange(){
nextDay = tempFriendlyDayArray[k+1];
nextDay = parseInt(nextDay);
//get next month
currentDay++;
currentDay++;
if ((currentDay != nextDay) || (tempFriendlyMonthArray[k] != tempFriendlyMonthArray[k+1])){
if (firstprint)
nrtempFriendlyTime += ", ";
......@@ -508,13 +508,13 @@ function addTimeRange(){
if (currentDay != firstDay)
nrtempFriendlyTime += month_array[firstMonth-1] + " " + firstDay + "-" + currentDay;
else
nrtempFriendlyTime += month_array[firstMonth-1] + " " + currentDay;
firstDayFound = false;
firstprint = true;
nrtempFriendlyTime += month_array[firstMonth-1] + " " + currentDay;
firstDayFound = false;
firstprint = true;
}
}
}
}
}
//code below spits out friendly look format for repeating schedules
foundEnd = false;
firstDayFound = false;
......@@ -536,7 +536,7 @@ function addTimeRange(){
//get next day
nextDay = tempFriendlyDayArray[k+1];
nextDay = parseInt(nextDay);
currentDay++;
currentDay++;
if (currentDay != nextDay){
if (firstprint)
rtempFriendlyTime += ", ";
......@@ -545,12 +545,12 @@ function addTimeRange(){
rtempFriendlyTime += day_array[firstDay-1] + " - " + day_array[currentDay-1];
else
rtempFriendlyTime += day_array[firstDay-1];
firstDayFound = false;
firstprint = true;
firstDayFound = false;
firstprint = true;
}
}
}
}
//sort the tempID
var tempsortArray = rtempID.split(",");
var isFirstdone = false;
......@@ -567,32 +567,32 @@ function addTimeRange(){
else
rtempID += "," + tempsortArray[t];
}
}
}
//get time specified
starttimehour = document.getElementById("starttimehour").value
starttimemin = document.getElementById("starttimemin").value;
stoptimehour = document.getElementById("stoptimehour").value;
stoptimemin = document.getElementById("stoptimemin").value;
timeRange = "||" + starttimehour + ":";
timeRange += starttimemin + "-";
timeRange += stoptimehour + ":";
timeRange += stoptimemin;
timeRange += stoptimehour + ":";
timeRange += stoptimemin;
//get description for time range
var tempdescr = document.getElementById("timerangedescr").value
var tempdescr = document.getElementById("timerangedescr").value
if (nonrepeatingfound){
nrtempTime += nrtempID;
//add time ranges
nrtempTime += timeRange;
nrtempTime += timeRange;
//add description
nrtempTime += "||" + tempdescr;
insertElements(nrtempFriendlyTime, starttimehour, starttimemin, stoptimehour, stoptimemin, tempdescr, nrtempTime, nrtempID);
}
if (repeatingfound){
rtempTime += rtempID;
//add time ranges
......@@ -601,7 +601,7 @@ function addTimeRange(){
rtempTime += "||" + tempdescr;
insertElements(rtempFriendlyTime, starttimehour, starttimemin, stoptimehour, stoptimemin, tempdescr, rtempTime, rtempID);
}
}
else
{
......@@ -611,42 +611,42 @@ function addTimeRange(){
}
function insertElements(tempFriendlyTime, starttimehour, starttimemin, stoptimehour, stoptimemin, tempdescr, tempTime, tempID){
//add it to the schedule list
d = document;
tbody = d.getElementById("scheduletable").getElementsByTagName("tbody").item(0);
tr = d.createElement("tr");
td = d.createElement("td");
td.innerHTML= "<span class='vexpl'>" + tempFriendlyTime + "<\/span>";
tr.appendChild(td);
tr.appendChild(td);
td = d.createElement("td");
td.innerHTML="<input type='text' readonly class='vexpl' name='starttime" + schCounter + "' id='starttime" + schCounter + "' style=' word-wrap:break-word; width:100%; border:0px solid;' value='" + starttimehour + ":" + starttimemin + "' />";
tr.appendChild(td);
td = d.createElement("td");
td.innerHTML="<input type='text' readonly class='vexpl' name='stoptime" + schCounter + "' id='stoptime" + schCounter + "' style=' word-wrap:break-word; width:100%; border:0px solid;' value='" + stoptimehour + ":" + stoptimemin + "' />";
tr.appendChild(td);
td = d.createElement("td");
td.innerHTML="<input type='text' readonly class='vexpl' name='timedescr" + schCounter + "' id='timedescr" + schCounter + "' style=' word-wrap:break-word; width:100%; border:0px solid;' value='" + tempdescr + "' />";
tr.appendChild(td);
td = d.createElement("td");
td.innerHTML = "<a onclick='editRow(\"" + tempTime + "\",this); return false;' href='#' class=\"btn btn-default btn-xs\"><span class=\"glyphicon glyphicon-pencil\"></span></\a>";
tr.appendChild(td);
td = d.createElement("td");
td.innerHTML = "<a onclick='removeRow(this); return false;' href='#' class=\"btn btn-default btn-xs\"><span class=\"glyphicon glyphicon-remove\"></span></\a>";
tr.appendChild(td);
td = d.createElement("td");
td.innerHTML="<input type='hidden' id='schedule" + schCounter + "' name='schedule" + schCounter + "' value='" + tempID + "' />";
td = d.createElement("td");
td.innerHTML="<input type='hidden' id='schedule" + schCounter + "' name='schedule" + schCounter + "' value='" + tempID + "' />";
tr.appendChild(td);
tbody.appendChild(tr);
schCounter++;
//reset calendar and time and descr
clearCalendar();
clearTime();
......@@ -666,10 +666,10 @@ function clearCalendar(){
tempstr = 'w' + j + 'p' + k;
daycell = eval('document.getElementById(tempstr)');
if (daycell != null){
daycell.style.backgroundColor = "#FFFFFF"; // white
}
daycell.style.backgroundColor = "#FFFFFF"; // white
}
}
}
}
}
function clearTime(){
......@@ -685,44 +685,44 @@ function clearDescr(){
function editRow(incTime, el) {
var check = checkForRanges();
if (check){
if (check){
//reset calendar and time
clearCalendar();
clearTime();
var starttimehour, descr, days, tempstr, starttimemin, hours, stoptimehour, stoptimemin = "";
var starttimehour, descr, days, tempstr, starttimemin, hours, stoptimehour, stoptimemin = "";
tempArray = incTime.split ("||");
days = tempArray[0];
hours = tempArray[1];
descr = tempArray[2];
var tempdayArray = days.split(",");
var temphourArray = hours.split("-");
tempstr = temphourArray[0];
var temphourArray2 = tempstr.split(":");
document.getElementById("starttimehour").value = temphourArray2[0];
document.getElementById("starttimemin").value = temphourArray2[1];
document.getElementById("starttimemin").value = temphourArray2[1];
tempstr = temphourArray[1];
temphourArray2 = tempstr.split(":");
document.getElementById("stoptimehour").value = temphourArray2[0];
document.getElementById("stoptimemin").value = temphourArray2[1];
document.getElementById("timerangedescr").value = descr;
//toggle the appropriate days
for (i=0; i<tempdayArray.length; i++)
{
if (tempdayArray[i]){
var tempweekstr = tempdayArray[i];
dashpos = tempweekstr.search("-");
dashpos = tempweekstr.search("-");
if (dashpos == "-1")
{
tempstr = "w2p" + tempdayArray[i];
......@@ -756,7 +756,7 @@ function removeRow(el) {
var cel;
while (el && el.nodeName.toLowerCase() != "tr")
el = el.parentNode;
if (el && el.parentNode) {
cel = el.getElementsByTagName("td").item(0);
el.parentNode.removeChild(el);
......@@ -775,52 +775,52 @@ EOD;
<section class="page-content-main">
<div class="container-fluid">
<div class="container-fluid">
<div class="row">
<?php if ($input_errors) print_input_errors($input_errors); ?>
<div id="inputerrors"></div>
<section class="col-xs-12">
<div class="content-box">
<header class="content-box-head container-fluid">
<h3><?=gettext("Schedule information");?></h3>
</header>
<div class="content-box-main">
<form action="firewall_schedule_edit.php" method="post" name="iform" id="iform">
<div class="content-box">
<header class="content-box-head container-fluid">
<h3><?=gettext("Schedule information");?></h3>
</header>
<div class="content-box-main">
<form action="firewall_schedule_edit.php" method="post" name="iform" id="iform">
<div class="table-responsive">
<table class="table table-striped table-sort">
<tbody>
<tr>
<tbody>
<tr>
<td width="15%" valign="top" class="vncellreq"><?=gettext("Schedule Name");?></td>
<td width="85%" class="vtable">
<?php if(is_schedule_inuse($pconfig['name']) == true): ?>
<input name="name" type="hidden" id="name" size="40" value="<?=htmlspecialchars($pconfig['name']);?>" />
<input name="name" type="hidden" id="name" size="40" value="<?=htmlspecialchars($pconfig['name']);?>" />
<?php echo $pconfig['name']; ?>
<p>
<span class="vexpl"><?=gettext("NOTE: This schedule is in use so the name may not be modified!");?></span>
</p>
<?php else: ?>
<input name="name" type="text" id="name" size="40" maxlength="40" class="form-control unknown" value="<?=htmlspecialchars($pconfig['name']);?>" /><br />
<span class="vexpl">
<?=gettext("The name of the alias may only consist of the characters a-z, A-Z and 0-9");?>
</span>
<?php endif; ?>
<span class="vexpl">
<?=gettext("The name of the alias may only consist of the characters a-z, A-Z and 0-9");?>
</span>
<?php endif; ?>
</td>
</tr>
<tr>
<td width="15%" valign="top" class="vncell"><?=gettext("Description");?></td>
<td width="85%" class="vtable"><input name="descr" type="text" id="descr" size="40" maxlength="40" class="form-control unknown" value="<?=htmlspecialchars($pconfig['descr']);?>" /><br />
<span class="vexpl">
<?=gettext("You may enter a description here for your reference (not parsed).");?>
</span>
<span class="vexpl">
<?=gettext("You may enter a description here for your reference (not parsed).");?>
</span>
</td>
</tr>
<!-- tr>
......@@ -829,13 +829,13 @@ EOD;
<td width="15%" valign="top" class="vncellreq"><?=gettext("Month");?></td>
<td width="85%" class="vtable">
<select name="monthsel" class="form-control" id="monthsel" onchange="update_month();">
<?php
$monthcounter = date("n");
$monthlimit = $monthcounter + 12;
$yearcounter = date("Y");
for ($k=0; $k<12; $k++){?>
<option value="<?php echo $monthcounter;?>"><?php echo date("F_y", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));?></option>
<?php
<?php
$monthcounter = date("n");
$monthlimit = $monthcounter + 12;
$yearcounter = date("Y");
for ($k=0; $k<12; $k++){?>
<option value="<?php echo $monthcounter;?>"><?php echo date("F_y", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));?></option>
<?php
if ($monthcounter == 12)
{
$monthcounter = 1;
......@@ -844,30 +844,30 @@ EOD;
else
{
$monthcounter++;
}
} ?>
}
} ?>
</select><br /><br />
<?php
$firstmonth = TRUE;
$monthcounter = date("n");
$yearcounter = date("Y");
for ($k=0; $k<12; $k++){
<?php
$firstmonth = TRUE;
$monthcounter = date("n");
$yearcounter = date("Y");
for ($k=0; $k<12; $k++){
$firstdayofmonth = date("w", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));
if ($firstdayofmonth == 0)
$firstdayofmonth = 7;
$daycounter = 1;
//number of day in month
$numberofdays = date("t", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));
$firstdayprinted = FALSE;
$lasttr = FALSE;
$positioncounter = 1;//7 for Sun, 1 for Mon, 2 for Tues, etc
?>
<div id="<?php echo date("F_y",mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));?>" style=" position:relative; display:<?php if($firstmonth)echo "block";else echo "none";?>">
<table border="1" cellspacing="1" cellpadding="1" id="calTable<?=$monthcounter . $yearcounter;?>" class="tabcont " summary="month">
$positioncounter = 1;//7 for Sun, 1 for Mon, 2 for Tues, etc
?>
<div id="<?php echo date("F_y",mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));?>" style=" position:relative; display:<?php if($firstmonth)echo "block";else echo "none";?>">
<table border="1" cellspacing="1" cellpadding="1" id="calTable<?=$monthcounter . $yearcounter;?>" class="tabcont " summary="month">
<thead>
<tr><td colspan="7" align="center" class="listbg"><?php echo date("F_Y", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));?></td></tr>
<tr>
<tr>
<td align="center" class="listhdrr" style="cursor: pointer;" onclick="daytoggle('w1p1');"><u><?=gettext("Mon");?></u></td>
<td align="center" class="listhdrr" style="cursor: pointer;" onclick="daytoggle('w1p2');"><u><?=gettext("Tue");?></u></td>
<td align="center" class="listhdrr" style="cursor: pointer;" onclick="daytoggle('w1p3');"><u><?=gettext("Wed");?></u></td>
......@@ -878,15 +878,15 @@ EOD;
</tr>
</thead>
<tbody>
<?php
$firstmonth = FALSE;
<?php
$firstmonth = FALSE;
while ($daycounter<=$numberofdays){
$weekcounter = date("W", mktime(0, 0, 0, date($monthcounter), date($daycounter), date($yearcounter)));
$weekcounter = ltrim($weekcounter, "0");
if ($positioncounter == 1)
{
echo "<tr>";
}
}
if ($firstdayofmonth == $positioncounter){?>
<td align="center" style="cursor: pointer;" class="listr" id="w<?=$weekcounter;?>p<?=$positioncounter;?>" onclick="daytoggle('w<?=$weekcounter;?>p<?=$positioncounter;?>-m<?=$monthcounter;?>d<?=$daycounter;?>');">
<?php echo $daycounter;
......@@ -904,7 +904,7 @@ EOD;
{
echo "<td align=\"center\" class=\"listr\"></td>";
}
if ($positioncounter == 7 || $daycounter > $numberofdays){
$positioncounter = 1;
echo "</tr>";
......@@ -912,13 +912,13 @@ EOD;
else{
$positioncounter++;
}
}//end while loop?>
}//end while loop?>
</tbody>
</table>
</div>
<?php
<?php
if ($monthcounter == 12)
{
$monthcounter = 1;
......@@ -927,7 +927,7 @@ EOD;
else
{
$monthcounter++;
}
}
} //end for loop
?>
<br />
......@@ -937,79 +937,79 @@ EOD;
<tr>
<td width="15%" valign="top" class="vncellreq"><?=gettext("Time");?></td>
<td width="85%" class="vtable">
<table cellspacing="2" class="tabcont" summary="time">
<tr>
<td class="listhdrr" align="center"><?=gettext("Start Time");?></td><td></td><td class="listhdrr" align="center"><?=gettext("Stop Time");?></td>
</tr>
<tr>
<td>
<select name="starttimehour" class="form-control" id="starttimehour">
<?php
for ($i=0; $i<24; $i++)
{
echo "<option value=\"$i\">";
echo $i;
echo "</option>";
}
?>
</select>&nbsp;<?=gettext("Hr"); ?>&nbsp;&nbsp;
<select name="starttimemin" class="form-control" id="starttimemin">
<option value="00">00</option>
<option value="15">15</option>
<option value="30">30</option>
<option value="45">45</option>
<option value="59">59</option>
</select>&nbsp;<?=gettext("Min"); ?>
</td>
<td></td>
<td>
<select name="stoptimehour" class="form-control" id="stoptimehour">
<?php
for ($i=0; $i<24; $i++)
{
if ($i==23)
$selected = "selected=\"selected\"";
else
$selected = "";
echo "<option value=\"$i\" $selected>";
echo $i;
echo "</option>";
}
?>
</select>&nbsp;<?=gettext("Hr");?>&nbsp;&nbsp;
<select name="stoptimemin" class="form-control" id="stoptimemin">
<option value="00">00</option>
<option value="15">15</option>
<option value="30">30</option>
<option value="45">45</option>
<option value="59" selected="selected">59</option>
</select>&nbsp;<?=gettext("Min");?>
</td>
</tr>
</table><br />
<table cellspacing="2" class="tabcont" summary="time">
<tr>
<td class="listhdrr" align="center"><?=gettext("Start Time");?></td><td></td><td class="listhdrr" align="center"><?=gettext("Stop Time");?></td>
</tr>
<tr>
<td>
<select name="starttimehour" class="form-control" id="starttimehour">
<?php
for ($i=0; $i<24; $i++)
{
echo "<option value=\"$i\">";
echo $i;
echo "</option>";
}
?>
</select>&nbsp;<?=gettext("Hr"); ?>&nbsp;&nbsp;
<select name="starttimemin" class="form-control" id="starttimemin">
<option value="00">00</option>
<option value="15">15</option>
<option value="30">30</option>
<option value="45">45</option>
<option value="59">59</option>
</select>&nbsp;<?=gettext("Min"); ?>
</td>
<td></td>
<td>
<select name="stoptimehour" class="form-control" id="stoptimehour">
<?php
for ($i=0; $i<24; $i++)
{
if ($i==23)
$selected = "selected=\"selected\"";
else
$selected = "";
echo "<option value=\"$i\" $selected>";
echo $i;
echo "</option>";
}
?>
</select>&nbsp;<?=gettext("Hr");?>&nbsp;&nbsp;
<select name="stoptimemin" class="form-control" id="stoptimemin">
<option value="00">00</option>
<option value="15">15</option>
<option value="30">30</option>
<option value="45">45</option>
<option value="59" selected="selected">59</option>
</select>&nbsp;<?=gettext("Min");?>
</td>
</tr>
</table><br />
<?=gettext("Select the time range for the day(s) selected on the Month(s) above. A full day is 0:00-23:59.")?>
</td>
</tr>
<tr>
<td width="15%" valign="top" class="vncell"><?=gettext("Time Range Description")?></td>
<td width="85%" class="vtable"><input name="timerangedescr" type="text" class="form-control unknown" id="timerangedescr" size="40" maxlength="40" /><br />
<span class="vexpl">
<?=gettext("You may enter a description here for your reference (not parsed).")?>
</span>
</td>
<span class="vexpl">
<?=gettext("You may enter a description here for your reference (not parsed).")?>
</span>
</td>
</tr>
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
<input type="button" value="<?=gettext("Add Time");?>" class="btn btn-default" onclick="javascript:processEntries();" />&nbsp;&nbsp;&nbsp;
<input type="button" value="<?=gettext("Clear Selection");?>" class="btn btn-default" onclick="javascript:clearCalendar(); clearTime(); clearDescr();" />
<input type="button" value="<?=gettext("Add Time");?>" class="btn btn-default" onclick="javascript:processEntries();" />&nbsp;&nbsp;&nbsp;
<input type="button" value="<?=gettext("Clear Selection");?>" class="btn btn-default" onclick="javascript:clearCalendar(); clearTime(); clearDescr();" />
</td>
</tr>
<tr>
<td width="15%" valign="top" class="vtable"></td>
<td width="85%" class="vtable"></td>
</tr>
</tr>
</tbody>
</table>
<table class="table table-striped">
......@@ -1018,7 +1018,7 @@ EOD;
<td colspan="2" valign="top" class="listtopic"><?=gettext("Schedule repeat");?></td>
</tr>
</thead>
<tbody>
<tbody>
<tr>
<td width="15%" valign="top" class="vncellreq"><?=gettext("Configured Ranges");?></td>
<td width="85%">
......@@ -1033,29 +1033,29 @@ EOD;
<?php
if ($getSchedule){
$counter = 0;
foreach($pconfig['timerange'] as $timerange) {
$tempFriendlyTime = "";
$tempID = "";
if ($timerange){
$dayFriendly = "";
$tempFriendlyTime = "";
$timedescr = $timerange['rangedescr'];
$timedescr = $timerange['rangedescr'];
//get hours
$temptimerange = $timerange['hour'];
$temptimeseparator = strrpos($temptimerange, "-");
$starttime = substr ($temptimerange, 0, $temptimeseparator);
$stoptime = substr ($temptimerange, $temptimeseparator+1);
$starttime = substr ($temptimerange, 0, $temptimeseparator);
$stoptime = substr ($temptimerange, $temptimeseparator+1);
$currentDay = "";
$firstDay = "";
$nextDay = "";
$foundEnd = false;
$firstDayFound = false;
$firstPrint = false;
$firstPrint = false;
$firstprint2 = false;
if ($timerange['month']){
$tempmontharray = explode(",", $timerange['month']);
$tempdayarray = explode(",",$timerange['day']);
......@@ -1067,24 +1067,24 @@ EOD;
//if sunday, set position to 7 to get correct week number. This is due to php limitations on ISO-8601. When we move to php5.1 we can change this.
if ($daypos == 0){
$daypos = 7;
}
}
$weeknumber = date("W", mktime(0, 0, 0, date($month), date($day), date("Y")));
$weeknumber = ltrim($weeknumber, "0");
$weeknumber = ltrim($weeknumber, "0");
if ($firstPrint)
{
$tempID .= ",";
}
$tempID .= "w" . $weeknumber . "p" . $daypos . "-m" . $month . "d" . $day;
$firstPrint = true;
if (!$firstDayFound)
{
$firstDay = $day;
$firstmonth = $month;
$firstDayFound = true;
}
$currentDay = $day;
$nextDay = $tempdayarray[$arraycounter+1];
$currentDay++;
......@@ -1096,21 +1096,21 @@ EOD;
$tempFriendlyTime .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ;
else
$tempFriendlyTime .= $monthArray[$month-1] . " " . $day;
$firstDayFound = false;
$firstDayFound = false;
$firstprint2 = true;
}
$arraycounter++;
}
}
$arraycounter++;
}
}
else
{
$dayFriendly = $timerange['position'];
$tempID = $dayFriendly;
}
}
$tempTime = $tempID . "||" . $starttime . "-" . $stoptime . "||" . $timedescr;
//following code makes the days friendly appearing, IE instead of Mon, Tues, Wed it will show Mon - Wed
$foundEnd = false;
$firstDayFound = false;
......@@ -1120,7 +1120,7 @@ EOD;
$firstDay = "";
$nextDay = "";
$i = 0;
if (!$timerange['month']){
if (!$timerange['month']){
foreach ($tempFriendlyDayArray as $day){
if ($day != ""){
if (!$firstDayFound)
......@@ -1131,7 +1131,7 @@ EOD;
$currentDay =$tempFriendlyDayArray[$i];
//get next day
$nextDay = $tempFriendlyDayArray[$i+1];
$currentDay++;
$currentDay++;
if ($currentDay != $nextDay){
if ($firstprint)
$tempFriendlyTime .= ", ";
......@@ -1140,51 +1140,51 @@ EOD;
$tempFriendlyTime .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1];
else
$tempFriendlyTime .= $dayArray[$firstDay-1];
$firstDayFound = false;
$firstprint = true;
$firstDayFound = false;
$firstprint = true;
}
$i++;
}
}
}
}
}
?>
<tr>
<td>
<span class="vexpl"><?php echo $tempFriendlyTime; ?></span>
</td>
<td>
<span class="vexpl"><?php echo $tempFriendlyTime; ?></span>
</td>
<td>
<input type='text' readonly='readonly' class='vexpl' name='starttime<?php echo $counter; ?>' id='starttime<?php echo $counter; ?>' style=' word-wrap:break-word; width:100%; border:0px solid;' value='<?php echo $starttime; ?>' />
</td>
<td>
<input type='text' readonly='readonly' class='vexpl' name='stoptime<?php echo $counter; ?>' id='stoptime<?php echo $counter; ?>' style=' word-wrap:break-word; width:100%; border:0px solid;' value='<?php echo $stoptime; ?>' />
<input type='text' readonly='readonly' class='vexpl' name='stoptime<?php echo $counter; ?>' id='stoptime<?php echo $counter; ?>' style=' word-wrap:break-word; width:100%; border:0px solid;' value='<?php echo $stoptime; ?>' />
</td>
<td>
<input type='text' readonly='readonly' class='vexpl' name='timedescr<?php echo $counter; ?>' id='timedescr<?php echo $counter; ?>' style=' word-wrap:break-word; width:100%; border:0px solid;' value='<?php echo $timedescr; ?>' />
<input type='text' readonly='readonly' class='vexpl' name='timedescr<?php echo $counter; ?>' id='timedescr<?php echo $counter; ?>' style=' word-wrap:break-word; width:100%; border:0px solid;' value='<?php echo $timedescr; ?>' />
</td>
<td>
<a onclick='editRow("<?php echo $tempTime; ?>",this); return false;' href='#' class="btn btn-default"><span class="glyphicon glyphicon-edit"></span></a>
<a onclick='editRow("<?php echo $tempTime; ?>",this); return false;' href='#' class="btn btn-default"><span class="glyphicon glyphicon-edit"></span></a>
</td>
<td>
<a onclick='removeRow(this); return false;' href='#' class="btn btn-default"><span class="glyphicon glyphicon-remove"></span></a>
<a onclick='removeRow(this); return false;' href='#' class="btn btn-default"><span class="glyphicon glyphicon-remove"></span></a>
</td>
<td>
<input type='hidden' id='schedule<?php echo $counter; ?>' name='schedule<?php echo $counter; ?>' value='<?php echo $tempID; ?>' />
<input type='hidden' id='schedule<?php echo $counter; ?>' name='schedule<?php echo $counter; ?>' value='<?php echo $tempID; ?>' />
</td>
</tr>
<?php
$counter++;
}//end if
} // end foreach
}//end if
}//end if
} // end foreach
}//end if
?>
</tbody>
</table>
</tbody>
</table>
</td>
</tr>
<tr>
<tr>
<td width="15%" valign="top">&nbsp;</td>
<td width="85%">
<input id="submit" name="submit" type="submit" onclick="return checkForRanges();" class="btn btn-primary" value="<?=gettext("Save"); ?>" />
......@@ -1193,7 +1193,7 @@ EOD;
<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
<?php endif; ?>
</td>
</tr>
</tr>
</tbody>
</table>
</div>
......@@ -1204,4 +1204,4 @@ EOD;
</div>
</div>
</section>
<?php include("foot.inc"); ?>
\ No newline at end of file
<?php include("foot.inc"); ?>
......@@ -56,14 +56,14 @@ $shortcut_section = "trafficshaper";
$shaperIFlist = get_configured_interface_with_descr();
read_altq_config();
/*
/*
* The whole logic in these code maybe can be specified.
* If you find a better way contact me :).
*/
if ($_GET) {
if ($_GET['queue'])
$qname = trim($_GET['queue']);
$qname = trim($_GET['queue']);
if ($_GET['interface'])
$interface = htmlspecialchars(trim($_GET['interface']));
if ($_GET['action'])
......@@ -71,7 +71,7 @@ if ($_GET) {
}
if ($_POST) {
if ($_POST['name'])
$qname = htmlspecialchars(trim($_POST['name']));
$qname = htmlspecialchars(trim($_POST['name']));
if ($_POST['interface'])
$interface = htmlspecialchars(trim($_POST['interface']));
if ($_POST['parentqueue'])
......@@ -137,26 +137,26 @@ if ($_GET) {
/* XXX: Find better way because we shouldn't know about this */
if ($altq) {
switch ($altq->GetScheduler()) {
case "PRIQ":
$q = new priq_queue();
break;
case "PRIQ":
$q = new priq_queue();
break;
case "FAIRQ":
$q = new fairq_queue();
break;
case "HFSC":
$q = new hfsc_queue();
break;
$q = new hfsc_queue();
break;
case "CBQ":
$q = new cbq_queue();
break;
break;
default:
/* XXX: Happens when sched==NONE?! */
$q = new altq_root_queue();
break;
}
break;
}
} else if ($addnewaltq) {
$q = new altq_root_queue();
} else
} else
$input_errors[] = gettext("Could not create new queue/discipline!");
if ($q) {
......@@ -170,7 +170,7 @@ if ($_GET) {
}
break;
case "show":
if ($queue)
if ($queue)
$output_form .= $queue->build_form();
else
$input_errors[] = gettext("Queue not found!");
......@@ -204,7 +204,7 @@ if ($_GET) {
if ($addnewaltq) {
$altq =& new altq_root_queue();
$altq->SetInterface($interface);
switch ($altq->GetBwscale()) {
case "Mb":
$factor = 1000 * 1000;
......@@ -222,14 +222,14 @@ if ($_GET) {
default: /* XXX assume Kb by default. */
$factor = 1000;
break;
}
}
$altq->SetAvailableBandwidth($altq->GetBandwidth() * $factor);
$altq->ReadConfig($_POST);
$altq->validate_input($_POST, $input_errors);
if (!$input_errors) {
unset($tmppath);
$tmppath[] = $altq->GetInterface();
$altq->SetLink($tmppath);
$altq->SetLink($tmppath);
$altq->wconfig();
if (write_config())
mark_subsystem_dirty('shaper');
......@@ -251,9 +251,9 @@ if ($_GET) {
$can_enable = true;
if ($tmp->CanHaveChildren() && $can_enable) {
if ($tmp->GetDefault() <> "")
$can_add = false;
else
$can_add = true;
$can_add = false;
else
$can_add = true;
} else
$can_add = false;
if (write_config())
......@@ -266,7 +266,7 @@ if ($_GET) {
$can_add = true;
}
read_altq_config();
$output_form .= $tmp->build_form();
$output_form .= $tmp->build_form();
} else
$input_errors[] = gettext("Could not add new queue.");
} else if ($_POST['apply']) {
......@@ -275,19 +275,19 @@ if ($_GET) {
$retval = 0;
$retval = filter_configure();
$savemsg = get_std_save_message($retval);
if (stristr($retval, "error") <> true)
$savemsg = get_std_save_message($retval);
else
$savemsg = $retval;
/* reset rrd queues */
/* reset rrd queues */
system("rm -f /var/db/rrd/*queuedrops.rrd");
system("rm -f /var/db/rrd/*queues.rrd");
enable_rrd_graphing();
clear_subsystem_dirty('shaper');
if ($queue) {
$output_form .= $queue->build_form();
$dontshow = false;
......@@ -305,7 +305,7 @@ if ($_GET) {
if (write_config())
mark_subsystem_dirty('shaper');
$dontshow = false;
}
}
read_altq_config();
$output_form .= $queue->build_form();
} else {
......@@ -323,7 +323,7 @@ if ($queue) {
$can_enable = true;
else
$can_enable = false;
if ($queue->CanHaveChildren() && $can_enable) {
if ($queue->CanHaveChildren() && $can_enable) {
if ($altq->GetQname() <> $queue->GetQname() && $queue->GetDefault() <> "")
$can_add = false;
else
......@@ -350,7 +350,7 @@ $output_form .= "</td><td valign=\"middle\" class=\"vncellreq\" width=\"78%\"><b
$output_form .= "<input type=\"submit\" name=\"Submit\" value=\"" . gettext("Save") . "\" class=\"btn btn-primary\" />";
if ($can_add || $addnewaltq) {
$output_form .= "<a href=\"firewall_shaper.php?interface=";
$output_form .= $interface;
$output_form .= $interface;
if ($queue) {
$output_form .= "&amp;queue=" . $queue->GetQname();
}
......@@ -373,7 +373,7 @@ $output_form .= "</a>";
$output_form .= "<br /></td></tr>";
$output_form .= "</table>";
}
else
else
$output_form .= "</table>";
$output = "<table summary=\"output form\">";
......@@ -393,27 +393,27 @@ if ($queue)
echo $queue->build_javascript();
echo $newjavascript;
include("fbegin.inc");
include("fbegin.inc");
?>
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
<div class="container-fluid">
<div class="row">
<div id="inputerrors"></div>
<?php if ($input_errors) print_input_errors($input_errors); ?>
<?php if ($savemsg) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('shaper')): ?>
<?php print_info_box_np(gettext("The traffic shaper configuration has been changed.")."<br />".gettext("You must apply the changes in order for them to take effect."));?><br />
<?php endif; ?>
<section class="col-xs-12">
<?php
<?php
$tab_array = array();
$tab_array[0] = array(gettext("By Interface"), true, "firewall_shaper.php");
$tab_array[1] = array(gettext("By Queue"), false, "firewall_shaper_queues.php");
......@@ -422,15 +422,15 @@ include("fbegin.inc");
$tab_array[4] = array(gettext("Wizards"), false, "firewall_shaper_wizards.php");
display_top_tabs($tab_array);
?>
<div class="tab-content content-box col-xs-12">
<div class="tab-content content-box col-xs-12">
<form action="firewall_shaper.php" method="post" name="iform" id="iform">
<div class="table-responsive">
<table class="table table-striped table-sort">
<?php if (count($altq_list_queues) > 0): ?>
<tr class="tabcont"><td width="25%" align="left">
......@@ -442,16 +442,16 @@ include("fbegin.inc");
<tr>
<td width="25%" valign="top" align="left" style="vertical-align:top">
<?php
echo $tree;
echo $tree;
?>
</td>
<td width="75%" valign="top" align="center">
<div id="shaperarea" style="position:relative">
<?php
echo $output;
?>
?>
</div>
</td></tr>
</table>
</div>
......@@ -461,5 +461,5 @@ include("fbegin.inc");
</div>
</div>
</section>
<?php include("foot.inc"); ?>
\ No newline at end of file
<?php include("foot.inc"); ?>
......@@ -391,31 +391,31 @@ function removeRow(tbl,row) {
<body>
<?
$main_buttons = array(
array('label'=>gettext("Create new l7 rules group"), 'href'=>'firewall_shaper_layer7.php?action=add'),
);
);
include("fbegin.inc");
include("fbegin.inc");
?>
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
<div class="container-fluid">
<div class="row">
<div id="inputerrors"></div>
<?php if ($input_errors) print_input_errors($input_errors); ?>
<?php if ($savemsg) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('shaper')): ?><p>
<?php print_info_box_np(gettext("The traffic shaper configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?><br /></p>
<?php endif; ?>
<section class="col-xs-12">
<?php
<?php
$tab_array = array();
$tab_array[0] = array(gettext("By Interface"), false, "firewall_shaper.php");
$tab_array[1] = array(gettext("By Queue"), false, "firewall_shaper_queues.php");
......@@ -424,34 +424,34 @@ include("fbegin.inc");
$tab_array[4] = array(gettext("Wizards"), false, "firewall_shaper_wizards.php");
display_top_tabs($tab_array);
?>
<div class="tab-content content-box col-xs-12">
<div class="tab-content content-box col-xs-12">
<form action="firewall_shaper_layer7.php" method="post" name="iform" id="iform">
<div class="table-responsive">
<table class="table table-striped table-sort">
<?php if (count($layer7_rules_list) > 0): ?>
<tr class="tabcont"><td width="25%" align="left">
</td><td width="75%"> </td></tr>
<?php endif; ?>
<tr>
<td width="25%" valign="top" align="left">
<?php
echo $tree;
?>
</td>
<td width="75%" valign="top" align="center">
<div id="shaperarea" style="position:relative">
<?php
echo $output;
?>
<!-- Layer 7 rules form -->
<?php if($show_proto_form): ?>
<tr><td width="22%" valign="top" class="vncellreq">
......@@ -459,11 +459,11 @@ include("fbegin.inc");
<?=gettext("Rule(s)"); ?>
</div>
</td>
<td width="78%" class="vtable">
<table width="236" id="maintable" summary="main table">
<tbody>
<tr>
<td colspan="4">
<div style="font-size: 8pt; padding:5px; margin-top: 16px; margin-bottom: 16px; border:1px dashed #000066;"
......@@ -472,7 +472,7 @@ include("fbegin.inc");
</div>
</td>
</tr>
<tr>
<td>
<div style="font-size: 8pt; padding:5px;"
......@@ -480,14 +480,14 @@ include("fbegin.inc");
<?=gettext("Protocol"); ?>
</div>
</td>
<td>
<div style="font-size: 8pt; padding:5px;"
id="twocolumn">
<?=gettext("Structure"); ?>
</div>
</td>
<td>
<div style="font-size: 8pt; padding:5px;"
id="threecolumn">
......@@ -556,29 +556,29 @@ include("fbegin.inc");
<a onclick="removeRow('maintable',this.parentNode.parentNode); return false;" href="#" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-remove"></span></a>
</td>
</tr>
<?php
} //end foreach
} //end if
?>
</tbody>
</table>
<a onclick="javascript:addRow('maintable'); return false;" href="#" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span></a><br/><br/>
</td>
</tr>
<tr>
<td width="22%" valign="top">
&nbsp;
</td>
<td width="78%">
<input id="submit" name="submit" type="submit" class="btn btn-primary" value="<?=gettext("Save"); ?>" />
<a href="firewall_shaper_layer7.php">
<input id="cancelbutton" name="cancelbutton" type="button" class="btn btn-default" value="<?=gettext("Cancel"); ?>" />
<?php if($container): ?>
<input id="delete" type="submit" class="formbtn" name="delete" value="<?=gettext("Delete"); ?>" />
<?php endif ?>
......@@ -597,4 +597,4 @@ include("fbegin.inc");
</section>
<?php include("foot.inc"); ?>
\ No newline at end of file
<?php include("foot.inc"); ?>
......@@ -54,7 +54,7 @@ $shaperIFlist = get_configured_interface_with_descr();
read_altq_config();
$qlist =& get_unique_queue_list();
if (!is_array($qlist))
if (!is_array($qlist))
$qlist = array();
$tree = "<ul class=\"tree\" >";
......@@ -62,14 +62,14 @@ foreach ($qlist as $queue => $qkey) {
$tree .= "<li><a href=\"firewall_shaper_queues.php?queue={$queue}&amp;action=show\" >";
if (isset($shaperIFlist[$queue]))
$tree .= $shaperIFlist[$queue] . "</a></li>";
else
else
$tree .= $queue . "</a></li>";
}
$tree .= "</ul>";
if ($_GET) {
if ($_GET['queue'])
$qname = htmlspecialchars(trim($_GET['queue']));
$qname = htmlspecialchars(trim($_GET['queue']));
if ($_GET['interface'])
$interface = htmlspecialchars(trim($_GET['interface']));
if ($_GET['action'])
......@@ -80,7 +80,7 @@ if ($_GET) {
$altq =& $altq_list_queues[$interface];
$qtmp =& $altq->find_queue("", $qname);
if ($qtmp) {
$qtmp->delete_queue();
$qtmp->delete_queue();
if (write_config())
mark_subsystem_dirty('shaper');
}
......@@ -88,7 +88,7 @@ if ($_GET) {
exit;
break;
case "add":
/*
/*
* XXX: WARNING: This returns the first it finds.
* Maybe the user expects something else?!
*/
......@@ -102,7 +102,7 @@ if ($_GET) {
$config['shaper']['queue'][] = $copycfg;
} else if ($aq) {
$tmp1 =& $qtmp->find_parentqueue($interface, $qname);
if ($tmp1)
if ($tmp1)
$tmp =& $aq->find_queue($interface, $tmp1->GetQname());
if ($tmp)
......@@ -161,7 +161,7 @@ if ($_POST['apply']) {
else
$savemsg = $retval;
/* reset rrd queues */
/* reset rrd queues */
system("rm -f /var/db/rrd/*queuedrops.rrd");
system("rm -f /var/db/rrd/*queues.rrd");
enable_rrd_graphing();
......@@ -183,21 +183,21 @@ include("head.inc");
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
<div class="container-fluid">
<div class="row">
<div id="inputerrors"></div>
<?php if ($input_errors) print_input_errors($input_errors); ?>
<?php if ($savemsg) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('shaper')): ?><p>
<?php print_info_box_np(gettext("The traffic shaper configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?><br /></p>
<?php endif; ?>
<section class="col-xs-12">
<?php
<?php
$tab_array = array();
$tab_array[0] = array(gettext("By Interface"), false, "firewall_shaper.php");
$tab_array[1] = array(gettext("By Queue"), true, "firewall_shaper_queues.php");
......@@ -206,13 +206,13 @@ include("head.inc");
$tab_array[4] = array(gettext("Wizards"), false, "firewall_shaper_wizards.php");
display_top_tabs($tab_array);
?>
<div class="tab-content content-box col-xs-12">
<div class="tab-content content-box col-xs-12">
<form action="firewall_shaper_queues.php" method="post" name="iform" id="iform">
<div class="table-responsive">
<table class="table table-striped table-sort">
<tr>
......@@ -220,14 +220,14 @@ include("head.inc");
<?php echo $tree; ?>
</td>
<td width="70%" valign="top" align="center">
<?php
<?php
if ($qname)
echo "<p class=\"pgtitle\">" . $qname . "</p><br />";
echo "<p class=\"pgtitle\">" . $qname . "</p><br />";
echo "<table align=\"center\" class=\"tabcont\" width=\"80%\" border=\"0\" cellpadding=\"4\" cellspacing=\"0\" summary=\"output form\">";
echo $output;
echo "<tr><td>&nbsp;</td></tr>";
echo "</table>";
?>
?>
</td></tr>
</table><!-- table:main area -->
</div><!-- div:main area -->
......@@ -237,6 +237,6 @@ include("head.inc");
</div>
</div>
</section>
<?php include("foot.inc"); ?>
\ No newline at end of file
<?php include("foot.inc"); ?>
......@@ -54,14 +54,14 @@ $pgtitle = array(gettext("Firewall"),gettext("Traffic Shaper"), gettext("Limiter
$shortcut_section = "trafficshaper-limiters";
read_dummynet_config();
/*
/*
* The whole logic in these code maybe can be specified.
* If you find a better way contact me :).
*/
if ($_GET) {
if ($_GET['queue'])
$qname = htmlspecialchars(trim($_GET['queue']));
$qname = htmlspecialchars(trim($_GET['queue']));
if ($_GET['pipe'])
$pipe = htmlspecialchars(trim($_GET['pipe']));
if ($_GET['action'])
......@@ -69,11 +69,11 @@ if ($_GET) {
}
if ($_POST) {
if ($_POST['name'])
$qname = htmlspecialchars(trim($_POST['name']));
$qname = htmlspecialchars(trim($_POST['name']));
else if ($_POST['newname'])
$qname = htmlspecialchars(trim($_POST['newname']));
$qname = htmlspecialchars(trim($_POST['newname']));
if ($_POST['pipe'])
$pipe = htmlspecialchars(trim($_POST['pipe']));
$pipe = htmlspecialchars(trim($_POST['pipe']));
else
$pipe = htmlspecialchars(trim($qname));
if ($_POST['parentqueue'])
......@@ -155,7 +155,7 @@ if ($_GET) {
} else if ($addnewpipe) {
$q = new dnpipe_class();
$q->SetQname($pipe);
} else
} else
$input_errors[] = gettext("Could not create new queue/discipline!");
if ($q) {
......@@ -166,7 +166,7 @@ if ($_GET) {
}
break;
case "show":
if ($queue)
if ($queue)
$output_form .= $queue->build_form();
else
$input_errors[] = gettext("Queue not found!");
......@@ -204,7 +204,7 @@ if ($_GET) {
$input_errors[] = gettext("You cannot name a child queue with the same name as a parent limiter");
else {
$dnpipe =& new dnpipe_class();
$dnpipe->ReadConfig($_POST);
$dnpipe->validate_input($_POST, $input_errors);
if (!$input_errors) {
......@@ -212,7 +212,7 @@ if ($_GET) {
$dnpipe->SetNumber($number);
unset($tmppath);
$tmppath[] = $dnpipe->GetQname();
$dnpipe->SetLink($tmppath);
$dnpipe->SetLink($tmppath);
$dnpipe->wconfig();
if (write_config())
mark_subsystem_dirty('shaper');
......@@ -250,17 +250,17 @@ if ($_GET) {
$retval = 0;
$retval = filter_configure();
$savemsg = get_std_save_message($retval);
if (stristr($retval, "error") <> true)
$savemsg = get_std_save_message($retval);
else
$savemsg = $retval;
/* XXX: TODO Make dummynet pretty graphs */
/* XXX: TODO Make dummynet pretty graphs */
// enable_rrd_graphing();
clear_subsystem_dirty('shaper');
if ($queue) {
$output_form .= $queue->build_form();
$dontshow = false;
......@@ -278,7 +278,7 @@ if ($_GET) {
if (write_config())
mark_subsystem_dirty('shaper');
$dontshow = false;
}
}
read_dummynet_config();
$output_form .= $queue->build_form();
} else {
......@@ -295,8 +295,8 @@ if ($queue) {
$can_enable = true;
else
$can_enable = false;
if ($queue->CanHaveChildren()) {
$can_add = true;
if ($queue->CanHaveChildren()) {
$can_add = true;
} else
$can_add = false;
}
......@@ -318,7 +318,7 @@ $output_form .= "</td><td valign=\"top\" class=\"vncellreq\" width=\"78%\">";
$output_form .= "<input type=\"submit\" name=\"Submit\" value=\"" . gettext("Save") . "\" class=\"btn btn-primary\" />";
if ($can_add || $addnewaltq) {
$output_form .= "<a href=\"firewall_shaper_vinterface.php?pipe=";
$output_form .= $pipe;
$output_form .= $pipe;
if ($queue) {
$output_form .= "&amp;queue=" . $queue->GetQname();
}
......@@ -337,11 +337,11 @@ if ($queue)
$output_form .= " value=\"" . gettext("Delete this queue") ."\" />";
else
$output_form .= " value=\"" . gettext("Delete Limiter") ."\" />";
$output_form .= "</a>";
$output_form .= "</a>";
$output_form .= "</td></tr>";
$output_form .= "</table>";
}
else
}
else
$output_form .= "</table>";
$output = "<table summary=\"output form\">";
......@@ -372,33 +372,33 @@ if ($queue)
echo $queue->build_javascript();
else
echo $newjavascript;
$main_buttons = array(
array('label'=>gettext("Create new limiter"), 'href'=>'firewall_shaper_vinterface.php?pipe=new&amp;action=add'),
);
include("fbegin.inc");
include("fbegin.inc");
?>
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
<div class="container-fluid">
<div class="row">
<div id="inputerrors"></div>
<?php if ($input_errors) print_input_errors($input_errors); ?>
<?php if ($savemsg) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('shaper')): ?><p>
<?php print_info_box_np(gettext("The traffic shaper configuration has been changed.")."<br />".gettext("You must apply the changes in order for them to take effect."));?><br /></p>
<?php endif; ?>
<section class="col-xs-12">
<?php
<?php
$tab_array = array();
$tab_array[0] = array(gettext("By Interface"), false, "firewall_shaper.php");
$tab_array[1] = array(gettext("By Queue"), false, "firewall_shaper_queues.php");
......@@ -407,13 +407,13 @@ include("fbegin.inc");
$tab_array[4] = array(gettext("Wizards"), false, "firewall_shaper_wizards.php");
display_top_tabs($tab_array);
?>
<div class="tab-content content-box col-xs-12">
<form action="firewall_shaper_vinterface.php" method="post" name="iform" id="iform">
<div class="table-responsive">
<table class="table table-striped table-sort">
<?php if (count($dummynet_pipe_list) > 0): ?>
......@@ -423,17 +423,17 @@ include("fbegin.inc");
<tr>
<td width="25%" valign="top" align="left">
<?php
echo $tree;
echo $tree;
?>
</td>
<td width="75%" valign="top" align="center">
<div id="shaperarea" style="position:relative">
<?php
echo $output;
?>
?>
</div>
</td>
</tr>
</table>
......@@ -444,16 +444,16 @@ include("fbegin.inc");
</div>
</div>
</section>
<script type='text/javascript'>
//<![CDATA[
<?php
$totalrows = 0;
if (is_array($config['dnshaper']) && is_array($config['dnshaper']['queue']))
if (is_array($config['dnshaper']) && is_array($config['dnshaper']['queue']))
$totalrows = count($config['dnshaper']['queue']);
echo "totalrows = {$totalrows}";
?>
//]]>
</script>
<?php include("foot.inc"); ?>
\ No newline at end of file
<?php include("foot.inc"); ?>
......@@ -88,19 +88,19 @@ include("head.inc");
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
<div class="container-fluid">
<div class="row">
<?php if ($input_errors) print_input_errors($input_errors); ?>
<?php if ($savemsg) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('shaper')): ?><p>
<?php print_info_box_np(gettext("The traffic shaper configuration has been changed.")."<br />".gettext("You must apply the changes in order for them to take effect."));?><br /></p>
<?php endif; ?>
<section class="col-xs-12">
<?php
<?php
$tab_array = array();
$tab_array[0] = array(gettext("By Interface"), false, "firewall_shaper.php");
$tab_array[1] = array(gettext("By Queue"), false, "firewall_shaper_queues.php");
......@@ -109,22 +109,22 @@ include("head.inc");
$tab_array[4] = array(gettext("Wizards"), true, "firewall_shaper_wizards.php");
display_top_tabs($tab_array);
?>
<div class="tab-content content-box col-xs-12">
<div class="tab-content content-box col-xs-12">
<form action="firewall_shaper_wizards.php" method="post" name="iform" id="iform">
<div class="table-responsive">
<table class="table table-striped table-sort">
<thead>
<thead>
<tr>
<td class="listhdrr" width="25%"><?=gettext("Wizard function");?></td>
<td class="listhdrr" width="75%"><?=gettext("Wizard Link");?></td>
</tr>
</thead>
<tbody>
</thead>
<tbody>
<?php
foreach ($wizards as $key => $wizard):
?>
......@@ -151,5 +151,5 @@ include("head.inc");
</div>
</div>
</section>
<?php include("foot.inc"); ?>
\ No newline at end of file
<?php include("foot.inc"); ?>
......@@ -68,21 +68,21 @@ if ($_POST) {
if (!empty($ovip))
interface_vip_bring_down($ovip);
if ($a_vip[$vid]) {
switch ($a_vip[$vid]['mode']) {
case "ipalias":
interface_ipalias_configure($a_vip[$vid]);
break;
case "proxyarp":
interface_proxyarp_configure($a_vip[$vid]['interface']);
break;
case "carp":
interface_carp_configure($a_vip[$vid]);
switch ($a_vip[$vid]['mode']) {
case "ipalias":
interface_ipalias_configure($a_vip[$vid]);
break;
case "proxyarp":
interface_proxyarp_configure($a_vip[$vid]['interface']);
break;
case "carp":
interface_carp_configure($a_vip[$vid]);
break;
default:
break;
default:
break;
}
}
}
}
}
@unlink("{$g['tmp_path']}/.firewall_virtual_ip.apply");
}
$retval = 0;
......@@ -147,7 +147,7 @@ if ($_GET['act'] == "del") {
if ($subnet == $if_subnet)
$found_if = true;
$vipiface = $a_vip[$_GET['id']]['interface'];
foreach ($a_vip as $vip_id => $vip) {
if ($vip_id == $_GET['id'])
......@@ -163,7 +163,7 @@ if ($_GET['act'] == "del") {
if ($found_carp === true && $found_other_alias === false && $found_if === false)
$input_errors[] = gettext("This entry cannot be deleted because it is still referenced by a CARP IP with the description") . " {$vip['descr']}.";
}
if (!$input_errors) {
if (!session_id())
session_start();
......@@ -197,7 +197,7 @@ $pgtitle = array(gettext("Firewall"),gettext("Virtual IP Addresses"));
include("head.inc");
$main_buttons = array(
array('href'=>'firewall_virtual_ip_edit.php', 'label'=>'Add'),
array('href'=>'firewall_virtual_ip_edit.php', 'label'=>'Add'),
);
?>
......@@ -205,41 +205,41 @@ $main_buttons = array(
<?php include("fbegin.inc"); ?>
<section class="page-content-main">
<div class="container-fluid">
<div class="container-fluid">
<div class="row">
<?php
if ($input_errors)
<?php
if ($input_errors)
print_input_errors($input_errors);
else
if ($savemsg)
print_info_box($savemsg);
if ($savemsg)
print_info_box($savemsg);
else
if (is_subsystem_dirty('vip'))
print_info_box_np(gettext("The VIP configuration has been changed.")."<br />".gettext("You must apply the changes in order for them to take effect."));
?>
<section class="col-xs-12">
<?php
<?php
/* active tabs */
$tab_array = array();
$tab_array[] = array(gettext("Virtual IPs"), true, "firewall_virtual_ip.php");
$tab_array[] = array(gettext("CARP Settings"), false, "system_hasync.php");
display_top_tabs($tab_array);
?>
<div class="tab-content content-box col-xs-12">
<div class="tab-content content-box col-xs-12">
<form action="firewall_virtual_ip.php" method="post" name="iform" id="iform">
<input type="hidden" id="id" name="id" value="<?php echo htmlspecialchars($id); ?>" />
<input type="hidden" id="id" name="id" value="<?php echo htmlspecialchars($id); ?>" />
<div class="table-responsive">
<table class="table table-striped table-sort">
<thead>
<thead>
<tr>
<td width="30%" class="listhdrr"><?=gettext("Virtual IP address");?></td>
<td width="10%" class="listhdrr"><?=gettext("Interface");?></td>
......@@ -247,8 +247,8 @@ $main_buttons = array(
<td width="40%" class="listhdr"><?=gettext("Description");?></td>
<td width="10%" class="list"></td>
</tr>
</thead>
<tbody>
</thead>
<tbody>
<?php
$interfaces = get_configured_interface_with_descr(false, true);
$interfaces['lo0'] = "Localhost";
......@@ -280,7 +280,7 @@ $main_buttons = array(
<tr>
<td valign="middle">
<a href="firewall_virtual_ip_edit.php?id=<?=$i;?>" class="btn btn-default"><span class="glyphicon glyphicon-edit" title="<?=gettext("Edit");?>"></span></a>
<a href="firewall_virtual_ip.php?act=del&amp;tab=<?=$tab;?>&amp;id=<?=$i;?>" class="btn btn-default" onclick="return confirm('<?=gettext("Do you really want to delete this entry?");?>')"><span class="glyphicon glyphicon-remove"></span></a>
</td>
</tr>
......@@ -289,7 +289,7 @@ $main_buttons = array(
</tr>
<?php endif; ?>
<?php $i++; endforeach; ?>
</tbody>
</tbody>
</table>
</div>
<div class="container-fluid">
......@@ -303,5 +303,5 @@ $main_buttons = array(
</div>
</div>
</section>
<?php include("foot.inc"); ?>
\ No newline at end of file
<?php include("foot.inc"); ?>
......@@ -74,7 +74,7 @@ function find_last_used_vhid() {
global $config, $g;
$vhid = 0;
foreach($config['virtualip']['vip'] as $vip) {
if($vip['vhid'] > $vhid)
if($vip['vhid'] > $vhid)
$vhid = $vip['vhid'];
}
return $vhid;
......@@ -263,7 +263,7 @@ include("head.inc");
<body>
<script type="text/javascript" src="/javascript/jquery.ipv4v6ify.js"></script>
<?php include("fbegin.inc"); ?>
<script type="text/javascript">
......@@ -287,15 +287,15 @@ function enable_change() {
var carpnote = document.createTextNode("<?=gettext("This must be the network's subnet mask. It does not specify a CIDR range.");?>");
var proxyarpnote = document.createTextNode("<?=gettext("This is a CIDR block of proxy ARP addresses.");?>");
var ipaliasnote = document.createTextNode("<?=gettext("This must be the network's subnet mask. It does not specify a CIDR range.");?>");
$mode = get_radio_value(document.iform.mode);
document.iform.password.disabled = $mode != "carp";
document.iform.vhid.disabled = $mode != "carp";
document.iform.advskew.disabled = $mode != "carp";
document.iform.advbase.disabled = $mode != "carp";
document.iform.type.disabled = $mode in {"carp":1,"ipalias":1};
if ($mode in {"carp":1,"ipalias":1})
document.iform.type.selectedIndex = 0;// single-adress
switch($mode)
......@@ -346,29 +346,29 @@ function typesel_change() {
</script>
<section class="page-content-main">
<div class="container-fluid">
<div class="container-fluid">
<div class="row">
<?php if ($input_errors) print_input_errors($input_errors); ?>
<div id="inputerrors"></div>
<section class="col-xs-12">
<div class="content-box">
<header class="content-box-head container-fluid">
<h3><?=gettext("Edit Virtual IP");?></h3>
</header>
<div class="content-box-main">
<form action="firewall_virtual_ip_edit.php" method="post" name="iform" id="iform">
<div class="content-box">
<header class="content-box-head container-fluid">
<h3><?=gettext("Edit Virtual IP");?></h3>
</header>
<div class="content-box-main">
<form action="firewall_virtual_ip_edit.php" method="post" name="iform" id="iform">
<div class="table-responsive">
<table class="table table-striped table-sort">
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Type");?></td>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Type");?></td>
<td width="78%" class="vtable">
<input name="mode" type="radio" onclick="enable_change()" value="ipalias"
<?php if ($pconfig['mode'] == "ipalias") echo "checked=\"checked\"";?> /> <?=gettext("IP Alias");?>
......@@ -384,7 +384,7 @@ function typesel_change() {
<td width="22%" valign="top" class="vncellreq"><?=gettext("Interface");?></td>
<td width="78%" class="vtable">
<select name="interface" class="form-control">
<?php
<?php
$interfaces = get_configured_interface_with_descr(false, true);
$interfaces['lo0'] = "Localhost";
foreach ($interfaces as $iface => $ifacename): ?>
......@@ -420,13 +420,13 @@ function typesel_change() {
</option>
<?php endfor; ?>
</select> <i id="typenote"></i>
</td>
</td>
</tr>
<tr id="noexpandrow">
<td><?=gettext("Expansion:");?>&nbsp;&nbsp;</td>
<td><input name="noexpand" type="checkbox" class="form-control unknown" id="noexpand" <?php echo (isset($pconfig['noexpand'])) ? "checked=\"checked\"" : "" ; ?> />
Disable expansion of this entry into IPs on NAT lists (e.g. 192.168.1.0/24 expands to 256 entries.)
</td>
Disable expansion of this entry into IPs on NAT lists (e.g. 192.168.1.0/24 expands to 256 entries.)
</td>
</tr>
<?php
/*
......@@ -437,7 +437,7 @@ function typesel_change() {
<input name="range_to" type="text" class="form-control unknown" id="range_to" size="28" value="<?=htmlspecialchars($pconfig['range']['to']);?>" />
</td>
</tr>
*/
*/
?>
</table>
</td>
......@@ -465,18 +465,18 @@ function typesel_change() {
<td class="vtable">
Base: <select id='advbase' name='advbase'>
<?php for ($i = 1; $i <= 254; $i++): ?>
<option value="<?=$i;?>" <?php if ($i == $pconfig['advbase']) echo "selected=\"selected\""; ?>>
<option value="<?=$i;?>" <?php if ($i == $pconfig['advbase']) echo "selected=\"selected\""; ?>>
<?=$i;?>
</option>
</option>
<?php endfor; ?>
</select>
</select>
Skew: <select id='advskew' name='advskew'>
<?php for ($i = 0; $i <= 254; $i++): ?>
<option value="<?=$i;?>" <?php if ($i == $pconfig['advskew']) echo "selected=\"selected\""; ?>>
<option value="<?=$i;?>" <?php if ($i == $pconfig['advskew']) echo "selected=\"selected\""; ?>>
<?=$i;?>
</option>
</option>
<?php endfor; ?>
</select>
</select>
<br /><br />
<?=gettext("The frequency that this machine will advertise. 0 means usually master. Otherwise the lowest combination of both values in the cluster determines the master.");?>
</td>
......@@ -501,16 +501,16 @@ function typesel_change() {
</div>
<div class="container-fluid">
<p class="vexpl">
<span class="text-danger">
<span class="text-danger">
<strong><?=gettext("Note:");?><br /></strong>
</span>
<?=gettext("Proxy ARP and Other type Virtual IPs cannot be bound to by anything running on the firewall, such as IPsec, OpenVPN, etc. Use a CARP or IP Alias type address for these cases.");?>
<br /><br /><?=gettext("For more information on CARP and the above values, visit the OpenBSD ");?><a href='http://www.openbsd.org/faq/pf/carp.html'> <?=gettext("CARP FAQ"); ?></a>.
</span>
<?=gettext("Proxy ARP and Other type Virtual IPs cannot be bound to by anything running on the firewall, such as IPsec, OpenVPN, etc. Use a CARP or IP Alias type address for these cases.");?>
<br /><br /><?=gettext("For more information on CARP and the above values, visit the OpenBSD ");?><a href='http://www.openbsd.org/faq/pf/carp.html'> <?=gettext("CARP FAQ"); ?></a>.
</p>
</div>
</form>
</div>
</div>
</form>
</div>
</div>
</section>
</div>
</div>
......@@ -521,4 +521,4 @@ function typesel_change() {
enable_change();
//]]>
</script>
<?php include("foot.inc"); ?>
\ No newline at end of file
<?php include("foot.inc"); ?>
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