]> git.wh0rd.org Git - tt-rss.git/commitdiff
cleanup OPML import interface
authorAndrew Dolgov <fox@madoka.spb.ru>
Thu, 1 Dec 2005 06:10:39 +0000 (07:10 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Thu, 1 Dec 2005 06:10:39 +0000 (07:10 +0100)
opml.css
opml.php

index de17423947e4ad6a3f51faa4b91552ad6ed46d8e..89f08d0ff80fa11accbd143872fb2402c1f074cf 100644 (file)
--- 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; 
+}
+
+
index f00be657dab768a5cd82164484c8dd064749ed30..21af43f7b9ab1bf597f67272d31b6b2ce7308c41 100644 (file)
--- 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 "<?xml version=\"1.0\"?>";
-       }
-
+       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 "<?xml version=\"1.0\"?>";
+       }
+
        if ($op == "Export") {
                print "<opml version=\"1.0\">";
                print "<head>
@@ -93,8 +98,9 @@
                                <link rel=\"stylesheet\" href=\"opml.css\" type=\"text/css\">
                        </head>
                        <body>
-                       <h1>Importing OPML...</h1>
-                       <div class=\"opmlBody\">";
+                       <h1><img src=\"images/ttrss_logo.png\"></h1>
+                       <div class=\"opmlBody\">
+                       <h2>Importing OPML...</h2>";
 
                if (WEB_DEMO_MODE) {
                        print "OPML import is disabled in demo-mode.";
 
                                        $outlines = $body->get_elements_by_tagname('outline');
 
+                                       print "<table>";
+
                                        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) {
 
                                                                print "Adding category <b>$cat_title</b>...<br>";
 
                                                                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");
                                                        (title = '$feed_title' OR feed_url = '$feed_url') 
                                                        AND owner_uid = '$owner_uid'");
 
-                                               print "Feed <b>$feed_title</b> ($feed_url)... ";
+                                               print "<tr><td><a href='$site_url'><b>$feed_title</b></a></b> 
+                                                       (<a href=\"$feed_url\">rss</a>)</td>";
 
                                                if (db_num_rows($result) > 0) {
-                                                       print " Already imported.<br>";
+                                                       print "<td>Already imported.</td>";
                                                } else {
 
                                                        if ($cat_id) {
 
                                                        db_query($link, $add_query);
                                                        
-                                                       print "<b>Done.</b><br>";
+                                                       print "<td><b>Done.</b></td>";
                                                }
+
+                                               print "</tr>";
                                                
                                                db_query($link, "COMMIT");
                                        }
 
+                                       print "</table>";
+
                                } else {
                                        print "<div class=\"error\">Error: can't find body element.</div>";
                                }