From b6a6e262bebfdcea6b9523e63c287f94b4ffcff6 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 13 Jan 2010 23:59:02 +0300 Subject: rework OPML import to use popup dialog --- modules/popup-dialog.php | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'modules/popup-dialog.php') diff --git a/modules/popup-dialog.php b/modules/popup-dialog.php index 7ba30a9f7..06a82ad57 100644 --- a/modules/popup-dialog.php +++ b/modules/popup-dialog.php @@ -3,6 +3,67 @@ $id = $_REQUEST["id"]; $param = db_escape_string($_REQUEST["param"]); + if ($id == "importOpml") { + print "
".__('OPML Import')."
"; + print "
"; + + print "
"; + + $owner_uid = $_SESSION["uid"]; + + db_query($link, "BEGIN"); + + /* create Imported feeds category just in case */ + + $result = db_query($link, "SELECT id FROM + ttrss_feed_categories WHERE title = 'Imported feeds' AND + owner_uid = '$owner_uid' LIMIT 1"); + + if (db_num_rows($result) == 0) { + db_query($link, "INSERT INTO ttrss_feed_categories + (title,owner_uid) + VALUES ('Imported feeds', '$owner_uid')"); + } + + db_query($link, "COMMIT"); + + /* Handle OPML import by DOMXML/DOMDocument */ + + if (function_exists('domxml_open_file')) { + print "
    "; + print "
  • ".__("Importing using DOMXML.")."
  • "; + require_once "modules/opml_domxml.php"; + opml_import_domxml($link, $owner_uid); + print "
"; + } else if (PHP_VERSION >= 5) { + print "
    "; + print "
  • ".__("Importing using DOMDocument.")."
  • "; + require_once "modules/opml_domdoc.php"; + opml_import_domdoc($link, $owner_uid); + print "
"; + } else { + print_error(__("DOMXML extension is not found. It is required for PHP versions below 5.")); + } + + print "
"; + + print "
"; + + print ""; + + print "
"; + + print ""; + + print "
"; + + return; + } + if ($id == "editPrefProfiles") { print "
".__('Settings Profiles')."
"; -- cgit v1.2.3