]> git.ipfire.org Git - ipfire-2.x.git/blame - src/wio/wio.cgi
Merge branch 'next'
[ipfire-2.x.git] / src / wio / wio.cgi
CommitLineData
0d6cc79d
SF
1#!/usr/bin/perl
2#
3###############################################################################
4# #
5# IPFire.org - A linux based firewall #
953882ff 6# Copyright (C) 2017-2020 Stephan Feddersen <sfeddersen@ipfire.org> #
0d6cc79d
SF
7# All Rights Reserved. #
8# #
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. #
13# #
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. #
18# #
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/>. #
21# #
22###############################################################################
23#
48aae162 24# Version: 2020/08/04 21:12:23
0d6cc79d 25#
391a2459 26# This wio.cgi is based on the code from the IPCop WIO Addon
0d6cc79d
SF
27# and is extremly adapted to work with IPFire.
28#
29# Autor: Stephan Feddersen
30# Co-Autor: Alexander Marx
391a2459 31# Co-Autor: Frank Mainz (for some code for the IPCop WIO Addon)
0d6cc79d
SF
32#
33
34use strict;
35
36# enable only the following on debugging purpose
37#use warnings;
38#no warnings 'once';
39#use CGI::Carp 'fatalsToBrowser';
40
41my $debug = 0;
42
43use Socket;
44use POSIX qw(strftime);
45use File::Copy;
46use Fatal qw/ open /;
47use Net::Telnet;
48
49require '/var/ipfire/general-functions.pl';
1bee37ba 50require '/var/ipfire/network-functions.pl';
0d6cc79d
SF
51require '/var/ipfire/lang.pl';
52require '/var/ipfire/header.pl';
53require '/usr/lib/wio/wio-lib.pl';
54require '/usr/lib/wio/wio-graphs.pl';
55
56my $logdir = "/var/log/wio";
57
391a2459 58my ( %mainsettings, %mailsettings, %wiosettings, %cgiparams, %netsettings, %ipshash, %vpnsettings,
0d6cc79d
SF
59 %vpnconfighash, %ovpnconfighash, %ovpnccdconfhash, %ovpnsettings, %checked, %selected, %color ) = ();
60
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);
391a2459 70&General::readhash('/var/ipfire/vpn/settings', \%vpnsettings);
0d6cc79d
SF
71
72my $ipadrfile = "$logdir/wioips";
73my $onoffip = "$logdir/wioscip";
74my $wiosettings = "/var/ipfire/wio/wio.conf";
75my $dyndnsconfig = "/var/ipfire/ddns/config";
76my $importfile = "$logdir/importfile";
77my $wiofile = "$logdir/wiofile";
78my $editfile = "$logdir/editfile";
79my $hostfile = "/var/ipfire/main/hosts";
80my $dhcpfile = "/var/ipfire/dhcp/fixleases";
81my $imgstatic = "/images/wio";
82my $rrddir = "/var/log/rrd/wio";
83my $refreshbox = '<meta http-equiv="refresh" content="0;url=/cgi-bin/wio.cgi">';
84my $sortstring = '^IPADR|^HOST';
85my $ovpnaddon = "/var/ipfire/ovpn";
86my $ovpnpid = "/var/run/openvpn.pid";
87my $vpnpid = "/var/run/charon.pid";
88my $redactive = "/var/ipfire/red/active";
89my $redip = '-';
90my $now = strftime "%Y-%m-%d", localtime;
91
92if ( -e $redactive ) {
93 open(IPADDR, "/var/ipfire/red/local-ipaddress");
94 $redip = <IPADDR>;
95 close IPADDR;
96 chomp($redip);
97}
98
99my $i = 0;
100my $idarp = 0;
101my $iddyndns = 0;
102my $idvpn = 0;
103my $idovpn = 0;
104my $idsort = 0;
105my $nr = 0;
106my $count = 0;
107my $showcount = 0;
108
a25c95b3 109my $arpbuttontext = "$Lang::tr{'wio_show_table_on'}";
c1fc92a9
SFD
110my $clientimportbuttontext = "$Lang::tr{'wio_show_table_on'}";
111my $networksearchbuttontext = "$Lang::tr{'wio_show_table_on'}";
a25c95b3 112
c1fc92a9 113my ( $message, $infomessage, $errormessage, $importmessage ) = '';
0d6cc79d
SF
114
115my ( $buttontext, $host, $timestamp, $ipadr, $on, $remark, $dyndns, $dyndnsip, $sendemailon, $net, $dev, $iprange, $output, $write, $webinterface,
391a2459 116 $sendemailoff, $pingmethode, $online, $color, $bgcolor, $exitcode, $id, $line, $interface, $counter, $vpnn2nip, $vpnn2nmask, $edc,
0d6cc79d
SF
117 $edd, $wmon, $wmoff, $ipfqdn, $http, $wioscan, $statustxt, $status, $key, $ic, $text, $image ) = ();
118
119my ( @temp, @dates, @ipaddresses, @names, @remark, @sendemailon, @sendemailoff, @current, @ddns, @match, @webinterface, @arpcache, @arpadd, @line,
120 @hosts, @vpnstatus, @ovpnstatus, @activ, @dyndns, @pingmethode, @status, @id, @write, @log );
121
122my @nosaved = ('ACTION','ID','CLIENTID','TIMESTAMP','IPADR','HOST','REMARK','DYNDNS','SENDEMAILON','SENDEMAILOFF','PINGMETHODE','ONLINE','WEBINTERFACE');
123
124my @devs_color = ('GREEN','BLUE','ORANGE','RED');
125my @devs_net = ('green0','blue0','orange0','red0');
126my @devs_img = ('green.png','blue.png','orange.png','red.png');
127my @devs_alt = ('green','blue','orange','red');
128
129my %ifacecolor = ( GREEN => 'wio_run_green', BLUE => 'wio_run_blue', ORANGE => 'wio_run_orange');
130
391a2459
SF
131#if ( $netsettings{'RED_TYPE'} eq 'STATIC' || $netsettings{'RED_TYPE'} eq 'DHCP' ) {
132# %ifacecolor = ( %ifacecolor, RED => 'wio_run_red' );
133#}
134
0d6cc79d
SF
135&loadips();
136
137## some wio settings
138
139$wiosettings{'ACTION'} = '';
140$wiosettings{'COUNT'} = '';
141$wiosettings{'ID'} = '';
142$wiosettings{'CLIENTID'} = '';
143$wiosettings{'SORT'} = 'IPADR';
144$wiosettings{'HOST'} = '';
145$wiosettings{'IPADR'} = '';
146$wiosettings{'EN'} = 'on';
147$wiosettings{'REMARK'} = '';
148$wiosettings{'DYNDNS'} = '';
149$wiosettings{'CLIENTREMARK'} = '';
150$wiosettings{'SENDEMAILON'} = '';
151$wiosettings{'SENDEMAILOFF'} = '';
152$wiosettings{'PINGMETHODE'} = 'ip';
153$wiosettings{'WEBINTERFACE'} = '----';
154$wiosettings{'TIMEOUT'} = '1';
155$wiosettings{'TIMESTAMP'} = '';
156$wiosettings{'ONLINE'} = 'off';
157$wiosettings{'CRON'} = '15';
158$wiosettings{'OVPNCRON'} = '5';
159$wiosettings{'ENABLE'} = 'off';
160$wiosettings{'LOGGING'} = 'off';
161$wiosettings{'MAILREMARK'} = 'off';
162$wiosettings{'MAILSTYLE'} = 'email';
163$wiosettings{'OVPNRWMAIL'} = 'off';
a25c95b3
SFD
164$wiosettings{'WIOGUISHOWARPTABLE'} = '';
165$wiosettings{'WIOGUISHOWCLIENTIMPORTTABLE'} = '';
166$wiosettings{'WIOGUISHOWNETWORKSEARCHTABLE'} = '';
0d6cc79d
SF
167
168&Header::getcgihash(\%wiosettings);
169&Header::getcgihash(\%mainsettings);
170&Header::getcgihash(\%mailsettings);
171&Header::getcgihash(\%netsettings);
172
173if ( $mailsettings{'USEMAIL'} eq 'on' ) { $wiosettings{'SENDEMAIL'} = 'on'; }
174else { $wiosettings{'SENDEMAIL'} = 'off'; }
175
176if ( -e $wiofile ) { goto WIOSCAN; }
177
178## get network ips
179foreach (@devs_color) {
180 if ( $netsettings{"${_}_DEV"} ne '' ) {
1bee37ba
SF
181 $wiosettings{"${_}_IPLOW"} = &Network::find_next_ip_address($netsettings{"${_}_NETADDRESS"}, 1);
182 $wiosettings{"${_}_IPHIGH"} = &Network::find_next_ip_address($netsettings{"${_}_BROADCAST"}, -1);
0d6cc79d
SF
183 }
184}
185
186## save wio settings
187
188if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_save'}.'1' ) {
189 unless ( `ps -A | grep wio.pl` ) {
190 $cgiparams{'SORT'} = $wiosettings{'SORT'};
191 $cgiparams{'CRON'} = $wiosettings{'CRON'};
192 $cgiparams{'OVPNCRON'} = $wiosettings{'OVPNCRON'};
193 $cgiparams{'ENABLE'} = $wiosettings{'ENABLE'};
194 $cgiparams{'LOGGING'} = $wiosettings{'LOGGING'};
195 $cgiparams{'TIMEOUT'} = $wiosettings{'TIMEOUT'};
196 $cgiparams{'ACTION'} = $wiosettings{'ACTION'};
197 $cgiparams{'CLIENTREMARK'} = $wiosettings{'CLIENTREMARK'};
198 $cgiparams{'MAILREMARK'} = $wiosettings{'MAILREMARK'};
199 $cgiparams{'MAILSTYLE'} = $wiosettings{'MAILSTYLE'};
200 $cgiparams{'OVPNRWMAIL'} = $wiosettings{'OVPNRWMAIL'};
0d6cc79d
SF
201
202 &General::writehash($wiosettings, \%cgiparams);
203 &General::readhash($wiosettings, \%wiosettings);
204
205 if ( $wiosettings{'ENABLE'} eq 'off' ) {
206 &WIO::clearfile($ipadrfile);
207 unlink glob "$rrddir/*";
208 }
209 }
210 else {
211 $infomessage = "$Lang::tr{'wio_error_function'}";
212 }
213}
214
215## save imported clients
216
217if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_save'}.'2' ) {
218 unless ( `ps -A | grep wio.pl` ) {
219 while ( $count < $wiosettings{'COUNT'} ) {
220 if ( defined($wiosettings{"USE$count"}) && $wiosettings{"USE$count"} eq 'on' ) {
83596e70 221 $wiosettings{'CLIENTID'} = $wiosettings{"CLIENTID$count"};
0d6cc79d
SF
222 $wiosettings{'TIMESTAMP'} = $wiosettings{"TIMESTAMP$count"};
223 $wiosettings{'IPADR'} = $wiosettings{"IPADR$count"};
224 $wiosettings{'HOST'} = $wiosettings{"HOST$count"};
225 $wiosettings{'EN'} = $wiosettings{"EN$count"};
226 $wiosettings{'REMARK'} = $wiosettings{"REMARK$count"};
227 $wiosettings{'DYNDNS'} = $wiosettings{"DYNDNS$count"};
228 $wiosettings{'SENDEMAILON'} = $wiosettings{"SENDEMAILON$count"};
229 $wiosettings{'SENDEMAILOFF'} = $wiosettings{"SENDEMAILOFF$count"};
230 $wiosettings{'PINGMETHODE'} = $wiosettings{"PINGMETHODE$count"};
231 $wiosettings{'ONLINE'} = $wiosettings{"ONLINE$count"};
83596e70 232 $wiosettings{'WEBINTERFACE'} = $wiosettings{"WEBINTERFACE$count"};
0d6cc79d
SF
233
234 &validSave();
235
236 if ($errormessage) {
237 open(FILE, ">> $editfile");
238 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";
239 close(FILE);
240 $importmessage = $errormessage;
241 }
242 else {
243 $wiosettings{'CLIENTID'} = &General::findhasharraykey (\%ipshash);
244 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");
245 &SortDataFile('',@current);
246 }
247 }
248 $count++;
249 }
250
251 map ($wiosettings{$_} = '' ,@nosaved);
252 unlink ($importfile);
253 if ( -e "$editfile" ) { goto EDIT; }
254 }
255 else {
256 $infomessage = "$Lang::tr{'wio_error_function'}";
257 }
258}
259
260## add or update client
261
262if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_client_add'} ) {
263 unless ( `ps -A | grep wio.pl` ) {
264 &validSave();
265
266 unless ($errormessage) {
267 if ( $wiosettings{'ID'} eq '' && $wiosettings{'ACTION'} ne $Lang::tr{'edit'} ) {
268 $wiosettings{'CLIENTID'} = &General::findhasharraykey (\%ipshash);
269 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");
270 }
271 else {
272 @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";
273 }
274 }
275 else { goto ERROR; }
276
277 map ($wiosettings{$_} = '' ,@nosaved);
278 &SortDataFile('',@current);
279 }
280 else {
281 $infomessage = "$Lang::tr{'wio_error_function'}";
282 }
283}
284
a25c95b3
SFD
285## show / hide arptable
286
c1fc92a9 287if ( $wiosettings{'WIOGUISHOWARPTABLE'} eq 'arptable' ) {
83596e70
SF
288 unless ( `ps -A | grep wio.pl` ) {
289 if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_show_table_off'} ) {
290 $wiosettings{'WIOGUISHOWARPTABLE'} = 'off';
291 $arpbuttontext = "$Lang::tr{'wio_show_table_on'}";
292 }
293 else {
294 $wiosettings{'WIOGUISHOWARPTABLE'} = 'on';
295 $arpbuttontext = "$Lang::tr{'wio_show_table_off'}";
296 }
a25c95b3
SFD
297 }
298 else {
83596e70 299 $infomessage = "$Lang::tr{'wio_error_function'}";
a25c95b3
SFD
300 }
301}
302
303## show / hide clientimporttable
304
305if ( $wiosettings{'WIOGUISHOWCLIENTIMPORTTABLE'} eq 'clientimport' ) {
83596e70
SF
306 unless ( `ps -A | grep wio.pl` ) {
307 if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_show_table_off'} ) {
308 $wiosettings{'WIOGUISHOWCLIENTIMPORTTABLE'} = 'off';
309 $clientimportbuttontext = "$Lang::tr{'wio_show_table_on'}";
310 }
311 else {
312 $wiosettings{'WIOGUISHOWCLIENTIMPORTTABLE'} = 'on';
313 $clientimportbuttontext = "$Lang::tr{'wio_show_table_off'}";
314 }
a25c95b3
SFD
315 }
316 else {
83596e70 317 $infomessage = "$Lang::tr{'wio_error_function'}";
a25c95b3
SFD
318 }
319}
320
321## show / hide networksearchtable
322
323if ( $wiosettings{'WIOGUISHOWNETWORKSEARCHTABLE'} eq 'networksearch' ) {
83596e70
SF
324 unless ( `ps -A | grep wio.pl` ) {
325 if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_show_table_off'} ) {
326 $wiosettings{'WIOGUISHOWNETWORKSEARCHTABLE'} = 'off';
327 $networksearchbuttontext = "$Lang::tr{'wio_show_table_on'}";
328 }
329 else {
330 $wiosettings{'WIOGUISHOWNETWORKSEARCHTABLE'} = 'on';
331 $networksearchbuttontext = "$Lang::tr{'wio_show_table_off'}";
332 }
a25c95b3
SFD
333 }
334 else {
83596e70 335 $infomessage = "$Lang::tr{'wio_error_function'}";
a25c95b3
SFD
336 }
337}
338
0d6cc79d
SF
339## add arp client
340
341if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_add'} ) {
342 unless ( `ps -A | grep wio.pl` ) {
343 open(FILE, "$logdir/.arpcache");
344 @arpadd = <FILE>;
345 close (FILE);
346
347 chomp(@arpadd[$wiosettings{'ID'}]);
348 @temp = split (/\,/, @arpadd[$wiosettings{'ID'}]);
349
350 $wiosettings{'CLIENTID'} = &General::findhasharraykey (\%ipshash);
351 $wiosettings{'IPADR'} = $temp[1];
352 $wiosettings{'HOST'} = $temp[2];
353 $wiosettings{'EN'} = 'on';
354
355 $wiosettings{'PINGMETHODE'} = 'ip';
356 $wiosettings{'ONLINE'} = 'off';
357
358 open(FILE, ">> $editfile");
359 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";
360 close(FILE);
361
362 goto EDIT;
363 }
364 else {
365 undef($wiosettings{'ID'});
366 $infomessage = "$Lang::tr{'wio_error_function'}";
367 }
368}
369
c1fc92a9 370## enable / disable client || enable / disable dyndns || enable / disable sendemailon || enable / disable sendemailoff || change ip / fqdn
0d6cc79d
SF
371
372if ( $wiosettings{'ACTION'} eq $Lang::tr{'enable disable client'} ) { $edc = 'on'; }
373if ( $wiosettings{'ACTION'} eq $Lang::tr{'enable disable dyndns'} ) { $edd = 'on'; }
374if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_mail_online'} ) { $wmon = 'on'; }
375if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_mail_offline'} ) { $wmoff = 'on'; }
376if (( $wiosettings{'ACTION'} eq $Lang::tr{'wio_ip_on'} ) || ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_fqdn_on'} )) { $ipfqdn = 'on'; }
377
378if ( defined($edc) || defined($edd) || defined($wmon) || defined($wmoff) || defined($ipfqdn) ) {
379 unless ( `ps -A | grep wio.pl` ) {
380 chomp(@current[$wiosettings{'ID'}]);
381 @temp = split (/\,/, @current[$wiosettings{'ID'}]);
382
383 if ( $edc eq 'on' ) {
384 $temp[4] = $temp[4] ne '' ? '' : 'on';
385 $temp[10] = '';
386 $temp[11] = '';
387 $temp[1] = '';
388 unlink "$rrddir/$temp[0].rrd";
389 }
390 elsif ( $edd eq 'on' ) { $temp[6] = $temp[6] ne '' ? '' : 'on'; }
391 elsif ( $wmon eq 'on' ) { $temp[7] = $temp[7] ne '' ? '' : 'on'; }
392 elsif ( $wmoff eq 'on' ) { $temp[8] = $temp[8] ne '' ? '' : 'on'; }
393 elsif ( $ipfqdn eq 'on' ) { $temp[9] = $temp[9] eq 'fqdn' ? 'ip' : 'fqdn'; }
394
395 @current[$wiosettings{'ID'}] = join (',', @temp)."\n";
396 undef($wiosettings{'ID'});
397
398 &writeips();
399 }
400 else {
401 undef($wiosettings{'ID'});
402 $infomessage = "$Lang::tr{'wio_error_function'}";
403 }
404}
405
406## refresh wio status || refresh single client status
407
408if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_refresh'} || $wiosettings{'ACTION'} eq $Lang::tr{'wio_sc_refresh'} ) {
409
83596e70
SF
410unless ( `ps -A | grep wio.pl` ) {
411
0d6cc79d
SF
412 if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_sc_refresh'} ) {
413 open(FILE, "> $onoffip");
414 print FILE @current[$wiosettings{'ID'}];
415 close(FILE);
416
417 undef($wiosettings{'ID'});
418 }
419
0d6cc79d
SF
420&Header::showhttpheaders();
421&Header::openpage($Lang::tr{'wio'}, 1, $refreshbox);
422&Header::openbigbox('100%', 'left', '');
423&Header::openbox('100%', 'left', $Lang::tr{'wio_info'});
424
425print"
426<table align='center' width='100%'>
427 <tr><td align='center'>$Lang::tr{'wio_msg'}</td></tr>
428 <tr><td>&nbsp;</td></tr>
429 <tr><td align='center'><img align='middle' src='/images/indicator.gif' /></td></tr>
430</table>
431";
432
433&Header::closebox();
434&Header::closebigbox();
435&Header::closepage();
436
437while ( system("/usr/local/bin/wiohelper", "&") ) {}
438
83596e70 439exit 0;
0d6cc79d
SF
440}
441else {
442 $infomessage = "$Lang::tr{'wio_already_running'}";
a25c95b3 443 unlink($onoffip);
0d6cc79d
SF
444}
445
446}
447
448## refresh dyndns ip
449
450if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_dyndns_refresh'} ) {
451 unless ( `ps -A | grep wio.pl` ) {
452 chomp(@current[$wiosettings{'ID'}]);
453 @temp = split (/\,/, @current[$wiosettings{'ID'}]);
454
455 ($temp[2], $infomessage) = &WIO::getdyndnsip($temp[2], $temp[3]);
456
457 @current[$wiosettings{'ID'}] = join (',', @temp)."\n";
458
459 &writeips();
460
461 undef($wiosettings{'ID'});
462 }
463 else {
464 $infomessage = "$Lang::tr{'wio_error_function'}";
465 }
466}
467
468## edit client
469
470if ( $wiosettings{'ACTION'} eq $Lang::tr{'edit'} ) {
471 unless ( `ps -A | grep wio.pl` ) {
472 chomp(@current[$wiosettings{'ID'}]);
473 @temp = split (/\,/, @current[$wiosettings{'ID'}]);
474
475 $wiosettings{'CLIENTID'} = $temp[0];
476 $wiosettings{'TIMESTAMP'} = $temp[1];
477 $wiosettings{'IPADR'} = $temp[2];
478 $wiosettings{'HOST'} = $temp[3];
479 $wiosettings{'EN'} = $temp[4];
480 $wiosettings{'REMARK'} = $temp[5];
481 $wiosettings{'DYNDNS'} = $temp[6];
482 $wiosettings{'SENDEMAILON'} = $temp[7];
483 $wiosettings{'SENDEMAILOFF'} = $temp[8];
484 $wiosettings{'PINGMETHODE'} = $temp[9];
485 $wiosettings{'ONLINE'} = $temp[10];
486 $wiosettings{'WEBINTERFACE'} = $temp[11];
487 }
488 else {
489 undef($wiosettings{'ACTION'});
490 $infomessage = "$Lang::tr{'wio_error_function'}";
491 }
492}
493
494## remove client
495
496if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_remove_client'} ) {
497 unless ( `ps -A | grep wio.pl` ) {
498 chomp(@current[$wiosettings{'ID'}]);
499
500 @temp = split (/\,/, @current[$wiosettings{'ID'}]);
501
502 unlink "$rrddir/$temp[0].rrd";
503
504 splice (@current,$wiosettings{'ID'},1);
505
506 &writeips();
507
508 undef($wiosettings{'ID'});
509 }
510 else {
511 undef($wiosettings{'ID'});
512 $infomessage = "$Lang::tr{'wio_error_function'}";
513 }
514}
515
516## remove all clients
517
518if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_remove_all'} ) {
519 unless ( `ps -A | grep wio.pl` ) {
520 &WIO::clearfile($ipadrfile);
521 unlink glob "$rrddir/*";
522 undef(@current);
523 }
524 else {
525 $infomessage = "$Lang::tr{'wio_error_function'}";
526 }
527}
528
529## back function
530
531if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_back'} ) {
532 if ( -e "$importfile" ) { unlink ($importfile); }
533 map ($wiosettings{$_} = '' ,@nosaved);
534 undef($errormessage);
535}
536
537## import hosts, fixleases or csv file || scan networks (green/blue/orange)
538
539if ( $wiosettings{'ACTION'} eq 'wio_run_green' ||
540 $wiosettings{'ACTION'} eq 'wio_run_blue' ||
391a2459 541 $wiosettings{'ACTION'} eq 'wio_run_red' ||
0d6cc79d
SF
542 $wiosettings{'ACTION'} eq 'wio_run_orange') { $wioscan = 'on'; }
543
544if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_import'}.'1' ||
545 $wiosettings{'ACTION'} eq $Lang::tr{'wio_import'}.'2' ||
546 $wiosettings{'ACTION'} eq $Lang::tr{'wio_import'}.'3' ||
547 defined($wioscan) || defined($importmessage) ) {
548
549unless ( `ps -A | grep wio.pl` ) {
550 if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_import'}.'1' && $importmessage eq '' ) {
551
552 &Header::getcgihash(\%wiosettings, {'wantfile' => 1, 'filevar' => 'CSVFILE'});
553
554 if ( $wiosettings{'CSVFILE'} eq '' ) {
555 $errormessage = $Lang::tr{'wio_no_file_selected'};
556 $message = 2; goto ERROR;
557 }
558
559 if ( $wiosettings{'CSVFILE'} =~ /[^a-z0-9A-Z\ \.\-\_\:\\]+/ ) {
560 $errormessage = $Lang::tr{'wio_no_csv_error'};
561 $message = 2; goto ERROR;
562 }
563
564 if ( !($wiosettings{'CSVFILE'} =~ /.csv$/) ) {
565 $errormessage = $Lang::tr{'wio_no_csv'};
566 $message = 2; goto ERROR;
567 }
568
569 if (copy($wiosettings{'CSVFILE'}, "$logdir/importfile") != 1) {
570 $errormessage = $!;
571 $message = 2; goto ERROR;
572 }
573 }
574
575EDIT:
576
577&General::readhash($wiosettings, \%wiosettings);
578
579&Header::showhttpheaders();
580&Header::openpage($Lang::tr{'wio'}, 1, '');
581&Header::openbigbox('100%', 'left');
582
583if ($importmessage) {
584 &Header::openbox('100%', 'left', $Lang::tr{'wio_error'}, 'error');
585 print" <table width='100%'><tr><td><font class='base'>$importmessage</font></td></tr></table>";
586 &Header::closebox();
587}
588
589if ( -e "$editfile" ) {
590 open(FILE, "< $editfile" ); }
591elsif ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_import'}.'1' ) {
592 open(FILE, "< $importfile" ); }
593elsif ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_import'}.'2' ) {
594 open(FILE, "< $hostfile" ); }
595elsif ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_import'}.'3' ) {
596 open(FILE, "< $dhcpfile" ); }
597elsif ( $wioscan eq 'on' ) {
598
599 foreach (keys(%ifacecolor)) {
600 if ( $netsettings{"${_}_DEV"} eq $wiosettings{'ID'} ) {
601 $dev = $netsettings{"${_}_DEV"};
602 $iprange = $wiosettings{"${_}_IPLOW"} . "-" . $wiosettings{"${_}_IPHIGH"};
603
604 if ( $_ eq 'GREEN' ) { $color = "$Header::colourgreen"; $net = $Lang::tr{'wio_msg_green'}; }
605 elsif ( $_ eq 'BLUE' ) { $color = "$Header::colourblue"; $net = $Lang::tr{'wio_msg_blue'}; }
391a2459 606 elsif ( $_ eq 'RED' ) { $color = "$Header::colourred"; $net = $Lang::tr{'wio_msg_red'}; }
0d6cc79d
SF
607 else { $color = "$Header::colourorange"; $net = $Lang::tr{'wio_msg_orange'}; }
608 }
609 }
610
611&Header::openbox('100%', 'left', $Lang::tr{'wio_info'});
612 print"<table width='100%'>
391a2459 613 <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'> $Lang::tr{'wio_msg_right'} $Lang::tr{'wio_msg_hint'}</font></td></tr>
0d6cc79d
SF
614 <tr><td>&nbsp;</td></tr>
615 <tr><td align='center'><img align='middle' src='/images/indicator.gif' /></td></tr>
616 </table>";
617&Header::closebox();
618&Header::closebigbox();
619
620 open(FILE, "/usr/local/bin/wioscan -wsa $dev $iprange |" );
621
622}
623
624@hosts = <FILE>;
625close(FILE);
626
627if ( $wioscan ne 'on' && ! -e $wiofile ) { @hosts = sort @hosts; }
628else {
629 open(FILE, "> $wiofile");
630 print FILE @hosts;
631 close(FILE);
632
633 print"<meta http-equiv=\"refresh\" content=\"0; URL=$ENV{'SCRIPT_NAME'}\">";
634 exit 0;
635}
636
637WIOSCAN:
638
639if ( -e $wiofile ) {
640 open(FILE, "< $wiofile");
641 @hosts = <FILE>;
642 close (FILE);
643
644 &General::readhash($wiosettings, \%wiosettings);
645
646 &Header::showhttpheaders();
647 &Header::openpage($Lang::tr{'wio'}, 1, '');
648 &Header::openbigbox('100%', 'left');
649}
650
651foreach (@hosts) {
652 chomp;
653
654 @line = split (/\,/, $_);
655
656 if ( -e $editfile || -e $importfile ) {
657 $wiosettings{'CLIENTID$count'} = $line[0];
658 $wiosettings{'TIMESTAMP$count'} = $line[1];
659 $wiosettings{'IPADR$count'} = $line[2];
660 $wiosettings{'HOST$count'} = $line[3];
661 $wiosettings{'EN$count'} = $line[4];
662 $wiosettings{'REMARK$count'} = $line[5];
663 $wiosettings{'DYNDNS$count'} = $line[6];
664 $wiosettings{'SENDEMAILON$count'} = $line[7];
665 $wiosettings{'SENDEMAILOFF$count'} = $line[8];
666 $wiosettings{'PINGMETHODE$count'} = $line[9];
667 $wiosettings{'ONLINE$count'} = $line[10];
668 $wiosettings{'WEBINTERFACE$count'} = $line[11];
669 $wiosettings{'USE$count'} = 'on';
670 }
671 else {
672 $wiosettings{'IPADR$count'} = $line[1];
673 $wiosettings{'EN$count'} = 'on';
674 $wiosettings{'PINGMETHODE$count'} = 'ip';
675 $wiosettings{'USE$count'} = 'on';
676
677 if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_import'}.'2' ) {
678 $wiosettings{'HOST$count'} = $line[2];
679 $wiosettings{'DOM$count'} = $line[3];
680 $wiosettings{'REMARK$count'} = '';
681 }
682 elsif ( $wioscan eq 'on' || -e $wiofile ) {
683 $wiosettings{'HOST$count'} = gethostbyaddr(inet_aton($line[1]), AF_INET);
684 if ($wiosettings{'HOST$count'} eq '') { $wiosettings{'HOST$count'} = $line[1]; }
685 $wiosettings{'REMARK$count'} = '';
0d6cc79d
SF
686 }
687 else {
688 $wiosettings{'HOST$count'} = $line[7];
689 $wiosettings{'REMARK$count'} = $line[6];
690 }
691 }
692
693 $checked{'EN$count'}{'on'} = ($wiosettings{'EN$count'} eq '' ) ? '' : "checked='checked'";
694
695 $checked{'DYNDNS$count'}{'on'} = ($wiosettings{'DYNDNS$count'} eq '' ) ? '' : "checked='checked'";
696 $checked{'SENDEMAILON$count'}{'on'} = ($wiosettings{'SENDEMAILON$count'} eq '' ) ? '' : "checked='checked'";
697 $checked{'SENDEMAILOFF$count'}{'on'} = ($wiosettings{'SENDEMAILOFF$count'} eq '' ) ? '' : "checked='checked'";
698
699 $checked{'PINGMETHODE$count'}{'ip'} = $checked{'PINGMETHODE$count'}{'fqdn'} = '';
700 $checked{'PINGMETHODE$count'}{$wiosettings{'PINGMETHODE$count'}} = "checked='checked'";
701
702 $checked{'USE$count'}{'on'} = ($wiosettings{'USE$count'} eq '' ) ? '' : "checked='checked'";
703
704 $selected{'WEBINTERFACE$count'}{'----'} = '';
705 $selected{'WEBINTERFACE$count'}{'HTTP'} = '';
706 $selected{'WEBINTERFACE$count'}{'HTTPS'} = '';
707 $selected{'WEBINTERFACE$count'}{$wiosettings{'WEBINTERFACE$count'}} = "selected='selected'";
708
709if (! &WIO::checkinto($wiosettings{'IPADR$count'}, $wiosettings{'HOST$count'}, @current) ) {
710
711if ( $importmessage ) {
712 &Header::openbox('100%', 'left', "$Lang::tr{'wio_import_data'}'$wiosettings{'HOST$count'}'$Lang::tr{'wio_import_data1'}");
713}
714elsif ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_import'}.'1' || $wioscan eq 'on' || -e $wiofile || -e $editfile ) {
715 &Header::openbox('100%', 'left', "$Lang::tr{'wio_import_data'}'$wiosettings{'HOST$count'}'$Lang::tr{'wio_import_data2'}");
716}
717elsif ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_import'}.'2' ) {
718 &Header::openbox('100%', 'left', "$Lang::tr{'wio_import_data'}'$wiosettings{'HOST$count'}.$wiosettings{'DOM$count'}'$Lang::tr{'wio_import_data2'}");
719}
720else {
721 &Header::openbox('100%', 'left', $Lang::tr{'wio_import_leases'});
722}
723
724print"
725<form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
726<input type='hidden' name='ONLINE$count' value='$wiosettings{'ONLINE$count'}' />
727
728<table width='100%'>
729<tr>
730 <td>$Lang::tr{'wio_use'}</td>
731 <td><input type='checkbox' name='USE$count' $checked{'USE$count'}{'on'} /></td>
732</tr>
733<tr>
734 <td>$Lang::tr{'wio_client_enable'}</td>
735 <td><input type='checkbox' name='EN$count' $checked{'EN$count'}{'on'} /></td>
736</tr>
737<tr>
738 <td>$Lang::tr{'host ip'}:</td>
739 <td><input type='text' name='IPADR$count' value='$wiosettings{'IPADR$count'}' size='18' /></td>
740 <td>$Lang::tr{'hostname'}:</td>
741";
742
743if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_import'}.'2' ) {
744 print"<td><input type='text' name='HOST$count' size='18' value='$wiosettings{'HOST$count'}.$wiosettings{'DOM$count'}' /></td>";
745}
746else {
747 print"<td><input type='text' name='HOST$count' size='18' value='$wiosettings{'HOST$count'}' /></td>";
748}
749
750print"
751 <td>$Lang::tr{'remark'}:</td>
752 <td><input type='text' name='REMARK$count' value='$wiosettings{'REMARK$count'}' size='18' /></td>
753</tr>
754<tr>
755 <td class='base'>$Lang::tr{'wio_ping_send'}:</td>
756 <td align='left'><input type='radio' name='PINGMETHODE$count' value='ip' $checked{'PINGMETHODE$count'}{'ip'} />&nbsp;IP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='radio' name='PINGMETHODE$count' value='fqdn' $checked{'PINGMETHODE$count'}{'fqdn'} />&nbsp;FQDN</td>
757 <td>$Lang::tr{'wio_dyndns'}:</td>
758 <td><input type='checkbox' name='DYNDNS$count' $checked{'DYNDNS$count'}{'on'} /></td>
759";
760
761if ( $wiosettings{'SENDEMAIL'} eq 'on' ) {
762 print"<td>$Lang::tr{'wio_sendemail'}:</td>
763 <td><input type='checkbox' name='SENDEMAILON$count' $checked{'SENDEMAILON$count'}{'on'} />&nbsp;$Lang::tr{'wio_online'}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='checkbox' name='SENDEMAILOFF$count' $checked{'SENDEMAILOFF$count'}{'on'} />&nbsp;$Lang::tr{'wio_offline'}</td>";
764}
765else {
766 print"<td colspan='2'>&nbsp;</td>";
767}
768
769print"
770</tr>
771<tr>
1bee37ba 772 <td height='30'>$Lang::tr{'wio_link_open'}:</td>
0d6cc79d
SF
773 <td align='left' colspan='5'>
774 <select size='1' name='WEBINTERFACE$count' width='80' style='width: 80px'>
775 <option value='----' $selected{'WEBINTERFACE$count'}{'----'}>----</option>
776 <option value='HTTP' $selected{'WEBINTERFACE$count'}{'HTTP'}>HTTP</option>
777 <option value='HTTPS' $selected{'WEBINTERFACE$count'}{'HTTPS'}>HTTPS</option>
778 </select>
779 </td>
780</tr>
781</table>
782";
783
784&Header::closebox();
785$showcount++;
786}
787$count++;
788}
789
790if ( $showcount gt 0 ) {
791&Header::openbox('100%', 'left', $Lang::tr{'wio_import_infos'});
792
793print"
794<table width='100%'>
795<tr>
796";
797
798if ($importmessage) { print"<td>&nbsp;</td>"; }
799else { print"<td><font color='$color{'color11'}'>$Lang::tr{'wio_import_infos_csv'}</font></td>"; }
800
801print"
802</tr>
803<tr><td colspan='4'>&nbsp;</td></tr>
804</table>
805<table width='100%'>
806<tr>
807 <td width='25%'>&nbsp;</td>
808 <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>
809 <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>
810 <td width='25%'>&nbsp;</td>
811</tr>
812</table>
813";
814
815&Header::closebox();
816&Header::closebigbox();
817&Header::closepage();
818}
819else {
820 print"<meta http-equiv=\"refresh\" content=\"0; URL=$ENV{'SCRIPT_NAME'}?INFO\">";
821}
822
823if ( -e "$editfile" ) { unlink ($editfile); }
824if ( -e "$wiofile" ) { unlink($wiofile); }
825exit 0;
826}
827else {
828 $infomessage = "$Lang::tr{'wio_error_function'}";
829}
830}
831
832## skript function
833
834if ($ENV{'QUERY_STRING'} =~ /$sortstring/ ) {
835 my $string = $ENV{'QUERY_STRING'};
836
837 if ( $string eq 'INFO' ) {
838 $infomessage = $Lang::tr{'wio_import_info_csv'};
839 }
840 else {
841 &General::readhash($wiosettings, \%wiosettings);
842
843 my $actual = $wiosettings{'SORT'};
844
845 if ($actual =~ $string) {
846 my $Rev = '';
847 if ($actual !~ 'Rev') { $Rev = 'Rev'; }
848 $string.=$Rev;
849 }
850
851 system("/bin/sed -i 's#$wiosettings{'SORT'}#$string#g' $wiosettings");
852
853 $wiosettings{'SORT'} = $string;
854 map ($wiosettings{$_} = '' ,@nosaved);
855 &SortDataFile('',@current);
856 }
857}
858
859## main part
860
861ERROR:
862
863unless($message == 1) { &General::readhash($wiosettings, \%wiosettings); }
864
865for ($i=5; $i<=60; $i+=5) { $selected{'CRON'}{$i} = ''; }
866
867$selected{'CRON'}{$wiosettings{'CRON'}} = "selected='selected'";
868
869for ($i=1; $i<=15; $i++) {
870 $selected{'TIMEOUT'}{$i} = '';
871 $selected{'OVPNCRON'}{$i} = '';
872}
873
874$selected{'TIMEOUT'}{$wiosettings{'TIMEOUT'}} = "selected='selected'";
875$selected{'OVPNCRON'}{$wiosettings{'OVPNCRON'}} = "selected='selected'";
876
877$checked{'ENABLE'}{'off'} = $checked{'ENABLE'}{'on'} = '';
878$checked{'ENABLE'}{$wiosettings{'ENABLE'}} = "checked='checked'";
879
880$checked{'LOGGING'}{'off'} = $checked{'LOGGING'}{'on'} = '';
881$checked{'LOGGING'}{$wiosettings{'LOGGING'}} = "checked='checked'";
882
883$checked{'CLIENTREMARK'}{'off'} = $checked{'CLIENTREMARK'}{'on'} = '';
884$checked{'CLIENTREMARK'}{$wiosettings{'CLIENTREMARK'}} = "checked='checked'";
885
886$checked{'MAILREMARK'}{'off'} = $checked{'MAILREMARK'}{'on'} = '';
887$checked{'MAILREMARK'}{$wiosettings{'MAILREMARK'}} = "checked='checked'";
888
889$checked{'OVPNRWMAIL'}{'off'} = $checked{'OVPNRWMAIL'}{'on'} = '';
890$checked{'OVPNRWMAIL'}{$wiosettings{'OVPNRWMAIL'}} = "checked='checked'";
891
0d6cc79d
SF
892$checked{'MAILSTYLE'}{'smail'} = $checked{'MAILSTYLE'}{'email'} = '';
893$checked{'MAILSTYLE'}{$wiosettings{'MAILSTYLE'}} = "checked='checked'";
894
895&Header::showhttpheaders();
896&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'>");
897&Header::openbigbox('100%', 'left', '');
898
899## DEBUG / ERROR / INFO / UPDATE
900
901if ( $debug ) {
902 &Header::openbox('100%', 'left', 'DEBUG', 'warning');
903
904 print"errormessage: $errormessage<br />\n";
905 print"infomessage: $infomessage<br />\n";
906
907 &hrline();
a25c95b3 908
0d6cc79d
SF
909 my $wiodebug = 0;
910 foreach (sort keys %wiosettings) {
911 print"$_ = $wiosettings{$_}<br />\n";
912 $wiodebug++;
913 }
914
915 &hrline();
916
917 my $netdebug = 0;
918 foreach (sort keys %netsettings) {
919 print"$_ = $netsettings{$_}<br />\n";
920 $netdebug++;
921 }
922 &Header::closebox();
923}
924
925if ( $errormessage ) {
926 &Header::openbox('100%', 'left', $Lang::tr{'wio_error'}, 'error');
927 print"<table width='100%'><tr><td><font class='base'><b>$errormessage</b></font></td></tr></table>";
928 &Header::closebox();
929}
930
931if ( $infomessage ) {
932 &Header::openbox('100%', 'left', $Lang::tr{'wio_info'}, 'warning');
933 print"<table width='100%'><tr><td><font class='base'><b>$infomessage</b></font></td></tr></table>";
934 &Header::closebox();
935}
936
937## wio configuration
938
939if ( $wiosettings{'ACTION'} eq $Lang::tr{'edit'}.'1' || $message == 1 || $wiosettings{'ENABLE'} eq 'off' ) {
940
941&Header::openbox('100%', 'left', $Lang::tr{'wio settings'});
942
943print"
944<form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
945<table width='100%'>
946<tr>
391a2459
SF
947 <td bgcolor='$color{'color20'}' align='left'><b>$Lang::tr{'wio_settings_msg_hint'}</b></td>
948 <td colspan='2'>&nbsp;</td>
0d6cc79d 949</tr>
0d6cc79d 950<tr>
391a2459
SF
951 <td width='48%'>&nbsp;</td>
952 <td width='2%'>&nbsp;</td>
953 <td width='50%'>&nbsp;</td>
0d6cc79d 954</tr>
0d6cc79d
SF
955<tr>
956 <td align='right'>$Lang::tr{'wio enabled'}</td>
957";
958
959print"<td>&nbsp;</td>";
960
961if ( $wiosettings{'ENABLE'} eq 'on' ) {
962 print"<td align='left'><input type='checkbox' onClick=\"return confirm('$Lang::tr{'wio_disable_hint'}')\" name='ENABLE' $checked{'ENABLE'}{'on'} /></td>";
963}
964else {
965 print"<td align='left'><input type='checkbox' name='ENABLE' $checked{'ENABLE'}{'on'} /></td>";
966}
967print"
968</tr>
969<tr><td colspan='3'>&nbsp;</td></tr>
0d6cc79d
SF
970<tr>
971 <td align='right'>$Lang::tr{'wio cron'}</td>
972 <td>&nbsp;</td>
973 <td align='left'><select size='1' name='CRON' size='5'>
974";
975
fe6f676b
SF
976for ($i=5; $i<=60; $i+=5) {
977 $_ = sprintf("%02s",$i);
978 print "<option $selected{'CRON'}{$_}>$_</option>\n";
979}
0d6cc79d
SF
980
981print"
982 </select>&nbsp;$Lang::tr{'wio min'}</td>
983</tr>
984<tr><td colspan='3'>&nbsp;</td></tr>
985<tr>
986 <td align='right'>$Lang::tr{'wio timeout'}</td>
987 <td>&nbsp;</td>
988 <td align='left'><select size='1' name='TIMEOUT' size='5'>
989";
990
fe6f676b
SF
991for ($i=1; $i<=15; $i++) {
992 $_ = sprintf("%02s",$i);
993 print "<option $selected{'TIMEOUT'}{$_}>$_</option>\n";
994}
0d6cc79d 995
c1fc92a9 996print"
0d6cc79d
SF
997 </select>&nbsp;$Lang::tr{'wio sec'}</td>
998</tr>
999<tr><td colspan='3'>&nbsp;</td></tr>
1000<tr>
1001 <td align='right'>$Lang::tr{'wio_logging'}</td>
1002 <td>&nbsp;</td>
1003 <td align='left'><input type='checkbox' name='LOGGING' $checked{'LOGGING'}{'on'} /></td>
1004</tr>
1005<tr><td colspan='3'>&nbsp;</td></tr>
1006<tr>
1007 <td align='right'>$Lang::tr{'wio_clientremark'}</td>
1008 <td>&nbsp;</td>
1009 <td align='left'><input type='checkbox' name='CLIENTREMARK' $checked{'CLIENTREMARK'}{'on'} /></td>
1010</tr>
1011<tr><td colspan='3'>&nbsp;</td></tr>
0d6cc79d
SF
1012";
1013
1014if ( $wiosettings{'SENDEMAIL'} eq 'on' ) {
1015print"
1016<tr>
1017 <td align='right'>$Lang::tr{'wio_mail_style'}:</td>
1018 <td>&nbsp;</td>
1019 <td align='left'><input type='radio' name='MAILSTYLE' value='smail' $checked{'MAILSTYLE'}{'smail'} />&nbsp;$Lang::tr{'wio_mail_smail'}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='radio' name='MAILSTYLE' value='email' $checked{'MAILSTYLE'}{'email'} />&nbsp;$Lang::tr{'wio_mail_email'}</td>
1020</tr>
1021<tr><td colspan='3'>&nbsp;</td></tr>
1022<tr>
1023 <td align='right'>$Lang::tr{'wio_mailremark_enabled'}</td>
1024 <td>&nbsp;</td>
1025 <td align='left'><input type='checkbox' name='MAILREMARK' $checked{'MAILREMARK'}{'on'}></td>
1026</tr>
1027<tr><td colspan='3'>&nbsp;</td></tr>
1028";
1029}
1030if ( -e "$ovpnaddon" || ! -z "/var/ipfire/vpn/config" ) {
1031print"
1032<tr>
1033 <td align='right'>$Lang::tr{'wio_mail_ovpnrw'}</td>
1034 <td>&nbsp;</td>
1035 <td align='left'><input type='checkbox' name='OVPNRWMAIL' $checked{'OVPNRWMAIL'}{'on'}></td>
1036</tr>
1037<tr><td colspan='3'>&nbsp;</td></tr>
1038<tr>
1039 <td align='right'>$Lang::tr{'wio_ovpn_cron'}</td>
1040 <td>&nbsp;</td>
1041 <td align='left'><select size='1' name='OVPNCRON' size='5'>
1042";
1043
fe6f676b
SF
1044for ($i=1; $i<=15; $i++) {
1045 $_ = sprintf("%02s",$i);
1046 print "<option $selected{'OVPNCRON'}{$_}>$_</option>\n";
1047}
0d6cc79d
SF
1048
1049print"
1050 </select>&nbsp;$Lang::tr{'wio min'}</td>
1051</tr>
1052<tr><td colspan='3'>&nbsp;</td></tr>
1053";
1054}
1055print"
1056<tr><td colspan='3'>&nbsp;</td></tr>
1057<tr>
1058 <td colspan='2'>&nbsp;</td>
1059 <td align='left'><input type='hidden' name='ACTION' value='$Lang::tr{'wio_save'}1' /><input type='submit' name='submit' value='$Lang::tr{'wio_save'}' />"
1060 .($wiosettings{'ENABLE'} ne 'off' ? "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='button' onClick='location.href=\"/cgi-bin/wio.cgi\"' value='$Lang::tr{'wio_back'}'>" : "")
1061 ."</td>
1062</tr>
1063</table>
1064</form>
1065";
1066
1067&Header::closebox();
1068&Header::closebigbox();
1069&Header::closepage();
1070exit 0;
1071}
1072
1073## wio client status
1074
1075if ( $wiosettings{'ENABLE'} eq 'on') {
1076 if ( !$errormessage && $wiosettings{'ACTION'} ne $Lang::tr{'edit'} || $message == 2 ) {
1077 &Header::openbox('100%', 'left', $Lang::tr{'wio stat'});
1078
1079 foreach (@current) {
1080 chomp;
1081
1082 ($id,$timestamp,$ipadr,$host,$on,$remark,$dyndns,$sendemailon,$sendemailoff,$pingmethode,$online,$webinterface) = split (/\,/, $_);
1083
1084 if ( defined($dyndns) && ( $dyndns =~ 'on' ) ) {
1085 ($dyndnsip, $infomessage) = &WIO::getdyndnsip($ipadr, $host);
1086
1087 if ( $dyndnsip ne $ipadr ) {
1088 $ipadr = $dyndnsip;
1089 $write = 'on';
1090 }
1091 }
1092
1093 push (@id,($id));
1094
1095 if ( $on eq 'on' ) { push (@dates,($timestamp)); }
1096 else { push (@dates,('-')); }
1097
1098 push (@ipaddresses,($ipadr));
1099 push (@names,($host));
1100 push (@activ,($on));
1101 push (@remark,($remark));
1102 push (@dyndns,($dyndns));
1103 push (@sendemailon,($sendemailon));
1104 push (@sendemailoff,($sendemailoff));
1105 push (@pingmethode,($pingmethode));
1106 push (@status,($online));
1107 push (@webinterface,($webinterface));
1108
1109 push (@write, "$id,$timestamp,$ipadr,$host,$on,$remark,$dyndns,$sendemailon,$sendemailoff,$pingmethode,$online,$webinterface\n");
1110
1111 $nr++;
1112 }
1113
1114 if ( defined($write) ) { &writeips(); }
1115
1116## wan connection
1117
1118print"
1119<table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
a25c95b3
SFD
1120<tr height='25'>
1121 <td width='33%' bgcolor='$color{'color20'}' align='left'><b>&nbsp;$Lang::tr{'wio_wan_con'}</b></td>
1122 <td width='67%' align='right'>&nbsp;</td>
0d6cc79d
SF
1123</tr>
1124<tr><td colspan='2'>&nbsp;</td></tr>
1125</table>
1126
1127<table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1128<tr bgcolor='$color{'color20'}' height='20'>
1129 <td width='3%' align='center'><b>$Lang::tr{'wio_id'}</b></td>
1130 <td width='15%' align='center'><b>$Lang::tr{'wio ipadress'}</b></td>
391a2459 1131 <td width='7%' align='center'><b>$Lang::tr{'wio network'}</b></td>
0d6cc79d
SF
1132 <td width='15%' align='center'><b>$Lang::tr{'wio_lanname'}</b></td>
1133 <td width='15%' align='center'><b>$Lang::tr{'wio_wanname'}</b></td>
391a2459 1134 <td width='20%' align='center'><b>$Lang::tr{'wio_dyndns_hosts'}</b></td>
0d6cc79d 1135 <td width='11%' align='center'><b>$Lang::tr{'wio image'}</b></td>
c1fc92a9 1136 <td width='14%' align='center'><b>$Lang::tr{'wio_connected'}</b></td>
0d6cc79d
SF
1137</tr>
1138<tr bgcolor='$color{'color22'}' height='20'>
1139 <td align='center'>01</td>
391a2459 1140 <td align='center'><font color='$Header::colourred'>$redip</font></td>
0d6cc79d
SF
1141 <td align='center'><img align='middle' src='$imgstatic/red.png' alt='$Lang::tr{'internet'}' title='$Lang::tr{'internet'}' /></td>
1142 <td align='center'><font color='$Header::colourgreen'>".$mainsettings{'HOSTNAME'}.".".$mainsettings{'DOMAINNAME'}."</font></td>
1143 <td align='center'><font color='$Header::colourred'>".( $redip ne '-' ? (gethostbyaddr(pack("C4", split (/\./, $redip)), 2))[0] : '-' )."</font></td>
1144 <td align='center'>
1145";
1146
1147if ( -s "$dyndnsconfig" ) {
1148
1149open(FILE, "< $dyndnsconfig");
1150@ddns = <FILE>;
1151close (FILE);
1152
0d6cc79d
SF
1153 foreach (@ddns) {
1154 chomp;
48aae162 1155
0d6cc79d
SF
1156 @temp = split (/\,/, $_);
1157
391a2459
SF
1158 if ( $temp[7] eq "on" ) {
1159 $bgcolor = ( &General::DyndnsServiceSync (&General::GetDyndnsRedIP,$temp[1],$temp[2]) ? "$Header::colourgreen" : "$Header::colourred" );
1160 }
1161 else {
1162 $bgcolor = "blue";
1163 }
48aae162 1164
0d6cc79d 1165 print"<font color='$bgcolor'>$temp[1].$temp[2]</font>";
391a2459 1166 if ( $iddyndns++ ne (@ddns-1) ) { print"<br />\n"; }
0d6cc79d
SF
1167 }
1168}
391a2459
SF
1169else {
1170 print"-";
1171}
0d6cc79d
SF
1172
1173print"
1174 </td>
1175 <td align='center'>
1176 <table bgcolor='".( -e $redactive ? "${Header::colourgreen}" : "${Header::colourred}" )."' cellpadding='2' cellspacing='0' width='100%'>
1177 <tr height='20'>
1178 <td align='center'><font color='white'><b>".( -e $redactive ? $Lang::tr{'wio_wan_up'} : $Lang::tr{'wio_wan_down'} )."</b></font></td>
1179 </tr>
1180 </table>
1181 </td>
1182 <td align='center'><font color='$Header::colourred'>".( -e "$redactive" ? &General::age("$redactive") : '-' )."</font></td>
1183</tr>
1184<tr height='1'><td colspan='9' bgcolor='#696565'></td></tr>
1185</table>
1186";
1187
1188&hrline();
1189
1190## vpn connection(s)
1191
1192if ( -e "$vpnpid" ) {
1193
1194@vpnstatus = `/usr/local/bin/ipsecctrl I`;
1195
1196print"
1197<table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
a25c95b3
SFD
1198<tr height='25'>
1199 <td width='33%' bgcolor='$color{'color20'}' align='left'><b>&nbsp;$Lang::tr{'wio_vpn_con'}</b></td>
1200 <td width='67%'>&nbsp;</td>
0d6cc79d
SF
1201</tr>
1202<tr><td colspan='2'>&nbsp;</td></tr>
1203</table>
1204<table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1205<tr bgcolor='$color{'color20'}' height='20'>
1206 <td width='3%' align='center'><b>$Lang::tr{'wio_id'}</b></td>
1207 <td width='19%' align='center'><b>$Lang::tr{'wio checked'}</b></td>
1208 <td width='20%' align='center'><b>$Lang::tr{'name'}</b></td>
1209 <td width='8%' align='center'><b>$Lang::tr{'type'}</b></td>
1210 <td width='25%' align='center'><b>$Lang::tr{'wio_common_name'}</b></td>
1211 <td width='11%' align='center'><b>$Lang::tr{'wio image'}</b></td>
c1fc92a9 1212 <td width='14%' align='center'><b>$Lang::tr{'wio_connected'}</b></td>
0d6cc79d
SF
1213</tr>
1214";
1215
1216foreach $key (sort SortByTunnelName (keys(%vpnconfighash))) {
1217
391a2459 1218my ( $vpnclient, $vpnclientip, $vpnrwnet, $vpnn2nnet, $vpntime, $vpncheck ) = '';
0d6cc79d
SF
1219
1220$status = "bgcolor='${Header::colourred}'";
1221$statustxt = "$Lang::tr{'capsclosed'}";
953882ff 1222$vpnclient = $vpnconfighash{$key}[1];
0d6cc79d 1223
391a2459
SF
1224my ($ip,$sub) = split(/\//,$vpnsettings{'RW_NET'});
1225my @ip = split( /\./, $ip);
1226$vpnrwnet = join( '.', ( $ip[0], $ip[1], $ip[2], ) );
1227
0d6cc79d
SF
1228 if ($vpnconfighash{$key}[0] eq 'off') {
1229 $status = "bgcolor='${Header::colourblue}'";
1230 $statustxt = "$Lang::tr{'capsclosed'}";
391a2459
SF
1231 $vpnn2nnet = '-';
1232 }
1233 else {
1234 $vpnn2nnet = $vpnconfighash{$key}[11];
0d6cc79d
SF
1235 }
1236
1237 foreach (@vpnstatus) {
953882ff 1238 if ($_ =~ /$vpnclient.*ESTABLISHED/) {
0d6cc79d
SF
1239 $status = "bgcolor='${Header::colourgreen}'";
1240 $statustxt = "$Lang::tr{'capsopen'}";
953882ff
SF
1241 $vpntime = `/usr/local/bin/ipsecctrl I | grep $vpnclient.*ESTABLISHED | sed 's/^[ \t]*//' | cut -d " " -f 3-4`;
1242 $vpntime = &WIO::contime($vpntime, "ipsec");
391a2459
SF
1243 $vpnclientip = `/usr/local/bin/ipsecctrl I | grep $vpnclient.*$vpnrwnet | sed 's/^[ \t]*//' | cut -d " " -f 6 | cut -d "/" -f 1`;
1244 $vpncheck = strftime("%d.%m.%Y - %H:%M:%S",localtime);
0d6cc79d
SF
1245 last;
1246 }
1247 }
1248
1249 print"<tr".($idvpn % 2?" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'>";
1250
1251 my $vpnnr = $idvpn+1;
1252
953882ff 1253 printf ("<td align='center'>%02d</td>", $vpnnr);
0d6cc79d 1254
391a2459 1255 print"<td align='center'>".($vpncheck ne '' ? "$vpncheck" : "-")."</td>
953882ff
SF
1256 <td align='center'>$vpnclient</td>
1257 <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>
391a2459 1258 <td align='center'>".($vpnconfighash{$key}[3] eq 'host' ? (defined($vpnclientip) ? "$vpnclientip" : "-") : $vpnconfighash{$key}[3] eq 'net' ? "$vpnn2nnet" : "-")."</td>
0d6cc79d
SF
1259 <td align='center'>
1260 <table $status cellpadding='2' cellspacing='0' width='100%'>
1261 <tr height='20'>
1262 <td align='center'><font color='white'><b>$statustxt</b></font></td>
1263 </tr>
1264 </table>
1265 </td>
391a2459 1266 <td align='center' height='20'>".($vpntime ne '' ? "$vpntime" : "-")."</td>
0d6cc79d
SF
1267 </tr>
1268";
c1fc92a9 1269
391a2459
SF
1270if ($wiosettings{'CLIENTREMARK'} eq 'on') {
1271 print"<tr".($idvpn % 2?" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'><td>&nbsp;</td><td colspan='16' align='left'>".($vpnconfighash{$key}[25] ne '' ? "$vpnconfighash{$key}[25]" : "-")."</td></tr>";
0d6cc79d 1272}
391a2459
SF
1273
1274print"<tr height='1'><td colspan='7' bgcolor='#696565'></td></tr>";
1275$idvpn++
0d6cc79d
SF
1276}
1277
1278print"</table>";
1279&hrline();
1280}
1281
1282## openvpn connection(s)
1283
1284if ( -e "$ovpnpid" ) {
1285
1286@ovpnstatus = `cat /var/run/ovpnserver.log`;
1287
1288print"
1289<table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
a25c95b3
SFD
1290<tr height='25'>
1291 <td width='33%' bgcolor='$color{'color20'}' align='left'><b>&nbsp;$Lang::tr{'wio_ovpn_con'}</b></td>
1292 <td width='67%'>&nbsp;</td>
0d6cc79d
SF
1293</tr>
1294<tr><td colspan='2'>&nbsp;</td></tr>
1295</table>
1296<table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1297<tr bgcolor='$color{'color20'}' height='20'>
1298 <td width='3%' align='center'><b>$Lang::tr{'wio_id'}</b></td>
1299 <td width='19%' align='center'><b>$Lang::tr{'wio checked'}</b></td>
391a2459 1300 <td width='20%' align='center'><b>$Lang::tr{'name'}</b></td>
0d6cc79d 1301 <td width='8%' align='center'><b>$Lang::tr{'type'}</b></td>
391a2459 1302 <td width='25%' align='center'><b>$Lang::tr{'wio_common_name'}</b></td>
0d6cc79d 1303 <td width='11%' align='center'><b>$Lang::tr{'wio image'}</b></td>
c1fc92a9 1304 <td width='14%' align='center'><b>$Lang::tr{'wio_connected'}</b></td>
0d6cc79d
SF
1305</tr>
1306";
1307
391a2459 1308foreach $key (keys %ovpnconfighash) {
0d6cc79d 1309
391a2459 1310 my ( $ovpncheck, $ovpntime, $ovpnclt, $ovpnrwip ) = '';
0d6cc79d 1311
391a2459 1312 print"<tr".($idovpn % 2?" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'>";
0d6cc79d 1313
391a2459 1314 my $ovpnnr = $idovpn+1;
0d6cc79d 1315
391a2459 1316 printf ("<td align='center' height='20'> %02d</td>", $ovpnnr);
0d6cc79d 1317
391a2459
SF
1318 if ($ovpnconfighash{$key}[3] eq 'net') {
1319 $image = "$imgstatic/ovpnn2n.png";
1320 $text = "$Lang::tr{'wio_n2n'}";
1321 }
1322 else {
1323 $image = "$imgstatic/ovpnrw.png";
1324 $text = "$Lang::tr{'wio_rw'}";
1325 }
0d6cc79d 1326
391a2459
SF
1327 if ( $ovpnconfighash{$key}[0] eq 'off' ) {
1328 $status = "${Header::colourblue}";
1329 $statustxt = "$Lang::tr{'capsclosed'}";
1330 $ovpncheck = "-";
1331 }
1332 else {
0d6cc79d 1333 if ($ovpnconfighash{$key}[3] eq 'net') {
391a2459
SF
1334 if (-e "/var/run/$ovpnconfighash{$key}[1]n2n.pid") {
1335 my ( @output, @tustate ) = '';
1336 my $tport = $ovpnconfighash{$key}[22];
48aae162 1337 my $tnet = new Net::Telnet ( Timeout=>5, Errmode=>'return', Port=>$tport);
391a2459
SF
1338 if ($tport ne '') {
1339 $tnet->open('127.0.0.1');
1340 @output = $tnet->cmd(String => 'state', Prompt => '/(END.*\n|ERROR:.*\n)/');
1341 @tustate = split(/\,/, $output[1]);
1342 $ovpntime = &WIO::contime(scalar localtime($tustate[0]), "ovpn");
1343 $ovpncheck = strftime("%d.%m.%Y - %H:%M:%S", localtime);
1344
1345 if (($tustate[1] eq 'CONNECTED')) {
1346 $status = "${Header::colourgreen}";
1347 $statustxt = "$Lang::tr{'capsopen'}";
1348 $ovpnrwip = $ovpnconfighash{$key}[11];
1349 }
1350 else {
1351 $status = "${Header::colourred}";
1352 $statustxt = "$tustate[1]";
0d6cc79d
SF
1353 }
1354 }
1355 }
391a2459
SF
1356 }
1357 else {
1358 foreach (@ovpnstatus) {
1359 if ( $_ =~ /^(.+),(\d+\.\d+\.\d+\.\d+\:\d+),(\d+),(\d+),(.+)/ ) {
1360 @match = split (m/^(.+),(\d+\.\d+\.\d+\.\d+\:\d+),(\d+),(\d+),(.+)/, $_);
1361 $match[1] =~ s/[_]/ /g;
1362 }
0d6cc79d 1363
391a2459
SF
1364 if ( $match[1] ne "Common Name" && ($match[1] eq $ovpnconfighash{$key}[2]) ) {
1365 $ovpnclt = $match[1];
1366 $ovpntime = &WIO::contime($match[5], "ovpn");
1367 }
0d6cc79d 1368
391a2459
SF
1369 if ( $_ =~ /^(\d+\.\d+\.\d+\.\d+),(.+),(\d+\.\d+\.\d+\.\d+\:\d+),(.+)/ ) {
1370 @match = split(m/^(\d+\.\d+\.\d+\.\d+),(.+),(\d+\.\d+\.\d+\.\d+\:\d+),(.+)/, $_);
1371 }
0d6cc79d 1372
391a2459
SF
1373 if ( $match[1] ne "Virtual Address" && $match[2] eq $ovpnclt ) {
1374 $ovpnrwip = $match[1];
1375 $ovpncheck = &WIO::statustime($match[4]);
1376 }
0d6cc79d 1377
391a2459
SF
1378 if ( $ovpnclt eq $ovpnconfighash{$key}[2] ) {
1379 $status = "${Header::colourgreen}";
1380 $statustxt = "$Lang::tr{'capsopen'}";
1381 }
1382 else {
1383 $status = "${Header::colourred}";
1384 $statustxt = "$Lang::tr{'capsclosed'}";
0d6cc79d
SF
1385 }
1386 }
391a2459
SF
1387 }
1388 }
0d6cc79d 1389
391a2459
SF
1390print"
1391 <td align='center'>".(defined($ovpncheck) ? "$ovpncheck" : "-")."</td>
1392 <td align='center'>".($ovpnconfighash{$key}[2] eq '%auth-dn' ? "$ovpnconfighash{$key}[9]" : ($ovpnconfighash{$key}[4] eq 'cert' ? "$ovpnconfighash{$key}[1]": "-"))."</td>
0d6cc79d 1393 <td align='center'><img align='middle' src='$image' alt='$text' title='$text' /></td>
391a2459 1394 <td align='center'>".($ovpnrwip ne '' ? "$ovpnrwip" : "-")."</td>
0d6cc79d 1395 <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>
391a2459 1396 <td align='center'>".(defined($ovpntime) ? "$ovpntime" : "-")."</td>
0d6cc79d
SF
1397</tr>
1398";
c1fc92a9 1399
391a2459
SF
1400if ($wiosettings{'CLIENTREMARK'} eq 'on') {
1401 print"<tr".($idovpn % 2?" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'><td>&nbsp;</td><td colspan='16' align='left'>".($ovpnconfighash{$key}[25] ne '' ? "$ovpnconfighash{$key}[25]" : "-")."</td></tr>";
1402}
1403
1404print"<tr height='1'><td colspan='17' bgcolor='#696565'></td></tr>";
1405$idovpn++
1406}
1407
1408print"</table>";
1409&hrline();
0d6cc79d 1410}
0d6cc79d
SF
1411
1412## client status
1413
1414print"
1415<table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
a25c95b3
SFD
1416<tr height='25'>
1417 <td width='33%' bgcolor='$color{'color20'}' align='left'><b>&nbsp;$Lang::tr{'wio_clients'}</b></td>
1418 <td width='67%'>&nbsp;</td>
0d6cc79d
SF
1419</tr>
1420<tr><td colspan='2'>&nbsp;</td></tr>
1421</table>
1422
1423<table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1424<tr bgcolor='$color{'color20'}' height='20'>
1425 <td width='3%' align='center'><b>$Lang::tr{'wio_id'}</b></td>
1426 <td width='4%' align='center'><b>$Lang::tr{'wio_activ'}</b></td>
1427 <td width='5%' align='center'><b>$Lang::tr{'wio_check'}</b></td>
1428 <td width='15%' align='center'><b>$Lang::tr{'wio checked'}</b></td>
1429 <td width='4%' align='center'><b>$Lang::tr{'wio_webinterface'}</b></td>
1430 <td width='11%' align='center'><a href='$ENV{'SCRIPT_NAME'}?IPADR'><b>$Lang::tr{'wio ipadress'}</b></a></td>
1431 <td width='5%' align='center'><b>$Lang::tr{'wio network'}</b></td>
391a2459
SF
1432 <td width='23%' align='center'><a href='$ENV{'SCRIPT_NAME'}?HOST'><b>$Lang::tr{'wio name'}</b></a></td>
1433 <td width='9%' align='center'><b>$Lang::tr{'wio image'}</b></td>
1434 <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_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>
0d6cc79d
SF
1435 <td width='4%' colspan='2' align='center'><b>$Lang::tr{'wio_dyndns'}</b></td>
1436 <td width='12%' colspan='4' align='center'><b>$Lang::tr{'action'}</b></td>
1437 <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>
1438</tr>
1439";
1440
1441for (my $a=0; $a<$nr; $a++) {
1442
1443my $gif = 'off.gif';
1444my $gdesc = $Lang::tr{'wio_client_off'};
1445my $dyndnsimg = 'on.gif';
1446my $dyndnsimgtxt = $Lang::tr{'wio_dyndns_on'};
1447my $mailonimg = 'wio/mailgreenon.png';
1448my $mailonimgtxt = $Lang::tr{'wio_mail_online_on'};
1449my $mailoffimg = 'wio/mailredon.png';
1450my $mailoffimgtxt = $Lang::tr{'wio_mail_offline_on'};
1451my $pingimg = '';
1452my $pingtxt = '';
1453my $webimg = '';
1454
1455if ( $activ[$a] eq 'on' ) {
1456 $gif = 'on.gif';
1457 $gdesc = $Lang::tr{'wio_client_on'};
1458}
1459
1460if ( $dyndns[$a] ne 'on' ) {
1461 $dyndnsimg = 'off.gif';
1462 $dyndnsimgtxt = $Lang::tr{'wio_dyndns_off'};
1463}
1464
1465if ( $sendemailon[$a] ne 'on' ) {
1466 $mailonimg = 'wio/mailgreenoff.png';
1467 $mailonimgtxt = $Lang::tr{'wio_mail_online_off'};
1468}
1469
1470if ( $sendemailoff[$a] ne 'on' ) {
1471 $mailoffimg = 'wio/mailredoff.png';
1472 $mailoffimgtxt = $Lang::tr{'wio_mail_offline_off'};
1473}
1474
1475if ( $webinterface[$a] eq 'HTTP' ) {
1476 $webimg = 'wio/http.png';
1477}
1478elsif ( $webinterface[$a] eq 'HTTPS' ) {
1479 $webimg = 'wio/https.png';
1480}
1481else {
1482 $webimg = 'wio/none.png';
1483}
1484
1485$bgcolor = $status[$a] eq "on" ? "${Header::colourgreen}" : ($status[$a] eq "off" && $dates[$a] eq "") ? "${Header::colourblue}" : "${Header::colourred}";
1486$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'}";
1487
1488print"<tr".($a % 2?" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'>";
1489printf ("<td align='center'> %02d</td>", $a+1);
1490
1491print"<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1492 <input type='hidden' name='ACTION' value='$Lang::tr{'enable disable client'}' />
1493 <input type='image' name='$Lang::tr{'enable disable client'}' src='/images/$gif' align='middle' alt='$gdesc' title='$gdesc' />
1494 <input type='hidden' name='ID' value='$a' /></form></td>";
1495
1496if ( $pingmethode[$a] eq 'ip') {
1497 print"<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1498 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_ip_on'}' />
1499 <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'}' />
1500 <input type='hidden' name='ID' value='$a' /></form></td>";
1501}
1502else {
1503 print"<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1504 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_fqdn_on'}' />
1505 <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'}' />
1506 <input type='hidden' name='ID' value='$a' /></form></td>";
1507}
1508
1509print"<td align='center'>$dates[$a]</td>";
1510
1511print"<td align='center'><img align='middle' src='/images/$webimg' /></td>";
1512
1513if ( $webinterface[$a] eq 'HTTP' ) {
1514 print"<td align='center'><a title=\"$Lang::tr{'wio_webinterface_link'}\" href=\"http://$ipaddresses[$a]\" target=\"_blank\">$ipaddresses[$a]</a></td>";
1515}
1516elsif ( $webinterface[$a] eq 'HTTPS' ) {
1517 print"<td align='center'><a title=\"$Lang::tr{'wio_webinterface_link'}\" href=\"https://$ipaddresses[$a]\" target=\"_blank\">$ipaddresses[$a]</a></td>";
1518}
1519else {
1520 print"<td align='center'>$ipaddresses[$a]</td>";
1521}
1522
1523my $dotip = length($ipaddresses[$a]) - rindex($ipaddresses[$a],'.');
1524 SWITCH: {
1525 foreach (@devs_color) {
1526 my $in = 0;
1527 $ic = "${_}";
1528
1529 foreach $interface (@devs_net) {
f928cc5a 1530 next if ( $netsettings{"$ic"."_DEV"} eq 'red0' && $netsettings{"RED_TYPE"} eq 'PPPOE');
0d6cc79d
SF
1531 if ( $netsettings{"$ic"."_DEV"} eq $interface ) {
1532 if ( &General::IpInSubnet($ipaddresses[$a], $netsettings{"$ic"."_NETADDRESS"}, $netsettings{"$ic"."_NETMASK"}) ) {
391a2459
SF
1533 if ( $netsettings{"$ic"."_DEV"} eq 'red0' ) {
1534 print"<td align='center' height='20'><img src='$imgstatic/$devs_img[$in]' alt='$Lang::tr{'wio_red_lan'}' title='$Lang::tr{'wio_red_lan'}' /></td>";
1535 }
1536 else {
1537 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>";
391a2459
SF
1538 }
1539 last SWITCH;
0d6cc79d
SF
1540 }
1541 }
1542 $in++;
1543 }
1544 }
1545
0d6cc79d
SF
1546 if ( -e "$vpnpid" ) {
1547 foreach $key (keys(%vpnconfighash)) {
1548 next unless ($vpnconfighash{$key}[3] eq 'net');
c1fc92a9 1549
0d6cc79d 1550 my $convertip = &General::ipcidr2msk($vpnconfighash{$key}[11]);
a25c95b3 1551
0d6cc79d
SF
1552 my @net = split ("/", $convertip);
1553
1554 $vpnn2nip = $net[0];
1555 $vpnn2nmask = length($net[1]) - rindex($net[1],'.');
1556
1557 if (substr($ipaddresses[$a],0,length($ipaddresses[$a])-$dotip) eq substr($vpnn2nip,0,length($vpnn2nip)-$vpnn2nmask)) {
391a2459 1558 print"<td align='center'><img align='middle' src='$imgstatic/vpn.png' alt='IPsec' title='IPsec' /></td>";
0d6cc79d
SF
1559 last SWITCH;
1560 }
1561 }
1562 }
1563
1564 if ( $ovpnsettings{'DOVPN_SUBNET'} ne '' ) {
1565 @match = split ("/", $ovpnsettings{'DOVPN_SUBNET'});
1566
1567 if ( &General::IpInSubnet($ipaddresses[$a], $match[0], $match[1]) ) {
c1fc92a9
SFD
1568 print"<td align='center'><img src='$imgstatic/ovpn.png' alt='OpenVPN' title='OpenVPN' /></td>";
1569 last SWITCH;
0d6cc79d
SF
1570 }
1571 }
1572
1573 if ( %ovpnccdconfhash ne '' ) {
1574 foreach $key (keys(%ovpnccdconfhash)) {
c1fc92a9 1575
0d6cc79d 1576 my $convertip = &General::ipcidr2msk($ovpnccdconfhash{$key}[1]);
0d6cc79d
SF
1577 my @net = split ("/", $convertip);
1578
1579 $vpnn2nip = $net[0];
1580 $vpnn2nmask = length($net[1]) - rindex($net[1],'.');
1581
1582 if (substr($ipaddresses[$a],0,length($ipaddresses[$a])-$dotip) eq substr($vpnn2nip,0,length($vpnn2nip)-$vpnn2nmask)) {
1583 print"<td align='center'><img align='middle' src='$imgstatic/ovpn.png' alt='OpenVPN' title='OpenVPN' /></td>";
1584 last SWITCH;
1585 }
0d6cc79d
SF
1586 }
1587 }
a25c95b3 1588
f928cc5a 1589 if ( $netsettings{"RED_TYPE"} eq 'PPPOE' ) {
a25c95b3
SFD
1590 my $redipadr = qx'ip addr | grep red0 | grep inet | awk "{print \$2}"';
1591 my @rednet = split ("/", $redipadr);
1592 chomp ($rednet[1]);
1593 my $red_netmask = General::iporsubtodec($rednet[1]);
1594 my $red_netaddress = Network::get_netaddress("$rednet[0]/$red_netmask");
c1fc92a9 1595
a25c95b3 1596 if ( &General::IpInSubnet($ipaddresses[$a], $red_netaddress, $red_netmask) ) {
391a2459 1597 print"<td align='center' height='20'><img src='$imgstatic/red.png' alt='$Lang::tr{'internet'}' title='$Lang::tr{'internet'}' /></td>";
a25c95b3
SFD
1598 last SWITCH;
1599 }
f928cc5a
SF
1600 }
1601 else {
a25c95b3
SFD
1602 print"<td align='center'><img align='middle' src='$imgstatic/white.png' alt='$Lang::tr{'wio_unknown_lan'}' title='$Lang::tr{'wio_unknown_lan'}' /></td>";
1603 last SWITCH;
a25c95b3 1604 }
0d6cc79d
SF
1605 }
1606
1607if ( $webinterface[$a] eq 'HTTP' ) {
1608 print"<td align='center'><a title=\"$Lang::tr{'wio_webinterface_link'}\" href=\"http://$names[$a]\" target=\"_blank\">$names[$a]</a></td>";
1609}
1610elsif ( $webinterface[$a] eq 'HTTPS' ) {
1611 print"<td align='center'><a title=\"$Lang::tr{'wio_webinterface_link'}\" href=\"https://$names[$a]\" target=\"_blank\">$names[$a]</a></td>";
1612}
1613else {
1614 print"<td align='center'>$names[$a]</td>";
1615}
1616
1617print"
1618 <td>
1619 <table bgcolor='$bgcolor' cellpadding='2' cellspacing='0' width='100%'>
1620 <tr height='20'>
1621 <td align='center'><font color='$color{'color21'}'><b>$statustxt</b></font></td>
1622 </tr>
1623 </table>
1624 </td>
1625
1626 <td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1627 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_sc_refresh'}' />
1628 <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'}' />
1629 <input type='hidden' name='ID' value='$a' /></form></td>
1630
1631 <td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1632 <input type='hidden' name='ACTION' value='$Lang::tr{'enable disable dyndns'}' />
1633 <input type='image' name='$Lang::tr{'enable disable dyndns'}' src='/images/$dyndnsimg' align='middle' alt='$dyndnsimgtxt' title='$dyndnsimgtxt' />
1634 <input type='hidden' name='ID' value='$a' /></form></td>";
1635
1636if ( defined($dyndns[$a]) && ($dyndns[$a] eq 'on') ) {
1637 print"<td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1638 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_dyndns_refresh'}' />
1639 <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'}' />
1640 <input type='hidden' name='ID' value='$a' /></form></td>";
1641}
1642else {
1643 print"<td width='3%' align='center'>-</td>";
1644}
1645
1646if ( -e "/var/log/rrd/wio/$id[$a].rrd" ) {
1647 print"
1648 <td width='3%' align='center'><form method='post' action='/cgi-bin/wiographs.cgi' enctype='multipart/form-data'>
1649 <input type='image' name='$Lang::tr{'wio_graphs'}' src='$imgstatic/graph.png' align='middle' alt='$Lang::tr{'wio_graphs'}' title='$Lang::tr{'wio_graphs'}' />
1650 <input type='hidden' name='HOSTID' value='$id[$a]' /><input type='hidden' name='HOSTNAME' value='$names[$a]' /></form></td>
1651 ";
1652}
1653else {
1654 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>";
1655}
1656
1657if ( $wiosettings{'SENDEMAIL'} eq 'on') {
1658 print"<td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1659 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_mail_online'}' />
1660 <input type='image' name='$Lang::tr{'wio_mail_online'}' src='/images/$mailonimg' align='middle' alt='$mailonimgtxt' title='$mailonimgtxt' />
1661 <input type='hidden' name='ID' value='$a' /></form></td>
1662 <td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1663 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_mail_offline'}' />
1664 <input type='image' name='$Lang::tr{'wio_mail_offline'}' src='/images/$mailoffimg' align='middle' alt='$mailoffimgtxt' title='$mailoffimgtxt' />
1665 <input type='hidden' name='ID' value='$a' /></form></td>";
1666}
1667else {
1668 print"<td width='3%' align='center'>-</td>
1669 <td width='3%' align='center'>-</td>";
1670}
1671
1672print"
1673 <td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1674 <input type='hidden' name='ACTION' value='$Lang::tr{'edit'}' />
1675 <input type='image' name='$Lang::tr{'edit'}' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' />
1676 <input type='hidden' name='ID' value='$a' /></form></td>
1677
1678 <td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1679 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_remove_client'}' />
1680 <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'}')\" />
1681 <input type='hidden' name='ID' value='$a' /></form></td></tr>
1682";
1683
391a2459
SF
1684if ($wiosettings{'CLIENTREMARK'} eq 'on') {
1685 print"<tr".($a % 2?" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'><td>&nbsp;</td><td colspan='16' align='left'>".($remark[$a] ne '' ? "$remark[$a]" : "-")."</td></tr>";
0d6cc79d
SF
1686}
1687 print"<tr height='1'><td colspan='17' bgcolor='#696565'></td></tr>";
1688}
1689
1690print"</table>";
1691
1692&Header::closebox();
1693
1694}
1695
1696## add / modify client
1697
1698$checked{'EN'}{'on'} = ($wiosettings{'EN'} eq '' ) ? '' : "checked='checked'";
1699
1700$checked{'DYNDNS'}{'off'} = $checked{'DYNDNS'}{'on'} = '';
1701$checked{'DYNDNS'}{$wiosettings{'DYNDNS'}} = "checked='checked'";
1702
1703$checked{'SENDEMAILON'}{'off'} = $checked{'SENDEMAILON'}{'on'} = '';
1704$checked{'SENDEMAILON'}{$wiosettings{'SENDEMAILON'}} = "checked='checked'";
1705
1706$checked{'SENDEMAILOFF'}{'off'} = $checked{'SENDEMAILOFF'}{'on'} = '';
1707$checked{'SENDEMAILOFF'}{$wiosettings{'SENDEMAILOFF'}} = "checked='checked'";
1708
1709if (! defined($errormessage) && $wiosettings{'ACTION'} ne $Lang::tr{'edit'} ) {
1710 $wiosettings{'PINGMETHODE'} = 'ip';
1711}
1712
1713$checked{'PINGMETHODE'}{'ip'} = $checked{'PINGMETHODE'}{'fqdn'} = '';
1714$checked{'PINGMETHODE'}{$wiosettings{'PINGMETHODE'}} = "checked='checked'";
1715
1716$selected{'WEBINTERFACE'}{'----'} = '';
1717$selected{'WEBINTERFACE'}{'HTTP'} = '';
1718$selected{'WEBINTERFACE'}{'HTTPS'} = '';
1719$selected{'WEBINTERFACE'}{$wiosettings{'WEBINTERFACE'}} = "selected='selected'";
1720
1721$buttontext = $Lang::tr{'wio_client_add'};
1722
1723if ( $wiosettings{'ACTION'} eq $Lang::tr{'edit'} || defined($errormessage) && ! defined($message) ) {
1724 &Header::openbox('100%', 'left', $Lang::tr{'wio_edit_client'});
1725 $buttontext = $Lang::tr{'update'};
1726}
1727else {
1728 &Header::openbox('100%', 'left', $Lang::tr{'wio_edit_settings'});
1729}
1730
1731if (! defined($errormessage) && $wiosettings{'ACTION'} ne $Lang::tr{'edit'} ) {
1732print"
1733<table width='100%' border='0' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1734<tr>
a25c95b3
SFD
1735 <td width='33%' bgcolor='$color{'color20'}' align='left' height='25'><b>&nbsp;$Lang::tr{'wio_add'}</b></td>
1736 <td width='67%' align='right'>&nbsp;</td>
0d6cc79d
SF
1737</tr>
1738<tr>
1739 <td>&nbsp;</td>
1740</tr>
1741</table>
1742";
1743}
1744
1745print"
1746<form method='post' action='$ENV{'SCRIPT_NAME'}'>
1747<input type='hidden' name='ID' value='$wiosettings{'ID'}' />
1748<input type='hidden' name='CLIENTID' value='$wiosettings{'CLIENTID'}' />
1749<input type='hidden' name='ONLINE' value='$wiosettings{'ONLINE'}' />
1750<input type='hidden' name='TIMESTAMP' value='$wiosettings{'TIMESTAMP'}' />
1751";
1752
1753print"
1754<table width='100%' border='0' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1755<tr>
1756 <td height='30'>$Lang::tr{'wio_client_enable'}</td>
1757 <td align='left'><input type='checkbox' name='EN' $checked{'EN'}{'on'} /></td>
1758 <td colspan='4'>&nbsp;</td>
1759</tr>
1760<tr>
1761 <td height='30'>$Lang::tr{'wio ipadress'}:</td>
1762 <td align='left'><input type='text' name='IPADR' value='$wiosettings{'IPADR'}' size='25' /></td>
1763 <td>$Lang::tr{'wio name'}:</td>
1764 <td align='left'><input type='text' name='HOST' value='$wiosettings{'HOST'}' size='25' /></td>
1765 <td>$Lang::tr{'remark'}:</td>
1766 <td align='left'><input type='text' name='REMARK' value='$wiosettings{'REMARK'}' size='30'></td>
1767</tr>
1768<tr>
1769 <td height='30'>$Lang::tr{'wio_ping_send'}:</td>
1770 <td align='left'><input type='radio' name='PINGMETHODE' value='ip' $checked{'PINGMETHODE'}{'ip'} />&nbsp;IP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='radio' name='PINGMETHODE' value='fqdn' $checked{'PINGMETHODE'}{'fqdn'} />&nbsp;FQDN</td>
1771 <td>$Lang::tr{'wio_dyndns'}:</td>
1772 <td align='left'><input type='checkbox' name='DYNDNS' $checked{'DYNDNS'}{'on'} /></td>
1773";
1774
1775if ( $wiosettings{'SENDEMAIL'} eq 'on' ) {
1776 print"<td>$Lang::tr{'wio_sendemail'}:</td>
1777 <td><input type='checkbox' name='SENDEMAILON' $checked{'SENDEMAILON'}{'on'} />&nbsp;$Lang::tr{'wio_online'}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='checkbox' name='SENDEMAILOFF' $checked{'SENDEMAILOFF'}{'on'} />&nbsp;$Lang::tr{'wio_offline'}</td>";
1778}
1779else {
1780 print"<td colspan='2'>&nbsp;</td>";
1781}
1782
1783print"
1784</tr>
1785<tr>
1bee37ba 1786 <td height='30'>$Lang::tr{'wio_link_open'}:</td>
0d6cc79d
SF
1787 <td align='left' colspan='5'>
1788 <select size='1' name='WEBINTERFACE' width='80' style='width: 80px'>
1789 <option value='----' $selected{'WEBINTERFACE'}{'----'}>----</option>
1790 <option value='HTTP' $selected{'WEBINTERFACE'}{'HTTP'}>HTTP</option>
1791 <option value='HTTPS' $selected{'WEBINTERFACE'}{'HTTPS'}>HTTPS</option>
1792 </select>
1793 </td>
1794</tr>
1795</table>
1796<table width='100%' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1797<tr>
1798 <td width='20%' align='center'>&nbsp;</td>
1799";
1800
1801if ( $buttontext eq $Lang::tr{'update'} && ( defined($errormessage) || $wiosettings{'ACTION'} eq $Lang::tr{'edit'}) && ! defined($message) ) {
1802 print"<td width='20%' align='center'>&nbsp;</td>
1803 <td width='20%' align='center'>&nbsp;</td>
1804 <td width='20%' align='center'><input type='hidden' name='ACTION' value='$Lang::tr{'wio_client_add'}' /><input type='submit' name='SUBMIT' value='$buttontext' /></td>
1805 <td width='20%' align='center'><input type='button' onClick='location.href=\"/cgi-bin/wio.cgi\"' value='$Lang::tr{'wio_back'}'></form></td>";
1806}
1807else {
1808 print"<td width='20%' align='center'>&nbsp;</td>
1809 <td width='20%' align='center'>&nbsp;</td>
1810 <td width='20%' align='center'>&nbsp;</td>
1811 <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>";
1812}
1813
1814print"
1815</tr>
1816</table>
1817";
1818
1819if ( $wiosettings{'ENABLE'} eq 'on' && !$errormessage && $wiosettings{'ACTION'} ne $Lang::tr{'edit'} || $message == 2 ) {
1820
1821&hrline();
1822
1823## arp table entries
1824
1825print"
1826<table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1827<tr>
a25c95b3
SFD
1828 <td width='33%' bgcolor='$color{'color20'}' align='left' height='25'><b>&nbsp;$Lang::tr{'wio_arp_table_entries'}</b></td>
1829 <td width='67%' align='right'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='WIOGUISHOWARPTABLE' value='arptable' /><input type='submit' name='ACTION' value='$arpbuttontext' /></form></td>
0d6cc79d 1830</tr>
0d6cc79d 1831</table>
a25c95b3
SFD
1832";
1833
1834if ( $wiosettings{'WIOGUISHOWARPTABLE'} eq 'on' ) {
0d6cc79d 1835
a25c95b3 1836print"
0d6cc79d 1837<table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
a25c95b3 1838<tr><td colspan='2'>&nbsp;</td></tr>
0d6cc79d
SF
1839<tr bgcolor='$color{'color20'}'>
1840 <td width='5%' align='center' height='20'><b>$Lang::tr{'wio_id'}</b></td>
1841 <td width='20%' align='center' height='20'><b>$Lang::tr{'wio_hwaddress'}</b></td>
1842 <td width='20%' align='center' height='20'><b>$Lang::tr{'wio ipadress'}</b></td>
1843 <td width='15%' align='center' height='20'><b>$Lang::tr{'wio network'}</b></td>
1844 <td width='20%' align='center' height='20'><b>$Lang::tr{'wio name'}</b></td>
1845 <td width='15%' align='center' height='20'><b>$Lang::tr{'wio_iface'}</b></td>
1846 <td width='5%' align='center' height='20'><b>$Lang::tr{'action'}</b></td>
1847</tr>
1848";
1849
1850$output = `/sbin/ip neigh list`;
1851$output = &Header::cleanhtml($output,"y");
1852
1853my $arpcnt = 0;
1854
1855foreach $line (split(/\n/, $output))
1856{
1857 if ($line =~ m/^(.*) dev ([^ ]+) lladdr ([0-9a-f:]*) (.*)$/) {
1858 my $arphost = gethostbyaddr(inet_aton($1), AF_INET);
1859 if ( $arphost eq 'localhost' ) { $arphost = ''; }
1860 push (@arpcache, "$3,$1,$arphost,$2\n");
1861 }
1862 elsif ($line =~ m/^(.*) dev ([^ ]+) (.*)$/) {
1863 my $arphost = gethostbyaddr(inet_aton($1), AF_INET);
1864 if ( $arphost eq 'localhost' ) { $arphost = ''; }
1865 push (@arpcache, ",$1,$arphost,$2\n");
1866 }
1867
1868 $arpcnt++;
1869}
1870
1871&SortDataFile('arpcache',@arpcache);
1872
1873foreach (@arpcache) {
1874 chomp;
1875
1876 @line = split (/\,/, $_);
1877
1878 print"<tr".($idarp % 2?" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'>";
1879 printf ("<td align='center'> %02d</td>", $idarp+1);
1880 print"<td align='center'>$line[0]</td>
1881 <td align='center'>$line[1]</td>";
1882
1883SWITCH: {
1884
1885 foreach (@devs_color) {
1886 my $in = 0;
1887 $ic = "${_}";
1888
1889 foreach $interface (@devs_net) {
1890 next if ( $netsettings{"$ic"."_DEV"} eq 'red0' && ($netsettings{"RED_TYPE"} eq 'DHCP' || $netsettings{"RED_TYPE"} eq 'PPPOE'));
1891
1892 if ($netsettings{"$ic"."_DEV"} eq $interface) {
1893 if ( &General::IpInSubnet($line[1], $netsettings{"$ic"."_NETADDRESS"}, $netsettings{"$ic"."_NETMASK"}) ) {
1894 print"<td align='center'><img src='$imgstatic/$devs_img[$in]' alt='$Lang::tr{$devs_alt[$in]}' title='$Lang::tr{$devs_alt[$in]}' /></td>";
1895 last SWITCH;
1896 }
1897 }
1898
1899 $in++;
1900 }
1901 }
1902
f928cc5a 1903 if ($netsettings{"RED_TYPE"} eq 'DHCP' || $netsettings{"RED_TYPE"} eq 'PPPOE' || $netsettings{"RED_TYPE"} eq 'STATIC') {
0d6cc79d
SF
1904 my $redipadr = qx'ip addr | grep red0 | grep inet | awk "{print \$2}"';
1905 my @rednet = split ("/", $redipadr);
1906 chomp ($rednet[1]);
1907 my $red_netmask = General::iporsubtodec($rednet[1]);
1908 my $red_netaddress = Network::get_netaddress("$rednet[0]/$red_netmask");
1909
1910 if ( &General::IpInSubnet($line[1], $red_netaddress, $red_netmask) ) {
391a2459 1911 print"<td align='center' height='20'><img src='$imgstatic/red.png' alt='$Lang::tr{'internet'}' title='$Lang::tr{'internet'}' /></td>";
0d6cc79d
SF
1912 last SWITCH;
1913 }
1914 else {
1915 print"<td align='center'><img align='middle' src='$imgstatic/white.png' alt='$Lang::tr{'wio_unknown_lan'}' title='$Lang::tr{'wio_unknown_lan'}' /></td>";
1916 last SWITCH;
1917 }
1918 }
1919}
1920
1921 print"<td align='center'>$line[2]</td>
1922 <td align='center'>".&WIO::color_devices($line[3])."</td>";
1923
1924 unless (&WIO::checkinto($line[1], '', @current)) {
1925 print"<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1926 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_add'}' />
1927 <input type='image' name='$Lang::tr{'wio_add'}' src='/images/add.gif' align='middle' alt='$Lang::tr{'wio_add'}' title='$Lang::tr{'wio_add'}' />
1928 <input type='hidden' name='ID' value='$idarp' /></form></td>";
1929 }
1930 else {
1931 print"<td align='center'><img src='$imgstatic/add.png' align='middle' alt='$Lang::tr{'wio_no_add'}' title='$Lang::tr{'wio_no_add'}' /></td>";
1932 }
1933
1934print"</tr>";
1935print"<tr height='1'><td colspan='17' bgcolor='#696565'></td></tr>";
1936$idarp++
1937}
1938
1939print"
1940</table>
1941";
a25c95b3 1942}
0d6cc79d
SF
1943
1944&hrline();
1945
1946print"
1947<table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1948<tr>
a25c95b3
SFD
1949 <td width='33%' bgcolor='$color{'color20'}' align='left' height='25'><b>&nbsp;$Lang::tr{'wio_import_file'}</b></td>
1950 <td width='67%' align='right'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='WIOGUISHOWCLIENTIMPORTTABLE' value='clientimport' /><input type='submit' name='ACTION' value='$clientimportbuttontext' /></form></td>
0d6cc79d 1951</tr>
0d6cc79d 1952</table>
a25c95b3
SFD
1953";
1954
1955if ( $wiosettings{'WIOGUISHOWCLIENTIMPORTTABLE'} eq 'on' ) {
1956
1957print"
0d6cc79d 1958<table width='100%' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
a25c95b3 1959<tr><td colspan='3'>&nbsp;</td></tr>
0d6cc79d
SF
1960<tr bgcolor='$color{'color22'}'>
1961 <form method='post' action='/cgi-bin/wio.cgi' enctype='multipart/form-data'>
391a2459 1962 <td width='33%' align='right'>$Lang::tr{'wio_import_csv'}&nbsp;</td>
0d6cc79d 1963 <td width='40%' align='center'><input type='file' name='CSVFILE' size='30' /></td>
391a2459 1964 <td width='27%' align='right'><input type='hidden' name='ACTION' value='$Lang::tr{'wio_import'}1' /><input type='submit' name='SUBMIT' value='$Lang::tr{'wio_import'}' /></td>
0d6cc79d
SF
1965 </form>
1966</tr>
1967<tr><td colspan='3'>&nbsp;</td></tr>
1968<tr bgcolor='$color{'color22'}'>
1969 <form method='post' action='/cgi-bin/wio.cgi' enctype='multipart/form-data'>
391a2459 1970 <td width='33%' align='right'>$Lang::tr{'wio_import_hosts'}&nbsp;</td>
0d6cc79d 1971 <td width='40%' align='center'>&nbsp;</td>
391a2459 1972 <td width='27%' align='right'><input type='hidden' name='ACTION' value='$Lang::tr{'wio_import'}2' /><input type='submit' name='SUBMIT' value='$Lang::tr{'wio_import'}' /></td>
0d6cc79d
SF
1973 </form>
1974</tr>
1975<tr><td colspan='3'>&nbsp;</td></tr>
1976<tr bgcolor='$color{'color22'}'>
1977 <form method='post' action='/cgi-bin/wio.cgi' enctype='multipart/form-data'>
391a2459 1978 <td width='33%' align='right'>$Lang::tr{'wio_import_fixleases'}&nbsp;</td>
0d6cc79d 1979 <td width='40%' align='center'>&nbsp;</td>
391a2459 1980 <td width='27%' align='right'><input type='hidden' name='ACTION' value='$Lang::tr{'wio_import'}3' /><input type='submit' name='SUBMIT' value='$Lang::tr{'wio_import'}' /></td>
0d6cc79d
SF
1981 </form>
1982</tr>
1983</table>
1984";
a25c95b3 1985}
0d6cc79d 1986
391a2459 1987&hrline();
0d6cc79d
SF
1988
1989print"
1990<table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1991<tr>
a25c95b3
SFD
1992 <td width='33%' bgcolor='$color{'color20'}' align='left' height='25'><b>&nbsp;$Lang::tr{'wio_net_scan'}</b></td>
1993 <td width='67%' align='right'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='WIOGUISHOWNETWORKSEARCHTABLE' value='networksearch' /><input type='submit' name='ACTION' value='$networksearchbuttontext' /></form></td>
0d6cc79d
SF
1994</tr>
1995</table>
a25c95b3
SFD
1996";
1997
1998if ( $wiosettings{'WIOGUISHOWNETWORKSEARCHTABLE'} eq 'on' ) {
1999
2000print"
0d6cc79d
SF
2001<table width='100%' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
2002<tr>
2003 <td colspan='3'>&nbsp;</td>
2004</tr>
2005";
2006
2007foreach (keys(%ifacecolor)) {
2008 if ( $_ eq 'GREEN' ) { $color = "$Header::colourgreen"; $net = $Lang::tr{'wio_net_scan_green'}; }
2009 elsif ( $_ eq 'BLUE' ) { $color = "$Header::colourblue"; $net = $Lang::tr{'wio_net_scan_blue'}; }
391a2459 2010 elsif ( $_ eq 'RED' ) { $color = "$Header::colourred"; $net = $Lang::tr{'wio_net_scan_red'}; }
0d6cc79d
SF
2011 else { $color = "$Header::colourorange"; $net = $Lang::tr{'wio_net_scan_orange'}; }
2012
2013 if ( $netsettings{"${_}_DEV"} eq 'disabled' || $netsettings{"${_}_DEV"} eq '' || $netsettings{"${_}_ADDRESS"} eq '' ) { next; }
2014 else {
2015 print <<END;
2016
2017 <tr bgcolor='$color{'color22'}'>
391a2459 2018 <td width='33%' align='right'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>$Lang::tr{'wio_net_scan_l'} <font color='$color'><b>$net&nbsp;</b></font>$Lang::tr{'wio_net_scan_r'}</td>
0d6cc79d 2019 <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>
391a2459 2020 <td width='27%' 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>
0d6cc79d
SF
2021 </tr>
2022 <tr>
2023 <td colspan='3'>&nbsp;</td>
2024 </tr>
2025END
2026 }
2027}
2028
2029print"
2030</tr>
2031</table>
2032</form>
2033";
a25c95b3 2034}
0d6cc79d
SF
2035&Header::closebox();
2036}
2037
2038if ( $wiosettings{'ENABLE'} eq 'on' && !$errormessage && $wiosettings{'ACTION'} ne $Lang::tr{'edit'} || $message == 2 ) {
2039
2040&Header::openbox('100%', 'left', $Lang::tr{'wio_service'});
2041
2042print"
2043<table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
2044<tr bgcolor='$color{'color22'}'>
f539ff6d 2045 <td colspan='2' align='right'></td>
fe6f676b
SF
2046";
2047
2048if ( $wiosettings{'LOGGING'} eq 'on' ) {
2049 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>";
2050}
2051
2052print"
f539ff6d 2053 <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>
0d6cc79d
SF
2054</tr>
2055</table>
2056";
2057}
2058
2059&Header::closebox();
2060}
2061
2062&Header::closebigbox();
2063&Header::closepage();
2064
2065############################################################################################################################
2066
2067sub SortDataFile {
2068my ($data,@checkfile) = @_;
2069 my $idsort = 0;
2070 our %entries = ();
2071
2072 sub sortips {
2073 my $qs = '';
2074
2075 if (rindex ($wiosettings{'SORT'},'Rev') != -1) {
2076 $qs = substr ($wiosettings{'SORT'},0,length($wiosettings{'SORT'})-3);
2077
2078 if ($qs eq 'IPADR') {
2079 my @a = split (/\./,$entries{$a}->{$qs});
2080 my @b = split (/\./,$entries{$b}->{$qs});
2081 ($b[0]<=>$a[0]) ||
2082 ($b[1]<=>$a[1]) ||
2083 ($b[2]<=>$a[2]) ||
2084 ($b[3]<=>$a[3]);
2085 }
2086 else {
2087 $entries{$b}->{$qs} cmp $entries{$a}->{$qs};
2088 }
2089 }
2090 else {
2091 $qs = $wiosettings{'SORT'};
2092
2093 if ($qs eq 'IPADR') {
2094 my @a = split (/\./,$entries{$a}->{$qs});
2095 my @b = split (/\./,$entries{$b}->{$qs});
2096 ($a[0]<=>$b[0]) ||
2097 ($a[1]<=>$b[1]) ||
2098 ($a[2]<=>$b[2]) ||
2099 ($a[3]<=>$b[3]);
2100 }
2101 else {
2102 $entries{$a}->{$qs} cmp $entries{$b}->{$qs};
2103 }
2104 }
2105 }
2106
2107 if ($data eq 'arpcache') {
2108 foreach (@checkfile) {
2109 chomp;
2110 @temp = split (',', $_);
2111
2112 my @record = ('KEY',$idsort++,'MAC',$temp[0],'IPADR',$temp[1],'HOST',$temp[2],'REMARK',$temp[3],'IFACE',$temp[4]);
2113 my $record = ();
2114 %{$record} = @record;
2115 $entries{$record->{KEY}} = $record;
2116 }
2117
2118 open(FILE, "> $logdir/.arpcache");
2119
2120 foreach (sort sortips keys %entries) {
2121 print FILE "$entries{$_}->{MAC},$entries{$_}->{IPADR},$entries{$_}->{HOST},$entries{$_}->{REMARK},$entries{$_}->{IFACE},$entries{$_}->{HW}\n";
2122 }
2123
2124 close(FILE);
2125
2126 open (FILE, "$logdir/.arpcache");
2127 @arpcache = <FILE>;
2128 close (FILE);
2129 }
2130 else {
2131 foreach (@checkfile) {
2132 chomp;
2133 @temp = split (',', $_);
2134
2135 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]);
2136 my $record = ();
2137 %{$record} = @record;
2138 $entries{$record->{KEY}} = $record;
2139 }
2140
2141 open(FILE, "> $ipadrfile");
2142
2143 foreach (sort sortips keys %entries) {
2144 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";
2145 }
2146
2147 close(FILE);
2148
2149 &loadips();
2150 }
2151}
2152
2153############################################################################################################################
2154
2155sub hrline {
2156
2157print"<table width='100%'><tr><td colspan='2' height='35'><hr></td></tr></table>";
2158
2159}
2160
2161############################################################################################################################
0d6cc79d
SF
2162
2163sub loadips {
2164
2165&General::readhasharray($ipadrfile, \%ipshash);
2166
2167open(FILE, "< $ipadrfile");
2168@current = <FILE>;
2169close (FILE);
2170
2171}
2172
2173############################################################################################################################
2174
2175sub writeips {
2176
2177open(FILE, "> $ipadrfile");
2178if ( defined($write) ) { print FILE @write; }
2179else { print FILE @current; }
2180close(FILE);
2181
2182}
2183
2184############################################################################################################################
2185
c1fc92a9
SFD
2186sub SortByTunnelName {
2187
2188 if ($vpnconfighash{$a}[1] lt $vpnconfighash{$b}[1]) {
2189 return -1;
2190 }
2191 elsif ($vpnconfighash{$a}[1] gt $vpnconfighash{$b}[1]) {
2192 return 1;
2193 }
2194 else {
2195 return 0;
2196 }
2197
0d6cc79d
SF
2198}
2199
2200############################################################################################################################
2201
c1fc92a9
SFD
2202sub validSave {
2203
0d6cc79d
SF
2204 if ( $wiosettings{'IPADR'} eq '' && $wiosettings{'PINGMETHODE'} eq 'ip' && $wiosettings{'DYNDNS'} eq '' ) {
2205 $errormessage = $Lang::tr{'wio_ip_empty'};
2206 }
2207
2208 if ( $wiosettings{'IPADR'} ne '' && (! &General::validip($wiosettings{'IPADR'})) ) {
2209 $errormessage = $Lang::tr{'wio_ip_error'};
2210 }
2211
2212 if ( $wiosettings{'HOST'} eq '' && $wiosettings{'PINGMETHODE'} eq 'fqdn' ) {
2213 $errormessage = $Lang::tr{'wio_host_empty'};
2214 }
2215
2216 if ( $wiosettings{'HOST'} ne '' && (! &General::validdomainname($wiosettings{'HOST'})) ) {
2217 $errormessage = $Lang::tr{'wio_host_error'};
2218 }
2219
2220 if ( $wiosettings{'DYNDNS'} eq 'on' && (! defined($errormessage)) ) {
2221 unless(&General::validfqdn($wiosettings{'HOST'})) { $errormessage = $Lang::tr{'wio_fqdn_error'}; }
2222 ( $wiosettings{'IPADR'}, $infomessage ) = &WIO::getdyndnsip($wiosettings{'IPADR'}, $wiosettings{'HOST'});
2223 $wiosettings{'PINGMETHODE'} = 'fqdn';
2224 }
2225
2226 if ( $wiosettings{'ID'} eq '' && ! defined($errormessage) ) { $errormessage = &WIO::checkinto($wiosettings{'IPADR'}, $wiosettings{'HOST'}, @current); }
2227
2228 if ( $wiosettings{'REMARK'} ne '' ) { $wiosettings{'REMARK'} =~ s/,/&#44;/g; }
c1fc92a9 2229
0d6cc79d 2230}