summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/guiconfig.inc
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2015-12-15 16:44:40 +0545
committerPhil Davis <phil.davis@inf.org>2015-12-15 16:44:40 +0545
commitaa82505e6577c28894150a6fb53c58f914930331 (patch)
tree3c4bc4b73d4dcd4e4e1d87d8acb5068ea14cacf8 /src/usr/local/www/guiconfig.inc
parent7895a8802317a8477929bea6428bf8dfe214306f (diff)
downloadpfsense-aa82505e6577c28894150a6fb53c58f914930331.zip
pfsense-aa82505e6577c28894150a6fb53c58f914930331.tar.gz
Code style g-i
Diffstat (limited to 'src/usr/local/www/guiconfig.inc')
-rw-r--r--src/usr/local/www/guiconfig.inc75
1 files changed, 45 insertions, 30 deletions
diff --git a/src/usr/local/www/guiconfig.inc b/src/usr/local/www/guiconfig.inc
index 7c9c7d8..8df884e 100644
--- a/src/usr/local/www/guiconfig.inc
+++ b/src/usr/local/www/guiconfig.inc
@@ -304,8 +304,9 @@ function verify_gzip_file($fname) {
function print_info_box_np($msg, $name="apply", $value="", $showapply=false, $class="alert-warning") {
global $g;
- if (strpos($class, "alert-") !== 0)
+ if (strpos($class, "alert-") !== 0) {
$class = 'alert-' . $class;
+ }
if (empty($value)) {
$value = gettext("Apply changes");
@@ -316,12 +317,14 @@ function print_info_box_np($msg, $name="apply", $value="", $showapply=false, $cl
if (stristr($msg, gettext("apply")) != false || stristr($msg, gettext("save")) != false || stristr($msg, gettext("create")) != false || $showapply) {
$msg .= '<form method="post" class="pull-right"><button type="submit" class="btn btn-default" name="'. $name .'" value="'.$value.'">'.$name.'</button>';
- if ($_POST['if'])
+ if ($_POST['if']) {
$msg .= "<input type=\"hidden\" name=\"if\" value=\"" . htmlspecialchars($_POST['if']) . "\" />";
+ }
$msg .= '</form>';
- } else
+ } else {
$msg = '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>'. $msg;
+ }
echo '<div class="alert ' . $class . ' clearfix" role="alert">'.$msg.'</div>';
}
@@ -523,18 +526,20 @@ function gentitle($title) {
}
function genhtmltitle($title) {
- if (!is_array($title))
+ if (!is_array($title)) {
return '<h1 class="page-header"><a href="">' . $title . '</a></h1>';
+ }
$heading = '<h1 class="page-header"><a href="">' . end($title) . '</a></h1>';
// If the array contains only one element, there are no breadcrumbs, so don't
// add anything else
- if(count($title) > 1) {
+ if (count($title) > 1) {
$bc = '<ol class="breadcrumb">';
- foreach ($title as $el)
+ foreach ($title as $el) {
$bc .= '<li>'.$el.'</li>';
+ }
$bc .= '</ol>';
} else {
@@ -599,10 +604,12 @@ function dump_clog_no_table($logfile, $tail, $withorig = true, $grepfor = "", $g
if ($config['syslog'][$specific_log]['cronorder'] == 'reverse') $sor = "-r";
$logarr = "";
$grepline = " ";
- if (is_array($grepfor))
+ if (is_array($grepfor)) {
$grepline .= " | /usr/bin/egrep " . escapeshellarg(implode("|", $grepfor));
- if (is_array($grepinvert))
+ }
+ if (is_array($grepinvert)) {
$grepline .= " | /usr/bin/egrep -v " . escapeshellarg(implode("|", $grepinvert));
+ }
if (is_dir($logfile)) {
$logarr = array("File $logfile is a directory.");
} elseif (file_exists($logfile) && filesize($logfile) == 0) {
@@ -611,10 +618,11 @@ function dump_clog_no_table($logfile, $tail, $withorig = true, $grepfor = "", $g
if ($config['system']['disablesyslogclog']) {
exec("cat " . escapeshellarg($logfile) . "{$grepline} | /usr/bin/tail {$sor} -n " . escapeshellarg($tail), $logarr);
} else {
- if (isset($config['system']['usefifolog']))
+ if (isset($config['system']['usefifolog'])) {
exec("/usr/sbin/fifolog_reader " . escapeshellarg($logfile) . "{$grepline} | /usr/bin/tail {$sor} -n " . escapeshellarg($tail), $logarr);
- else
+ } else {
exec("/usr/local/sbin/clog " . escapeshellarg($logfile) . "{$grepline}| grep -v \"CLOG\" | grep -v \"\033\" | /usr/bin/tail {$sor} -n " . escapeshellarg($tail), $logarr);
+ }
}
}
echo "\n";
@@ -626,7 +634,7 @@ function dump_clog_no_table($logfile, $tail, $withorig = true, $grepfor = "", $g
if ($withorig) {
if (isset($config['system']['usefifolog'])) {
- $entry_date_time = htmlspecialchars(date("F j, Y, g:i a","" . $logent[1] . ""));
+ $entry_date_time = htmlspecialchars(date("F j, Y, g:i a", "" . $logent[1] . ""));
$entry_text = htmlspecialchars($logent[5]);
} else {
$entry_date_time = htmlspecialchars(join(" ", array_slice($logent, 0, 3)));
@@ -1048,8 +1056,9 @@ function display_top_tabs(& $tab_array, $no_drop_down = false, $type = 'pills')
$font_color = "white";
$tabcharcount = 0;
- foreach ($tab_array as $ta)
+ foreach ($tab_array as $ta) {
$tabcharcount = $tabcharcount + strlen($ta[0]);
+ }
if ($no_drop_down == true) {
$tabcharcount = 0;
@@ -1063,10 +1072,11 @@ function display_top_tabs(& $tab_array, $no_drop_down = false, $type = 'pills')
echo "<select name=\"TabSelect\" onchange=\"tabs_will_go(this)\">\n";
foreach ($tab_array as $ta) {
- if ($ta[1] == "true")
+ if ($ta[1] == "true") {
$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";
@@ -1101,7 +1111,7 @@ function add_package_tabs($tabgroup, &$tab_array) {
return;
}
- foreach ($config['installedpackages']['package'] as $pkg){
+ foreach ($config['installedpackages']['package'] as $pkg) {
$pkg_config = read_package_configurationfile($pkg['name']);
if (!isset($pkg_config['tabs']['tab'])) {
@@ -1123,32 +1133,31 @@ function add_package_tabs($tabgroup, &$tab_array) {
function alias_info_popup($alias_id) {
global $config;
- if (!is_array($config['aliases']['alias'][$alias_id]))
+ if (!is_array($config['aliases']['alias'][$alias_id])) {
return;
+ }
$maxlength = 60;
$alias = $config['aliases']['alias'][$alias_id];
$content = "";
- if ($alias['url'])
- {
+ if ($alias['url']) {
// TODO: Change it when pf supports tables with ports
if ($alias['type'] == "urltable") {
exec("/sbin/pfctl -t {$alias['name']} -T show | wc -l", $total_entries);
- $counter=preg_replace("/\D/","",$total_entries[0]);
+ $counter=preg_replace("/\D/", "", $total_entries[0]);
exec("/sbin/pfctl -t {$alias['name']} -T show | head -10002", $alias_addresses);
} else {
$urlfn = alias_expand_urltable($alias['name']);
$alias_addresses = explode("\n", file_get_contents($urlfn));
$counter = count($alias_addresses);
}
-
+
$content .= '<h5>'. $alias['url'] .'</h5><ul><li>'. implode('</li><li>', $alias_addresses) .'</li></ul>';
- if ($counter > 10002)
+ if ($counter > 10002) {
$content .= '<i>'. gettext("listing only first 10k items") .'</i>';
- }
- else
- {
+ }
+ } else {
$alias_addresses = explode (" ", $alias['address']);
$alias_details = explode ("||", $alias['detail']);
$idx = 0;
@@ -1176,8 +1185,9 @@ function alias_info_popup($alias_id) {
$content .= "<table>\n";
}
- if (strlen($alias['descr']) >= $maxlength)
+ if (strlen($alias['descr']) >= $maxlength) {
$alias['descr'] = substr($alias['descr'], 0, $maxlength) . '&hellip;';
+ }
return $content;
}
@@ -1185,19 +1195,24 @@ function alias_info_popup($alias_id) {
function rule_columns_with_alias($src, $srcport, $dst, $dstport) {
global $config;
- if ($config['aliases']['alias'] == "" || !is_array($config['aliases']['alias']))
+ if ($config['aliases']['alias'] == "" || !is_array($config['aliases']['alias'])) {
return;
+ }
$columns = array();
foreach ($config['aliases']['alias'] as $alias_id => $alias_name) {
- if ($alias_name['name'] == $src)
+ if ($alias_name['name'] == $src) {
$columns['src'] = $alias_id;
- if ($alias_name['name'] == $srcport)
+ }
+ if ($alias_name['name'] == $srcport) {
$columns['srcport'] = $alias_id;
- if ($alias_name['name'] == $dst )
+ }
+ if ($alias_name['name'] == $dst) {
$columns['dst'] = $alias_id;
- if ($alias_name['name'] == $dstport)
+ }
+ if ($alias_name['name'] == $dstport) {
$columns['dstport'] = $alias_id;
+ }
}
return $columns;
OpenPOWER on IntegriCloud