delete extra file

delete extra file
This commit is contained in:
Erreur32 2017-06-17 19:26:32 +02:00
parent 86a3b15b71
commit 82e31624df
2 changed files with 0 additions and 100 deletions

View file

@ -1,70 +0,0 @@
<?php
class rss
{
public $conn;
public function __construct()
{
if(!$this->conn())
{
die('Failed to connect with MySQL');
self::close();
}
}
public function conn()
{
$host = "localhost";
$user = "paste";
$pass = "no*aksp1";
$name = "paste";
$conn = mysqli_connect($host,$user,$pass,$name);
if (mysqli_connect_errno())
{
die("Failed to connect with MySQL: ".mysqli_connect_error());
}
else
{
return $this->conn = $conn;
}
}
public function head($title,$content,$siteurl)
{
echo '<rss xmlns:atom="http://www.w3.org/2005/Atom">';
echo '<channel>';
echo '<title>'.$title.'</title>';
echo '<link>'.$siteurl.'</link>';
echo '<description>'.$content.'</description>';
echo '<language>en-us</language>';
echo '<atom:link href="'.$siteurl.'/rss.xml" rel="self" type="application/rss+xml"/>';
}
public function feed($member,$url,$content,$publish)
{
echo '
<item>
<title>'.$member.'</title>
<link>'.$url.'</link>
<description>'.$content.'</description>
<pubDate>'.$publish.'</pubDate>
</item>
';
}
public function foot()
{
echo '</channel>';
echo '</rss>';
}
public function clean($string) {
$string = strtolower( preg_replace('@[\W_]+@', '-', $string) );
$string = rtrim($string,'-');
$string = strtolower($string);
return $string;
}
public function close()
{
mysqli_close(self::conn());
}
}
?>

View file

@ -1,30 +0,0 @@
<?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 = 'http://'.$_SERVER['HTTP_HOST'];
include_once 'rss.class.php';
$rss = new rss;
$rssTitle = ' Latest Paste ';
$rssDescription = ' Get Latest Paste ';
$rss->head($rssTitle,$rssDescription,$url);
$query = "SELECT * FROM pastes ORDER BY id";
if ($result = mysqli_query($rss->conn(), $query)) {
while ($row = mysqli_fetch_assoc($result)) {
$link = $url.slash.rss::clean($row['member']).slash;
$date= date("D, d M Y H:i:s T", $row['date']);
if (preg_match('/^.{1,500}\b/s', $row['content'], $match))
{
$description=$match[0].'...';
}
rss::feed(htmlspecialchars($row['member']),$link,htmlspecialchars($content ),$date);
}
mysqli_free_result($result);
}
$rss->foot();
$rss->close();
?>