CS fixes, tabs to spaces

pull/6806/head
Aleksander Machniak 6 years ago
parent f7b4ce0412
commit 8e63309203

@ -27,5 +27,3 @@ else
$days = 7;
rcmail_utils::db_clean($days);
?>

@ -24,5 +24,3 @@ require_once INSTALL_PATH.'program/include/clisetup.php';
ini_set('memory_limit', -1);
rcmail_utils::indexcontacts();
?>

@ -37,5 +37,3 @@ if (!file_exists($opts['dir'])) {
}
rcmail_utils::db_init($opts['dir']);
?>

@ -136,5 +136,3 @@ if (strtolower($input) == 'y') {
else {
echo "Update cancelled. See ya!\n";
}
?>

@ -19,6 +19,5 @@ OUTPUTFORMAT=HTML
TEMPLATE=responsive-twig
# make documentation
$BIN_PHPDOC -d $PATH_PROJECT,$PATH_FRAMEWORK -t $PATH_DOCS --title "$TITLE" --defaultpackagename $PACKAGES \
--template=$TEMPLATE
$BIN_PHPDOC -d $PATH_PROJECT,$PATH_FRAMEWORK -t $PATH_DOCS --title "$TITLE" \
--defaultpackagename $PACKAGES --template=$TEMPLATE

@ -63,5 +63,3 @@ if ($args['config']) {
}
rcmail_utils::mod_pref($pref_name, $pref_value, $args['user'], $args['type']);
?>

@ -53,20 +53,18 @@ function export_mailbox($mbox, $filename)
vputs("Getting message list of {$mbox}...");
vputs("$count messages\n");
if ($filename)
{
if (!($out = fopen($filename, 'w')))
{
if ($filename) {
if (!($out = fopen($filename, 'w'))) {
vputs("Cannot write to output file\n");
return;
}
vputs("Writing to $filename\n");
}
else
else {
$out = STDOUT;
}
for ($i = 0; $i < $count; $i++)
{
for ($i = 0; $i < $count; $i++) {
$headers = $IMAP->get_message_headers($index[$i]);
$from = current(rcube_mime::decode_address_list($headers->from, 1, false));
@ -78,30 +76,27 @@ function export_mailbox($mbox, $filename)
}
vputs("\ncomplete.\n");
if ($filename)
if ($filename) {
fclose($out);
}
}
// get arguments
$opts = array('h' => 'host', 'u' => 'user', 'p' => 'pass', 'm' => 'mbox', 'f' => 'file');
$args = rcube_utils::get_opt($opts) + array('host' => 'localhost', 'mbox' => 'INBOX');
if ($_SERVER['argv'][1] == 'help')
{
if ($_SERVER['argv'][1] == 'help') {
print_usage();
exit;
}
else if (!$args['host'])
{
else if (!$args['host']) {
vputs("Missing required parameters.\n");
print_usage();
exit;
}
// prompt for username if not set
if (empty($args['user']))
{
if (empty($args['user'])) {
vputs("IMAP user: ");
$args['user'] = trim(fgets(STDIN));
}
@ -112,14 +107,12 @@ $args['pass'] = rcube_utils::prompt_silent("Password: ");
// parse $host URL
$a_host = parse_url($args['host']);
if ($a_host['host'])
{
if ($a_host['host']) {
$host = $a_host['host'];
$imap_ssl = (isset($a_host['scheme']) && in_array($a_host['scheme'], array('ssl','imaps','tls'))) ? TRUE : FALSE;
$imap_port = isset($a_host['port']) ? $a_host['port'] : ($imap_ssl ? 993 : 143);
}
else
{
else {
$host = $args['host'];
$imap_port = 143;
}
@ -128,29 +121,25 @@ else
$IMAP = new rcube_imap(null);
// try to connect to IMAP server
if ($IMAP->connect($host, $args['user'], $args['pass'], $imap_port, $imap_ssl))
{
if ($IMAP->connect($host, $args['user'], $args['pass'], $imap_port, $imap_ssl)) {
vputs("IMAP login successful.\n");
$filename = null;
$mailboxes = $args['mbox'] == '*' ? $IMAP->list_folders(null) : array($args['mbox']);
foreach ($mailboxes as $mbox)
{
foreach ($mailboxes as $mbox) {
if ($args['file'])
$filename = preg_replace('/\.[a-z0-9]{3,4}$/i', '', $args['file']) . asciiwords($mbox) . '.mbox';
else if ($args['mbox'] == '*')
$filename = asciiwords($mbox) . '.mbox';
if ($args['mbox'] == '*' && in_array(strtolower($mbox), array('junk','spam','trash')))
if ($args['mbox'] == '*' && in_array(strtolower($mbox), array('junk','spam','trash'))) {
continue;
}
export_mailbox($mbox, $filename);
}
}
else
{
else {
vputs("IMAP login failed.\n");
}
?>

@ -33,46 +33,39 @@ function print_usage()
$opts = array('h' => 'host', 'u' => 'user', 'p' => 'pass', 'm' => 'mbox', 'f' => 'file');
$args = rcube_utils::get_opt($opts) + array('host' => 'localhost', 'mbox' => 'INBOX');
if ($_SERVER['argv'][1] == 'help')
{
if ($_SERVER['argv'][1] == 'help') {
print_usage();
exit;
}
else if (!($args['host'] && $args['file']))
{
else if (!($args['host'] && $args['file'])) {
print "Missing required parameters.\n";
print_usage();
exit;
}
else if (!is_file($args['file']))
{
else if (!is_file($args['file'])) {
rcube::raise_error("Cannot read message file.", false, true);
}
// prompt for username if not set
if (empty($args['user']))
{
if (empty($args['user'])) {
//fwrite(STDOUT, "Please enter your name\n");
echo "IMAP user: ";
$args['user'] = trim(fgets(STDIN));
}
// prompt for password
if (empty($args['pass']))
{
if (empty($args['pass'])) {
$args['pass'] = rcube_utils::prompt_silent("Password: ");
}
// parse $host URL
$a_host = parse_url($args['host']);
if ($a_host['host'])
{
if ($a_host['host']) {
$host = $a_host['host'];
$imap_ssl = (isset($a_host['scheme']) && in_array($a_host['scheme'], array('ssl','imaps','tls'))) ? TRUE : FALSE;
$imap_port = isset($a_host['port']) ? $a_host['port'] : ($imap_ssl ? 993 : 143);
}
else
{
else {
$host = $args['host'];
$imap_port = 143;
}
@ -81,8 +74,7 @@ else
$IMAP = new rcube_imap(null);
// try to connect to IMAP server
if ($IMAP->connect($host, $args['user'], $args['pass'], $imap_port, $imap_ssl))
{
if ($IMAP->connect($host, $args['user'], $args['pass'], $imap_port, $imap_ssl)) {
print "IMAP login successful.\n";
print "Uploading messages...\n";
@ -90,12 +82,9 @@ if ($IMAP->connect($host, $args['user'], $args['pass'], $imap_port, $imap_ssl))
$message = $lastline = '';
$fp = fopen($args['file'], 'r');
while (($line = fgets($fp)) !== false)
{
if (preg_match('/^From\s+-/', $line) && $lastline == '')
{
if (!empty($message))
{
while (($line = fgets($fp)) !== false) {
if (preg_match('/^From\s+-/', $line) && $lastline == '') {
if (!empty($message)) {
if ($IMAP->save_message($args['mbox'], rtrim($message)))
$count++;
else
@ -118,9 +107,6 @@ if ($IMAP->connect($host, $args['user'], $args['pass'], $imap_port, $imap_ssl))
else
print "Adding messages failed!\n";
}
else
{
else {
rcube::raise_error("IMAP login failed.", false, true);
}
?>

@ -104,4 +104,3 @@ Please download it from http://getcomposer.org/download/ or with
}
echo "\n";

@ -271,5 +271,3 @@ else {
echo "This instance of Roundcube is not yet configured!\n";
echo "Open http://url-to-roundcube/installer/ in your browser and follow the instuctions.\n";
}
?>

@ -117,5 +117,3 @@ function get_files($dir)
return $files;
}
?>

@ -37,5 +37,3 @@ if (empty($opts['package'])) {
}
rcmail_utils::db_update($opts['dir'], $opts['package'], $opts['version'], array('errors' => true));
?>

Loading…
Cancel
Save