Хранилища Subversion ant

Сравнить редакции

Не учитывать пробелы Редакция 124 → Редакция 125

/trunk/feed.php
Новый файл
0,0 → 1,62
<?php
/*
* Project: Ant: sources.list generator
* File: feed.php
*
* This application is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
 
$mode = abs(intval($_GET["atom"]));
// RSS 2.0 - $mode = 0
// Atom 1.0 - $mode = 1
 
switch($mode) {
case '0':
$header = "application/rss+xml";
$query =& $db->query("SELECT * FROM changelog ORDER BY log_id DESC LIMIT 1");
$query->fetchInto($log, DB_FETCHMODE_ASSOC);
$lastbuilddate = date("r",strtotime($log["log_record"]));
$result = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
$result .= "<rss version=\"2.0\"\n xmlns:content=\"http://purl.org/rss/1.0/modules/content/\"\n xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n>\n";
$result .= "<channel>\n";
$result .= "<title>Ant: последние изменения</title>\n";
$result .= "<link>http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/</link>\n";
$result .= "<description>Изменения списка поддерживаемых генератором sources.list дистрибутивов и репозиториев для них.</description>\n";
$result .= "<language>ru</language>\n";
$result .= "<docs>http://blogs.law.harvard.edu/tech/rss</docs>\n";
$result .= "<lastBuildDate>".$lastbuilddate."</lastBuildDate>\n";
$query =& $db->query("SELECT * FROM changelog ORDER BY log_id DESC LIMIT 10");
if ($query->numRows()>0) {
while ($query->fetchInto($log, DB_FETCHMODE_ASSOC)) {
$result .= "<item>\n";
$result .= "<title>".stripslashes($log["log_title"])."</title>\n";
$result .= "<link>http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/changelog.php?id=".$log["log_id"]."<link>\n";
$result .= "<pubDate>".date("r",strtotime($log["log_record"]))."</pubDate>\n";
$result .= "<description><![CDATA[".stripslashes($log["log_desc"])."]]></description>\n";
$result .= "<guid isPermaLink=\"false\">".md5("http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/changelog.php?id=".$log["log_id"])."</guid>\n";
$result .= "</item>\n";
}
}
$result .= "</channel>\n";
break;
case '1':
break;
}
 
header("Content-type: ".$header);
echo $result;
 
?>