<?php
/*
OpenDataBag - Data Web Interface
Copyright (C) 2004 Nawara
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 2
of the License, or (at your option) any later version.
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.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
$link=$selflink;
$content='<rss version="2.0"><channel>'.CRLF;
$content.='<title>Data changes report</title>'.CRLF;
$content.='<link>'.$link.'</link>'.CRLF;
$content.='<description>Report contains changes comments from last 3 days.</description>'.CRLF;
$content.='<lastBuildDate>'.date('d.m.Y').'</lastBuildDate>'.CRLF;
$result_array=search('sysModDate>'.date('Ymd',mktime(0,0,0, date('m'), date('d')-7, date('Y'))).' -logs -accesslog');
$item_array=array();
reset($result_array);
foreach($result_array as $line)
{
$item_array[read($line,'sysModDate').' '.read($line,'sysGroupBy')]++;
}
krsort($item_array);
$content.='<item>'.CRLF;
$content.='<title>'.cfg_skin_name.' (odb '.INFO.')</title>'.CRLF;
$content.='<link>'.$link.'?odb_search=sysModBy%20sysModDate%3D'.date('Ymd').'+-logs+-accesslog&odb_script=report&odb_popup=&k2=sysGroupBy&n1=TOTAL&k3=sysModBy&odb_mm1=Reports&odb_mm2=Changes%20Report</link>'.CRLF;
$content.='</item>'.CRLF;
reset($item_array);
foreach($item_array as $key => $val)
{
$content.='<item>'.CRLF;
$content.='<title>'.substr($key,0,4).'.'.substr($key,4,2).'.'.substr($key,6).' '.$val.'</title>'.CRLF;
$content.='<link>'.$link.'?odb_search='.urlencode('sysModDate='.substr($key,0,8).' sysGroupBy='.substr($key,9).' -logs -accesslog').'</link>'.CRLF;
$content.='</item>'.CRLF;
}
$content.='</channel></rss>'.CRLF;
$filename='rss.xml';
header('Content-Type: text/xml');
header('Content-Disposition: inline; filename="'.$filename.'"'); //attachement couses too much dialog boxes /inline
header('Content-Length: '.strlen($content));
echo $content;
?>