Редакция 127 | Редакция 129 | К новейшей редакции | Только различия | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 127 | Редакция 128 | ||
---|---|---|---|
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 = abs(intval($_GET["atom"])); |
24 | $mode = abs(intval($_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>\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>\n"; |
36 | $result .= "<channel>\n"; |
36 | $result .= "<channel>\n"; |
37 | $result .= "<title>Ant: последние изменения</title>\n"; |
37 | $result .= "<title>Ant: последние изменения</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 | $query =& $db->query("SELECT * FROM changelog ORDER BY log_id DESC LIMIT 10"); |
43 | $query =& $db->query("SELECT * FROM changelog ORDER BY log_id DESC LIMIT 10"); |
44 | if ($query->numRows()>0) { |
44 | if ($query->numRows()>0) { |
45 | while ($query->fetchInto($log, DB_FETCHMODE_ASSOC)) { |
45 | while ($query->fetchInto($log, DB_FETCHMODE_ASSOC)) { |
46 | $result .= "<item>\n"; |
46 | $result .= "<item>\n"; |
47 | $result .= "<title>".stripslashes($log["log_title"])."</title>\n"; |
47 | $result .= "<title>".stripslashes($log["log_title"])."</title>\n"; |
48 | $result .= "<link>http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/changelog.php?id=".$log["log_id"]."</link>\n"; |
48 | $result .= "<link>http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/changelog.php?id=".$log["log_id"]."</link>\n"; |
49 | $result .= "<pubDate>".date("r",strtotime($log["log_record"]))."</pubDate>\n"; |
49 | $result .= "<pubDate>".date("r",strtotime($log["log_record"]))."</pubDate>\n"; |
50 | $result .= "<description><![CDATA[".stripslashes($log["log_desc"])."]]></description>\n"; |
50 | $result .= "<description><![CDATA[".stripslashes($log["log_desc"])."]]></description>\n"; |
51 | $result .= "<guid isPermaLink=\"false\">".md5("http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/changelog.php?id=".$log["log_id"])."</guid>\n"; |
51 | $result .= "<guid isPermaLink=\"false\">".md5("http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/changelog.php?id=".$log["log_id"])."</guid>\n"; |
52 | $result .= "</item>\n"; |
52 | $result .= "</item>\n"; |
53 | }
|
53 | }
|
54 | }
|
54 | }
|
55 | $result .= "</channel>\n"; |
55 | $result .= "</channel>\n</rss>\n"; |
56 | break; |
56 | break; |
57 | case '1': |
57 | case '1': |
58 | break; |
58 | break; |
59 | }
|
59 | }
|
60 | 60 | ||
61 | header("Content-type: ".$header); |
61 | header("Content-type: ".$header); |
62 | echo $result; |
62 | echo $result; |
63 | 63 | ||
64 | ?>
|
64 | ?>
|
65 | 65 |