Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/roundcube/roundcubemail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2018-05-23 10:51:08 +0300
committerAleksander Machniak <alec@alec.pl>2018-05-23 10:51:08 +0300
commit13ad9e6593ae95280de9f0104bf38515431b69fe (patch)
treecd64c3429c239522bd8813722e0772a17e79839c /program
parent5843d8cdcd92f6338402a1656644be75b2a10dba (diff)
parent9d3d600a2557608824cacfdbf4055bca9985f026 (diff)
Merge branch 'master' into dev/elastic
Diffstat (limited to 'program')
-rw-r--r--program/include/rcmail_install.php11
-rw-r--r--program/js/app.js8
-rw-r--r--program/lib/Roundcube/rcube.php61
-rw-r--r--program/lib/Roundcube/rcube_config.php14
-rw-r--r--program/localization/en_US/labels.inc4
-rw-r--r--program/steps/addressbook/import.inc5
-rw-r--r--program/steps/mail/func.inc15
-rw-r--r--program/steps/utils/error.inc9
8 files changed, 48 insertions, 79 deletions
diff --git a/program/include/rcmail_install.php b/program/include/rcmail_install.php
index dfd8b28a0..df08db944 100644
--- a/program/include/rcmail_install.php
+++ b/program/include/rcmail_install.php
@@ -206,16 +206,7 @@ class rcmail_install
}
// convert some form data
- if ($prop == 'debug_level' && !$is_default) {
- if (is_array($value)) {
- $val = 0;
- foreach ($value as $dbgval) {
- $val += intval($dbgval);
- }
- $value = $val;
- }
- }
- else if ($prop == 'db_dsnw' && !empty($_POST['_dbtype'])) {
+ if ($prop == 'db_dsnw' && !empty($_POST['_dbtype'])) {
if ($_POST['_dbtype'] == 'sqlite') {
$value = sprintf('%s://%s?mode=0646', $_POST['_dbtype'],
$_POST['_dbname']{0} == '/' ? '/' . $_POST['_dbname'] : $_POST['_dbname']);
diff --git a/program/js/app.js b/program/js/app.js
index 69f9bbcf3..f96c1bec4 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -1430,7 +1430,13 @@ function rcube_webmail()
ret = false;
this.triggerEvent('actionafter', { props:props, action:command, aborted:aborted, ret:ret, originalEvent:event});
- return ret === false ? false : obj ? false : true;
+ if (ret === false)
+ return false;
+
+ if (obj || aborted === true)
+ return false;
+
+ return true;
};
// set command(s) enabled or disabled
diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php
index 6c7a6d016..bc49845fc 100644
--- a/program/lib/Roundcube/rcube.php
+++ b/program/lib/Roundcube/rcube.php
@@ -1352,7 +1352,7 @@ class rcube
}
/**
- * Report error according to configured debug_level
+ * Log an error
*
* @param array $arg_arr Named parameters
* @see self::raise_error()
@@ -1360,58 +1360,31 @@ class rcube
public static function log_bug($arg_arr)
{
$program = strtoupper($arg_arr['type'] ?: 'php');
- $level = self::get_instance()->config->get('debug_level');
-
- // disable errors for ajax requests, write to log instead (#1487831)
- if (($level & 4) && !empty($_REQUEST['_remote'])) {
- $level = ($level ^ 4) | 1;
- }
// write error to local log file
- if (($level & 1) || !empty($arg_arr['fatal'])) {
- if ($_SERVER['REQUEST_METHOD'] == 'POST') {
- foreach (array('_task', '_action') as $arg) {
- if ($_POST[$arg] && !$_GET[$arg]) {
- $post_query[$arg] = $_POST[$arg];
- }
- }
-
- if (!empty($post_query)) {
- $post_query = (strpos($_SERVER['REQUEST_URI'], '?') != false ? '&' : '?')
- . http_build_query($post_query, '', '&');
+ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
+ foreach (array('_task', '_action') as $arg) {
+ if ($_POST[$arg] && !$_GET[$arg]) {
+ $post_query[$arg] = $_POST[$arg];
}
}
- $log_entry = sprintf("%s Error: %s%s (%s %s)",
- $program,
- $arg_arr['message'],
- $arg_arr['file'] ? sprintf(' in %s on line %d', $arg_arr['file'], $arg_arr['line']) : '',
- $_SERVER['REQUEST_METHOD'],
- $_SERVER['REQUEST_URI'] . $post_query);
-
- if (!self::write_log('errors', $log_entry)) {
- // send error to PHPs error handler if write_log didn't succeed
- trigger_error($arg_arr['message'], E_USER_WARNING);
+ if (!empty($post_query)) {
+ $post_query = (strpos($_SERVER['REQUEST_URI'], '?') != false ? '&' : '?')
+ . http_build_query($post_query, '', '&');
}
}
- // report the bug to the global bug reporting system
- if ($level & 2) {
- // TODO: Send error via HTTP
- }
-
- // show error if debug_mode is on
- if ($level & 4) {
- print "<b>$program Error";
-
- if (!empty($arg_arr['file']) && !empty($arg_arr['line'])) {
- print " in $arg_arr[file] ($arg_arr[line])";
- }
+ $log_entry = sprintf("%s Error: %s%s (%s %s)",
+ $program,
+ $arg_arr['message'],
+ $arg_arr['file'] ? sprintf(' in %s on line %d', $arg_arr['file'], $arg_arr['line']) : '',
+ $_SERVER['REQUEST_METHOD'],
+ $_SERVER['REQUEST_URI'] . $post_query);
- print ':</b>&nbsp;';
- print nl2br($arg_arr['message']);
- print '<br />';
- flush();
+ if (!self::write_log('errors', $log_entry)) {
+ // send error to PHPs error handler if write_log didn't succeed
+ trigger_error($arg_arr['message'], E_USER_WARNING);
}
}
diff --git a/program/lib/Roundcube/rcube_config.php b/program/lib/Roundcube/rcube_config.php
index 300337ae7..73e7738a6 100644
--- a/program/lib/Roundcube/rcube_config.php
+++ b/program/lib/Roundcube/rcube_config.php
@@ -245,20 +245,14 @@ class rcube_config
}
// set PHP error logging according to config
- if ($this->prop['debug_level'] & 1) {
- $error_log = $this->prop['log_driver'];
- if ($error_log != 'syslog') {
- $error_log = $this->prop['log_dir'] . '/errors';
- $error_log .= isset($this->prop['log_file_ext']) ? $this->prop['log_file_ext'] : '.log';
- }
+ $error_log = $this->prop['log_driver'];
+ if ($error_log != 'syslog') {
+ $error_log = $this->prop['log_dir'] . '/errors';
+ $error_log .= isset($this->prop['log_file_ext']) ? $this->prop['log_file_ext'] : '.log';
ini_set('error_log', $error_log);
- ini_set('log_errors', 1);
}
- // enable display_errors in 'show' level, but not for ajax requests
- ini_set('display_errors', intval(empty($_REQUEST['_remote']) && ($this->prop['debug_level'] & 4)));
-
// remove deprecated properties
unset($this->prop['dst_active']);
}
diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc
index 3ee16633b..d4ce1cce2 100644
--- a/program/localization/en_US/labels.inc
+++ b/program/localization/en_US/labels.inc
@@ -224,6 +224,8 @@ $labels['folderactions'] = 'Folder actions...';
$labels['compact'] = 'Compact';
$labels['empty'] = 'Empty';
$labels['importmessages'] = 'Import messages';
+$labels['mailimportdesc'] = 'You can upload mail using files in <a href="https://en.wikipedia.org/wiki/Email#Message_format">MIME</a> or <a href="https://en.wikipedia.org/wiki/Mbox">Mbox</a> format.';
+$labels['mailimportzip'] = 'Multiple files can be compressed into zip archives.';
$labels['quota'] = 'Disk usage';
$labels['unknown'] = 'unknown';
@@ -481,7 +483,7 @@ $labels['importreplace'] = 'Replace the entire address book';
$labels['importgroups'] = 'Import group assignments';
$labels['importgroupsall'] = 'All (create groups if necessary)';
$labels['importgroupsexisting'] = 'Only for existing groups';
-$labels['importdesc'] = 'You can upload contacts from an existing address book.<br/>We currently support importing addresses from the <a href="http://en.wikipedia.org/wiki/VCard">vCard</a> or CSV (comma-separated) data format.';
+$labels['importdesc'] = 'You can upload contacts from an existing address book.<br/>We currently support importing addresses from the <a href="https://en.wikipedia.org/wiki/VCard">vCard</a> or CSV (comma-separated) data format.';
$labels['done'] = 'Done';
// settings
diff --git a/program/steps/addressbook/import.inc b/program/steps/addressbook/import.inc
index 34928f795..7ada22142 100644
--- a/program/steps/addressbook/import.inc
+++ b/program/steps/addressbook/import.inc
@@ -203,6 +203,7 @@ function rcmail_import_form($attrib)
$attrib += array('id' => "rcmImportForm");
$writable_books = $RCMAIL->get_address_sources(true, true);
+ $max_filesize = $RCMAIL->upload_init();
$form = '';
$table = new html_table(array('cols' => 2));
@@ -216,7 +217,9 @@ function rcmail_import_form($attrib)
));
$table->add('title', html::label('rcmimportfile', $RCMAIL->gettext('importfromfile')));
- $table->add(null, $upload->show());
+ $table->add(null, $upload->show()
+ . html::div('hint', $RCMAIL->gettext(array('id' => 'importfile', 'name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize))))
+ );
// addressbook selector
if (count($writable_books) > 1) {
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 36b3ec218..0ab2dba0f 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -1687,16 +1687,23 @@ function rcmail_message_import_form($attrib = array())
{
global $RCMAIL;
- $RCMAIL->output->add_label('selectimportfile','importwait');
+ $RCMAIL->output->add_label('selectimportfile', 'importwait', 'importmessages');
- $input_attr = array(
+ $description = $RCMAIL->gettext('mailimportdesc');
+ $input_attr = array(
'multiple' => true,
'name' => '_file[]',
- 'accept' => ".eml, .mbox, message/rfc822, text/*",
+ 'accept' => '.eml, .mbox, .msg, message/rfc822, text/*',
);
+ if (class_exists('ZipArchive', false)) {
+ $input_attr['accept'] .= '.zip, application/zip, application/x-zip';
+ $description .= ' ' . $RCMAIL->gettext('mailimportzip');
+ }
+
$attrib['prefix'] = html::tag('input', array('type' => 'hidden', 'name' => '_unlock', 'value' => ''))
- . html::tag('input', array('type' => 'hidden', 'name' => '_framed', 'value' => '1'));
+ . html::tag('input', array('type' => 'hidden', 'name' => '_framed', 'value' => '1'))
+ . html::p(null, $description);
return $RCMAIL->upload_form($attrib, 'importform', 'import-messages', $input_attr);
}
diff --git a/program/steps/utils/error.inc b/program/steps/utils/error.inc
index 9e134fb7a..773fe71fe 100644
--- a/program/steps/utils/error.inc
+++ b/program/steps/utils/error.inc
@@ -96,14 +96,7 @@ else if ($ERROR_CODE == 603) {
// system error
else {
$__error_title = "SERVICE CURRENTLY NOT AVAILABLE!";
- $__error_text = "Please contact your server-administrator.";
-
- if (($rcmail->config->get('debug_level') & 4) && $ERROR_MESSAGE) {
- $__error_text = $ERROR_MESSAGE;
- }
- else {
- $__error_text = sprintf('Error No. [%s]', $ERROR_CODE);
- }
+ $__error_text = sprintf('Error No. [%s]', $ERROR_CODE);
}
// inform plugins