Хранилища Subversion ant

Редакция

Редакция 209 | К новейшей редакции | Только различия | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS

Редакция 209 Редакция 458
1
<?php
1
<?php
2
/*
2
/*
3
 * Project:     Ant: sources.list generator
3
 * Project:     Ant: sources.list generator
4
 * File:        feed.php
4
 * File:        feed.php
5
 *
5
 *
6
 * This application is free software; you can redistribute it and/or
6
 * This application is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Lesser General Public
7
 * modify it under the terms of the GNU Lesser General Public
8
 * License as published by the Free Software Foundation; either
8
 * License as published by the Free Software Foundation; either
9
 * version 2.1 of the License, or (at your option) any later version.
9
 * version 2.1 of the License, or (at your option) any later version.
10
 *
10
 *
11
 * This application is distributed in the hope that it will be useful,
11
 * This application is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * Lesser General Public License for more details.
14
 * Lesser General Public License for more details.
15
 *
15
 *
16
 * You should have received a copy of the GNU Lesser General Public
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
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
18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
 *
19
 *
20
 */
20
 */
21
21
22
require_once dirname(__FILE__)."/lib/init.php";
22
require_once dirname(__FILE__)."/lib/init.php";
23
23
24
$mode = $secure->wrapInt($_GET["atom"]);
24
$mode = $secure->wrapInt($_GET["atom"]);
25
// RSS 2.0 - $mode = 0
25
// RSS 2.0 - $mode = 0
26
// Atom 1.0 - $mode = 1
26
// Atom 1.0 - $mode = 1
27
27
28
switch($mode) {
28
switch($mode) {
29
    case '0':
29
    case '0':
30
        $header = "application/rss+xml";
30
        $header = "application/rss+xml";
31
        $query =& $db->query("SELECT * FROM changelog ORDER BY log_id DESC LIMIT 1");
31
        $query =& $db->query("SELECT * FROM changelog ORDER BY log_id DESC LIMIT 1");
32
        $query->fetchInto($log, DB_FETCHMODE_ASSOC);
32
        $query->fetchInto($log, DB_FETCHMODE_ASSOC);
33
        $lastbuilddate = date("r",strtotime($log["log_record"]));
33
        $lastbuilddate = date("r",strtotime($log["log_record"]));
34
        $result  = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
34
        $result  = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
35
        $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 xmlns:atom=\"http://www.w3.org/2005/Atom\"\n>\n";
35
        $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 xmlns:atom=\"http://www.w3.org/2005/Atom\"\n>\n";
36
        $result .= "<channel>\n";
36
        $result .= "<channel>\n";
37
        $result .= "<title>".$core->getSetting('codename',$db)." последние изменения</title>\n";
37
        $result .= "<title>".$core->getSetting('codename',$db)." последние изменения</title>\n";
38
        $result .= "<link>http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/</link>\n";
38
        $result .= "<link>http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/</link>\n";
39
        $result .= "<description>Изменения списка поддерживаемых генератором sources.list дистрибутивов и репозиториев для них.</description>\n";
39
        $result .= "<description>Изменения списка поддерживаемых генератором sources.list дистрибутивов и репозиториев для них.</description>\n";
40
        $result .= "<language>ru</language>\n";
40
        $result .= "<language>ru</language>\n";
41
        $result .= "<docs>http://blogs.law.harvard.edu/tech/rss</docs>\n";
41
        $result .= "<docs>http://blogs.law.harvard.edu/tech/rss</docs>\n";
42
        $result .= "<lastBuildDate>".$lastbuilddate."</lastBuildDate>\n";
42
        $result .= "<lastBuildDate>".$lastbuilddate."</lastBuildDate>\n";
43
        $result .= "<atom:link href=\"http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/feed.php\" rel=\"self\" type=\"".$header."\" />\n";
43
        $result .= "<atom:link href=\"http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/feed.php\" rel=\"self\" type=\"".$header."\" />\n";
44
        $query =& $db->query("SELECT * FROM changelog ORDER BY log_id DESC LIMIT 10");
44
        $query =& $db->query("SELECT * FROM changelog ORDER BY log_id DESC LIMIT 10");
45
        if ($query->numRows()>0) {
45
        if ($query->numRows()>0) {
46
            while ($query->fetchInto($log, DB_FETCHMODE_ASSOC)) {
46
            while ($query->fetchInto($log, DB_FETCHMODE_ASSOC)) {
47
                $result .= "<item>\n";
47
                $result .= "<item>\n";
48
                $result .= "<title>".$secure->stripStr($log["log_title"])."</title>\n";
48
                $result .= "<title>".$secure->stripStr($log["log_title"])."</title>\n";
49
                $result .= "<link>http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/changelog.php?id=".$log["log_id"]."</link>\n";
49
                $result .= "<link>http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/changelog.php?id=".$log["log_id"]."</link>\n";
50
                $result .= "<pubDate>".date("r",strtotime($log["log_record"]))."</pubDate>\n";
50
                $result .= "<pubDate>".date("r",strtotime($log["log_record"]))."</pubDate>\n";
51
                $result .= "<description><![CDATA[".$secure->stripStr($log["log_desc"])."]]></description>\n";
51
                $result .= "<description><![CDATA[".$secure->stripStr($log["log_desc"])."]]></description>\n";
52
                $result .= "<guid isPermaLink=\"false\">".md5("http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/changelog.php?id=".$log["log_id"])."</guid>\n";
52
                $result .= "<guid isPermaLink=\"false\">".md5("http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/changelog.php?id=".$log["log_id"])."</guid>\n";
53
                $result .= "</item>\n";
53
                $result .= "</item>\n";
54
            }
54
            }
55
        }
55
        }
56
        $result .= "</channel>\n</rss>";
56
        $result .= "</channel>\n</rss>";
57
        break;
57
        break;
58
    case '1':
58
    case '1':
59
        $header = "application/atom+xml";
59
        $header = "application/atom+xml";
60
        $query =& $db->query("SELECT * FROM changelog ORDER BY log_id DESC LIMIT 1");
60
        $query =& $db->query("SELECT * FROM changelog ORDER BY log_id DESC LIMIT 1");
61
        $query->fetchInto($log, DB_FETCHMODE_ASSOC);
61
        $query->fetchInto($log, DB_FETCHMODE_ASSOC);
62
        $lastbuilddate = $log["log_record"];
62
        $lastbuilddate = $log["log_record"];
63
        $lastbuilddate = str_replace(" ","T",$lastbuilddate);
63
        $lastbuilddate = str_replace(" ","T",$lastbuilddate);
64
        $lastbuilddate .= "+06:00";
64
        $lastbuilddate .= "+06:00";
65
        $result  = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
65
        $result  = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
66
        $result .= "<feed xmlns=\"http://www.w3.org/2005/Atom\">\n";
66
        $result .= "<feed xmlns=\"http://www.w3.org/2005/Atom\">\n";
67
        $result .= "<title>".$core->getSetting('codename',$db)." последние изменения</title>\n";
67
        $result .= "<title>".$core->getSetting('codename',$db)." последние изменения</title>\n";
68
        $result .= "<link href=\"http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/\" />\n";
68
        $result .= "<link href=\"http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/\" />\n";
69
        $result .= "<link href=\"http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/feed.php?atom=1\" rel=\"self\" />\n";
69
        $result .= "<link href=\"http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/feed.php?atom=1\" rel=\"self\" />\n";
70
        $result .= "<updated>".$lastbuilddate."</updated>\n";
70
        $result .= "<updated>".$lastbuilddate."</updated>\n";
71
        $result .= "<author>\n<name>\n".$core->getSetting('codename',$db)."</name>\n</author>\n";
71
        $result .= "<author>\n<name>\n".$core->getSetting('codename',$db)."</name>\n</author>\n";
72
        $result .= "<id>urn:uuid:".$core->getUUID("http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/")."</id>\n";
72
        $result .= "<id>urn:uuid:".$core->getUUID("http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/")."</id>\n";
73
        $query =& $db->query("SELECT * FROM changelog ORDER BY log_id DESC LIMIT 10");
73
        $query =& $db->query("SELECT * FROM changelog ORDER BY log_id DESC LIMIT 10");
74
        if ($query->numRows()>0) {
74
        if ($query->numRows()>0) {
75
            while ($query->fetchInto($log, DB_FETCHMODE_ASSOC)) {
75
            while ($query->fetchInto($log, DB_FETCHMODE_ASSOC)) {
76
                $result .= "<entry>\n";
76
                $result .= "<entry>\n";
77
                $result .= "<title type=\"html\">".$secure->stripStr($log["log_title"])."</title>\n";
77
                $result .= "<title type=\"html\">".$secure->stripStr($log["log_title"])."</title>\n";
78
                $result .= "<link href=\"http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/changelog.php?id=".$log["log_id"]."\" />\n";
78
                $result .= "<link href=\"http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/changelog.php?id=".$log["log_id"]."\" />\n";
79
                $result .= "<summary type=\"html\"><![CDATA[".$secure->stripStr($log["log_desc"])."]]></summary>\n";
79
                $result .= "<summary type=\"html\"><![CDATA[".$secure->stripStr($log["log_desc"])."]]></summary>\n";
80
                $result .= "<id>urn:uuid:".$core->getUUID("http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/changelog.php?id=".$log["log_id"])."</id>\n";
80
                $result .= "<id>urn:uuid:".$core->getUUID("http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/changelog.php?id=".$log["log_id"])."</id>\n";
81
                $updated = str_replace(" ","T",$log["log_record"]);
81
                $updated = str_replace(" ","T",$log["log_record"]);
82
                $updated .= "+06:00";
82
                $updated .= "+06:00";
83
                $result .= "<updated>".$updated."</updated>\n";
83
                $result .= "<updated>".$updated."</updated>\n";
84
                $result .= "</entry>\n";
84
                $result .= "</entry>\n";
85
            }
85
            }
86
        }
86
        }
87
        $result .= "</feed>";
87
        $result .= "</feed>";
88
        break;
88
        break;
89
}
89
}
90
90
91
header("Content-type: ".$header."\n\n");
91
header("Content-type: ".$header."\n\n");
92
echo $result;
92
echo $result;
93
93
94
?>
94
?>
95
 
95