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 %config = getConf("config");
36 my $outFile = $config{"output"};
37 my $feed = HTML::Template->new(filename => $config{"tmpl"});
39 my %channel = getConf("channel");
40 $feed->param(CHANNELTITLE => $channel{'title'});
41 $feed->param(CHANNELLINK => $channel{'link'});
42 $feed->param(CHANNELDESC => $channel{'desc'});
43 $feed->param(CHANNELLANG => $channel{'lang'});
44 $feed->param(CHANNELLASTBUILD => getDate());
46 my %image = getConf("image");
47 $feed->param(IMAGETITLE => $image{'title'});
48 $feed->param(IMAGEURL => $image{'url'});
49 $feed->param(IMAGELINK => $image{'link'});
54 $feed->param(ITEMS => getItems($config{'query'}));
56 open(FILE, ">$outFile") or die "can't open $outFile";
57 print FILE $feed->output();
61 my $date = localtime(timelocal(localtime));
70 open(FILE,$file) or die "can't open $file";
73 my @line = split(/=/,$_,2);
77 my ($key, $value) = @line;
79 $return{$key} = $value;
82 if ($_ eq "$section\n") { $inSection = 1 }
89 $query .= " limit 15";
90 my $dbh = C4::Context->dbh;
91 my $sth=$dbh->prepare($query);
94 while (my $data = $sth->fetchrow_hashref) {
95 foreach my $key (keys %$data) {
96 my $value=$data->{$key};
97 $value=~s/\&/\&/g and $data->{$key}=$value;