]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
WIO: Fix a problem with the Network-Table-Button
authorStephan Feddersen via Development <development@lists.ipfire.org>
Tue, 27 Feb 2018 16:20:07 +0000 (17:20 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 9 Mar 2018 15:39:52 +0000 (15:39 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/wio/wio.cgi

index 8c43b0432a2dccb1f610ed2bda290f18fd7c642d..c51910f4db483863e58be6bf505815cedf2d08e4 100644 (file)
@@ -21,7 +21,7 @@
 #                                                                             #
 ###############################################################################
 #
-# Version: 2018/01/05 14:34:23
+# Version: 2018/02/27 16:54:23
 #
 # This wio.cgi is based on the Code from the IPCop WIO Addon
 # and is extremly adapted to work with IPFire.
@@ -106,10 +106,10 @@ my $count = 0;
 my $showcount = 0;
 
 my $arpbuttontext = "$Lang::tr{'wio_show_table_on'}";
-my $clientimportbuttontext  = "$Lang::tr{'wio_show_table_on'}";
-my $networksearchbuttontext  = "$Lang::tr{'wio_show_table_on'}";
+my $clientimportbuttontext = "$Lang::tr{'wio_show_table_on'}";
+my $networksearchbuttontext = "$Lang::tr{'wio_show_table_on'}";
 
-my ( $infomessage, $errormessage, $importmessage, $message ) = '';
+my ( $message, $infomessage, $errormessage, $importmessage ) = '';
 
 my ( $buttontext, $host, $timestamp, $ipadr, $on, $remark, $dyndns, $dyndnsip, $sendemailon, $net, $dev, $iprange, $output, $write, $webinterface,
         $sendemailoff, $pingmethode, $online, $color, $bgcolor, $exitcode, $id, $line, $interface, $counter, $vpnn2nip, $vpnn2nmask, $ddns, $edc,
@@ -280,7 +280,7 @@ if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_client_add'} ) {
 
 ## show / hide arptable
 
-if ($wiosettings{'WIOGUISHOWARPTABLE'} eq 'arptable') {
+if ( $wiosettings{'WIOGUISHOWARPTABLE'} eq 'arptable' ) {
        if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_show_table_off'} ) {
                $wiosettings{'WIOGUISHOWARPTABLE'} = 'off';
                $arpbuttontext = "$Lang::tr{'wio_show_table_on'}";
@@ -309,11 +309,11 @@ if ( $wiosettings{'WIOGUISHOWCLIENTIMPORTTABLE'} eq 'clientimport' ) {
 if ( $wiosettings{'WIOGUISHOWNETWORKSEARCHTABLE'} eq 'networksearch' ) {
        if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_show_table_off'} ) {
                $wiosettings{'WIOGUISHOWNETWORKSEARCHTABLE'} = 'off';
-               $clientimportbuttontext = "$Lang::tr{'wio_show_table_on'}";
+               $networksearchbuttontext = "$Lang::tr{'wio_show_table_on'}";
        }
        else {
                $wiosettings{'WIOGUISHOWNETWORKSEARCHTABLE'} = 'on';
-               $clientimportbuttontext = "$Lang::tr{'wio_show_table_off'}";
+               $networksearchbuttontext = "$Lang::tr{'wio_show_table_off'}";
        }
 }
 
@@ -348,7 +348,7 @@ if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_add'} ) {
        }
 }
 
-## enable / disabel client || enable / disable dyndns || enable / disable sendemailon || enable / disable sendemailoff || change ip / fqdn
+## enable / disable client || enable / disable dyndns || enable / disable sendemailon || enable / disable sendemailoff || change ip / fqdn
 
 if ( $wiosettings{'ACTION'} eq $Lang::tr{'enable disable client'} ) { $edc = 'on'; }
 if ( $wiosettings{'ACTION'} eq $Lang::tr{'enable disable dyndns'} ) { $edd = 'on'; }
@@ -983,7 +983,7 @@ for ($i=1; $i<=15; $i++) {
        print "<option $selected{'TIMEOUT'}{$_}>$_</option>\n";
 }
 
-print" 
+print"
        </select>&nbsp;$Lang::tr{'wio sec'}</td>
 </tr>
 <tr><td colspan='3'>&nbsp;</td></tr>
@@ -1123,7 +1123,7 @@ print"
        <td width='15%' align='center'><b>$Lang::tr{'wio_wanname'}</b></td>
        <td width='24%' align='center'><b>$Lang::tr{'wio_dyndns_hosts'}</b></td>
        <td width='11%' align='center'><b>$Lang::tr{'wio image'}</b></td>
-       <td width='14%' align='center'><b>$Lang::tr{'wio_wancheck'}</b></td>
+       <td width='14%' align='center'><b>$Lang::tr{'wio_connected'}</b></td>
 </tr>
 <tr bgcolor='$color{'color22'}' height='20'>
        <td align='center'>01</td>
@@ -1196,7 +1196,7 @@ print"
        <td width='8%' align='center'><b>$Lang::tr{'type'}</b></td>
        <td width='25%' align='center'><b>$Lang::tr{'wio_common_name'}</b></td>
        <td width='11%' align='center'><b>$Lang::tr{'wio image'}</b></td>
-       <td width='14%' align='center'><b>$Lang::tr{'wio_ovpn_connected'}</b></td>
+       <td width='14%' align='center'><b>$Lang::tr{'wio_connected'}</b></td>
 </tr>
 ";
 
@@ -1244,7 +1244,7 @@ $statustxt = "$Lang::tr{'capsclosed'}";
                  <td align='center' height='20'>&nbsp;</td>
                  </tr>
 ";
+
 if ($vpnconfighash{$key}[25] && $wiosettings{'CLIENTREMARK'} eq 'on') {
        print"<tr".($idvpn % 2?" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'><td>&nbsp;</td><td colspan='16' align='left'>$vpnconfighash{$key}[25]</td></tr>";
 }
@@ -1278,7 +1278,7 @@ print"
        <td width='8%' align='center'><b>$Lang::tr{'type'}</b></td>
        <td width='25%' align='center'><b>$Lang::tr{'common name'}</b></td>
        <td width='11%' align='center'><b>$Lang::tr{'wio image'}</b></td>
-       <td width='14%' align='center'><b>$Lang::tr{'wio_ovpn_connected'}</b></td>
+       <td width='14%' align='center'><b>$Lang::tr{'wio_connected'}</b></td>
 </tr>
 ";
 
@@ -1310,7 +1310,6 @@ print"
                        $statustxt = "$Lang::tr{'capsclosed'}";
                }
                else {
-                       
                        if ($ovpnconfighash{$key}[3] eq 'net') {
                                if (-e "/var/run/$ovpnconfighash{$key}[1]n2n.pid") {
                                        my @output = "";
@@ -1378,7 +1377,7 @@ print"
                if ($ovpnconfighash{$key}[25] && $wiosettings{'CLIENTREMARK'} eq 'on') {
                        print"<tr".($idovpn % 2?" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'><td>&nbsp;</td><td colspan='16' align='left'>$ovpnconfighash{$key}[25]</td></tr>";
                }
-               
+
                print"<tr height='1'><td colspan='17' bgcolor='#696565'></td></tr>";
                $idovpn++
        }
@@ -1519,7 +1518,7 @@ my $dotip = length($ipaddresses[$a]) - rindex($ipaddresses[$a],'.');
                if ( -e "$vpnpid" ) {
                        foreach $key (keys(%vpnconfighash)) {
                                next unless ($vpnconfighash{$key}[3] eq 'net');
-                               
+
                                my $convertip = &General::ipcidr2msk($vpnconfighash{$key}[11]);
 
                                my @net = split ("/", $convertip);
@@ -1538,16 +1537,15 @@ my $dotip = length($ipaddresses[$a]) - rindex($ipaddresses[$a],'.');
                        @match = split ("/", $ovpnsettings{'DOVPN_SUBNET'});
 
                        if ( &General::IpInSubnet($ipaddresses[$a], $match[0], $match[1]) ) {
-                               print"<td align='center'><img src='$imgstatic/ovpn.png' alt='OpenVPN' title='OpenVPN' /></td>"; 
-                               last SWITCH; 
+                               print"<td align='center'><img src='$imgstatic/ovpn.png' alt='OpenVPN' title='OpenVPN' /></td>";
+                               last SWITCH;
                        }
                }
 
                if ( %ovpnccdconfhash ne '' ) {
                        foreach $key (keys(%ovpnccdconfhash)) {
-                                                               
+
                                my $convertip = &General::ipcidr2msk($ovpnccdconfhash{$key}[1]);
-                                                       
                                my @net = split ("/", $convertip);
 
                                $vpnn2nip = $net[0];
@@ -1557,7 +1555,6 @@ my $dotip = length($ipaddresses[$a]) - rindex($ipaddresses[$a],'.');
                                        print"<td align='center'><img align='middle' src='$imgstatic/ovpn.png' alt='OpenVPN' title='OpenVPN' /></td>";
                                        last SWITCH;
                                }
-                                       
                        }
                }
 
@@ -1567,7 +1564,7 @@ my $dotip = length($ipaddresses[$a]) - rindex($ipaddresses[$a],'.');
                        chomp ($rednet[1]);
                        my $red_netmask = General::iporsubtodec($rednet[1]);
                        my $red_netaddress = Network::get_netaddress("$rednet[0]/$red_netmask");
-                                               
+
                        if ( &General::IpInSubnet($ipaddresses[$a], $red_netaddress, $red_netmask) ) {
                                print"<td align='center' height='20'><img src='$imgstatic/red.png' alt='$Lang::tr{'wio_red_lan'}' title='$Lang::tr{'wio_red_lan'}' /></td>";
                                last SWITCH;
@@ -2165,23 +2162,24 @@ close(FILE);
 
 ############################################################################################################################
 
-sub SortByTunnelName
-{
-    if ($vpnconfighash{$a}[1] lt $vpnconfighash{$b}[1]) {
-        return -1;
-    }
-    elsif ($vpnconfighash{$a}[1] gt $vpnconfighash{$b}[1]) {
-        return 1;
-    }
-    else {
-        return 0;
-    }
+sub SortByTunnelName {
+
+       if ($vpnconfighash{$a}[1] lt $vpnconfighash{$b}[1]) {
+               return -1;
+       }
+       elsif ($vpnconfighash{$a}[1] gt $vpnconfighash{$b}[1]) {
+               return 1;
+       }
+       else {
+               return 0;
+       }
+
 }
 
 ############################################################################################################################
 
-sub validSave
-{
+sub validSave {
+
        if ( $wiosettings{'IPADR'} eq '' && $wiosettings{'PINGMETHODE'} eq 'ip' && $wiosettings{'DYNDNS'} eq '' ) {
                $errormessage = $Lang::tr{'wio_ip_empty'};
        }
@@ -2207,4 +2205,5 @@ sub validSave
        if ( $wiosettings{'ID'} eq '' && ! defined($errormessage) ) { $errormessage = &WIO::checkinto($wiosettings{'IPADR'}, $wiosettings{'HOST'}, @current); }
 
        if ( $wiosettings{'REMARK'} ne '' ) { $wiosettings{'REMARK'} =~ s/,/&#44;/g; }
+
 }