summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/etc/inc/openvpn.inc36
-rw-r--r--src/usr/local/www/index.php29
-rw-r--r--src/usr/local/www/interfaces.php4
-rw-r--r--src/usr/local/www/services_igmpproxy.php8
-rw-r--r--src/usr/local/www/services_igmpproxy_edit.php18
-rw-r--r--src/usr/local/www/services_ntpd.php12
-rw-r--r--src/usr/local/www/services_ntpd_gps.php14
-rw-r--r--src/usr/local/www/services_ntpd_pps.php8
-rw-r--r--src/usr/local/www/services_pppoe.php8
-rw-r--r--src/usr/local/www/services_pppoe_edit.php37
-rw-r--r--src/usr/local/www/services_rfc2136.php21
-rw-r--r--src/usr/local/www/services_rfc2136_edit.php23
-rw-r--r--src/usr/local/www/services_router_advertisements.php17
-rw-r--r--src/usr/local/www/services_snmp.php21
-rw-r--r--src/usr/local/www/services_unbound.php15
-rw-r--r--src/usr/local/www/services_unbound_acls.php45
-rw-r--r--src/usr/local/www/services_unbound_domainoverride_edit.php3
-rw-r--r--src/usr/local/www/services_unbound_host_edit.php20
-rw-r--r--src/usr/local/www/services_wol.php8
-rw-r--r--src/usr/local/www/services_wol_edit.php3
-rw-r--r--src/usr/local/www/status_openvpn.php39
-rw-r--r--src/usr/local/www/system_camanager.php51
-rw-r--r--src/usr/local/www/system_certmanager.php84
-rw-r--r--src/usr/local/www/system_crlmanager.php66
-rw-r--r--src/usr/local/www/widgets/widgets/dyn_dns_status.widget.php8
-rw-r--r--src/usr/local/www/widgets/widgets/gateways.widget.php2
-rw-r--r--src/usr/local/www/widgets/widgets/log.widget.php2
-rw-r--r--src/usr/local/www/widgets/widgets/openvpn.widget.php39
-rw-r--r--src/usr/local/www/widgets/widgets/picture.widget.php6
-rw-r--r--src/usr/local/www/widgets/widgets/rss.widget.php12
-rw-r--r--src/usr/local/www/widgets/widgets/services_status.widget.php2
-rw-r--r--src/usr/local/www/widgets/widgets/thermal_sensors.widget.php26
-rw-r--r--src/usr/local/www/widgets/widgets/traffic_graphs.widget.php6
33 files changed, 358 insertions, 335 deletions
diff --git a/src/etc/inc/openvpn.inc b/src/etc/inc/openvpn.inc
index da666e3..9dc83c5 100644
--- a/src/etc/inc/openvpn.inc
+++ b/src/etc/inc/openvpn.inc
@@ -1611,6 +1611,42 @@ function openvpn_get_client_status($client, $socket) {
return $client;
}
+function openvpn_kill_client($port, $remipp) {
+ global $g;
+
+ //$tcpsrv = "tcp://127.0.0.1:{$port}";
+ $tcpsrv = "unix://{$g['varetc_path']}/openvpn/{$port}.sock";
+ $errval = null;
+ $errstr = null;
+
+ /* open a tcp connection to the management port of each server */
+ $fp = @stream_socket_client($tcpsrv, $errval, $errstr, 1);
+ $killed = -1;
+ if ($fp) {
+ stream_set_timeout($fp, 1);
+ fputs($fp, "kill {$remipp}\n");
+ while (!feof($fp)) {
+ $line = fgets($fp, 1024);
+
+ $info = stream_get_meta_data($fp);
+ if ($info['timed_out']) {
+ break;
+ }
+
+ /* parse header list line */
+ if (strpos($line, "INFO:") !== false) {
+ continue;
+ }
+ if (strpos($line, "SUCCESS") !== false) {
+ $killed = 0;
+ }
+ break;
+ }
+ fclose($fp);
+ }
+ return $killed;
+}
+
function openvpn_refresh_crls() {
global $g, $config;
diff --git a/src/usr/local/www/index.php b/src/usr/local/www/index.php
index 214f129..ba572d4 100644
--- a/src/usr/local/www/index.php
+++ b/src/usr/local/www/index.php
@@ -308,19 +308,19 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard");
<div class="panel panel-default" id="widget-available">
<div class="panel-heading"><?=gettext("Available Widgets"); ?>
<span class="widget-heading-icon">
- <a data-toggle="collapse" href="#widget-available .panel-body" name="widgets-available">
+ <a data-toggle="collapse" href="#widget-available_panel-body" id="widgets-available">
<i class="fa fa-plus-circle"></i>
</a>
</span>
</div>
- <div class="panel-body collapse out">
+ <div id="widget-available_panel-body" class="panel-body collapse out">
<div class="content">
<div class="row">
<?php
foreach ($widgets as $widgetname => $widgetconfig):
if ($widgetconfig['display'] == 'none'):
?>
- <div class="col-sm-3"><a href="#" name="btnadd-<?=$widgetname?>"><i class="fa fa-plus"></i> <?=$widgetconfig['name']?></a></div>
+ <div class="col-sm-3"><a href="#" id="btnadd-<?=$widgetname?>"><i class="fa fa-plus"></i> <?=$widgetconfig['name']?></a></div>
<?php endif; ?>
<?php endforeach; ?>
</div>
@@ -351,7 +351,7 @@ foreach ($widgets as $widgetname => $widgetconfig):
</div>
<div class="hidden" id="widgetSequence">
- <form action="/" method="post" id="widgetSequence" name="widgetForm">
+ <form action="/" method="post" id="widgetSequence_form" name="widgetForm">
<input type="hidden" name="sequence" value="" />
<button type="submit" id="btnstore" class="btn btn-primary">Store widget configuration</button>
@@ -381,13 +381,12 @@ foreach ($widgets as $widgetname => $widgetconfig) {
<?php
$columnWidth = 12 / $numColumns;
- for ($i=1; $i<=$numColumns; $i++) {
- echo '<div class="col-md-' . $columnWidth . '" id="widgets-col' . $i . '">';
+ for ($currentColumnNumber = 1; $currentColumnNumber <= $numColumns; $currentColumnNumber++) {
+ echo '<div class="col-md-' . $columnWidth . '" id="widgets-col' . $currentColumnNumber . '">';
- //if col$i exists
- if (isset($widgetColumns['col'.$i])) {
-
- $columnWidgets = $widgetColumns['col'.$i];
+ //if col$currentColumnNumber exists
+ if (isset($widgetColumns['col'.$currentColumnNumber])) {
+ $columnWidgets = $widgetColumns['col'.$currentColumnNumber];
foreach ($columnWidgets as $widgetname => $widgetconfig) {
// Compose the widget title and include the title link if available
@@ -403,7 +402,7 @@ foreach ($widgets as $widgetname => $widgetconfig) {
<div class="panel-heading">
<?=$wtitle?>
<span class="widget-heading-icon">
- <a data-toggle="collapse" href="#widget-<?=$widgetname?> .panel-footer" class="config hidden">
+ <a data-toggle="collapse" href="#widget-<?=$widgetname?>_panel-footer" class="config hidden">
<i class="fa fa-wrench"></i>
</a>
<a data-toggle="collapse" href="#widget-<?=$widgetname?>_panel-body">
@@ -422,7 +421,7 @@ foreach ($widgets as $widgetname => $widgetconfig) {
<?php
}
} else {
- echo '<div class="col-md-' . $columnWidth . '" id="widgets-col' . $i . '"></div>';
+ echo '<div class="col-md-' . $columnWidth . '" id="widgets-col' . $currentColumnNumber . '"></div>';
}
echo "</div>";
}
@@ -448,7 +447,7 @@ function updateWidgets(newWidget) {
}
$('#widgetSequence').removeClass('hidden');
- $('input[name=sequence]', $('#widgetSequence')).val(sequence);
+ $('input[name=sequence]', $('#widgetSequence_form')).val(sequence);
}
events.push(function() {
@@ -470,9 +469,9 @@ events.push(function() {
});
// On clicking a widget to install . .
- $('[name^=btnadd-]').click(function(event) {
+ $('[id^=btnadd-]').click(function(event) {
// Add the widget name to the list of displayed widgets
- updateWidgets(this.name.replace('btnadd-', ''));
+ updateWidgets(this.id.replace('btnadd-', ''));
// We don't want to see the "Store" button because we are doing that automatically
$('#btnstore').hide();
diff --git a/src/usr/local/www/interfaces.php b/src/usr/local/www/interfaces.php
index 42871fe..f3cf12f 100644
--- a/src/usr/local/www/interfaces.php
+++ b/src/usr/local/www/interfaces.php
@@ -3556,6 +3556,8 @@ events.push(function() {
var sv = "<?=htmlspecialchars($pconfig['adv_dhcp_pt_values']);?>";
if (sv == "") {
$("input[name=adv_dhcp_pt_values][value='SavedCfg']").prop('checked', true);
+ } else {
+ $("input[name=adv_dhcp_pt_values][value="+sv+"]").prop('checked', true);
}
// Set preset from value
@@ -3616,7 +3618,7 @@ events.push(function() {
});
// On click . .
- $('[id=adv_dhcp_pt_values]').click(function () {
+ $('[name=adv_dhcp_pt_values]').click(function () {
setPresets($('input[name=adv_dhcp_pt_values]:checked').val());
});
diff --git a/src/usr/local/www/services_igmpproxy.php b/src/usr/local/www/services_igmpproxy.php
index afcc8f2..df1f560 100644
--- a/src/usr/local/www/services_igmpproxy.php
+++ b/src/usr/local/www/services_igmpproxy.php
@@ -101,11 +101,13 @@ if ($_GET['act'] == "del") {
$pgtitle = array(gettext("Services"), gettext("IGMP Proxy"));
include("head.inc");
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, 'success');
+}
-if (is_subsystem_dirty('igmpproxy'))
+if (is_subsystem_dirty('igmpproxy')) {
print_info_box_np(gettext('The IGMP entry list has been changed.' . '<br />' . 'You must apply the changes in order for them to take effect.'));
+}
?>
<form action="services_igmpproxy.php" method="post">
@@ -137,7 +139,7 @@ foreach ($a_igmpproxy as $igmpentry):
$addresses = implode(", ", array_slice(explode(" ", $igmpentry['address']), 0, 10));
print($addresses);
- if(count($addresses) < 10) {
+ if (count($addresses) < 10) {
print(' ');
} else {
print('...');
diff --git a/src/usr/local/www/services_igmpproxy_edit.php b/src/usr/local/www/services_igmpproxy_edit.php
index f7b3e1b..371b85a 100644
--- a/src/usr/local/www/services_igmpproxy_edit.php
+++ b/src/usr/local/www/services_igmpproxy_edit.php
@@ -114,7 +114,7 @@ if ($_POST) {
/* item is a normal igmpentry type */
$x = 0;
- while($_POST["address{$x}"]) {
+ while ($_POST["address{$x}"]) {
if ($isfirst > 0) {
$address .= " ";
@@ -151,8 +151,9 @@ if ($_POST) {
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
// These two inputs appear in the original file. Don't know what they are for
// but they are here just in case.
@@ -178,8 +179,9 @@ $section = new Form_Section('IGMP Proxy Edit');
$optionlist = array();
$iflist = get_configured_interface_with_descr();
-foreach ($iflist as $ifnam => $ifdescr)
+foreach ($iflist as $ifnam => $ifdescr) {
$optionlist[$ifnam] = $ifdescr;
+}
$section->addInput(new Form_Select(
'ifname',
@@ -202,7 +204,7 @@ $section->addInput(new Form_Select(
['upstream' => gettext('Upstream Interface'), 'downstream' => gettext('Downstream Interface')]
))->setHelp('The upstream network interface is the outgoing interface which is responsible for communicating to available multicast data sources .' .
'There can only be one upstream interface.' . '<br />' .
- 'Downstream network interfaces are the distribution interfaces to the destination networks, where multicast clients can join groups and '.
+ 'Downstream network interfaces are the distribution interfaces to the destination networks, where multicast clients can join groups and '.
'receive multicast data. One or more downstream interfaces must be configured.');
$section->addInput(new Form_Input(
@@ -213,7 +215,7 @@ $section->addInput(new Form_Input(
))->setHelp('Defines the TTL threshold for the network interface. Packets with a lower TTL than the threshold value will be ignored. ' .
'This setting is optional, and by default the threshold is 1.');
-if (isset($id) && $a_igmpproxy[$id]){
+if (isset($id) && $a_igmpproxy[$id]) {
$section->addInput(new Form_Input(
'id',
null,
@@ -232,13 +234,13 @@ $address = $pconfig['address'];
$item = explode(" ", $address);
$rows = count($item) -1;
-foreach($item as $ww) {
+foreach ($item as $ww) {
$address = $item[$counter];
$address_subnet = "";
$item2 = explode("/", $address);
- foreach($item2 as $current) {
- if($item2[1] != "") {
+ foreach ($item2 as $current) {
+ if ($item2[1] != "") {
$address = $item2[0];
$address_subnet = $item2[1];
}
diff --git a/src/usr/local/www/services_ntpd.php b/src/usr/local/www/services_ntpd.php
index bf9b518..e672f99 100644
--- a/src/usr/local/www/services_ntpd.php
+++ b/src/usr/local/www/services_ntpd.php
@@ -72,7 +72,7 @@ if (!is_array($config['ntpd'])) {
if (empty($config['ntpd']['interface'])) {
if (is_array($config['installedpackages']['openntpd']) && is_array($config['installedpackages']['openntpd']['config']) &&
- is_array($config['installedpackages']['openntpd']['config'][0]) && !empty($config['installedpackages']['openntpd']['config'][0]['interface'])) {
+ is_array($config['installedpackages']['openntpd']['config'][0]) && !empty($config['installedpackages']['openntpd']['config'][0]['interface'])) {
$pconfig['interface'] = explode(",", $config['installedpackages']['openntpd']['config'][0]['interface']);
unset($config['installedpackages']['openntpd']);
write_config("Upgraded settings from openttpd");
@@ -269,10 +269,12 @@ $pgtitle = array(gettext("Services"), gettext("NTP"), gettext("NTP"));
$shortcut_section = "ntp";
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
-if ($savemsg)
+}
+if ($savemsg) {
print_info_box($savemsg, 'success');
+}
$tab_array = array();
$tab_array[] = array(gettext("NTP"), true, "services_ntpd.php");
@@ -296,7 +298,7 @@ $section->addInput(new Form_Select(
'Selecting no interfaces will listen on all interfaces with a wildcard.' . '<br />' .
'Selecting all interfaces will explicitly listen on only the interfaces/IPs specified.');
-$timeservers = explode( ' ', $config['system']['timeservers']);
+$timeservers = explode(' ', $config['system']['timeservers']);
$maxrows = max(count($timeservers), 1);
for ($counter=0; $counter < $maxrows; $counter++) {
$group = new Form_Group($counter == 0 ? 'Time servers':'');
@@ -504,7 +506,7 @@ print($form);
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
+events.push(function() {
// Make the ‘clear’ button a plain button, not a submit button
$('#btnadvstats').prop('type','button');
diff --git a/src/usr/local/www/services_ntpd_gps.php b/src/usr/local/www/services_ntpd_gps.php
index 7bfbde7..5afc183 100644
--- a/src/usr/local/www/services_ntpd_gps.php
+++ b/src/usr/local/www/services_ntpd_gps.php
@@ -208,12 +208,14 @@ function build_nmea_list() {
$nmealist['options'][4] = 'GLL';
$nmealist['options'][8] = 'ZDA or ZDG';
- if(!$pconfig['nmea'])
+ if (!$pconfig['nmea']) {
array_push($nmealist['selected'], 0);
+ }
- foreach($nmealist['options'] as $val => $opt) {
- if($pconfig['nmea'] & $val)
+ foreach ($nmealist['options'] as $val => $opt) {
+ if ($pconfig['nmea'] & $val) {
array_push($nmealist['selected'], $val);
+ }
}
return($nmealist);
@@ -261,7 +263,7 @@ if (!empty($serialports)) {
$splist = array();
foreach ($serialports as $port) {
- $shortport = substr($port,5);
+ $shortport = substr($port, 5);
$splist[$shortport] = $shortport;
}
@@ -424,13 +426,13 @@ print($form);
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
+events.push(function() {
function NMEAChecksum(cmd) {
// Compute the checksum by XORing all the character values in the string.
var checksum = 0;
- for(var i = 0; i < cmd.length; i++) {
+ for (var i = 0; i < cmd.length; i++) {
checksum = checksum ^ cmd.charCodeAt(i);
}
// Convert it to hexadecimal (base-16, upper case, most significant byte first).
diff --git a/src/usr/local/www/services_ntpd_pps.php b/src/usr/local/www/services_ntpd_pps.php
index 615c5d7..98c1b37 100644
--- a/src/usr/local/www/services_ntpd_pps.php
+++ b/src/usr/local/www/services_ntpd_pps.php
@@ -137,11 +137,13 @@ $pgtitle = array(gettext("Services"), gettext("NTP"), gettext("PPS"));
$shortcut_section = "ntp";
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, 'success');
+}
$tab_array = array();
$tab_array[] = array(gettext("NTP"), false, "services_ntpd.php");
@@ -168,7 +170,7 @@ if (!empty($serialports)) {
$splist = array();
foreach ($serialports as $port) {
- $shortport = substr($port,5);
+ $shortport = substr($port, 5);
$splist[$shortport] = $shortport;
}
diff --git a/src/usr/local/www/services_pppoe.php b/src/usr/local/www/services_pppoe.php
index 090e4df..109520b 100644
--- a/src/usr/local/www/services_pppoe.php
+++ b/src/usr/local/www/services_pppoe.php
@@ -113,15 +113,17 @@ if ($_GET['act'] == "del") {
}
}
-$pgtitle = array(gettext("Services"),gettext("PPPoE Server"));
+$pgtitle = array(gettext("Services"), gettext("PPPoE Server"));
$shortcut_section = "pppoes";
include("head.inc");
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, 'success');
+}
-if (is_subsystem_dirty('vpnpppoe'))
+if (is_subsystem_dirty('vpnpppoe')) {
print_info_box_np(gettext('The PPPoE entry list has been changed') . '.<br />' . gettext('You must apply the changes in order for them to take effect.'));
+}
?>
<div class="table-responsive">
diff --git a/src/usr/local/www/services_pppoe_edit.php b/src/usr/local/www/services_pppoe_edit.php
index f358749..03284bb 100644
--- a/src/usr/local/www/services_pppoe_edit.php
+++ b/src/usr/local/www/services_pppoe_edit.php
@@ -88,8 +88,8 @@ $a_pppoes = &$config['pppoes']['pppoe'];
if (is_numericint($_GET['id'])) {
$id = $_GET['id'];
-
-if (isset($_POST['id']) && is_numericint($_POST['id']))
+}
+if (isset($_POST['id']) && is_numericint($_POST['id'])) {
$id = $_POST['id'];
}
@@ -162,7 +162,7 @@ if ($_POST) {
$subnet_start = ip2ulong($_POST['remoteip']);
$subnet_end = ip2ulong($_POST['remoteip']) + $_POST['pppoe_subnet'] - 1;
if ((ip2ulong($_POST['localip']) >= $subnet_start) &&
- (ip2ulong($_POST['localip']) <= $subnet_end)) {
+ (ip2ulong($_POST['localip']) <= $subnet_end)) {
$input_errors[] = gettext("The specified server address lies in the remote subnet.");
}
if ($_POST['localip'] == get_interface_ip($_POST['interface'])) {
@@ -292,21 +292,24 @@ function build_interface_list() {
$interfaces = get_configured_interface_with_descr();
- foreach ($interfaces as $iface => $ifacename)
+ foreach ($interfaces as $iface => $ifacename) {
$list[$iface] = $ifacename;
+ }
return($list);
}
-$pgtitle = array(gettext("Services"),gettext("PPPoE Server"), gettext("Edit"));
+$pgtitle = array(gettext("Services"), gettext("PPPoE Server"), gettext("Edit"));
$shortcut_section = "pppoes";
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, 'success');
+}
$form = new Form();
@@ -431,7 +434,7 @@ $group->add(new Form_Input(
null,
'text',
$pconfig['radiusserverport']
-))->setHelp('Authentication port ');
+))->setHelp('Authentication port');
$group->add(new Form_Input(
'radiusserveracctport',
@@ -464,7 +467,7 @@ $group->add(new Form_Input(
null,
'text',
$pconfig['radiusserver2port']
-))->setHelp('Authentication port ');
+))->setHelp('Authentication port');
$group->add(new Form_Input(
'radiusserver2acctport',
@@ -492,15 +495,16 @@ $usernames = $pconfig['username'];
//DEBUG
//$usernames = 'sbeaver:TXlQYXNzd2Q=:192.168.1.1 smith:TXlQYXNzd2Q=:192.168.2.1 sjones:TXlQYXNzd2Q=:192.168.3.1 salpha:TXlQYXNzd2Q=:192.168.4.1';
-if($usernames == "")
+if ($usernames == "") {
$usernames = '::';
+}
-if ($usernames != ""){
+if ($usernames != "") {
$item = explode(" ", $usernames);
$numrows = count($item) -1;
- foreach($item as $ww) {
+ foreach ($item as $ww) {
$wws = explode(":", $ww);
$user = $wws[0];
$passwd = base64_decode($wws[1]);
@@ -553,7 +557,7 @@ $section->addInput(new Form_StaticText(
));
// Hidden fields
-if(isset($id)) {
+if (isset($id)) {
$section->addInput(new Form_Input(
'id',
null,
@@ -579,7 +583,7 @@ print_info_box(gettext('Don\'t forget to add a firewall rule to permit traffic f
?>
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
+events.push(function() {
// show/hide radius server controls
function hide_radius(hide) {
@@ -607,10 +611,11 @@ events.push(function(){
// When the RADIUS checkbox is clicked . .
$('#radiusenable').click(function () {
hide_radius(!$('#radiusenable').prop('checked'));
- if(!$('#radiusenable').prop('checked'))
+ if (!$('#radiusenable').prop('checked')) {
hide_radius2(true);
- else
+ } else {
hide_radius2(!$('#radiussecenable').prop('checked'));
+ }
});
// When the 'Use backup RADIUS' checkbox is clicked . .
diff --git a/src/usr/local/www/services_rfc2136.php b/src/usr/local/www/services_rfc2136.php
index 59416de..0649abd 100644
--- a/src/usr/local/www/services_rfc2136.php
+++ b/src/usr/local/www/services_rfc2136.php
@@ -75,8 +75,7 @@ if ($_GET['act'] == "del") {
header("Location: services_rfc2136.php");
exit;
-}
-else if ($_GET['act'] == "toggle") {
+} else if ($_GET['act'] == "toggle") {
if ($a_rfc2136[$_GET['id']]) {
if (isset($a_rfc2136[$_GET['id']]['enable'])) {
unset($a_rfc2136[$_GET['id']]['enable']);
@@ -98,8 +97,9 @@ $tab_array[] = array(gettext("Dynamic DNS"), false, "services_dyndns.php");
$tab_array[] = array(gettext("RFC 2136"), true, "services_rfc2136.php");
display_top_tabs($tab_array);
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
?>
<form action="services_rfc2136.php" method="post" name="iform" id="iform">
@@ -147,18 +147,20 @@ foreach ($a_rfc2136 as $rfc2136):
if (file_exists($filename)) {
print('IPv4: ');
- if (isset($rfc2136['usepublicip']))
+ if (isset($rfc2136['usepublicip'])) {
$ipaddr = dyndnsCheckIP($rfc2136['interface']);
- else
+ } else {
$ipaddr = get_interface_ip($rfc2136['interface']);
+ }
$cached_ip_s = explode("|", file_get_contents($filename));
$cached_ip = $cached_ip_s[0];
- if ($ipaddr != $cached_ip)
+ if ($ipaddr != $cached_ip) {
print('<span class="text-danger">');
- else
+ } else {
print('<span class="text-success">');
+ }
print(htmlspecialchars($cached_ip));
print('</span>');
@@ -174,10 +176,11 @@ foreach ($a_rfc2136 as $rfc2136):
$cached_ip_s = explode("|", file_get_contents("{$filename}.ipv6"));
$cached_ip = $cached_ip_s[0];
- if ($ipaddr != $cached_ip)
+ if ($ipaddr != $cached_ip) {
print('<span class="text-danger">');
- else
+ } else {
print('<span class="text-success">');
+ }
print(htmlspecialchars($cached_ip));
print('</span>');
diff --git a/src/usr/local/www/services_rfc2136_edit.php b/src/usr/local/www/services_rfc2136_edit.php
index fa244a1..0c0548a 100644
--- a/src/usr/local/www/services_rfc2136_edit.php
+++ b/src/usr/local/www/services_rfc2136_edit.php
@@ -160,11 +160,13 @@ if ($_POST) {
$pgtitle = array(gettext("Services"), gettext("Dynamic DNS"), gettext("RFC 2136 Client"), gettext("Edit"));
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg);
+}
$form = new Form;
@@ -180,8 +182,9 @@ $section->addInput(new Form_Checkbox(
$optionlist = array();
$iflist = get_configured_interface_with_descr();
-foreach ($iflist as $ifnam => $ifdescr)
+foreach ($iflist as $ifnam => $ifdescr) {
$optionlist[$ifnam] = $ifdescr;
+}
$section->addInput(new Form_Select(
'interface',
@@ -217,7 +220,7 @@ $group->add(new Form_Checkbox(
'keytype',
'Key Type',
'Zone',
- ($pconfig['keytype']=='zone'),
+ ($pconfig['keytype'] == 'zone'),
'zone'
))->displayAsRadio();
@@ -225,7 +228,7 @@ $group->add($input = new Form_Checkbox(
'keytype',
'Key Type',
'Host',
- ($pconfig['keytype']=='host'),
+ ($pconfig['keytype'] == 'host'),
'host'
))->displayAsRadio();
@@ -233,7 +236,7 @@ $group->add($input = new Form_Checkbox(
'keytype',
'Key Type',
'User',
- ($pconfig['keytype']=='user'),
+ ($pconfig['keytype'] == 'user'),
'user'
))->displayAsRadio();
@@ -273,7 +276,7 @@ $group->add(new Form_Checkbox(
'recordtype',
'Record Type',
'A (IPv4)',
- ($pconfig['recordtype']=='A'),
+ ($pconfig['recordtype'] == 'A'),
'A'
))->displayAsRadio();
@@ -281,7 +284,7 @@ $group->add($input = new Form_Checkbox(
'recordtype',
'Record Type',
'AAAA (IPv6)',
- ($pconfig['recordtype']=='AAAA'),
+ ($pconfig['recordtype'] == 'AAAA'),
'AAAA'
))->displayAsRadio();
@@ -289,7 +292,7 @@ $group->add($input = new Form_Checkbox(
'recordtype',
'Record Type',
'Both',
- ($pconfig['recordtype']=='both'),
+ ($pconfig['recordtype'] == 'both'),
'both'
))->displayAsRadio();
@@ -302,7 +305,7 @@ $section->addInput(new Form_Input(
$pconfig['descr']
))->setHelp('You may enter a description here for your reference (not parsed).');
-if (isset($id) && $a_rfc2136[$id]){
+if (isset($id) && $a_rfc2136[$id]) {
$section->addInput(new Form_Input(
'id',
null,
diff --git a/src/usr/local/www/services_router_advertisements.php b/src/usr/local/www/services_router_advertisements.php
index da1c640..1693b4a 100644
--- a/src/usr/local/www/services_router_advertisements.php
+++ b/src/usr/local/www/services_router_advertisements.php
@@ -103,7 +103,7 @@ if (!$if || !isset($iflist[$if])) {
foreach ($iflist as $ifent => $ifname) {
$oc = $config['interfaces'][$ifent];
if ((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))) ||
- (!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6']))))) {
+ (!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6']))))) {
continue;
}
$if = $ifent;
@@ -227,11 +227,13 @@ $pgtitle = array(gettext("Services"), gettext("Router Advertisements"));
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, 'success');
+}
/* active tabs */
$tab_array = array();
@@ -241,7 +243,7 @@ foreach ($iflist as $ifent => $ifname) {
$oc = $config['interfaces'][$ifent];
// We need at least one interface configured with a NON-LOCAL IPv6 static address. fd80:8dba:82e1::/64 fits the bill
if ((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))) ||
- (!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6']))))) {
+ (!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6']))))) {
continue;
}
@@ -324,8 +326,9 @@ $section->addInput(new Form_StaticText(
));
-if(empty($pconfig['subnets']))
+if (empty($pconfig['subnets'])) {
$pconfig['subnets'] = array('0' => '/128');
+}
$counter = 0;
$numrows = count($pconfig['subnets']) - 1;
@@ -364,7 +367,7 @@ $form->add($section);
$section = new Form_Section('DNS Configuration');
-for($idx=1; $idx<=3; $idx++) {
+for ($idx=1; $idx<=3; $idx++) {
$section->addInput(new Form_IpAddress(
'radns' . $idx,
'Server ' . $idx,
@@ -400,7 +403,7 @@ print($form);
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
+events.push(function() {
// Suppress "Delete row" button if there are fewer than two rows
checkLastRow();
diff --git a/src/usr/local/www/services_snmp.php b/src/usr/local/www/services_snmp.php
index 67f5efb..f11c90f 100644
--- a/src/usr/local/www/services_snmp.php
+++ b/src/usr/local/www/services_snmp.php
@@ -213,11 +213,13 @@ $shortcut_section = "snmp";
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg);
+}
$form = new Form();
@@ -277,10 +279,11 @@ $form->add($section);
$section = new Form_Section('SNMP Trap settings');
-if($pconfig['trapenable'])
+if ($pconfig['trapenable']) {
$section->addClass('toggle-traps', 'in');
-else
+} else {
$section->addClass('toggle-traps', 'collapse');
+}
$section->addInput(new Form_Input(
'trapserver',
@@ -372,7 +375,7 @@ print($form);
//<![CDATA[
// hostres requires mibii so we force that here
-events.push(function(){
+events.push(function() {
noMibii = false;
@@ -380,7 +383,7 @@ events.push(function(){
hostresChange();
function hostresChange() {
- if($('#hostres').prop('checked')) {
+ if ($('#hostres').prop('checked')) {
$('#mibii').prop('checked', true);
noMibii = true;
} else {
@@ -388,13 +391,13 @@ events.push(function(){
}
}
- $('#hostres').change(function(){
+ $('#hostres').change(function() {
hostresChange();
});
- $('#mibii').change(function(){
- if(noMibii) {
+ $('#mibii').change(function() {
+ if (noMibii) {
$('#mibii').prop('checked', 'true');
}
});
diff --git a/src/usr/local/www/services_unbound.php b/src/usr/local/www/services_unbound.php
index 17e7f33..ccef9f2 100644
--- a/src/usr/local/www/services_unbound.php
+++ b/src/usr/local/www/services_unbound.php
@@ -238,8 +238,9 @@ function build_if_list($selectedifs) {
foreach ($interface_addresses as $laddr => $ldescr) {
$iflist['options'][$laddr] = htmlspecialchars($ldescr);
- if ($selectedifs && in_array($laddr, $selectedifs))
+ if ($selectedifs && in_array($laddr, $selectedifs)) {
array_push($iflist['selected'], $laddr);
+ }
}
unset($interface_addresses);
@@ -253,11 +254,13 @@ $shortcut_section = "resolver";
include_once("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, 'success');
+}
if (is_subsystem_dirty('unbound')) {
print_info_box_np(gettext("The configuration of the DNS Resolver has been changed. You must apply changes for them to take effect."));
@@ -374,7 +377,7 @@ print($form);
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
+events.push(function() {
// If the enable checkbox is not checked, disable the next three checkboxes
function disableDHCP() {
@@ -407,7 +410,7 @@ events.push(function(){
});
// On initial load
- if($('#custom_options').val().length == 0) {
+ if ($('#custom_options').val().length == 0) {
hideInput('custom_options', true);
}
@@ -551,7 +554,7 @@ endforeach;
" entered in %sSystem: General setup%s".
" or those obtained via DHCP or PPP on WAN if &quot;Allow".
" DNS server list to be overridden by DHCP/PPP on WAN&quot;".
- " is checked."),'<a href="system.php">','</a>'), info)?>
+ " is checked."), '<a href="system.php">', '</a>'), info)?>
</div>
<?php include("foot.inc");
diff --git a/src/usr/local/www/services_unbound_acls.php b/src/usr/local/www/services_unbound_acls.php
index b85565d..94e3d83 100644
--- a/src/usr/local/www/services_unbound_acls.php
+++ b/src/usr/local/www/services_unbound_acls.php
@@ -109,12 +109,14 @@ if ($act == "edit") {
}
}
-if(!is_array($networkacl))
+if (!is_array($networkacl)) {
$networkacl = array();
+}
// Add a row to the networks table
-if($act == 'new')
+if ($act == 'new') {
$networkacl = array('0' => array('acl_network' => '', 'mask' => '', 'description' => ''));
+}
if ($_POST) {
unset($input_errors);
@@ -122,8 +124,8 @@ if ($_POST) {
$deleting = false;
// Delete a row from the networks table
- for($idx = 0; $idx<50; $idx++) {
- if($pconfig['dlt' . $idx] == 'Delete') {
+ for ($idx = 0; $idx < 50; $idx++) {
+ if ($pconfig['dlt' . $idx] == 'Delete') {
unset($networkacl[$idx]);
$deleting = true;
break;
@@ -133,9 +135,10 @@ if ($_POST) {
if ($_POST['apply']) {
$retval = services_unbound_configure();
$savemsg = get_std_save_message($retval);
- if ($retval == 0)
+ if ($retval == 0) {
clear_subsystem_dirty('unbound');
- } else if(!$deleting) {
+ }
+ } else if (!$deleting) {
// input validation - only allow 50 entries in a single ACL
for ($x = 0; $x < 50; $x++) {
@@ -208,14 +211,17 @@ $pgtitle = array(gettext("Services"), gettext("DNS Resolver"), gettext("Access L
$shortcut_section = "resolver";
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, 'success');
+}
-if (is_subsystem_dirty('unbound'))
+if (is_subsystem_dirty('unbound')) {
print_info_box_np(gettext("The configuration of the DNS Resolver, has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));
+}
$tab_array = array();
$tab_array[] = array(gettext("General settings"), false, "/services_unbound.php");
@@ -223,7 +229,7 @@ $tab_array[] = array(gettext("Advanced settings"), false, "services_unbound_adva
$tab_array[] = array(gettext("Access Lists"), true, "/services_unbound_acls.php");
display_top_tabs($tab_array, true);
-if($act=="new" || $act=="edit") {
+if ($act == "new" || $act == "edit") {
$form = new Form();
@@ -251,10 +257,10 @@ if($act=="new" || $act=="edit") {
))->setHelp('Provide an Access List name.');
$section->addInput(new Form_Select(
- 'aclaction',
- 'Action',
- strtolower($pconfig['aclaction']),
- array('allow' => 'Allow','deny' => 'Deny','refuse' => 'Refuse','allow snoop' => 'Allow Snoop')
+ 'aclaction',
+ 'Action',
+ strtolower($pconfig['aclaction']),
+ array('allow' => 'Allow', 'deny' => 'Deny', 'refuse' => 'Refuse', 'allow snoop' => 'Allow Snoop')
))->setHelp($actionHelp);
$section->addInput(new Form_Input(
@@ -267,7 +273,7 @@ if($act=="new" || $act=="edit") {
$numrows = count($networkacl) - 1;
$counter = 0;
- foreach($networkacl as $item) {
+ foreach ($networkacl as $item) {
$network = $item['acl_network'];
$cidr = $item['mask'];
$description = $item['description'];
@@ -305,9 +311,8 @@ if($act=="new" || $act=="edit") {
$form->add($section);
print($form);
-}
-else // NOT 'edit' or 'add'
-{
+} else {
+ // NOT 'edit' or 'add'
?>
<div class="panel panel-default">
<div class="panel-heading"><h2 class="panel-title"><?=gettext('Access Lists to control access to the DNS Resolver')?></h2></div>
@@ -325,7 +330,7 @@ else // NOT 'edit' or 'add'
<tbody>
<?php
$i = 0;
- foreach($a_acls as $acl):
+ foreach ($a_acls as $acl):
?>
<tr ondblclick="document.location='services_unbound_acls.php?act=edit&amp;id=<?=$i?>'">
<td>
@@ -361,7 +366,7 @@ else // NOT 'edit' or 'add'
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
+events.push(function() {
// Suppress "Delete row" button if there are fewer than two rows
checkLastRow();
});
diff --git a/src/usr/local/www/services_unbound_domainoverride_edit.php b/src/usr/local/www/services_unbound_domainoverride_edit.php
index 6a02e6c..01d4cad 100644
--- a/src/usr/local/www/services_unbound_domainoverride_edit.php
+++ b/src/usr/local/www/services_unbound_domainoverride_edit.php
@@ -67,8 +67,9 @@
require("guiconfig.inc");
-if (!is_array($config['unbound']['domainoverrides']))
+if (!is_array($config['unbound']['domainoverrides'])) {
$config['unbound']['domainoverrides'] = array();
+}
$a_domainOverrides = &$config['unbound']['domainoverrides'];
diff --git a/src/usr/local/www/services_unbound_host_edit.php b/src/usr/local/www/services_unbound_host_edit.php
index 787b39b..6f87318 100644
--- a/src/usr/local/www/services_unbound_host_edit.php
+++ b/src/usr/local/www/services_unbound_host_edit.php
@@ -213,28 +213,30 @@ if ($_POST) {
}
// Delete a row in the options table
-if($_GET['act'] == "delopt") {
+if ($_GET['act'] == "delopt") {
$idx = $_GET['id'];
- if($pconfig['aliases'] && is_array($pconfig['aliases']['item'][$idx])) {
+ if ($pconfig['aliases'] && is_array($pconfig['aliases']['item'][$idx])) {
unset($pconfig['aliases']['item'][$idx]);
}
}
// Add an option row
-if($_GET['act'] == "addopt") {
- if(!is_array($pconfig['aliases']['item']))
+if ($_GET['act'] == "addopt") {
+ if (!is_array($pconfig['aliases']['item'])) {
$pconfig['aliases']['item'] = array();
+ }
array_push($pconfig['aliases']['item'], array('host' => null, 'domain' => null, 'description' => null));
}
-$pgtitle = array(gettext("Services"),gettext("DNS Resolver"),gettext("Edit Host Override"));
+$pgtitle = array(gettext("Services"), gettext("DNS Resolver"), gettext("Edit Host Override"));
$shortcut_section = "resolver";
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
$form = new Form();
@@ -283,15 +285,15 @@ $form->add($section);
$section = new Form_Section('Additional names for this host');
-if(!$pconfig['aliases']['item']) {
+if (!$pconfig['aliases']['item']) {
$pconfig['aliases']['item'] = array('host' => "");
}
-if( $pconfig['aliases']['item']) {
+if ($pconfig['aliases']['item']) {
$counter = 0;
$last = count($pconfig['aliases']['item']) - 1;
- foreach($pconfig['aliases']['item'] as $item) {
+ foreach ($pconfig['aliases']['item'] as $item) {
$group = new Form_Group(null);
$group->addClass('repeatable');
diff --git a/src/usr/local/www/services_wol.php b/src/usr/local/www/services_wol.php
index 0194910..8d91c19 100644
--- a/src/usr/local/www/services_wol.php
+++ b/src/usr/local/www/services_wol.php
@@ -69,7 +69,7 @@ if (!is_array($config['wol']['wolentry'])) {
}
$a_wol = &$config['wol']['wolentry'];
-if($_GET['wakeall'] != "") {
+if ($_GET['wakeall'] != "") {
$i = 0;
$savemsg = "";
foreach ($a_wol as $wolent) {
@@ -149,11 +149,13 @@ print_info_box(gettext('This service can be used to wake up (power on) computers
<?php
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg);
+}
$form = new Form('Send');
diff --git a/src/usr/local/www/services_wol_edit.php b/src/usr/local/www/services_wol_edit.php
index 9163ee4..0bbcda3 100644
--- a/src/usr/local/www/services_wol_edit.php
+++ b/src/usr/local/www/services_wol_edit.php
@@ -137,8 +137,9 @@ if ($_POST) {
$pgtitle = array(gettext("Services"), gettext("Wake on LAN"), gettext("Edit"));
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
$form = new Form;
diff --git a/src/usr/local/www/status_openvpn.php b/src/usr/local/www/status_openvpn.php
index 63c4f89..bc7e266 100644
--- a/src/usr/local/www/status_openvpn.php
+++ b/src/usr/local/www/status_openvpn.php
@@ -75,7 +75,7 @@ if ($_GET['action']) {
$port = $_GET['port'];
$remipp = $_GET['remipp'];
if (!empty($port) and !empty($remipp)) {
- $retval = kill_client($port, $remipp);
+ $retval = openvpn_kill_client($port, $remipp);
echo htmlentities("|{$port}|{$remipp}|{$retval}|");
} else {
echo gettext("invalid input");
@@ -84,43 +84,6 @@ if ($_GET['action']) {
}
}
-
-function kill_client($port, $remipp) {
- global $g;
-
- //$tcpsrv = "tcp://127.0.0.1:{$port}";
- $tcpsrv = "unix://{$g['varetc_path']}/openvpn/{$port}.sock";
- $errval = null;
- $errstr = null;
-
- /* open a tcp connection to the management port of each server */
- $fp = @stream_socket_client($tcpsrv, $errval, $errstr, 1);
- $killed = -1;
- if ($fp) {
- stream_set_timeout($fp, 1);
- fputs($fp, "kill {$remipp}\n");
- while (!feof($fp)) {
- $line = fgets($fp, 1024);
-
- $info = stream_get_meta_data($fp);
- if ($info['timed_out']) {
- break;
- }
-
- /* parse header list line */
- if (strpos($line, "INFO:") !== false) {
- continue;
- }
- if (strpos($line, "SUCCESS") !== false) {
- $killed = 0;
- }
- break;
- }
- fclose($fp);
- }
- return $killed;
-}
-
$servers = openvpn_get_active_servers();
$sk_servers = openvpn_get_active_servers("p2p");
$clients = openvpn_get_active_clients();
diff --git a/src/usr/local/www/system_camanager.php b/src/usr/local/www/system_camanager.php
index 1cb7afb..b9e197d 100644
--- a/src/usr/local/www/system_camanager.php
+++ b/src/usr/local/www/system_camanager.php
@@ -317,8 +317,7 @@ if ($_POST) {
array_push($input_errors, "openssl library returns: " . $ssl_err);
}
}
- }
- else if ($pconfig['method'] == "intermediate") {
+ } else if ($pconfig['method'] == "intermediate") {
$dn = array(
'countryName' => $pconfig['dn_country'],
'stateOrProvinceName' => $pconfig['dn_state'],
@@ -353,17 +352,19 @@ if ($_POST) {
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, 'success');
+}
// Load valid country codes
$dn_cc = array();
-if (file_exists("/etc/ca_countries")){
+if (file_exists("/etc/ca_countries")) {
$dn_cc_file=file("/etc/ca_countries");
- foreach($dn_cc_file as $line) {
+ foreach ($dn_cc_file as $line) {
if (preg_match('/^(\S*)\s(.*)$/', $line, $matches)) {
$dn_cc[$matches[1]] = $matches[1];
}
@@ -376,8 +377,7 @@ $tab_array[] = array(gettext("Certificates"), false, "system_certmanager.php");
$tab_array[] = array(gettext("Certificate Revocation"), false, "system_crlmanager.php");
display_top_tabs($tab_array);
-if (!($act == "new" || $act == "edit" || $act == gettext("Save") || $input_errors))
-{
+if (!($act == "new" || $act == "edit" || $act == gettext("Save") || $input_errors)) {
?>
<div class="table-responsive">
<table class="table table-striped table-hover">
@@ -398,28 +398,34 @@ foreach ($a_ca as $i => $ca):
$subj = cert_get_subject($ca['crt']);
$issuer = cert_get_issuer($ca['crt']);
list($startdate, $enddate) = cert_get_dates($ca['crt']);
- if ($subj == $issuer)
+ if ($subj == $issuer) {
$issuer_name = gettext("self-signed");
- else
+ } else {
$issuer_name = gettext("external");
+ }
$subj = htmlspecialchars($subj);
$issuer = htmlspecialchars($issuer);
$certcount = 0;
$issuer_ca = lookup_ca($ca['caref']);
- if ($issuer_ca)
+ if ($issuer_ca) {
$issuer_name = $issuer_ca['descr'];
+ }
// TODO : Need gray certificate icon
$internal = (!!$ca['prv']);
- foreach ($a_cert as $cert)
- if ($cert['caref'] == $ca['refid'])
+ foreach ($a_cert as $cert) {
+ if ($cert['caref'] == $ca['refid']) {
$certcount++;
+ }
+ }
- foreach ($a_ca as $cert)
- if ($cert['caref'] == $ca['refid'])
+ foreach ($a_ca as $cert) {
+ if ($cert['caref'] == $ca['refid']) {
$certcount++;
+ }
+ }
?>
<tr>
<td><?=$name?></td>
@@ -459,8 +465,7 @@ foreach ($a_ca as $i => $ca):
$form = new Form;
//$form->setAction('system_camanager.php?act=edit');
-if (isset($id) && $a_ca[$id])
-{
+if (isset($id) && $a_ca[$id]) {
$form->addGlobal(new Form_Input(
'id',
null,
@@ -469,8 +474,7 @@ if (isset($id) && $a_ca[$id])
));
}
-if ($act == "edit")
-{
+if ($act == "edit") {
$form->addGlobal(new Form_Input(
'refid',
null,
@@ -488,8 +492,7 @@ $section->addInput(new Form_Input(
$pconfig['descr']
));
-if (!isset($id) || $act == "edit")
-{
+if (!isset($id) || $act == "edit") {
$section->addInput(new Form_Select(
'method',
'Method',
@@ -531,10 +534,10 @@ $section = new Form_Section('Internal Certificate Authority');
$section->addClass('toggle-internal', 'toggle-intermediate', 'collapse');
$allCas = array();
-foreach ($a_ca as $ca)
-{
- if (!$ca['prv'])
+foreach ($a_ca as $ca) {
+ if (!$ca['prv']) {
continue;
+ }
$allCas[ $ca['refid'] ] = $ca['descr'];
}
diff --git a/src/usr/local/www/system_certmanager.php b/src/usr/local/www/system_certmanager.php
index 66e685f..9fa7e51 100644
--- a/src/usr/local/www/system_certmanager.php
+++ b/src/usr/local/www/system_certmanager.php
@@ -248,7 +248,7 @@ if ($act == "csr") {
if ($_POST) {
// This is just the blank altername name that is added for display purposes. We don't want to validate/save it
- if($_POST['altname_value0'] == "") {
+ if ($_POST['altname_value0'] == "") {
unset($_POST['altname_type0']);
unset($_POST['altname_value0']);
}
@@ -317,8 +317,7 @@ if ($_POST) {
if (!substr_compare('altname_type', $key, 0, 12)) {
$entry = substr($key, 12);
$field = 'type';
- }
- elseif (!substr_compare('altname_value', $key, 0, 13)) {
+ } elseif (!substr_compare('altname_value', $key, 0, 13)) {
$entry = substr($key, 13);
$field = 'value';
}
@@ -507,8 +506,8 @@ if ($_POST) {
/* input validation */
$reqdfields = explode(" ", "descr cert");
$reqdfieldsn = array(
- gettext("Descriptive name"),
- gettext("Final Certificate data"));
+ gettext("Descriptive name"),
+ gettext("Final Certificate data"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
@@ -562,11 +561,13 @@ if ($_POST) {
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, 'success');
+}
$tab_array = array();
$tab_array[] = array(gettext("CAs"), false, "system_camanager.php");
@@ -576,9 +577,9 @@ display_top_tabs($tab_array);
// Load valid country codes
$dn_cc = array();
-if (file_exists("/etc/ca_countries")){
+if (file_exists("/etc/ca_countries")) {
$dn_cc_file=file("/etc/ca_countries");
- foreach($dn_cc_file as $line) {
+ foreach ($dn_cc_file as $line) {
if (preg_match('/^(\S*)\s(.*)$/', $line, $matches)) {
$dn_cc[$matches[1]] = $matches[1];
}
@@ -588,14 +589,12 @@ if (file_exists("/etc/ca_countries")){
if ($act == "new" || (($_POST['save'] == gettext("Save")) && $input_errors)) {
$form = new Form;
-if ($act == "csr" || (($_POST['save'] == gettext("Update")) && $input_errors))
-{
+if ($act == "csr" || (($_POST['save'] == gettext("Update")) && $input_errors)) {
$form->setAction('system_certmanager.php?act=csr');
$section = new Form_Section('Complete Signing Request');
- if (isset($id) && $a_cert[$id])
- {
+ if (isset($id) && $a_cert[$id]) {
$form->addGlobal(new Form_Input(
'id',
null,
@@ -621,7 +620,7 @@ if ($act == "csr" || (($_POST['save'] == gettext("Update")) && $input_errors))
$section->addInput(new Form_Textarea(
'cert',
'Final certificate data',
- $pconfig["cert"]
+ $pconfig['cert']
))->setHelp('Paste the certificate received from your certificate authority here.');
$form->add($section);
@@ -633,8 +632,7 @@ if ($act == "csr" || (($_POST['save'] == gettext("Update")) && $input_errors))
$form->setAction('system_certmanager.php?act=edit');
-if (isset($userid) && $a_user)
-{
+if (isset($userid) && $a_user) {
$form->addGlobal(new Form_Input(
'userid',
null,
@@ -643,8 +641,7 @@ if (isset($userid) && $a_user)
));
}
-if (isset($id) && $a_cert[$id])
-{
+if (isset($id) && $a_cert[$id]) {
$form->addGlobal(new Form_Input(
'id',
null,
@@ -655,8 +652,7 @@ if (isset($id) && $a_cert[$id])
$section = new Form_Section('Add a new certificate');
-if (!isset($id))
-{
+if (!isset($id)) {
$section->addInput(new Form_Select(
'method',
'Method',
@@ -692,22 +688,19 @@ $form->add($section);
$section = new Form_Section('Internal Certificate');
$section->addClass('toggle-internal collapse');
-if (!$internal_ca_count)
-{
+if (!$internal_ca_count) {
$section->addInput(new Form_StaticText(
'Certificate authority',
gettext('No internal Certificate Authorities have been defined. You must ').
'<a href="system_camanager.php?act=new&amp;method=internal"> '. gettext(" create") .'</a>'.
gettext(' an internal CA before creating an internal certificate.')
));
-}
-else
-{
+} else {
$allCas = array();
- foreach ($a_ca as $ca)
- {
- if (!$ca['prv'])
- continue;
+ foreach ($a_ca as $ca) {
+ if (!$ca['prv']) {
+ continue;
+ }
$allCas[ $ca['refid'] ] = $ca['descr'];
}
@@ -797,8 +790,7 @@ $section->addInput(new Form_Input(
['placeholder' => 'e.g. www.example.com']
));
-if (empty($pconfig['altnames']['item']))
-{
+if (empty($pconfig['altnames']['item'])) {
$pconfig['altnames']['item'] = array(
array('type' => null, 'value' => null)
);
@@ -869,7 +861,7 @@ $section->addInput(new Form_Select(
$section->addInput(new Form_Select(
'csr_dn_country',
'Country Code',
- $pconfig['dn_country'],
+ $pconfig['csr_dn_country'],
$dn_cc
));
@@ -920,19 +912,23 @@ $section->addClass('toggle-existing collapse');
$existCerts = array();
foreach ($config['cert'] as $cert) {
- if(is_array($config['system']['user'][$userid]['cert'])) { // Could be MIA!
- if (isset($userid) && in_array($cert['refid'], $config['system']['user'][$userid]['cert']))
+ if (is_array($config['system']['user'][$userid]['cert'])) { // Could be MIA!
+ if (isset($userid) && in_array($cert['refid'], $config['system']['user'][$userid]['cert'])) {
continue;
+ }
}
$ca = lookup_ca($cert['caref']);
- if ($ca)
+ if ($ca) {
$cert['descr'] .= " (CA: {$ca['descr']})";
+ }
- if (cert_in_use($cert['refid']))
+ if (cert_in_use($cert['refid'])) {
$cert['descr'] .= " <i>In Use</i>";
- if (is_cert_revoked($cert))
+ }
+ if (is_cert_revoked($cert)) {
$cert['descr'] .= " <b>Revoked</b>";
+ }
$existCerts[ $cert['refid'] ] = $cert['descr'];
}
@@ -1011,7 +1007,7 @@ print $form;
</thead>
<tbody>
<?php
-foreach($a_cert as $i => $cert):
+foreach ($a_cert as $i => $cert):
$name = htmlspecialchars($cert['descr']);
if ($cert['crt']) {
@@ -1020,10 +1016,11 @@ foreach($a_cert as $i => $cert):
$purpose = cert_get_purpose($cert['crt']);
list($startdate, $enddate) = cert_get_dates($cert['crt']);
- if ($subj==$issuer)
+ if ($subj == $issuer) {
$caname = '<i>'. gettext("self-signed") .'</i>';
- else
+ } else {
$caname = '<i>'. gettext("external").'</i>';
+ }
$subj = htmlspecialchars($subj);
}
@@ -1034,8 +1031,9 @@ foreach($a_cert as $i => $cert):
}
$ca = lookup_ca($cert['caref']);
- if ($ca)
+ if ($ca) {
$caname = $ca['descr'];
+ }
?>
<tr>
<td>
@@ -1050,7 +1048,7 @@ foreach($a_cert as $i => $cert):
<td><?=$caname?></td>
<td>
<?=$subj?>
- <?php if (! $cert['csr']): ?>
+ <?php if (!$cert['csr']): ?>
<br />
<small>
<?=gettext("Valid From")?>: <b><?=$startdate ?></b><br /><?=gettext("Valid Until")?>: <b><?=$enddate ?></b>
@@ -1115,7 +1113,7 @@ foreach($a_cert as $i => $cert):
?>
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
+events.push(function() {
<?php if ($internal_ca_count): ?>
function internalca_change() {
diff --git a/src/usr/local/www/system_crlmanager.php b/src/usr/local/www/system_crlmanager.php
index 46ffc95..437a3a9 100644
--- a/src/usr/local/www/system_crlmanager.php
+++ b/src/usr/local/www/system_crlmanager.php
@@ -324,9 +324,10 @@ function build_method_list() {
$list = array();
- foreach($crl_methods as $method => $desc) {
- if (($_GET['importonly'] == "yes") && ($method != "existing"))
+ foreach ($crl_methods as $method => $desc) {
+ if (($_GET['importonly'] == "yes") && ($method != "existing")) {
continue;
+ }
$list[$method] = $desc;
}
@@ -339,8 +340,9 @@ function build_ca_list() {
$list = array();
- foreach($a_ca as $ca)
+ foreach ($a_ca as $ca) {
$list[$ca['refid']] = $ca['descr'];
+ }
return($list);
}
@@ -350,17 +352,20 @@ function build_cacert_list() {
$list = array();
- foreach($ca_certs as $cert)
+ foreach($ca_certs as $cert) {
$list[$cert['refid']] = $cert['descr'];
+ }
return($list);
}
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, 'sucess');
+}
$tab_array = array();
$tab_array[] = array(gettext("CAs"), false, "system_camanager.php");
@@ -489,9 +494,9 @@ if ($act == "new" || $act == gettext("Save") || $input_errors) {
<div class="panel-heading"><h2 class="panel-title"><?=gettext("Currently Revoked Certificates for CRL") . ': ' . $crl['descr']?></h2></div>
<div class="panel-body table-responsive">
<?php
- if (!is_array($crl['cert']) || (count($crl['cert']) == 0))
+ if (!is_array($crl['cert']) || (count($crl['cert']) == 0)) {
print_info_box(gettext("No Certificates Found for this CRL."), 'danger');
- else {
+ } else {
?>
<table class="table table-striped table-hover table-condensed">
<thead>
@@ -504,7 +509,7 @@ if ($act == "new" || $act == gettext("Save") || $input_errors) {
</thead>
<tbody>
<?php
- foreach($crl['cert'] as $i => $cert):
+ foreach ($crl['cert'] as $i => $cert):
$name = htmlspecialchars($cert['descr']);
?>
<tr>
@@ -534,9 +539,11 @@ if ($act == "new" || $act == gettext("Save") || $input_errors) {
<?php
$ca_certs = array();
- foreach($a_cert as $cert)
- if ($cert['caref'] == $crl['caref'])
+ foreach ($a_cert as $cert) {
+ if ($cert['caref'] == $crl['caref']) {
$ca_certs[] = $cert;
+ }
+ }
if (count($ca_certs) == 0)
print_info_box(gettext("No Certificates Found for this CA."), 'danger');
@@ -609,17 +616,19 @@ if ($act == "new" || $act == gettext("Save") || $input_errors) {
<?php
// Map CRLs to CAs in one pass
$ca_crl_map = array();
- foreach($a_crl as $crl)
+ foreach ($a_crl as $crl) {
$ca_crl_map[$crl['caref']][] = $crl['refid'];
+ }
$i = 0;
- foreach($a_ca as $ca):
+ foreach ($a_ca as $ca):
$name = htmlspecialchars($ca['descr']);
- if($ca['prv']) {
+ if ($ca['prv']) {
$cainternal = "YES";
- } else
+ } else {
$cainternal = "NO";
+ }
?>
<tr>
<td colspan="4">
@@ -627,22 +636,25 @@ if ($act == "new" || $act == gettext("Save") || $input_errors) {
</td>
<td>
<?php
- if ($cainternal == "YES"): ?>
+ if ($cainternal == "YES"):
+?>
<a href="system_crlmanager.php?act=new&amp;caref=<?=$ca['refid']; ?>" class="btn btn-xs btn-success">
<?=gettext("Add or Import CRL")?>
</a>
<?php
- else: ?>
+ else:
+?>
<a href="system_crlmanager.php?act=new&amp;caref=<?=$ca['refid']; ?>&amp;importonly=yes" class="btn btn-xs btn-success">
<?=gettext("Add or Import CRL")?>
</a>
<?php
- endif; ?>
+ endif;
+?>
</td>
</tr>
<?php
if (is_array($ca_crl_map[$ca['refid']])):
- foreach($ca_crl_map[$ca['refid']] as $crl):
+ foreach ($ca_crl_map[$ca['refid']] as $crl):
$tmpcrl = lookup_crl($crl);
$internal = is_crl_internal($tmpcrl);
$inuse = crl_in_use($tmpcrl['refid']);
@@ -662,17 +674,20 @@ if ($act == "new" || $act == gettext("Save") || $input_errors) {
<?=gettext("Edit CRL")?>
</a>
<?php
- else: ?>
+ else:
+?>
<a href="system_crlmanager.php?act=editimported&amp;id=<?=$tmpcrl['refid']?>" class="btn btn-xs btn-info">
<?=gettext("Edit CRL")?>
</a>
<?php endif;
- if (!$inuse): ?>
+ if (!$inuse):
+?>
<a href="system_crlmanager.php?act=del&amp;id=<?=$tmpcrl['refid']?>" class="btn btn-xs btn-danger">
<?=gettext("Delete CRL")?>
</a>
<?php
- endif; ?>
+ endif;
+?>
</td>
</tr>
<?php
@@ -694,14 +709,15 @@ if ($act == "new" || $act == gettext("Save") || $input_errors) {
<script>
//<![CDATA[
-events.push(function(){
+events.push(function() {
// Hides all elements of the specified class. This will usually be a section or group
function hideClass(s_class, hide) {
- if(hide)
+ if (hide) {
$('.' + s_class).hide();
- else
+ } else {
$('.' + s_class).show();
+ }
}
// When the 'method" selector is changed, we show/hide certain sections
diff --git a/src/usr/local/www/widgets/widgets/dyn_dns_status.widget.php b/src/usr/local/www/widgets/widgets/dyn_dns_status.widget.php
index b450915..2eb1c84 100644
--- a/src/usr/local/www/widgets/widgets/dyn_dns_status.widget.php
+++ b/src/usr/local/www/widgets/widgets/dyn_dns_status.widget.php
@@ -105,8 +105,8 @@ if ($_REQUEST['getdyndnsstatus']) {
<td width="20%" class="listhdrr"><?=gettext("Hostname");?></td>
<td width="20%" class="listhdrr"><?=gettext("Cached IP");?></td>
</tr>
- <?php $i = 0; foreach ($a_dyndns as $dyndns): ?>
- <tr ondblclick="document.location='services_dyndns_edit.php?id=<?=$i;?>'">
+ <?php $dyndnsid = 0; foreach ($a_dyndns as $dyndns): ?>
+ <tr ondblclick="document.location='services_dyndns_edit.php?id=<?=$dyndnsid;?>'">
<td class="listlr">
<?php $iflist = get_configured_interface_with_descr();
foreach ($iflist as $if => $ifdesc) {
@@ -158,10 +158,10 @@ if ($_REQUEST['getdyndnsstatus']) {
?>
</td>
<td class="listr">
- <div id='dyndnsstatus<?= $i;?>'><?= gettext("Checking ...");?></div>
+ <div id='dyndnsstatus<?= $dyndnsid;?>'><?= gettext("Checking ...");?></div>
</td>
</tr>
- <?php $i++; endforeach;?>
+ <?php $dyndnsid++; endforeach;?>
</table>
</div>
<script type="text/javascript">
diff --git a/src/usr/local/www/widgets/widgets/gateways.widget.php b/src/usr/local/www/widgets/widgets/gateways.widget.php
index cd86719..b11162b 100644
--- a/src/usr/local/www/widgets/widgets/gateways.widget.php
+++ b/src/usr/local/www/widgets/widgets/gateways.widget.php
@@ -220,7 +220,7 @@ if ($_POST) {
//]]>
</script>
-<div class="panel-footer collapse">
+<div id="widget-<?=$widgetname?>_panel-footer" class="panel-footer collapse">
<input type="hidden" id="gateways-config" name="gateways-config" value="" />
<div id="gateways-settings" class="widgetconfigdiv" >
diff --git a/src/usr/local/www/widgets/widgets/log.widget.php b/src/usr/local/www/widgets/widgets/log.widget.php
index 753e19d..62e5104 100644
--- a/src/usr/local/www/widgets/widgets/log.widget.php
+++ b/src/usr/local/www/widgets/widgets/log.widget.php
@@ -221,7 +221,7 @@ events.push(function(){
<!-- close the body we're wrapped in and add a configuration-panel -->
</div>
-<div class="panel-footer collapse">
+<div id="widget-<?=$widgetname?>_panel-footer" class="panel-footer collapse">
<form action="/widgets/widgets/log.widget.php" method="post"
class="form-horizontal">
diff --git a/src/usr/local/www/widgets/widgets/openvpn.widget.php b/src/usr/local/www/widgets/widgets/openvpn.widget.php
index 8a02f3d..2d34401 100644
--- a/src/usr/local/www/widgets/widgets/openvpn.widget.php
+++ b/src/usr/local/www/widgets/widgets/openvpn.widget.php
@@ -65,7 +65,7 @@ if ($_GET['action']) {
$port = $_GET['port'];
$remipp = $_GET['remipp'];
if (!empty($port) and !empty($remipp)) {
- $retval = kill_client($port, $remipp);
+ $retval = openvpn_kill_client($port, $remipp);
echo htmlentities("|{$port}|{$remipp}|{$retval}|");
} else {
echo gettext("invalid input");
@@ -74,43 +74,6 @@ if ($_GET['action']) {
}
}
-
-function kill_client($port, $remipp) {
- global $g;
-
- //$tcpsrv = "tcp://127.0.0.1:{$port}";
- $tcpsrv = "unix://{$g['varetc_path']}/openvpn/{$port}.sock";
- $errval = null;
- $errstr = null;
-
- /* open a tcp connection to the management port of each server */
- $fp = @stream_socket_client($tcpsrv, $errval, $errstr, 1);
- $killed = -1;
- if ($fp) {
- stream_set_timeout($fp, 1);
- fputs($fp, "kill {$remipp}\n");
- while (!feof($fp)) {
- $line = fgets($fp, 1024);
-
- $info = stream_get_meta_data($fp);
- if ($info['timed_out']) {
- break;
- }
-
- /* parse header list line */
- if (strpos($line, "INFO:") !== false) {
- continue;
- }
- if (strpos($line, "SUCCESS") !== false) {
- $killed = 0;
- }
- break;
- }
- fclose($fp);
- }
- return $killed;
-}
-
$servers = openvpn_get_active_servers();
$sk_servers = openvpn_get_active_servers("p2p");
$clients = openvpn_get_active_clients();
diff --git a/src/usr/local/www/widgets/widgets/picture.widget.php b/src/usr/local/www/widgets/widgets/picture.widget.php
index 6b19ab6..7d31199 100644
--- a/src/usr/local/www/widgets/widgets/picture.widget.php
+++ b/src/usr/local/www/widgets/widgets/picture.widget.php
@@ -71,14 +71,14 @@ if ($_POST) {
?>
<a href="/widgets/widgets/picture.widget.php?getpic=true" target="_blank">
- <img width="100%" height="100%" src="/widgets/widgets/picture.widget.php?getpic=true" alt="picture" />
+ <img style="width:100%; height:100%" src="/widgets/widgets/picture.widget.php?getpic=true" alt="picture" />
</a>
<!-- close the body we're wrapped in and add a configuration-panel -->
-</div><div class="panel-footer collapse">
+</div><div id="widget-<?=$widgetname?>_panel-footer" class="panel-footer collapse">
<form action="/widgets/widgets/picture.widget.php" method="post" enctype="multipart/form-data" class="form-inline">
<label for="pictfile">New picture: </label>
- <input name="pictfile" type="file" class="form-control" />
+ <input id="pictfile" name="pictfile" type="file" class="form-control" />
<button type="submit" class="btn btn-default">Upload</button>
</form>
diff --git a/src/usr/local/www/widgets/widgets/rss.widget.php b/src/usr/local/www/widgets/widgets/rss.widget.php
index b7d3f9d..358717e 100644
--- a/src/usr/local/www/widgets/widgets/rss.widget.php
+++ b/src/usr/local/www/widgets/widgets/rss.widget.php
@@ -139,7 +139,7 @@ if ($config['widgets']['rssfeed']) {
?>
<a href="<?=$item->get_permalink()?>" target="_blank" class="list-group-item">
<h4 class="list-group-item-heading">
- <img src="pfs-mini.png" title="Source: <?=$feed->get_title()?>" width="16" height="16" />
+ <img src="pfs-mini.png" title="Source: <?=$feed->get_title()?>" alt="" width="16" height="16" />
<?=$item->get_title()?>
</h4>
<p class="list-group-item-text">
@@ -154,34 +154,34 @@ if ($config['widgets']['rssfeed']) {
</div>
<!-- close the body we're wrapped in and add a configuration-panel -->
-</div><div class="panel-footer collapse">
+</div><div id="widget-<?=$widgetname?>_panel-footer" class="panel-footer collapse">
<form action="/widgets/widgets/rss.widget.php" method="post" class="form-horizontal">
<div class="form-group">
<label for="rssfeed" class="col-sm-3 control-label">Feeds</label>
<div class="col-sm-6">
- <textarea name="rssfeed" class="form-control"><?=$textarea_txt;?></textarea>
+ <textarea id="rssfeed" name="rssfeed" class="form-control"><?=$textarea_txt;?></textarea>
</div>
</div>
<div class="form-group">
<label for="rssmaxitems" class="col-sm-3 control-label"># Stories</label>
<div class="col-sm-6">
- <input type="number" name="rssmaxitems" value="<?=$max_items?>" min="1" max="100" class="form-control" />
+ <input type="number" id="rssmaxitems" name="rssmaxitems" value="<?=$max_items?>" min="1" max="100" class="form-control" />
</div>
</div>
<div class="form-group">
<label for="rsswidgetheight" class="col-sm-3 control-label">Widget height</label>
<div class="col-sm-6">
- <input type="number" name="rsswidgetheight" value="<?=$rsswidgetheight?>" min="100" max="2500" step="100" class="form-control" />
+ <input type="number" id="rsswidgetheight" name="rsswidgetheight" value="<?=$rsswidgetheight?>" min="100" max="2500" step="100" class="form-control" />
</div>
</div>
<div class="form-group">
<label for="rsswidgettextlength" class="col-sm-3 control-label">Content limit</label>
<div class="col-sm-6">
- <input type="number" name="rsswidgettextlength" value="<?=$rsswidgettextlength?>" min="100" max="5000" step="10" class="form-control" />
+ <input type="number" id="rsswidgettextlength" name="rsswidgettextlength" value="<?=$rsswidgettextlength?>" min="100" max="5000" step="10" class="form-control" />
</div>
</div>
diff --git a/src/usr/local/www/widgets/widgets/services_status.widget.php b/src/usr/local/www/widgets/widgets/services_status.widget.php
index 173629e..8899886 100644
--- a/src/usr/local/www/widgets/widgets/services_status.widget.php
+++ b/src/usr/local/www/widgets/widgets/services_status.widget.php
@@ -123,7 +123,7 @@ if (count($services) > 0) {
</table>
<!-- close the body we're wrapped in and add a configuration-panel -->
-</div><div class="panel-footer collapse">
+</div><div id="widget-<?=$widgetname?>_panel-footer" class="panel-footer collapse">
<form action="/widgets/widgets/services_status.widget.php" method="post" class="form-horizontal">
<div class="form-group">
diff --git a/src/usr/local/www/widgets/widgets/thermal_sensors.widget.php b/src/usr/local/www/widgets/widgets/thermal_sensors.widget.php
index a274935..522dcd3 100644
--- a/src/usr/local/www/widgets/widgets/thermal_sensors.widget.php
+++ b/src/usr/local/www/widgets/widgets/thermal_sensors.widget.php
@@ -191,19 +191,19 @@ function getBoolValueFromConfig(&$configArray, $valueKey, $defaultValue) {
</div>
<input type="hidden" id="thermal_sensors-config" name="thermal_sensors-config" value="" />
-<div id="thermal_sensors-settings" class="widgetconfigdiv panel-footer collapse" >
+<div id="widget-<?=$widgetname?>_panel-footer" class="widgetconfigdiv panel-footer collapse" >
<form action="/widgets/widgets/thermal_sensors.widget.php" method="post" id="iform_thermal_sensors_settings" name="iform_thermal_sensors_settings">
<table>
<tr>
- <td align="left" colspan="2">
+ <td style="text-align:left" colspan="2">
<span style="font-weight: bold" >Thresholds in &deg;C (1 to 100):</span>
</td>
- <td align="right" colspan="1">
+ <td style="text-align:right" colspan="1">
<span style="font-weight: bold" >Display settings:</span>
</td>
</tr>
<tr>
- <td align="right">
+ <td style="text-align:right">
Zone Warning:
</td>
<td>
@@ -212,7 +212,7 @@ function getBoolValueFromConfig(&$configArray, $valueKey, $defaultValue) {
id="thermal_sensors_widget_zone_warning_threshold"
value="<?= $thermal_sensors_widget_zoneWarningTempThreshold; ?>" />
</td>
- <td align="right">
+ <td style="text-align:right">
<label for="thermal_sensors_widget_show_raw_output">Show raw output (no graph): </label>
<input type="checkbox"
id="thermal_sensors_widget_show_raw_output"
@@ -221,7 +221,7 @@ function getBoolValueFromConfig(&$configArray, $valueKey, $defaultValue) {
</td>
</tr>
<tr>
- <td align="right">
+ <td style="text-align:right">
Zone Critical:
</td>
<td>
@@ -230,7 +230,7 @@ function getBoolValueFromConfig(&$configArray, $valueKey, $defaultValue) {
id="thermal_sensors_widget_zone_critical_threshold"
value="<?= $thermal_sensors_widget_zoneCriticalTempThreshold; ?>" />
</td>
- <td align="right">
+ <td style="text-align:right">
<label for="thermal_sensors_widget_show_full_sensor_name">Show full sensor name: </label>
<input type="checkbox"
id="thermal_sensors_widget_show_full_sensor_name"
@@ -239,7 +239,7 @@ function getBoolValueFromConfig(&$configArray, $valueKey, $defaultValue) {
</td>
</tr>
<tr>
- <td align="right">
+ <td style="text-align:right">
Core Warning:
</td>
<td>
@@ -248,12 +248,12 @@ function getBoolValueFromConfig(&$configArray, $valueKey, $defaultValue) {
id="thermal_sensors_widget_core_warning_threshold"
value="<?= $thermal_sensors_widget_coreWarningTempThreshold ?>" />
</td>
- <td align="right">
+ <td style="text-align:right">
</td>
</tr>
<tr>
- <td align="right">
+ <td style="text-align:right">
Core Critical:
</td>
<td>
@@ -262,17 +262,17 @@ function getBoolValueFromConfig(&$configArray, $valueKey, $defaultValue) {
id="thermal_sensors_widget_core_critical_threshold"
value="<?= $thermal_sensors_widget_coreCriticalTempThreshold ?>" />
</td>
- <td align="right">
+ <td style="text-align:right">
</td>
</tr>
<tr>
- <td align="right" colspan="3">
+ <td style="text-align:right" colspan="3">
<input type="submit" id="thermal_sensors_widget_submit" name="thermal_sensors_widget_submit" class="formbtn" value="Save" />
</td>
</tr>
<tr>
- <td align="left" colspan="3">
+ <td style="text-align:left" colspan="3">
<span>* You can configure a proper Thermal Sensor / Module under <br />
&nbsp;&nbsp;&nbsp;<a href="system_advanced_misc.php">System &gt; Advanced &gt; Miscellaneous : Thermal Sensors section</a>.</span>
</td>
diff --git a/src/usr/local/www/widgets/widgets/traffic_graphs.widget.php b/src/usr/local/www/widgets/widgets/traffic_graphs.widget.php
index 11835c4..4d421ea 100644
--- a/src/usr/local/www/widgets/widgets/traffic_graphs.widget.php
+++ b/src/usr/local/www/widgets/widgets/traffic_graphs.widget.php
@@ -158,7 +158,7 @@ foreach ($ifdescrs as $ifname => $ifdescr):
<?php endforeach; ?>
<!-- close the body we're wrapped in and add a configuration-panel -->
-</div><div class="panel-footer collapse">
+</div><div id="widget-<?=$widgetname?>_panel-footer" class="panel-footer collapse">
<form action="/widgets/widgets/traffic_graphs.widget.php" method="post" class="form-horizontal">
<div class="form-group">
@@ -166,7 +166,7 @@ foreach ($ifdescrs as $ifname => $ifdescr):
<div class="col-sm-6 checkbox">
<?php foreach ($ifdescrs as $ifname => $ifdescr): ?>
<label>
- <input type="checkbox" name="shown[]"<?= $ifname?>]" value="<?=$ifname?>" <?= ($shown[$ifname]) ? "checked":""?> />
+ <input type="checkbox" name="shown[<?= $ifname?>]" value="<?=$ifname?>" <?= ($shown[$ifname]) ? "checked":""?> />
<?=$ifname?>
</label>
<?php endforeach; ?>
@@ -189,7 +189,7 @@ foreach ($ifdescrs as $ifname => $ifdescr):
<div class="form-group">
<label for="refreshinterval" class="col-sm-3 control-label">Refresh Interval</label>
<div class="col-sm-6">
- <input type="number" name="refreshinterval" value="<?=$refreshinterval?>" min="1" max="30" class="form-control" />
+ <input type="number" id="refreshinterval" name="refreshinterval" value="<?=$refreshinterval?>" min="1" max="30" class="form-control" />
</div>
</div>
OpenPOWER on IntegriCloud