]>
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.1 2017/07/11 21:31: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) { printf("<option %s>%02s</option>\n",$selected{'CRON'}{$i},$i); }
923 </select> $Lang::tr{'wio min'}</td>
925 <tr><td colspan='3'> </td></tr>
927 <td align='right'>$Lang::tr{'wio timeout'}</td>
929 <td align='left'><select size='1' name='TIMEOUT' size='5'>
932 for ($i=1; $i<=15; $i++) { printf("<option %s>%02s</option>\n",$selected{'TIMEOUT'}{$i},$i); }
935 </select> $Lang::tr{'wio sec'}</td>
937 <tr><td colspan='3'> </td></tr>
939 <td align='right'>$Lang::tr{'wio_logging'}</td>
941 <td align='left'><input type='checkbox' name='LOGGING' $checked{'LOGGING'}{'on'} /></td>
943 <tr><td colspan='3'> </td></tr>
945 <td align='right'>$Lang::tr{'wio_clientremark'}</td>
947 <td align='left'><input type='checkbox' name='CLIENTREMARK' $checked{'CLIENTREMARK'}{'on'} /></td>
949 <tr><td colspan='3'> </td></tr>
953 if ( $wiosettings{'SENDEMAIL'} eq 'on' ) {
956 <td align='right'>$Lang::tr{'wio_mail_style'}:</td>
958 <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>
960 <tr><td colspan='3'> </td></tr>
962 <td align='right'>$Lang::tr{'wio_mailremark_enabled'}</td>
964 <td align='left'><input type='checkbox' name='MAILREMARK' $checked{'MAILREMARK'}{'on'}></td>
966 <tr><td colspan='3'> </td></tr>
969 if ( -e
"$ovpnaddon" || ! -z
"/var/ipfire/vpn/config" ) {
972 <td align='right'>$Lang::tr{'wio_mail_ovpnrw'}</td>
974 <td align='left'><input type='checkbox' name='OVPNRWMAIL' $checked{'OVPNRWMAIL'}{'on'}></td>
976 <tr><td colspan='3'> </td></tr>
978 <td align='right'>$Lang::tr{'wio_ovpn_cron'}</td>
980 <td align='left'><select size='1' name='OVPNCRON' size='5'>
983 for ($i=1; $i<=15; $i++) { printf("<option %s>%02s</option>\n",$selected{'OVPNCRON'}{$i},$i); }
986 </select> $Lang::tr{'wio min'}</td>
988 <tr><td colspan='3'> </td></tr>
992 <tr><td colspan='3'> </td></tr>
994 <td colspan='2'> </td>
995 <td align='left'><input type='hidden' name='ACTION' value='$Lang::tr{'wio_save'}1' /><input type='submit' name='submit' value='$Lang::tr{'wio_save'}' />"
996 .($wiosettings{'ENABLE'} ne 'off' ?
" <input type='button' onClick='location.href=\"/cgi-bin/wio.cgi\"' value='$Lang::tr{'wio_back'}'>" : "")
1003 &Header
::closebox
();
1004 &Header
::closebigbox
();
1005 &Header
::closepage
();
1009 ## wio client status
1011 if ( $wiosettings{'ENABLE'} eq 'on') {
1012 if ( !$errormessage && $wiosettings{'ACTION'} ne $Lang::tr
{'edit'} || $message == 2 ) {
1013 &Header
::openbox
('100%', 'left', $Lang::tr
{'wio stat'});
1015 foreach (@current) {
1018 ($id,$timestamp,$ipadr,$host,$on,$remark,$dyndns,$sendemailon,$sendemailoff,$pingmethode,$online,$webinterface) = split (/\,/, $_);
1020 if ( defined($dyndns) && ( $dyndns =~ 'on' ) ) {
1021 ($dyndnsip, $infomessage) = &WIO
::getdyndnsip
($ipadr, $host);
1023 if ( $dyndnsip ne $ipadr ) {
1031 if ( $on eq 'on' ) { push (@dates,($timestamp)); }
1032 else { push (@dates,('-')); }
1034 push (@ipaddresses,($ipadr));
1035 push (@names,($host));
1036 push (@activ,($on));
1037 push (@remark,($remark));
1038 push (@dyndns,($dyndns));
1039 push (@sendemailon,($sendemailon));
1040 push (@sendemailoff,($sendemailoff));
1041 push (@pingmethode,($pingmethode));
1042 push (@status,($online));
1043 push (@webinterface,($webinterface));
1045 push (@write, "$id,$timestamp,$ipadr,$host,$on,$remark,$dyndns,$sendemailon,$sendemailoff,$pingmethode,$online,$webinterface\n");
1050 if ( defined($write) ) { &writeips
(); }
1055 <table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1057 <td width='28%' bgcolor='$color{'color20'}' align='left'><b> $Lang::tr{'wio_wan_con'}</b></td>
1058 <td width='72%' align='right'> </td>
1060 <tr><td colspan='2'> </td></tr>
1063 <table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1064 <tr bgcolor='$color{'color20'}' height='20'>
1065 <td width='3%' align='center'><b>$Lang::tr{'wio_id'}</b></td>
1066 <td width='15%' align='center'><b>$Lang::tr{'wio ipadress'}</b></td>
1067 <td width='3%' align='center'><b>$Lang::tr{'wio network'}</b></td>
1068 <td width='15%' align='center'><b>$Lang::tr{'wio_lanname'}</b></td>
1069 <td width='15%' align='center'><b>$Lang::tr{'wio_wanname'}</b></td>
1070 <td width='24%' align='center'><b>$Lang::tr{'wio_dyndns_hosts'}</b></td>
1071 <td width='11%' align='center'><b>$Lang::tr{'wio image'}</b></td>
1072 <td width='14%' align='center'><b>$Lang::tr{'wio_wancheck'}</b></td>
1074 <tr bgcolor='$color{'color22'}' height='20'>
1075 <td align='center'>01</td>
1076 <td align='center'><font color='$Header::colourred'>$redip</b></font></td>
1077 <td align='center'><img align='middle' src='$imgstatic/red.png' alt='$Lang::tr{'internet'}' title='$Lang::tr{'internet'}' /></td>
1078 <td align='center'><font color='$Header::colourgreen'>".$mainsettings{'HOSTNAME'}.".".$mainsettings{'DOMAINNAME'}."</font></td>
1079 <td align='center'><font color='$Header::colourred'>".( $redip ne '-' ?
(gethostbyaddr(pack("C4", split (/\./, $redip)), 2))[0] : '-' )."</font></td>
1083 if ( -s
"$dyndnsconfig" ) {
1085 open(FILE
, "< $dyndnsconfig");
1095 @temp = split (/\,/, $_);
1097 if ( $temp[7] eq "on" ) { $bgcolor = ( &General
::DyndnsServiceSync
(&General
::GetDyndnsRedIP
,$temp[1],$temp[2]) ?
"$Header::colourgreen" : "$Header::colourred" ); }
1099 print"<font color='$bgcolor'>$temp[1].$temp[2]</font>";
1101 if ( $iddyndns++ ne ($ddns-1) ) { print"<b>, </b>"; }
1104 else { print"<b> - </b>"; }
1109 <table bgcolor='".( -e
$redactive ?
"${Header::colourgreen}" : "${Header::colourred}" )."' cellpadding='2' cellspacing='0' width='100%'>
1111 <td align='center'><font color='white'><b>".( -e
$redactive ?
$Lang::tr
{'wio_wan_up'} : $Lang::tr
{'wio_wan_down'} )."</b></font></td>
1115 <td align='center'><font color='$Header::colourred'>".( -e
"$redactive" ?
&General
::age
("$redactive") : '-' )."</font></td>
1117 <tr height='1'><td colspan='9' bgcolor='#696565'></td></tr>
1123 ## vpn connection(s)
1125 if ( -e
"$vpnpid" ) {
1127 @vpnstatus = `/usr/local/bin/ipsecctrl I`;
1130 <table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1132 <td width='28%' bgcolor='$color{'color20'}' align='left'><b> $Lang::tr{'wio_vpn_con'}</b></td>
1133 <td width='72%'> </td>
1135 <tr><td colspan='2'> </td></tr>
1137 <table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1138 <tr bgcolor='$color{'color20'}' height='20'>
1139 <td width='3%' align='center'><b>$Lang::tr{'wio_id'}</b></td>
1140 <td width='19%' align='center'><b>$Lang::tr{'wio checked'}</b></td>
1141 <td width='20%' align='center'><b>$Lang::tr{'name'}</b></td>
1142 <td width='8%' align='center'><b>$Lang::tr{'type'}</b></td>
1143 <td width='25%' align='center'><b>$Lang::tr{'wio_common_name'}</b></td>
1144 <td width='11%' align='center'><b>$Lang::tr{'wio image'}</b></td>
1145 <td width='14%' align='center'><b>$Lang::tr{'wio_ovpn_connected'}</b></td>
1149 foreach $key (sort SortByTunnelName
(keys(%vpnconfighash))) {
1153 if ( -e
'/var/log/wio/.vpncache' ) {
1154 $vpncheck = strftime
("%d.%m.%Y - %H:%M:%S",localtime(((stat('/var/log/wio/.vpncache'))[9])));
1157 $status = "bgcolor='${Header::colourred}'";
1158 $statustxt = "$Lang::tr{'capsclosed'}";
1160 if ($vpnconfighash{$key}[0] eq 'off') {
1161 $status = "bgcolor='${Header::colourblue}'";
1162 $statustxt = "$Lang::tr{'capsclosed'}";
1165 foreach (@vpnstatus) {
1166 if ($_ =~ /$vpnconfighash{$key}[1]\{.*INSTALLED/) {
1167 $status = "bgcolor='${Header::colourgreen}'";
1168 $statustxt = "$Lang::tr{'capsopen'}";
1173 print"<tr".($idvpn % 2?
" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'>";
1175 my $vpnnr = $idvpn+1;
1177 printf ("<td align='center'> %02d</td>", $vpnnr);
1179 print"<td align='center'>$vpncheck</td>
1180 <td align='center'>$vpnconfighash{$key}[1]</td>
1181 <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>
1182 <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>
1184 <table $status cellpadding='2' cellspacing='0' width='100%'>
1186 <td align='center'><font color='white'><b>$statustxt</b></font></td>
1190 <td align='center' height='20'> </td>
1194 if ($vpnconfighash{$key}[25] && $wiosettings{'CLIENTREMARK'} eq 'on') {
1195 print"<tr".($idvpn % 2?
" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'><td> </td><td colspan='16' align='left'>$vpnconfighash{$key}[25]</td></tr>";
1197 print"<tr height='1'><td colspan='7' bgcolor='#696565'></td></tr>";
1205 ## openvpn connection(s)
1207 if ( -e
"$ovpnpid" ) {
1209 @ovpnstatus = `cat /var/run/ovpnserver.log`;
1212 <table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1214 <td width='28%' bgcolor='$color{'color20'}' align='left'><b> $Lang::tr{'wio_ovpn_con'}</b></td>
1215 <td width='72%'> </td>
1217 <tr><td colspan='2'> </td></tr>
1219 <table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1220 <tr bgcolor='$color{'color20'}' height='20'>
1221 <td width='3%' align='center'><b>$Lang::tr{'wio_id'}</b></td>
1222 <td width='19%' align='center'><b>$Lang::tr{'wio checked'}</b></td>
1223 <td width='20%' align='center'><b>$Lang::tr{'wio ipadress'}</b></td>
1224 <td width='8%' align='center'><b>$Lang::tr{'type'}</b></td>
1225 <td width='25%' align='center'><b>$Lang::tr{'common name'}</b></td>
1226 <td width='11%' align='center'><b>$Lang::tr{'wio image'}</b></td>
1227 <td width='14%' align='center'><b>$Lang::tr{'wio_ovpn_connected'}</b></td>
1231 foreach $key (keys %ovpnconfighash) {
1233 my ( $ovpnclt, $ovpntime, $ovpnrwip, $ovpncheck ) = '';
1235 if ( -e
'/var/log/wio/.ovpncache' ) {
1236 $ovpncheck = strftime
("%d.%m.%Y - %H:%M:%S",localtime(((stat('/var/log/wio/.ovpncache'))[9])));
1239 print"<tr".($idovpn % 2?
" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'>";
1241 my $ovpnnr = $idovpn+1;
1243 printf ("<td align='center' height='20'> %02d</td>", $ovpnnr);
1245 if ($ovpnconfighash{$key}[3] eq 'net') {
1246 $image = "$imgstatic/ovpnn2n.png";
1247 $text = "$Lang::tr{'wio_n2n'}";
1250 $image = "$imgstatic/ovpnrw.png";
1251 $text = "$Lang::tr{'wio_rw'}";
1254 if ( $ovpnconfighash{$key}[0] eq 'off' ) {
1255 $status = "${Header::colourblue}";
1256 $statustxt = "$Lang::tr{'capsclosed'}";
1260 if ($ovpnconfighash{$key}[3] eq 'net') {
1261 if (-e
"/var/run/$ovpnconfighash{$key}[1]n2n.pid") {
1264 my $tport = $ovpnconfighash{$key}[22];
1265 my $tnet = new Net
::Telnet
( Timeout
=>5, Errmode
=>'return', Port
=>$tport);
1267 $tnet->open('127.0.0.1');
1268 @output = $tnet->cmd(String
=> 'state', Prompt
=> '/(END.*\n|ERROR:.*\n)/');
1269 @tustate = split(/\,/, $output[1]);
1270 $ovpntime = &WIO
::contime
(scalar localtime($tustate[0]));
1272 if (($tustate[1] eq 'CONNECTED')) {
1273 $status = "${Header::colourgreen}";
1274 $statustxt = "$Lang::tr{'capsopen'}";
1276 $status = "${Header::colourred}";
1277 $statustxt = "$tustate[1]";
1283 foreach (@ovpnstatus) {
1284 if ( $_ =~ /^(.+),(\d+\.\d+\.\d+\.\d+\:\d+),(\d+),(\d+),(.+)/ ) {
1285 @match = split (m/^(.+),(\d+\.\d+\.\d+\.\d+\:\d+),(\d+),(\d+),(.+)/, $_);
1286 $match[1] =~ s/[_]/ /g;
1289 if ( $match[1] ne "Common Name" && ($match[1] eq $ovpnconfighash{$key}[2]) ) {
1290 $ovpnclt = $match[1];
1291 $ovpntime = &WIO
::contime
($match[5]);
1294 if ( $_ =~ /^(\d+\.\d+\.\d+\.\d+),(.+),(\d+\.\d+\.\d+\.\d+\:\d+),(.+)/ ) {
1295 @match = split(m/^(\d+\.\d+\.\d+\.\d+),(.+),(\d+\.\d+\.\d+\.\d+\:\d+),(.+)/, $_);
1298 if ( $match[1] ne "Virtual Address" && $match[2] eq $ovpnclt ) {
1299 $ovpnrwip = $match[1];
1300 $ovpncheck = &WIO
::statustime
($match[4]);
1303 if ( $ovpnclt eq $ovpnconfighash{$key}[2] ) {
1304 $status = "${Header::colourgreen}";
1305 $statustxt = "$Lang::tr{'capsopen'}";
1308 $status = "${Header::colourred}";
1309 $statustxt = "$Lang::tr{'capsclosed'}";
1316 <td align='center'>$ovpncheck</td>
1317 <td align='center'>".( defined($ovpnrwip)?
"$ovpnrwip" : " ")."</td>
1318 <td align='center'><img align='middle' src='$image' alt='$text' title='$text' /></td>
1319 <td align='center'>".($ovpnconfighash{$key}[2] eq '%auth-dn' ?
"$ovpnconfighash{$key}[9]" : ($ovpnconfighash{$key}[4] eq 'cert' ?
"$ovpnconfighash{$key}[2]": " "))."</td>
1320 <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>
1321 <td align='center'>".(defined($ovpntime)?
"$ovpntime" : " ")."</td>
1324 if ($ovpnconfighash{$key}[25] && $wiosettings{'CLIENTREMARK'} eq 'on') {
1325 print"<tr".($idovpn % 2?
" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'><td> </td><td colspan='16' align='left'>$ovpnconfighash{$key}[25]</td></tr>";
1328 print"<tr height='1'><td colspan='17' bgcolor='#696565'></td></tr>";
1339 <table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1341 <td width='28%' bgcolor='$color{'color20'}' align='left'><b> $Lang::tr{'wio_clients'}</b></td>
1342 <td width='72%'> </td>
1344 <tr><td colspan='2'> </td></tr>
1347 <table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1348 <tr bgcolor='$color{'color20'}' height='20'>
1349 <td width='3%' align='center'><b>$Lang::tr{'wio_id'}</b></td>
1350 <td width='4%' align='center'><b>$Lang::tr{'wio_activ'}</b></td>
1351 <td width='5%' align='center'><b>$Lang::tr{'wio_check'}</b></td>
1352 <td width='15%' align='center'><b>$Lang::tr{'wio checked'}</b></td>
1353 <td width='4%' align='center'><b>$Lang::tr{'wio_webinterface'}</b></td>
1354 <td width='11%' align='center'><a href='$ENV{'SCRIPT_NAME'}?IPADR'><b>$Lang::tr{'wio ipadress'}</b></a></td>
1355 <td width='5%' align='center'><b>$Lang::tr{'wio network'}</b></td>
1356 <td width='20%' align='center'><a href='$ENV{'SCRIPT_NAME'}?HOST'><b>$Lang::tr{'wio name'}</b></a></td>
1357 <td width='11%' align='center'><b>$Lang::tr{'wio image'}</b></td>
1358 <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>
1359 <td width='4%' colspan='2' align='center'><b>$Lang::tr{'wio_dyndns'}</b></td>
1360 <td width='12%' colspan='4' align='center'><b>$Lang::tr{'action'}</b></td>
1361 <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>
1365 for (my $a=0; $a<$nr; $a++) {
1367 my $gif = 'off.gif';
1368 my $gdesc = $Lang::tr
{'wio_client_off'};
1369 my $dyndnsimg = 'on.gif';
1370 my $dyndnsimgtxt = $Lang::tr
{'wio_dyndns_on'};
1371 my $mailonimg = 'wio/mailgreenon.png';
1372 my $mailonimgtxt = $Lang::tr
{'wio_mail_online_on'};
1373 my $mailoffimg = 'wio/mailredon.png';
1374 my $mailoffimgtxt = $Lang::tr
{'wio_mail_offline_on'};
1379 if ( $activ[$a] eq 'on' ) {
1381 $gdesc = $Lang::tr
{'wio_client_on'};
1384 if ( $dyndns[$a] ne 'on' ) {
1385 $dyndnsimg = 'off.gif';
1386 $dyndnsimgtxt = $Lang::tr
{'wio_dyndns_off'};
1389 if ( $sendemailon[$a] ne 'on' ) {
1390 $mailonimg = 'wio/mailgreenoff.png';
1391 $mailonimgtxt = $Lang::tr
{'wio_mail_online_off'};
1394 if ( $sendemailoff[$a] ne 'on' ) {
1395 $mailoffimg = 'wio/mailredoff.png';
1396 $mailoffimgtxt = $Lang::tr
{'wio_mail_offline_off'};
1399 if ( $webinterface[$a] eq 'HTTP' ) {
1400 $webimg = 'wio/http.png';
1402 elsif ( $webinterface[$a] eq 'HTTPS' ) {
1403 $webimg = 'wio/https.png';
1406 $webimg = 'wio/none.png';
1409 $bgcolor = $status[$a] eq "on" ?
"${Header::colourgreen}" : ($status[$a] eq "off" && $dates[$a] eq "") ?
"${Header::colourblue}" : "${Header::colourred}";
1410 $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'}";
1412 print"<tr".($a % 2?
" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'>";
1413 printf ("<td align='center'> %02d</td>", $a+1);
1415 print"<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1416 <input type='hidden' name='ACTION' value='$Lang::tr{'enable disable client'}' />
1417 <input type='image' name='$Lang::tr{'enable disable client'}' src='/images/$gif' align='middle' alt='$gdesc' title='$gdesc' />
1418 <input type='hidden' name='ID' value='$a' /></form></td>";
1420 if ( $pingmethode[$a] eq 'ip') {
1421 print"<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1422 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_ip_on'}' />
1423 <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'}' />
1424 <input type='hidden' name='ID' value='$a' /></form></td>";
1427 print"<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1428 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_fqdn_on'}' />
1429 <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'}' />
1430 <input type='hidden' name='ID' value='$a' /></form></td>";
1433 print"<td align='center'>$dates[$a]</td>";
1435 print"<td align='center'><img align='middle' src='/images/$webimg' /></td>";
1437 if ( $webinterface[$a] eq 'HTTP' ) {
1438 print"<td align='center'><a title=\"$Lang::tr{'wio_webinterface_link'}\" href=\"http://$ipaddresses[$a]\" target=\"_blank\">$ipaddresses[$a]</a></td>";
1440 elsif ( $webinterface[$a] eq 'HTTPS' ) {
1441 print"<td align='center'><a title=\"$Lang::tr{'wio_webinterface_link'}\" href=\"https://$ipaddresses[$a]\" target=\"_blank\">$ipaddresses[$a]</a></td>";
1444 print"<td align='center'>$ipaddresses[$a]</td>";
1447 my $dotip = length($ipaddresses[$a]) - rindex($ipaddresses[$a],'.');
1449 foreach (@devs_color) {
1453 foreach $interface (@devs_net) {
1454 next if ( $netsettings{"$ic"."_DEV"} eq 'red0' && ($netsettings{"RED_TYPE"} eq 'DHCP' || $netsettings{"RED_TYPE"} eq 'PPPOE'));
1455 if ( $netsettings{"$ic"."_DEV"} eq $interface ) {
1456 if ( &General
::IpInSubnet
($ipaddresses[$a], $netsettings{"$ic"."_NETADDRESS"}, $netsettings{"$ic"."_NETMASK"}) ) {
1457 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>";
1465 if ($netsettings{"RED_TYPE"} eq 'DHCP' || $netsettings{"RED_TYPE"} eq 'PPPOE') {
1466 my $redipadr = qx'ip addr | grep red0 | grep inet | awk "{print \$2}"';
1467 my @rednet = split ("/", $redipadr);
1469 my $red_netmask = General
::iporsubtodec
($rednet[1]);
1470 my $red_netaddress = Network
::get_netaddress
("$rednet[0]/$red_netmask");
1472 if ( &General
::IpInSubnet
($ipaddresses[$a], $red_netaddress, $red_netmask) ) {
1473 print"<td align='center' height='20'><img src='$imgstatic/red.png' alt='$Lang::tr{'wio_red_lan'}' title='$Lang::tr{'wio_red_lan'}' /></td>";
1477 print"<td align='center'><img align='middle' src='$imgstatic/white.png' alt='$Lang::tr{'wio_unknown_lan'}' title='$Lang::tr{'wio_unknown_lan'}' /></td>";
1482 if ( -e
"$vpnpid" ) {
1483 foreach $key (keys(%vpnconfighash)) {
1484 next unless ($vpnconfighash{$key}[3] eq 'net');
1486 my $convertip = &General
::ipcidr2msk
($vpnconfighash{$key}[11]);
1488 my @net = split ("/", $convertip);
1490 $vpnn2nip = $net[0];
1491 $vpnn2nmask = length($net[1]) - rindex($net[1],'.');
1493 if (substr($ipaddresses[$a],0,length($ipaddresses[$a])-$dotip) eq substr($vpnn2nip,0,length($vpnn2nip)-$vpnn2nmask)) {
1494 print"<td align='center'><img align='middle' src='$imgstatic/vpn.png' alt='IPSec' title='IPSec' /></td>";
1500 if ( $ovpnsettings{'DOVPN_SUBNET'} ne '' ) {
1501 @match = split ("/", $ovpnsettings{'DOVPN_SUBNET'});
1503 if ( &General
::IpInSubnet
($ipaddresses[$a], $match[0], $match[1]) ) {
1504 print"<td align='center'><img src='$imgstatic/ovpn.png' alt='OpenVPN' title='OpenVPN' /></td>";
1509 if ( %ovpnccdconfhash ne '' ) {
1510 foreach $key (keys(%ovpnccdconfhash)) {
1512 my $convertip = &General
::ipcidr2msk
($ovpnccdconfhash{$key}[1]);
1514 my @net = split ("/", $convertip);
1516 $vpnn2nip = $net[0];
1517 $vpnn2nmask = length($net[1]) - rindex($net[1],'.');
1519 if (substr($ipaddresses[$a],0,length($ipaddresses[$a])-$dotip) eq substr($vpnn2nip,0,length($vpnn2nip)-$vpnn2nmask)) {
1520 print"<td align='center'><img align='middle' src='$imgstatic/ovpn.png' alt='OpenVPN' title='OpenVPN' /></td>";
1528 if ( $webinterface[$a] eq 'HTTP' ) {
1529 print"<td align='center'><a title=\"$Lang::tr{'wio_webinterface_link'}\" href=\"http://$names[$a]\" target=\"_blank\">$names[$a]</a></td>";
1531 elsif ( $webinterface[$a] eq 'HTTPS' ) {
1532 print"<td align='center'><a title=\"$Lang::tr{'wio_webinterface_link'}\" href=\"https://$names[$a]\" target=\"_blank\">$names[$a]</a></td>";
1535 print"<td align='center'>$names[$a]</td>";
1540 <table bgcolor='$bgcolor' cellpadding='2' cellspacing='0' width='100%'>
1542 <td align='center'><font color='$color{'color21'}'><b>$statustxt</b></font></td>
1547 <td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1548 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_sc_refresh'}' />
1549 <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'}' />
1550 <input type='hidden' name='ID' value='$a' /></form></td>
1552 <td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1553 <input type='hidden' name='ACTION' value='$Lang::tr{'enable disable dyndns'}' />
1554 <input type='image' name='$Lang::tr{'enable disable dyndns'}' src='/images/$dyndnsimg' align='middle' alt='$dyndnsimgtxt' title='$dyndnsimgtxt' />
1555 <input type='hidden' name='ID' value='$a' /></form></td>";
1557 if ( defined($dyndns[$a]) && ($dyndns[$a] eq 'on') ) {
1558 print"<td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1559 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_dyndns_refresh'}' />
1560 <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'}' />
1561 <input type='hidden' name='ID' value='$a' /></form></td>";
1564 print"<td width='3%' align='center'>-</td>";
1567 if ( -e
"/var/log/rrd/wio/$id[$a].rrd" ) {
1569 <td width='3%' align='center'><form method='post' action='/cgi-bin/wiographs.cgi' enctype='multipart/form-data'>
1570 <input type='image' name='$Lang::tr{'wio_graphs'}' src='$imgstatic/graph.png' align='middle' alt='$Lang::tr{'wio_graphs'}' title='$Lang::tr{'wio_graphs'}' />
1571 <input type='hidden' name='HOSTID' value='$id[$a]' /><input type='hidden' name='HOSTNAME' value='$names[$a]' /></form></td>
1575 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>";
1578 if ( $wiosettings{'SENDEMAIL'} eq 'on') {
1579 print"<td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1580 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_mail_online'}' />
1581 <input type='image' name='$Lang::tr{'wio_mail_online'}' src='/images/$mailonimg' align='middle' alt='$mailonimgtxt' title='$mailonimgtxt' />
1582 <input type='hidden' name='ID' value='$a' /></form></td>
1583 <td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1584 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_mail_offline'}' />
1585 <input type='image' name='$Lang::tr{'wio_mail_offline'}' src='/images/$mailoffimg' align='middle' alt='$mailoffimgtxt' title='$mailoffimgtxt' />
1586 <input type='hidden' name='ID' value='$a' /></form></td>";
1589 print"<td width='3%' align='center'>-</td>
1590 <td width='3%' align='center'>-</td>";
1594 <td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1595 <input type='hidden' name='ACTION' value='$Lang::tr{'edit'}' />
1596 <input type='image' name='$Lang::tr{'edit'}' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' />
1597 <input type='hidden' name='ID' value='$a' /></form></td>
1599 <td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1600 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_remove_client'}' />
1601 <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'}')\" />
1602 <input type='hidden' name='ID' value='$a' /></form></td></tr>
1605 if ($remark[$a] && $wiosettings{'CLIENTREMARK'} eq 'on') {
1606 print"<tr".($a % 2?
" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'><td> </td><td colspan='16' align='left'>$remark[$a]</td></tr>";
1608 print"<tr height='1'><td colspan='17' bgcolor='#696565'></td></tr>";
1613 &Header
::closebox
();
1617 ## add / modify client
1619 $checked{'EN'}{'on'} = ($wiosettings{'EN'} eq '' ) ?
'' : "checked='checked'";
1621 $checked{'DYNDNS'}{'off'} = $checked{'DYNDNS'}{'on'} = '';
1622 $checked{'DYNDNS'}{$wiosettings{'DYNDNS'}} = "checked='checked'";
1624 $checked{'SENDEMAILON'}{'off'} = $checked{'SENDEMAILON'}{'on'} = '';
1625 $checked{'SENDEMAILON'}{$wiosettings{'SENDEMAILON'}} = "checked='checked'";
1627 $checked{'SENDEMAILOFF'}{'off'} = $checked{'SENDEMAILOFF'}{'on'} = '';
1628 $checked{'SENDEMAILOFF'}{$wiosettings{'SENDEMAILOFF'}} = "checked='checked'";
1630 if (! defined($errormessage) && $wiosettings{'ACTION'} ne $Lang::tr
{'edit'} ) {
1631 $wiosettings{'PINGMETHODE'} = 'ip';
1634 $checked{'PINGMETHODE'}{'ip'} = $checked{'PINGMETHODE'}{'fqdn'} = '';
1635 $checked{'PINGMETHODE'}{$wiosettings{'PINGMETHODE'}} = "checked='checked'";
1637 $selected{'WEBINTERFACE'}{'----'} = '';
1638 $selected{'WEBINTERFACE'}{'HTTP'} = '';
1639 $selected{'WEBINTERFACE'}{'HTTPS'} = '';
1640 $selected{'WEBINTERFACE'}{$wiosettings{'WEBINTERFACE'}} = "selected='selected'";
1642 $buttontext = $Lang::tr
{'wio_client_add'};
1644 if ( $wiosettings{'ACTION'} eq $Lang::tr
{'edit'} || defined($errormessage) && ! defined($message) ) {
1645 &Header
::openbox
('100%', 'left', $Lang::tr
{'wio_edit_client'});
1646 $buttontext = $Lang::tr
{'update'};
1649 &Header
::openbox
('100%', 'left', $Lang::tr
{'wio_edit_settings'});
1652 if (! defined($errormessage) && $wiosettings{'ACTION'} ne $Lang::tr
{'edit'} ) {
1654 <table width='100%' border='0' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1656 <td width='28%' bgcolor='$color{'color20'}' align='left' height='20'><b> $Lang::tr{'wio_add'}</b></td>
1657 <td width='72%' align='right'> </td>
1667 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
1668 <input type='hidden' name='ID' value='$wiosettings{'ID'}' />
1669 <input type='hidden' name='CLIENTID' value='$wiosettings{'CLIENTID'}' />
1670 <input type='hidden' name='ONLINE' value='$wiosettings{'ONLINE'}' />
1671 <input type='hidden' name='TIMESTAMP' value='$wiosettings{'TIMESTAMP'}' />
1675 <table width='100%' border='0' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1677 <td height='30'>$Lang::tr{'wio_client_enable'}</td>
1678 <td align='left'><input type='checkbox' name='EN' $checked{'EN'}{'on'} /></td>
1679 <td colspan='4'> </td>
1682 <td height='30'>$Lang::tr{'wio ipadress'}:</td>
1683 <td align='left'><input type='text' name='IPADR' value='$wiosettings{'IPADR'}' size='25' /></td>
1684 <td>$Lang::tr{'wio name'}:</td>
1685 <td align='left'><input type='text' name='HOST' value='$wiosettings{'HOST'}' size='25' /></td>
1686 <td>$Lang::tr{'remark'}:</td>
1687 <td align='left'><input type='text' name='REMARK' value='$wiosettings{'REMARK'}' size='30'></td>
1690 <td height='30'>$Lang::tr{'wio_ping_send'}:</td>
1691 <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>
1692 <td>$Lang::tr{'wio_dyndns'}:</td>
1693 <td align='left'><input type='checkbox' name='DYNDNS' $checked{'DYNDNS'}{'on'} /></td>
1696 if ( $wiosettings{'SENDEMAIL'} eq 'on' ) {
1697 print"<td>$Lang::tr{'wio_sendemail'}:</td>
1698 <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>";
1701 print"<td colspan='2'> </td>";
1707 <td height='30'>$Lang::tr{'wio_link_open'}:</td>
1708 <td align='left' colspan='5'>
1709 <select size='1' name='WEBINTERFACE' width='80' style='width: 80px'>
1710 <option value='----' $selected{'WEBINTERFACE'}{'----'}>----</option>
1711 <option value='HTTP' $selected{'WEBINTERFACE'}{'HTTP'}>HTTP</option>
1712 <option value='HTTPS' $selected{'WEBINTERFACE'}{'HTTPS'}>HTTPS</option>
1717 <table width='100%' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1719 <td width='20%' align='center'> </td>
1722 if ( $buttontext eq $Lang::tr
{'update'} && ( defined($errormessage) || $wiosettings{'ACTION'} eq $Lang::tr
{'edit'}) && ! defined($message) ) {
1723 print"<td width='20%' align='center'> </td>
1724 <td width='20%' align='center'> </td>
1725 <td width='20%' align='center'><input type='hidden' name='ACTION' value='$Lang::tr{'wio_client_add'}' /><input type='submit' name='SUBMIT' value='$buttontext' /></td>
1726 <td width='20%' align='center'><input type='button' onClick='location.href=\"/cgi-bin/wio.cgi\"' value='$Lang::tr{'wio_back'}'></form></td>";
1729 print"<td width='20%' align='center'> </td>
1730 <td width='20%' align='center'> </td>
1731 <td width='20%' align='center'> </td>
1732 <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>";
1740 if ( $wiosettings{'ENABLE'} eq 'on' && !$errormessage && $wiosettings{'ACTION'} ne $Lang::tr
{'edit'} || $message == 2 ) {
1744 ## arp table entries
1747 <table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1749 <td width='28%' bgcolor='$color{'color20'}' align='left' height='20'><b> $Lang::tr{'wio_arp_table_entries'}</b></td>
1750 <td width='72%'> </td>
1752 <tr><td colspan='2'> </td></tr>
1755 <table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1756 <tr bgcolor='$color{'color20'}'>
1757 <td width='5%' align='center' height='20'><b>$Lang::tr{'wio_id'}</b></td>
1758 <td width='20%' align='center' height='20'><b>$Lang::tr{'wio_hwaddress'}</b></td>
1759 <td width='20%' align='center' height='20'><b>$Lang::tr{'wio ipadress'}</b></td>
1760 <td width='15%' align='center' height='20'><b>$Lang::tr{'wio network'}</b></td>
1761 <td width='20%' align='center' height='20'><b>$Lang::tr{'wio name'}</b></td>
1762 <td width='15%' align='center' height='20'><b>$Lang::tr{'wio_iface'}</b></td>
1763 <td width='5%' align='center' height='20'><b>$Lang::tr{'action'}</b></td>
1767 $output = `/sbin/ip neigh list`;
1768 $output = &Header
::cleanhtml
($output,"y");
1772 foreach $line (split(/\n/, $output))
1774 if ($line =~ m/^(.*) dev ([^ ]+) lladdr ([0-9a-f:]*) (.*)$/) {
1775 my $arphost = gethostbyaddr(inet_aton
($1), AF_INET
);
1776 if ( $arphost eq 'localhost' ) { $arphost = ''; }
1777 push (@arpcache, "$3,$1,$arphost,$2\n");
1779 elsif ($line =~ m/^(.*) dev ([^ ]+) (.*)$/) {
1780 my $arphost = gethostbyaddr(inet_aton
($1), AF_INET
);
1781 if ( $arphost eq 'localhost' ) { $arphost = ''; }
1782 push (@arpcache, ",$1,$arphost,$2\n");
1788 &SortDataFile
('arpcache',@arpcache);
1790 foreach (@arpcache) {
1793 @line = split (/\,/, $_);
1795 print"<tr".($idarp % 2?
" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'>";
1796 printf ("<td align='center'> %02d</td>", $idarp+1);
1797 print"<td align='center'>$line[0]</td>
1798 <td align='center'>$line[1]</td>";
1802 foreach (@devs_color) {
1806 foreach $interface (@devs_net) {
1807 next if ( $netsettings{"$ic"."_DEV"} eq 'red0' && ($netsettings{"RED_TYPE"} eq 'DHCP' || $netsettings{"RED_TYPE"} eq 'PPPOE'));
1809 if ($netsettings{"$ic"."_DEV"} eq $interface) {
1810 if ( &General
::IpInSubnet
($line[1], $netsettings{"$ic"."_NETADDRESS"}, $netsettings{"$ic"."_NETMASK"}) ) {
1811 print"<td align='center'><img src='$imgstatic/$devs_img[$in]' alt='$Lang::tr{$devs_alt[$in]}' title='$Lang::tr{$devs_alt[$in]}' /></td>";
1820 if ($netsettings{"RED_TYPE"} eq 'DHCP' || $netsettings{"RED_TYPE"} eq 'PPPOE') {
1821 my $redipadr = qx'ip addr | grep red0 | grep inet | awk "{print \$2}"';
1822 my @rednet = split ("/", $redipadr);
1824 my $red_netmask = General
::iporsubtodec
($rednet[1]);
1825 my $red_netaddress = Network
::get_netaddress
("$rednet[0]/$red_netmask");
1827 if ( &General
::IpInSubnet
($line[1], $red_netaddress, $red_netmask) ) {
1828 print"<td align='center' height='20'><img src='$imgstatic/red.png' alt='$Lang::tr{'wio_red_lan'}' title='$Lang::tr{'wio_red_lan'}' /></td>";
1832 print"<td align='center'><img align='middle' src='$imgstatic/white.png' alt='$Lang::tr{'wio_unknown_lan'}' title='$Lang::tr{'wio_unknown_lan'}' /></td>";
1838 print"<td align='center'>$line[2]</td>
1839 <td align='center'>".&WIO
::color_devices
($line[3])."</td>";
1841 unless (&WIO
::checkinto
($line[1], '', @current)) {
1842 print"<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1843 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_add'}' />
1844 <input type='image' name='$Lang::tr{'wio_add'}' src='/images/add.gif' align='middle' alt='$Lang::tr{'wio_add'}' title='$Lang::tr{'wio_add'}' />
1845 <input type='hidden' name='ID' value='$idarp' /></form></td>";
1848 print"<td align='center'><img src='$imgstatic/add.png' align='middle' alt='$Lang::tr{'wio_no_add'}' title='$Lang::tr{'wio_no_add'}' /></td>";
1852 print"<tr height='1'><td colspan='17' bgcolor='#696565'></td></tr>";
1863 <table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1865 <td width='28%' bgcolor='$color{'color20'}' align='left' height='20'><b> $Lang::tr{'wio_import_file'}</b></td>
1866 <td width='72%'> </td>
1868 <tr><td colspan='2'> </td></tr>
1870 <table width='100%' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1871 <tr bgcolor='$color{'color22'}'>
1872 <form method='post' action='/cgi-bin/wio.cgi' enctype='multipart/form-data'>
1873 <td width='35%' align='right'>$Lang::tr{'wio_import_csv'} </td>
1874 <td width='40%' align='center'><input type='file' name='CSVFILE' size='30' /></td>
1875 <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>
1878 <tr><td colspan='3'> </td></tr>
1879 <tr bgcolor='$color{'color22'}'>
1880 <form method='post' action='/cgi-bin/wio.cgi' enctype='multipart/form-data'>
1881 <td width='35%' align='right'>$Lang::tr{'wio_import_hosts'} </td>
1882 <td width='40%' align='center'> </td>
1883 <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>
1886 <tr><td colspan='3'> </td></tr>
1887 <tr bgcolor='$color{'color22'}'>
1888 <form method='post' action='/cgi-bin/wio.cgi' enctype='multipart/form-data'>
1889 <td width='35%' align='right'>$Lang::tr{'wio_import_fixleases'} </td>
1890 <td width='40%' align='center'> </td>
1891 <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>
1900 <table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1902 <td width='28%' bgcolor='$color{'color20'}' align='left' height='20'><b> $Lang::tr{'wio_net_scan'}</b></td>
1903 <td width='72%'> </td>
1906 <table width='100%' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1908 <td colspan='3'> </td>
1912 foreach (keys(%ifacecolor)) {
1913 if ( $_ eq 'GREEN' ) { $color = "$Header::colourgreen"; $net = $Lang::tr
{'wio_net_scan_green'}; }
1914 elsif ( $_ eq 'BLUE' ) { $color = "$Header::colourblue"; $net = $Lang::tr
{'wio_net_scan_blue'}; }
1915 else { $color = "$Header::colourorange"; $net = $Lang::tr
{'wio_net_scan_orange'}; }
1917 if ( $netsettings{"${_}_DEV"} eq 'disabled' || $netsettings{"${_}_DEV"} eq '' || $netsettings{"${_}_ADDRESS"} eq '' ) { next; }
1921 <tr bgcolor='$color{'color22'}'>
1922 <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>
1923 <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>
1924 <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>
1927 <td colspan='3'> </td>
1939 &Header
::closebox
();
1942 if ( $wiosettings{'ENABLE'} eq 'on' && !$errormessage && $wiosettings{'ACTION'} ne $Lang::tr
{'edit'} || $message == 2 ) {
1944 &Header
::openbox
('100%', 'left', $Lang::tr
{'wio_service'});
1947 <table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1948 <tr bgcolor='$color{'color22'}'>
1949 <td colspan='2' align='right'></td>
1950 <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>
1951 <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>
1957 &Header
::closebox
();
1960 &Header
::closebigbox
();
1961 &Header
::closepage
();
1963 ############################################################################################################################
1966 my ($data,@checkfile) = @_;
1973 if (rindex ($wiosettings{'SORT'},'Rev') != -1) {
1974 $qs = substr ($wiosettings{'SORT'},0,length($wiosettings{'SORT'})-3);
1976 if ($qs eq 'IPADR') {
1977 my @a = split (/\./,$entries{$a}->{$qs});
1978 my @b = split (/\./,$entries{$b}->{$qs});
1985 $entries{$b}->{$qs} cmp $entries{$a}->{$qs};
1989 $qs = $wiosettings{'SORT'};
1991 if ($qs eq 'IPADR') {
1992 my @a = split (/\./,$entries{$a}->{$qs});
1993 my @b = split (/\./,$entries{$b}->{$qs});
2000 $entries{$a}->{$qs} cmp $entries{$b}->{$qs};
2005 if ($data eq 'arpcache') {
2006 foreach (@checkfile) {
2008 @temp = split (',', $_);
2010 my @record = ('KEY',$idsort++,'MAC',$temp[0],'IPADR',$temp[1],'HOST',$temp[2],'REMARK',$temp[3],'IFACE',$temp[4]);
2012 %{$record} = @record;
2013 $entries{$record->{KEY
}} = $record;
2016 open(FILE
, "> $logdir/.arpcache");
2018 foreach (sort sortips
keys %entries) {
2019 print FILE
"$entries{$_}->{MAC},$entries{$_}->{IPADR},$entries{$_}->{HOST},$entries{$_}->{REMARK},$entries{$_}->{IFACE},$entries{$_}->{HW}\n";
2024 open (FILE
, "$logdir/.arpcache");
2029 foreach (@checkfile) {
2031 @temp = split (',', $_);
2033 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]);
2035 %{$record} = @record;
2036 $entries{$record->{KEY
}} = $record;
2039 open(FILE
, "> $ipadrfile");
2041 foreach (sort sortips
keys %entries) {
2042 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";
2051 ############################################################################################################################
2055 print"<table width='100%'><tr><td colspan='2' height='35'><hr></td></tr></table>";
2059 ############################################################################################################################
2063 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>";
2067 ############################################################################################################################
2071 &General
::readhasharray
($ipadrfile, \
%ipshash);
2073 open(FILE
, "< $ipadrfile");
2079 ############################################################################################################################
2083 open(FILE
, "> $ipadrfile");
2084 if ( defined($write) ) { print FILE
@write; }
2085 else { print FILE
@current; }
2090 ############################################################################################################################
2092 sub SortByTunnelName
2094 if ($vpnconfighash{$a}[1] lt $vpnconfighash{$b}[1]) {
2097 elsif ($vpnconfighash{$a}[1] gt $vpnconfighash{$b}[1]) {
2105 ############################################################################################################################
2109 if ( $wiosettings{'IPADR'} eq '' && $wiosettings{'PINGMETHODE'} eq 'ip' && $wiosettings{'DYNDNS'} eq '' ) {
2110 $errormessage = $Lang::tr
{'wio_ip_empty'};
2113 if ( $wiosettings{'IPADR'} ne '' && (! &General
::validip
($wiosettings{'IPADR'})) ) {
2114 $errormessage = $Lang::tr
{'wio_ip_error'};
2117 if ( $wiosettings{'HOST'} eq '' && $wiosettings{'PINGMETHODE'} eq 'fqdn' ) {
2118 $errormessage = $Lang::tr
{'wio_host_empty'};
2121 if ( $wiosettings{'HOST'} ne '' && (! &General
::validdomainname
($wiosettings{'HOST'})) ) {
2122 $errormessage = $Lang::tr
{'wio_host_error'};
2125 if ( $wiosettings{'DYNDNS'} eq 'on' && (! defined($errormessage)) ) {
2126 unless(&General
::validfqdn
($wiosettings{'HOST'})) { $errormessage = $Lang::tr
{'wio_fqdn_error'}; }
2127 ( $wiosettings{'IPADR'}, $infomessage ) = &WIO
::getdyndnsip
($wiosettings{'IPADR'}, $wiosettings{'HOST'});
2128 $wiosettings{'PINGMETHODE'} = 'fqdn';
2131 if ( $wiosettings{'ID'} eq '' && ! defined($errormessage) ) { $errormessage = &WIO
::checkinto
($wiosettings{'IPADR'}, $wiosettings{'HOST'}, @current); }
2133 if ( $wiosettings{'REMARK'} ne '' ) { $wiosettings{'REMARK'} =~ s/,/,/g; }