wiki.pl: Port some fixes from upstream
[Orgmuse.git] / modules / weblog-1.pl
blob9b929378291e94865d291cfc0e3814a6b8398310
1 # Copyright (C) 2004, 2005 Alex Schroeder <alex@emacswiki.org>
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the
15 # Free Software Foundation, Inc.
16 # 59 Temple Place, Suite 330
17 # Boston, MA 02111-1307 USA
19 use vars qw($WeblogTextLogo $WeblogXmlLogo);
21 $WeblogXmlLogo = '/images/rss.png';
22 $WeblogTextLogo = '/images/txt.png';
24 $ModulesDescription .= '<p><a href="http://git.savannah.gnu.org/cgit/oddmuse.git/tree/modules/weblog-1.pl">weblog-1.pl</a>, see <a href="http://www.oddmuse.org/cgi-bin/oddmuse/Minimal_Weblog_Extension">Minimal Weblog Extension</a></p>';
26 $RefererTracking = 1;
27 $CommentsPrefix = 'Comments_on_';
28 $EditAllowed = 2;
30 push(@MyInitVariables, \&WebLog1Init);
32 sub WebLog1Init {
33 if (GetParam('blog', 1)) { # language independent!
34 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = localtime(time);
35 $today = sprintf("%d-%02d-%02d", $year + 1900, $mon + 1, $mday);
36 ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = localtime(time - 60*60*24);
37 $yesterday = sprintf("%d-%02d-%02d", $year + 1900, $mon + 1, $mday);
38 # this modification is not mod_perl safe!
39 my $blog = T('Blog');
40 push(@UserGotoBarPages, $blog) unless grep (/^$blog$/, @UserGotoBarPages);
41 push(@UserGotoBarPages, $today) unless grep (/^$today$/, @UserGotoBarPages);
42 push(@UserGotoBarPages, $yesterday) unless grep (/^$yesterday$/, @UserGotoBarPages);
43 $UserGotoBar .=
44 ScriptLink('action=rss',
45 "<img src=\"$WeblogXmlLogo\" alt=\"XML\" class=\"XML\" />")
46 . ' '. ScriptLink('action=rc;raw=1',
47 "<img src=\"$WeblogTextLogo\" alt=\"TXT\" class=\"XML\" />");