Просмотр файла pages/rss.php

Размер файла: 1.92Kb
<?php
require_once"../template/config.php";
require_once"../template/functions.php";
require_once"../template/maincore.php";

header("Content-type:application/rss+xml; charset=utf-8");
echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?>";
echo "<rss version=\"2.0\"><channel><title>RSS NEWS</title><link>http://vova.h2m.ru</link><description>RSS</description><language>ru</language><copyright>Copyright</copyright>";


$file = @file("../local/news.dat");
$total = count($file);    
if (empty($_GET['start'])) $start = 0;
else $start = $_GET['start'];
if ($total < $start + $config_maxpostnews){ $end = $total; }
else {$end = $start + $config_maxpostnews; }
for ($i = $start; $i < $end; $i++){
$file = @file("../local/news.dat");
$file = array_reverse($file);
$data = explode("|",$file[$i]);
$i2=round($i+1);
$data[1]=eregi_replace("((https?|ftp)://[[:alnum:]_=/-]+(\\.[[:alnum:]_=/-]+)*(/[[:alnum:]+&amp;._=/~%#]*(\\?[[:alnum:]?+&amp;_=/%#]*)?)?)", "<a href='\\1'>\\1</a>", $data[1]);
$data[6]=preg_replace ("|[\r\n]+|si","",$data[6]);
if(!empty($data[1])){
echo "<item><title>$data[0]</title><link>http://vova.h2m.ru</link>";
echo "<description>$data[1]</description><pubData>$data[2] $data[3]</pubData><guid>http://vova.h2m.ru/news/</guid></item>";
/* $filek = @file("../local/datakomm/$data[5].dat");
$totalk = count($filek);
$totalk=$totalk-1;
$data1 = explode("|",$filek[$totalk]); */
/* echo '('.(int)$data1[5].')'; */
echo"";} else { echo"";}
}
$ba=ceil($total/$config_maxpostnews);
$ba2=$ba*$config_maxpostnews-$config_maxpostnews;
echo'';
$asd=$start-($config_maxpostnews*3);
$asd2=$start+($config_maxpostnews*4);
if($asd<$total && $asd>0){echo '';}
for($i=$asd; $i<$asd2;)
{
if($i<$total && $i>=0){
$ii=floor(1+$i/$config_maxpostnews);
/* if ($start==$i) {
echo '';
               }
                else {
echo '';
} */ }
$i=$i+$config_maxpostnews;}
/* if($asd2<$total){echo '';} */
echo "</channel></rss>";
?>