summaryrefslogtreecommitdiff
path: root/plugins/import_export
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2013-04-02 09:28:47 +0400
committerAndrew Dolgov <[email protected]>2013-04-02 09:28:47 +0400
commitf58df87234089d31ee01b9bcf429131bda29564b (patch)
tree2795a046e7a0a988cff7a5c30d52744c64c3d3ba /plugins/import_export
parenteab5a5e241ccf911c40bb4a4d89f2e6d9e69f0e3 (diff)
import_export: fix syntax error, adapt to work with new gettext syntax
Diffstat (limited to 'plugins/import_export')
-rw-r--r--plugins/import_export/init.php17
1 files changed, 7 insertions, 10 deletions
diff --git a/plugins/import_export/init.php b/plugins/import_export/init.php
index 5a3051edb..ab47288b3 100644
--- a/plugins/import_export/init.php
+++ b/plugins/import_export/init.php
@@ -9,7 +9,7 @@ class Import_Export extends Plugin implements IHandler {
$this->host = $host;
$host->add_hook($host::HOOK_PREFS_TAB, $this);
- $host->add_command("xml-import", "USER FILE: import articles from XML", $this);
+ $host->add_command("xml-import", "import articles from XML", $this, ":", "FILE");
}
function about() {
@@ -19,21 +19,18 @@ class Import_Export extends Plugin implements IHandler {
}
function xml_import($args) {
- array_shift($args);
- $username = $args[count($args) - 2];
- $filename = $args[count($args) - 1];
-
- if (!$username) {
- print "error: please specify username.\n";
- return;
- }
+ $filename = $args['xml_import'];
if (!is_file($filename)) {
print "error: input filename ($filename) doesn't exist.\n";
return;
}
+ _debug("please enter your username:");
+
+ $username = db_escape_string($this->link, trim(read_stdin()));
+
_debug("importing $filename for user $username...\n");
$result = db_query($this->link, "SELECT id FROM ttrss_users WHERE login = '$username'");
@@ -382,7 +379,7 @@ class Import_Export extends Plugin implements IHandler {
}
print "<p>" .
- vsprintf(__("Finished: ")).
+ __("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).