Редакция 126 | Редакция 128 | К новейшей редакции | Содержимое файла | Сравнить с предыдущей | Последнее изменение | Открыть журнал | 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 | |||
126 | alex-w | 22 | require_once dirname(__FILE__)."/lib/init.php"; |
23 | |||
125 | alex-w | 24 | $mode = abs(intval($_GET["atom"])); |
25 | // RSS 2.0 - $mode = 0 |
||
26 | // Atom 1.0 - $mode = 1 |
||
27 | |||
28 | switch($mode) { |
||
29 | case '0': |
||
30 | $header = "application/rss+xml"; |
||
31 | $query =& $db->query("SELECT * FROM changelog ORDER BY log_id DESC LIMIT 1"); |
||
32 | $query->fetchInto($log, DB_FETCHMODE_ASSOC); |
||
33 | $lastbuilddate = date("r",strtotime($log["log_record"])); |
||
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"; |
||
36 | $result .= "<channel>\n"; |
||
37 | $result .= "<title>Ant: последние изменения</title>\n"; |
||
38 | $result .= "<link>http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/</link>\n"; |
||
39 | $result .= "<description>Изменения списка поддерживаемых генератором sources.list дистрибутивов и репозиториев для них.</description>\n"; |
||
40 | $result .= "<language>ru</language>\n"; |
||
41 | $result .= "<docs>http://blogs.law.harvard.edu/tech/rss</docs>\n"; |
||
42 | $result .= "<lastBuildDate>".$lastbuilddate."</lastBuildDate>\n"; |
||
43 | $query =& $db->query("SELECT * FROM changelog ORDER BY log_id DESC LIMIT 10"); |
||
44 | if ($query->numRows()>0) { |
||
45 | while ($query->fetchInto($log, DB_FETCHMODE_ASSOC)) { |
||
46 | $result .= "<item>\n"; |
||
47 | $result .= "<title>".stripslashes($log["log_title"])."</title>\n"; |
||
127 | alex-w | 48 | $result .= "<link>http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/changelog.php?id=".$log["log_id"]."</link>\n"; |
125 | alex-w | 49 | $result .= "<pubDate>".date("r",strtotime($log["log_record"]))."</pubDate>\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"; |
||
52 | $result .= "</item>\n"; |
||
53 | } |
||
54 | } |
||
55 | $result .= "</channel>\n"; |
||
56 | break; |
||
57 | case '1': |
||
58 | break; |
||
59 | } |
||
60 | |||
61 | header("Content-type: ".$header); |
||
62 | echo $result; |
||
63 | |||
64 | ?> |