]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - html/cgi-bin/updatexlrator.cgi
Fix typo at updatexlrator.cgi
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / updatexlrator.cgi
1 #!/usr/bin/perl
2 ###############################################################################
3 # #
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007 Michael Tremer & Christian Schmidt #
6 # #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
11 # #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
16 # #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
19 # #
20 ###############################################################################
21
22 use strict;
23
24 # enable only the following on debugging purpose
25 #use warnings;
26 #use CGI::Carp 'fatalsToBrowser';
27
28 use IO::Socket;
29
30 require '/var/ipfire/general-functions.pl';
31 require "${General::swroot}/lang.pl";
32 require "${General::swroot}/header.pl";
33
34 my %color = ();
35 my %checked=();
36 my %selected=();
37 my %netsettings=();
38 my %mainsettings=();
39 my %proxysettings=();
40 my %xlratorsettings=();
41 my $id=0;
42 my @dfdata=();
43 my $dfstr='';
44 my @updatelist=();
45 my @sources=();
46 my $sourceurl='';
47 my $vendorid='';
48 my $uuid='';
49 my $status=0;
50 my $updatefile='';
51 my $shortname='';
52 my $time='';
53 my $filesize=0;
54 my $filedate='';
55 my $lastaccess='';
56 my $lastcheck='';
57 my $cachedtraffic=0;
58 my @requests=();
59 my $data='';
60 my $counts=0;
61 my $numfiles=0;
62 my $cachehits=0;
63 my $efficiency='0.0';
64 my @vendors=();
65 my %vendorstats=();
66
67 my $repository = "/var/updatecache/";
68 my $hintcolour = '#FFFFCC';
69 my $colourgray = '#808080';
70
71 my $sfUnknown='0';
72 my $sfOk='1';
73 my $sfOutdated='2';
74 my $sfNoSource='3';
75
76 my $not_accessed_last='';
77
78 my $errormessage='';
79
80 my @repositorylist=();
81 my @repositoryfiles=();
82
83 my @metadata=();
84
85 my $chk_cron_dly = "${General::swroot}/updatexlrator/autocheck/cron.daily";
86 my $chk_cron_wly = "${General::swroot}/updatexlrator/autocheck/cron.weekly";
87 my $chk_cron_mly = "${General::swroot}/updatexlrator/autocheck/cron.monthly";
88
89 &General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
90 &General::readhash("${General::swroot}/main/settings", \%mainsettings);
91 &General::readhash("${General::swroot}/proxy/settings", \%proxysettings);
92 &General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
93
94 $xlratorsettings{'ACTION'} = '';
95 $xlratorsettings{'ENABLE_LOG'} = 'off';
96 $xlratorsettings{'PASSIVE_MODE'} = 'off';
97 $xlratorsettings{'MAX_DISK_USAGE'} = '75';
98 $xlratorsettings{'LOW_DOWNLOAD_PRIORITY'} = 'off';
99 $xlratorsettings{'MAX_DOWNLOAD_RATE'} = '';
100 $xlratorsettings{'ENABLE_AUTOCHECK'} = 'off';
101 $xlratorsettings{'FULL_AUTOSYNC'} = 'off';
102 $xlratorsettings{'NOT_ACCESSED_LAST'} = 'month1';
103
104 &Header::getcgihash(\%xlratorsettings);
105
106 $xlratorsettings{'EXTENDED_GUI'} = '';
107
108 if ($xlratorsettings{'ACTION'} eq "$Lang::tr{'updxlrtr statistics'} >>")
109 {
110 $xlratorsettings{'EXTENDED_GUI'} = 'statistics';
111 }
112
113 if ($xlratorsettings{'ACTION'} eq "$Lang::tr{'updxlrtr maintenance'} >>")
114 {
115 $xlratorsettings{'EXTENDED_GUI'} = 'maintenance';
116 }
117
118 if ($xlratorsettings{'ACTION'} eq $Lang::tr{'updxlrtr purge'})
119 {
120 $xlratorsettings{'EXTENDED_GUI'} = 'maintenance';
121
122 if (($xlratorsettings{'REMOVE_OBSOLETE'} eq 'on') || ($xlratorsettings{'REMOVE_NOSOURCE'} eq 'on') || ($xlratorsettings{'REMOVE_OUTDATED'} eq 'on'))
123 {
124 undef (@sources);
125 undef @repositoryfiles;
126 foreach (<$repository/*>)
127 {
128 if (-d $_)
129 {
130 unless (/^$repository\/download$/) { push(@sources,$_); }
131 }
132 }
133
134 foreach (@sources)
135 {
136 @updatelist=<$_/*>;
137 $vendorid = substr($_,rindex($_,"/")+1);
138 foreach(@updatelist)
139 {
140 $uuid = substr($_,rindex($_,"/")+1);
141 if (-e "$_/source.url")
142 {
143 open (FILE,"$_/source.url");
144 $sourceurl=<FILE>;
145 close FILE;
146 chomp($sourceurl);
147 $updatefile = substr($sourceurl,rindex($sourceurl,'/')+1,length($sourceurl));
148 $updatefile = "$vendorid/$uuid/$updatefile";
149 push(@repositoryfiles,$updatefile);
150 }
151 }
152 }
153
154 foreach (@repositoryfiles)
155 {
156 ($vendorid,$uuid,$updatefile) = split('/');
157
158 if (-e "$repository/$vendorid/$uuid/status")
159 {
160 open (FILE,"$repository/$vendorid/$uuid/status");
161 @metadata = <FILE>;
162 close FILE;
163 chomp(@metadata);
164 $status = $metadata[-1];
165 }
166
167 if (-e "$repository/$vendorid/$uuid/access.log")
168 {
169 open (FILE,"$repository/$vendorid/$uuid/access.log");
170 @metadata = <FILE>;
171 close FILE;
172 chomp(@metadata);
173 $lastaccess = $metadata[-1];
174 }
175
176 if (($xlratorsettings{'REMOVE_NOSOURCE'} eq 'on') && ($status == $sfNoSource))
177 {
178 if (-e "$repository/$vendorid/$uuid/$updatefile") { system("rm -r $repository/$vendorid/$uuid"); }
179 }
180 if (($xlratorsettings{'REMOVE_OUTDATED'} eq 'on') && ($status == $sfOutdated))
181 {
182 if (-e "$repository/$vendorid/$uuid/$updatefile") { system("rm -r $repository/$vendorid/$uuid"); }
183 }
184 if ($xlratorsettings{'REMOVE_OBSOLETE'} eq 'on')
185 {
186 if (($xlratorsettings{'NOT_ACCESSED_LAST'} eq 'week') && ($lastaccess < (time - 604800)))
187 {
188 if (-e "$repository/$vendorid/$uuid/$updatefile") { system("rm -r $repository/$vendorid/$uuid"); }
189 }
190 if (($xlratorsettings{'NOT_ACCESSED_LAST'} eq 'month1') && ($lastaccess < (time - 2505600)))
191 {
192 if (-e "$repository/$vendorid/$uuid/$updatefile") { system("rm -r $repository/$vendorid/$uuid"); }
193 }
194 if (($xlratorsettings{'NOT_ACCESSED_LAST'} eq 'month3') && ($lastaccess < (time - 7516800)))
195 {
196 if (-e "$repository/$vendorid/$uuid/$updatefile") { system("rm -r $repository/$vendorid/$uuid"); }
197 }
198 if (($xlratorsettings{'NOT_ACCESSED_LAST'} eq 'month6') && ($lastaccess < (time - 15033600)))
199 {
200 if (-e "$repository/$vendorid/$uuid/$updatefile") { system("rm -r $repository/$vendorid/$uuid"); }
201 }
202 if (($xlratorsettings{'NOT_ACCESSED_LAST'} eq 'year') && ($lastaccess < (time - 31536000)))
203 {
204 if (-e "$repository/$vendorid/$uuid/$updatefile") { system("rm -r $repository/$vendorid/$uuid"); }
205 }
206 }
207 }
208 }
209 }
210
211 if ($xlratorsettings{'ACTION'} eq $Lang::tr{'save'})
212 {
213 if (!($xlratorsettings{'MAX_DISK_USAGE'} =~ /^\d+$/) || ($xlratorsettings{'MAX_DISK_USAGE'} < 1) || ($xlratorsettings{'MAX_DISK_USAGE'} > 100))
214 {
215 $errormessage = $Lang::tr{'updxlrtr invalid disk usage'};
216 goto ERROR;
217 }
218 if (($xlratorsettings{'MAX_DOWNLOAD_RATE'} ne '') && ((!($xlratorsettings{'MAX_DOWNLOAD_RATE'} =~ /^\d+$/)) || ($xlratorsettings{'MAX_DOWNLOAD_RATE'} < 1)))
219 {
220 $errormessage = $Lang::tr{'updxlrtr invalid download rate'};
221 goto ERROR;
222 }
223
224 &savesettings;
225 }
226
227 if ($xlratorsettings{'ACTION'} eq $Lang::tr{'updxlrtr save and restart'})
228 {
229 if (!($xlratorsettings{'MAX_DISK_USAGE'} =~ /^\d+$/) || ($xlratorsettings{'MAX_DISK_USAGE'} < 1) || ($xlratorsettings{'MAX_DISK_USAGE'} > 100))
230 {
231 $errormessage = $Lang::tr{'updxlrtr invalid disk usage'};
232 goto ERROR;
233 }
234 if (($xlratorsettings{'MAX_DOWNLOAD_RATE'} ne '') && ((!($xlratorsettings{'MAX_DOWNLOAD_RATE'} =~ /^\d+$/)) || ($xlratorsettings{'MAX_DOWNLOAD_RATE'} < 1)))
235 {
236 $errormessage = $Lang::tr{'updxlrtr invalid download rate'};
237 goto ERROR;
238 }
239 if ((!(-e "${General::swroot}/proxy/enable")) && (!(-e "${General::swroot}/proxy/enable_blue")))
240 {
241 $errormessage = $Lang::tr{'updxlrtr web proxy service required'};
242 goto ERROR;
243 }
244 if (!($proxysettings{'ENABLE_UPDXLRATOR'} eq 'on'))
245 {
246 $errormessage = $Lang::tr{'updxlrtr not enabled'};
247 goto ERROR;
248 }
249
250 &savesettings;
251
252 system('/usr/local/bin/squidctrl restart >/dev/null 2>&1');
253 }
254
255 if ($xlratorsettings{'ACTION'} eq $Lang::tr{'updxlrtr remove file'})
256 {
257 $xlratorsettings{'EXTENDED_GUI'} = 'maintenance';
258
259 $updatefile = $xlratorsettings{'ID'};
260
261 if ($updatefile =~ /^download\//)
262 {
263 ($uuid,$vendorid,$updatefile) = split('/',$updatefile);
264 if (-e "$repository/download/$vendorid/$updatefile") { system("rm $repository/download/$vendorid/$updatefile"); }
265 } else {
266 ($vendorid,$uuid,$updatefile) = split('/',$updatefile);
267 if (-e "$repository/$vendorid/$uuid/$updatefile") { system("rm -r $repository/$vendorid/$uuid"); }
268 }
269 }
270
271 $not_accessed_last = $xlratorsettings{'NOT_ACCESSED_LAST'};
272 undef($xlratorsettings{'NOT_ACCESSED_LAST'});
273
274 if (-e "${General::swroot}/updatexlrator/settings") { &General::readhash("${General::swroot}/updatexlrator/settings", \%xlratorsettings); }
275
276 if ($xlratorsettings{'NOT_ACCESSED_LAST'} eq '') { $xlratorsettings{'NOT_ACCESSED_LAST'} = $not_accessed_last; } ;
277
278 ERROR:
279
280 $checked{'ENABLE_LOG'}{'off'} = '';
281 $checked{'ENABLE_LOG'}{'on'} = '';
282 $checked{'ENABLE_LOG'}{$xlratorsettings{'ENABLE_LOG'}} = "checked='checked'";
283 $checked{'PASSIVE_MODE'}{'off'} = '';
284 $checked{'PASSIVE_MODE'}{'on'} = '';
285 $checked{'PASSIVE_MODE'}{$xlratorsettings{'PASSIVE_MODE'}} = "checked='checked'";
286 $checked{'LOW_DOWNLOAD_PRIORITY'}{'off'} = '';
287 $checked{'LOW_DOWNLOAD_PRIORITY'}{'on'} = '';
288 $checked{'LOW_DOWNLOAD_PRIORITY'}{$xlratorsettings{'LOW_DOWNLOAD_PRIORITY'}} = "checked='checked'";
289 $checked{'ENABLE_AUTOCHECK'}{'off'} = '';
290 $checked{'ENABLE_AUTOCHECK'}{'on'} = '';
291 $checked{'ENABLE_AUTOCHECK'}{$xlratorsettings{'ENABLE_AUTOCHECK'}} = "checked='checked'";
292 $checked{'FULL_AUTOSYNC'}{'off'} = '';
293 $checked{'FULL_AUTOSYNC'}{'on'} = '';
294 $checked{'FULL_AUTOSYNC'}{$xlratorsettings{'FULL_AUTOSYNC'}} = "checked='checked'";
295
296 $selected{'AUTOCHECK_SCHEDULE'}{$xlratorsettings{'AUTOCHECK_SCHEDULE'}} = "selected='selected'";
297 $selected{'NOT_ACCESSED_LAST'}{$xlratorsettings{'NOT_ACCESSED_LAST'}} = "selected='selected'";
298
299 # ----------------------------------------------------
300 # Settings dialog
301 # ----------------------------------------------------
302
303 &Header::showhttpheaders();
304
305 &Header::openpage($Lang::tr{'updxlrtr configuration'}, 1, '');
306
307 &Header::openbigbox('100%', 'left', '', $errormessage);
308
309 if ($errormessage) {
310 &Header::openbox('100%', 'left', $Lang::tr{'error messages'});
311 print "<font class='base'>$errormessage&nbsp;</font>\n";
312 &Header::closebox();
313 }
314
315 print "<form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>\n";
316
317 &Header::openbox('100%', 'left', "$Lang::tr{'updxlrtr update accelerator'}");
318
319 print <<END
320 <table width='100%'>
321 <tr>
322 <td colspan='4'><b>$Lang::tr{'updxlrtr common settings'}</b></td>
323 </tr>
324 <tr>
325 <td class='base' width='25%'>$Lang::tr{'updxlrtr enable log'}:</td>
326 <td class='base' width='20%'><input type='checkbox' name='ENABLE_LOG' $checked{'ENABLE_LOG'}{'on'} /></td>
327 <td class='base' width='25%'></td>
328 <td class='base' width='30%'></td>
329 </tr>
330 <tr>
331 <td class='base'>$Lang::tr{'updxlrtr passive mode'}:</td>
332 <td class='base'><input type='checkbox' name='PASSIVE_MODE' $checked{'PASSIVE_MODE'}{'on'} /></td>
333 <td class='base'>$Lang::tr{'updxlrtr max disk usage'}:</td>
334 <td class='base'><input type='text' name='MAX_DISK_USAGE' value='$xlratorsettings{'MAX_DISK_USAGE'}' size='1' /> %</td>
335 </tr>
336 </table>
337 <hr size='1'>
338 <table width='100%'>
339 <tr>
340 <td colspan='4'><b>$Lang::tr{'updxlrtr performance options'}</b></td>
341 </tr>
342 <tr>
343 <td class='base' width='25%'>$Lang::tr{'updxlrtr low download priority'}:</td>
344 <td class='base' width='20%'><input type='checkbox' name='LOW_DOWNLOAD_PRIORITY' $checked{'LOW_DOWNLOAD_PRIORITY'}{'on'} /></td>
345 <td class='base' width='25%'>$Lang::tr{'updxlrtr max download rate'}:&nbsp;<img src='/blob.gif' alt='*' </td>
346 <td class='base' width='30%'><input type='text' name='MAX_DOWNLOAD_RATE' value='$xlratorsettings{'MAX_DOWNLOAD_RATE'}' size='5' /></td>
347 </tr>
348 </table>
349 <hr size='1'>
350 <table width='100%'>
351 <tr>
352 <td colspan='4'><b>$Lang::tr{'updxlrtr source checkup'}</b></td>
353 </tr>
354 <tr>
355 <td class='base' width='25%'>$Lang::tr{'updxlrtr enable autocheck'}:</td>
356 <td class='base' width='20%'><input type='checkbox' name='ENABLE_AUTOCHECK' $checked{'ENABLE_AUTOCHECK'}{'on'} /></td>
357 <td class='base' width='25%'>$Lang::tr{'updxlrtr source checkup schedule'}:</td>
358 <td class='base' width='30%'>
359 <select name='AUTOCHECK_SCHEDULE'>
360 <option value='daily' $selected{'AUTOCHECK_SCHEDULE'}{'daily'}>$Lang::tr{'updxlrtr daily'}</option>
361 <option value='weekly' $selected{'AUTOCHECK_SCHEDULE'}{'weekly'}>$Lang::tr{'updxlrtr weekly'}</option>
362 <option value='monthly' $selected{'AUTOCHECK_SCHEDULE'}{'monthly'}>$Lang::tr{'updxlrtr monthly'}</option>
363 </select>
364 </td>
365 </tr>
366 <tr>
367 <td class='base'>$Lang::tr{'updxlrtr full autosync'}:</td>
368 <td class='base'><input type='checkbox' name='FULL_AUTOSYNC' $checked{'FULL_AUTOSYNC'}{'on'} /></td>
369 <td>&nbsp;</td>
370 <td>&nbsp;</td>
371 </tr>
372 </table>
373 <hr size='1'>
374 <table width='100%'>
375 <tr>
376 <td align='center' width='20%'><input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></td>
377 <td align='center' width='20%'><input type='submit' name='ACTION' value='$Lang::tr{'updxlrtr save and restart'}' /></td>
378 <td>&nbsp;</td>
379 END
380 ;
381
382 print" <td align='center' width='20%'><input type='submit' name='ACTION' value='$Lang::tr{'updxlrtr statistics'}";
383 if ($xlratorsettings{'EXTENDED_GUI'} eq 'statistics') { print " <<' "; } else { print " >>' "; }
384 print "/></td>\n";
385
386 print" <td align='center' width='20%'><input type='submit' name='ACTION' value='$Lang::tr{'updxlrtr maintenance'}";
387 if ($xlratorsettings{'EXTENDED_GUI'} eq 'maintenance') { print " <<' "; } else { print " >>' "; }
388 print "/></td>\n";
389
390 print <<END
391 </tr>
392 </table>
393 END
394 ;
395
396 &Header::closebox();
397
398 print "</form>\n";
399
400 # =====================================================================================
401 # CACHE STATISTICS
402 # =====================================================================================
403
404 if ($xlratorsettings{'EXTENDED_GUI'} eq 'statistics')
405 {
406
407 # ----------------------------------------------------
408 # Get statistics
409 # ----------------------------------------------------
410
411 @sources=();
412 foreach (<$repository/*>)
413 {
414 if (-d $_)
415 {
416 unless ((/^$repository\/download$/) || (/^$repository\/lost\+found$/)) { push(@sources,$_); }
417 }
418 }
419
420 @vendors=();
421 foreach (@sources)
422 {
423 $vendorid=substr($_,rindex($_,'/')+1,length($_));
424 push(@vendors,$vendorid);
425 @updatelist=<$_/*>;
426 foreach $data (@updatelist)
427 {
428 if (-e "$data/source.url")
429 {
430 open (FILE,"$data/source.url");
431 $sourceurl=<FILE>;
432 close FILE;
433 chomp($sourceurl);
434 $updatefile = substr($sourceurl,rindex($sourceurl,'/')+1,length($sourceurl));
435 #
436 # Total file size
437 #
438 $filesize += (-s "$data/$updatefile");
439 #
440 # File size for this source
441 #
442 $vendorstats{$vendorid."_filesize"} += (-s "$data/$updatefile");
443 #
444 # Number of requests from cache for this source
445 #
446 open (FILE,"$data/access.log");
447 @requests=<FILE>;
448 close FILE;
449 chomp(@requests);
450 $counts = @requests;
451 $counts--;
452 $vendorstats{$vendorid."_requests"} += $counts;
453 $cachehits += $counts;
454 #
455 # Total number of files in cache
456 #
457 $numfiles++;
458 #
459 # Number of files for this source
460 #
461 $vendorstats{$vendorid."_files"}++;
462 #
463 # Count cache status occurences
464 #
465 open (FILE,"$data/status");
466 $_=<FILE>;
467 close FILE;
468 chomp;
469 $vendorstats{$vendorid."_".$_}++;
470 #
471 # Calculate cached traffic for this source
472 #
473 $vendorstats{$vendorid."_cachehits"} += $counts * (-s "$data/$updatefile");
474 #
475 # Calculate total cached traffic
476 #
477 $cachedtraffic += $counts * (-s "$data/$updatefile");
478
479 }
480 }
481 }
482
483 if ($numfiles) { $efficiency = sprintf("%.1f", $cachehits / $numfiles); }
484
485 1 while $filesize =~ s/^(-?\d+)(\d{3})/$1.$2/;
486 1 while $cachedtraffic =~ s/^(-?\d+)(\d{3})/$1.$2/;
487
488 # ----------------------------------------------------
489 # Show statistics
490 # ----------------------------------------------------
491
492 &Header::openbox('100%', 'left', "$Lang::tr{'updxlrtr cache statistics'}");
493
494 unless ($numfiles) { print "<i>$Lang::tr{'updxlrtr empty repository'}</i>\n<hr size='1'>\n"; }
495
496 print <<END
497 <table>
498 <tr><td class='boldbase'><b>$Lang::tr{'updxlrtr disk usage'}</b></td></tr>
499 </table>
500 <table cellpadding='3'>
501 <tr>
502 <td align='left' class='base'><i>$Lang::tr{'updxlrtr cache dir'}</i></td>
503 <td align='center' class='base'><i>$Lang::tr{'size'}</i></td>
504 <td align='center' class='base'><i>$Lang::tr{'used'}</i></td>
505 <td align='center' class='base'><i>$Lang::tr{'free'}</i></td>
506 <td align='left' class='base' colspan='2'><i>$Lang::tr{'percentage'}</i></td>
507 </tr>
508 END
509 ;
510
511 open(DF,"/bin/df -h $repository|");
512 @dfdata = <DF>;
513 close DF;
514 shift(@dfdata);
515 chomp(@dfdata);
516 $dfstr = join(' ',@dfdata);
517 my ($device,$size,$used,$free,$percent,$mount) = split(' ',$dfstr);
518
519 print <<END
520 <tr>
521 <td>[$repository]</td>
522 <td align='right'>$size</td>
523 <td align='right'>$used</td>
524 <td align='right'>$free</td>
525 <td>
526 END
527 ;
528 &percentbar($percent);
529 print <<END
530 </td>
531 <td align='right'>$percent</td>
532 </tr>
533 </table>
534 END
535 ;
536
537 if ($numfiles)
538 {
539 print <<END
540 <hr size='1'>
541 <table width='100%'>
542 <tr>
543 <td colspan='5'><b>$Lang::tr{'updxlrtr summary'}</b></td>
544 </tr>
545 <tr>
546 <td class='base' width='25%'>$Lang::tr{'updxlrtr total files'}:</td>
547 <td class='base' width='20%'><font color='$colourgray'>$numfiles</font></td>
548 <td class='base' width='25%'>$Lang::tr{'updxlrtr total cache size'}:</td>
549 <td class='base' width='15%' align='right'><font color='$colourgray'>$filesize</font></td>
550 <td class='base'></td>
551 </tr>
552 <tr>
553 <td class='base'>$Lang::tr{'updxlrtr efficiency index'}:</td>
554 <td class='base'><font color='$colourgray'>$efficiency</font></td>
555 <td class='base'>$Lang::tr{'updxlrtr total data from cache'}:</td>
556 <td class='base' align='right'><font color='$colourgray'>$cachedtraffic</font></td>
557 <td class='base'></td>
558 </tr>
559 </table>
560 <hr size='1'>
561 <table>
562 <tr>
563 <td colspan='17'><b>$Lang::tr{'updxlrtr statistics by source'}</b></td>
564 </tr>
565 <tr>
566 <td class='base' colspan='2'><i>$Lang::tr{'updxlrtr source'}</i></td>
567 <td class='base' width='7%'>&nbsp;</td>
568 <td class='base' align='right'><i>$Lang::tr{'updxlrtr files'}</i></td>
569 <td class='base' width='7%'>&nbsp;</td>
570 <td class='base' align='right'><nobr><i>$Lang::tr{'updxlrtr cache size'}</i></nobr></td>
571 <td class='base' width='7%'>&nbsp;</td>
572 <td class='base' align='right'><nobr><i>$Lang::tr{'updxlrtr data from cache'}</i></nobr></td>
573 <td class='base' width='15%'>&nbsp;</td>
574 <td class='base'><img src="/images/updbooster/updxl-led-green.gif" /></td>
575 <td class='base' width='15%'>&nbsp;</td>
576 <td class='base'><img src="/images/updbooster/updxl-led-yellow.gif" /></td>
577 <td class='base' width='15%'>&nbsp;</td>
578 <td class='base'><img src="/images/updbooster/updxl-led-red.gif" /></td>
579 <td class='base' width='15%'>&nbsp;</td>
580 <td class='base'><img src="/images/updbooster/updxl-led-gray.gif" /></td>
581 <td class='base' width='90%'>&nbsp;</td>
582 </tr>
583 END
584 ;
585
586 $id = 0;
587
588 foreach (@vendors)
589 {
590 $vendorid = $_;
591
592 unless ($vendorstats{$vendorid . "_files"}) { next; }
593
594 $id++;
595 if ($id % 2) {
596 print "<tr bgcolor=''$color{'color20'}'>\n"; }
597 else {
598 print "<tr bgcolor=''$color{'color22'}'>\n"; }
599
600 print "<td class='base' align='center'><nobr>&nbsp;";
601
602 if ($vendorid =~ /^Adobe$/i)
603 {
604 print "<img src='/images/updbooster/updxl-src-adobe.gif' alt='Adobe'}' />&nbsp;</nobr></td>\n";
605 print "<td class='base'>&nbsp;Adobe&nbsp;</td>\n";
606 } elsif ($vendorid =~ /^Microsoft$/i)
607 {
608 print "<img src='/images/updbooster/updxl-src-windows.gif' alt='Microsoft'}' />&nbsp;</nobr></td>\n";
609 print "<td class='base'>&nbsp;Microsoft&nbsp;</td>\n";
610 } elsif ($vendorid =~ /^Symantec$/i)
611 {
612 print "<img src='/images/updbooster/updxl-src-symantec.gif' alt='Symantec'}' />&nbsp;</nobr></td>\n";
613 print "<td class='base'>&nbsp;Symantec&nbsp;</td>\n";
614 } elsif ($vendorid =~ /^Linux$/i)
615 {
616 print "<img src='/images/updbooster/updxl-src-linux.gif' alt='Linux'}' />&nbsp;</nobr></td>\n";
617 print "<td class='base'>&nbsp;Linux&nbsp;</td>\n";
618 } elsif ($vendorid =~ /^TrendMicro$/i)
619 {
620 print "<img src='/images/updbooster/updxl-src-trendmicro.gif' alt='Trend Micro'}' />&nbsp;</nobr></td>\n";
621 print "<td class='base'>&nbsp;Trend&nbsp;Micro&nbsp;</td>\n";
622 } elsif ($vendorid =~ /^Apple$/i)
623 {
624 print "<img src='/images/updbooster/updxl-src-apple.gif' alt='Apple'}' />&nbsp;</nobr></td>\n";
625 print "<td class='base'>&nbsp;Apple&nbsp;</td>\n";
626 } elsif ($vendorid =~ /^Avast$/i)
627 {
628 print "<img src='/images/updbooster/updxl-src-avast.gif' alt='Avast'}' />&nbsp;</nobr></td>\n";
629 print "<td class='base'>&nbsp;Avast&nbsp;</td>\n";
630 } elsif ($vendorid =~ /^Avira$/i)
631 {
632 print "<img src='/images/updbooster/updxl-src-avira.gif' alt='Avira' />&nbsp;</td>\n";
633 print "<td class='base'>&nbsp;Avira&nbsp;</td>\n";
634 } elsif ($vendorid =~ /^AVG$/i)
635 {
636 print "<img src='/images/updbooster/updxl-src-avg.gif' alt='AVG' />&nbsp;</td>\n";
637 print "<td class='base'>&nbsp;AVG&nbsp;</td>\n";
638 } elsif ($vendorid =~ /^Ipfire$/i)
639 {
640 print "<img src='/images/IPFire.png' width='18' height='18' alt='IPFire' />&nbsp;</td>\n";
641 print "<td class='base'>&nbsp;IPFire&nbsp;</td>\n";
642 } else
643 {
644 if (-e "/srv/web/ipfire/html/images/updbooster/updxl-src-" . $vendorid . ".gif")
645 {
646 print "<img src='/images/updbooster/updxl-src-" . $vendorid . ".gif' alt='" . ucfirst $vendorid . "' />&nbsp;</nobr></td>\n";
647 } else {
648 print "<img src='/images/updbooster/updxl-src-unknown.gif' alt='" . ucfirst $vendorid . "' />&nbsp;</nobr></td>\n";
649 }
650 print "<td class='base'>&nbsp;" . ucfirst $vendorid . "&nbsp;</td>\n";
651 }
652
653 print "<td class='base' colspan=2 align='right'>";
654 printf "%5d", $vendorstats{$vendorid."_files"};
655 print "&nbsp;</td>\n";
656
657 unless ($vendorstats{$vendorid."_filesize"}) { $vendorstats{$vendorid."_filesize"} = '0'; }
658 1 while $vendorstats{$vendorid."_filesize"} =~ s/^(-?\d+)(\d{3})/$1.$2/;
659 print "<td class='base' colspan=2 align='right'>";
660 printf "%15s", $vendorstats{$vendorid."_filesize"};
661 print "&nbsp;</td>\n";
662
663 unless ($vendorstats{$vendorid."_cachehits"}) { $vendorstats{$vendorid."_cachehits"} = '0'; }
664 1 while $vendorstats{$vendorid."_cachehits"} =~ s/^(-?\d+)(\d{3})/$1.$2/;
665 print "<td class='base' colspan=2 align='right'>";
666 printf "%15s", $vendorstats{$vendorid."_cachehits"};
667 print "&nbsp;</td>\n";
668
669 print "<td class='base' colspan=2 align='right'>";
670 printf "%5d", $vendorstats{$vendorid."_1"};
671 print "&nbsp;&nbsp;</td>\n";
672
673 print "<td class='base' colspan=2 align='right'>";
674 printf "%5d", $vendorstats{$vendorid."_3"};
675 print "&nbsp;&nbsp;</td>\n";
676
677 print "<td class='base' colspan=2 align='right'>";
678 printf "%5d", $vendorstats{$vendorid."_2"};
679 print "&nbsp;&nbsp;</td>\n";
680
681 print "<td class='base' colspan=2 align='right'>";
682 printf "%5d", $vendorstats{$vendorid."_0"};
683 print "&nbsp;&nbsp;</td>\n";
684
685 print "<td class='base'>&nbsp;</td>\n";
686 print "</tr>\n";
687 }
688
689 print "</table>\n";
690
691 print <<END
692 <br>
693 <table>
694 <tr>
695 <td class='boldbase'>&nbsp; <b>$Lang::tr{'legend'}:</b></td>
696 <td class='base'>&nbsp;</td>
697 <td align='center'><img src='/images/updbooster/updxl-led-green.gif' alt='$Lang::tr{'updxlrtr condition ok'}' /></td>
698 <td class='base'>$Lang::tr{'updxlrtr condition ok'}</td>
699 <td class='base'>&nbsp;&nbsp;&nbsp;</td>
700 <td align='center'><img src='/images/updbooster/updxl-led-yellow.gif' alt='$Lang::tr{'updxlrtr condition nosource'}' /></td>
701 <td class='base'>$Lang::tr{'updxlrtr condition nosource'}</td>
702 <td class='base'>&nbsp;&nbsp;&nbsp;</td>
703 <td align='center'><img src='/images/updbooster/updxl-led-red.gif' alt='$Lang::tr{'updxlrtr condition outdated'}' /></td>
704 <td class='base'>$Lang::tr{'updxlrtr condition outdated'}</td>
705 <td class='base'>&nbsp;&nbsp;&nbsp;</td>
706 <td align='center'><img src='/images/updbooster/updxl-led-gray.gif' alt='$Lang::tr{'updxlrtr condition unknown'}' /></td>
707 <td class='base'>$Lang::tr{'updxlrtr condition unknown'}</td>
708 <td class='base'>&nbsp;&nbsp;&nbsp;</td>
709 </tr>
710 </table>
711 END
712 ;
713
714 }
715
716 &Header::closebox();
717
718 }
719
720 # =====================================================================================
721 # CACHE MAINTENANCE
722 # =====================================================================================
723
724 if ($xlratorsettings{'EXTENDED_GUI'} eq 'maintenance')
725 {
726
727
728 # ----------------------------------------------------
729 # File list dialog
730 # ----------------------------------------------------
731
732 &Header::openbox('100%', 'left', "$Lang::tr{'updxlrtr cache maintenance'}");
733
734 @sources= <$repository/download/*>;
735
736 undef @repositoryfiles;
737 foreach (@sources)
738 {
739 if (-d)
740 {
741 @updatelist = <$_/*>;
742 $vendorid = substr($_,rindex($_,"/")+1);
743 foreach(@updatelist)
744 {
745 $updatefile = substr($_,rindex($_,"/")+1);
746 $updatefile .= ":download/$vendorid/$updatefile";
747 $updatefile = " ".$updatefile;
748 push(@repositoryfiles,$updatefile);
749 }
750 }
751 }
752
753 undef (@sources);
754 foreach (<$repository/*>)
755 {
756 if (-d $_)
757 {
758 unless (/^$repository\/download$/) { push(@sources,$_); }
759 }
760 }
761
762 foreach (@sources)
763 {
764 @updatelist=<$_/*>;
765 $vendorid = substr($_,rindex($_,"/")+1);
766 foreach(@updatelist)
767 {
768 $uuid = substr($_,rindex($_,"/")+1);
769 if (-e "$_/source.url")
770 {
771 open (FILE,"$_/source.url");
772 $sourceurl=<FILE>;
773 close FILE;
774 chomp($sourceurl);
775 $updatefile = substr($sourceurl,rindex($sourceurl,'/')+1,length($sourceurl));
776 $_ = $updatefile; tr/[A-Z]/[a-z]/;
777 $updatefile = "$_:$vendorid/$uuid/$updatefile";
778 push(@repositoryfiles,$updatefile);
779 }
780 }
781 }
782
783 @repositoryfiles = sort(@repositoryfiles);
784
785 unless (@repositoryfiles) { print "<i>$Lang::tr{'updxlrtr empty repository'}</i>\n<hr size='1'>\n"; }
786
787 print <<END
788 <table>
789 <tr><td class='boldbase'><b>$Lang::tr{'updxlrtr disk usage'}</b></td></tr>
790 </table>
791 <table cellpadding='3'>
792 <tr>
793 <td align='left' class='base'><i>$Lang::tr{'updxlrtr cache dir'}</i></td>
794 <td align='center' class='base'><i>$Lang::tr{'size'}</i></td>
795 <td align='center' class='base'><i>$Lang::tr{'used'}</i></td>
796 <td align='center' class='base'><i>$Lang::tr{'free'}</i></td>
797 <td align='left' class='base' colspan='2'><i>$Lang::tr{'percentage'}</i></td>
798 </tr>
799 END
800 ;
801
802 open(DF,"/bin/df -h $repository|");
803 @dfdata = <DF>;
804 close DF;
805 shift(@dfdata);
806 chomp(@dfdata);
807 $dfstr = join(' ',@dfdata);
808 my ($device,$size,$used,$free,$percent,$mount) = split(' ',$dfstr);
809
810 print <<END
811 <tr>
812 <td>[$repository]</td>
813 <td align='right'>$size</td>
814 <td align='right'>$used</td>
815 <td align='right'>$free</td>
816 <td>
817 END
818 ;
819 &percentbar($percent);
820 print <<END
821 </td>
822 <td align='right'>$percent</td>
823 </tr>
824 </table>
825 END
826 ;
827
828 if (@repositoryfiles)
829 {
830 print <<END
831 <hr size='1'>
832 <form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
833 <table width='100%'>
834 <tr>
835 <td class='base' colspan='3'><input type='submit' name='ACTION' value='$Lang::tr{'updxlrtr purge'}' /> &nbsp;$Lang::tr{'updxlrtr all files'}</td>
836 <td class='base' width='25%'><input type='checkbox' name='REMOVE_OBSOLETE' $checked{'REMOVE_OBSOLETE'}{'on'} />&nbsp;$Lang::tr{'updxlrtr not accessed'}</td>
837 <td class='base' colspan='3'><select name='NOT_ACCESSED_LAST'>
838 <option value='week' $selected{'NOT_ACCESSED_LAST'}{'week'}>$Lang::tr{'updxlrtr week'}</option>
839 <option value='month1' $selected{'NOT_ACCESSED_LAST'}{'month1'}>$Lang::tr{'updxlrtr month'}</option>
840 <option value='month3' $selected{'NOT_ACCESSED_LAST'}{'month3'}>$Lang::tr{'updxlrtr 3 months'}</option>
841 <option value='month6' $selected{'NOT_ACCESSED_LAST'}{'month6'}>$Lang::tr{'updxlrtr 6 months'}</option>
842 <option value='year' $selected{'NOT_ACCESSED_LAST'}{'year'}>$Lang::tr{'updxlrtr year'}</option>
843 </select>
844 </td>
845 </tr>
846 <tr>
847 </tr>
848 <tr>
849 <td class='base' width='25%'><input type='checkbox' name='REMOVE_NOSOURCE' $checked{'REMOVE_NOSOURCE'}{'on'} />&nbsp;$Lang::tr{'updxlrtr marked as'}</td>
850 <td class='base' width='3%'><img src='/images/updbooster/updxl-led-yellow.gif' alt='$Lang::tr{'updxlrtr condition nosource'}' /></td>
851 <td class='base' width='17%'>[<i>$Lang::tr{'updxlrtr condition nosource'}</i>]</td>
852 <td class='base' width='25%'><input type='checkbox' name='REMOVE_OUTDATED' $checked{'REMOVE_OUTDATED'}{'on'} />&nbsp;$Lang::tr{'updxlrtr marked as'}</td>
853 <td class='base' width='3%'><img src='/images/updbooster/updxl-led-red.gif' alt='$Lang::tr{'updxlrtr condition outdated'}' /></td>
854 <td class='base' width='27%'>[<i>$Lang::tr{'updxlrtr condition outdated'}</i>]</td>
855 </tr>
856 </table>
857 </form>
858 <hr size='1'>
859 <table>
860 <tr><td class='boldbase'><b>$Lang::tr{'updxlrtr current files'}</b></td></tr>
861 </table>
862 <table width='100%'>
863 <colgroup span='2' width='2%'></colgroup>
864 <colgroup span='1' width='0*'></colgroup>
865 <colgroup span='4' width='5%'></colgroup>
866 <colgroup span='1' width='2%'></colgroup>
867 <tr>
868 <td class='base' align='center'>&nbsp;</td>
869 <td class='base' align='center'>&nbsp;</td>
870 <td class='base' align='center'><b>$Lang::tr{'updxlrtr filename'}</b></td>
871 <td class='base' align='center'><b>$Lang::tr{'updxlrtr filesize'}</b></td>
872 <td class='base' align='center'><b>$Lang::tr{'date'}</b></td>
873 <td class='base' align='center'><img src='/images/reload.gif' alt='$Lang::tr{'updxlrtr last access'}' /></td>
874 <td class='base' align='center'><img src='/images/updbooster/updxl-globe.gif' alt='$Lang::tr{'updxlrtr last checkup'}' /></td>
875 <td class='base' align='center'>&nbsp;</td>
876 </tr>
877 END
878 ;
879 $id = 0;
880 foreach $updatefile (@repositoryfiles)
881 {
882 $updatefile =~ s/.*://;
883
884 $id++;
885 if ($id % 2) {
886 print "<tr bgcolor='$Header::table1colour'>\n"; }
887 else {
888 print "<tr bgcolor='$Header::table2colour'>\n"; }
889 $filesize = (-s "$repository/$updatefile");
890 1 while $filesize =~ s/^(-?\d+)(\d{3})/$1.$2/;
891
892 my ($SECdt,$MINdt,$HOURdt,$DAYdt,$MONTHdt,$YEARdt) = localtime(&getmtime("$repository/$updatefile"));
893 $DAYdt = sprintf ("%.02d",$DAYdt);
894 $MONTHdt = sprintf ("%.02d",$MONTHdt+1);
895 $YEARdt = sprintf ("%.04d",$YEARdt+1900);
896 $filedate = $YEARdt."-".$MONTHdt."-".$DAYdt;
897
898 $lastaccess = "n/a";
899 $lastcheck = "n/a";
900
901 $status = $sfUnknown;
902
903 unless ($updatefile =~ /^download\//)
904 {
905 ($vendorid,$uuid,$shortname) = split('/',$updatefile);
906
907 if (-e "$repository/$vendorid/$uuid/access.log")
908 {
909 open (FILE,"$repository/$vendorid/$uuid/access.log");
910 @metadata = <FILE>;
911 close(FILE);
912 chomp @metadata;
913
914 ($SECdt,$MINdt,$HOURdt,$DAYdt,$MONTHdt,$YEARdt) = localtime($metadata[-1]);
915 $DAYdt = sprintf ("%.02d",$DAYdt);
916 $MONTHdt = sprintf ("%.02d",$MONTHdt+1);
917 $YEARdt = sprintf ("%.04d",$YEARdt+1900);
918 if (($metadata[-1] =~ /^\d+/) && ($metadata[-1] >= 1)) { $lastaccess = $YEARdt."-".$MONTHdt."-".$DAYdt; }
919 }
920 if (-e "$repository/$vendorid/$uuid/checkup.log")
921 {
922 open (FILE,"$repository/$vendorid/$uuid/checkup.log");
923 @metadata = <FILE>;
924 close(FILE);
925 chomp @metadata;
926
927 ($SECdt,$MINdt,$HOURdt,$DAYdt,$MONTHdt,$YEARdt) = localtime($metadata[-1]);
928 $DAYdt = sprintf ("%.02d",$DAYdt);
929 $MONTHdt = sprintf ("%.02d",$MONTHdt+1);
930 $YEARdt = sprintf ("%.04d",$YEARdt+1900);
931 if (($metadata[-1] =~ /^\d+/) && ($metadata[-1] >= 1)) { $lastcheck = $YEARdt."-".$MONTHdt."-".$DAYdt; }
932 }
933 if (-e "$repository/$vendorid/$uuid/status")
934 {
935 open (FILE,"$repository/$vendorid/$uuid/status");
936 @metadata = <FILE>;
937 close(FILE);
938 chomp @metadata;
939 $status = $metadata[-1];
940 }
941 } else {
942 ($uuid,$vendorid,$shortname) = split('/',$updatefile);
943 $status = $sfOutdated;
944 }
945
946 print "\t\t<td align='center' nowrap='nowrap'>&nbsp;";
947 if ($status == $sfUnknown)
948 {
949 print "<img src='/images/updbooster/updxl-led-gray.gif' alt='$Lang::tr{'updxlrtr condition unknown'}' />&nbsp;</td>\n";
950 }
951 if ($status == $sfOk)
952 {
953 print "<img src='/images/updbooster/updxl-led-green.gif' alt='$Lang::tr{'updxlrtr condition ok'}' />&nbsp;</td>\n";
954 }
955 if ($status == $sfNoSource)
956 {
957 print "<img src='/images/updbooster/updxl-led-yellow.gif' alt='$Lang::tr{'updxlrtr condition nosource'}' />&nbsp;</td>\n";
958 }
959 if (($status == $sfOutdated) && (!($updatefile =~ /^download\//i)))
960 {
961 print "<img src='/images/updbooster/updxl-led-red.gif' alt='$Lang::tr{'updxlrtr condition outdated'}' />&nbsp;</td>\n";
962 }
963 if (($status == $sfOutdated) && ($updatefile =~ /^download\//i))
964 {
965 print "<img src='/images/updbooster/updxl-led-blue.gif' alt='$Lang::tr{'updxlrtr condition download'}' />&nbsp;</td>\n";
966 }
967
968 print "\t\t<td align='center' nowrap='nowrap'>&nbsp;";
969 if ($vendorid =~ /^Adobe$/i)
970 {
971 print "<img src='/images/updbooster/updxl-src-adobe.gif' alt='Adobe'}' />&nbsp;</td>\n";
972 } elsif ($vendorid =~ /^Microsoft$/i)
973 {
974 print "<img src='/images/updbooster/updxl-src-windows.gif' alt='Microsoft'}' />&nbsp;</td>\n";
975 } elsif ($vendorid =~ /^Symantec$/i)
976 {
977 print "<img src='/images/updbooster/updxl-src-symantec.gif' alt='Symantec'}' />&nbsp;</td>\n";
978 } elsif ($vendorid =~ /^Linux$/i)
979 {
980 print "<img src='/images/updbooster/updxl-src-linux.gif' alt='Linux'}' />&nbsp;</td>\n";
981 } elsif ($vendorid =~ /^TrendMicro$/i)
982 {
983 print "<img src='/images/updbooster/updxl-src-trendmicro.gif' alt='Trend Micro'}' />&nbsp;</td>\n";
984 } elsif ($vendorid =~ /^Apple$/i)
985 {
986 print "<img src='/images/updbooster/updxl-src-apple.gif' alt='Apple'}' />&nbsp;</td>\n";
987 } elsif ($vendorid =~ /^Avast$/i)
988 {
989 print "<img src='/images/updbooster/updxl-src-avast.gif' alt='Avast'}' />&nbsp;</td>\n";
990 } elsif ($vendorid =~ /^Avira$/i)
991 {
992 print "<img src='/images/updbooster/updxl-src-avira.gif' alt='Avira' />&nbsp;</td>\n";
993 } elsif ($vendorid =~ /^AVG$/i)
994 {
995 print "<img src='/images/updbooster/updxl-src-avg.gif' alt='AVG' />&nbsp;</td>\n";
996 } elsif ($vendorid =~ /^Ipfire$/i)
997 {
998 print "<img src='/images/IPFire.png' width='18' height='18' alt='IPFire' />&nbsp;</td>\n";
999 }
1000 else
1001 {
1002 if (-e "/srv/web/ipfire/html/images/updbooster/updxl-src-" . $vendorid . ".gif")
1003 {
1004 print "<img src='/images/updbooster/updxl-src-" . $vendorid . ".gif' alt='" . ucfirst $vendorid . "' />&nbsp;</td>\n";
1005 } else {
1006 print "<img src='/images/updbooster/updxl-src-unknown.gif' alt='" . ucfirst $vendorid . "' />&nbsp;</td>\n";
1007 }
1008 }
1009
1010 $shortname = substr($updatefile,rindex($updatefile,"/")+1);
1011 $shortname =~ s/(.*)_[\da-f]*(\.(exe|cab|psf)$)/\1_*\2/i;
1012
1013 print <<END
1014 <td class='base' align='left' title='cache:/$updatefile'><a href="/updatecache/$updatefile">$shortname</a></td>
1015 <td class='base' align='right' nowrap='nowrap'>&nbsp;$filesize&nbsp;</td>
1016 <td class='base' align='center' nowrap='nowrap'>&nbsp;$filedate&nbsp;</td>
1017 <td class='base' align='center' nowrap='nowrap'>&nbsp;$lastaccess&nbsp;</td>
1018 <td class='base' align='center' nowrap='nowrap'>&nbsp;$lastcheck&nbsp;</td>
1019 <td align='center'>
1020 <form method='post' name='frma$id' action='$ENV{'SCRIPT_NAME'}'>
1021 <input type='image' name='$Lang::tr{'updxlrtr remove file'}' src='/images/delete.gif' title='$Lang::tr{'updxlrtr remove file'}' alt='$Lang::tr{'updxlrtr remove file'}' />
1022 <input type='hidden' name='ID' value='$updatefile' />
1023 <input type='hidden' name='ACTION' value='$Lang::tr{'updxlrtr remove file'}' />
1024 </form>
1025 </td>
1026 </tr>
1027 END
1028 ;
1029 }
1030
1031 print <<END
1032 </table>
1033 <br>
1034 <table>
1035 <tr>
1036 <td class='boldbase'>&nbsp; <b>$Lang::tr{'legend'}:</b></td>
1037 <td class='base'>&nbsp;</td>
1038 <td><img src='/images/reload.gif' alt='$Lang::tr{'updxlrtr last access'}' /></td>
1039 <td class='base'>$Lang::tr{'updxlrtr last access'}</td>
1040 <td class='base'>&nbsp;</td>
1041 <td><img src='/images/updbooster/updxl-globe.gif' alt='$Lang::tr{'updxlrtr last checkup'}' /></td>
1042 <td class='base'>$Lang::tr{'updxlrtr last checkup'}</td>
1043 <td class='base'>&nbsp;</td>
1044 <td><img src='/images/delete.gif' alt='$Lang::tr{'updxlrtr remove file'}' /></td>
1045 <td class='base'>$Lang::tr{'updxlrtr remove file'}</td>
1046 <td class='base'>&nbsp;</td>
1047 <td class='base'>&nbsp;</td>
1048 <td class='base'>&nbsp;</td>
1049 </tr>
1050 <tr>
1051 <td colspan='13'><br></td>
1052 </tr>
1053 <tr>
1054 <td class='base'>&nbsp; $Lang::tr{'status'}:</td>
1055 <td class='base'>&nbsp;</td>
1056 <td align='center'><img src='/images/updbooster/updxl-led-green.gif' alt='$Lang::tr{'updxlrtr condition ok'}' /></td>
1057 <td class='base'>$Lang::tr{'updxlrtr condition ok'}</td>
1058 <td class='base'>&nbsp;</td>
1059 <td align='center'><img src='/images/updbooster/updxl-led-yellow.gif' alt='$Lang::tr{'updxlrtr condition nosource'}' /></td>
1060 <td class='base'>$Lang::tr{'updxlrtr condition nosource'}</td>
1061 <td class='base'>&nbsp;</td>
1062 <td align='center'><img src='/images/updbooster/updxl-led-red.gif' alt='$Lang::tr{'updxlrtr condition outdated'}' /></td>
1063 <td class='base'>$Lang::tr{'updxlrtr condition outdated'}</td>
1064 <td class='base'>&nbsp;</td>
1065 <td align='center'>&nbsp;</td>
1066 <td class='base'>&nbsp;</td>
1067 </tr>
1068 <tr>
1069 <td class='base'>&nbsp;</td>
1070 <td class='base'>&nbsp;</td>
1071 <td align='center'><img src='/images/updbooster/updxl-led-blue.gif' alt='$Lang::tr{'updxlrtr condition download'}' /></td>
1072 <td class='base'>$Lang::tr{'updxlrtr condition download'}</td>
1073 <td class='base'>&nbsp;</td>
1074 <td align='center'><img src='/images/updbooster/updxl-led-gray.gif' alt='$Lang::tr{'updxlrtr condition unknown'}' /></td>
1075 <td class='base'>$Lang::tr{'updxlrtr condition unknown'}</td>
1076 <td class='base'>&nbsp;</td>
1077 <td align='center'>&nbsp;</td>
1078 <td class='base'>&nbsp;</td>
1079 <td class='base'>&nbsp;</td>
1080 <td align='center'>&nbsp;</td>
1081 <td class='base'>&nbsp;</td>
1082 </tr>
1083 <tr>
1084 <td colspan='13'>&nbsp;<br></td>
1085 </tr>
1086 <tr>
1087 <td class='base'>&nbsp; $Lang::tr{'updxlrtr source'}:</td>
1088 <td class='base'>&nbsp;</td>
1089 <td align='center'><img src='/images/updbooster/updxl-src-adobe.gif' alt='Adobe' /></td>
1090 <td class='base'>Adobe</td>
1091 <td class='base'>&nbsp;</td>
1092 <td align='center'><img src='/images/updbooster/updxl-src-apple.gif' alt='Apple' /></td>
1093 <td class='base'>Apple</td>
1094 <td class='base'>&nbsp;</td>
1095 <td align='center'><img src='/images/updbooster/updxl-src-avast.gif' alt='Avast' /></td>
1096 <td class='base'>Avast</td>
1097 <td class='base'>&nbsp;</td>
1098 <td align='center'><img src='/images/updbooster/updxl-src-linux.gif' alt='Linux' /></td>
1099 <td class='base'>Linux</td>
1100 </tr>
1101 <tr>
1102 <td colspan='13'></td>
1103 </tr>
1104 <tr>
1105 <td class='base'>&nbsp;</td>
1106 <td class='base'>&nbsp;</td>
1107 <td align='center'><img src='/images/updbooster/updxl-src-windows.gif' alt='Microsoft' /></td>
1108 <td class='base'>Microsoft</td>
1109 <td class='base'>&nbsp;</td>
1110 <td align='center'><img src='/images/updbooster/updxl-src-symantec.gif' alt='Symantec' /></td>
1111 <td class='base'>Symantec</td>
1112 <td class='base'>&nbsp;</td>
1113 <td align='center'><img src='/images/updbooster/updxl-src-trendmicro.gif' alt='Trend Micro' /></td>
1114 <td class='base'>Trend Micro</td>
1115 <td class='base'>&nbsp;</td>
1116 <td align='center'><img src='/images/IPFire.png' width='18' height='18' alt='IPFire' /></td>
1117 <td class='base'>IPFire</td>
1118 </tr>
1119 <tr>
1120 <td class='base'>&nbsp;</td>
1121 <td class='base'>&nbsp;</td>
1122 <td align='center'><img src='/images/updbooster/updxl-src-avira.gif' alt='Avira' /></td>
1123 <td class='base'>Avira</td>
1124 <td class='base'>&nbsp;</td>
1125 <td align='center'><img src='/images/updbooster/updxl-src-avg.gif' alt='AVG' /></td>
1126 <td class='base'>AVG</td>
1127 <td class='base'>&nbsp;</td>
1128 <td align='center'><img src='/images/updbooster/updxl-src-unknown.gif' alt='$Lang::tr{'updxlrtr other'}' /></td>
1129 <td class='base'>$Lang::tr{'updxlrtr other'}</td>
1130 <td class='base'>&nbsp;</td>
1131 <td align='center'></td>
1132 <td class='base'>&nbsp;</td>
1133 </tr>
1134 </table>
1135 END
1136 ;
1137
1138 }
1139
1140 &Header::closebox();
1141
1142 }
1143
1144 # =====================================================================================
1145
1146 # ----------------------------------------------------
1147
1148 &Header::closebigbox();
1149
1150 &Header::closepage();
1151
1152 # -------------------------------------------------------------------
1153
1154 sub savesettings
1155 {
1156 if (-e $chk_cron_dly) { unlink($chk_cron_dly); }
1157 if (-e $chk_cron_wly) { unlink($chk_cron_wly); }
1158 if (-e $chk_cron_mly) { unlink($chk_cron_mly); }
1159
1160 if (($xlratorsettings{'ENABLE_AUTOCHECK'} eq 'on') && ($xlratorsettings{'AUTOCHECK_SCHEDULE'} eq 'daily'))
1161 {
1162 symlink("../bin/checkup",$chk_cron_dly)
1163 } else {
1164 symlink("/bin/false",$chk_cron_dly)
1165 }
1166 if (($xlratorsettings{'ENABLE_AUTOCHECK'} eq 'on') && ($xlratorsettings{'AUTOCHECK_SCHEDULE'} eq 'weekly'))
1167 {
1168 symlink("../bin/checkup",$chk_cron_wly)
1169 } else {
1170 symlink("/bin/false",$chk_cron_wly)
1171 }
1172 if (($xlratorsettings{'ENABLE_AUTOCHECK'} eq 'on') && ($xlratorsettings{'AUTOCHECK_SCHEDULE'} eq 'monthly'))
1173 {
1174 symlink("../bin/checkup",$chk_cron_mly)
1175 } else {
1176 symlink("/bin/false",$chk_cron_mly)
1177 }
1178
1179 delete($xlratorsettings{'REMOVE_OBSOLETE'});
1180 delete($xlratorsettings{'REMOVE_NOSOURCE'});
1181 delete($xlratorsettings{'REMOVE_OUTDATED'});
1182
1183 delete($xlratorsettings{'EXTENDED_GUI'});
1184
1185 &General::writehash("${General::swroot}/updatexlrator/settings", \%xlratorsettings);
1186 }
1187
1188 # -------------------------------------------------------------------
1189
1190 sub percentbar
1191 {
1192 my $percent = $_[0];
1193 my $fg = '#a0a0a0';
1194 my $bg = '#e2e2e2';
1195
1196 if ($percent =~ m/^(\d+)%$/ )
1197 {
1198 print <<END
1199 <table width='100' border='1' cellspacing='0' cellpadding='0' style='border-width:1px;border-style:solid;border-color:$fg;width:100px;height:10px;'>
1200 <tr>
1201 END
1202 ;
1203 if ($percent eq "100%") {
1204 print "<td width='100%' bgcolor='$fg' style='background-color:$fg;border-style:solid;border-width:1px;border-color:$bg'>"
1205 } elsif ($percent eq "0%") {
1206 print "<td width='100%' bgcolor='$bg' style='background-color:$bg;border-style:solid;border-width:1px;border-color:$bg'>"
1207 } else {
1208 print "<td width='$percent' bgcolor='$fg' style='background-color:$fg;border-style:solid;border-width:1px;border-color:$bg'></td><td width='" . (100-$1) . "%' bgcolor='$bg' style='background-color:$bg;border-style:solid;border-width:1px;border-color:$bg'>"
1209 }
1210 print <<END
1211 <img src='/images/null.gif' width='1' height='1' alt='' /></td></tr></table>
1212 END
1213 ;
1214 }
1215 }
1216
1217 # -------------------------------------------------------------------
1218
1219 sub getmtime
1220 {
1221 my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat($_[0]);
1222
1223 return $mtime;
1224 }
1225
1226 # -------------------------------------------------------------------