<?PHP
/* ====================
Seditio - Website engine
Copyright Neocrome
http://www.neocrome.net
[BEGIN_SED]
File=NEWS_RSS.php
Version=101
Updated=2006-mar-15
Type=Core
Author=Varios
Description=YabdexNewsRSS
[END_SED]
==================== */
define('SED_CODE', TRUE);
require_once ('./datas/config.php');
require_once ($cfg['system_dir'].'/functions.php');
require_once ($cfg['system_dir'].'/common.php');
/* ================ Settings ================ */
//RSS News Title
$cfg_titlenews = "Авто новости Рязани";
//RSS Forums Title
$cfg_titleforums = "Рязанский автофорум";
//Page parent category with news on your site (grabbing pages from this and all children's category's)
$cfg_newscat = "news";
//Your site url
$cfg_url = "http://auto62rus.ru";
//RSS Charset
$cfg_charset="windows-1251";
//News displayed in RSS
$cfg_maxlines = 5;
$cfg_ttl = 1;
/* ================ Getting Type ============ */
$m = sed_import('m','G','ALP');
/* ================ Grabbing Data =========== */
switch ($m)
{
// News Export
default :
$cfg_title=$cfg_titlenews;
$mtch = $sed_cat[$cfg_newscat]['path'].".";
$mtchlen = strlen($mtch);
$catsub = array();
$catsub[] = $cfg_newscat;
foreach($sed_cat as $i => $x)
{
if (substr($x['path'], 0, $mtchlen)==$mtch)
{ $catsub[] = $i; }
}
$sql = sed_sql_query("SELECT page_id, page_title, page_text, page_cat, page_date FROM $db_pages WHERE page_state=0 AND page_cat NOT LIKE 'system' AND page_cat IN ('".implode("','", $catsub)."') ORDER by page_date DESC LIMIT ".$cfg_maxlines);
while ($row = mysql_fetch_array($sql))
{
$row['full_text'] = stripslashes($row['page_text']);
$row['full_text'] = preg_replace("'[[^]]*?.*?]'si", "", $row['full_text']);
$readmore = strpos($row['page_text'], "[more]");
if ($readmore>0)
{
$row['page_text'] = substr($row['page_text'], 0, $readmore)."<br />";
//$row['page_text'] .= "<a href=\"".$row['page_pageurl']."\">".$L['ReadMore']."</a>";
}
$items .= "<item>\n";
$items .= " <title>".htmlspecialchars(stripslashes($row['page_title']))."</title>\n";
$items .= " <description>".htmlspecialchars(sed_parse($row['page_text'], $cfg['parsebbcodepages'], $cfg['parsesmiliespages'], 1))."</description>\n";
$items .= " <category>".$sed_cat[$row['page_cat']]['title']."</category>\n";
$items .= " <link>".$cfg_url."/page.php?id=".$row['page_id']."</link>\n";
$items .= " <pubDate>".date("r",$row['page_date'])."</pubDate>\n";
$items .= " <yandex:full-text>".htmlspecialchars($row['full_text'])."</yandex:full-text>\n";
$items .= "</item>\n";
}
break;
}
/* ================ Display result ========== */
$items=iconv("UTF-8","windows-1251",$items);
$cfg_title=iconv("UTF-8","windows-1251",$cfg_title);
$cfg_ttl=iconv("UTF-8","windows-1251",$cfg_ttl);
/*$cfg_titlenews=iconv("UTF-8","windows-1251",$cfg_titlenews);*/
$output .= "<?xml version=\"1.0\" encoding='".$cfg_charset."'?>\n";
$output .= "<rss version=\"2.0\">\n";
$output .= "<channel>\n";
$output .= "<title>".$cfg_title."</title>\n";
$output .= "<link>".$cfg_url."</link>\n";
$output .= "<description></description>\n";
$output .= "<image>\n";
$output .= "<url>http://www.auto62rus.ru/logo.gif</url>\n";
$output .="<title>".$cfg_titlenews."</title>\n";
$output .="<link>http://www.auto62rus.ru/</link>\n";
$output .= "</image>\n";
$output .= "<ttl>".$cfg_ttl."</ttl>\n";
$output .= $items;
$output .= "</channel>\n";
$output .= "</rss>";
/*$output=iconv("UTF-8","windows-1251",$output);*/
//@ob_start("ob_gzhandler");
echo($output);
//@ob_end_flush();
?>