]>
git.wh0rd.org - tt-rss.git/blob - xml-export.php
3 Exports your starred articles in schema-neutral XML format.
6 require_once "config.php";
7 require_once "functions.php";
10 define('SCHEMA_VERSION', 1);
12 header("Content-Type: application/xml");
18 $link = db_connect(DB_HOST
, DB_USER
, DB_PASS
, DB_NAME
);
21 if (DB_TYPE
== "mysql") {
24 // PG seems to display its own errors just fine by default.
28 if (DB_TYPE
== "pgsql") {
29 pg_query("set client_encoding = 'utf-8'");
32 $result = db_query($link, "SELECT schema_version FROM ttrss_version");
34 $schema_version = db_fetch_result($result, 0, "schema_version");
36 if ($schema_version != SCHEMA_VERSION
) {
37 print "Error: database schema is invalid
38 (got version $schema_version; expected ".SCHEMA_VERSION
.")";
42 print "<schema_version>$schema_version</schema_version>";
49 $result = db_query($link, "SELECT
50 ttrss_entries.title AS title,
60 ttrss_feeds.feed_url AS feed_url,
61 ttrss_feeds.title AS feed_title
63 ttrss_entries,ttrss_feeds
65 feed_id = ttrss_feeds.id AND marked = true");
68 while ($line = db_fetch_assoc($result)) {
71 foreach (array_keys($line) as $key) {
72 print "<$key><![CDATA[".$line[$key]."]]></$key>";