Bladeren bron

Added $pic1 and $pic2 instead of set $image = "filename.png"
So the user can easily use his own Stats-Bar-Graphics.

Fixed Bug in TopTimes-Stats

doomshammer 25 jaren geleden
bovenliggende
commit
a9875b79a9
1 gewijzigde bestanden met toevoegingen van 15 en 11 verwijderingen
  1. 15 11
      pisg.pl

+ 15 - 11
pisg.pl

@@ -25,7 +25,7 @@ my ($channel, $logfile, $format, $network, $outputfile, $maintainer,
 $pagehead, $usersfile, $imagepath, $logdir, $lang, $bgcolor, $text, $hbgcolor,
 $pagehead, $usersfile, $imagepath, $logdir, $lang, $bgcolor, $text, $hbgcolor,
 $hcolor, $hicell, $hicell2, $tdcolor, $tdtop, $link, $vlink, $hlink, $headline,
 $hcolor, $hicell, $hicell2, $tdcolor, $tdtop, $link, $vlink, $hlink, $headline,
 $rankc, $minquote, $maxquote, $activenicks, $activenicks2, $topichistory,
 $rankc, $minquote, $maxquote, $activenicks, $activenicks2, $topichistory,
-$nicktracking, $timeoffset, $version, $debug, $debugfile);
+$pic1, $pic2, $nicktracking, $timeoffset, $version, $debug, $debugfile);
 
 
 # Values that _MUST_ be set below (unless you pass them on commandline)
 # Values that _MUST_ be set below (unless you pass them on commandline)
 $channel = "#channel";		# The name of your channel.
 $channel = "#channel";		# The name of your channel.
@@ -37,7 +37,7 @@ $maintainer = "MAINTAINER";	# The maintainer or bot which makes the logfile
 $pagehead = "none";		# Some 'page header' file which you want to
 $pagehead = "none";		# Some 'page header' file which you want to
 				# include in top of the stats
 				# include in top of the stats
 
 
-$usersfile = "users.cfg";	# Path to users config file (aliases, ignores,
+$usersfile = "/usr/local/apache/cgi-bin/users.cfg";	# Path to users config file (aliases, ignores,
 				# pics and more, see users.cfg for examples)
 				# pics and more, see users.cfg for examples)
 
 
 $imagepath = "";		# If your user pictures is located
 $imagepath = "";		# If your user pictures is located
@@ -64,6 +64,8 @@ $vlink = "#0b407a";		# Color of visited links
 $hlink = "#0b407a";		# Color of hovered links
 $hlink = "#0b407a";		# Color of hovered links
 $headline = "#000000";		# Border color of headlines
 $headline = "#000000";		# Border color of headlines
 $rankc = "#CCCCCC";             # Colors of 'ranks' (1,2,3,4)
 $rankc = "#CCCCCC";             # Colors of 'ranks' (1,2,3,4)
+$pic1 = "pipe-blue.png"		# Bar-graphic-file for normal times
+$pic2 = "pipe-purple.png"   # Bar-graphic-file for top-times
 
 
 # Other things that you might set, but not everyone cares about them
 # Other things that you might set, but not everyone cares about them
 $minquote = "25";		# Minimal value of letters for a random quote
 $minquote = "25";		# Minimal value of letters for a random quote
@@ -83,7 +85,7 @@ $timeoffset = "+0";		# A time offset on the stats page - if your
 # You shouldn't care about anything below this point
 # You shouldn't care about anything below this point
 $debug = 0;			# 0 = Debugging off, 1 = Debugging on
 $debug = 0;			# 0 = Debugging off, 1 = Debugging on
 $debugfile = "debug.log";	# Path to debug file(must be set if $debug == 1)
 $debugfile = "debug.log";	# Path to debug file(must be set if $debug == 1)
-$version = "v0.17pre1";
+$version = "v0.16-cvs-dh1";
 
 
 my ($lines, $kicked, $gotkicked, $smile, $longlines, $time, $timestamp, %alias,
 my ($lines, $kicked, $gotkicked, $smile, $longlines, $time, $timestamp, %alias,
 $normalline, $actionline, $thirdline, @ignore, $line, $processtime, @topics,
 $normalline, $actionline, $thirdline, @ignore, $line, $processtime, @topics,
@@ -125,11 +127,11 @@ sub init_pisg
 
 
     $timestamp = time;
     $timestamp = time;
 
 
-    if ($timeoffset =~ /\+(\d+)/) {
+    if ($timeoffset =~ /\+(\d)/) {
         # We must plus some hours to the time
         # We must plus some hours to the time
         $timestamp += 3600 * $1; # 3600 seconds per hour
         $timestamp += 3600 * $1; # 3600 seconds per hour
 
 
-    } elsif ($timeoffset =~ /-(\d+)/) {
+    } elsif ($timeoffset =~ /-(\d)/) {
         # We must remove some hours from the time
         # We must remove some hours from the time
         $timestamp -= 3600 * $1; # 3600 seconds per hour
         $timestamp -= 3600 * $1; # 3600 seconds per hour
     }
     }
@@ -180,6 +182,7 @@ sub init_lineformats {
         $normalline = '^\[(\d+):\d+\] <([^>]+)> (.*)';
         $normalline = '^\[(\d+):\d+\] <([^>]+)> (.*)';
         $actionline = '^\[(\d+):\d+\] \* (\S+) (.*)';
         $actionline = '^\[(\d+):\d+\] \* (\S+) (.*)';
         $thirdline = '^\[(\d+):(\d+)\] (\S+) (\S+) (\S+) (\S+) (\S+) (\S+)(.*)';
         $thirdline = '^\[(\d+):(\d+)\] (\S+) (\S+) (\S+) (\S+) (\S+) (\S+)(.*)';
+
     } else {
     } else {
         die("Logfile format not supported, check \$format setting.\n");
         die("Logfile format not supported, check \$format setting.\n");
     }
     }
@@ -870,26 +873,27 @@ sub activetimes
 
 
     my @now = localtime($timestamp);
     my @now = localtime($timestamp);
 
 
-    my $image = "pipe-blue.png";
+    my $image;
 
 
     for my $hour (sort keys %times) {
     for my $hour (sort keys %times) {
         debug("Time: $hour => ". $times{$hour});
         debug("Time: $hour => ". $times{$hour});
-
         if ($toptime[0] == $hour) {
         if ($toptime[0] == $hour) {
-            $image = "pipe-purple.png";
+            $image = $pic2;
+		} else { 
+			$image = $pic1; 
         } 
         } 
 
 
         my $size = ($times{$hour} / $highest_value) * 100;
         my $size = ($times{$hour} / $highest_value) * 100;
         my $percent = ($times{$hour} / $lines) * 100;
         my $percent = ($times{$hour} / $lines) * 100;
         $percent =~ s/(\.\d)\d+/$1/;
         $percent =~ s/(\.\d)\d+/$1/;
 
 
-        if ($timeoffset =~ /\+(\d+)/) {
+        if ($timeoffset =~ /\+(\d)/) {
             # We must plus some hours to the time
             # We must plus some hours to the time
             $hour += $1;
             $hour += $1;
             $hour = $hour % 24;
             $hour = $hour % 24;
             if ($hour < 10) { $hour = "0" . $hour; }
             if ($hour < 10) { $hour = "0" . $hour; }
 
 
-        } elsif ($timeoffset =~ /-(\d+)/) {
+        } elsif ($timeoffset =~ /-(\d)/) {
             # We must remove some hours from the time
             # We must remove some hours from the time
             $hour -= $1;
             $hour -= $1;
             $hour = $hour % 24;
             $hour = $hour % 24;
@@ -1650,7 +1654,7 @@ sub htmlfooter
 {
 {
 print OUTPUT <<HTML;
 print OUTPUT <<HTML;
 <span class="small">
 <span class="small">
-Stats generated by <a href="http://pisg.sourceforge.net/" title="Go to the pisg homepage">pisg</a> $version<br>
+Stats generated by <a href="http://www.wtf.dk/hp/index.php?page=pisg" title="Go to the pisg homepage">pisg</a> $version<br>
 pisg by <a href="http://www.wtf.dk/hp/" title="Go to the authors homepage">Morten "LostStar" Brix Pedersen</a> and others<br>
 pisg by <a href="http://www.wtf.dk/hp/" title="Go to the authors homepage">Morten "LostStar" Brix Pedersen</a> and others<br>
 Stats generated in $processtime
 Stats generated in $processtime
 </span>
 </span>