Commit 7e5b2b1e authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

whitespace / codestyle guiconfig.inc

(cherry picked from commit 8098a423)
parent 366ac330
......@@ -289,11 +289,14 @@ function get_std_save_message()
$filter_related = false;
$filter_pages = array("nat", "filter");
$to_return = gettext("The changes have been applied successfully.");
foreach($filter_pages as $fp)
if(stristr($_SERVER['SCRIPT_FILENAME'], $fp))
foreach($filter_pages as $fp) {
if (stristr($_SERVER['SCRIPT_FILENAME'], $fp)) {
$filter_related = true;
if($filter_related)
}
}
if ($filter_related) {
$to_return .= "<br />" . gettext("You can also <a href=\"status_filter_reload.php\">monitor</a> the filter reload progress.");
}
return $to_return;
}
......@@ -311,14 +314,15 @@ function pprint_address($adr) {
if (isset($adr['any'])) {
$padr = "*";
} else if (isset($adr['network'])) {
} elseif (isset($adr['network'])) {
$padr = $specialnets[$adr['network']];
} else {
$padr = isset($adr['address']) ? $adr['address'] : null;
}
if (isset($adr['not']))
if (isset($adr['not'])) {
$padr = "! " . $padr;
}
return $padr;
}
......@@ -328,18 +332,19 @@ function pprint_port($port) {
$pport = "";
if (!$port)
if (!$port) {
return "*";
else {
} else {
$srcport = explode("-", $port);
if ((empty($srcport[1])) || ($srcport[0] == $srcport[1])) {
$pport = $srcport[0];
if (!empty($wkports[$srcport[0]])) {
$pport .= " (" . $wkports[$srcport[0]] . ")";
}
} else
} else {
$pport .= $srcport[0] . " - " . $srcport[1];
}
}
return $pport;
}
......@@ -479,28 +484,30 @@ function dump_log($logfile, $tail, $grepfor = '')
print_dump($logarr);
}
function address_to_pconfig($adr, &$padr, &$pmask, &$pnot, &$pbeginport, &$pendport) {
if (isset($adr['any']))
function address_to_pconfig($adr, &$padr, &$pmask, &$pnot, &$pbeginport, &$pendport)
{
if (isset($adr['any'])) {
$padr = "any";
else if (isset($adr['network']))
} elseif (isset($adr['network'])) {
$padr = $adr['network'];
else if (isset($adr['address'])) {
} elseif (isset($adr['address'])) {
if (strpos($adr['address'], '/') !== false) {
list($padr, $pmask) = explode("/", $adr['address']);
} else {
$padr = $adr['address'];
if (is_ipaddrv6($padr))
if (is_ipaddrv6($padr)) {
$pmask = 128;
else
} else {
$pmask = 32;
}
}
}
if (isset($adr['not']))
if (isset($adr['not'])) {
$pnot = 1;
else
} else {
$pnot = 0;
}
if (isset($adr['port'])) {
if (strpos($adr['port'], '-') !== false) {
......@@ -509,13 +516,14 @@ function address_to_pconfig($adr, &$padr, &$pmask, &$pnot, &$pbeginport, &$pendp
$pbeginport = $adr['port'];
$pendport = $pbeginport;
}
} else if (!is_alias($pbeginport) && !is_alias($pendport)) {
} elseif (!is_alias($pbeginport) && !is_alias($pendport)) {
$pbeginport = "any";
$pendport = "any";
}
}
function pconfig_to_address(&$adr, $padr, $pmask, $pnot=false, $pbeginport=0, $pendport=0) {
function pconfig_to_address(&$adr, $padr, $pmask, $pnot=false, $pbeginport=0, $pendport=0)
{
$adr = array();
if ($padr == "any") {
$adr['any'] = true;
......@@ -526,13 +534,15 @@ function pconfig_to_address(&$adr, $padr, $pmask, $pnot=false, $pbeginport=0, $p
} else {
$adr['address'] = $padr;
if (is_ipaddrv6($padr)) {
if ($pmask != 128)
if ($pmask != 128) {
$adr['address'] .= "/" . $pmask;
}
} else {
if ($pmask != 32)
if ($pmask != 32) {
$adr['address'] .= "/" . $pmask;
}
}
}
if ($pnot) {
$adr['not'] = true;
......@@ -540,7 +550,7 @@ function pconfig_to_address(&$adr, $padr, $pmask, $pnot=false, $pbeginport=0, $p
unset($adr['not']);
}
if(is_alias($pbeginport)) {
if (is_alias($pbeginport)) {
$adr['port'] = $pbeginport;
} elseif (($pbeginport != 0) && ($pbeginport != "any")) {
if ($pbeginport != $pendport) {
......@@ -551,15 +561,18 @@ function pconfig_to_address(&$adr, $padr, $pmask, $pnot=false, $pbeginport=0, $p
}
}
function is_specialnet($net) {
function is_specialnet($net)
{
global $specialsrcdst;
if(!$net)
if (!$net) {
return false;
if (is_array($specialsrcdst) && in_array($net, $specialsrcdst))
}
if (is_array($specialsrcdst) && in_array($net, $specialsrcdst)) {
return true;
else
} else {
return false;
}
}
......@@ -584,29 +597,32 @@ function display_top_tabs(& $tab_array, $no_drop_down = false)
* unset the tab item.
*/
foreach ($tab_array as $tab_id => $ta){
if(!isAllowedPage($ta[2]))
if (!isAllowedPage($ta[2])) {
unset ($tab_array[$tab_id]);
}
}
$tabcharcount = 0;
foreach ($tab_array as $ta)
foreach ($tab_array as $ta) {
$tabcharcount = $tabcharcount + strlen($ta[0]);
}
if($no_drop_down == true) {
if ($no_drop_down == true) {
$tabcharcount = 0;
unset($tab_array_char_limit);
}
// If the character count of the tab names is > 670
// then show a select item dropdown menubox.
if($tabcharcount > $tab_array_char_limit) {
if ($tabcharcount > $tab_array_char_limit) {
echo "<h2>".gettext("Currently viewing: ")."</h2>";
echo "<select class=\"selectpicker\" name=\"TabSelect\" onchange=\"tabs_will_go(this)\" data-live-search=\"true\" data-style=\"btn-default\">\n";
foreach ($tab_array as $ta) {
if($ta[1]=="true")
if ($ta[1]=="true") {
$selected = " selected=\"selected\"";
else
} else {
$selected = "";
}
// Onclick in option will not work in some browser
// echo "<option onclick=\"document.location='{$ta[2]}';\"{$selected}>{$ta['0']}</option>\n";
echo "<option value=\"{$ta[2]}\"{$selected}>{$ta['0']}</option>\n";
......@@ -726,7 +742,6 @@ function get_menu_messages()
} else {
$msg= sprintf("%1$02d",count($notices))." ".gettext("unread notices");
}
$menu_messages.="<a href=\"/\" class=\"dropdown-toggle \" data-toggle=\"dropdown\" role=\"button\" aria-expanded=\"false\"><span class=\"text-primary\">{$msg}&nbsp;</span><span class=\"caret text-primary\"></span></a>{$notice_msgs}\n";
}
} else {
......
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