]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - html/cgi-bin/updatexlrator.cgi
Hardcode theme to ipfire
[ipfire-2.x.git] / html / cgi-bin / updatexlrator.cgi
index 65f6b26bc5d767f54b87c05e999219bd98c23735..ec7b7522841344e4f688409ea02460418ae0d6d6 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/perl
-#!/usr/bin/perl
 #
 # This code is distributed under the terms of the GPL
 #
@@ -12,7 +11,7 @@
 ###############################################################################
 #                                                                             #
 # IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2009  Michael Tremer & Christian Schmidt                      #
+# Copyright (C) 2005-2010  IPFire Team                                        #
 #                                                                             #
 # This program is free software: you can redistribute it and/or modify        #
 # it under the terms of the GNU General Public License as published by        #
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
 #                                                                             #
 ###############################################################################
+#
+# Changelog:
+# 2012-10-27: nightshift - Bugfix regarding showing wrong vendor icon while Download of new Updates
+# 2012-10-27: nightshift - Optimizing logic of check for vendor icons
+#
 
 use strict;
 
@@ -76,6 +80,7 @@ my @vendors=();
 my %vendorstats=();
 
 my $repository = "/var/updatecache/";
+my $webhome = "/srv/web/ipfire/html"; 
 my $hintcolour = '#FFFFCC';
 my $colourgray = '#808080';
 
@@ -95,14 +100,10 @@ my @downloadfiles=();
 
 my @metadata=();
 
-my $chk_cron_dly = "${General::swroot}/updatexlrator/autocheck/cron.daily";
-my $chk_cron_wly = "${General::swroot}/updatexlrator/autocheck/cron.weekly";
-my $chk_cron_mly = "${General::swroot}/updatexlrator/autocheck/cron.monthly";
-
 &General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
 &General::readhash("${General::swroot}/main/settings", \%mainsettings);
 &General::readhash("${General::swroot}/proxy/settings", \%proxysettings);
-&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
+&General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color);
 
 $xlratorsettings{'ACTION'} = '';
 $xlratorsettings{'ENABLE_LOG'} = 'off';
@@ -396,7 +397,7 @@ print <<END
 <tr>
        <td class='base'>$Lang::tr{'updxlrtr passive mode'}:</td>
        <td class='base'><input type='checkbox' name='PASSIVE_MODE' $checked{'PASSIVE_MODE'}{'on'} /></td>
-       <td class='base'>$Lang::tr{'updxlrtr max disk usage'}:</td>
+       <td class='base'>$Lang::tr{'updxlrtr max disk usage'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
        <td class='base'><input type='text' name='MAX_DISK_USAGE' value='$xlratorsettings{'MAX_DISK_USAGE'}' size='1' /> %</td>
 </tr>
 </table>
@@ -408,7 +409,7 @@ print <<END
 <tr>
        <td class='base' width='25%'>$Lang::tr{'updxlrtr low download priority'}:</td>
        <td class='base' width='20%'><input type='checkbox' name='LOW_DOWNLOAD_PRIORITY' $checked{'LOW_DOWNLOAD_PRIORITY'}{'on'} /></td>
-       <td class='base' width='25%'>$Lang::tr{'updxlrtr max download rate'}:&nbsp;<img src='/blob.gif' alt='*' </td>
+       <td class='base' width='25%'>$Lang::tr{'updxlrtr max download rate'}:</td>
        <td class='base' width='30%'><input type='text' name='MAX_DOWNLOAD_RATE' value='$xlratorsettings{'MAX_DOWNLOAD_RATE'}' size='5' /></td>
 </tr>
 </table>
@@ -516,7 +517,7 @@ END
                $id = 0;
                foreach $updatefile (@downloadfiles)
                {
-                       $updatefile =~ s/.*://;
+                       $updatefile =~ s/.*:download/download/;
                        my $size_updatefile = 0;
                        my $mtime = 0;
                        if(-e "$repository/$updatefile") {
@@ -549,51 +550,28 @@ END
                print "\t\t<td align='center' nowrap='nowrap'>&nbsp;";
                if (&getPID("\\s/usr/bin/wget\\s.*\\s".quotemeta($dlinfo{'SRCURL'})."\$"))
                {
-                       print "<img src='/images/updxl-led-blue.gif' alt='$Lang::tr{'updxlrtr condition download'}' />&nbsp;</td>\n";
+                       print "<img src='/images/updbooster/updxl-led-blue.gif' alt='$Lang::tr{'updxlrtr condition download'}' />&nbsp;</td>\n";
                } else {
-                       print "<img src='/images/updxl-led-gray.gif' alt='$Lang::tr{'updxlrtr condition suspended'}' />&nbsp;</td>\n";
+                       print "<img src='/images/updbooster/updxl-led-gray.gif' alt='$Lang::tr{'updxlrtr condition suspended'}' />&nbsp;</td>\n";
                }
 
-                       print "\t\t<td align='center' nowrap='nowrap'>&nbsp;";
-                       if ($vendorid =~ /^Adobe$/i)
-                       {
-                               print "<img src='/images/updxl-src-adobe.gif' alt='Adobe'}' />&nbsp;</td>\n";
-                       } elsif ($vendorid =~ /^Microsoft$/i)
-                       {
-                               print "<img src='/images/updxl-src-windows.gif' alt='Microsoft'}' />&nbsp;</td>\n";
-                       } elsif ($vendorid =~ /^Symantec$/i)
-                       {
-                               print "<img src='/images/updxl-src-symantec.gif' alt='Symantec'}' />&nbsp;</td>\n";
-                       } elsif ($vendorid =~ /^Linux$/i)
-                       {
-                               print "<img src='/images/updxl-src-linux.gif' alt='Linux'}' />&nbsp;</td>\n";
-                       } elsif ($vendorid =~ /^TrendMicro$/i)
-                       {
-                               print "<img src='/images/updxl-src-trendmicro.gif' alt='Trend Micro'}' />&nbsp;</td>\n";
-                       } elsif ($vendorid =~ /^Apple$/i)
-                       {
-                               print "<img src='/images/updxl-src-apple.gif' alt='Apple'}' />&nbsp;</td>\n";
-                       } elsif ($vendorid =~ /^Avast$/i)
-                       {
-                               print "<img src='/images/updxl-src-avast.gif' alt='Avast'}' />&nbsp;</td>\n";
-                       } else
-                       {
-                               if (-e "/home/httpd/html/images/updxl-src-" . $vendorid . ".gif")
-                               {
-                                       print "<img src='/images/updxl-src-" . $vendorid . ".gif' alt='" . ucfirst $vendorid . "' />&nbsp;</td>\n";
-                               } else {
-                                       print "<img src='/images/updxl-src-unknown.gif' alt='" . ucfirst $vendorid . "' />&nbsp;</td>\n";
-                               }
-                       }
+               print "\t\t<td align='center' nowrap='nowrap'>&nbsp;";
 
-                       $shortname = substr($updatefile,rindex($updatefile,"/")+1);
-                       $shortname =~ s/(.*)_[\da-f]*(\.(exe|cab|psf)$)/$1_*$2/i;
+               if (($vendorid ne '') && (-e "$webhome/images/updbooster/updxl-src-$vendorid.gif"))
+               {
+                       print "<img src='/images/updbooster/updxl-src-" . $vendorid . ".gif' alt='" . ucfirst $vendorid . "' />&nbsp;</td>\n";
+               } else {
+                       print "<img src='/images/updbooster/updxl-src-unknown.gif' alt='" . ucfirst $vendorid . "' />&nbsp;</td>\n";
+               }
 
-                       $filesize = $dlinfo{'REMOTESIZE'};
-                       1 while $filesize =~ s/^(-?\d+)(\d{3})/$1.$2/;
-                       $dlinfo{'VENDORID'}=ucfirst $vendorid;
+               $shortname = substr($updatefile,rindex($updatefile,"/")+1);
+               $shortname =~ s/(.*)_[\da-f]*(\.(exe|cab|psf)$)/$1_*$2/i;
 
-                       print <<END
+               $filesize = $dlinfo{'REMOTESIZE'};
+               1 while $filesize =~ s/^(-?\d+)(\d{3})/$1.$2/;
+               $dlinfo{'VENDORID'} = ucfirst $vendorid;
+
+               print <<END
                <td class='base' align='center'>&nbsp;$dlinfo{'VENDORID'}&nbsp;</td>
                <td class='base' align='left' title='cache:/$updatefile'>$shortname</td>
                <td class='base' align='right'  nowrap='nowrap'>&nbsp;$filesize&nbsp;</td>
@@ -993,7 +971,8 @@ foreach (@sources)
                {
                        next if(/\.info$/);
                        $updatefile = substr($_,rindex($_,"/")+1);
-                       $updatefile .= ":download/$vendorid/$updatefile";
+                       $_ = $updatefile; tr/[A-Z]/[a-z]/;
+                       $updatefile = "$_:separator:download/$vendorid/$updatefile";
                        $updatefile = " ".$updatefile;
                        push(@repositoryfiles,$updatefile);
                }
@@ -1024,7 +1003,7 @@ foreach (@sources)
                        chomp($sourceurl);
                        $updatefile = substr($sourceurl,rindex($sourceurl,'/')+1,length($sourceurl));
                        $_ = $updatefile; tr/[A-Z]/[a-z]/;
-                       $updatefile = "$_:$vendorid/$uuid/$updatefile";
+                       $updatefile = "$_:separator:$vendorid/$uuid/$updatefile";
                        push(@repositoryfiles,$updatefile);
                }
        }
@@ -1167,7 +1146,7 @@ END
        $id = 0;
        foreach $updatefile (@files)
        {
-               $updatefile =~ s/.*://;
+               $updatefile =~ s/.*:separator://;
                my $size_updatefile = 0;
                my $mtime = 0;
                if(-e "$repository/$updatefile") {
@@ -1367,7 +1346,7 @@ sub printlegendicons
                <td><img src='/images/updbooster/updxl-globe.gif' alt='$Lang::tr{'updxlrtr last checkup'}' /></td>
                <td class='base'>$Lang::tr{'updxlrtr last checkup'}</td>
                <td class='base'>&nbsp;</td>
-               <td><img src='/images/updbooster/delete.gif' alt='$Lang::tr{'updxlrtr remove file'}' /></td>
+               <td><img src='/images/delete.gif' alt='$Lang::tr{'updxlrtr remove file'}' /></td>
                <td class='base'>$Lang::tr{'updxlrtr remove file'}</td>
                <td class='base'>&nbsp;</td>
                <td class='base'>&nbsp;</td>
@@ -1496,27 +1475,18 @@ END
 
 sub savesettings
 {
-       if (-e $chk_cron_dly) { unlink($chk_cron_dly); }
-       if (-e $chk_cron_wly) { unlink($chk_cron_wly); }
-       if (-e $chk_cron_mly) { unlink($chk_cron_mly); }
 
        if (($xlratorsettings{'ENABLE_AUTOCHECK'} eq 'on') && ($xlratorsettings{'AUTOCHECK_SCHEDULE'} eq 'daily'))
        {
-               symlink("../bin/checkup",$chk_cron_dly)
-       } else {
-               symlink("/bin/false",$chk_cron_dly)
+               system('/usr/local/bin/updxlratorctrl cron daily >/dev/null 2>&1');
        }
-               if (($xlratorsettings{'ENABLE_AUTOCHECK'} eq 'on') && ($xlratorsettings{'AUTOCHECK_SCHEDULE'} eq 'weekly'))
+       if (($xlratorsettings{'ENABLE_AUTOCHECK'} eq 'on') && ($xlratorsettings{'AUTOCHECK_SCHEDULE'} eq 'weekly'))
        {
-               symlink("../bin/checkup",$chk_cron_wly)
-       } else {
-               symlink("/bin/false",$chk_cron_wly)
+               system('/usr/local/bin/updxlratorctrl cron weekly >/dev/null 2>&1');
        }
-               if (($xlratorsettings{'ENABLE_AUTOCHECK'} eq 'on') && ($xlratorsettings{'AUTOCHECK_SCHEDULE'} eq 'monthly'))
+       if (($xlratorsettings{'ENABLE_AUTOCHECK'} eq 'on') && ($xlratorsettings{'AUTOCHECK_SCHEDULE'} eq 'monthly'))
        {
-               symlink("../bin/checkup",$chk_cron_mly)
-       } else {
-               symlink("/bin/false",$chk_cron_mly)
+               system('/usr/local/bin/updxlratorctrl cron monthly >/dev/null 2>&1');
        }
 
        # don't save those variable to the settings file,