<?php
/* This file is part of Madcollector.
* Madcollector created by Thomas Andrieu,
* Developped by Mickael Jardet and Thomas Andrieu.
* Madcollector 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.
* Madcollector 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.
*/
session_start();
define("LIBS", "libs/");
define("PLUGINS", "plugins/");
require 'cfg/param.php'; // Config file
require_once LIBS.('classes/pluginmanager.class.php');
require_once LIBS.('classes/series.class.php');
require_once LIBS.('classes/publisher.class.php');
require_once LIBS.('classes/issue.class.php');
require_once LIBS.('functions.php');
$madPluginManager = new PluginManager();
$DB_connexion = mysql_connect($cfg_host, $cfg_user, $cfg_password);
if (! $DB_connexion){
exit ;
}
if(!mysql_select_db($cfg_database)){
exit ;
}
//Disabling magic_quotes
if (get_magic_quotes_gpc()) {
$_SERVER = stripslashes_array($_SERVER);
$_GET = stripslashes_array($_GET);
$_POST = stripslashes_array($_POST);
$_COOKIE = stripslashes_array($_COOKIE);
$_FILES = stripslashes_array($_FILES);
$_ENV = stripslashes_array($_ENV);
$_REQUEST = stripslashes_array($_REQUEST);
$HTTP_SERVER_VARS = stripslashes_array($HTTP_SERVER_VARS);
$HTTP_GET_VARS = stripslashes_array($HTTP_GET_VARS);
$HTTP_POST_VARS = stripslashes_array($HTTP_POST_VARS);
$HTTP_COOKIE_VARS = stripslashes_array($HTTP_COOKIE_VARS);
$HTTP_POST_FILES = stripslashes_array($HTTP_POST_FILES);
$HTTP_ENV_VARS = stripslashes_array($HTTP_ENV_VARS);
if (isset($_SESSION)) { #These are unconfirmed (?)
$_SESSION = stripslashes_array($_SESSION, '');
$HTTP_SESSION_VARS = stripslashes_array($HTTP_SESSION_VARS, '');
}
}
$madPluginManager->loadPlugins(PLUGINS);
$thisURL = $_SERVER['SERVER_NAME'].$_SERVER["REQUEST_URI"];
$dirURL = substr($thisURL, 0, strlen($thisURL) - 8);
header("Content-Type: application/xml");
echo '<?xml version="1.0" ?>
<rss version="2.0">
<channel>
<title>'.$cfg_site_title.'</title>
<link>http://'.$dirURL.'</link>';
//reste à afficher la liste des numéros
$requete_recent_updates = 'SELECT '.$cfg_table_prefix.'issues.id_series,'.$cfg_table_prefix.'issues.issue,'.$cfg_table_prefix.'series.series_name,'.$cfg_table_prefix.'series.series_volume,'.$cfg_table_prefix.'series.series_year,'.$cfg_table_prefix.'publishers.publisher_name, '.$cfg_table_prefix.'publishers.id_publisher FROM '.$cfg_table_prefix.'issues,'.$cfg_table_prefix.'series,'.$cfg_table_prefix.'publishers WHERE '.$cfg_table_prefix.'series.id_series='.$cfg_table_prefix.'issues.id_series AND '.$cfg_table_prefix.'series.id_publisher='.$cfg_table_prefix.'publishers.id_publisher ORDER BY '.$cfg_table_prefix.'issues.last_date DESC LIMIT 0,20;';
$envoi_requete_recent_updates = mysql_query($requete_recent_updates,$DB_connexion);
if($envoi_requete_recent_updates) $nb_occur_issues = mysql_num_rows($envoi_requete_recent_updates);
if($nb_occur_issues >0 )
{
//TEST
while ($table_result = mysql_fetch_array($envoi_requete_recent_updates, MYSQL_BOTH))
{
$newPublisher = new Publisher($table_result);
$newSeries = new Series($table_result);
$newIssue = new Issue($table_result);
echo '
<item>
<title>'.htmlspecialchars($newSeries->name).' vol.'.$newSeries->volume;
if($newSeries->year != 0) $temp .= " (".$newSeries->year.")";
echo ' #'.$newIssue->number.'</title>
<link>http://'.$dirURL.'/index.php?rub=issue&id_series='.$newSeries->id_series.'&issue='.urlencode($newIssue->number).'</link>
<description>'.htmlspecialchars($newPublisher->name).' : '.htmlspecialchars($newSeries->name).' vol.'.$newSeries->volume;
if($newSeries->year != 0) $temp .= " (".$newSeries->year.")";
echo ' #'.$newIssue->number.'</description>
</item> ';
}
mysql_free_result($envoi_requete_recent_updates);
echo '
</channel>
</rss> ';
}
?>