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 | |
parent | 10c5820d088d1b59131e622730a72e9a6974e349 (diff) |
OPML export
-rw-r--r-- | backend.php | 5 | ||||
-rw-r--r-- | opml.php | 34 | ||||
-rw-r--r-- | prefs.js | 11 | ||||
-rw-r--r-- | ttrss_schema.sql | 1 |
4 files changed, 37 insertions, 14 deletions
diff --git a/backend.php b/backend.php index 5b996316a..94ddb22ff 100644 --- a/backend.php +++ b/backend.php @@ -572,11 +572,10 @@ href=\"javascript:updateFeedList()\">Refresh</a> OPML: <a class=\"button\" - href=\"javascript:exportOPML()\">Import</a> + href=\"opml.php?op=import\">Import</a> <a class=\"button\" - href=\"javascript:exportOPML()\">Export</a>"; + href=\"opml.php?op=export\">Export</a>"; - } } 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>"; + } + +?> @@ -297,17 +297,6 @@ function localPiggieFunction(enable) { } } -function exportOPML() { - - -} - -function importOPML() { - - -} - - function init() { // IE kludge diff --git a/ttrss_schema.sql b/ttrss_schema.sql index 8be0d3dae..364087f17 100644 --- a/ttrss_schema.sql +++ b/ttrss_schema.sql @@ -36,6 +36,7 @@ create table ttrss_entries (id serial not null primary key, content text not null, content_hash varchar(250) not null, last_read timestamp, + marked boolean not null default false, date_entered timestamp not null default NOW(), no_orig_date boolean not null default false, comments varchar(250) not null default '', |