123456789101112131415161718192021222324252627282930313233343536373839404142 |
- use strict;
- use v5.10;
- use Time::ParseDate;
- AddModuleDescription('weblog-2.pl', 'Complex Weblog Extension');
- our ($q, @MyInitVariables, @UserGotoBarPages);
- push(@MyInitVariables, \&WebLog2Init);
- sub WebLog2Init {
- my $id = GetId();
- my ($sec, $min, $hour, $mday, $mon, $year) = localtime;
- my $today = sprintf('%4d-%02d-%02d', $year + 1900, $mon + 1, $mday);
- my ($current) = ($id =~ m|^(\d\d\d\d-\d\d-\d\d)|);
- if ($current and $current ne $today) {
- my $time = parsedate($current, GMT => 1);
- ($sec,$min,$hour,$mday,$mon,$year) = localtime($time - 60*60*24);
- my $previous = sprintf("%4d-%02d-%02d", $year + 1900, $mon + 1, $mday);
- ($sec,$min,$hour,$mday,$mon,$year) = localtime($time + 60*60*24);
- my $next = sprintf("%4d-%02d-%02d", $year + 1900, $mon + 1, $mday);
- push(@UserGotoBarPages,$next) unless grep(/^$next$/, @UserGotoBarPages);
- push(@UserGotoBarPages,$current) unless grep(/^$current$/, @UserGotoBarPages);
- push(@UserGotoBarPages,$previous) unless grep(/^$previous$/, @UserGotoBarPages);
- }
- }
|