]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - html/cgi-bin/updatexlrator.cgi
Updated openssl (0.9.8n).
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / updatexlrator.cgi
1 #!/usr/bin/perl
2 #!/usr/bin/perl
3 #
4 # This code is distributed under the terms of the GPL
5 #
6 # (c) 2006-2008 marco.s - http://update-accelerator.advproxy.net
7 #
8 # Portions (c) 2008 by dotzball - http://www.blockouttraffic.de
9 #
10 # $Id: updatexlrator.cgi,v 2.1.0 2008/07/16 00:00:00 marco.s Exp $
11 #
12 ###############################################################################
13 # #
14 # IPFire.org - A linux based firewall #
15 # Copyright (C) 2009 Michael Tremer & Christian Schmidt #
16 # #
17 # This program is free software: you can redistribute it and/or modify #
18 # it under the terms of the GNU General Public License as published by #
19 # the Free Software Foundation, either version 3 of the License, or #
20 # (at your option) any later version. #
21 # #
22 # This program is distributed in the hope that it will be useful, #
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
25 # GNU General Public License for more details. #
26 # #
27 # You should have received a copy of the GNU General Public License #
28 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
29 # #
30 ###############################################################################
31
32 use strict;
33
34 # enable only the following on debugging purpose
35 #use warnings; no warnings 'once';# 'redefine', 'uninitialized';
36 #use CGI::Carp 'fatalsToBrowser';
37
38 use IO::Socket;
39
40 require '/var/ipfire/general-functions.pl';
41 require "${General::swroot}/lang.pl";
42 require "${General::swroot}/header.pl";
43
44 my %color = ();
45 my %checked=();
46 my %selected=();
47 my %netsettings=();
48 my %mainsettings=();
49 my %proxysettings=();
50 my %xlratorsettings=();
51 my %dlinfo=();
52 my $id=0;
53 my @dfdata=();
54 my $dfstr='';
55 my @updatelist=();
56 my @sources=();
57 my $sourceurl='';
58 my $vendorid='';
59 my $uuid='';
60 my $status=0;
61 my $updatefile='';
62 my $shortname='';
63 my $time='';
64 my $filesize=0;
65 my $filedate='';
66 my $lastaccess='';
67 my $lastcheck='';
68 my $cachedtraffic=0;
69 my @requests=();
70 my $data='';
71 my $counts=0;
72 my $numfiles=0;
73 my $cachehits=0;
74 my $efficiency='0.0';
75 my @vendors=();
76 my %vendorstats=();
77
78 my $repository = "/var/updatecache/";
79 my $hintcolour = '#FFFFCC';
80 my $colourgray = '#808080';
81
82 my $sfUnknown='0';
83 my $sfOk='1';
84 my $sfOutdated='2';
85 my $sfNoSource='3';
86
87 my $not_accessed_last='';
88
89 my $errormessage='';
90
91 my @repositorylist=();
92 my @repositoryfiles=();
93 my @downloadlist=();
94 my @downloadfiles=();
95
96 my @metadata=();
97
98 my $chk_cron_dly = "${General::swroot}/updatexlrator/autocheck/cron.daily";
99 my $chk_cron_wly = "${General::swroot}/updatexlrator/autocheck/cron.weekly";
100 my $chk_cron_mly = "${General::swroot}/updatexlrator/autocheck/cron.monthly";
101
102 &General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
103 &General::readhash("${General::swroot}/main/settings", \%mainsettings);
104 &General::readhash("${General::swroot}/proxy/settings", \%proxysettings);
105 &General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
106
107 $xlratorsettings{'ACTION'} = '';
108 $xlratorsettings{'ENABLE_LOG'} = 'off';
109 $xlratorsettings{'PASSIVE_MODE'} = 'off';
110 $xlratorsettings{'MAX_DISK_USAGE'} = '75';
111 $xlratorsettings{'LOW_DOWNLOAD_PRIORITY'} = 'off';
112 $xlratorsettings{'MAX_DOWNLOAD_RATE'} = '';
113 $xlratorsettings{'ENABLE_AUTOCHECK'} = 'off';
114 $xlratorsettings{'FULL_AUTOSYNC'} = 'off';
115 $xlratorsettings{'NOT_ACCESSED_LAST'} = 'month1';
116 $xlratorsettings{'REMOVE_NOSOURCE'} = 'off';
117 $xlratorsettings{'REMOVE_OUTDATED'} = 'off';
118 $xlratorsettings{'REMOVE_OBSOLETE'} = 'off';
119
120 &Header::getcgihash(\%xlratorsettings);
121
122 $xlratorsettings{'EXTENDED_GUI'} = '';
123
124 if ($xlratorsettings{'ACTION'} eq "$Lang::tr{'updxlrtr statistics'} >>")
125 {
126 $xlratorsettings{'EXTENDED_GUI'} = 'statistics';
127 }
128
129 if ($xlratorsettings{'ACTION'} eq "$Lang::tr{'updxlrtr maintenance'} >>")
130 {
131 $xlratorsettings{'EXTENDED_GUI'} = 'maintenance';
132 }
133
134 if ($xlratorsettings{'ACTION'} eq $Lang::tr{'updxlrtr purge'})
135 {
136 $xlratorsettings{'EXTENDED_GUI'} = 'maintenance';
137
138 if (($xlratorsettings{'REMOVE_OBSOLETE'} eq 'on') || ($xlratorsettings{'REMOVE_NOSOURCE'} eq 'on') || ($xlratorsettings{'REMOVE_OUTDATED'} eq 'on'))
139 {
140 undef (@sources);
141 undef @repositoryfiles;
142 foreach (<$repository/*>)
143 {
144 if (-d $_)
145 {
146 unless (/^$repository\/download$/) { push(@sources,$_); }
147 }
148 }
149
150 foreach (@sources)
151 {
152 @updatelist=<$_/*>;
153 $vendorid = substr($_,rindex($_,"/")+1);
154 foreach(@updatelist)
155 {
156 $uuid = substr($_,rindex($_,"/")+1);
157 if (-e "$_/source.url")
158 {
159 open (FILE,"$_/source.url");
160 $sourceurl=<FILE>;
161 close FILE;
162 chomp($sourceurl);
163 $updatefile = substr($sourceurl,rindex($sourceurl,'/')+1,length($sourceurl));
164 $updatefile = "$vendorid/$uuid/$updatefile";
165 push(@repositoryfiles,$updatefile);
166 }
167 }
168 }
169
170 foreach (@repositoryfiles)
171 {
172 ($vendorid,$uuid,$updatefile) = split('/');
173
174 if (-e "$repository/$vendorid/$uuid/status")
175 {
176 open (FILE,"$repository/$vendorid/$uuid/status");
177 @metadata = <FILE>;
178 close FILE;
179 chomp(@metadata);
180 $status = $metadata[-1];
181 }
182
183 if (-e "$repository/$vendorid/$uuid/access.log")
184 {
185 open (FILE,"$repository/$vendorid/$uuid/access.log");
186 @metadata = <FILE>;
187 close FILE;
188 chomp(@metadata);
189 $lastaccess = $metadata[-1];
190 }
191
192 if (($xlratorsettings{'REMOVE_NOSOURCE'} eq 'on') && ($status == $sfNoSource))
193 {
194 if (-e "$repository/$vendorid/$uuid/$updatefile") { system("rm -r $repository/$vendorid/$uuid"); }
195 }
196 if (($xlratorsettings{'REMOVE_OUTDATED'} eq 'on') && ($status == $sfOutdated))
197 {
198 if (-e "$repository/$vendorid/$uuid/$updatefile") { system("rm -r $repository/$vendorid/$uuid"); }
199 }
200 if ($xlratorsettings{'REMOVE_OBSOLETE'} eq 'on')
201 {
202 if (($xlratorsettings{'NOT_ACCESSED_LAST'} eq 'week') && ($lastaccess < (time - 604800)))
203 {
204 if (-e "$repository/$vendorid/$uuid/$updatefile") { system("rm -r $repository/$vendorid/$uuid"); }
205 }
206 if (($xlratorsettings{'NOT_ACCESSED_LAST'} eq 'month1') && ($lastaccess < (time - 2505600)))
207 {
208 if (-e "$repository/$vendorid/$uuid/$updatefile") { system("rm -r $repository/$vendorid/$uuid"); }
209 }
210 if (($xlratorsettings{'NOT_ACCESSED_LAST'} eq 'month3') && ($lastaccess < (time - 7516800)))
211 {
212 if (-e "$repository/$vendorid/$uuid/$updatefile") { system("rm -r $repository/$vendorid/$uuid"); }
213 }
214 if (($xlratorsettings{'NOT_ACCESSED_LAST'} eq 'month6') && ($lastaccess < (time - 15033600)))
215 {
216 if (-e "$repository/$vendorid/$uuid/$updatefile") { system("rm -r $repository/$vendorid/$uuid"); }
217 }
218 if (($xlratorsettings{'NOT_ACCESSED_LAST'} eq 'year') && ($lastaccess < (time - 31536000)))
219 {
220 if (-e "$repository/$vendorid/$uuid/$updatefile") { system("rm -r $repository/$vendorid/$uuid"); }
221 }
222 }
223 }
224 }
225 }
226
227 if ($xlratorsettings{'ACTION'} eq $Lang::tr{'save'})
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
240 &savesettings;
241 }
242
243 if ($xlratorsettings{'ACTION'} eq $Lang::tr{'updxlrtr save and restart'})
244 {
245 if (!($xlratorsettings{'MAX_DISK_USAGE'} =~ /^\d+$/) || ($xlratorsettings{'MAX_DISK_USAGE'} < 1) || ($xlratorsettings{'MAX_DISK_USAGE'} > 100))
246 {
247 $errormessage = $Lang::tr{'updxlrtr invalid disk usage'};
248 goto ERROR;
249 }
250 if (($xlratorsettings{'MAX_DOWNLOAD_RATE'} ne '') && ((!($xlratorsettings{'MAX_DOWNLOAD_RATE'} =~ /^\d+$/)) || ($xlratorsettings{'MAX_DOWNLOAD_RATE'} < 1)))
251 {
252 $errormessage = $Lang::tr{'updxlrtr invalid download rate'};
253 goto ERROR;
254 }
255 if ((!(-e "${General::swroot}/proxy/enable")) && (!(-e "${General::swroot}/proxy/enable_blue")))
256 {
257 $errormessage = $Lang::tr{'updxlrtr web proxy service required'};
258 goto ERROR;
259 }
260 if (!($proxysettings{'ENABLE_UPDXLRATOR'} eq 'on'))
261 {
262 $errormessage = $Lang::tr{'updxlrtr not enabled'};
263 goto ERROR;
264 }
265
266 &savesettings;
267
268 system('/usr/local/bin/squidctrl restart >/dev/null 2>&1');
269 }
270
271 if ($xlratorsettings{'ACTION'} eq $Lang::tr{'updxlrtr remove file'})
272 {
273 $xlratorsettings{'EXTENDED_GUI'} = 'maintenance';
274
275 $updatefile = $xlratorsettings{'ID'};
276
277 unless ($updatefile =~ /^download\//)
278 {
279 ($vendorid,$uuid,$updatefile) = split('/',$updatefile);
280 if (-e "$repository/$vendorid/$uuid/$updatefile") { system("rm -r $repository/$vendorid/$uuid"); }
281 }
282 }
283
284 if (($xlratorsettings{'ACTION'} eq $Lang::tr{'updxlrtr cancel download'}) || ($xlratorsettings{'ACTION'} eq $Lang::tr{'updxlrtr remove file'}))
285 {
286 $updatefile = $xlratorsettings{'ID'};
287
288 if ($updatefile =~ /^download\//)
289 {
290 ($uuid,$vendorid,$updatefile) = split('/',$updatefile);
291
292 if (-e "$repository/download/$vendorid/$updatefile.info")
293 {
294 &General::readhash("$repository/download/$vendorid/$updatefile.info", \%dlinfo);
295
296 $id = &getPID("\\s${General::swroot}/updatexlrator/bin/download\\s.*\\s".quotemeta($dlinfo{'SRCURL'})."\\s\\d\\s\\d\$");
297 if ($id) { system("/bin/kill -9 $id"); }
298 $id = &getPID("\\s/usr/bin/wget\\s.*\\s".quotemeta($dlinfo{'SRCURL'})."\$");
299 if ($id) { system("/bin/kill -9 $id"); }
300
301 system("rm $repository/download/$vendorid/$updatefile.info");
302 }
303
304 if (-e "$repository/download/$vendorid/$updatefile")
305 {
306 system("rm $repository/download/$vendorid/$updatefile");
307 }
308 }
309
310 }
311
312 $not_accessed_last = $xlratorsettings{'NOT_ACCESSED_LAST'};
313 undef($xlratorsettings{'NOT_ACCESSED_LAST'});
314
315 if (-e "${General::swroot}/updatexlrator/settings")
316 {
317 &General::readhash("${General::swroot}/updatexlrator/settings", \%xlratorsettings);
318 }
319
320 if ($xlratorsettings{'NOT_ACCESSED_LAST'} eq '')
321 {
322 $xlratorsettings{'NOT_ACCESSED_LAST'} = $not_accessed_last;
323 }
324
325 ERROR:
326
327 $checked{'ENABLE_LOG'}{'off'} = '';
328 $checked{'ENABLE_LOG'}{'on'} = '';
329 $checked{'ENABLE_LOG'}{$xlratorsettings{'ENABLE_LOG'}} = "checked='checked'";
330 $checked{'PASSIVE_MODE'}{'off'} = '';
331 $checked{'PASSIVE_MODE'}{'on'} = '';
332 $checked{'PASSIVE_MODE'}{$xlratorsettings{'PASSIVE_MODE'}} = "checked='checked'";
333 $checked{'LOW_DOWNLOAD_PRIORITY'}{'off'} = '';
334 $checked{'LOW_DOWNLOAD_PRIORITY'}{'on'} = '';
335 $checked{'LOW_DOWNLOAD_PRIORITY'}{$xlratorsettings{'LOW_DOWNLOAD_PRIORITY'}} = "checked='checked'";
336 $checked{'ENABLE_AUTOCHECK'}{'off'} = '';
337 $checked{'ENABLE_AUTOCHECK'}{'on'} = '';
338 $checked{'ENABLE_AUTOCHECK'}{$xlratorsettings{'ENABLE_AUTOCHECK'}} = "checked='checked'";
339 $checked{'FULL_AUTOSYNC'}{'off'} = '';
340 $checked{'FULL_AUTOSYNC'}{'on'} = '';
341 $checked{'FULL_AUTOSYNC'}{$xlratorsettings{'FULL_AUTOSYNC'}} = "checked='checked'";
342 $checked{'REMOVE_NOSOURCE'}{'off'} = '';
343 $checked{'REMOVE_NOSOURCE'}{'on'} = '';
344 $checked{'REMOVE_NOSOURCE'}{$xlratorsettings{'REMOVE_NOSOURCE'}} = "checked='checked'";
345 $checked{'REMOVE_OUTDATED'}{'off'} = '';
346 $checked{'REMOVE_OUTDATED'}{'on'} = '';
347 $checked{'REMOVE_OUTDATED'}{$xlratorsettings{'REMOVE_OUTDATED'}} = "checked='checked'";
348 $checked{'REMOVE_OBSOLETE'}{'off'} = '';
349 $checked{'REMOVE_OBSOLETE'}{'on'} = '';
350 $checked{'REMOVE_OBSOLETE'}{$xlratorsettings{'REMOVE_OBSOLETE'}} = "checked='checked'";
351
352
353 $selected{'AUTOCHECK_SCHEDULE'}{'daily'} = '';
354 $selected{'AUTOCHECK_SCHEDULE'}{'weekly'} = '';
355 $selected{'AUTOCHECK_SCHEDULE'}{'monthly'} = '';
356 $selected{'AUTOCHECK_SCHEDULE'}{$xlratorsettings{'AUTOCHECK_SCHEDULE'}} = "selected='selected'";
357
358 $selected{'NOT_ACCESSED_LAST'}{'week'} = '';
359 $selected{'NOT_ACCESSED_LAST'}{'month1'} = '';
360 $selected{'NOT_ACCESSED_LAST'}{'month3'} = '';
361 $selected{'NOT_ACCESSED_LAST'}{'month6'} = '';
362 $selected{'NOT_ACCESSED_LAST'}{'year'} = '';
363 $selected{'NOT_ACCESSED_LAST'}{$xlratorsettings{'NOT_ACCESSED_LAST'}} = "selected='selected'";
364
365 # ----------------------------------------------------
366 # Settings dialog
367 # ----------------------------------------------------
368
369 &Header::showhttpheaders();
370
371 &Header::openpage($Lang::tr{'updxlrtr configuration'}, 1, '');
372
373 &Header::openbigbox('100%', 'left', '', $errormessage);
374
375 if ($errormessage) {
376 &Header::openbox('100%', 'left', $Lang::tr{'error messages'});
377 print "<font class='base'>$errormessage&nbsp;</font>\n";
378 &Header::closebox();
379 }
380
381 print "<form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>\n";
382
383 &Header::openbox('100%', 'left', "$Lang::tr{'updxlrtr update accelerator'}");
384
385 print <<END
386 <table width='100%'>
387 <tr>
388 <td colspan='4'><b>$Lang::tr{'updxlrtr common settings'}</b></td>
389 </tr>
390 <tr>
391 <td class='base' width='25%'>$Lang::tr{'updxlrtr enable log'}:</td>
392 <td class='base' width='20%'><input type='checkbox' name='ENABLE_LOG' $checked{'ENABLE_LOG'}{'on'} /></td>
393 <td class='base' width='25%'></td>
394 <td class='base' width='30%'></td>
395 </tr>
396 <tr>
397 <td class='base'>$Lang::tr{'updxlrtr passive mode'}:</td>
398 <td class='base'><input type='checkbox' name='PASSIVE_MODE' $checked{'PASSIVE_MODE'}{'on'} /></td>
399 <td class='base'>$Lang::tr{'updxlrtr max disk usage'}:</td>
400 <td class='base'><input type='text' name='MAX_DISK_USAGE' value='$xlratorsettings{'MAX_DISK_USAGE'}' size='1' /> %</td>
401 </tr>
402 </table>
403 <hr size='1'>
404 <table width='100%'>
405 <tr>
406 <td colspan='4'><b>$Lang::tr{'updxlrtr performance options'}</b></td>
407 </tr>
408 <tr>
409 <td class='base' width='25%'>$Lang::tr{'updxlrtr low download priority'}:</td>
410 <td class='base' width='20%'><input type='checkbox' name='LOW_DOWNLOAD_PRIORITY' $checked{'LOW_DOWNLOAD_PRIORITY'}{'on'} /></td>
411 <td class='base' width='25%'>$Lang::tr{'updxlrtr max download rate'}:&nbsp;<img src='/blob.gif' alt='*' </td>
412 <td class='base' width='30%'><input type='text' name='MAX_DOWNLOAD_RATE' value='$xlratorsettings{'MAX_DOWNLOAD_RATE'}' size='5' /></td>
413 </tr>
414 </table>
415 <hr size='1'>
416 <table width='100%'>
417 <tr>
418 <td colspan='4'><b>$Lang::tr{'updxlrtr source checkup'}</b></td>
419 </tr>
420 <tr>
421 <td class='base' width='25%'>$Lang::tr{'updxlrtr enable autocheck'}:</td>
422 <td class='base' width='20%'><input type='checkbox' name='ENABLE_AUTOCHECK' $checked{'ENABLE_AUTOCHECK'}{'on'} /></td>
423 <td class='base' width='25%'>$Lang::tr{'updxlrtr source checkup schedule'}:</td>
424 <td class='base' width='30%'>
425 <select name='AUTOCHECK_SCHEDULE'>
426 <option value='daily' $selected{'AUTOCHECK_SCHEDULE'}{'daily'}>$Lang::tr{'updxlrtr daily'}</option>
427 <option value='weekly' $selected{'AUTOCHECK_SCHEDULE'}{'weekly'}>$Lang::tr{'updxlrtr weekly'}</option>
428 <option value='monthly' $selected{'AUTOCHECK_SCHEDULE'}{'monthly'}>$Lang::tr{'updxlrtr monthly'}</option>
429 </select>
430 </td>
431 </tr>
432 <tr>
433 <td class='base'>$Lang::tr{'updxlrtr full autosync'}:</td>
434 <td class='base'><input type='checkbox' name='FULL_AUTOSYNC' $checked{'FULL_AUTOSYNC'}{'on'} /></td>
435 <td>&nbsp;</td>
436 <td>&nbsp;</td>
437 </tr>
438 </table>
439 <hr size='1'>
440 <table width='100%'>
441 <tr>
442 <td align='center' width='20%'><input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></td>
443 <td align='center' width='20%'><input type='submit' name='ACTION' value='$Lang::tr{'updxlrtr save and restart'}' /></td>
444 <td>&nbsp;</td>
445 END
446 ;
447
448 print" <td align='center' width='20%'><input type='submit' name='ACTION' value='$Lang::tr{'updxlrtr statistics'}";
449 if ($xlratorsettings{'EXTENDED_GUI'} eq 'statistics') { print " <<' "; } else { print " >>' "; }
450 print "/></td>\n";
451
452 print" <td align='center' width='20%'><input type='submit' name='ACTION' value='$Lang::tr{'updxlrtr maintenance'}";
453 if ($xlratorsettings{'EXTENDED_GUI'} eq 'maintenance') { print " <<' "; } else { print " >>' "; }
454 print "/></td>\n";
455
456 print <<END
457 </tr>
458 </table>
459 END
460 ;
461
462 &Header::closebox();
463
464 print "</form>\n";
465
466 # ----------------------------------------------------
467 # List pending downloads - if any
468 # ----------------------------------------------------
469
470 if (($xlratorsettings{'EXTENDED_GUI'} ne 'statistics') && ($xlratorsettings{'EXTENDED_GUI'} ne 'maintenance'))
471 {
472 @downloadlist = <$repository/download/*>;
473
474 undef(@downloadfiles);
475 foreach (@downloadlist)
476 {
477 if (-d)
478 {
479 my @filelist = <$_/*>;
480 $vendorid = substr($_,rindex($_,"/")+1);
481 foreach(@filelist)
482 {
483 next if(/\.info$/);
484 $updatefile = substr($_,rindex($_,"/")+1);
485 $updatefile .= ":download/$vendorid/$updatefile";
486 $updatefile = " ".$updatefile;
487 push(@downloadfiles, $updatefile);
488 }
489 }
490 }
491
492 if (@downloadfiles)
493 {
494 &Header::openbox('100%', 'left', "$Lang::tr{'updxlrtr pending downloads'}");
495
496 print <<END
497 <table>
498 <tr><td class='boldbase'><b>$Lang::tr{'updxlrtr current downloads'}</b></td></tr>
499 </table>
500 <table width='100%'>
501 <colgroup span='3' width='2%'></colgroup>
502 <colgroup span='1' width='0*'></colgroup>
503 <colgroup span='3' width='5%'></colgroup>
504 <colgroup span='1' width='2%'></colgroup>
505 <tr>
506 <td class='base' align='center'>&nbsp;</td>
507 <td class='base' align='left' colspan='2'><i>$Lang::tr{'updxlrtr source'}</i></td>
508 <td class='base' align='center'><i>$Lang::tr{'updxlrtr filename'}</i></td>
509 <td class='base' align='center'><i>$Lang::tr{'updxlrtr filesize'}</i></td>
510 <td class='base' align='center'><i>$Lang::tr{'date'}</i></td>
511 <td class='base' align='center'><i>$Lang::tr{'updxlrtr progress'}</i></td>
512 <td class='base' align='center'>&nbsp;</td>
513 </tr>
514 END
515 ;
516 $id = 0;
517 foreach $updatefile (@downloadfiles)
518 {
519 $updatefile =~ s/.*://;
520 my $size_updatefile = 0;
521 my $mtime = 0;
522 if(-e "$repository/$updatefile") {
523 $size_updatefile = (-s "$repository/$updatefile");
524 $mtime = &getmtime("$repository/$updatefile");
525 }
526 if (-e "$repository/$updatefile.info") {
527 &General::readhash("$repository/$updatefile.info", \%dlinfo);
528 } else {
529 undef(%dlinfo);
530 }
531
532 $id++;
533 if ($id % 2) {
534 print "<tr bgcolor='$Header::table1colour'>\n"; }
535 else {
536 print "<tr bgcolor='$Header::table2colour'>\n"; }
537
538 $filesize = $size_updatefile;
539 1 while $filesize =~ s/^(-?\d+)(\d{3})/$1.$2/;
540
541 my ($SECdt,$MINdt,$HOURdt,$DAYdt,$MONTHdt,$YEARdt) = localtime($mtime);
542 $DAYdt = sprintf ("%.02d",$DAYdt);
543 $MONTHdt = sprintf ("%.02d",$MONTHdt+1);
544 $YEARdt = sprintf ("%.04d",$YEARdt+1900);
545 $filedate = $YEARdt."-".$MONTHdt."-".$DAYdt;
546
547 ($uuid,$vendorid,$shortname) = split('/',$updatefile);
548
549 print "\t\t<td align='center' nowrap='nowrap'>&nbsp;";
550 if (&getPID("\\s/usr/bin/wget\\s.*\\s".quotemeta($dlinfo{'SRCURL'})."\$"))
551 {
552 print "<img src='/images/updxl-led-blue.gif' alt='$Lang::tr{'updxlrtr condition download'}' />&nbsp;</td>\n";
553 } else {
554 print "<img src='/images/updxl-led-gray.gif' alt='$Lang::tr{'updxlrtr condition suspended'}' />&nbsp;</td>\n";
555 }
556
557 print "\t\t<td align='center' nowrap='nowrap'>&nbsp;";
558 if ($vendorid =~ /^Adobe$/i)
559 {
560 print "<img src='/images/updxl-src-adobe.gif' alt='Adobe'}' />&nbsp;</td>\n";
561 } elsif ($vendorid =~ /^Microsoft$/i)
562 {
563 print "<img src='/images/updxl-src-windows.gif' alt='Microsoft'}' />&nbsp;</td>\n";
564 } elsif ($vendorid =~ /^Symantec$/i)
565 {
566 print "<img src='/images/updxl-src-symantec.gif' alt='Symantec'}' />&nbsp;</td>\n";
567 } elsif ($vendorid =~ /^Linux$/i)
568 {
569 print "<img src='/images/updxl-src-linux.gif' alt='Linux'}' />&nbsp;</td>\n";
570 } elsif ($vendorid =~ /^TrendMicro$/i)
571 {
572 print "<img src='/images/updxl-src-trendmicro.gif' alt='Trend Micro'}' />&nbsp;</td>\n";
573 } elsif ($vendorid =~ /^Apple$/i)
574 {
575 print "<img src='/images/updxl-src-apple.gif' alt='Apple'}' />&nbsp;</td>\n";
576 } elsif ($vendorid =~ /^Avast$/i)
577 {
578 print "<img src='/images/updxl-src-avast.gif' alt='Avast'}' />&nbsp;</td>\n";
579 } else
580 {
581 if (-e "/home/httpd/html/images/updxl-src-" . $vendorid . ".gif")
582 {
583 print "<img src='/images/updxl-src-" . $vendorid . ".gif' alt='" . ucfirst $vendorid . "' />&nbsp;</td>\n";
584 } else {
585 print "<img src='/images/updxl-src-unknown.gif' alt='" . ucfirst $vendorid . "' />&nbsp;</td>\n";
586 }
587 }
588
589 $shortname = substr($updatefile,rindex($updatefile,"/")+1);
590 $shortname =~ s/(.*)_[\da-f]*(\.(exe|cab|psf)$)/$1_*$2/i;
591
592 $filesize = $dlinfo{'REMOTESIZE'};
593 1 while $filesize =~ s/^(-?\d+)(\d{3})/$1.$2/;
594 $dlinfo{'VENDORID'}=ucfirst $vendorid;
595
596 print <<END
597 <td class='base' align='center'>&nbsp;$dlinfo{'VENDORID'}&nbsp;</td>
598 <td class='base' align='left' title='cache:/$updatefile'>$shortname</td>
599 <td class='base' align='right' nowrap='nowrap'>&nbsp;$filesize&nbsp;</td>
600 <td class='base' align='center' nowrap='nowrap'>&nbsp;$filedate&nbsp;</td>
601 <td class='base' align='center' nowrap='nowrap'>
602 END
603 ;
604 my $percent="0%";
605 if ($dlinfo{'REMOTESIZE'} && $size_updatefile)
606 {
607 $percent=int(100 / ($dlinfo{'REMOTESIZE'} / $size_updatefile))."%";
608 }
609 print $percent; &percentbar($percent);
610 print <<END
611 </td>
612 <td align='center'>
613 <form method='post' name='frma$id' action='$ENV{'SCRIPT_NAME'}'>
614 <input type='image' name='$Lang::tr{'updxlrtr cancel download'}' src='/images/delete.gif' title='$Lang::tr{'updxlrtr cancel download'}' alt='$Lang::tr{'updxlrtr cancel download'}' />
615 <input type='hidden' name='ID' value='$updatefile' />
616 <input type='hidden' name='ACTION' value='$Lang::tr{'updxlrtr cancel download'}' />
617 </form>
618 </td>
619 </tr>
620 END
621 ;
622 }
623
624 print "</table>\n<br>\n<table>\n";
625 &printlegenddownload();
626 print "</table>\n";
627
628 &Header::closebox();
629 }
630 }
631 # =====================================================================================
632 # CACHE STATISTICS
633 # =====================================================================================
634
635 if ($xlratorsettings{'EXTENDED_GUI'} eq 'statistics')
636 {
637
638 # ----------------------------------------------------
639 # Get statistics
640 # ----------------------------------------------------
641
642 @sources=();
643 foreach (<$repository/*>)
644 {
645 if (-d $_)
646 {
647 unless ((/^$repository\/download$/) || (/^$repository\/lost\+found$/)) { push(@sources,$_); }
648 }
649 }
650
651 @vendors=();
652 foreach (@sources)
653 {
654 $vendorid=substr($_,rindex($_,'/')+1,length($_));
655 push(@vendors,$vendorid);
656 $vendorstats{$vendorid."_filesize"} = 0;
657 $vendorstats{$vendorid."_requests"} = 0;
658 $vendorstats{$vendorid."_files"} = 0;
659 $vendorstats{$vendorid."_cachehits"} = 0;
660 $vendorstats{$vendorid."_0"} = 0;
661 $vendorstats{$vendorid."_1"} = 0;
662 $vendorstats{$vendorid."_2"} = 0;
663 $vendorstats{$vendorid."_3"} = 0;
664 @updatelist=<$_/*>;
665 foreach $data (@updatelist)
666 {
667 if (-e "$data/source.url")
668 {
669 open (FILE,"$data/source.url");
670 $sourceurl=<FILE>;
671 close FILE;
672 chomp($sourceurl);
673 $updatefile = substr($sourceurl,rindex($sourceurl,'/')+1,length($sourceurl));
674
675 my $size_updatefile = 0;
676 if(-e "$data/$updatefile") {
677 $size_updatefile = (-s "$data/$updatefile");
678 }
679 else
680 {
681 # DEBUG
682 #die "file not found: $data/$updatefile\n";
683 }
684 #
685 # Total file size
686 #
687 $filesize += $size_updatefile;
688 #
689 # File size for this source
690 #
691 $vendorstats{$vendorid."_filesize"} += $size_updatefile;
692 #
693 # Number of requests from cache for this source
694 #
695 open (FILE,"$data/access.log");
696 @requests=<FILE>;
697 close FILE;
698 chomp(@requests);
699 $counts = @requests;
700 $counts--;
701 $vendorstats{$vendorid."_requests"} += $counts;
702 $cachehits += $counts;
703 #
704 # Total number of files in cache
705 #
706 $numfiles++;
707 #
708 # Number of files for this source
709 #
710 $vendorstats{$vendorid."_files"}++;
711 #
712 # Count cache status occurences
713 #
714 open (FILE,"$data/status");
715 $_=<FILE>;
716 close FILE;
717 chomp;
718 $vendorstats{$vendorid."_".$_}++;
719 #
720 # Calculate cached traffic for this source
721 #
722 $vendorstats{$vendorid."_cachehits"} += $counts * $size_updatefile;
723 #
724 # Calculate total cached traffic
725 #
726 $cachedtraffic += $counts * $size_updatefile;
727
728 }
729 }
730 }
731
732 if ($numfiles) { $efficiency = sprintf("%.1f", $cachehits / $numfiles); }
733
734 1 while $filesize =~ s/^(-?\d+)(\d{3})/$1.$2/;
735 1 while $cachedtraffic =~ s/^(-?\d+)(\d{3})/$1.$2/;
736
737 # ----------------------------------------------------
738 # Show statistics
739 # ----------------------------------------------------
740
741 &Header::openbox('100%', 'left', "$Lang::tr{'updxlrtr cache statistics'}");
742
743 unless ($numfiles) { print "<i>$Lang::tr{'updxlrtr empty repository'}</i>\n<hr size='1'>\n"; }
744
745 print <<END
746 <table>
747 <tr><td class='boldbase'><b>$Lang::tr{'updxlrtr disk usage'}</b></td></tr>
748 </table>
749 <table cellpadding='3'>
750 <tr>
751 <td align='left' class='base'><i>$Lang::tr{'updxlrtr cache dir'}</i></td>
752 <td align='center' class='base'><i>$Lang::tr{'size'}</i></td>
753 <td align='center' class='base'><i>$Lang::tr{'used'}</i></td>
754 <td align='center' class='base'><i>$Lang::tr{'free'}</i></td>
755 <td align='left' class='base' colspan='2'><i>$Lang::tr{'percentage'}</i></td>
756 </tr>
757 END
758 ;
759
760 open(DF,"/bin/df -h $repository|");
761 @dfdata = <DF>;
762 close DF;
763 shift(@dfdata);
764 chomp(@dfdata);
765 $dfstr = join(' ',@dfdata);
766 my ($device,$size,$used,$free,$percent,$mount) = split(' ',$dfstr);
767
768 print <<END
769 <tr>
770 <td>[$repository]</td>
771 <td align='right'>$size</td>
772 <td align='right'>$used</td>
773 <td align='right'>$free</td>
774 <td>
775 END
776 ;
777 &percentbar($percent);
778 print <<END
779 </td>
780 <td align='right'>$percent</td>
781 </tr>
782 </table>
783 END
784 ;
785
786 if ($numfiles)
787 {
788 print <<END
789 <hr size='1'>
790 <table width='100%'>
791 <tr>
792 <td colspan='5'><b>$Lang::tr{'updxlrtr summary'}</b></td>
793 </tr>
794 <tr>
795 <td class='base' width='25%'>$Lang::tr{'updxlrtr total files'}:</td>
796 <td class='base' width='20%'><font color='$colourgray'>$numfiles</font></td>
797 <td class='base' width='25%'>$Lang::tr{'updxlrtr total cache size'}:</td>
798 <td class='base' width='15%' align='right'><font color='$colourgray'>$filesize</font></td>
799 <td class='base'></td>
800 </tr>
801 <tr>
802 <td class='base'>$Lang::tr{'updxlrtr efficiency index'}:</td>
803 <td class='base'><font color='$colourgray'>$efficiency</font></td>
804 <td class='base'>$Lang::tr{'updxlrtr total data from cache'}:</td>
805 <td class='base' align='right'><font color='$colourgray'>$cachedtraffic</font></td>
806 <td class='base'></td>
807 </tr>
808 </table>
809 <hr size='1'>
810 <table>
811 <tr>
812 <td colspan='17'><b>$Lang::tr{'updxlrtr statistics by source'}</b></td>
813 </tr>
814 <tr>
815 <td class='base' colspan='2'><i>$Lang::tr{'updxlrtr source'}</i></td>
816 <td class='base' width='7%'>&nbsp;</td>
817 <td class='base' align='right'><i>$Lang::tr{'updxlrtr files'}</i></td>
818 <td class='base' width='7%'>&nbsp;</td>
819 <td class='base' align='right'><nobr><i>$Lang::tr{'updxlrtr cache size'}</i></nobr></td>
820 <td class='base' width='7%'>&nbsp;</td>
821 <td class='base' align='right'><nobr><i>$Lang::tr{'updxlrtr data from cache'}</i></nobr></td>
822 <td class='base' width='15%'>&nbsp;</td>
823 <td class='base'><img src="/images/updbooster/updxl-led-green.gif" /></td>
824 <td class='base' width='15%'>&nbsp;</td>
825 <td class='base'><img src="/images/updbooster/updxl-led-yellow.gif" /></td>
826 <td class='base' width='15%'>&nbsp;</td>
827 <td class='base'><img src="/images/updbooster/updxl-led-red.gif" /></td>
828 <td class='base' width='15%'>&nbsp;</td>
829 <td class='base'><img src="/images/updbooster/updxl-led-gray.gif" /></td>
830 <td class='base' width='90%'>&nbsp;</td>
831 </tr>
832 END
833 ;
834
835 $id = 0;
836
837 foreach (@vendors)
838 {
839 $vendorid = $_;
840
841 unless ($vendorstats{$vendorid . "_files"}) { next; }
842
843 $id++;
844 if ($id % 2) {
845 print "<tr bgcolor=''$color{'color20'}'>\n"; }
846 else {
847 print "<tr bgcolor=''$color{'color22'}'>\n"; }
848
849 print "<td class='base' align='center'><nobr>&nbsp;";
850
851 if ($vendorid =~ /^Adobe$/i)
852 {
853 print "<img src='/images/updbooster/updxl-src-adobe.gif' alt='Adobe'}' />&nbsp;</nobr></td>\n";
854 print "<td class='base'>&nbsp;Adobe&nbsp;</td>\n";
855 } elsif ($vendorid =~ /^Microsoft$/i)
856 {
857 print "<img src='/images/updbooster/updxl-src-windows.gif' alt='Microsoft'}' />&nbsp;</nobr></td>\n";
858 print "<td class='base'>&nbsp;Microsoft&nbsp;</td>\n";
859 } elsif ($vendorid =~ /^Symantec$/i)
860 {
861 print "<img src='/images/updbooster/updxl-src-symantec.gif' alt='Symantec'}' />&nbsp;</nobr></td>\n";
862 print "<td class='base'>&nbsp;Symantec&nbsp;</td>\n";
863 } elsif ($vendorid =~ /^Linux$/i)
864 {
865 print "<img src='/images/updbooster/updxl-src-linux.gif' alt='Linux'}' />&nbsp;</nobr></td>\n";
866 print "<td class='base'>&nbsp;Linux&nbsp;</td>\n";
867 } elsif ($vendorid =~ /^TrendMicro$/i)
868 {
869 print "<img src='/images/updbooster/updxl-src-trendmicro.gif' alt='Trend Micro'}' />&nbsp;</nobr></td>\n";
870 print "<td class='base'>&nbsp;Trend&nbsp;Micro&nbsp;</td>\n";
871 } elsif ($vendorid =~ /^Apple$/i)
872 {
873 print "<img src='/images/updbooster/updxl-src-apple.gif' alt='Apple'}' />&nbsp;</nobr></td>\n";
874 print "<td class='base'>&nbsp;Apple&nbsp;</td>\n";
875 } elsif ($vendorid =~ /^Avast$/i)
876 {
877 print "<img src='/images/updbooster/updxl-src-avast.gif' alt='Avast'}' />&nbsp;</nobr></td>\n";
878 print "<td class='base'>&nbsp;Avast&nbsp;</td>\n";
879 } elsif ($vendorid =~ /^Avira$/i)
880 {
881 print "<img src='/images/updbooster/updxl-src-avira.gif' alt='Avira' />&nbsp;</td>\n";
882 print "<td class='base'>&nbsp;Avira&nbsp;</td>\n";
883 } elsif ($vendorid =~ /^AVG$/i)
884 {
885 print "<img src='/images/updbooster/updxl-src-avg.gif' alt='AVG' />&nbsp;</td>\n";
886 print "<td class='base'>&nbsp;AVG&nbsp;</td>\n";
887 } elsif ($vendorid =~ /^Ipfire$/i)
888 {
889 print "<img src='/images/IPFire.png' width='18' height='18' alt='IPFire' />&nbsp;</td>\n";
890 print "<td class='base'>&nbsp;IPFire&nbsp;</td>\n";
891 } else
892 {
893 if (-e "/srv/web/ipfire/html/images/updbooster/updxl-src-" . $vendorid . ".gif")
894 {
895 print "<img src='/images/updbooster/updxl-src-" . $vendorid . ".gif' alt='" . ucfirst $vendorid . "' />&nbsp;</nobr></td>\n";
896 } else {
897 print "<img src='/images/updbooster/updxl-src-unknown.gif' alt='" . ucfirst $vendorid . "' />&nbsp;</nobr></td>\n";
898 }
899 print "<td class='base'>&nbsp;" . ucfirst $vendorid . "&nbsp;</td>\n";
900 }
901
902 print "<td class='base' colspan=2 align='right'>";
903 printf "%5d", $vendorstats{$vendorid."_files"};
904 print "&nbsp;</td>\n";
905
906 unless ($vendorstats{$vendorid."_filesize"}) { $vendorstats{$vendorid."_filesize"} = '0'; }
907 1 while $vendorstats{$vendorid."_filesize"} =~ s/^(-?\d+)(\d{3})/$1.$2/;
908 print "<td class='base' colspan=2 align='right'>";
909 printf "%15s", $vendorstats{$vendorid."_filesize"};
910 print "&nbsp;</td>\n";
911
912 unless ($vendorstats{$vendorid."_cachehits"}) { $vendorstats{$vendorid."_cachehits"} = '0'; }
913 1 while $vendorstats{$vendorid."_cachehits"} =~ s/^(-?\d+)(\d{3})/$1.$2/;
914 print "<td class='base' colspan=2 align='right'>";
915 printf "%15s", $vendorstats{$vendorid."_cachehits"};
916 print "&nbsp;</td>\n";
917
918 print "<td class='base' colspan=2 align='right'>";
919 printf "%5d", $vendorstats{$vendorid."_1"};
920 print "&nbsp;&nbsp;</td>\n";
921
922 print "<td class='base' colspan=2 align='right'>";
923 printf "%5d", $vendorstats{$vendorid."_3"};
924 print "&nbsp;&nbsp;</td>\n";
925
926 print "<td class='base' colspan=2 align='right'>";
927 printf "%5d", $vendorstats{$vendorid."_2"};
928 print "&nbsp;&nbsp;</td>\n";
929
930 print "<td class='base' colspan=2 align='right'>";
931 printf "%5d", $vendorstats{$vendorid."_0"};
932 print "&nbsp;&nbsp;</td>\n";
933
934 print "<td class='base'>&nbsp;</td>\n";
935 print "</tr>\n";
936 }
937
938 print "</table>\n";
939
940 print <<END
941 <br>
942 <table>
943 <tr>
944 <td class='boldbase'>&nbsp; <b>$Lang::tr{'legend'}:</b></td>
945 <td class='base'>&nbsp;</td>
946 <td align='center'><img src='/images/updbooster/updxl-led-green.gif' alt='$Lang::tr{'updxlrtr condition ok'}' /></td>
947 <td class='base'>$Lang::tr{'updxlrtr condition ok'}</td>
948 <td class='base'>&nbsp;&nbsp;&nbsp;</td>
949 <td align='center'><img src='/images/updbooster/updxl-led-yellow.gif' alt='$Lang::tr{'updxlrtr condition nosource'}' /></td>
950 <td class='base'>$Lang::tr{'updxlrtr condition nosource'}</td>
951 <td class='base'>&nbsp;&nbsp;&nbsp;</td>
952 <td align='center'><img src='/images/updbooster/updxl-led-red.gif' alt='$Lang::tr{'updxlrtr condition outdated'}' /></td>
953 <td class='base'>$Lang::tr{'updxlrtr condition outdated'}</td>
954 <td class='base'>&nbsp;&nbsp;&nbsp;</td>
955 <td align='center'><img src='/images/updbooster/updxl-led-gray.gif' alt='$Lang::tr{'updxlrtr condition unknown'}' /></td>
956 <td class='base'>$Lang::tr{'updxlrtr condition unknown'}</td>
957 <td class='base'>&nbsp;&nbsp;&nbsp;</td>
958 </tr>
959 </table>
960 END
961 ;
962
963 }
964
965 &Header::closebox();
966
967 }
968
969 # =====================================================================================
970 # CACHE MAINTENANCE
971 # =====================================================================================
972
973 if ($xlratorsettings{'EXTENDED_GUI'} eq 'maintenance')
974 {
975
976
977 # ----------------------------------------------------
978 # File list dialog
979 # ----------------------------------------------------
980
981 &Header::openbox('100%', 'left', "$Lang::tr{'updxlrtr cache maintenance'}");
982
983 @sources= <$repository/download/*>;
984
985 undef @repositoryfiles;
986 foreach (@sources)
987 {
988 if (-d)
989 {
990 @updatelist = <$_/*>;
991 $vendorid = substr($_,rindex($_,"/")+1);
992 foreach(@updatelist)
993 {
994 next if(/\.info$/);
995 $updatefile = substr($_,rindex($_,"/")+1);
996 $updatefile .= ":download/$vendorid/$updatefile";
997 $updatefile = " ".$updatefile;
998 push(@repositoryfiles,$updatefile);
999 }
1000 }
1001 }
1002
1003 undef (@sources);
1004 foreach (<$repository/*>)
1005 {
1006 if (-d $_)
1007 {
1008 unless (/^$repository\/download$/) { push(@sources,$_); }
1009 }
1010 }
1011
1012 foreach (@sources)
1013 {
1014 @updatelist=<$_/*>;
1015 $vendorid = substr($_,rindex($_,"/")+1);
1016 foreach(@updatelist)
1017 {
1018 $uuid = substr($_,rindex($_,"/")+1);
1019 if (-e "$_/source.url")
1020 {
1021 open (FILE,"$_/source.url");
1022 $sourceurl=<FILE>;
1023 close FILE;
1024 chomp($sourceurl);
1025 $updatefile = substr($sourceurl,rindex($sourceurl,'/')+1,length($sourceurl));
1026 $_ = $updatefile; tr/[A-Z]/[a-z]/;
1027 $updatefile = "$_:$vendorid/$uuid/$updatefile";
1028 push(@repositoryfiles,$updatefile);
1029 }
1030 }
1031 }
1032
1033 @repositoryfiles = sort(@repositoryfiles);
1034
1035 unless (@repositoryfiles) { print "<i>$Lang::tr{'updxlrtr empty repository'}</i>\n<hr size='1'>\n"; }
1036
1037 print <<END
1038 <table>
1039 <tr><td class='boldbase'><b>$Lang::tr{'updxlrtr disk usage'}</b></td></tr>
1040 </table>
1041 <table cellpadding='3'>
1042 <tr>
1043 <td align='left' class='base'><i>$Lang::tr{'updxlrtr cache dir'}</i></td>
1044 <td align='center' class='base'><i>$Lang::tr{'size'}</i></td>
1045 <td align='center' class='base'><i>$Lang::tr{'used'}</i></td>
1046 <td align='center' class='base'><i>$Lang::tr{'free'}</i></td>
1047 <td align='left' class='base' colspan='2'><i>$Lang::tr{'percentage'}</i></td>
1048 </tr>
1049 END
1050 ;
1051
1052 open(DF,"/bin/df -h $repository|");
1053 @dfdata = <DF>;
1054 close DF;
1055 shift(@dfdata);
1056 chomp(@dfdata);
1057 $dfstr = join(' ',@dfdata);
1058 my ($device,$size,$used,$free,$percent,$mount) = split(' ',$dfstr);
1059
1060 print <<END
1061 <tr>
1062 <td>[$repository]</td>
1063 <td align='right'>$size</td>
1064 <td align='right'>$used</td>
1065 <td align='right'>$free</td>
1066 <td>
1067 END
1068 ;
1069 &percentbar($percent);
1070 print <<END
1071 </td>
1072 <td align='right'>$percent</td>
1073 </tr>
1074 </table>
1075 END
1076 ;
1077
1078 if (@repositoryfiles)
1079 {
1080 print <<END
1081 <hr size='1'>
1082 <form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1083 <table width='100%'>
1084 <tr>
1085 <td class='base' colspan='3'><input type='submit' name='ACTION' value='$Lang::tr{'updxlrtr purge'}' /> &nbsp;$Lang::tr{'updxlrtr all files'}</td>
1086 <td class='base' width='25%'>
1087 <input type='checkbox' name='REMOVE_OBSOLETE' $checked{'REMOVE_OBSOLETE'}{'on'} />&nbsp;$Lang::tr{'updxlrtr not accessed'}
1088 </td>
1089 <td class='base' colspan='3'>
1090 <select name='NOT_ACCESSED_LAST'>
1091 <option value='week' $selected{'NOT_ACCESSED_LAST'}{'week'}>$Lang::tr{'updxlrtr week'}</option>
1092 <option value='month1' $selected{'NOT_ACCESSED_LAST'}{'month1'}>$Lang::tr{'updxlrtr month'}</option>
1093 <option value='month3' $selected{'NOT_ACCESSED_LAST'}{'month3'}>$Lang::tr{'updxlrtr 3 months'}</option>
1094 <option value='month6' $selected{'NOT_ACCESSED_LAST'}{'month6'}>$Lang::tr{'updxlrtr 6 months'}</option>
1095 <option value='year' $selected{'NOT_ACCESSED_LAST'}{'year'}>$Lang::tr{'updxlrtr year'}</option>
1096 </select>
1097 </td>
1098 </tr>
1099 <tr>
1100 </tr>
1101 <tr>
1102 <td class='base' width='25%'>
1103 <input type='checkbox' name='REMOVE_NOSOURCE' $checked{'REMOVE_NOSOURCE'}{'on'} />&nbsp;$Lang::tr{'updxlrtr marked as'}
1104 </td>
1105 <td class='base' width='3%'><img src='/images/updbooster/updxl-led-yellow.gif' alt='$Lang::tr{'updxlrtr condition nosource'}' /></td>
1106 <td class='base' width='17%'>[<i>$Lang::tr{'updxlrtr condition nosource'}</i>]</td>
1107 <td class='base' width='25%'>
1108 <input type='checkbox' name='REMOVE_OUTDATED' $checked{'REMOVE_OUTDATED'}{'on'} />&nbsp;$Lang::tr{'updxlrtr marked as'}
1109 </td>
1110 <td class='base' width='3%'><img src='/images/updbooster/updxl-led-red.gif' alt='$Lang::tr{'updxlrtr condition outdated'}' /></td>
1111 <td class='base' width='27%'>[<i>$Lang::tr{'updxlrtr condition outdated'}</i>]</td>
1112 </tr>
1113 </table>
1114 </form>
1115 <hr size='1'>
1116 END
1117 ;
1118
1119 &printcurrentfiles($Lang::tr{'updxlrtr current files'}, @repositoryfiles);
1120 print "<br>\n<table>\n";
1121 &printlegendicons();
1122 &printlegendspacer();
1123 &printlegendstatus();
1124 &printlegendspacer();
1125 &printlegendsource();
1126 print "</table>\n";
1127 }
1128
1129 &Header::closebox();
1130
1131 }
1132
1133 # =====================================================================================
1134
1135 &Header::closebigbox();
1136
1137 &Header::closepage();
1138
1139 # -------------------------------------------------------------------
1140
1141 sub printcurrentfiles
1142 {
1143 my $title = shift;
1144 my @files = @_;
1145
1146 print <<END
1147 <table>
1148 <tr><td class='boldbase'><b>$Lang::tr{'updxlrtr current files'}</b></td></tr>
1149 </table>
1150 <table width='100%'>
1151 <colgroup span='2' width='2%'></colgroup>
1152 <colgroup span='1' width='0*'></colgroup>
1153 <colgroup span='4' width='5%'></colgroup>
1154 <colgroup span='1' width='2%'></colgroup>
1155 <tr>
1156 <td class='base' align='center'>&nbsp;</td>
1157 <td class='base' align='center'>&nbsp;</td>
1158 <td class='base' align='center'><i>$Lang::tr{'updxlrtr filename'}</i></td>
1159 <td class='base' align='center'><i>$Lang::tr{'updxlrtr filesize'}</i></td>
1160 <td class='base' align='center'><i>$Lang::tr{'date'}</i></td>
1161 <td class='base' align='center'><img src='/images/reload.gif' alt='$Lang::tr{'updxlrtr last access'}' /></td>
1162 <td class='base' align='center'><img src='/images/updbooster/updxl-globe.gif' alt='$Lang::tr{'updxlrtr last checkup'}' /></td>
1163 <td class='base' align='center'>&nbsp;</td>
1164 </tr>
1165 END
1166 ;
1167 $id = 0;
1168 foreach $updatefile (@files)
1169 {
1170 $updatefile =~ s/.*://;
1171 my $size_updatefile = 0;
1172 my $mtime = 0;
1173 if(-e "$repository/$updatefile") {
1174 $size_updatefile = (-s "$repository/$updatefile");
1175 $mtime = &getmtime("$repository/$updatefile");
1176 }
1177
1178 $id++;
1179 if ($id % 2) {
1180 print "<tr bgcolor='$Header::table1colour'>\n"; }
1181 else {
1182 print "<tr bgcolor='$Header::table2colour'>\n"; }
1183
1184 $filesize = $size_updatefile;
1185 1 while $filesize =~ s/^(-?\d+)(\d{3})/$1.$2/;
1186
1187 my ($SECdt,$MINdt,$HOURdt,$DAYdt,$MONTHdt,$YEARdt) = localtime($mtime);
1188 $DAYdt = sprintf ("%.02d",$DAYdt);
1189 $MONTHdt = sprintf ("%.02d",$MONTHdt+1);
1190 $YEARdt = sprintf ("%.04d",$YEARdt+1900);
1191 $filedate = $YEARdt."-".$MONTHdt."-".$DAYdt;
1192
1193 $lastaccess = "n/a";
1194 $lastcheck = "n/a";
1195
1196 $status = $sfUnknown;
1197
1198 unless ($updatefile =~ /^download\//)
1199 {
1200 ($vendorid,$uuid,$shortname) = split('/',$updatefile);
1201
1202 if (-e "$repository/$vendorid/$uuid/access.log")
1203 {
1204 open (FILE,"$repository/$vendorid/$uuid/access.log");
1205 @metadata = <FILE>;
1206 close(FILE);
1207 chomp @metadata;
1208
1209 ($SECdt,$MINdt,$HOURdt,$DAYdt,$MONTHdt,$YEARdt) = localtime($metadata[-1]);
1210 $DAYdt = sprintf ("%.02d",$DAYdt);
1211 $MONTHdt = sprintf ("%.02d",$MONTHdt+1);
1212 $YEARdt = sprintf ("%.04d",$YEARdt+1900);
1213 if (($metadata[-1] =~ /^\d+/) && ($metadata[-1] >= 1)) { $lastaccess = $YEARdt."-".$MONTHdt."-".$DAYdt; }
1214 }
1215 if (-e "$repository/$vendorid/$uuid/checkup.log")
1216 {
1217 open (FILE,"$repository/$vendorid/$uuid/checkup.log");
1218 @metadata = <FILE>;
1219 close(FILE);
1220 chomp @metadata;
1221
1222 ($SECdt,$MINdt,$HOURdt,$DAYdt,$MONTHdt,$YEARdt) = localtime($metadata[-1]);
1223 $DAYdt = sprintf ("%.02d",$DAYdt);
1224 $MONTHdt = sprintf ("%.02d",$MONTHdt+1);
1225 $YEARdt = sprintf ("%.04d",$YEARdt+1900);
1226 if (($metadata[-1] =~ /^\d+/) && ($metadata[-1] >= 1)) { $lastcheck = $YEARdt."-".$MONTHdt."-".$DAYdt; }
1227 }
1228 if (-e "$repository/$vendorid/$uuid/status")
1229 {
1230 open (FILE,"$repository/$vendorid/$uuid/status");
1231 @metadata = <FILE>;
1232 close(FILE);
1233 chomp @metadata;
1234 $status = $metadata[-1];
1235 }
1236 } else {
1237 ($uuid,$vendorid,$shortname) = split('/',$updatefile);
1238 $status = $sfOutdated;
1239 }
1240
1241 print "\t\t<td align='center' nowrap='nowrap'>&nbsp;";
1242 if ($status == $sfUnknown)
1243 {
1244 print "<img src='/images/updbooster/updxl-led-gray.gif' alt='$Lang::tr{'updxlrtr condition unknown'}' />&nbsp;</td>\n";
1245 }
1246 if ($status == $sfOk)
1247 {
1248 print "<img src='/images/updbooster/updxl-led-green.gif' alt='$Lang::tr{'updxlrtr condition ok'}' />&nbsp;</td>\n";
1249 }
1250 if ($status == $sfNoSource)
1251 {
1252 print "<img src='/images/updbooster/updxl-led-yellow.gif' alt='$Lang::tr{'updxlrtr condition nosource'}' />&nbsp;</td>\n";
1253 }
1254 if (($status == $sfOutdated) && (!($updatefile =~ /^download\//i)))
1255 {
1256 print "<img src='/images/updbooster/updxl-led-red.gif' alt='$Lang::tr{'updxlrtr condition outdated'}' />&nbsp;</td>\n";
1257 }
1258 if (($status == $sfOutdated) && ($updatefile =~ /^download\//i))
1259 {
1260 print "<img src='/images/updbooster/updxl-led-blue.gif' alt='$Lang::tr{'updxlrtr condition download'}' />&nbsp;</td>\n";
1261 }
1262
1263 print "\t\t<td align='center' nowrap='nowrap'>&nbsp;";
1264 if ($vendorid =~ /^Adobe$/i)
1265 {
1266 print "<img src='/images/updbooster/updxl-src-adobe.gif' alt='Adobe'}' />&nbsp;</td>\n";
1267 } elsif ($vendorid =~ /^Microsoft$/i)
1268 {
1269 print "<img src='/images/updbooster/updxl-src-windows.gif' alt='Microsoft'}' />&nbsp;</td>\n";
1270 } elsif ($vendorid =~ /^Symantec$/i)
1271 {
1272 print "<img src='/images/updbooster/updxl-src-symantec.gif' alt='Symantec'}' />&nbsp;</td>\n";
1273 } elsif ($vendorid =~ /^Linux$/i)
1274 {
1275 print "<img src='/images/updbooster/updxl-src-linux.gif' alt='Linux'}' />&nbsp;</td>\n";
1276 } elsif ($vendorid =~ /^TrendMicro$/i)
1277 {
1278 print "<img src='/images/updbooster/updxl-src-trendmicro.gif' alt='Trend Micro'}' />&nbsp;</td>\n";
1279 } elsif ($vendorid =~ /^Apple$/i)
1280 {
1281 print "<img src='/images/updbooster/updxl-src-apple.gif' alt='Apple'}' />&nbsp;</td>\n";
1282 } elsif ($vendorid =~ /^Avast$/i)
1283 {
1284 print "<img src='/images/updbooster/updxl-src-avast.gif' alt='Avast'}' />&nbsp;</td>\n";
1285 } elsif ($vendorid =~ /^Avira$/i)
1286 {
1287 print "<img src='/images/updbooster/updxl-src-avira.gif' alt='Avira' />&nbsp;</td>\n";
1288 } elsif ($vendorid =~ /^AVG$/i)
1289 {
1290 print "<img src='/images/updbooster/updxl-src-avg.gif' alt='AVG' />&nbsp;</td>\n";
1291 } elsif ($vendorid =~ /^Ipfire$/i)
1292 {
1293 print "<img src='/images/IPFire.png' width='18' height='18' alt='IPFire' />&nbsp;</td>\n";
1294 }
1295 else
1296 {
1297 if (-e "/srv/web/ipfire/html/images/updbooster/updxl-src-" . $vendorid . ".gif")
1298 {
1299 print "<img src='/images/updbooster/updxl-src-" . $vendorid . ".gif' alt='" . ucfirst $vendorid . "' />&nbsp;</td>\n";
1300 } else {
1301 print "<img src='/images/updbooster/updxl-src-unknown.gif' alt='" . ucfirst $vendorid . "' />&nbsp;</td>\n";
1302 }
1303 }
1304
1305 $shortname = substr($updatefile,rindex($updatefile,"/")+1);
1306 $shortname =~ s/(.*)_[\da-f]*(\.(exe|cab|psf)$)/$1_*$2/i;
1307
1308 print <<END
1309 <td class='base' align='left' title='cache:/$updatefile'><a href="/updatecache/$updatefile">$shortname</a></td>
1310 <td class='base' align='right' nowrap='nowrap'>&nbsp;$filesize&nbsp;</td>
1311 <td class='base' align='center' nowrap='nowrap'>&nbsp;$filedate&nbsp;</td>
1312 <td class='base' align='center' nowrap='nowrap'>&nbsp;$lastaccess&nbsp;</td>
1313 <td class='base' align='center' nowrap='nowrap'>&nbsp;$lastcheck&nbsp;</td>
1314 <td align='center'>
1315 <form method='post' name='frma$id' action='$ENV{'SCRIPT_NAME'}'>
1316 <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'}' />
1317 <input type='hidden' name='ID' value='$updatefile' />
1318 <input type='hidden' name='ACTION' value='$Lang::tr{'updxlrtr remove file'}' />
1319 </form>
1320 </td>
1321 </tr>
1322 END
1323 ;
1324 }
1325
1326 print "</table>\n";
1327
1328 }
1329
1330 # -------------------------------------------------------------------
1331
1332 sub printlegenddownload
1333 {
1334 print <<END
1335 <tr>
1336 <td class='boldbase'>&nbsp; <b>$Lang::tr{'legend'}:</b></td>
1337 <td class='base'>&nbsp;</td>
1338 <td><img src='/images/updbooster/updxl-led-blue.gif' alt='$Lang::tr{'updxlrtr condition download'}' /></td>
1339 <td class='base'>$Lang::tr{'updxlrtr condition download'}</td>
1340 <td class='base'>&nbsp;</td>
1341 <td class='base'>&nbsp;</td>
1342 <td><img src='/images/updbooster/updxl-led-gray.gif' alt='$Lang::tr{'updxlrtr condition suspended'}' /></td>
1343 <td class='base'>$Lang::tr{'updxlrtr condition suspended'}</td>
1344 <td class='base'>&nbsp;</td>
1345 <td class='base'>&nbsp;</td>
1346 <td><img src='/images/delete.gif' alt='$Lang::tr{'updxlrtr cancel download'}' /></td>
1347 <td class='base'>$Lang::tr{'updxlrtr cancel download'}</td>
1348 </tr>
1349 END
1350 ;
1351 }
1352
1353 # -------------------------------------------------------------------
1354
1355 sub printlegendicons
1356 {
1357 print <<END
1358
1359
1360
1361 <tr>
1362 <td class='boldbase'>&nbsp; <b>$Lang::tr{'legend'}:</b></td>
1363 <td class='base'>&nbsp;</td>
1364 <td><img src='/images/reload.gif' alt='$Lang::tr{'updxlrtr last access'}' /></td>
1365 <td class='base'>$Lang::tr{'updxlrtr last access'}</td>
1366 <td class='base'>&nbsp;</td>
1367 <td><img src='/images/updbooster/updxl-globe.gif' alt='$Lang::tr{'updxlrtr last checkup'}' /></td>
1368 <td class='base'>$Lang::tr{'updxlrtr last checkup'}</td>
1369 <td class='base'>&nbsp;</td>
1370 <td><img src='/images/updbooster/delete.gif' alt='$Lang::tr{'updxlrtr remove file'}' /></td>
1371 <td class='base'>$Lang::tr{'updxlrtr remove file'}</td>
1372 <td class='base'>&nbsp;</td>
1373 <td class='base'>&nbsp;</td>
1374 <td class='base'>&nbsp;</td>
1375 </tr>
1376 END
1377 ;
1378 }
1379
1380 # -------------------------------------------------------------------
1381
1382 sub printlegendstatus
1383 {
1384 print <<END
1385 <tr>
1386 <td class='base'>&nbsp; $Lang::tr{'status'}:</td>
1387 <td class='base'>&nbsp;</td>
1388 <td align='center'><img src='/images/updbooster/updxl-led-green.gif' alt='$Lang::tr{'updxlrtr condition ok'}' /></td>
1389 <td class='base'>$Lang::tr{'updxlrtr condition ok'}</td>
1390 <td class='base'>&nbsp;</td>
1391 <td align='center'><img src='/images/updbooster/updxl-led-yellow.gif' alt='$Lang::tr{'updxlrtr condition nosource'}' /></td>
1392 <td class='base'>$Lang::tr{'updxlrtr condition nosource'}</td>
1393 <td class='base'>&nbsp;</td>
1394 <td align='center'><img src='/images/updbooster/updxl-led-red.gif' alt='$Lang::tr{'updxlrtr condition outdated'}' /></td>
1395 <td class='base'>$Lang::tr{'updxlrtr condition outdated'}</td>
1396 <td class='base'>&nbsp;</td>
1397 <td class='base'>&nbsp;</td>
1398
1399 <td class='base'>&nbsp;</td>
1400 </tr>
1401 <tr>
1402 <td class='base'>&nbsp;</td>
1403 <td class='base'>&nbsp;</td>
1404 <td align='center'><img src='/images/updbooster/updxl-led-blue.gif' alt='$Lang::tr{'updxlrtr condition download'}' /></td>
1405 <td class='base'>$Lang::tr{'updxlrtr condition download'}</td>
1406 <td class='base'>&nbsp;</td>
1407 <td align='center'><img src='/images/updbooster/updxl-led-gray.gif' alt='$Lang::tr{'updxlrtr condition unknown'}' /></td>
1408 <td class='base'>$Lang::tr{'updxlrtr condition unknown'}</td>
1409 <td class='base'>&nbsp;</td>
1410 <td class='base'>&nbsp;</td>
1411 <td class='base'>&nbsp;</td>
1412 <td class='base'>&nbsp;</td>
1413 <td class='base'>&nbsp;</td>
1414
1415 <td class='base'>&nbsp;</td>
1416 </tr>
1417 END
1418 ;
1419 }
1420
1421 # -------------------------------------------------------------------
1422
1423 sub printlegendsource
1424 {
1425 print <<END
1426 <tr>
1427
1428
1429
1430 <td class='base'>&nbsp; $Lang::tr{'updxlrtr source'}:</td>
1431 <td class='base'>&nbsp;</td>
1432 <td align='center'><img src='/images/updbooster/updxl-src-adobe.gif' alt='Adobe' /></td>
1433 <td class='base'>Adobe</td>
1434 <td class='base'>&nbsp;</td>
1435 <td align='center'><img src='/images/updbooster/updxl-src-apple.gif' alt='Apple' /></td>
1436 <td class='base'>Apple</td>
1437 <td class='base'>&nbsp;</td>
1438 <td align='center'><img src='/images/updbooster/updxl-src-avast.gif' alt='Avast' /></td>
1439 <td class='base'>Avast</td>
1440 <td class='base'>&nbsp;</td>
1441 <td align='center'><img src='/images/updbooster/updxl-src-linux.gif' alt='Linux' /></td>
1442 <td class='base'>Linux</td>
1443 </tr>
1444 <tr>
1445 <td colspan='13'></td>
1446 </tr>
1447 <tr>
1448 <td class='base'>&nbsp;</td>
1449 <td class='base'>&nbsp;</td>
1450 <td align='center'><img src='/images/updbooster/updxl-src-windows.gif' alt='Microsoft' /></td>
1451 <td class='base'>Microsoft</td>
1452 <td class='base'>&nbsp;</td>
1453 <td align='center'><img src='/images/updbooster/updxl-src-symantec.gif' alt='Symantec' /></td>
1454 <td class='base'>Symantec</td>
1455 <td class='base'>&nbsp;</td>
1456 <td align='center'><img src='/images/updbooster/updxl-src-trendmicro.gif' alt='Trend Micro' /></td>
1457 <td class='base'>Trend Micro</td>
1458 <td class='base'>&nbsp;</td>
1459 <td align='center'><img src='/images/IPFire.png' width='18' height='18' alt='IPFire' /></td>
1460 <td class='base'>IPFire</td>
1461 </tr>
1462 <tr>
1463 <td class='base'>&nbsp;</td>
1464 <td class='base'>&nbsp;</td>
1465 <td align='center'><img src='/images/updbooster/updxl-src-avira.gif' alt='Avira' /></td>
1466 <td class='base'>Avira</td>
1467 <td class='base'>&nbsp;</td>
1468 <td align='center'><img src='/images/updbooster/updxl-src-avg.gif' alt='AVG' /></td>
1469 <td class='base'>AVG</td>
1470 <td class='base'>&nbsp;</td>
1471 <td align='center'><img src='/images/updbooster/updxl-src-unknown.gif' alt='$Lang::tr{'updxlrtr other'}' /></td>
1472 <td class='base'>$Lang::tr{'updxlrtr other'}</td>
1473 <td class='base'>&nbsp;</td>
1474 <td align='center'></td>
1475 <td class='base'>&nbsp;</td>
1476 </tr>
1477
1478 END
1479 ;
1480
1481 }
1482
1483 # -------------------------------------------------------------------
1484
1485 sub printlegendspacer
1486 {
1487 print <<END
1488 <tr>
1489 <td colspan='13'>&nbsp;<br></td>
1490 </tr>
1491 END
1492 ;
1493 }
1494
1495 # -------------------------------------------------------------------
1496
1497 sub savesettings
1498 {
1499 if (-e $chk_cron_dly) { unlink($chk_cron_dly); }
1500 if (-e $chk_cron_wly) { unlink($chk_cron_wly); }
1501 if (-e $chk_cron_mly) { unlink($chk_cron_mly); }
1502
1503 if (($xlratorsettings{'ENABLE_AUTOCHECK'} eq 'on') && ($xlratorsettings{'AUTOCHECK_SCHEDULE'} eq 'daily'))
1504 {
1505 symlink("../bin/checkup",$chk_cron_dly)
1506 } else {
1507 symlink("/bin/false",$chk_cron_dly)
1508 }
1509 if (($xlratorsettings{'ENABLE_AUTOCHECK'} eq 'on') && ($xlratorsettings{'AUTOCHECK_SCHEDULE'} eq 'weekly'))
1510 {
1511 symlink("../bin/checkup",$chk_cron_wly)
1512 } else {
1513 symlink("/bin/false",$chk_cron_wly)
1514 }
1515 if (($xlratorsettings{'ENABLE_AUTOCHECK'} eq 'on') && ($xlratorsettings{'AUTOCHECK_SCHEDULE'} eq 'monthly'))
1516 {
1517 symlink("../bin/checkup",$chk_cron_mly)
1518 } else {
1519 symlink("/bin/false",$chk_cron_mly)
1520 }
1521
1522 # don't save those variable to the settings file,
1523 # but we wan't to have them in the hash again after saving to file
1524 my $obsolete = $xlratorsettings{'REMOVE_OBSOLETE'};
1525 my $nosource = $xlratorsettings{'REMOVE_NOSOURCE'};
1526 my $outdated = $xlratorsettings{'REMOVE_OUTDATED'};
1527 my $gui = $xlratorsettings{'EXTENDED_GUI'};
1528
1529 delete($xlratorsettings{'REMOVE_OBSOLETE'});
1530 delete($xlratorsettings{'REMOVE_NOSOURCE'});
1531 delete($xlratorsettings{'REMOVE_OUTDATED'});
1532
1533 delete($xlratorsettings{'EXTENDED_GUI'});
1534
1535 &General::writehash("${General::swroot}/updatexlrator/settings", \%xlratorsettings);
1536
1537 # put temp variables back into the hash
1538 $xlratorsettings{'REMOVE_OBSOLETE'} = $obsolete;
1539 $xlratorsettings{'REMOVE_NOSOURCE'} = $nosource;
1540 $xlratorsettings{'REMOVE_OUTDATED'} = $outdated;
1541 $xlratorsettings{'EXTENDED_GUI'} = $gui;
1542 }
1543
1544 # -------------------------------------------------------------------
1545
1546 sub percentbar
1547 {
1548 my $percent = $_[0];
1549 my $fg = '#a0a0a0';
1550 my $bg = '#e2e2e2';
1551
1552 if ($percent =~ m/^(\d+)%$/ )
1553 {
1554 print <<END
1555 <table width='100' border='1' cellspacing='0' cellpadding='0' style='border-width:1px;border-style:solid;border-color:$fg;width:100px;height:10px;'>
1556 <tr>
1557 END
1558 ;
1559 if ($percent eq "100%") {
1560 print "<td width='100%' bgcolor='$fg' style='background-color:$fg;border-style:solid;border-width:1px;border-color:$bg'>"
1561 } elsif ($percent eq "0%") {
1562 print "<td width='100%' bgcolor='$bg' style='background-color:$bg;border-style:solid;border-width:1px;border-color:$bg'>"
1563 } else {
1564 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'>"
1565 }
1566 print <<END
1567 <img src='/images/null.gif' width='1' height='1' alt='' /></td></tr></table>
1568 END
1569 ;
1570 }
1571 }
1572
1573 # -------------------------------------------------------------------
1574
1575 sub getmtime
1576 {
1577 my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat($_[0]);
1578
1579 return $mtime;
1580 }
1581
1582 # -------------------------------------------------------------------
1583
1584 sub getPID
1585 {
1586 my $pid='';
1587 my @psdata=`ps ax --no-heading`;
1588
1589 foreach (@psdata)
1590 {
1591 if (/$_[0]/) { ($pid)=/^\s*(\d+)/; }
1592 }
1593
1594 return $pid;
1595 }
1596
1597 # -------------------------------------------------------------------