-
Notifications
You must be signed in to change notification settings - Fork 0
/
rss.php
37 lines (28 loc) · 1.26 KB
/
rss.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
include ("Core/Z/AutoLoader.php");
define('APPLICATION_PATH', realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR));
define('LIBRARY_PATH', realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Core'));
define('CONFIG_PATH', realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Settings') . DIRECTORY_SEPARATOR);
define('TEMPLATES_PATH', realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Templates' ) . DIRECTORY_SEPARATOR);
define('URL', "http://" . $_SERVER['SERVER_NAME'] . "/");
error_reporting(E_ALL);
new Z_AutoLoader();
header("Content-Type: application/rss+xml");
$config = new Z_Config("site.ini");
$db = new Z_DB($config->host(), $config->user(), $config->password(), $config->dbname());
$mainView = new Z_MainView("rss");
$postsTable = new Z_Table("posts");
$list = $postsTable->getList();
if (count($list) > 0){
foreach($list As $value){
$item = "<item>".
"<title>" . strip_tags($value->name()) . "</title>
<link>http://postshub.tk/post/".$value->id() . "</link>
<description><![CDATA[" . $value->format_description() . "]]></description>
<pubDate>".@date("r", $value->created_time())."</pubDate>
<guid>http://postshub.tk/post/" . $value->id() . "</guid>
</item>";
$mainView->replace("items", $item, false);
}
}
?>