]> git.wh0rd.org - tt-rss.git/blobdiff - opml.php
interface tweaks
[tt-rss.git] / opml.php
index 492a8b8cb19d597d375c7b29f94fcc42db07f32a..5b0d7fe6279c7e50e9f97f750795b524a1b10ec7 100644 (file)
--- a/opml.php
+++ b/opml.php
@@ -1,6 +1,5 @@
-<?
+<?php
        require_once "sessions.php";
-
        require_once "sanity_check.php";
        require_once "functions.php";
        require_once "config.php";
@@ -11,6 +10,7 @@
 
        if (DB_TYPE == "pgsql") {
                pg_query($link, "set client_encoding = 'utf-8'");
+               pg_set_client_encoding("UNICODE");
        }
 
        login_sequence($link);
@@ -24,8 +24,8 @@
        if (!$op) $op = "Export";
        
        if ($op == "Export") {
-               header("Content-type: application/xml");
-               print "<?xml version=\"1.0\"?>";
+               header("Content-type: application/xml+opml");
+               print "<?phpxml version=\"1.0\"?>";
        }
 
        if ($op == "Export") {
@@ -49,7 +49,7 @@
                                ORDER BY cat_title,title");
                } else {
                        $result = db_query($link, "SELECT * FROM ttrss_feeds 
-                               ORDER BY title WHERE owner_uid = '$owner_uid'");
+                               WHERE owner_uid = '$owner_uid' ORDER BY title");
                }
 
                $old_cat_title = "";
                        <body>
                        <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.";
-                       print "<p><a class=\"button\" href=\"prefs.php\">
-                       Return to preferences</a></div></body></html>";
-
-                       return;
-               }
+                       <h2>"._('Importing OPML...')."</h2>";
 
                if (is_file($_FILES['opml_file']['tmp_name'])) {
                        $dom = domxml_open_file($_FILES['opml_file']['tmp_name']);
 
                                                        if (db_num_rows($result) == 0) {
 
-                                                               print "Adding category <b>$cat_title</b>...<br>";
+                                                               printf(_("Adding category <b>%s</b>..."), $cat_title);
+                                                               print "<br>";
 
                                                                db_query($link, "INSERT INTO ttrss_feed_categories
                                                                        (title,owner_uid) 
                                                        (<a href=\"$feed_url\">rss</a>)</td>";
 
                                                if (db_num_rows($result) > 0) {
-                                                       print "<td>Already imported.</td>";
+                                                       print "<td>"._("Already imported.")."</td>";
                                                } else {
 
                                                        if ($cat_id) {
 
                                                        db_query($link, $add_query);
                                                        
-                                                       print "<td><b>Done.</b></td>";
+                                                       print "<td><b>"._('Done.')."</b></td>";
                                                }
 
                                                print "</tr>";
                                        print "</table>";
 
                                } else {
-                                       print "<div class=\"error\">Error: can't find body element.</div>";
+                                       print "<div class=\"error\">"._("Error: can't find body element.")."</div>";
                                }
                        } else {
-                               print "<div class=\"error\">Error while parsing document.</div>";
+                               print "<div class=\"error\">"._("Error while parsing document.")."</div>";
                        }
 
                } else {
-                       print "<div class=\"error\">Error: please upload OPML file.</div>";
+                       print "<div class=\"error\">"._("Error: please upload OPML file.")."</div>";
                }
 
-               print "<p><a class=\"button\" href=\"prefs.php\">
-                       Return to preferences</a>";
+               print "<br><form method=\"GET\" action=\"prefs.php\">
+                       <input type=\"submit\" value=\"Return to preferences\">
+                       </form>";
 
                print "</div></body></html>";