diff options
author | Andrew Dolgov <[email protected]> | 2005-09-02 11:18:45 +0100 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2005-09-02 11:18:45 +0100 |
commit | 9a4506c87de04bcde0d6da3da7c289f58d69312b (patch) | |
tree | 13c7c1dccb1d671dab0bab9c2de1a91bb81639a7 /opml.php | |
parent | 10c5820d088d1b59131e622730a72e9a6974e349 (diff) |
OPML export
Diffstat (limited to 'opml.php')
-rw-r--r-- | opml.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/opml.php b/opml.php new file mode 100644 index 000000000..05ad1943c --- /dev/null +++ b/opml.php @@ -0,0 +1,34 @@ +<? + // FIXME there are some brackets issues here + + $op = $_GET["op"]; + if ($op == "export") { + header("Content-type: application/xml"); + } + + require_once "config.php"; + require_once "functions.php"; + + $link = pg_connect(DB_CONN); + + pg_query($link, "set client_encoding = 'utf-8'"); + + if ($op == "export") { + print "<?xml version=\"1.0\"?>"; + print "<opml version=\"1.0\">"; + print "<head><dateCreated>" . date("r", time()) . "</dateCreated></head>"; + print "<body>"; + + $result = pg_query("SELECT * FROM ttrss_feeds ORDER BY title"); + + while ($line = pg_fetch_assoc($result)) { + $title = $line["title"]; + $url = $line["feed_url"]; + + print "<outline text=\"$title\" xmlUrl=\"$url\"/>"; + } + + print "</body></opml>"; + } + +?> |