diff options
author | Andrew Dolgov <[email protected]> | 2006-02-12 11:20:22 +0100 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2006-02-12 11:20:22 +0100 |
commit | cce5b59a751d5a6189ee4e988efe25e06fa589c6 (patch) | |
tree | 7a3ce5b6fcaf859ba329b72dfd2b627ca6e621f6 /utils/xml-export.php | |
parent | 3f286c4c2bb531156e16f3a1f809d36811ca1cd4 (diff) |
add auth to xml-export if required, bump schema compatibility constants
Diffstat (limited to 'utils/xml-export.php')
-rw-r--r-- | utils/xml-export.php | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/utils/xml-export.php b/utils/xml-export.php index 620331fba..a10c9e3de 100644 --- a/utils/xml-export.php +++ b/utils/xml-export.php @@ -1,7 +1,7 @@ <? session_start(); - define('MAX_SCHEMA_VERSION', 4); + define('MAX_SCHEMA_VERSION', 5); require_once "config.php"; require_once "functions.php"; @@ -10,6 +10,27 @@ if ($_GET["export"]) { header("Content-Type: application/xml"); } + + $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); + + if (!$link) { + if (DB_TYPE == "mysql") { + print mysql_error(); + } + // PG seems to display its own errors just fine by default. + return; + } + + if (DB_TYPE == "pgsql") { + pg_query("set client_encoding = 'utf-8'"); + } + + $result = db_query($link, "SELECT schema_version FROM ttrss_version"); + + $schema_version = db_fetch_result($result, 0, "schema_version"); + + if ($schema_version > 1) login_sequence($link); + ?> <? if (!$_GET["export"]) { ?> @@ -39,23 +60,6 @@ <xmldb> <? - $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); - - if (!$link) { - if (DB_TYPE == "mysql") { - print mysql_error(); - } - // PG seems to display its own errors just fine by default. - return; - } - - if (DB_TYPE == "pgsql") { - pg_query("set client_encoding = 'utf-8'"); - } - - $result = db_query($link, "SELECT schema_version FROM ttrss_version"); - - $schema_version = db_fetch_result($result, 0, "schema_version"); /* if ($schema_version != SCHEMA_VERSION) { print "<error>Source database schema is invalid |