From 6c2637d973a8887bdccf4cdbd15e30643605c576 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 24 Dec 2012 15:03:19 +0400 Subject: move data import/export to a separate plugin --- classes/dlg.php | 41 ------------------------ classes/pref/feeds.php | 28 +---------------- classes/rpc.php | 85 +------------------------------------------------- 3 files changed, 2 insertions(+), 152 deletions(-) (limited to 'classes') diff --git a/classes/dlg.php b/classes/dlg.php index 10b6d580e..09f7cc387 100644 --- a/classes/dlg.php +++ b/classes/dlg.php @@ -16,24 +16,6 @@ class Dlg extends Handler_Protected { print ""; } - function exportData() { - - print "

You need to prepare exported data first by clicking the button below.

"; - - print "
"; - print ""; - - print ""; - - print "
"; - - - } - function importOpml() { header("Content-Type: text/html"); # required for iframe @@ -704,29 +686,6 @@ class Dlg extends Handler_Protected { return; } - function dataImport() { - header("Content-Type: text/html"); # required for iframe - - print "
"; - - if (is_file($_FILES['export_file']['tmp_name'])) { - - perform_data_import($this->link, $_FILES['export_file']['tmp_name'], $_SESSION['uid']); - - } else { - print "

" . T_sprintf("Could not upload file. You might need to adjust upload_max_filesize - in PHP.ini (current value = %s)", ini_get("upload_max_filesize")) . " or use CLI import tool.

"; - - } - - print ""; - - print "
"; - - } - function batchSubscribe() { print ""; print ""; diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index 373498f3c..447aa8947 100644 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -1376,9 +1376,7 @@ class Pref_Feeds extends Handler_Protected { print ""; # feeds pane - print "
"; - - print "

" . __("OPML") . "

"; + print "
"; print "

" . __("Using OPML you can export and import your feeds, filters, labels and Tiny Tiny RSS settings.") . " "; @@ -1416,30 +1414,6 @@ class Pref_Feeds extends Handler_Protected { print " "; - - print "

" . __("Article archive") . "

"; - - print "

" . __("You can export and import your Starred and Archived articles for safekeeping or when migrating between tt-rss instances.") . "

"; - - print " "; - - print "
"; - - print ""; - - print "
-   - - - "; - - print "
"; # pane if (strpos($_SERVER['HTTP_USER_AGENT'], "Firefox") !== false) { diff --git a/classes/rpc.php b/classes/rpc.php index c7cdc3810..08efbcffc 100644 --- a/classes/rpc.php +++ b/classes/rpc.php @@ -2,7 +2,7 @@ class RPC extends Handler_Protected { function csrf_ignore($method) { - $csrf_ignored = array("sanitycheck", "buttonplugin", "exportget", "completelabels"); + $csrf_ignored = array("sanitycheck", "completelabels"); return array_search($method, $csrf_ignored) !== false; } @@ -14,89 +14,6 @@ class RPC extends Handler_Protected { $_SESSION["prefs_cache"] = array(); } - function exportget() { - $exportname = CACHE_DIR . "/export/" . - sha1($_SESSION['uid'] . $_SESSION['login']) . ".xml"; - - if (file_exists($exportname)) { - header("Content-type: text/xml"); - - if (function_exists('gzencode')) { - header("Content-Disposition: attachment; filename=TinyTinyRSS_exported.xml.gz"); - echo gzencode(file_get_contents($exportname)); - } else { - header("Content-Disposition: attachment; filename=TinyTinyRSS_exported.xml"); - echo file_get_contents($exportname); - } - } else { - echo "File not found."; - } - } - - function exportrun() { - $offset = (int) db_escape_string($_REQUEST['offset']); - $exported = 0; - $limit = 250; - - if ($offset < 10000 && is_writable(CACHE_DIR . "/export")) { - $result = db_query($this->link, "SELECT - ttrss_entries.guid, - ttrss_entries.title, - content, - marked, - published, - score, - note, - link, - tag_cache, - label_cache, - ttrss_feeds.title AS feed_title, - ttrss_feeds.feed_url AS feed_url, - ttrss_entries.updated - FROM - ttrss_user_entries LEFT JOIN ttrss_feeds ON (ttrss_feeds.id = feed_id), - ttrss_entries - WHERE - (marked = true OR feed_id IS NULL) AND - ref_id = ttrss_entries.id AND - ttrss_user_entries.owner_uid = " . $_SESSION['uid'] . " - ORDER BY ttrss_entries.id LIMIT $limit OFFSET $offset"); - - $exportname = sha1($_SESSION['uid'] . $_SESSION['login']); - - if ($offset == 0) { - $fp = fopen(CACHE_DIR . "/export/$exportname.xml", "w"); - fputs($fp, ""); - } else { - $fp = fopen(CACHE_DIR . "/export/$exportname.xml", "a"); - } - - if ($fp) { - - while ($line = db_fetch_assoc($result)) { - fputs($fp, "
"); - - foreach ($line as $k => $v) { - fputs($fp, "<$k>"); - } - - fputs($fp, "
"); - } - - $exported = db_num_rows($result); - - if ($exported < $limit && $exported > 0) { - fputs($fp, "
"); - } - - fclose($fp); - } - - } - - print json_encode(array("exported" => $exported)); - } - function remprofiles() { $ids = explode(",", db_escape_string(trim($_REQUEST["ids"]))); -- cgit v1.2.3-54-g00ecf