3 # This script can be used to generate rss 0.91 files for syndication.
6 # it should be run from cron like:
11 # Copyright 2003 Katipo Communications
13 # This file is part of Koha.
15 # Koha is free software; you can redistribute it and/or modify it under the
16 # terms of the GNU General Public License as published by the Free Software
17 # Foundation; either version 2 of the License, or (at your option) any later
20 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
21 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
22 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
24 # You should have received a copy of the GNU General Public License along with
25 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
26 # Suite 330, Boston, MA 02111-1307 USA
35 my $dbh = C4::Context->dbh;
37 my %config = getConf("config");
38 my $outFile = $config{"output"};
39 my $feed = HTML::Template->new(filename => $config{"tmpl"});
41 my %channel = getConf("channel");
42 $feed->param(CHANNELTITLE => $channel{'title'});
43 $feed->param(CHANNELLINK => $channel{'link'});
44 $feed->param(CHANNELDESC => $channel{'desc'});
45 $feed->param(CHANNELLANG => $channel{'lang'});
46 $feed->param(CHANNELLASTBUILD => getDate());
48 my %image = getConf("image");
49 $feed->param(IMAGETITLE => $image{'title'});
50 $feed->param(IMAGEURL => $image{'url'});
51 $feed->param(IMAGELINK => $image{'link'});
52 $feed->param(IMAGEDESCRIPTION => $image{'description'});
53 $feed->param(IMAGEWIDTH => $image{'width'});
54 $feed->param(IMAGEHEIGHT => $image{'height'});
59 $feed->param(ITEMS => getItems($config{'query'}));
61 open(FILE, ">$outFile") or die "can't open $outFile";
62 print FILE $feed->output();
66 # my $date = localtime(timelocal(localtime));
67 my $date = strftime("%a, %d %b %Y %T %Z", localtime);
76 open(FILE,$file) or die "can't open $file";
79 my @line = split(/=/,$_,2);
83 my ($key, $value) = @line;
85 $return{$key} = $value;
88 if ($_ eq "$section\n") { $inSection = 1 }
95 $query .= " limit 15";
96 my $sth=$dbh->prepare($query);
99 while (my $data = $sth->fetchrow_hashref) {
100 foreach my $key (keys %$data) {
101 my $value=$data->{$key};
102 $value=~s/\&/\&/g and $data->{$key}=$value;