PastonBin/feed/rss.php
2017-06-20 20:26:43 +02:00

39 lines
1.1 KiB
PHP

<?php
header("Content-Type: application/xml; charset=UTF-8");
header('Pragma: public');
header('Cache-control: private');
header('Expires: -1');
date_default_timezone_set('UTC');
define('slash','/');
$url = 'https://'.$_SERVER['HTTP_HOST'];
include_once 'rss.class.php';
$rss = new rss;
$rssTitle = 'pastebin.echosystem.fr';
$rssDescription = 'Get the latest Pastes from pastebin.echosystem.fr';
$rss->head($rssTitle,$rssDescription,$url);
$query = "SELECT * FROM pastes ORDER BY date";
if ($result = mysqli_query($rss->conn(), $query)) {
while ($row = mysqli_fetch_assoc($result)) {
$link = $url.slash.rss::clean($row['id']).slash;
$date= Trim($row['date']);
$date= date('Y d M H:i:s', strtotime($date));
//if (preg_match('/^.{1,200}\b/s', $row['content'], $match))
//{
//$content=$match[0].'...';
//}
//$content = nl2br('$content');
$content = $row['content'];
//$content = get_extended($content);
rss::feed(htmlspecialchars($row['title']),$link,$content,$date);
//rss::feed(htmlspecialchars($row['title']),$link,htmlspecialchars($content),$date);
}
mysqli_free_result($result);
}
$rss->foot();
$rss->close();
?>