Хранилища Subversion ant

Редакция

Редакция 126 | К новейшей редакции | Содержимое файла | Последнее изменение | Открыть журнал | RSS

Редакция Автор № строки Строка
125 alex-w 1
<?php
2
/*
3
 * Project:     Ant: sources.list generator
4
 * File:        feed.php
5
 *
6
 * This application is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Lesser General Public
8
 * License as published by the Free Software Foundation; either
9
 * version 2.1 of the License, or (at your option) any later version.
10
 *
11
 * This application is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public
17
 * License along with this library; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
 *
20
 */
21
 
22
$mode = abs(intval($_GET["atom"]));
23
// RSS 2.0 - $mode = 0
24
// Atom 1.0 - $mode = 1
25
 
26
switch($mode) {
27
    case '0':
28
        $header = "application/rss+xml";
29
        $query =& $db->query("SELECT * FROM changelog ORDER BY log_id DESC LIMIT 1");
30
        $query->fetchInto($log, DB_FETCHMODE_ASSOC);
31
        $lastbuilddate = date("r",strtotime($log["log_record"]));
32
        $result  = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
33
        $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";
34
        $result .= "<channel>\n";
35
        $result .= "<title>Ant: последние изменения</title>\n";
36
        $result .= "<link>http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/</link>\n";
37
        $result .= "<description>Изменения списка поддерживаемых генератором sources.list дистрибутивов и репозиториев для них.</description>\n";
38
        $result .= "<language>ru</language>\n";
39
        $result .= "<docs>http://blogs.law.harvard.edu/tech/rss</docs>\n";
40
        $result .= "<lastBuildDate>".$lastbuilddate."</lastBuildDate>\n";
41
        $query =& $db->query("SELECT * FROM changelog ORDER BY log_id DESC LIMIT 10");
42
        if ($query->numRows()>0) {
43
            while ($query->fetchInto($log, DB_FETCHMODE_ASSOC)) {
44
                $result .= "<item>\n";
45
                $result .= "<title>".stripslashes($log["log_title"])."</title>\n";
46
                $result .= "<link>http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/changelog.php?id=".$log["log_id"]."<link>\n";
47
                $result .= "<pubDate>".date("r",strtotime($log["log_record"]))."</pubDate>\n";
48
                $result .= "<description><![CDATA[".stripslashes($log["log_desc"])."]]></description>\n";
49
                $result .= "<guid isPermaLink=\"false\">".md5("http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/changelog.php?id=".$log["log_id"])."</guid>\n";
50
                $result .= "</item>\n";
51
            }
52
        }
53
        $result .= "</channel>\n";
54
        break;
55
    case '1':
56
        break;
57
}
58
 
59
header("Content-type: ".$header);
60
echo $result;
61
 
62
?>