--- awstats.pl.orig 2008-11-30 16:42:46.000000000 +0100 +++ awstats.pl 2009-01-02 21:28:48.000000000 +0100 @@ -33,7 +33,7 @@ $LIMITFLUSH $NEWDAYVISITTIMEOUT $VISITTIMEOUT $NOTSORTEDRECORDTOLERANCE $WIDTHCOLICON $TOOLTIPON $lastyearbeforeupdate $lastmonthbeforeupdate $lastdaybeforeupdate $lasthourbeforeupdate $lastdatebeforeupdate - $NOHTML + $NOHTML $MultipleMonthPatch /; $DEBUGFORCED = 0 ; # Force debug level to log lesser level into debug.log file (Keep this value to 0) @@ -52,6 +52,7 @@ $WIDTHCOLICON = 32; $TOOLTIPON = 0; # Tooltips plugin loaded $NOHTML = 0; # Suppress the html headers +$MultipleMonthPatch = 1; # Enable/Disable the "Reported period" drop down box on the generated static pages # ----- Running variables ----- use vars qw/ @@ -488,7 +489,7 @@ %ValidHTTPCodes %ValidSMTPCodes %TrapInfosForHTTPErrorCodes %NotPageList %DayBytes %DayHits %DayPages %DayVisits %MaxNbOf %MinHit - %ListOfYears %HistoryAlreadyFlushed %PosInFile %ValueInFile + %ListOfYears %ListOfMonths %HistoryAlreadyFlushed %PosInFile %ValueInFile %val %nextval %egal %TmpDNSLookup %TmpOS %TmpRefererServer %TmpRobot %TmpBrowser %MyDNSTable /; @@ -501,7 +502,7 @@ %NotPageList = (); %DayBytes = %DayHits = %DayPages = %DayVisits = (); %MaxNbOf = %MinHit = (); -%ListOfYears = %HistoryAlreadyFlushed = %PosInFile = %ValueInFile = (); +%ListOfYears = %ListOfMonths = %HistoryAlreadyFlushed = %PosInFile = %ValueInFile = (); %val = %nextval = %egal = (); %TmpDNSLookup = %TmpOS = %TmpRefererServer = %TmpRobot = %TmpBrowser = (); %MyDNSTable = (); @@ -5916,6 +5917,13 @@ if ( !$ListOfYears{"$year"} || $ListOfYears{"$year"} lt "$month" ) { $ListOfYears{"$year"} = "$month"; } + + if ( !$ListOfMonths{"$year"} ) { + $ListOfMonths{"$year"} = (); + } + if ( !$ListOfMonths{"$year"}{"$month"} ) { + $ListOfMonths{"$year"}{"$month"} = 1; + } } # For backward compatibility, if LastLine does not exist, set to LastTime @@ -8905,7 +8913,7 @@ . ( $ENV{'GATEWAY_INTERFACE'} || !$StaticLinks ? XMLEncode("$AWScript?${NewLinkParams}output=$key") - : "$PROG$StaticLinks.$key.$StaticExt" ) + : ( ($MultipleMonthPatch) ? "$PROG.$key-$YearRequired-$MonthRequired.$StaticExt" : "$PROG$StaticLinks.$key.$StaticExt" ) ) . "\"$NewLinkTarget>$menutext->{$key}\n"; print( $frame? "\n" : " " ); } @@ -8943,7 +8951,7 @@ . ( $ENV{'GATEWAY_INTERFACE'} || !$StaticLinks ? XMLEncode("$AWScript?${NewLinkParams}output=allemails") - : "$PROG$StaticLinks.allemails.$StaticExt" ) + : ( ($MultipleMonthPatch) ? "$PROG.allemails-$YearRequired-$MonthRequired.$StaticExt" : "$PROG$StaticLinks.allemails.$StaticExt" ) ) . "\"$NewLinkTarget>$Message[80]"; if ( $ShowEMailSenders =~ /L/i ) { $title .= @@ -8951,7 +8959,7 @@ . ( $ENV{'GATEWAY_INTERFACE'} || !$StaticLinks ? XMLEncode("$AWScript?${NewLinkParams}output=lastemails") - : "$PROG$StaticLinks.lastemails.$StaticExt" ) + : ( ($MultipleMonthPatch) ? "$PROG.lastemails-$YearRequired-$MonthRequired.$StaticExt" : "$PROG$StaticLinks.lastemails.$StaticExt" ) ) . "\"$NewLinkTarget>$Message[9]"; } } @@ -9099,7 +9107,7 @@ . ( $ENV{'GATEWAY_INTERFACE'} || !$StaticLinks ? XMLEncode("$AWScript?${NewLinkParams}output=allemailr") - : "$PROG$StaticLinks.allemailr.$StaticExt" ) + : ( ($MultipleMonthPatch) ? "$PROG.allemailr-$YearRequired-$MonthRequired.$StaticExt" : "$PROG$StaticLinks.allemailr.$StaticExt" ) ) . "\"$NewLinkTarget>$Message[80]"; if ( $ShowEMailReceivers =~ /L/i ) { $title .= @@ -9107,7 +9115,7 @@ . ( $ENV{'GATEWAY_INTERFACE'} || !$StaticLinks ? XMLEncode("$AWScript?${NewLinkParams}output=lastemailr") - : "$PROG$StaticLinks.lastemailr.$StaticExt" ) + : ( ($MultipleMonthPatch) ? "$PROG.lastemailr-$YearRequired-$MonthRequired.$StaticExt" : "$PROG$StaticLinks.lastemailr.$StaticExt" ) ) . "\"$NewLinkTarget>$Message[9]"; } } @@ -10142,6 +10150,12 @@ # ListOfYears contains max month found $ListOfYears{"$2"} = "$1"; } + if ( !$ListOfMonths{$2} ) { + $ListOfMonths{$2} = (); + } + if ( !$ListOfMonths{"$2"}{"$1"} ) { + $ListOfMonths{"$2"}{"$1"} = 1; + } my $rangestring = ( $2 || "" ) . ( $1 || "" ) . ( $3 || "" ) . ( $4 || "" ); if ( $rangestring gt $lastdatebeforeupdate ) { @@ -13047,9 +13061,59 @@ if ( $FrameName eq 'mainright' ) { $NewLinkTarget = " target=\"_parent\""; } + print "\n +EOF print "