From: Andrew Dolgov Date: Thu, 1 Dec 2005 06:10:39 +0000 (+0100) Subject: cleanup OPML import interface X-Git-Tag: schema_feature_freeze_for_1.1~12 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=4e9f5c242047f215b23a4f2fd2d488d1dead70d3;hp=d998a8a8e0506958a3249234075aca79d590ee5d;p=tt-rss.git cleanup OPML import interface --- diff --git a/opml.css b/opml.css index de174239..89f08d0f 100644 --- a/opml.css +++ b/opml.css @@ -52,3 +52,19 @@ a { color : black; } +a { + color : black; + text-decoration : none; +} + +a:hover { + color : #5050aa; +} + +ul { + list-style-type : none; + margin : 0px; + padding : 10px; +} + + diff --git a/opml.php b/opml.php index f00be657..21af43f7 100644 --- a/opml.php +++ b/opml.php @@ -2,27 +2,32 @@ session_start(); require_once "sanity_check.php"; - - // FIXME there are some brackets issues here - - $op = $_REQUEST["op"]; - if ($op == "Export") { - header("Content-type: application/xml"); - print ""; - } - + require_once "functions.php"; require_once "config.php"; require_once "db.php"; require_once "db-prefs.php"; - $owner_uid = $_SESSION["uid"]; - $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); if (DB_TYPE == "pgsql") { pg_query($link, "set client_encoding = 'utf-8'"); } + login_sequence($link); + + $owner_uid = $_SESSION["uid"]; + + // FIXME there are some brackets issues here + + $op = $_REQUEST["op"]; + + if (!$op) $op = "Export"; + + if ($op == "Export") { + header("Content-type: application/xml"); + print ""; + } + if ($op == "Export") { print ""; print " @@ -93,8 +98,9 @@ -

Importing OPML...

-
"; +

+
+

Importing OPML...

"; if (WEB_DEMO_MODE) { print "OPML import is disabled in demo-mode."; @@ -117,10 +123,13 @@ $outlines = $body->get_elements_by_tagname('outline'); + print ""; + foreach ($outlines as $outline) { $feed_title = db_escape_string($outline->get_attribute('text')); $cat_title = db_escape_string($outline->get_attribute('title')); $feed_url = db_escape_string($outline->get_attribute('xmlUrl')); + $site_url = db_escape_string($outline->get_attribute('htmlUrl')); if ($cat_title && !$feed_url) { @@ -135,7 +144,8 @@ print "Adding category $cat_title...
"; db_query($link, "INSERT INTO ttrss_feed_categories - (title,owner_uid) VALUES ('$cat_title', '$owner_uid')"); + (title,owner_uid,site_url) + VALUES ('$cat_title', '$owner_uid', '$site_url')"); } db_query($link, "COMMIT"); @@ -172,10 +182,11 @@ (title = '$feed_title' OR feed_url = '$feed_url') AND owner_uid = '$owner_uid'"); - print "Feed $feed_title ($feed_url)... "; + print ""; if (db_num_rows($result) > 0) { - print " Already imported.
"; + print ""; } else { if ($cat_id) { @@ -192,12 +203,16 @@ db_query($link, $add_query); - print "Done.
"; + print ""; } + + print ""; db_query($link, "COMMIT"); } + print "
$feed_title + (rss)Already imported.Done.
"; + } else { print "
Error: can't find body element.
"; }