From bd911ba8143f07fa4f14b682ddcd559a69a208e8 Mon Sep 17 00:00:00 2001 From: thomascube Date: Wed, 29 Sep 2010 08:30:56 +0000 Subject: Pool some code for command line tools; avoid displaying password on shell (#1486947); fix msgexport now using the new imap wrapper --- CHANGELOG | 2 + bin/msgexport.sh | 44 ++-------------------- bin/msgimport.sh | 43 +-------------------- program/include/clisetup.php | 90 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 98 insertions(+), 81 deletions(-) create mode 100644 program/include/clisetup.php diff --git a/CHANGELOG b/CHANGELOG index e4a19cf0b..d38bbb9a3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ CHANGELOG Roundcube Webmail =========================== +- Fix msgexport.sh now using the new imap wrapper +- Avoid displaying password on shell (#1486947) - Only lower-case user name if first login attempt failed (#1486393) - Make alias setting in squirrelmail_usercopy plugin configurable (patch by pommi, #1487007) - Prevent from saving a non-existing skin path in user prefs (#1486936) diff --git a/bin/msgexport.sh b/bin/msgexport.sh index 005e2cadf..0aa33b5a8 100755 --- a/bin/msgexport.sh +++ b/bin/msgexport.sh @@ -1,45 +1,10 @@ #!/usr/bin/env php decode_address_list($headers->from, 1, false)); fwrite($out, sprintf("From %s %s UID %d\n", $from['mailto'], $headers->date, $headers->uid)); - fwrite($out, iil_C_FetchPartHeader($IMAP->conn, $mbox, $i, null)); - fwrite($out, iil_C_HandlePartBody($IMAP->conn, $mbox, $i, null, 1)); + fwrite($out, $IMAP->conn->fetchPartHeader($mbox, $i)); + fwrite($out, $IMAP->conn->handlePartBody($mbox, $i)); fwrite($out, "\n\n\n"); progress_update($i, $count); @@ -125,8 +90,7 @@ if (empty($args['user'])) } // prompt for password -vputs("Password: "); -$args['pass'] = trim(fgets(STDIN)); +$args['pass'] = prompt_silent("Password: "); // parse $host URL diff --git a/bin/msgimport.sh b/bin/msgimport.sh index a5161e026..74dc81617 100755 --- a/bin/msgimport.sh +++ b/bin/msgimport.sh @@ -1,45 +1,10 @@ #!/usr/bin/env php | + +-----------------------------------------------------------------------+ + + $Id$ + +*/ + +if (php_sapi_name() != 'cli') { + die('Not on the "shell" (php-cli).'); +} + +require_once 'iniset.php'; + + +/** + * Parse commandline arguments into a hash array + */ +function get_opt($aliases=array()) +{ + $args = array(); + for ($i=1; $i \ No newline at end of file -- cgit v1.2.3