]>
git.ipfire.org Git - ipfire-2.x.git/blob - src/wio/wio.cgi
3 ###############################################################################
5 # IPFire.org - A linux based firewall #
6 # Copyright (C) 2017 Stephan Feddersen <addons@h-loit.de> #
7 # All Rights Reserved. #
9 # This program is free software: you can redistribute it and/or modify #
10 # it under the terms of the GNU General Public License as published by #
11 # the Free Software Foundation, either version 3 of the License, or #
12 # (at your option) any later version. #
14 # This program is distributed in the hope that it will be useful, #
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17 # GNU General Public License for more details. #
19 # You should have received a copy of the GNU General Public License #
20 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
22 ###############################################################################
24 # id: wio.cgi, v1.3.2 2017/08/27 14:11:16 sfeddersen
26 # This wio.cgi is based on the Code from the IPCop WIO Addon
27 # and is extremly adapted to work with IPFire.
29 # Autor: Stephan Feddersen
30 # Co-Autor: Alexander Marx
31 # Co-Autor: Frank Mainz
36 # enable only the following on debugging purpose
39 #use CGI::Carp 'fatalsToBrowser';
44 use POSIX
qw(strftime);
49 require '/var/ipfire/general-functions.pl';
50 require '/var/ipfire/network-functions.pl';
51 require '/var/ipfire/lang.pl';
52 require '/var/ipfire/header.pl';
53 require '/usr/lib/wio/wio-lib.pl';
54 require '/usr/lib/wio/wio-graphs.pl';
56 my $logdir = "/var/log/wio";
58 my ( %mainsettings, %mailsettings, %wiosettings, %cgiparams, %netsettings, %ipshash,
59 %vpnconfighash, %ovpnconfighash, %ovpnccdconfhash, %ovpnsettings, %checked, %selected, %color ) = ();
61 &General
::readhash
('/var/ipfire/main/settings', \
%mainsettings);
62 &General
::readhash
('/var/ipfire/ethernet/settings', \
%netsettings);
63 &General
::readhash
('/var/ipfire/dma/mail.conf', \
%mailsettings);
64 &General
::readhash
('/var/ipfire/wio/wio.conf', \
%wiosettings);
65 &General
::readhash
("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \
%color);
66 &General
::readhasharray
('/var/ipfire/ovpn/ovpnconfig', \
%ovpnconfighash);
67 &General
::readhash
('/var/ipfire/ovpn/settings', \
%ovpnsettings);
68 &General
::readhasharray
('/var/ipfire/ovpn/ccd.conf', \
%ovpnccdconfhash);
69 &General
::readhasharray
('/var/ipfire/vpn/config', \
%vpnconfighash);
71 my $ipadrfile = "$logdir/wioips";
72 my $onoffip = "$logdir/wioscip";
73 my $wiosettings = "/var/ipfire/wio/wio.conf";
74 my $dyndnsconfig = "/var/ipfire/ddns/config";
75 my $importfile = "$logdir/importfile";
76 my $wiofile = "$logdir/wiofile";
77 my $editfile = "$logdir/editfile";
78 my $hostfile = "/var/ipfire/main/hosts";
79 my $dhcpfile = "/var/ipfire/dhcp/fixleases";
80 my $imgstatic = "/images/wio";
81 my $rrddir = "/var/log/rrd/wio";
82 my $refreshbox = '<meta http-equiv="refresh" content="0;url=/cgi-bin/wio.cgi">';
83 my $sortstring = '^IPADR|^HOST';
84 my $ovpnaddon = "/var/ipfire/ovpn";
85 my $ovpnpid = "/var/run/openvpn.pid";
86 my $vpnpid = "/var/run/charon.pid";
87 my $redactive = "/var/ipfire/red/active";
89 my $now = strftime
"%Y-%m-%d", localtime;
91 if ( -e
$redactive ) {
92 open(IPADDR
, "/var/ipfire/red/local-ipaddress");
108 my ( $infomessage, $errormessage, $importmessage, $message ) = '';
110 my ( $buttontext, $host, $timestamp, $ipadr, $on, $remark, $dyndns, $dyndnsip, $sendemailon, $net, $dev, $iprange, $output, $write, $webinterface,
111 $sendemailoff, $pingmethode, $online, $color, $bgcolor, $exitcode, $id, $line, $interface, $counter, $vpnn2nip, $vpnn2nmask, $ddns, $edc,
112 $edd, $wmon, $wmoff, $ipfqdn, $http, $wioscan, $statustxt, $status, $key, $ic, $text, $image ) = ();
114 my ( @temp, @dates, @ipaddresses, @names, @remark, @sendemailon, @sendemailoff, @current, @ddns, @match, @webinterface, @arpcache, @arpadd, @line,
115 @hosts, @vpnstatus, @ovpnstatus, @activ, @dyndns, @pingmethode, @status, @id, @write, @log );
117 my @nosaved = ('ACTION','ID','CLIENTID','TIMESTAMP','IPADR','HOST','REMARK','DYNDNS','SENDEMAILON','SENDEMAILOFF','PINGMETHODE','ONLINE','WEBINTERFACE');
119 my @devs_color = ('GREEN','BLUE','ORANGE','RED');
120 my @devs_net = ('green0','blue0','orange0','red0');
121 my @devs_img = ('green.png','blue.png','orange.png','red.png');
122 my @devs_alt = ('green','blue','orange','red');
124 my %ifacecolor = ( GREEN
=> 'wio_run_green', BLUE
=> 'wio_run_blue', ORANGE
=> 'wio_run_orange');
130 $wiosettings{'ACTION'} = '';
131 $wiosettings{'COUNT'} = '';
132 $wiosettings{'ID'} = '';
133 $wiosettings{'CLIENTID'} = '';
134 $wiosettings{'SORT'} = 'IPADR';
135 $wiosettings{'HOST'} = '';
136 $wiosettings{'IPADR'} = '';
137 $wiosettings{'EN'} = 'on';
138 $wiosettings{'REMARK'} = '';
139 $wiosettings{'DYNDNS'} = '';
140 $wiosettings{'CLIENTREMARK'} = '';
141 $wiosettings{'SENDEMAILON'} = '';
142 $wiosettings{'SENDEMAILOFF'} = '';
143 $wiosettings{'PINGMETHODE'} = 'ip';
144 $wiosettings{'WEBINTERFACE'} = '----';
145 $wiosettings{'TIMEOUT'} = '1';
146 $wiosettings{'TIMESTAMP'} = '';
147 $wiosettings{'ONLINE'} = 'off';
148 $wiosettings{'CRON'} = '15';
149 $wiosettings{'OVPNCRON'} = '5';
150 $wiosettings{'ENABLE'} = 'off';
151 $wiosettings{'LOGGING'} = 'off';
152 $wiosettings{'MAILREMARK'} = 'off';
153 $wiosettings{'MAILSTYLE'} = 'email';
154 $wiosettings{'OVPNRWMAIL'} = 'off';
155 $wiosettings{'SHUTDOWN'} = 'off';
157 &Header
::getcgihash
(\
%wiosettings);
158 &Header
::getcgihash
(\
%mainsettings);
159 &Header
::getcgihash
(\
%mailsettings);
160 &Header
::getcgihash
(\
%netsettings);
162 if ( $mailsettings{'USEMAIL'} eq 'on' ) { $wiosettings{'SENDEMAIL'} = 'on'; }
163 else { $wiosettings{'SENDEMAIL'} = 'off'; }
165 if ( -e
$wiofile ) { goto WIOSCAN
; }
168 foreach (@devs_color) {
169 if ( $netsettings{"${_}_DEV"} ne '' ) {
170 $wiosettings{"${_}_IPLOW"} = &Network
::find_next_ip_address
($netsettings{"${_}_NETADDRESS"}, 1);
171 $wiosettings{"${_}_IPHIGH"} = &Network
::find_next_ip_address
($netsettings{"${_}_BROADCAST"}, -1);
177 if ( $wiosettings{'ACTION'} eq $Lang::tr
{'wio_save'}.'1' ) {
178 unless ( `ps -A | grep wio.pl` ) {
179 $cgiparams{'SORT'} = $wiosettings{'SORT'};
180 $cgiparams{'CRON'} = $wiosettings{'CRON'};
181 $cgiparams{'OVPNCRON'} = $wiosettings{'OVPNCRON'};
182 $cgiparams{'ENABLE'} = $wiosettings{'ENABLE'};
183 $cgiparams{'LOGGING'} = $wiosettings{'LOGGING'};
184 $cgiparams{'TIMEOUT'} = $wiosettings{'TIMEOUT'};
185 $cgiparams{'ACTION'} = $wiosettings{'ACTION'};
186 $cgiparams{'CLIENTREMARK'} = $wiosettings{'CLIENTREMARK'};
187 $cgiparams{'MAILREMARK'} = $wiosettings{'MAILREMARK'};
188 $cgiparams{'MAILSTYLE'} = $wiosettings{'MAILSTYLE'};
189 $cgiparams{'OVPNRWMAIL'} = $wiosettings{'OVPNRWMAIL'};
190 $cgiparams{'SHUTDOWN'} = $wiosettings{'SHUTDOWN'};
192 &General
::writehash
($wiosettings, \
%cgiparams);
193 &General
::readhash
($wiosettings, \
%wiosettings);
195 if ( $wiosettings{'ENABLE'} eq 'off' ) {
196 &WIO
::clearfile
($ipadrfile);
197 unlink glob "$rrddir/*";
201 $infomessage = "$Lang::tr{'wio_error_function'}";
205 ## save imported clients
207 if ( $wiosettings{'ACTION'} eq $Lang::tr
{'wio_save'}.'2' ) {
208 unless ( `ps -A | grep wio.pl` ) {
209 while ( $count < $wiosettings{'COUNT'} ) {
210 if ( defined($wiosettings{"USE$count"}) && $wiosettings{"USE$count"} eq 'on' ) {
211 $wiosettings{'CLIENTID'} = $wiosettings{'CLIENTID$count'};
212 $wiosettings{'TIMESTAMP'} = $wiosettings{"TIMESTAMP$count"};
213 $wiosettings{'IPADR'} = $wiosettings{"IPADR$count"};
214 $wiosettings{'HOST'} = $wiosettings{"HOST$count"};
215 $wiosettings{'EN'} = $wiosettings{"EN$count"};
216 $wiosettings{'REMARK'} = $wiosettings{"REMARK$count"};
217 $wiosettings{'DYNDNS'} = $wiosettings{"DYNDNS$count"};
218 $wiosettings{'SENDEMAILON'} = $wiosettings{"SENDEMAILON$count"};
219 $wiosettings{'SENDEMAILOFF'} = $wiosettings{"SENDEMAILOFF$count"};
220 $wiosettings{'PINGMETHODE'} = $wiosettings{"PINGMETHODE$count"};
221 $wiosettings{'ONLINE'} = $wiosettings{"ONLINE$count"};
222 $wiosettings{'WEBINTERFACE'} = $wiosettings{"WEBINTERFACE$count"};
227 open(FILE
, ">> $editfile");
228 print FILE
"$wiosettings{'CLIENTID'},$wiosettings{'TIMESTAMP'},$wiosettings{'IPADR'},$wiosettings{'HOST'},$wiosettings{'EN'},$wiosettings{'REMARK'},$wiosettings{'DYNDNS'},$wiosettings{'SENDEMAILON'},$wiosettings{'SENDEMAILOFF'},$wiosettings{'PINGMETHODE'},$wiosettings{'ONLINE'},$wiosettings{'WEBINTERFACE'}\n";
230 $importmessage = $errormessage;
233 $wiosettings{'CLIENTID'} = &General
::findhasharraykey
(\
%ipshash);
234 unshift (@current, "$wiosettings{'CLIENTID'},$wiosettings{'TIMESTAMP'},$wiosettings{'IPADR'},$wiosettings{'HOST'},$wiosettings{'EN'},$wiosettings{'REMARK'},$wiosettings{'DYNDNS'},$wiosettings{'SENDEMAILON'},$wiosettings{'SENDEMAILOFF'},$wiosettings{'PINGMETHODE'},$wiosettings{'ONLINE'},$wiosettings{'WEBINTERFACE'}\n");
235 &SortDataFile
('',@current);
241 map ($wiosettings{$_} = '' ,@nosaved);
242 unlink ($importfile);
243 if ( -e
"$editfile" ) { goto EDIT
; }
246 $infomessage = "$Lang::tr{'wio_error_function'}";
250 ## add or update client
252 if ( $wiosettings{'ACTION'} eq $Lang::tr
{'wio_client_add'} ) {
253 unless ( `ps -A | grep wio.pl` ) {
256 unless ($errormessage) {
257 if ( $wiosettings{'ID'} eq '' && $wiosettings{'ACTION'} ne $Lang::tr
{'edit'} ) {
258 $wiosettings{'CLIENTID'} = &General
::findhasharraykey
(\
%ipshash);
259 unshift (@current, "$wiosettings{'CLIENTID'},$wiosettings{'TIMESTAMP'},$wiosettings{'IPADR'},$wiosettings{'HOST'},$wiosettings{'EN'},$wiosettings{'REMARK'},$wiosettings{'DYNDNS'},$wiosettings{'SENDEMAILON'},$wiosettings{'SENDEMAILOFF'},$wiosettings{'PINGMETHODE'},$wiosettings{'ONLINE'},$wiosettings{'WEBINTERFACE'}\n");
262 @current[$wiosettings{'ID'}] = "$wiosettings{'CLIENTID'},$wiosettings{'TIMESTAMP'},$wiosettings{'IPADR'},$wiosettings{'HOST'},$wiosettings{'EN'},$wiosettings{'REMARK'},$wiosettings{'DYNDNS'},$wiosettings{'SENDEMAILON'},$wiosettings{'SENDEMAILOFF'},$wiosettings{'PINGMETHODE'},$wiosettings{'ONLINE'},$wiosettings{'WEBINTERFACE'}\n";
267 map ($wiosettings{$_} = '' ,@nosaved);
268 &SortDataFile
('',@current);
271 $infomessage = "$Lang::tr{'wio_error_function'}";
277 if ( $wiosettings{'ACTION'} eq $Lang::tr
{'wio_add'} ) {
278 unless ( `ps -A | grep wio.pl` ) {
279 open(FILE
, "$logdir/.arpcache");
283 chomp(@arpadd[$wiosettings{'ID'}]);
284 @temp = split (/\,/, @arpadd[$wiosettings{'ID'}]);
286 $wiosettings{'CLIENTID'} = &General
::findhasharraykey
(\
%ipshash);
287 $wiosettings{'IPADR'} = $temp[1];
288 $wiosettings{'HOST'} = $temp[2];
289 $wiosettings{'EN'} = 'on';
291 $wiosettings{'PINGMETHODE'} = 'ip';
292 $wiosettings{'ONLINE'} = 'off';
294 open(FILE
, ">> $editfile");
295 print FILE
"$wiosettings{'CLIENTID'},$wiosettings{'TIMESTAMP'},$wiosettings{'IPADR'},$wiosettings{'HOST'},$wiosettings{'EN'},$wiosettings{'REMARK'},$wiosettings{'DYNDNS'},$wiosettings{'SENDEMAILON'},$wiosettings{'SENDEMAILOFF'},$wiosettings{'PINGMETHODE'},$wiosettings{'ONLINE'},$wiosettings{'WEBINTERFACE'}\n";
301 undef($wiosettings{'ID'});
302 $infomessage = "$Lang::tr{'wio_error_function'}";
306 ## enable / disabel client || enable / disable dyndns || enable / disable sendemailon || enable / disable sendemailoff || change ip / fqdn
308 if ( $wiosettings{'ACTION'} eq $Lang::tr
{'enable disable client'} ) { $edc = 'on'; }
309 if ( $wiosettings{'ACTION'} eq $Lang::tr
{'enable disable dyndns'} ) { $edd = 'on'; }
310 if ( $wiosettings{'ACTION'} eq $Lang::tr
{'wio_mail_online'} ) { $wmon = 'on'; }
311 if ( $wiosettings{'ACTION'} eq $Lang::tr
{'wio_mail_offline'} ) { $wmoff = 'on'; }
312 if (( $wiosettings{'ACTION'} eq $Lang::tr
{'wio_ip_on'} ) || ( $wiosettings{'ACTION'} eq $Lang::tr
{'wio_fqdn_on'} )) { $ipfqdn = 'on'; }
314 if ( defined($edc) || defined($edd) || defined($wmon) || defined($wmoff) || defined($ipfqdn) ) {
315 unless ( `ps -A | grep wio.pl` ) {
316 chomp(@current[$wiosettings{'ID'}]);
317 @temp = split (/\,/, @current[$wiosettings{'ID'}]);
319 if ( $edc eq 'on' ) {
320 $temp[4] = $temp[4] ne '' ?
'' : 'on';
324 unlink "$rrddir/$temp[0].rrd";
326 elsif ( $edd eq 'on' ) { $temp[6] = $temp[6] ne '' ?
'' : 'on'; }
327 elsif ( $wmon eq 'on' ) { $temp[7] = $temp[7] ne '' ?
'' : 'on'; }
328 elsif ( $wmoff eq 'on' ) { $temp[8] = $temp[8] ne '' ?
'' : 'on'; }
329 elsif ( $ipfqdn eq 'on' ) { $temp[9] = $temp[9] eq 'fqdn' ?
'ip' : 'fqdn'; }
331 @current[$wiosettings{'ID'}] = join (',', @temp)."\n";
332 undef($wiosettings{'ID'});
337 undef($wiosettings{'ID'});
338 $infomessage = "$Lang::tr{'wio_error_function'}";
342 ## refresh wio status || refresh single client status
344 if ( $wiosettings{'ACTION'} eq $Lang::tr
{'wio_refresh'} || $wiosettings{'ACTION'} eq $Lang::tr
{'wio_sc_refresh'} ) {
346 if ( $wiosettings{'ACTION'} eq $Lang::tr
{'wio_sc_refresh'} ) {
347 open(FILE
, "> $onoffip");
348 print FILE
@current[$wiosettings{'ID'}];
351 undef($wiosettings{'ID'});
354 unless ( `ps -A | grep wio.pl` ) {
356 &Header
::showhttpheaders
();
357 &Header
::openpage
($Lang::tr
{'wio'}, 1, $refreshbox);
358 &Header
::openbigbox
('100%', 'left', '');
359 &Header
::openbox
('100%', 'left', $Lang::tr
{'wio_info'});
362 <table align='center' width='100%'>
363 <tr><td align='center'>$Lang::tr{'wio_msg'}</td></tr>
364 <tr><td> </td></tr>
365 <tr><td align='center'><img align='middle' src='/images/indicator.gif' /></td></tr>
370 &Header
::closebigbox
();
371 &Header
::closepage
();
373 while ( system("/usr/local/bin/wiohelper", "&") ) {}
378 $infomessage = "$Lang::tr{'wio_already_running'}";
385 if ( $wiosettings{'ACTION'} eq $Lang::tr
{'wio_dyndns_refresh'} ) {
386 unless ( `ps -A | grep wio.pl` ) {
387 chomp(@current[$wiosettings{'ID'}]);
388 @temp = split (/\,/, @current[$wiosettings{'ID'}]);
390 ($temp[2], $infomessage) = &WIO
::getdyndnsip
($temp[2], $temp[3]);
392 @current[$wiosettings{'ID'}] = join (',', @temp)."\n";
396 undef($wiosettings{'ID'});
399 $infomessage = "$Lang::tr{'wio_error_function'}";
405 if ( $wiosettings{'ACTION'} eq $Lang::tr
{'edit'} ) {
406 unless ( `ps -A | grep wio.pl` ) {
407 chomp(@current[$wiosettings{'ID'}]);
408 @temp = split (/\,/, @current[$wiosettings{'ID'}]);
410 $wiosettings{'CLIENTID'} = $temp[0];
411 $wiosettings{'TIMESTAMP'} = $temp[1];
412 $wiosettings{'IPADR'} = $temp[2];
413 $wiosettings{'HOST'} = $temp[3];
414 $wiosettings{'EN'} = $temp[4];
415 $wiosettings{'REMARK'} = $temp[5];
416 $wiosettings{'DYNDNS'} = $temp[6];
417 $wiosettings{'SENDEMAILON'} = $temp[7];
418 $wiosettings{'SENDEMAILOFF'} = $temp[8];
419 $wiosettings{'PINGMETHODE'} = $temp[9];
420 $wiosettings{'ONLINE'} = $temp[10];
421 $wiosettings{'WEBINTERFACE'} = $temp[11];
424 undef($wiosettings{'ACTION'});
425 $infomessage = "$Lang::tr{'wio_error_function'}";
431 if ( $wiosettings{'ACTION'} eq $Lang::tr
{'wio_remove_client'} ) {
432 unless ( `ps -A | grep wio.pl` ) {
433 chomp(@current[$wiosettings{'ID'}]);
435 @temp = split (/\,/, @current[$wiosettings{'ID'}]);
437 unlink "$rrddir/$temp[0].rrd";
439 splice (@current,$wiosettings{'ID'},1);
443 undef($wiosettings{'ID'});
446 undef($wiosettings{'ID'});
447 $infomessage = "$Lang::tr{'wio_error_function'}";
451 ## remove all clients
453 if ( $wiosettings{'ACTION'} eq $Lang::tr
{'wio_remove_all'} ) {
454 unless ( `ps -A | grep wio.pl` ) {
455 &WIO
::clearfile
($ipadrfile);
456 unlink glob "$rrddir/*";
460 $infomessage = "$Lang::tr{'wio_error_function'}";
466 if ( $wiosettings{'ACTION'} eq $Lang::tr
{'wio_back'} ) {
467 if ( -e
"$importfile" ) { unlink ($importfile); }
468 map ($wiosettings{$_} = '' ,@nosaved);
469 undef($errormessage);
472 ## import hosts, fixleases or csv file || scan networks (green/blue/orange)
474 if ( $wiosettings{'ACTION'} eq 'wio_run_green' ||
475 $wiosettings{'ACTION'} eq 'wio_run_blue' ||
476 $wiosettings{'ACTION'} eq 'wio_run_orange') { $wioscan = 'on'; }
478 if ( $wiosettings{'ACTION'} eq $Lang::tr
{'wio_import'}.'1' ||
479 $wiosettings{'ACTION'} eq $Lang::tr
{'wio_import'}.'2' ||
480 $wiosettings{'ACTION'} eq $Lang::tr
{'wio_import'}.'3' ||
481 defined($wioscan) || defined($importmessage) ) {
483 unless ( `ps -A | grep wio.pl` ) {
484 if ( $wiosettings{'ACTION'} eq $Lang::tr
{'wio_import'}.'1' && $importmessage eq '' ) {
486 &Header
::getcgihash
(\
%wiosettings, {'wantfile' => 1, 'filevar' => 'CSVFILE'});
488 if ( $wiosettings{'CSVFILE'} eq '' ) {
489 $errormessage = $Lang::tr
{'wio_no_file_selected'};
490 $message = 2; goto ERROR
;
493 if ( $wiosettings{'CSVFILE'} =~ /[^a-z0-9A-Z\ \.\-\_\:\\]+/ ) {
494 $errormessage = $Lang::tr
{'wio_no_csv_error'};
495 $message = 2; goto ERROR
;
498 if ( !($wiosettings{'CSVFILE'} =~ /.csv$/) ) {
499 $errormessage = $Lang::tr
{'wio_no_csv'};
500 $message = 2; goto ERROR
;
503 if (copy
($wiosettings{'CSVFILE'}, "$logdir/importfile") != 1) {
505 $message = 2; goto ERROR
;
511 &General
::readhash
($wiosettings, \
%wiosettings);
513 &Header
::showhttpheaders
();
514 &Header
::openpage
($Lang::tr
{'wio'}, 1, '');
515 &Header
::openbigbox
('100%', 'left');
517 if ($importmessage) {
518 &Header
::openbox
('100%', 'left', $Lang::tr
{'wio_error'}, 'error');
519 print" <table width='100%'><tr><td><font class='base'>$importmessage</font></td></tr></table>";
523 if ( -e
"$editfile" ) {
524 open(FILE
, "< $editfile" ); }
525 elsif ( $wiosettings{'ACTION'} eq $Lang::tr
{'wio_import'}.'1' ) {
526 open(FILE
, "< $importfile" ); }
527 elsif ( $wiosettings{'ACTION'} eq $Lang::tr
{'wio_import'}.'2' ) {
528 open(FILE
, "< $hostfile" ); }
529 elsif ( $wiosettings{'ACTION'} eq $Lang::tr
{'wio_import'}.'3' ) {
530 open(FILE
, "< $dhcpfile" ); }
531 elsif ( $wioscan eq 'on' ) {
533 foreach (keys(%ifacecolor)) {
534 if ( $netsettings{"${_}_DEV"} eq $wiosettings{'ID'} ) {
535 $dev = $netsettings{"${_}_DEV"};
536 $iprange = $wiosettings{"${_}_IPLOW"} . "-" . $wiosettings{"${_}_IPHIGH"};
538 if ( $_ eq 'GREEN' ) { $color = "$Header::colourgreen"; $net = $Lang::tr
{'wio_msg_green'}; }
539 elsif ( $_ eq 'BLUE' ) { $color = "$Header::colourblue"; $net = $Lang::tr
{'wio_msg_blue'}; }
540 else { $color = "$Header::colourorange"; $net = $Lang::tr
{'wio_msg_orange'}; }
544 &Header
::openbox
('100%', 'left', $Lang::tr
{'wio_info'});
545 print"<table width='100%'>
546 <tr><td align='center'><font class='base'>$Lang::tr{'wio_msg_left'} </font><font class='base' color='$color'><b>$net</b></font> $Lang::tr{'wio_msg_center'} <font class='base' color='$color'><b>$dev</b></font><font class='base'> $Lang::tr{'wio_msg_right'} $Lang::tr{'wio_msg_hint'}</font></td></tr>
547 <tr><td> </td></tr>
548 <tr><td align='center'><img align='middle' src='/images/indicator.gif' /></td></tr>
551 &Header
::closebigbox
();
553 open(FILE
, "/usr/local/bin/wioscan -wsa $dev $iprange |" );
560 if ( $wioscan ne 'on' && ! -e
$wiofile ) { @hosts = sort @hosts; }
562 open(FILE
, "> $wiofile");
566 print"<meta http-equiv=\"refresh\" content=\"0; URL=$ENV{'SCRIPT_NAME'}\">";
573 open(FILE
, "< $wiofile");
577 &General
::readhash
($wiosettings, \
%wiosettings);
579 &Header
::showhttpheaders
();
580 &Header
::openpage
($Lang::tr
{'wio'}, 1, '');
581 &Header
::openbigbox
('100%', 'left');
587 @line = split (/\,/, $_);
589 if ( -e
$editfile || -e
$importfile ) {
590 $wiosettings{'CLIENTID$count'} = $line[0];
591 $wiosettings{'TIMESTAMP$count'} = $line[1];
592 $wiosettings{'IPADR$count'} = $line[2];
593 $wiosettings{'HOST$count'} = $line[3];
594 $wiosettings{'EN$count'} = $line[4];
595 $wiosettings{'REMARK$count'} = $line[5];
596 $wiosettings{'DYNDNS$count'} = $line[6];
597 $wiosettings{'SENDEMAILON$count'} = $line[7];
598 $wiosettings{'SENDEMAILOFF$count'} = $line[8];
599 $wiosettings{'PINGMETHODE$count'} = $line[9];
600 $wiosettings{'ONLINE$count'} = $line[10];
601 $wiosettings{'WEBINTERFACE$count'} = $line[11];
602 $wiosettings{'USE$count'} = 'on';
605 $wiosettings{'IPADR$count'} = $line[1];
606 $wiosettings{'EN$count'} = 'on';
607 $wiosettings{'PINGMETHODE$count'} = 'ip';
608 $wiosettings{'USE$count'} = 'on';
610 if ( $wiosettings{'ACTION'} eq $Lang::tr
{'wio_import'}.'2' ) {
611 $wiosettings{'HOST$count'} = $line[2];
612 $wiosettings{'DOM$count'} = $line[3];
613 $wiosettings{'REMARK$count'} = '';
615 elsif ( $wioscan eq 'on' || -e
$wiofile ) {
616 $wiosettings{'HOST$count'} = gethostbyaddr(inet_aton
($line[1]), AF_INET
);
617 if ($wiosettings{'HOST$count'} eq '') { $wiosettings{'HOST$count'} = $line[1]; }
618 $wiosettings{'REMARK$count'} = '';
619 $wiosettings{'WEBINTERFACE$count'} = '';
622 $wiosettings{'HOST$count'} = $line[7];
623 $wiosettings{'REMARK$count'} = $line[6];
627 $checked{'EN$count'}{'on'} = ($wiosettings{'EN$count'} eq '' ) ?
'' : "checked='checked'";
629 $checked{'DYNDNS$count'}{'on'} = ($wiosettings{'DYNDNS$count'} eq '' ) ?
'' : "checked='checked'";
630 $checked{'SENDEMAILON$count'}{'on'} = ($wiosettings{'SENDEMAILON$count'} eq '' ) ?
'' : "checked='checked'";
631 $checked{'SENDEMAILOFF$count'}{'on'} = ($wiosettings{'SENDEMAILOFF$count'} eq '' ) ?
'' : "checked='checked'";
633 $checked{'PINGMETHODE$count'}{'ip'} = $checked{'PINGMETHODE$count'}{'fqdn'} = '';
634 $checked{'PINGMETHODE$count'}{$wiosettings{'PINGMETHODE$count'}} = "checked='checked'";
636 $checked{'USE$count'}{'on'} = ($wiosettings{'USE$count'} eq '' ) ?
'' : "checked='checked'";
638 $selected{'WEBINTERFACE$count'}{'----'} = '';
639 $selected{'WEBINTERFACE$count'}{'HTTP'} = '';
640 $selected{'WEBINTERFACE$count'}{'HTTPS'} = '';
641 $selected{'WEBINTERFACE$count'}{$wiosettings{'WEBINTERFACE$count'}} = "selected='selected'";
643 if (! &WIO
::checkinto
($wiosettings{'IPADR$count'}, $wiosettings{'HOST$count'}, @current) ) {
645 if ( $importmessage ) {
646 &Header
::openbox
('100%', 'left', "$Lang::tr{'wio_import_data'}'$wiosettings{'HOST$count'}'$Lang::tr{'wio_import_data1'}");
648 elsif ( $wiosettings{'ACTION'} eq $Lang::tr
{'wio_import'}.'1' || $wioscan eq 'on' || -e
$wiofile || -e
$editfile ) {
649 &Header
::openbox
('100%', 'left', "$Lang::tr{'wio_import_data'}'$wiosettings{'HOST$count'}'$Lang::tr{'wio_import_data2'}");
651 elsif ( $wiosettings{'ACTION'} eq $Lang::tr
{'wio_import'}.'2' ) {
652 &Header
::openbox
('100%', 'left', "$Lang::tr{'wio_import_data'}'$wiosettings{'HOST$count'}.$wiosettings{'DOM$count'}'$Lang::tr{'wio_import_data2'}");
655 &Header
::openbox
('100%', 'left', $Lang::tr
{'wio_import_leases'});
659 <form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
660 <input type='hidden' name='ONLINE$count' value='$wiosettings{'ONLINE$count'}' />
664 <td>$Lang::tr{'wio_use'}</td>
665 <td><input type='checkbox' name='USE$count' $checked{'USE$count'}{'on'} /></td>
668 <td>$Lang::tr{'wio_client_enable'}</td>
669 <td><input type='checkbox' name='EN$count' $checked{'EN$count'}{'on'} /></td>
672 <td>$Lang::tr{'host ip'}:</td>
673 <td><input type='text' name='IPADR$count' value='$wiosettings{'IPADR$count'}' size='18' /></td>
674 <td>$Lang::tr{'hostname'}:</td>
677 if ( $wiosettings{'ACTION'} eq $Lang::tr
{'wio_import'}.'2' ) {
678 print"<td><input type='text' name='HOST$count' size='18' value='$wiosettings{'HOST$count'}.$wiosettings{'DOM$count'}' /></td>";
681 print"<td><input type='text' name='HOST$count' size='18' value='$wiosettings{'HOST$count'}' /></td>";
685 <td>$Lang::tr{'remark'}:</td>
686 <td><input type='text' name='REMARK$count' value='$wiosettings{'REMARK$count'}' size='18' /></td>
689 <td class='base'>$Lang::tr{'wio_ping_send'}:</td>
690 <td align='left'><input type='radio' name='PINGMETHODE$count' value='ip' $checked{'PINGMETHODE$count'}{'ip'} /> IP <input type='radio' name='PINGMETHODE$count' value='fqdn' $checked{'PINGMETHODE$count'}{'fqdn'} /> FQDN</td>
691 <td>$Lang::tr{'wio_dyndns'}:</td>
692 <td><input type='checkbox' name='DYNDNS$count' $checked{'DYNDNS$count'}{'on'} /></td>
695 if ( $wiosettings{'SENDEMAIL'} eq 'on' ) {
696 print"<td>$Lang::tr{'wio_sendemail'}:</td>
697 <td><input type='checkbox' name='SENDEMAILON$count' $checked{'SENDEMAILON$count'}{'on'} /> $Lang::tr{'wio_online'} <input type='checkbox' name='SENDEMAILOFF$count' $checked{'SENDEMAILOFF$count'}{'on'} /> $Lang::tr{'wio_offline'}</td>";
700 print"<td colspan='2'> </td>";
706 <td height='30'>$Lang::tr{'wio_link_open'}:</td>
707 <td align='left' colspan='5'>
708 <select size='1' name='WEBINTERFACE$count' width='80' style='width: 80px'>
709 <option value='----' $selected{'WEBINTERFACE$count'}{'----'}>----</option>
710 <option value='HTTP' $selected{'WEBINTERFACE$count'}{'HTTP'}>HTTP</option>
711 <option value='HTTPS' $selected{'WEBINTERFACE$count'}{'HTTPS'}>HTTPS</option>
724 if ( $showcount gt 0 ) {
725 &Header
::openbox
('100%', 'left', $Lang::tr
{'wio_import_infos'});
732 if ($importmessage) { print"<td> </td>"; }
733 else { print"<td><font color='$color{'color11'}'>$Lang::tr{'wio_import_infos_csv'}</font></td>"; }
737 <tr><td colspan='4'> </td></tr>
741 <td width='25%'> </td>
742 <td width='25%'><input type='hidden' name='COUNT' value='$count' /><input type='hidden' name='ACTION' value='$Lang::tr{'wio_save'}2' /><input type='submit' name='SUBMIT' value='$Lang::tr{'wio_save'}' /></form></td>
743 <td width='25%'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'><input type='submit' name='ACTION' value='$Lang::tr{'wio_back'}' /></form></td>
744 <td width='25%'> </td>
750 &Header
::closebigbox
();
751 &Header
::closepage
();
754 print"<meta http-equiv=\"refresh\" content=\"0; URL=$ENV{'SCRIPT_NAME'}?INFO\">";
757 if ( -e
"$editfile" ) { unlink ($editfile); }
758 if ( -e
"$wiofile" ) { unlink($wiofile); }
762 $infomessage = "$Lang::tr{'wio_error_function'}";
768 if ($ENV{'QUERY_STRING'} =~ /$sortstring/ ) {
769 my $string = $ENV{'QUERY_STRING'};
771 if ( $string eq 'INFO' ) {
772 $infomessage = $Lang::tr
{'wio_import_info_csv'};
775 &General
::readhash
($wiosettings, \
%wiosettings);
777 my $actual = $wiosettings{'SORT'};
779 if ($actual =~ $string) {
781 if ($actual !~ 'Rev') { $Rev = 'Rev'; }
785 system("/bin/sed -i 's#$wiosettings{'SORT'}#$string#g' $wiosettings");
787 $wiosettings{'SORT'} = $string;
788 map ($wiosettings{$_} = '' ,@nosaved);
789 &SortDataFile
('',@current);
797 unless($message == 1) { &General
::readhash
($wiosettings, \
%wiosettings); }
799 for ($i=5; $i<=60; $i+=5) { $selected{'CRON'}{$i} = ''; }
801 $selected{'CRON'}{$wiosettings{'CRON'}} = "selected='selected'";
803 for ($i=1; $i<=15; $i++) {
804 $selected{'TIMEOUT'}{$i} = '';
805 $selected{'OVPNCRON'}{$i} = '';
808 $selected{'TIMEOUT'}{$wiosettings{'TIMEOUT'}} = "selected='selected'";
809 $selected{'OVPNCRON'}{$wiosettings{'OVPNCRON'}} = "selected='selected'";
811 $checked{'ENABLE'}{'off'} = $checked{'ENABLE'}{'on'} = '';
812 $checked{'ENABLE'}{$wiosettings{'ENABLE'}} = "checked='checked'";
814 $checked{'LOGGING'}{'off'} = $checked{'LOGGING'}{'on'} = '';
815 $checked{'LOGGING'}{$wiosettings{'LOGGING'}} = "checked='checked'";
817 $checked{'CLIENTREMARK'}{'off'} = $checked{'CLIENTREMARK'}{'on'} = '';
818 $checked{'CLIENTREMARK'}{$wiosettings{'CLIENTREMARK'}} = "checked='checked'";
820 $checked{'MAILREMARK'}{'off'} = $checked{'MAILREMARK'}{'on'} = '';
821 $checked{'MAILREMARK'}{$wiosettings{'MAILREMARK'}} = "checked='checked'";
823 $checked{'OVPNRWMAIL'}{'off'} = $checked{'OVPNRWMAIL'}{'on'} = '';
824 $checked{'OVPNRWMAIL'}{$wiosettings{'OVPNRWMAIL'}} = "checked='checked'";
826 $checked{'SHUTDOWN'}{'off'} = $checked{'SHUTDOWN'}{'on'} = '';
827 $checked{'SHUTDOWN'}{$wiosettings{'SHUTDOWN'}} = "checked='checked'";
829 $checked{'MAILSTYLE'}{'smail'} = $checked{'MAILSTYLE'}{'email'} = '';
830 $checked{'MAILSTYLE'}{$wiosettings{'MAILSTYLE'}} = "checked='checked'";
832 &Header
::showhttpheaders
();
833 &Header
::openpage
($Lang::tr
{'wio'}, 1, "<meta http-equiv='expires' content='-1'><meta http-equiv='cache-control' content='no-store, no-cache, must-revalidate'><meta http-equiv='pragma' content='no-cache'>");
834 &Header
::openbigbox
('100%', 'left', '');
836 ## DEBUG / ERROR / INFO / UPDATE
839 &Header
::openbox
('100%', 'left', 'DEBUG', 'warning');
841 print"errormessage: $errormessage<br />\n";
842 print"infomessage: $infomessage<br />\n";
847 foreach (sort keys %wiosettings) {
848 print"$_ = $wiosettings{$_}<br />\n";
855 foreach (sort keys %netsettings) {
856 print"$_ = $netsettings{$_}<br />\n";
862 if ( $errormessage ) {
863 &Header
::openbox
('100%', 'left', $Lang::tr
{'wio_error'}, 'error');
864 print"<table width='100%'><tr><td><font class='base'><b>$errormessage</b></font></td></tr></table>";
868 if ( $infomessage ) {
869 &Header
::openbox
('100%', 'left', $Lang::tr
{'wio_info'}, 'warning');
870 print"<table width='100%'><tr><td><font class='base'><b>$infomessage</b></font></td></tr></table>";
876 if ( $wiosettings{'ACTION'} eq $Lang::tr
{'edit'}.'1' || $message == 1 || $wiosettings{'ENABLE'} eq 'off' ) {
878 &Header
::openbox
('100%', 'left', $Lang::tr
{'wio settings'});
881 <form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
884 <td width='45%' bgcolor='$color{'color20'}' align='left' height='20'><b> $Lang::tr{'wio_settings_msg'}</b></td>
885 <td width='2%'> </td>
886 <td width='53%'> </td>
888 <tr><td colspan='3'> </td></tr>
890 <td colspan='3'>$Lang::tr{'wio_settings_msg_hint'}</td>
892 <tr><td colspan='3'> </td></tr>
894 <td align='right'>$Lang::tr{'wio enabled'}</td>
897 print"<td> </td>";
899 if ( $wiosettings{'ENABLE'} eq 'on' ) {
900 print"<td align='left'><input type='checkbox' onClick=\"return confirm('$Lang::tr{'wio_disable_hint'}')\" name='ENABLE' $checked{'ENABLE'}{'on'} /></td>";
903 print"<td align='left'><input type='checkbox' name='ENABLE' $checked{'ENABLE'}{'on'} /></td>";
907 <tr><td colspan='3'> </td></tr>
909 <td align='right'>$Lang::tr{'wio_shutdown'}</td>
911 <td align='left'><input type='checkbox' name='SHUTDOWN' $checked{'SHUTDOWN'}{'on'} /></td>
913 <tr><td colspan='3'> </td></tr>
915 <td align='right'>$Lang::tr{'wio cron'}</td>
917 <td align='left'><select size='1' name='CRON' size='5'>
920 for ($i=5; $i<=60; $i+=5) {
921 $_ = sprintf("%02s",$i);
922 print "<option $selected{'CRON'}{$_}>$_</option>\n";
926 </select> $Lang::tr{'wio min'}</td>
928 <tr><td colspan='3'> </td></tr>
930 <td align='right'>$Lang::tr{'wio timeout'}</td>
932 <td align='left'><select size='1' name='TIMEOUT' size='5'>
935 for ($i=1; $i<=15; $i++) {
936 $_ = sprintf("%02s",$i);
937 print "<option $selected{'TIMEOUT'}{$_}>$_</option>\n";
941 </select> $Lang::tr{'wio sec'}</td>
943 <tr><td colspan='3'> </td></tr>
945 <td align='right'>$Lang::tr{'wio_logging'}</td>
947 <td align='left'><input type='checkbox' name='LOGGING' $checked{'LOGGING'}{'on'} /></td>
949 <tr><td colspan='3'> </td></tr>
951 <td align='right'>$Lang::tr{'wio_clientremark'}</td>
953 <td align='left'><input type='checkbox' name='CLIENTREMARK' $checked{'CLIENTREMARK'}{'on'} /></td>
955 <tr><td colspan='3'> </td></tr>
959 if ( $wiosettings{'SENDEMAIL'} eq 'on' ) {
962 <td align='right'>$Lang::tr{'wio_mail_style'}:</td>
964 <td align='left'><input type='radio' name='MAILSTYLE' value='smail' $checked{'MAILSTYLE'}{'smail'} /> $Lang::tr{'wio_mail_smail'} <input type='radio' name='MAILSTYLE' value='email' $checked{'MAILSTYLE'}{'email'} /> $Lang::tr{'wio_mail_email'}</td>
966 <tr><td colspan='3'> </td></tr>
968 <td align='right'>$Lang::tr{'wio_mailremark_enabled'}</td>
970 <td align='left'><input type='checkbox' name='MAILREMARK' $checked{'MAILREMARK'}{'on'}></td>
972 <tr><td colspan='3'> </td></tr>
975 if ( -e
"$ovpnaddon" || ! -z
"/var/ipfire/vpn/config" ) {
978 <td align='right'>$Lang::tr{'wio_mail_ovpnrw'}</td>
980 <td align='left'><input type='checkbox' name='OVPNRWMAIL' $checked{'OVPNRWMAIL'}{'on'}></td>
982 <tr><td colspan='3'> </td></tr>
984 <td align='right'>$Lang::tr{'wio_ovpn_cron'}</td>
986 <td align='left'><select size='1' name='OVPNCRON' size='5'>
989 for ($i=1; $i<=15; $i++) {
990 $_ = sprintf("%02s",$i);
991 print "<option $selected{'OVPNCRON'}{$_}>$_</option>\n";
995 </select> $Lang::tr{'wio min'}</td>
997 <tr><td colspan='3'> </td></tr>
1001 <tr><td colspan='3'> </td></tr>
1003 <td colspan='2'> </td>
1004 <td align='left'><input type='hidden' name='ACTION' value='$Lang::tr{'wio_save'}1' /><input type='submit' name='submit' value='$Lang::tr{'wio_save'}' />"
1005 .($wiosettings{'ENABLE'} ne 'off' ?
" <input type='button' onClick='location.href=\"/cgi-bin/wio.cgi\"' value='$Lang::tr{'wio_back'}'>" : "")
1012 &Header
::closebox
();
1013 &Header
::closebigbox
();
1014 &Header
::closepage
();
1018 ## wio client status
1020 if ( $wiosettings{'ENABLE'} eq 'on') {
1021 if ( !$errormessage && $wiosettings{'ACTION'} ne $Lang::tr
{'edit'} || $message == 2 ) {
1022 &Header
::openbox
('100%', 'left', $Lang::tr
{'wio stat'});
1024 foreach (@current) {
1027 ($id,$timestamp,$ipadr,$host,$on,$remark,$dyndns,$sendemailon,$sendemailoff,$pingmethode,$online,$webinterface) = split (/\,/, $_);
1029 if ( defined($dyndns) && ( $dyndns =~ 'on' ) ) {
1030 ($dyndnsip, $infomessage) = &WIO
::getdyndnsip
($ipadr, $host);
1032 if ( $dyndnsip ne $ipadr ) {
1040 if ( $on eq 'on' ) { push (@dates,($timestamp)); }
1041 else { push (@dates,('-')); }
1043 push (@ipaddresses,($ipadr));
1044 push (@names,($host));
1045 push (@activ,($on));
1046 push (@remark,($remark));
1047 push (@dyndns,($dyndns));
1048 push (@sendemailon,($sendemailon));
1049 push (@sendemailoff,($sendemailoff));
1050 push (@pingmethode,($pingmethode));
1051 push (@status,($online));
1052 push (@webinterface,($webinterface));
1054 push (@write, "$id,$timestamp,$ipadr,$host,$on,$remark,$dyndns,$sendemailon,$sendemailoff,$pingmethode,$online,$webinterface\n");
1059 if ( defined($write) ) { &writeips
(); }
1064 <table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1066 <td width='28%' bgcolor='$color{'color20'}' align='left'><b> $Lang::tr{'wio_wan_con'}</b></td>
1067 <td width='72%' align='right'> </td>
1069 <tr><td colspan='2'> </td></tr>
1072 <table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1073 <tr bgcolor='$color{'color20'}' height='20'>
1074 <td width='3%' align='center'><b>$Lang::tr{'wio_id'}</b></td>
1075 <td width='15%' align='center'><b>$Lang::tr{'wio ipadress'}</b></td>
1076 <td width='3%' align='center'><b>$Lang::tr{'wio network'}</b></td>
1077 <td width='15%' align='center'><b>$Lang::tr{'wio_lanname'}</b></td>
1078 <td width='15%' align='center'><b>$Lang::tr{'wio_wanname'}</b></td>
1079 <td width='24%' align='center'><b>$Lang::tr{'wio_dyndns_hosts'}</b></td>
1080 <td width='11%' align='center'><b>$Lang::tr{'wio image'}</b></td>
1081 <td width='14%' align='center'><b>$Lang::tr{'wio_wancheck'}</b></td>
1083 <tr bgcolor='$color{'color22'}' height='20'>
1084 <td align='center'>01</td>
1085 <td align='center'><font color='$Header::colourred'>$redip</b></font></td>
1086 <td align='center'><img align='middle' src='$imgstatic/red.png' alt='$Lang::tr{'internet'}' title='$Lang::tr{'internet'}' /></td>
1087 <td align='center'><font color='$Header::colourgreen'>".$mainsettings{'HOSTNAME'}.".".$mainsettings{'DOMAINNAME'}."</font></td>
1088 <td align='center'><font color='$Header::colourred'>".( $redip ne '-' ?
(gethostbyaddr(pack("C4", split (/\./, $redip)), 2))[0] : '-' )."</font></td>
1092 if ( -s
"$dyndnsconfig" ) {
1094 open(FILE
, "< $dyndnsconfig");
1104 @temp = split (/\,/, $_);
1106 if ( $temp[7] eq "on" ) { $bgcolor = ( &General
::DyndnsServiceSync
(&General
::GetDyndnsRedIP
,$temp[1],$temp[2]) ?
"$Header::colourgreen" : "$Header::colourred" ); }
1108 print"<font color='$bgcolor'>$temp[1].$temp[2]</font>";
1110 if ( $iddyndns++ ne ($ddns-1) ) { print"<b>, </b>"; }
1113 else { print"<b> - </b>"; }
1118 <table bgcolor='".( -e
$redactive ?
"${Header::colourgreen}" : "${Header::colourred}" )."' cellpadding='2' cellspacing='0' width='100%'>
1120 <td align='center'><font color='white'><b>".( -e
$redactive ?
$Lang::tr
{'wio_wan_up'} : $Lang::tr
{'wio_wan_down'} )."</b></font></td>
1124 <td align='center'><font color='$Header::colourred'>".( -e
"$redactive" ?
&General
::age
("$redactive") : '-' )."</font></td>
1126 <tr height='1'><td colspan='9' bgcolor='#696565'></td></tr>
1132 ## vpn connection(s)
1134 if ( -e
"$vpnpid" ) {
1136 @vpnstatus = `/usr/local/bin/ipsecctrl I`;
1139 <table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1141 <td width='28%' bgcolor='$color{'color20'}' align='left'><b> $Lang::tr{'wio_vpn_con'}</b></td>
1142 <td width='72%'> </td>
1144 <tr><td colspan='2'> </td></tr>
1146 <table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1147 <tr bgcolor='$color{'color20'}' height='20'>
1148 <td width='3%' align='center'><b>$Lang::tr{'wio_id'}</b></td>
1149 <td width='19%' align='center'><b>$Lang::tr{'wio checked'}</b></td>
1150 <td width='20%' align='center'><b>$Lang::tr{'name'}</b></td>
1151 <td width='8%' align='center'><b>$Lang::tr{'type'}</b></td>
1152 <td width='25%' align='center'><b>$Lang::tr{'wio_common_name'}</b></td>
1153 <td width='11%' align='center'><b>$Lang::tr{'wio image'}</b></td>
1154 <td width='14%' align='center'><b>$Lang::tr{'wio_ovpn_connected'}</b></td>
1158 foreach $key (sort SortByTunnelName
(keys(%vpnconfighash))) {
1162 if ( -e
'/var/log/wio/.vpncache' ) {
1163 $vpncheck = strftime
("%d.%m.%Y - %H:%M:%S",localtime(((stat('/var/log/wio/.vpncache'))[9])));
1166 $status = "bgcolor='${Header::colourred}'";
1167 $statustxt = "$Lang::tr{'capsclosed'}";
1169 if ($vpnconfighash{$key}[0] eq 'off') {
1170 $status = "bgcolor='${Header::colourblue}'";
1171 $statustxt = "$Lang::tr{'capsclosed'}";
1174 foreach (@vpnstatus) {
1175 if ($_ =~ /$vpnconfighash{$key}[1]\{.*INSTALLED/) {
1176 $status = "bgcolor='${Header::colourgreen}'";
1177 $statustxt = "$Lang::tr{'capsopen'}";
1182 print"<tr".($idvpn % 2?
" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'>";
1184 my $vpnnr = $idvpn+1;
1186 printf ("<td align='center'> %02d</td>", $vpnnr);
1188 print"<td align='center'>$vpncheck</td>
1189 <td align='center'>$vpnconfighash{$key}[1]</td>
1190 <td align='center'><img align='middle' src='$imgstatic/".( $vpnconfighash{$key}[3] eq 'host' ?
"vpnrw.png' alt='$Lang::tr{'wio_rw'}' title='$Lang::tr{'wio_rw'}'" : "vpnn2n.png' alt='$Lang::tr{'wio_n2n'}' title='$Lang::tr{'wio_n2n'}'")." /></td>
1191 <td align='center'>".($vpnconfighash{$key}[2] eq '%auth-dn' ?
"$vpnconfighash{$key}[9]" : ($vpnconfighash{$key}[4] eq 'cert' ?
"$vpnconfighash{$key}[2]" : ($vpnconfighash{$key}[8] ne '' ?
"$vpnconfighash{$key}[10]" : " ")))."</td>
1193 <table $status cellpadding='2' cellspacing='0' width='100%'>
1195 <td align='center'><font color='white'><b>$statustxt</b></font></td>
1199 <td align='center' height='20'> </td>
1203 if ($vpnconfighash{$key}[25] && $wiosettings{'CLIENTREMARK'} eq 'on') {
1204 print"<tr".($idvpn % 2?
" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'><td> </td><td colspan='16' align='left'>$vpnconfighash{$key}[25]</td></tr>";
1206 print"<tr height='1'><td colspan='7' bgcolor='#696565'></td></tr>";
1214 ## openvpn connection(s)
1216 if ( -e
"$ovpnpid" ) {
1218 @ovpnstatus = `cat /var/run/ovpnserver.log`;
1221 <table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1223 <td width='28%' bgcolor='$color{'color20'}' align='left'><b> $Lang::tr{'wio_ovpn_con'}</b></td>
1224 <td width='72%'> </td>
1226 <tr><td colspan='2'> </td></tr>
1228 <table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1229 <tr bgcolor='$color{'color20'}' height='20'>
1230 <td width='3%' align='center'><b>$Lang::tr{'wio_id'}</b></td>
1231 <td width='19%' align='center'><b>$Lang::tr{'wio checked'}</b></td>
1232 <td width='20%' align='center'><b>$Lang::tr{'wio ipadress'}</b></td>
1233 <td width='8%' align='center'><b>$Lang::tr{'type'}</b></td>
1234 <td width='25%' align='center'><b>$Lang::tr{'common name'}</b></td>
1235 <td width='11%' align='center'><b>$Lang::tr{'wio image'}</b></td>
1236 <td width='14%' align='center'><b>$Lang::tr{'wio_ovpn_connected'}</b></td>
1240 foreach $key (keys %ovpnconfighash) {
1242 my ( $ovpnclt, $ovpntime, $ovpnrwip, $ovpncheck ) = '';
1244 if ( -e
'/var/log/wio/.ovpncache' ) {
1245 $ovpncheck = strftime
("%d.%m.%Y - %H:%M:%S",localtime(((stat('/var/log/wio/.ovpncache'))[9])));
1248 print"<tr".($idovpn % 2?
" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'>";
1250 my $ovpnnr = $idovpn+1;
1252 printf ("<td align='center' height='20'> %02d</td>", $ovpnnr);
1254 if ($ovpnconfighash{$key}[3] eq 'net') {
1255 $image = "$imgstatic/ovpnn2n.png";
1256 $text = "$Lang::tr{'wio_n2n'}";
1259 $image = "$imgstatic/ovpnrw.png";
1260 $text = "$Lang::tr{'wio_rw'}";
1263 if ( $ovpnconfighash{$key}[0] eq 'off' ) {
1264 $status = "${Header::colourblue}";
1265 $statustxt = "$Lang::tr{'capsclosed'}";
1269 if ($ovpnconfighash{$key}[3] eq 'net') {
1270 if (-e
"/var/run/$ovpnconfighash{$key}[1]n2n.pid") {
1273 my $tport = $ovpnconfighash{$key}[22];
1274 my $tnet = new Net
::Telnet
( Timeout
=>5, Errmode
=>'return', Port
=>$tport);
1276 $tnet->open('127.0.0.1');
1277 @output = $tnet->cmd(String
=> 'state', Prompt
=> '/(END.*\n|ERROR:.*\n)/');
1278 @tustate = split(/\,/, $output[1]);
1279 $ovpntime = &WIO
::contime
(scalar localtime($tustate[0]));
1281 if (($tustate[1] eq 'CONNECTED')) {
1282 $status = "${Header::colourgreen}";
1283 $statustxt = "$Lang::tr{'capsopen'}";
1285 $status = "${Header::colourred}";
1286 $statustxt = "$tustate[1]";
1292 foreach (@ovpnstatus) {
1293 if ( $_ =~ /^(.+),(\d+\.\d+\.\d+\.\d+\:\d+),(\d+),(\d+),(.+)/ ) {
1294 @match = split (m/^(.+),(\d+\.\d+\.\d+\.\d+\:\d+),(\d+),(\d+),(.+)/, $_);
1295 $match[1] =~ s/[_]/ /g;
1298 if ( $match[1] ne "Common Name" && ($match[1] eq $ovpnconfighash{$key}[2]) ) {
1299 $ovpnclt = $match[1];
1300 $ovpntime = &WIO
::contime
($match[5]);
1303 if ( $_ =~ /^(\d+\.\d+\.\d+\.\d+),(.+),(\d+\.\d+\.\d+\.\d+\:\d+),(.+)/ ) {
1304 @match = split(m/^(\d+\.\d+\.\d+\.\d+),(.+),(\d+\.\d+\.\d+\.\d+\:\d+),(.+)/, $_);
1307 if ( $match[1] ne "Virtual Address" && $match[2] eq $ovpnclt ) {
1308 $ovpnrwip = $match[1];
1309 $ovpncheck = &WIO
::statustime
($match[4]);
1312 if ( $ovpnclt eq $ovpnconfighash{$key}[2] ) {
1313 $status = "${Header::colourgreen}";
1314 $statustxt = "$Lang::tr{'capsopen'}";
1317 $status = "${Header::colourred}";
1318 $statustxt = "$Lang::tr{'capsclosed'}";
1325 <td align='center'>$ovpncheck</td>
1326 <td align='center'>".( defined($ovpnrwip)?
"$ovpnrwip" : " ")."</td>
1327 <td align='center'><img align='middle' src='$image' alt='$text' title='$text' /></td>
1328 <td align='center'>".($ovpnconfighash{$key}[2] eq '%auth-dn' ?
"$ovpnconfighash{$key}[9]" : ($ovpnconfighash{$key}[4] eq 'cert' ?
"$ovpnconfighash{$key}[2]": " "))."</td>
1329 <td align='center'><table bgcolor='$status' cellpadding='2' cellspacing='0' width='100%'><tr height='20'><td align='center'><font color='white'><b>$statustxt</b></font></td></tr></table></td>
1330 <td align='center'>".(defined($ovpntime)?
"$ovpntime" : " ")."</td>
1333 if ($ovpnconfighash{$key}[25] && $wiosettings{'CLIENTREMARK'} eq 'on') {
1334 print"<tr".($idovpn % 2?
" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'><td> </td><td colspan='16' align='left'>$ovpnconfighash{$key}[25]</td></tr>";
1337 print"<tr height='1'><td colspan='17' bgcolor='#696565'></td></tr>";
1348 <table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1350 <td width='28%' bgcolor='$color{'color20'}' align='left'><b> $Lang::tr{'wio_clients'}</b></td>
1351 <td width='72%'> </td>
1353 <tr><td colspan='2'> </td></tr>
1356 <table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1357 <tr bgcolor='$color{'color20'}' height='20'>
1358 <td width='3%' align='center'><b>$Lang::tr{'wio_id'}</b></td>
1359 <td width='4%' align='center'><b>$Lang::tr{'wio_activ'}</b></td>
1360 <td width='5%' align='center'><b>$Lang::tr{'wio_check'}</b></td>
1361 <td width='15%' align='center'><b>$Lang::tr{'wio checked'}</b></td>
1362 <td width='4%' align='center'><b>$Lang::tr{'wio_webinterface'}</b></td>
1363 <td width='11%' align='center'><a href='$ENV{'SCRIPT_NAME'}?IPADR'><b>$Lang::tr{'wio ipadress'}</b></a></td>
1364 <td width='5%' align='center'><b>$Lang::tr{'wio network'}</b></td>
1365 <td width='20%' align='center'><a href='$ENV{'SCRIPT_NAME'}?HOST'><b>$Lang::tr{'wio name'}</b></a></td>
1366 <td width='11%' align='center'><b>$Lang::tr{'wio image'}</b></td>
1367 <td width='4%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'><input type='hidden' name='ACTION' value='$Lang::tr{'wio_refresh'}' /><input type='image' name='$Lang::tr{'wio_refresh'}' src='$imgstatic/refresh.png' align='middle' alt='$Lang::tr{'wio_refresh'}' title='$Lang::tr{'wio_refresh'}' /></form></td>
1368 <td width='4%' colspan='2' align='center'><b>$Lang::tr{'wio_dyndns'}</b></td>
1369 <td width='12%' colspan='4' align='center'><b>$Lang::tr{'action'}</b></td>
1370 <td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'><input type='hidden' name='ACTION' value='$Lang::tr{'wio_remove_all'}' /><input type='image' name='$Lang::tr{'wio_remove_all'}' src='/images/delete.gif' align='middle' alt='$Lang::tr{'wio_remove_all'}' title='$Lang::tr{'wio_remove_all'}' onClick=\"return confirm('$Lang::tr{'wio_remove_all_hint'}')\"/></form></td>
1374 for (my $a=0; $a<$nr; $a++) {
1376 my $gif = 'off.gif';
1377 my $gdesc = $Lang::tr
{'wio_client_off'};
1378 my $dyndnsimg = 'on.gif';
1379 my $dyndnsimgtxt = $Lang::tr
{'wio_dyndns_on'};
1380 my $mailonimg = 'wio/mailgreenon.png';
1381 my $mailonimgtxt = $Lang::tr
{'wio_mail_online_on'};
1382 my $mailoffimg = 'wio/mailredon.png';
1383 my $mailoffimgtxt = $Lang::tr
{'wio_mail_offline_on'};
1388 if ( $activ[$a] eq 'on' ) {
1390 $gdesc = $Lang::tr
{'wio_client_on'};
1393 if ( $dyndns[$a] ne 'on' ) {
1394 $dyndnsimg = 'off.gif';
1395 $dyndnsimgtxt = $Lang::tr
{'wio_dyndns_off'};
1398 if ( $sendemailon[$a] ne 'on' ) {
1399 $mailonimg = 'wio/mailgreenoff.png';
1400 $mailonimgtxt = $Lang::tr
{'wio_mail_online_off'};
1403 if ( $sendemailoff[$a] ne 'on' ) {
1404 $mailoffimg = 'wio/mailredoff.png';
1405 $mailoffimgtxt = $Lang::tr
{'wio_mail_offline_off'};
1408 if ( $webinterface[$a] eq 'HTTP' ) {
1409 $webimg = 'wio/http.png';
1411 elsif ( $webinterface[$a] eq 'HTTPS' ) {
1412 $webimg = 'wio/https.png';
1415 $webimg = 'wio/none.png';
1418 $bgcolor = $status[$a] eq "on" ?
"${Header::colourgreen}" : ($status[$a] eq "off" && $dates[$a] eq "") ?
"${Header::colourblue}" : "${Header::colourred}";
1419 $statustxt = $status[$a] eq "on" ?
"$Lang::tr{'wio up'}" : ($status[$a] eq "off" && $dates[$a] eq "") ?
"$Lang::tr{'wio_no_image'}" : "$Lang::tr{'wio down'}";
1421 print"<tr".($a % 2?
" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'>";
1422 printf ("<td align='center'> %02d</td>", $a+1);
1424 print"<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1425 <input type='hidden' name='ACTION' value='$Lang::tr{'enable disable client'}' />
1426 <input type='image' name='$Lang::tr{'enable disable client'}' src='/images/$gif' align='middle' alt='$gdesc' title='$gdesc' />
1427 <input type='hidden' name='ID' value='$a' /></form></td>";
1429 if ( $pingmethode[$a] eq 'ip') {
1430 print"<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1431 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_ip_on'}' />
1432 <input type='image' name='$Lang::tr{'wio_ip_on'}' src='/images/wio/ip.png' align='middle' alt='$Lang::tr{'wio_ip_on'}' title='$Lang::tr{'wio_ip_on'}' />
1433 <input type='hidden' name='ID' value='$a' /></form></td>";
1436 print"<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1437 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_fqdn_on'}' />
1438 <input type='image' name='$Lang::tr{'wio_fqdn_on'}' src='/images/wio/fqdn.png' align='middle' alt='$Lang::tr{'wio_fqdn_on'}' title='$Lang::tr{'wio_fqdn_on'}' />
1439 <input type='hidden' name='ID' value='$a' /></form></td>";
1442 print"<td align='center'>$dates[$a]</td>";
1444 print"<td align='center'><img align='middle' src='/images/$webimg' /></td>";
1446 if ( $webinterface[$a] eq 'HTTP' ) {
1447 print"<td align='center'><a title=\"$Lang::tr{'wio_webinterface_link'}\" href=\"http://$ipaddresses[$a]\" target=\"_blank\">$ipaddresses[$a]</a></td>";
1449 elsif ( $webinterface[$a] eq 'HTTPS' ) {
1450 print"<td align='center'><a title=\"$Lang::tr{'wio_webinterface_link'}\" href=\"https://$ipaddresses[$a]\" target=\"_blank\">$ipaddresses[$a]</a></td>";
1453 print"<td align='center'>$ipaddresses[$a]</td>";
1456 my $dotip = length($ipaddresses[$a]) - rindex($ipaddresses[$a],'.');
1458 foreach (@devs_color) {
1462 foreach $interface (@devs_net) {
1463 next if ( $netsettings{"$ic"."_DEV"} eq 'red0' && ($netsettings{"RED_TYPE"} eq 'DHCP' || $netsettings{"RED_TYPE"} eq 'PPPOE'));
1464 if ( $netsettings{"$ic"."_DEV"} eq $interface ) {
1465 if ( &General
::IpInSubnet
($ipaddresses[$a], $netsettings{"$ic"."_NETADDRESS"}, $netsettings{"$ic"."_NETMASK"}) ) {
1466 print"<td align='center' height='20'><img src='$imgstatic/$devs_img[$in]' alt='$Lang::tr{$devs_alt[$in]}' title='$Lang::tr{$devs_alt[$in]}' /></td>";
1474 if ($netsettings{"RED_TYPE"} eq 'DHCP' || $netsettings{"RED_TYPE"} eq 'PPPOE') {
1475 my $redipadr = qx'ip addr | grep red0 | grep inet | awk "{print \$2}"';
1476 my @rednet = split ("/", $redipadr);
1478 my $red_netmask = General
::iporsubtodec
($rednet[1]);
1479 my $red_netaddress = Network
::get_netaddress
("$rednet[0]/$red_netmask");
1481 if ( &General
::IpInSubnet
($ipaddresses[$a], $red_netaddress, $red_netmask) ) {
1482 print"<td align='center' height='20'><img src='$imgstatic/red.png' alt='$Lang::tr{'wio_red_lan'}' title='$Lang::tr{'wio_red_lan'}' /></td>";
1486 print"<td align='center'><img align='middle' src='$imgstatic/white.png' alt='$Lang::tr{'wio_unknown_lan'}' title='$Lang::tr{'wio_unknown_lan'}' /></td>";
1491 if ( -e
"$vpnpid" ) {
1492 foreach $key (keys(%vpnconfighash)) {
1493 next unless ($vpnconfighash{$key}[3] eq 'net');
1495 my $convertip = &General
::ipcidr2msk
($vpnconfighash{$key}[11]);
1497 my @net = split ("/", $convertip);
1499 $vpnn2nip = $net[0];
1500 $vpnn2nmask = length($net[1]) - rindex($net[1],'.');
1502 if (substr($ipaddresses[$a],0,length($ipaddresses[$a])-$dotip) eq substr($vpnn2nip,0,length($vpnn2nip)-$vpnn2nmask)) {
1503 print"<td align='center'><img align='middle' src='$imgstatic/vpn.png' alt='IPSec' title='IPSec' /></td>";
1509 if ( $ovpnsettings{'DOVPN_SUBNET'} ne '' ) {
1510 @match = split ("/", $ovpnsettings{'DOVPN_SUBNET'});
1512 if ( &General
::IpInSubnet
($ipaddresses[$a], $match[0], $match[1]) ) {
1513 print"<td align='center'><img src='$imgstatic/ovpn.png' alt='OpenVPN' title='OpenVPN' /></td>";
1518 if ( %ovpnccdconfhash ne '' ) {
1519 foreach $key (keys(%ovpnccdconfhash)) {
1521 my $convertip = &General
::ipcidr2msk
($ovpnccdconfhash{$key}[1]);
1523 my @net = split ("/", $convertip);
1525 $vpnn2nip = $net[0];
1526 $vpnn2nmask = length($net[1]) - rindex($net[1],'.');
1528 if (substr($ipaddresses[$a],0,length($ipaddresses[$a])-$dotip) eq substr($vpnn2nip,0,length($vpnn2nip)-$vpnn2nmask)) {
1529 print"<td align='center'><img align='middle' src='$imgstatic/ovpn.png' alt='OpenVPN' title='OpenVPN' /></td>";
1537 if ( $webinterface[$a] eq 'HTTP' ) {
1538 print"<td align='center'><a title=\"$Lang::tr{'wio_webinterface_link'}\" href=\"http://$names[$a]\" target=\"_blank\">$names[$a]</a></td>";
1540 elsif ( $webinterface[$a] eq 'HTTPS' ) {
1541 print"<td align='center'><a title=\"$Lang::tr{'wio_webinterface_link'}\" href=\"https://$names[$a]\" target=\"_blank\">$names[$a]</a></td>";
1544 print"<td align='center'>$names[$a]</td>";
1549 <table bgcolor='$bgcolor' cellpadding='2' cellspacing='0' width='100%'>
1551 <td align='center'><font color='$color{'color21'}'><b>$statustxt</b></font></td>
1556 <td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1557 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_sc_refresh'}' />
1558 <input type='image' name='$Lang::tr{'wio_sc_refresh'}' src='$imgstatic/refresh.png' align='middle' alt='$Lang::tr{'wio_sc_refresh'}' title='$Lang::tr{'wio_sc_refresh'}' />
1559 <input type='hidden' name='ID' value='$a' /></form></td>
1561 <td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1562 <input type='hidden' name='ACTION' value='$Lang::tr{'enable disable dyndns'}' />
1563 <input type='image' name='$Lang::tr{'enable disable dyndns'}' src='/images/$dyndnsimg' align='middle' alt='$dyndnsimgtxt' title='$dyndnsimgtxt' />
1564 <input type='hidden' name='ID' value='$a' /></form></td>";
1566 if ( defined($dyndns[$a]) && ($dyndns[$a] eq 'on') ) {
1567 print"<td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1568 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_dyndns_refresh'}' />
1569 <input type='image' name='$Lang::tr{'wio_dyndns_refresh'}' src='/images/reload.gif' align='middle' alt='$Lang::tr{'wio_dyndns_refresh'}' title='$Lang::tr{'wio_dyndns_refresh'}' />
1570 <input type='hidden' name='ID' value='$a' /></form></td>";
1573 print"<td width='3%' align='center'>-</td>";
1576 if ( -e
"/var/log/rrd/wio/$id[$a].rrd" ) {
1578 <td width='3%' align='center'><form method='post' action='/cgi-bin/wiographs.cgi' enctype='multipart/form-data'>
1579 <input type='image' name='$Lang::tr{'wio_graphs'}' src='$imgstatic/graph.png' align='middle' alt='$Lang::tr{'wio_graphs'}' title='$Lang::tr{'wio_graphs'}' />
1580 <input type='hidden' name='HOSTID' value='$id[$a]' /><input type='hidden' name='HOSTNAME' value='$names[$a]' /></form></td>
1584 print "<td width='3%' align='center'><img src='$imgstatic/no_graph.png' align='middle' alt='$Lang::tr{'wio_no_graphs'}' title='$Lang::tr{'wio_no_graphs'}' /></td>";
1587 if ( $wiosettings{'SENDEMAIL'} eq 'on') {
1588 print"<td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1589 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_mail_online'}' />
1590 <input type='image' name='$Lang::tr{'wio_mail_online'}' src='/images/$mailonimg' align='middle' alt='$mailonimgtxt' title='$mailonimgtxt' />
1591 <input type='hidden' name='ID' value='$a' /></form></td>
1592 <td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1593 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_mail_offline'}' />
1594 <input type='image' name='$Lang::tr{'wio_mail_offline'}' src='/images/$mailoffimg' align='middle' alt='$mailoffimgtxt' title='$mailoffimgtxt' />
1595 <input type='hidden' name='ID' value='$a' /></form></td>";
1598 print"<td width='3%' align='center'>-</td>
1599 <td width='3%' align='center'>-</td>";
1603 <td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1604 <input type='hidden' name='ACTION' value='$Lang::tr{'edit'}' />
1605 <input type='image' name='$Lang::tr{'edit'}' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' />
1606 <input type='hidden' name='ID' value='$a' /></form></td>
1608 <td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1609 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_remove_client'}' />
1610 <input type='image' name='$Lang::tr{'wio_remove_client'}' src='/images/delete.gif' align='middle' alt='$Lang::tr{'wio_remove_client'}' title='$Lang::tr{'wio_remove_client'}' onClick=\"return confirm('$Lang::tr{'wio_remove_client_hint'}')\" />
1611 <input type='hidden' name='ID' value='$a' /></form></td></tr>
1614 if ($remark[$a] && $wiosettings{'CLIENTREMARK'} eq 'on') {
1615 print"<tr".($a % 2?
" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'><td> </td><td colspan='16' align='left'>$remark[$a]</td></tr>";
1617 print"<tr height='1'><td colspan='17' bgcolor='#696565'></td></tr>";
1622 &Header
::closebox
();
1626 ## add / modify client
1628 $checked{'EN'}{'on'} = ($wiosettings{'EN'} eq '' ) ?
'' : "checked='checked'";
1630 $checked{'DYNDNS'}{'off'} = $checked{'DYNDNS'}{'on'} = '';
1631 $checked{'DYNDNS'}{$wiosettings{'DYNDNS'}} = "checked='checked'";
1633 $checked{'SENDEMAILON'}{'off'} = $checked{'SENDEMAILON'}{'on'} = '';
1634 $checked{'SENDEMAILON'}{$wiosettings{'SENDEMAILON'}} = "checked='checked'";
1636 $checked{'SENDEMAILOFF'}{'off'} = $checked{'SENDEMAILOFF'}{'on'} = '';
1637 $checked{'SENDEMAILOFF'}{$wiosettings{'SENDEMAILOFF'}} = "checked='checked'";
1639 if (! defined($errormessage) && $wiosettings{'ACTION'} ne $Lang::tr
{'edit'} ) {
1640 $wiosettings{'PINGMETHODE'} = 'ip';
1643 $checked{'PINGMETHODE'}{'ip'} = $checked{'PINGMETHODE'}{'fqdn'} = '';
1644 $checked{'PINGMETHODE'}{$wiosettings{'PINGMETHODE'}} = "checked='checked'";
1646 $selected{'WEBINTERFACE'}{'----'} = '';
1647 $selected{'WEBINTERFACE'}{'HTTP'} = '';
1648 $selected{'WEBINTERFACE'}{'HTTPS'} = '';
1649 $selected{'WEBINTERFACE'}{$wiosettings{'WEBINTERFACE'}} = "selected='selected'";
1651 $buttontext = $Lang::tr
{'wio_client_add'};
1653 if ( $wiosettings{'ACTION'} eq $Lang::tr
{'edit'} || defined($errormessage) && ! defined($message) ) {
1654 &Header
::openbox
('100%', 'left', $Lang::tr
{'wio_edit_client'});
1655 $buttontext = $Lang::tr
{'update'};
1658 &Header
::openbox
('100%', 'left', $Lang::tr
{'wio_edit_settings'});
1661 if (! defined($errormessage) && $wiosettings{'ACTION'} ne $Lang::tr
{'edit'} ) {
1663 <table width='100%' border='0' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1665 <td width='28%' bgcolor='$color{'color20'}' align='left' height='20'><b> $Lang::tr{'wio_add'}</b></td>
1666 <td width='72%' align='right'> </td>
1676 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
1677 <input type='hidden' name='ID' value='$wiosettings{'ID'}' />
1678 <input type='hidden' name='CLIENTID' value='$wiosettings{'CLIENTID'}' />
1679 <input type='hidden' name='ONLINE' value='$wiosettings{'ONLINE'}' />
1680 <input type='hidden' name='TIMESTAMP' value='$wiosettings{'TIMESTAMP'}' />
1684 <table width='100%' border='0' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1686 <td height='30'>$Lang::tr{'wio_client_enable'}</td>
1687 <td align='left'><input type='checkbox' name='EN' $checked{'EN'}{'on'} /></td>
1688 <td colspan='4'> </td>
1691 <td height='30'>$Lang::tr{'wio ipadress'}:</td>
1692 <td align='left'><input type='text' name='IPADR' value='$wiosettings{'IPADR'}' size='25' /></td>
1693 <td>$Lang::tr{'wio name'}:</td>
1694 <td align='left'><input type='text' name='HOST' value='$wiosettings{'HOST'}' size='25' /></td>
1695 <td>$Lang::tr{'remark'}:</td>
1696 <td align='left'><input type='text' name='REMARK' value='$wiosettings{'REMARK'}' size='30'></td>
1699 <td height='30'>$Lang::tr{'wio_ping_send'}:</td>
1700 <td align='left'><input type='radio' name='PINGMETHODE' value='ip' $checked{'PINGMETHODE'}{'ip'} /> IP <input type='radio' name='PINGMETHODE' value='fqdn' $checked{'PINGMETHODE'}{'fqdn'} /> FQDN</td>
1701 <td>$Lang::tr{'wio_dyndns'}:</td>
1702 <td align='left'><input type='checkbox' name='DYNDNS' $checked{'DYNDNS'}{'on'} /></td>
1705 if ( $wiosettings{'SENDEMAIL'} eq 'on' ) {
1706 print"<td>$Lang::tr{'wio_sendemail'}:</td>
1707 <td><input type='checkbox' name='SENDEMAILON' $checked{'SENDEMAILON'}{'on'} /> $Lang::tr{'wio_online'} <input type='checkbox' name='SENDEMAILOFF' $checked{'SENDEMAILOFF'}{'on'} /> $Lang::tr{'wio_offline'}</td>";
1710 print"<td colspan='2'> </td>";
1716 <td height='30'>$Lang::tr{'wio_link_open'}:</td>
1717 <td align='left' colspan='5'>
1718 <select size='1' name='WEBINTERFACE' width='80' style='width: 80px'>
1719 <option value='----' $selected{'WEBINTERFACE'}{'----'}>----</option>
1720 <option value='HTTP' $selected{'WEBINTERFACE'}{'HTTP'}>HTTP</option>
1721 <option value='HTTPS' $selected{'WEBINTERFACE'}{'HTTPS'}>HTTPS</option>
1726 <table width='100%' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1728 <td width='20%' align='center'> </td>
1731 if ( $buttontext eq $Lang::tr
{'update'} && ( defined($errormessage) || $wiosettings{'ACTION'} eq $Lang::tr
{'edit'}) && ! defined($message) ) {
1732 print"<td width='20%' align='center'> </td>
1733 <td width='20%' align='center'> </td>
1734 <td width='20%' align='center'><input type='hidden' name='ACTION' value='$Lang::tr{'wio_client_add'}' /><input type='submit' name='SUBMIT' value='$buttontext' /></td>
1735 <td width='20%' align='center'><input type='button' onClick='location.href=\"/cgi-bin/wio.cgi\"' value='$Lang::tr{'wio_back'}'></form></td>";
1738 print"<td width='20%' align='center'> </td>
1739 <td width='20%' align='center'> </td>
1740 <td width='20%' align='center'> </td>
1741 <td width='20%' align='right'><input type='hidden' name='ACTION' value='$Lang::tr{'wio_client_add'}' /><input type='submit' name='SUBMIT' value='$buttontext' /></form></td>";
1749 if ( $wiosettings{'ENABLE'} eq 'on' && !$errormessage && $wiosettings{'ACTION'} ne $Lang::tr
{'edit'} || $message == 2 ) {
1753 ## arp table entries
1756 <table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1758 <td width='28%' bgcolor='$color{'color20'}' align='left' height='20'><b> $Lang::tr{'wio_arp_table_entries'}</b></td>
1759 <td width='72%'> </td>
1761 <tr><td colspan='2'> </td></tr>
1764 <table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1765 <tr bgcolor='$color{'color20'}'>
1766 <td width='5%' align='center' height='20'><b>$Lang::tr{'wio_id'}</b></td>
1767 <td width='20%' align='center' height='20'><b>$Lang::tr{'wio_hwaddress'}</b></td>
1768 <td width='20%' align='center' height='20'><b>$Lang::tr{'wio ipadress'}</b></td>
1769 <td width='15%' align='center' height='20'><b>$Lang::tr{'wio network'}</b></td>
1770 <td width='20%' align='center' height='20'><b>$Lang::tr{'wio name'}</b></td>
1771 <td width='15%' align='center' height='20'><b>$Lang::tr{'wio_iface'}</b></td>
1772 <td width='5%' align='center' height='20'><b>$Lang::tr{'action'}</b></td>
1776 $output = `/sbin/ip neigh list`;
1777 $output = &Header
::cleanhtml
($output,"y");
1781 foreach $line (split(/\n/, $output))
1783 if ($line =~ m/^(.*) dev ([^ ]+) lladdr ([0-9a-f:]*) (.*)$/) {
1784 my $arphost = gethostbyaddr(inet_aton
($1), AF_INET
);
1785 if ( $arphost eq 'localhost' ) { $arphost = ''; }
1786 push (@arpcache, "$3,$1,$arphost,$2\n");
1788 elsif ($line =~ m/^(.*) dev ([^ ]+) (.*)$/) {
1789 my $arphost = gethostbyaddr(inet_aton
($1), AF_INET
);
1790 if ( $arphost eq 'localhost' ) { $arphost = ''; }
1791 push (@arpcache, ",$1,$arphost,$2\n");
1797 &SortDataFile
('arpcache',@arpcache);
1799 foreach (@arpcache) {
1802 @line = split (/\,/, $_);
1804 print"<tr".($idarp % 2?
" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'>";
1805 printf ("<td align='center'> %02d</td>", $idarp+1);
1806 print"<td align='center'>$line[0]</td>
1807 <td align='center'>$line[1]</td>";
1811 foreach (@devs_color) {
1815 foreach $interface (@devs_net) {
1816 next if ( $netsettings{"$ic"."_DEV"} eq 'red0' && ($netsettings{"RED_TYPE"} eq 'DHCP' || $netsettings{"RED_TYPE"} eq 'PPPOE'));
1818 if ($netsettings{"$ic"."_DEV"} eq $interface) {
1819 if ( &General
::IpInSubnet
($line[1], $netsettings{"$ic"."_NETADDRESS"}, $netsettings{"$ic"."_NETMASK"}) ) {
1820 print"<td align='center'><img src='$imgstatic/$devs_img[$in]' alt='$Lang::tr{$devs_alt[$in]}' title='$Lang::tr{$devs_alt[$in]}' /></td>";
1829 if ($netsettings{"RED_TYPE"} eq 'DHCP' || $netsettings{"RED_TYPE"} eq 'PPPOE') {
1830 my $redipadr = qx'ip addr | grep red0 | grep inet | awk "{print \$2}"';
1831 my @rednet = split ("/", $redipadr);
1833 my $red_netmask = General
::iporsubtodec
($rednet[1]);
1834 my $red_netaddress = Network
::get_netaddress
("$rednet[0]/$red_netmask");
1836 if ( &General
::IpInSubnet
($line[1], $red_netaddress, $red_netmask) ) {
1837 print"<td align='center' height='20'><img src='$imgstatic/red.png' alt='$Lang::tr{'wio_red_lan'}' title='$Lang::tr{'wio_red_lan'}' /></td>";
1841 print"<td align='center'><img align='middle' src='$imgstatic/white.png' alt='$Lang::tr{'wio_unknown_lan'}' title='$Lang::tr{'wio_unknown_lan'}' /></td>";
1847 print"<td align='center'>$line[2]</td>
1848 <td align='center'>".&WIO
::color_devices
($line[3])."</td>";
1850 unless (&WIO
::checkinto
($line[1], '', @current)) {
1851 print"<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1852 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_add'}' />
1853 <input type='image' name='$Lang::tr{'wio_add'}' src='/images/add.gif' align='middle' alt='$Lang::tr{'wio_add'}' title='$Lang::tr{'wio_add'}' />
1854 <input type='hidden' name='ID' value='$idarp' /></form></td>";
1857 print"<td align='center'><img src='$imgstatic/add.png' align='middle' alt='$Lang::tr{'wio_no_add'}' title='$Lang::tr{'wio_no_add'}' /></td>";
1861 print"<tr height='1'><td colspan='17' bgcolor='#696565'></td></tr>";
1872 <table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1874 <td width='28%' bgcolor='$color{'color20'}' align='left' height='20'><b> $Lang::tr{'wio_import_file'}</b></td>
1875 <td width='72%'> </td>
1877 <tr><td colspan='2'> </td></tr>
1879 <table width='100%' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1880 <tr bgcolor='$color{'color22'}'>
1881 <form method='post' action='/cgi-bin/wio.cgi' enctype='multipart/form-data'>
1882 <td width='35%' align='right'>$Lang::tr{'wio_import_csv'} </td>
1883 <td width='40%' align='center'><input type='file' name='CSVFILE' size='30' /></td>
1884 <td width='25%' align='right'><input type='hidden' name='ACTION' value='$Lang::tr{'wio_import'}1' /><input type='submit' name='SUBMIT' value='$Lang::tr{'wio_import'}' /></td>
1887 <tr><td colspan='3'> </td></tr>
1888 <tr bgcolor='$color{'color22'}'>
1889 <form method='post' action='/cgi-bin/wio.cgi' enctype='multipart/form-data'>
1890 <td width='35%' align='right'>$Lang::tr{'wio_import_hosts'} </td>
1891 <td width='40%' align='center'> </td>
1892 <td width='25%' align='right'><input type='hidden' name='ACTION' value='$Lang::tr{'wio_import'}2' /><input type='submit' name='SUBMIT' value='$Lang::tr{'wio_import'}' /></td>
1895 <tr><td colspan='3'> </td></tr>
1896 <tr bgcolor='$color{'color22'}'>
1897 <form method='post' action='/cgi-bin/wio.cgi' enctype='multipart/form-data'>
1898 <td width='35%' align='right'>$Lang::tr{'wio_import_fixleases'} </td>
1899 <td width='40%' align='center'> </td>
1900 <td width='25%' align='right'><input type='hidden' name='ACTION' value='$Lang::tr{'wio_import'}3' /><input type='submit' name='SUBMIT' value='$Lang::tr{'wio_import'}' /></td>
1909 <table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1911 <td width='28%' bgcolor='$color{'color20'}' align='left' height='20'><b> $Lang::tr{'wio_net_scan'}</b></td>
1912 <td width='72%'> </td>
1915 <table width='100%' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1917 <td colspan='3'> </td>
1921 foreach (keys(%ifacecolor)) {
1922 if ( $_ eq 'GREEN' ) { $color = "$Header::colourgreen"; $net = $Lang::tr
{'wio_net_scan_green'}; }
1923 elsif ( $_ eq 'BLUE' ) { $color = "$Header::colourblue"; $net = $Lang::tr
{'wio_net_scan_blue'}; }
1924 else { $color = "$Header::colourorange"; $net = $Lang::tr
{'wio_net_scan_orange'}; }
1926 if ( $netsettings{"${_}_DEV"} eq 'disabled' || $netsettings{"${_}_DEV"} eq '' || $netsettings{"${_}_ADDRESS"} eq '' ) { next; }
1930 <tr bgcolor='$color{'color22'}'>
1931 <td width='35%' align='right'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>$Lang::tr{'wio_net_scan_vl'} <font color='$color'><b>$net</b></font> $Lang::tr{'wio_net_scan_l'}<font color='$color'><b> $netsettings{"${_}_DEV"} </b></font>$Lang::tr{'wio_net_scan_r'}</td>
1932 <td width='40%' align='center'><input type='text' name='${_}_IPLOW' value='$wiosettings{"${_}_IPLOW"}' size='14' STYLE='background-color:$color; text-align: center; color:white' /> - <input type='text' name='${_}_IPHIGH' value='$wiosettings{"${_}_IPHIGH"}' size='14' STYLE='background-color:$color; text-align: center; color:white' /></td>
1933 <td width='25%' align='right'><input type='hidden' name='ACTION' value='$ifacecolor{$_}' /><input type='hidden' name='ID' value='$netsettings{"${_}_DEV"}' /><input type='submit' name='SUBMIT' value='$Lang::tr{'wio_net_scan_run'}'></form></td>
1936 <td colspan='3'> </td>
1948 &Header
::closebox
();
1951 if ( $wiosettings{'ENABLE'} eq 'on' && !$errormessage && $wiosettings{'ACTION'} ne $Lang::tr
{'edit'} || $message == 2 ) {
1953 &Header
::openbox
('100%', 'left', $Lang::tr
{'wio_service'});
1956 <table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1957 <tr bgcolor='$color{'color22'}'>
1958 <td colspan='2' align='right'></td>
1961 if ( $wiosettings{'LOGGING'} eq 'on' ) {
1962 print"<td width='10%' align='right'><form method='post' action='/cgi-bin/logs.cgi/log.dat' enctype='multipart/form-data'><input type='hidden' name='SECTION' value='wio' /><input type='submit' name='SUBMIT' value='$Lang::tr{'system logs'}' /></form></td>";
1966 <td width='10%' align='right'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'><input type='hidden' name='ACTION' value='$Lang::tr{'edit'}1' /><input type='submit' name='SUBMIT' value='$Lang::tr{'wio_edit_set'}' /></form></td>
1972 &Header
::closebox
();
1975 &Header
::closebigbox
();
1976 &Header
::closepage
();
1978 ############################################################################################################################
1981 my ($data,@checkfile) = @_;
1988 if (rindex ($wiosettings{'SORT'},'Rev') != -1) {
1989 $qs = substr ($wiosettings{'SORT'},0,length($wiosettings{'SORT'})-3);
1991 if ($qs eq 'IPADR') {
1992 my @a = split (/\./,$entries{$a}->{$qs});
1993 my @b = split (/\./,$entries{$b}->{$qs});
2000 $entries{$b}->{$qs} cmp $entries{$a}->{$qs};
2004 $qs = $wiosettings{'SORT'};
2006 if ($qs eq 'IPADR') {
2007 my @a = split (/\./,$entries{$a}->{$qs});
2008 my @b = split (/\./,$entries{$b}->{$qs});
2015 $entries{$a}->{$qs} cmp $entries{$b}->{$qs};
2020 if ($data eq 'arpcache') {
2021 foreach (@checkfile) {
2023 @temp = split (',', $_);
2025 my @record = ('KEY',$idsort++,'MAC',$temp[0],'IPADR',$temp[1],'HOST',$temp[2],'REMARK',$temp[3],'IFACE',$temp[4]);
2027 %{$record} = @record;
2028 $entries{$record->{KEY
}} = $record;
2031 open(FILE
, "> $logdir/.arpcache");
2033 foreach (sort sortips
keys %entries) {
2034 print FILE
"$entries{$_}->{MAC},$entries{$_}->{IPADR},$entries{$_}->{HOST},$entries{$_}->{REMARK},$entries{$_}->{IFACE},$entries{$_}->{HW}\n";
2039 open (FILE
, "$logdir/.arpcache");
2044 foreach (@checkfile) {
2046 @temp = split (',', $_);
2048 my @record = ('KEY',$idsort++,'CLIENTID',$temp[0],'TIMESTAMP',$temp[1],'IPADR',$temp[2],'HOST',$temp[3],'EN',$temp[4],'REMARK',$temp[5],'DYNDNS',$temp[6],'SENDEMAILON',$temp[7],'SENDEMAILOFF',$temp[8],'PINGMETHODE',$temp[9],'ONLINE',$temp[10],'WEBINTERFACE',$temp[11]);
2050 %{$record} = @record;
2051 $entries{$record->{KEY
}} = $record;
2054 open(FILE
, "> $ipadrfile");
2056 foreach (sort sortips
keys %entries) {
2057 print FILE
"$entries{$_}->{CLIENTID},$entries{$_}->{TIMESTAMP},$entries{$_}->{IPADR},$entries{$_}->{HOST},$entries{$_}->{EN},$entries{$_}->{REMARK},$entries{$_}->{DYNDNS},$entries{$_}->{SENDEMAILON},$entries{$_}->{SENDEMAILOFF},$entries{$_}->{PINGMETHODE},$entries{$_}->{ONLINE},$entries{$_}->{WEBINTERFACE}\n";
2066 ############################################################################################################################
2070 print"<table width='100%'><tr><td colspan='2' height='35'><hr></td></tr></table>";
2074 ############################################################################################################################
2078 print"<table width='100%'><tr><td width='10%'><a href='/cgi-bin/wio.cgi'><img src='/images/wio/back.png' alt='$Lang::tr{'wio_back'}' title='$Lang::tr{'wio_back'}' /></a></td><td> </td></tr></table>";
2082 ############################################################################################################################
2086 &General
::readhasharray
($ipadrfile, \
%ipshash);
2088 open(FILE
, "< $ipadrfile");
2094 ############################################################################################################################
2098 open(FILE
, "> $ipadrfile");
2099 if ( defined($write) ) { print FILE
@write; }
2100 else { print FILE
@current; }
2105 ############################################################################################################################
2107 sub SortByTunnelName
2109 if ($vpnconfighash{$a}[1] lt $vpnconfighash{$b}[1]) {
2112 elsif ($vpnconfighash{$a}[1] gt $vpnconfighash{$b}[1]) {
2120 ############################################################################################################################
2124 if ( $wiosettings{'IPADR'} eq '' && $wiosettings{'PINGMETHODE'} eq 'ip' && $wiosettings{'DYNDNS'} eq '' ) {
2125 $errormessage = $Lang::tr
{'wio_ip_empty'};
2128 if ( $wiosettings{'IPADR'} ne '' && (! &General
::validip
($wiosettings{'IPADR'})) ) {
2129 $errormessage = $Lang::tr
{'wio_ip_error'};
2132 if ( $wiosettings{'HOST'} eq '' && $wiosettings{'PINGMETHODE'} eq 'fqdn' ) {
2133 $errormessage = $Lang::tr
{'wio_host_empty'};
2136 if ( $wiosettings{'HOST'} ne '' && (! &General
::validdomainname
($wiosettings{'HOST'})) ) {
2137 $errormessage = $Lang::tr
{'wio_host_error'};
2140 if ( $wiosettings{'DYNDNS'} eq 'on' && (! defined($errormessage)) ) {
2141 unless(&General
::validfqdn
($wiosettings{'HOST'})) { $errormessage = $Lang::tr
{'wio_fqdn_error'}; }
2142 ( $wiosettings{'IPADR'}, $infomessage ) = &WIO
::getdyndnsip
($wiosettings{'IPADR'}, $wiosettings{'HOST'});
2143 $wiosettings{'PINGMETHODE'} = 'fqdn';
2146 if ( $wiosettings{'ID'} eq '' && ! defined($errormessage) ) { $errormessage = &WIO
::checkinto
($wiosettings{'IPADR'}, $wiosettings{'HOST'}, @current); }
2148 if ( $wiosettings{'REMARK'} ne '' ) { $wiosettings{'REMARK'} =~ s/,/,/g; }