2015-07-28 22:44:53 +02:00
|
|
|
|
# Copyright (C) 2004–2014 Alex Schroeder <alex@gnu.org>
|
2004-01-30 21:35:44 +00:00
|
|
|
|
#
|
2015-03-29 23:42:09 +02:00
|
|
|
|
# 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 the Free Software
|
|
|
|
|
|
# Foundation, either version 3 of the License, or (at your option) any later
|
|
|
|
|
|
# version.
|
2004-01-30 21:35:44 +00:00
|
|
|
|
#
|
2015-03-29 23:42:09 +02:00
|
|
|
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
|
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
2004-01-30 21:35:44 +00:00
|
|
|
|
#
|
2015-03-29 23:42:09 +02:00
|
|
|
|
# You should have received a copy of the GNU General Public License along with
|
|
|
|
|
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
2004-01-30 21:35:44 +00:00
|
|
|
|
|
2015-03-29 23:42:09 +02:00
|
|
|
|
use strict;
|
2015-08-18 10:48:03 +02:00
|
|
|
|
use v5.10;
|
2015-03-27 03:01:01 +02:00
|
|
|
|
|
2004-01-30 11:53:18 +00:00
|
|
|
|
use Time::ParseDate;
|
|
|
|
|
|
|
2014-08-21 22:23:23 +02:00
|
|
|
|
AddModuleDescription('weblog-2.pl', 'Complex Weblog Extension');
|
2004-01-30 11:53:18 +00:00
|
|
|
|
|
2015-04-10 13:31:28 +03:00
|
|
|
|
our ($q, @MyInitVariables, @UserGotoBarPages);
|
2015-03-27 03:01:01 +02:00
|
|
|
|
|
2005-01-04 09:52:44 +00:00
|
|
|
|
push(@MyInitVariables, \&WebLog2Init);
|
2004-01-30 11:53:18 +00:00
|
|
|
|
|
2005-01-04 09:52:44 +00:00
|
|
|
|
sub WebLog2Init {
|
2015-03-29 23:42:09 +02:00
|
|
|
|
my $id = GetId();
|
|
|
|
|
|
my ($sec, $min, $hour, $mday, $mon, $year) = localtime; # CalcDay uses gmtime!
|
|
|
|
|
|
my $today = sprintf('%4d-%02d-%02d', $year + 1900, $mon + 1, $mday);
|
|
|
|
|
|
my ($current) = ($id =~ m|^(\d\d\d\d-\d\d-\d\d)|);
|
2004-01-30 11:53:18 +00:00
|
|
|
|
if ($current and $current ne $today) {
|
|
|
|
|
|
my $time = parsedate($current, GMT => 1);
|
2015-03-29 23:42:09 +02:00
|
|
|
|
($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);
|
2004-01-30 11:53:18 +00:00
|
|
|
|
push(@UserGotoBarPages,$next) unless grep(/^$next$/, @UserGotoBarPages);
|
|
|
|
|
|
push(@UserGotoBarPages,$current) unless grep(/^$current$/, @UserGotoBarPages);
|
|
|
|
|
|
push(@UserGotoBarPages,$previous) unless grep(/^$previous$/, @UserGotoBarPages);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|