Перейти из форума на сайт.

НовостиФайловые архивы
ПоискАктивные темыТоп лист
ПравилаКто в on-line?
Вход Забыли пароль? Первый раз на этом сайте? Регистрация
Компьютерный форум Ru.Board » Тематические » Системы управления сайтами » Koobi - 2

Модерирует : Antuan

 Версия для печати • ПодписатьсяДобавить в закладки
На первую страницук этому сообщениюк последнему сообщению

Открыть новую тему     Написать ответ в эту тему

faun



Junior Member
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору


Код:
 
<?php
error_reporting(0);
$querystr =$_SERVER['QUERY_STRING'];
$querystr = strtolower($querystr);
if (strstr($querystr,"concat_ws") || strstr($querystr,"concat") || strstr($querystr,"http") || strstr($querystr,"'") || strstr($querystr,"union"))
{
    header( "Location: /" );
}
 
$base= substr(dirname(__FILE__),0,-4);
define("BASEDIR", $base);
define("ANTISPAM",1);
include_once(BASEDIR . "/inc/config.php");
include_once(BASEDIR . "/functions/Func.Session.php");
ob_start();
session_start();
session_name("live_rss");
include_once(BASEDIR . "/inc/init.php");
 
$db = new DB("$dbhost", "$dbuser", "$dbpass", "$dbname");
$catq = "";
$limit = ((int)$_REQUEST['pp']=='') ? '15' : $_REQUEST['pp'];
$fid = ((int)$_REQUEST['fid']=='') ? '1' : "forum_id='".$_REQUEST['fid']."'";
$toid = ($_REQUEST['toid']=='') ? '1' : "topic_id='".$_REQUEST['toid']."'";
 
if(!isset($page))$page = 1;
 
$area = escs($_REQUEST['area']);
 
header("Content-Type: text/xml");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
 
ob_start();
$rss = "<?xml version=\"1.0\" encoding=\"windows-1251\" ?>\n";
$rss .= "<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n";
$rss .= "<channel>\n";
$rss .= "<language>ru</language>\n";
$rss .= "<copyright>Copyright 2007-2009 All rights reserved</copyright>\n";
$rss .= "<pubDate>". date("r")."</pubDate>\n";
$rss .= "<lastBuildDate>". date("r")."</lastBuildDate>\n";
$rss .= "<managingEditor>info@site.ru (Рога и Копыта)</managingEditor>\n";
$rss .= "<webMaster>info@site.ru (Рога и Копыта)</webMaster>\n";
$rss .= "<image><title>«Рога и Копыта»</title><url>http://www.site.ru/rss/logo.gif</url><link>http://www.alvocom.ru/</link><width>144</width><height>34</height></image>\n";
$rss .= "<description>Информационная лента компании «Рога и Копыта»</description>\n";
 
switch($_REQUEST['rss'])
{
    case 'news':
        $query = "SELECT newscat, uid, newsid, title, text, textmore, time_start, ntime FROM ".PREFIX."_news WHERE ((area_id='$area' || allareas='yes') && ((time_end>=".time().") || (time_end='1') || (time_end='0')) && (((ispublic='1')) && (time_start<=".time().")$catq))  ORDER BY ntime DESC limit $limit";
        $rss .= "<title>Новости от компании «Рога и Копыта»</title>\n";
        $rss .= "<link>http://".$_SERVER['HTTP_HOST'].str_replace("rss/index.php","",$_SERVER['PHP_SELF'])."index.php?area=$area&amp;p=newsarchive</link>\n";
        break;
 
    case 'articles':
        $query = "SELECT content, id, articlecat, time_start, title, type, ctime, uid FROM ".PREFIX."_articles WHERE ((area='$area' || allareas='yes') && ((time_end>=".time().") || (time_end='1') || (time_end='0')) && (((active='1')) && (time_start<=".time().")$catq))  ORDER BY ctime DESC limit $limit";
        $rss .= "<title>Статьи от компании «Рога и Копыта»</title>\n";
        $rss .= "<link>http://".$_SERVER['HTTP_HOST'].str_replace("rss/index.php","",$_SERVER['PHP_SELF'])."index.php?area=$area&amp;p=articles</link>\n";
        break;
 
    case 'forum':
        $query = "SELECT id, title, datum, replies, forum_id FROM " .PREFIX. "_f_topic WHERE ".$fid." ORDER BY datum DESC limit $limit";
        $rss .= "<title>Новые темы на форуме компании «Рога и Копыта»</title>\n";
        $rss .= "<link>http://".$_SERVER['HTTP_HOST'].str_replace("rss/index.php","",$_SERVER['PHP_SELF'])."index.php?area=$area&amp;p=showforums</link>\n";
        break;
 
    case 'topic':
        $query = "SELECT id, title, datum, message, topic_id FROM ".PREFIX."_f_post WHERE ".$toid." ORDER BY datum DESC limit $limit";
        $rss .= "<title>Новые сообщения на форуме компании «Рога и Копыта»</title>\n";
        $rss .= "<link>http://".$_SERVER['HTTP_HOST'].str_replace("rss/index.php","",$_SERVER['PHP_SELF'])."index.php?area=$area&amp;p=showforums</link>\n";
        break;
 
    case '':
        $query = "SELECT newscat, uid, newsid, title, text, textmore, time_start, ntime FROM ".PREFIX."_news WHERE ((area_id='$area' || allareas='yes') && ((time_end>=".time().") || (time_end='1') || (time_end='0')) && (((ispublic='1')) && (time_start<=".time().")$catq))  ORDER BY ntime DESC limit $limit";
        $rss .= "<title>«Рога и Копыта» - центр системной интеграции</title>\n";
        $rss .= "<link>http://".$_SERVER['HTTP_HOST'].str_replace("rss/index.php","",$_SERVER['PHP_SELF'])."</link>\n";
        break;
}
 
$sql = $db->Query($query);
 
function tag_r($text)
{
    $text = str_replace('&bdquo;', '„', $text);
    $text = str_replace('&ldquo;', '“', $text);
    $text = str_replace('&ndash;','-',$text);
    $text = str_replace('&mdash;','-',$text);
    $text = str_replace('&copy;','©',$text);
    $text = str_replace('&reg;','®',$text);
    $text = str_replace(array('&trade;','&#8482;'),'™',$text);
    $text = str_replace('&pound;','Ј',$text);
    $text = str_replace(array('&#8364;','&euro;'),'Ђ',$text);
    $text = str_replace('&laquo;','«',$text);
    $text = str_replace('&raquo;','»',$text);
    $text = str_replace('&quot;','"',$text);
    $text = str_replace(' & ','&amp;',$text);
    $text = str_replace('<o:p>','<p>', $text);
    $text = str_replace('</o:p>','</p>', $text);
    $text = str_replace('&nbsp;', ' ', $text);
    $text = str_replace('[--NEU--]', ' ', $text);
    $text = str_ireplace('[URL]', ' ', $text);   // str_ireplace  рабоает только под PHP5
    $text = str_ireplace('[/URL]', ' ', $text);
    $text = str_ireplace('', ' ', $text);
    $text = str_ireplace('
', ' ', $text);
    $text = str_ireplace('
Цитата:
', ' ', $text);
    $text = str_ireplace('
', ' ', $text);
    $text = str_ireplace('', ' ', $text);
    $text = str_ireplace('
', ' ', $text);
    $text = str_ireplace('[IMG]', ' ', $text);
    $text = str_ireplace('[/IMG]', ' ', $text);
    $text = str_replace('template/', HPURL .'template/', $text);
    $text = preg_replace("/\[color=(.*?)\](.*?)\[\/color\]/si", '\\2', $text);
    $text = preg_replace("/\[size=(.*?)\](.*?)\[\/size\]/si", '\\2', $text);
    $text = preg_replace("/\[font=(.*?)\](.*?)\[\/font\]/si", '\\2', $text);
    $text = preg_replace("/\[spoiler\](.*?)\[\/spoiler\]/si", '\\1', $text);
    $text = preg_replace("/\[hide\](.*?)\[\/hide\]/si","Данный текст доступен для просмотра только зарегистрированными пользователями ", $text);
    $text = preg_replace("/\[hide=(.*?)\](.*?)\[\/hide\]/si","Данный текст доступен для просмотра только зарегистрированными пользователями ", $text);
    $text = preg_replace("/\[code\](.*?)\[\/code\]/si","В данном сообщении содержится код, он доступен для просмотра в сообщении на форуме ", $text);
    $text = preg_replace("/\[php\](.*?)\[\/php\]/si","В данном сообщении содержится код, он доступен для просмотра в сообщении на форуме ", $text);
    return $text;
}
 
while ($row = $sql->FetchRow())
{
    switch($_REQUEST['rss'])
    {
        case 'news':
            @$row->text = @tag_r($row->text);
            $sql_new = $db->Query("SELECT catname FROM " . PREFIX . "_newscat WHERE catid = '$row->newscat'");
            $row_new = $sql_new->fetchrow();
            @$row->catname = @tag_r($row_new->catname);
            @$row->datum = @date("r",$row->time_start);
            break;
 
        case 'articles':
            @$row->content = @tag_r($row->content);
            $sql_artc = $db->Query("SELECT catname FROM " . PREFIX . "_articlecat WHERE catid = '$row->articlecat'");
            $row_artc = $sql_artc->fetchrow();
            @$row->catname = @tag_r($row_artc->catname);
            @$row->datum = @date("r",$row->time_start);
            break;
 
        case 'forum':
            $sql_forum = $db->Query("SELECT message, title FROM " . PREFIX . "_f_post WHERE topic_id = '$row->id'");
            $row_forum = $sql_forum->fetchrow();
            @$row->message = @tag_r($row_forum->message);
            @$row->title2 = @tag_r($row_forum->title);
            $sql_forum3 = $db->Query("SELECT title FROM " . PREFIX . "_f_forum WHERE id = '$row->forum_id'");
            $row_forum3 = $sql_forum3->fetchrow();
            @$row->title3 = @tag_r($row_forum3->title);
            break;
 
        case 'topic':
            @$row->message = @tag_r($row->message);
            $sql_topic = $db->Query("SELECT title FROM " . PREFIX . "_f_topic WHERE id = '$row->topic_id'");
            $row_topic = $sql_topic->fetchrow();
            @$row->topic = @tag_r($row_topic->title);
            break;
 
        case '':
            @$row->text = @tag_r($row->text);
            $sql_new = $db->Query("SELECT catname FROM " . PREFIX . "_newscat WHERE catid = '$row->newscat'");
            $row_new = $sql_new->fetchrow();
            @$row->catname = @tag_r($row_new->catname);
            @$row->datum = @date("r",$row->time_start);
            break;
    }
 
    $rss .= "<item>\n";
    $rss .= "<title>" . stripslashes($row->title) . "</title>\n";
 
    switch($_REQUEST['rss'])
    {
        case 'news':
            $rss .= "<description>" . substr(strip_tags(stripslashes($row->text)),0,520) . "...</description>\n";
            $rss .= "<link>http://".$_SERVER['HTTP_HOST'].str_replace("rss/index.php","",$_SERVER['PHP_SELF'])."index.php?area=$area&amp;p=news&amp;newsid=$row->newsid</link>\n";
            $rss .= "<pubDate>".$row->datum."</pubDate>";
            $rss .= "<guid>http://".$_SERVER['HTTP_HOST'].str_replace("rss/index.php","",$_SERVER['PHP_SELF'])."index.php?area=$area&amp;p=news&amp;newsid=$row->newsid</guid>";
            $rss .= "<comments>http://".$_SERVER['HTTP_HOST'].str_replace("rss/index.php","",$_SERVER['PHP_SELF'])."index.php?area=$area&amp;p=news&amp;newsid=$row->newsid</comments>";
            $rss .= "<category>" . substr(strip_tags(stripslashes($row->catname)),0,30) . "</category>";
            break;
 
        case 'articles':
            $rss .= "<description>" . substr(strip_tags(stripslashes($row->content)),0,520) . "...</description>\n";
            $rss .= "<link>http://".$_SERVER['HTTP_HOST'].str_replace("rss/index.php","",$_SERVER['PHP_SELF'])."index.php?area=$area&amp;p=articles&amp;type=$row->type&amp;id=$row->id</link>\n";
            $rss .= "<pubDate>".$row->datum."</pubDate>";
            $rss .= "<guid>http://".$_SERVER['HTTP_HOST'].str_replace("rss/index.php","",$_SERVER['PHP_SELF'])."index.php?area=$area&amp;p=articles&amp;type=$row->type&amp;id=$row->id</guid>";
            $rss .= "<comments>http://".$_SERVER['HTTP_HOST'].str_replace("rss/index.php","",$_SERVER['PHP_SELF'])."index.php?area=$area&amp;p=articles&amp;type=$row->type&amp;id=$row->id</comments>";
            $rss .= "<category>" . substr(strip_tags(stripslashes($row->catname)),0,30) . "</category>";
            break;
 
        case 'forum':
            $rss .= "<description>" . substr(strip_tags(stripslashes($row->title2)),0,100) . "\n" . substr(strip_tags(stripslashes($row->message)),0,520) . "...</description>\n";
            $rss .= "<link>http://".$_SERVER['HTTP_HOST'].str_replace("rss/index.php","",$_SERVER['PHP_SELF'])."index.php?area=$area&amp;p=showtopic&amp;toid=$row->id</link>\n";
            $rss .= "<pubDate>".$row->datum."</pubDate>";
            $rss .= "<guid>http://".$_SERVER['HTTP_HOST'].str_replace("rss/index.php","",$_SERVER['PHP_SELF'])."index.php?area=$area&amp;p=showtopic&amp;toid=$row->id</guid>";
            $rss .= "<comments>http://".$_SERVER['HTTP_HOST'].str_replace("rss/index.php","",$_SERVER['PHP_SELF'])."index.php?area=$area&amp;p=showtopic&amp;toid=$row->id</comments>";
            $rss .= "<category>" . substr(strip_tags(stripslashes($row->title3)),0,30) . "</category>";
            break;
 
        case 'topic':
            $rss .= "<description>" . substr(strip_tags(stripslashes($row->message)),0,520) . "...</description>\n";
            $rss .= "<link>http://".$_SERVER['HTTP_HOST'].str_replace("rss/index.php","",$_SERVER['PHP_SELF'])."index.php?area=$area&amp;p=showtopic&amp;toid=$row->topic_id</link>\n";
            $rss .= "<pubDate>".$row->datum."</pubDate>";
            $rss .= "<guid>http://".$_SERVER['HTTP_HOST'].str_replace("rss/index.php","",$_SERVER['PHP_SELF'])."index.php?area=$area&amp;p=showtopic&amp;toid=$row->topic_id</guid>";
            $rss .= "<comments>http://".$_SERVER['HTTP_HOST'].str_replace("rss/index.php","",$_SERVER['PHP_SELF'])."index.php?area=$area&amp;p=showtopic&amp;toid=$row->topic_id</comments>";
            $rss .= "<category>" . substr(strip_tags(stripslashes($row->topic)),0,30) . "</category>";
            break;
 
        case '':
            $rss .= "<description>" . substr(strip_tags(stripslashes($row->text)),0,520) . "...</description>\n";
            $rss .= "<link>http://".$_SERVER['HTTP_HOST'].str_replace("rss/index.php","",$_SERVER['PHP_SELF'])."index.php?area=$area&amp;p=news&amp;newsid=$row->newsid</link>\n";
            $rss .= "<pubDate>".$row->datum."</pubDate>";
            $rss .= "<guid>http://".$_SERVER['HTTP_HOST'].str_replace("rss/index.php","",$_SERVER['PHP_SELF'])."index.php?area=$area&amp;p=news&amp;newsid=$row->newsid</guid>";
            $rss .= "<comments>http://".$_SERVER['HTTP_HOST'].str_replace("rss/index.php","",$_SERVER['PHP_SELF'])."index.php?area=$area&amp;p=news&amp;newsid=$row->newsid</comments>";
            $rss .= "<category>" . substr(strip_tags(stripslashes($row->catname)),0,30) . "</category>";
            break;
    }
    $rss .= " </item>\n";
}
$sql->Close();
$rss .= " </channel>\n";
$rss .= "</rss>";
 
header("Content-Length: " . strlen($rss));
echo $rss;
exit();
?>
 
 

Всего записей: 51 | Зарегистр. 25-02-2006 | Отправлено: 17:59 19-04-2009 | Исправлено: faun, 19:08 19-04-2009
Открыть новую тему     Написать ответ в эту тему

На первую страницук этому сообщениюк последнему сообщению

Компьютерный форум Ru.Board » Тематические » Системы управления сайтами » Koobi - 2


Реклама на форуме Ru.Board.

Powered by Ikonboard "v2.1.7b" © 2000 Ikonboard.com
Modified by Ru.B0ard
© Ru.B0ard 2000-2024

BitCoin: 1NGG1chHtUvrtEqjeerQCKDMUi6S6CG4iC

Рейтинг.ru