require_once ("config.inc.php");
require_once ("templates/download.inc.php");
require_once ("templates/news.inc.php");
session_id () || session_start ();
switch (isset ($_GET['section']) ? $_GET['section'] : "") {
case "forum":
$model = isset ($_GET['model']) ? $_GET['model'] : "atom";
header("location: /forum/?action=.xml;type=$model;limit=10");
exit;
case "download":
$items = array ();
$download = new Download (isset ($_GET['version']) ? $_GET['version'] : "");
$files = $download->get (10, isset ($_GET['addon']) ? $_GET['addon'] : "");
$channel = array (
'title' => "MLD download news",
'link' => "http://{$_SERVER['SERVER_NAME']}",
'description' => "Neuigkeiten rund um MiniDVBLinux Downloads",
'date' => date ("D, d M Y H:i:s O", $download->newest));
$items[] = array (
'title' => "Letzte Aktualisierung: " . (!empty ($_GET['addon']) && isset ($files[0]) ? date ("d.m.Y", $files[0]['time']) : $download->getNewestDate ()),
'link' => "http://{$_SERVER['SERVER_NAME']}",
'description' => "",
'date' => "");
foreach ($files as $file) {
$items[] = array (
'title' => "{$file['name']} ({$file['version']})",
'link' => preg_replace ("/&/", "&", "http://{$_SERVER['SERVER_NAME']}{$file['href']}"),
'description' => $file['descript'],
'date' => date ("D, d M Y H:i:s O", $file['time']));
}
break;
case "update":
$items = array ();
$download = new Download (isset ($_GET['version']) ? $_GET['version'] : "");
$files = $download->get (10);
$channel = array (
'title' => "MLD update news",
'link' => "http://{$_SERVER['SERVER_NAME']}",
'description' => "Neuigkeiten rund um MiniDVBLinux Updates",
'date' => date ("D, d M Y H:i:s O", $download->newest));
$items[] = array (
'title' => "Letzte Aktualisierung: " . (!empty ($_GET['addon']) && isset ($files[0]) ? date ("d.m.Y", $files[0]['time']) : $download->getNewestDate ()),
'link' => "http://{$_SERVER['SERVER_NAME']}",
'description' => "",
'date' => "");
foreach ($files as $file) {
$history = file ($file['hisfile']);
$history_version = preg_replace("/.*(\d\d\d\d-\d\d-\d\d).*/", "\\1", $history[0]);
$file_version = preg_replace ("/.*_(\d\d\d\d)\.(\d\d)\.(\d\d)_.*/", "\\1-\\2-\\3", $file['version']);
$items[] = array (
'title' => "{$file['name']} ({$file['version']})",
'link' => preg_replace ("/&/", "&", "http://{$_SERVER['SERVER_NAME']}{$file['history']}"),
'description' => $file_version > $history_version ? "$file_version -- Update of source package" : "$history_version -- $history[1]",
'date' => date ("D, d M Y H:i:s O", $file['time']));
}
break;
default: // news
$items = array ();
$news = new News ();
$channel = array (
'title' => "MLD news",
'link' => "http://{$_SERVER['SERVER_NAME']}",
'description' => "Neuigkeiten rund um die MiniDVBLinux Distribution",
'date' => isset ($news->newest['News']) ? $news->newest['News'] : "");
foreach ($news->get (isset ($_GET['id']) ? $_GET['id'] : 0) as $article) {
$items[] = array (
'title' => $article['title'],
'link' => preg_replace ("/&/", "&", $article['href']),
'description' => $article['descript'],
'date' => $article['date']);
}
break;
}
header ("Content-type: text/xml; charset=UTF-8");
echo "";
switch (isset ($_GET['model']) ? $_GET['model'] : "") {
case "rss": // RSS 1.0
?>
=$channel['title']?>
=$channel['link']?>
=$channel['description']?>
=$channel['date']?>
foreach ($items as $item) { ?>
} ?>
foreach ($items as $item) { ?>
-
=$item['title']?>
=$item['link']?>
=$item['description']?>
=$item['date']?>
} ?>
break;
case "rss2": // RSS 2.0
?>
=$channel['title']?>
=$channel['link']?>
=$channel['description']?>
=$channel['date']?>
foreach ($items as $item) { ?>
-
=$item['title']?>
=$item['link']?>
=$item['description']?>
=$item['date']?>
} ?>
break;
default: // Atom
?>
=$channel['title']?>
=$channel['description']?>
=$channel['date']?>
foreach ($items as $item) { ?>
=$item['title']?>
=$item['description']?>
=$item['date']?>
} ?>
break;
}
?>