summaryrefslogtreecommitdiffstats
path: root/usr/local/www/guiconfig.inc
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2013-02-13 10:31:49 -0200
committerRenato Botelho <garga@FreeBSD.org>2013-02-13 10:31:49 -0200
commit96ccd0095e6b7258abf6fa39b262321b65508f48 (patch)
treed9a73741acb5ab11ce4c2c3494b84ff1a13429db /usr/local/www/guiconfig.inc
parent2e2676355addebf2ed2acc94ac6ef5ac78075449 (diff)
downloadpfsense-96ccd0095e6b7258abf6fa39b262321b65508f48.zip
pfsense-96ccd0095e6b7258abf6fa39b262321b65508f48.tar.gz
Fix indent and whitespaces
Diffstat (limited to 'usr/local/www/guiconfig.inc')
-rwxr-xr-xusr/local/www/guiconfig.inc497
1 files changed, 247 insertions, 250 deletions
diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc
index 3de25f0..e2829d0 100755
--- a/usr/local/www/guiconfig.inc
+++ b/usr/local/www/guiconfig.inc
@@ -95,20 +95,20 @@ if(!$ignorefirmwarelock) {
}
}
-$firewall_rules_dscp_types = array("af11",
- "af12",
- "af13",
- "af21",
- "af22",
- "af23",
- "af31",
- "af32",
- "af33",
- "af41",
- "af42",
- "af43",
- "EF",
- "1-64",
+$firewall_rules_dscp_types = array("af11",
+ "af12",
+ "af13",
+ "af21",
+ "af22",
+ "af23",
+ "af31",
+ "af32",
+ "af33",
+ "af41",
+ "af42",
+ "af43",
+ "EF",
+ "1-64",
"0x10",
"0x04-0xfc");
@@ -162,7 +162,7 @@ $netbios_nodetypes = array(
/* some well knows ports */
$wkports = array(
- 5999 => "CVSup",
+ 5999 => "CVSup",
53 => "DNS",
21 => "FTP",
3000 => "HBCI",
@@ -190,7 +190,7 @@ $wkports = array(
1194 => "OpenVPN",
110 => "POP3",
995 => "POP3/S",
- 1723 => "PPTP",
+ 1723 => "PPTP",
1812 => "RADIUS",
1813 => "RADIUS accounting",
5004 => "RTP",
@@ -276,8 +276,7 @@ EOF2;
}
function verify_gzip_file($fname) {
-
- $returnvar = mwexec("/usr/bin/gzip -t " . escapeshellarg($fname));
+ $returnvar = mwexec("/usr/bin/gzip -t " . escapeshellarg($fname));
if ($returnvar != 0)
return 0;
else
@@ -315,7 +314,7 @@ function print_info_box_np($msg, $name="apply",$value="", $showapply=false) {
if(file_exists("/usr/local/www/themes/{$themename}/infobox.php")) {
$toeval = file_get_contents("/usr/local/www/themes/{$themename}/infobox.php");
eval($toeval);
- }
+ }
if(!$savebutton) {
$savebutton = "<td class=\"infoboxsave\"><input value=\"Close\" type=\"button\" onclick=\"jQuery('#redboxtable').hide();\" /></td>";
@@ -363,7 +362,7 @@ function print_info_box_np_undo($msg, $name="apply",$value="Apply changes", $und
$savebutton .= "<input type=\"button\" value=\"Undo\" onclick=\"document.location='{$undo}'\" />";
$savebutton .= "<input name=\"{$name}\" type=\"submit\" class=\"formbtn\" id=\"${name}\" value=\"{$value}\" />";
$savebutton .= "</td>";
- if($_POST['if'])
+ if($_POST['if'])
$savebutton .= "<input type=\"hidden\" name=\"if\" value=\"" . htmlspecialchars($_POST['if']) . "\" />";
}
$nifty_redbox = "#990000";
@@ -379,7 +378,7 @@ function print_info_box_np_undo($msg, $name="apply",$value="Apply changes", $und
if(file_exists("/usr/local/www/themes/{$themename}/infobox.php")) {
$toeval = file_get_contents("/usr/local/www/themes/{$themename}/infobox.php");
eval($toeval);
- }
+ }
if(!$savebutton) {
@@ -399,7 +398,7 @@ function print_info_box_np_undo($msg, $name="apply",$value="Apply changes", $und
<td class="infoboxnptd2">
<b>{$msg}</b>
</td>
- {$savebutton}
+ {$savebutton}
{$undobutton}
</tr>
</table>
@@ -430,9 +429,9 @@ function get_std_save_message($ok) {
$filter_related = false;
$filter_pages = array("nat", "filter");
$to_return = "The changes have been applied successfully.";
- foreach($filter_pages as $fp)
+ foreach($filter_pages as $fp)
if(stristr($_SERVER['SCRIPT_FILENAME'], $fp))
- $filter_related = true;
+ $filter_related = true;
if($filter_related)
$to_return .= "<br/>You can also <a href=\"status_filter_reload.php\">monitor</a> the filter reload progress.";
return $to_return;
@@ -477,45 +476,45 @@ function pprint_port($port) {
}
function firewall_check_for_advanced_options(&$item) {
- $item_set = "";
- if($item['max'])
- $item_set .= "max {$item['max']} ";
- if($item['max-src-nodes'])
- $item_set .= "max-src-nodes {$item['max-src-nodes']} ";
- if($item['max-src-conn'])
- $item_set .= "max-src-conn {$item['max-src-conn']} ";
- if($item['max-src-states'])
- $item_set .= "max-src-states {$item['max-src-states']} ";
- if($item['statetype'] != "keep state" && $item['statetype'] != "")
- $item_set .= "statetype {$item['statetype']} ";
- if($item['statetimeout'])
- $item_set .= "statetimeout {$item['statetimeout']} ";
- if($item['nosync'])
- $item_set .= "nosync ";
- if($item['max-src-conn-rate'])
- $item_set .= "max-src-conn-rate {$item['max-src-conn-rate']} ";
- if($item['max-src-conn-rates'])
- $item_set .= "max-src-conn-rates {$item['max-src-conn-rates']} ";
- if($item['gateway'])
- $item_set .= "gateway {$item['gateway']} ";
- if($item['dnpipe'])
- $item_set .= "limiter {$item['dnpipe']} ";
- if($item['pdnpipe'])
- $item_set .= "limiter {$item['pdnpipe']} ";
- if($item['l7container'])
- $item_set .= "layer7 {$item['l7container']} ";
- if($item['tag'])
- $item_set .= "tag {$item['tag']} ";
- if($item['tagged'])
- $item_set .= "tagged {$item['tagged']} ";
- if(isset($item['allowopts']))
- $item_set .= "allowopts ";
- if(isset($item['disablereplyto']))
- $item_set .= "disable reply-to ";
- if($item['tcpflags_any'] || $item['tcpflags1'] || $item['tcpflags2'])
- $item_set .= "tcpflags set";
-
- return $item_set;
+ $item_set = "";
+ if($item['max'])
+ $item_set .= "max {$item['max']} ";
+ if($item['max-src-nodes'])
+ $item_set .= "max-src-nodes {$item['max-src-nodes']} ";
+ if($item['max-src-conn'])
+ $item_set .= "max-src-conn {$item['max-src-conn']} ";
+ if($item['max-src-states'])
+ $item_set .= "max-src-states {$item['max-src-states']} ";
+ if($item['statetype'] != "keep state" && $item['statetype'] != "")
+ $item_set .= "statetype {$item['statetype']} ";
+ if($item['statetimeout'])
+ $item_set .= "statetimeout {$item['statetimeout']} ";
+ if($item['nosync'])
+ $item_set .= "nosync ";
+ if($item['max-src-conn-rate'])
+ $item_set .= "max-src-conn-rate {$item['max-src-conn-rate']} ";
+ if($item['max-src-conn-rates'])
+ $item_set .= "max-src-conn-rates {$item['max-src-conn-rates']} ";
+ if($item['gateway'])
+ $item_set .= "gateway {$item['gateway']} ";
+ if($item['dnpipe'])
+ $item_set .= "limiter {$item['dnpipe']} ";
+ if($item['pdnpipe'])
+ $item_set .= "limiter {$item['pdnpipe']} ";
+ if($item['l7container'])
+ $item_set .= "layer7 {$item['l7container']} ";
+ if($item['tag'])
+ $item_set .= "tag {$item['tag']} ";
+ if($item['tagged'])
+ $item_set .= "tagged {$item['tagged']} ";
+ if(isset($item['allowopts']))
+ $item_set .= "allowopts ";
+ if(isset($item['disablereplyto']))
+ $item_set .= "disable reply-to ";
+ if($item['tcpflags_any'] || $item['tcpflags1'] || $item['tcpflags2'])
+ $item_set .= "tcpflags set";
+
+ return $item_set;
}
function gentitle($title) {
@@ -527,8 +526,8 @@ function gentitle($title) {
}
function genhtmltitle($title) {
- global $config;
- return gentitle($title);
+ global $config;
+ return gentitle($title);
}
/* update the changedesc and changecount(er) variables */
@@ -547,12 +546,12 @@ function clear_log_file($logfile = "/var/log/system.log") {
unlink($logfile);
touch($logfile);
} else {
- if(isset($config['system']['usefifolog']))
+ if(isset($config['system']['usefifolog']))
exec("/usr/sbin/fifolog_create -s 511488 {$logfile}");
else
exec("/usr/sbin/clog -i -s 511488 {$logfile}");
}
- system_syslogd_start();
+ system_syslogd_start();
}
function dump_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinvert = "") {
@@ -615,7 +614,7 @@ function return_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinve
exec("cat {$logfile}{$grepline} | /usr/bin/tail {$sor} -n {$tail}", $logarr);
} else {
if(isset($config['system']['usefifolog'])) {
- exec("/usr/sbin/fifolog_reader {$logfile}{$grepline} | /usr/bin/tail {$sor} -n {$tail}", $logarr);
+ exec("/usr/sbin/fifolog_reader {$logfile}{$grepline} | /usr/bin/tail {$sor} -n {$tail}", $logarr);
} else {
exec("/usr/sbin/clog {$logfile}{$grepline}| grep -v \"CLOG\" | grep -v \"\033\" | /usr/bin/tail {$sor} -n {$tail}", $logarr);
}
@@ -653,76 +652,74 @@ function update_if_changed($varname, & $orig, $new) {
}
function address_to_pconfig($adr, &$padr, &$pmask, &$pnot, &$pbeginport, &$pendport) {
+ if (isset($adr['any']))
+ $padr = "any";
+ else if ($adr['network'])
+ $padr = $adr['network'];
+ else if ($adr['address']) {
+ list($padr, $pmask) = explode("/", $adr['address']);
+ if (!$pmask)
+ $pmask = 32;
+ }
- if (isset($adr['any']))
- $padr = "any";
- else if ($adr['network'])
- $padr = $adr['network'];
- else if ($adr['address']) {
- list($padr, $pmask) = explode("/", $adr['address']);
- if (!$pmask)
- $pmask = 32;
- }
-
- if (isset($adr['not']))
- $pnot = 1;
- else
- $pnot = 0;
-
- if ($adr['port']) {
- list($pbeginport, $pendport) = explode("-", $adr['port']);
- if (!$pendport)
- $pendport = $pbeginport;
+ if (isset($adr['not']))
+ $pnot = 1;
+ else
+ $pnot = 0;
+
+ if ($adr['port']) {
+ list($pbeginport, $pendport) = explode("-", $adr['port']);
+ if (!$pendport)
+ $pendport = $pbeginport;
} else if (!is_alias($pbeginport) && !is_alias($pendport)) {
$pbeginport = "any";
$pendport = "any";
- }
+ }
}
function pconfig_to_address(&$adr, $padr, $pmask, $pnot=false, $pbeginport=0, $pendport=0) {
+ $adr = array();
+
+ if ($padr == "any")
+ $adr['any'] = true;
+ else if (is_specialnet($padr))
+ $adr['network'] = $padr;
+ else {
+ $adr['address'] = $padr;
+ if ($pmask != 32)
+ $adr['address'] .= "/" . $pmask;
+ }
- $adr = array();
-
- if ($padr == "any")
- $adr['any'] = true;
- else if (is_specialnet($padr))
- $adr['network'] = $padr;
- else {
- $adr['address'] = $padr;
- if ($pmask != 32)
- $adr['address'] .= "/" . $pmask;
- }
-
- if ($pnot)
- $adr['not'] = true;
- else
- unset($adr['not']);
-
- if (($pbeginport != 0) && ($pbeginport != "any")) {
- if ($pbeginport != $pendport)
- $adr['port'] = $pbeginport . "-" . $pendport;
- else
- $adr['port'] = $pbeginport;
- }
-
- if(is_alias($pbeginport)) {
- $adr['port'] = $pbeginport;
- }
+ if ($pnot)
+ $adr['not'] = true;
+ else
+ unset($adr['not']);
+
+ if (($pbeginport != 0) && ($pbeginport != "any")) {
+ if ($pbeginport != $pendport)
+ $adr['port'] = $pbeginport . "-" . $pendport;
+ else
+ $adr['port'] = $pbeginport;
+ }
+
+ if(is_alias($pbeginport)) {
+ $adr['port'] = $pbeginport;
+ }
}
function is_specialnet($net) {
- global $specialsrcdst;
+ global $specialsrcdst;
- if(!$net)
+ if(!$net)
+ return false;
+ if (in_array($net, $specialsrcdst))
+ return true;
+ else
return false;
- if (in_array($net, $specialsrcdst))
- return true;
- else
- return false;
}
//function to create widget tabs when called
-function display_widget_tabs(& $tab_array) {
+function display_widget_tabs(& $tab_array) {
echo "<div id=\"tabs\">";
$tabscounter = 0;
foreach ($tab_array as $ta) {
@@ -733,7 +730,7 @@ function display_widget_tabs(& $tab_array) {
if ($ta[1] == true) {
$tabActive = "table-cell";
$tabNonActive = "none";
- }
+ }
else {
$tabActive = "none";
$tabNonActive = "table-cell";
@@ -760,7 +757,7 @@ function display_widget_tabs(& $tab_array) {
}
-// Return inline javascript file or CSS to minimizie
+// Return inline javascript file or CSS to minimizie
// request count going back to server.
function outputJavaScriptFileInline($javascript) {
if(file_exists($javascript)) {
@@ -854,7 +851,7 @@ function print_rfc2616_select($tag, $current){
if ($current == "")
$current = 200;
- echo "<select id=\"{$tag}\" name=\"{$tag}\">\n";
+ echo "<select id=\"{$tag}\" name=\"{$tag}\">\n";
foreach($rfc2616 as $code => $message) {
if ($code == $current) {
$sel = " selected=\"selected\"";
@@ -867,29 +864,29 @@ function print_rfc2616_select($tag, $current){
// Useful debugging function, much cleaner than print_r
function echo_array($array,$return_me=false){
- if(is_array($array) == false){
- $return = "The provided variable is not an array.";
- }else{
- foreach($array as $name=>$value){
- if(is_array($value)){
- $return .= "";
- $return .= "['<b>$name</b>'] {<div style=\"margin-left:10px;\">\n";
- $return .= echo_array($value,true);
- $return .= "</div>}";
- $return .= "\n\n";
- }else{
- if(is_string($value)){
- $value = "\"$value\"";
- }
- $return .= "['<b>$name</b>'] = $value\n\n";
- }
- }
- }
- if($return_me == true){
- return $return;
- }else{
- echo "<pre>".$return."</pre>";
- }
+ if(is_array($array) == false){
+ $return = "The provided variable is not an array.";
+ }else{
+ foreach($array as $name=>$value){
+ if(is_array($value)){
+ $return .= "";
+ $return .= "['<b>$name</b>'] {<div style=\"margin-left:10px;\">\n";
+ $return .= echo_array($value,true);
+ $return .= "</div>}";
+ $return .= "\n\n";
+ }else{
+ if(is_string($value)){
+ $value = "\"$value\"";
+ }
+ $return .= "['<b>$name</b>'] = $value\n\n";
+ }
+ }
+ }
+ if($return_me == true){
+ return $return;
+ }else{
+ echo "<pre>".$return."</pre>";
+ }
}
/****f* pfsense-utils/display_top_tabs
@@ -901,115 +898,115 @@ function echo_array($array,$return_me=false){
* null
******/
function display_top_tabs(& $tab_array, $no_drop_down = false) {
- global $HTTP_SERVER_VARS;
- global $config;
- global $g;
- global $tab_array_indent;
- global $tab_array_space;
- global $tab_array_char_limit;
-
- /* does the user have access to this tab?
- * master user has access to everything.
- * if the user does not have access, simply
- * unset the tab item.
- */
-
- /* empty string code */
- if ($tab_array_indent == '') {
- $tab_array_indent = 0;
- }
+ global $HTTP_SERVER_VARS;
+ global $config;
+ global $g;
+ global $tab_array_indent;
+ global $tab_array_space;
+ global $tab_array_char_limit;
+
+ /* does the user have access to this tab?
+ * master user has access to everything.
+ * if the user does not have access, simply
+ * unset the tab item.
+ */
+
+ /* empty string code */
+ if ($tab_array_indent == '') {
+ $tab_array_indent = 0;
+ }
- if ($tab_array_space == '') {
- $tab_array_space = 1;
- }
+ if ($tab_array_space == '') {
+ $tab_array_space = 1;
+ }
- if ($tab_array_char_limit == '') {
- $tab_array_char_limit = 92;
- }
+ if ($tab_array_char_limit == '') {
+ $tab_array_char_limit = 92;
+ }
- foreach ($tab_array as $tab_id => $ta){
- if(!isAllowedPage($ta[2]))
- unset ($tab_array[$tab_id]);
- }
+ foreach ($tab_array as $tab_id => $ta){
+ if(!isAllowedPage($ta[2]))
+ unset ($tab_array[$tab_id]);
+ }
- $tab_active_bg = "#EEEEEE";
- $tab_inactive_bg = "#777777";
- $nifty_tabs_corners = "#FFF";
- $font_color = "white";
-
- /* if tabcontrols.php exist for a theme, allow it to be overriden */
- $themename = $config['theme'];
- $filename = "/usr/local/www/themes/{$themename}/tabcontrols.php";
- if(file_exists($filename)) {
- $eval_code = file_get_contents($filename);
- eval($eval_code);
- }
-
- $tabcharcount = 0;
- foreach ($tab_array as $ta)
- $tabcharcount = $tabcharcount + strlen($ta[0]);
-
- if($no_drop_down == true) {
- $tabcharcount = 0;
- unset($tab_array_char_limit);
- }
+ $tab_active_bg = "#EEEEEE";
+ $tab_inactive_bg = "#777777";
+ $nifty_tabs_corners = "#FFF";
+ $font_color = "white";
+
+ /* if tabcontrols.php exist for a theme, allow it to be overriden */
+ $themename = $config['theme'];
+ $filename = "/usr/local/www/themes/{$themename}/tabcontrols.php";
+ if(file_exists($filename)) {
+ $eval_code = file_get_contents($filename);
+ eval($eval_code);
+ }
+
+ $tabcharcount = 0;
+ foreach ($tab_array as $ta)
+ $tabcharcount = $tabcharcount + strlen($ta[0]);
- // If the character count of the tab names is > 670
- // then show a select item dropdown menubox.
- if($tabcharcount > $tab_array_char_limit) {
- echo "Currently viewing: ";
- echo "<select name=\"TabSelect\" onchange=\"tabs_will_go(this)\">\n";
- foreach ($tab_array as $ta) {
- if($ta[1]=="true")
- $selected = " selected=\"selected\"";
- 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";
- }
- echo "</select>\n<p>&nbsp;</p>";
- echo "<script type=\"text/javascript\">";
- echo "\n//<![CDATA[\n";
- echo " function tabs_will_go(obj){ document.location = obj.value; }\n";
- echo "//]]>\n";
- echo "</script>";
- } else {
- echo "<div class=\"newtabmenu\" style=\"margin:{$tab_array_space}px {$tab_array_indent}px; width:775px;\">\n";
- echo "<!-- Tabbed bar code-->\n";
- echo "<ul class=\"newtabmenu\">\n";
- $tabscounter = 0;
- foreach ($tab_array as $ta) {
- if ($ta[1] == true) {
- echo " <li class=\"newtabmenu_active\"><a href=\"{$ta[2]}\"><span>{$ta[0]}</span></a></li>\n";
- } else {
- echo " <li><a href=\"{$ta[2]}\"><span>{$ta[0]}</span></a></li>\n";
- }
- $tabscounter++;
- }
- echo "</ul>\n</div>\n";
- }
+ 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) {
+ echo "Currently viewing: ";
+ echo "<select name=\"TabSelect\" onchange=\"tabs_will_go(this)\">\n";
+ foreach ($tab_array as $ta) {
+ if($ta[1]=="true")
+ $selected = " selected=\"selected\"";
+ 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";
+ }
+ echo "</select>\n<p>&nbsp;</p>";
+ echo "<script type=\"text/javascript\">";
+ echo "\n//<![CDATA[\n";
+ echo " function tabs_will_go(obj){ document.location = obj.value; }\n";
+ echo "//]]>\n";
+ echo "</script>";
+ } else {
+ echo "<div class=\"newtabmenu\" style=\"margin:{$tab_array_space}px {$tab_array_indent}px; width:775px;\">\n";
+ echo "<!-- Tabbed bar code-->\n";
+ echo "<ul class=\"newtabmenu\">\n";
+ $tabscounter = 0;
+ foreach ($tab_array as $ta) {
+ if ($ta[1] == true) {
+ echo " <li class=\"newtabmenu_active\"><a href=\"{$ta[2]}\"><span>{$ta[0]}</span></a></li>\n";
+ } else {
+ echo " <li><a href=\"{$ta[2]}\"><span>{$ta[0]}</span></a></li>\n";
+ }
+ $tabscounter++;
+ }
+ echo "</ul>\n</div>\n";
+ }
}
function add_package_tabs($tabgroup, & $tab_array) {
- global $config, $g;
-
- if(!is_array($config['installedpackages']))
- return;
- if(!is_array($config['installedpackages']['tab']))
- return;
-
- foreach($config['installedpackages']['tab'] as $tab) {
- if ($tab['group'] !== $group)
- continue;
- $tab_entry = array();
- if($tab['name']) {
- $tab_entry[] = $tab['name'];
- $tab_entry[] = false;
- $tab_entry[] = $tab['url'];
- $tab_array[] = $tab_entry;
- }
- }
+ global $config, $g;
+
+ if(!is_array($config['installedpackages']))
+ return;
+ if(!is_array($config['installedpackages']['tab']))
+ return;
+
+ foreach($config['installedpackages']['tab'] as $tab) {
+ if ($tab['group'] !== $group)
+ continue;
+ $tab_entry = array();
+ if($tab['name']) {
+ $tab_entry[] = $tab['name'];
+ $tab_entry[] = false;
+ $tab_entry[] = $tab['url'];
+ $tab_array[] = $tab_entry;
+ }
+ }
}
function alias_info_popup($alias_id){
@@ -1115,7 +1112,7 @@ function rule_popup($src,$srcport,$dst,$dstport){
}
}
return $descriptions;
- }
+ }
}
$timezone = $config['system']['timezone'];
OpenPOWER on IntegriCloud