import_export: fix syntax error, adapt to work with new gettext syntax
This commit is contained in:
parent
eab5a5e241
commit
f58df87234
1 changed files with 7 additions and 10 deletions
|
@ -9,7 +9,7 @@ class Import_Export extends Plugin implements IHandler {
|
||||||
$this->host = $host;
|
$this->host = $host;
|
||||||
|
|
||||||
$host->add_hook($host::HOOK_PREFS_TAB, $this);
|
$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() {
|
function about() {
|
||||||
|
@ -19,21 +19,18 @@ class Import_Export extends Plugin implements IHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
function xml_import($args) {
|
function xml_import($args) {
|
||||||
array_shift($args);
|
|
||||||
|
|
||||||
$username = $args[count($args) - 2];
|
$filename = $args['xml_import'];
|
||||||
$filename = $args[count($args) - 1];
|
|
||||||
|
|
||||||
if (!$username) {
|
|
||||||
print "error: please specify username.\n";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_file($filename)) {
|
if (!is_file($filename)) {
|
||||||
print "error: input filename ($filename) doesn't exist.\n";
|
print "error: input filename ($filename) doesn't exist.\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_debug("please enter your username:");
|
||||||
|
|
||||||
|
$username = db_escape_string($this->link, trim(read_stdin()));
|
||||||
|
|
||||||
_debug("importing $filename for user $username...\n");
|
_debug("importing $filename for user $username...\n");
|
||||||
|
|
||||||
$result = db_query($this->link, "SELECT id FROM ttrss_users WHERE login = '$username'");
|
$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>" .
|
print "<p>" .
|
||||||
vsprintf(__("Finished: ")).
|
__("Finished: ").
|
||||||
vsprintf(ngettext("%d article processed, ", "%d articles processed, ", $num_processed), $num_processed).
|
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 imported, ", "%d imported, ", $num_imported), $num_imported).
|
||||||
vsprintf(ngettext("%d feed created.", "%d feeds created.", $num_feeds_created), $num_feeds_created).
|
vsprintf(ngettext("%d feed created.", "%d feeds created.", $num_feeds_created), $num_feeds_created).
|
||||||
|
|
Loading…
Reference in a new issue