Location: PHPKode > projects > Simple But Mighty Blog > sbmb03/modules/rss.php
<?
//Simple But Mighty Blog, version 0.3.1
//copyright © 2007, Mighty Mind
// @license http://opensource.org/licenses/gpl-license.php GNU Public License
// Äàííàÿ ïðîãðàììà ÿâëÿåòñÿ ñâîáîäíûì ïðîãðàììíûì îáåñïå÷åíèåì. Âû âïðàâå ðàñïðîñòðàíÿòü åå è/èëè ìîäèôèöèðîâàòü â ñîîòâåòñòâèè ñ
//óñëîâèÿìè âåðñèè 3 Ñòàíäàðòíîé Îáùåñòâåííîé Ëèöåíçèè GNU, îïóáëèêîâàííîé Free Software Foundation. 
// Ìû ðàñïðîñòðàíÿåì äàííóþ ïðîãðàììó â íàäåæäå íà òî, ÷òî îíà áóäåò âàì ïîëåçíîé, îäíàêî ÍÅ ÏÐÅÄÎÑÒÀÂËßÅÌ ÍÀ ÍÅÅ ÍÈÊÀÊÈÕ ÃÀÐÀÍÒÈÉ,
//â òîì ÷èñëå ÃÀÐÀÍÒÈÈ ÒÎÂÀÐÍÎÃÎ ÑÎÑÒÎßÍÈß ÏÐÈ ÏÐÎÄÀÆÅ è ÏÐÈÃÎÄÍÎÑÒÈ ÄËß ÈÑÏÎËÜÇÎÂÀÍÈß Â ÊÎÍÊÐÅÒÍÛÕ ÖÅËßÕ.
//Äëÿ ïîëó÷åíèÿ áîëåå ïîäðîáíîé èíôîðìàöèè îçíàêîìüòåñü ñî Ñòàíäàðòíîé Îáùåñòâåííîé Ëèöåíçèåé GNU.
//Âìåñòå ñ äàííîé ïðîãðàììîé âû äîëæíû áûëè ïîëó÷èòü ýêçåìïëÿð Ñòàíäàðòíîé Îáùåñòâåííîé Ëèöåíçèè GNU.
//Åñëè âû åãî íå ïîëó÷èëè, ñîîáùèòå îá ýòîì â Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//

function getusernamebyid($id)
{
global $t_users;
@$result=mysql_query("SELECT login FROM `$t_users` WHERE id='$id'") or die("<p>ERROR0003!!!<p>");
if (mysql_num_rows($result)!=0)
{
$row=mysql_fetch_array($result);
return $row["login"];
} else {return "Óäàëåííûé ïîëüçîâàòåëü";}
}

include ("../config.php");
include ("../functions.php");
Header("Content-type: text/xml; charset=UTF-8"); 
Header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");   
Header("Cache-Control: no-cache, must-revalidate");   
Header("Pragma: no-cache");   
Header("Last-Modified: ".gmdate("D, d M Y H:i:s")."GMT");
?>
<rss version="2.0">
<channel>
<title><? echo iconv($CONFIG["charset"], "UTF-8", $CONFIG["blog_title"]);?></title>
<link><? echo iconv($CONFIG["charset"], "UTF-8", $CONFIG["sitename"]);?></link>
<description><? echo iconv($CONFIG["charset"], "UTF-8", $CONFIG["blog_title"].": ".$CONFIG["blog_title"]." - ".$CONFIG["blog_content"]);?></description>
<copyright><? echo iconv($CONFIG["charset"], "UTF-8", $CONFIG["blog_hoster"]);?></copyright>
<image>
<title><? echo iconv($CONFIG["charset"], "UTF-8", $CONFIG["blog_title"]);?></title>
<url><? echo iconv($CONFIG["charset"], "UTF-8", $CONFIG["sitename"]."/".$CONFIG["ico"]);?></url>
<link><? echo iconv($CONFIG["charset"], "UTF-8", $CONFIG["sitename"]);?></link>
<width>16</width>
<height>16</height>
</image>
<?
@$result=mysql_query("SELECT * FROM `".$t_topics."` ORDER BY id DESC LIMIT 25") or die("<p>Îøèáêà âûáîðà òîïèêîâ!<p>");
	if (mysql_num_rows($result)!=0)
	{
	while ($row=mysql_fetch_array($result)):
	echo "<item>\r\n";
	echo "<title>".iconv($CONFIG["charset"], "UTF-8", $row["theme"])."</title>\r\n";
	echo "<link>."$CONFIG["sitename"]"./index.php?topic=".$row["id"]."</link>\r\n";
	echo "<description>".iconv($CONFIG["charset"], "UTF-8", substr(htmlspecialchars($row["text"], ENT_QUOTES),0,200))."...</description>\r\n";
	echo "<author>".iconv($CONFIG["charset"], "UTF-8", getusernamebyid($row["author"]))."</author>\r\n";
	echo "<pubDate>".date("r")."</pubDate>\r\n";
	echo "<guid>."$CONFIG["sitename"]"./index.php?topic=".$row["id"]."</guid>\r\n";
	echo "</item>\r\n";
	endwhile;
	}
	else {	echo "<item><title>No topics!</title><description>No topics!</description></item>";	}
?>
</channel>
</rss>
Return current item: Simple But Mighty Blog