print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Import and export')."\">";
- print "<h3>" . __("Article archive") . "</h3>";
+ print_notice(__("You can export and import your Starred and Archived articles for safekeeping or when migrating between tt-rss instances of same version."));
- print "<p>" . __("You can export and import your Starred and Archived articles for safekeeping or when migrating between tt-rss instances.") . "</p>";
+ print "<p>";
print "<button dojoType=\"dijit.form.Button\" onclick=\"return exportData()\">".
__('Export my data')."</button> ";
print "</form>";
+ print "</p>";
+
print "</div>"; # pane
}
if (file_exists($exportname)) {
header("Content-type: text/xml");
+ $timestamp_suffix = date("Y-m-d", filemtime($exportname));
+
if (function_exists('gzencode')) {
- header("Content-Disposition: attachment; filename=TinyTinyRSS_exported.xml.gz");
+ header("Content-Disposition: attachment; filename=TinyTinyRSS_exported_${timestamp_suffix}.xml.gz");
echo gzencode(file_get_contents($exportname));
} else {
- header("Content-Disposition: attachment; filename=TinyTinyRSS_exported.xml");
+ header("Content-Disposition: attachment; filename=TinyTinyRSS_exported_${timestamp_suffix}.xml");
echo file_get_contents($exportname);
}
} else {
$num_processed = 0;
$num_feeds_created = 0;
+ libxml_disable_entity_loader(false);
+
$doc = @DOMDocument::load($filename);
if (!$doc) {
$doc = DOMDocument::loadXML($data);
}
+ libxml_disable_entity_loader(true);
+
if ($doc) {
$xpath = new DOMXpath($doc);
$article = array();
foreach ($article_node->childNodes as $child) {
- if ($child->nodeName != 'label_cache')
- $article[$child->nodeName] = db_escape_string($child->nodeValue);
- else
+ if ($child->nodeName == 'content') {
+ $article[$child->nodeName] = db_escape_string($child->nodeValue, false);
+ } else if ($child->nodeName == 'label_cache') {
$article[$child->nodeName] = $child->nodeValue;
+ } else {
+ $article[$child->nodeName] = db_escape_string($child->nodeValue);
+ }
}
//print_r($article);
$score = (int) $article['score'];
$tag_cache = $article['tag_cache'];
- $label_cache = db_escape_string($article['label_cache']);
$note = $article['note'];
//print "Importing " . $article['title'] . "<br/>";
published, score, tag_cache, label_cache, uuid, note)
VALUES ($ref_id, $owner_uid, $feed, false,
NULL, $marked, $published, $score, '$tag_cache',
- '$label_cache', '', '$note')");
+ '', '', '$note')");
- $label_cache = json_decode($label_cache, true);
+ $label_cache = json_decode($article['label_cache'], true);
if (is_array($label_cache) && $label_cache["no-labels"] != 1) {
foreach ($label_cache as $label) {
print "<p>" .
__("Finished: ").
- vsprintf(ngettext("%d article processed, ", "%d articles processed, ", $num_processed), $num_processed).
- vsprintf(ngettext("%d imported, ", "%d imported, ", $num_imported), $num_imported).
- vsprintf(ngettext("%d feed created.", "%d feeds created.", $num_feeds_created), $num_feeds_created).
+ vsprintf(_ngettext("%d article processed, ", "%d articles processed, ", $num_processed), $num_processed).
+ vsprintf(_ngettext("%d imported, ", "%d imported, ", $num_imported), $num_imported).
+ vsprintf(_ngettext("%d feed created.", "%d feeds created.", $num_feeds_created), $num_feeds_created).
"</p>";
} else {
}
+ function api_version() {
+ return 2;
+ }
}
?>