Fix so an error is logged when more than one attachment plugin has been enabled, initialize the first one (#6735)

pull/6748/head
Aleksander Machniak 6 years ago
parent 593188559a
commit 45a6ad1ba7

@ -19,6 +19,7 @@ CHANGELOG Roundcube Webmail
- Managesieve: Fix bug where global includes were requested for vacation (#6716)
- Managesieve: Use RFC-compliant line endings, CRLF instead of LF (#6686)
- Managesieve: Fix so "Create filter" option does not show up when Filters menu is disabled (#6723)
- Fix so an error is logged when more than one attachment plugin has been enabled, initialize the first one (#6735)
- Fix bug where flag change could have been passed to a preview frame when not expected
- Fix bug in HTML parser that could cause missing text fragments when there was no head/body tag (#6713)
- Fix bug where HTML messages with a xml:namespace tag were not rendered (#6697)

@ -29,10 +29,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
if (class_exists('filesystem_attachments', false) && !defined('TESTS_DIR')) {
die("Configuration issue. There can be only one enabled plugin for attachments handling");
}
require_once INSTALL_PATH . 'plugins/filesystem_attachments/filesystem_attachments.php';
class database_attachments extends filesystem_attachments

@ -27,9 +27,24 @@
class filesystem_attachments extends rcube_plugin
{
public $task = '?(?!login).*';
public $initialized = false;
function init()
{
// Find filesystem_attachments-based plugins, we can use only one
foreach ($this->api->loaded_plugins() as $plugin_name) {
$plugin = $this->api->get_plugin($plugin_name);
if (($plugin instanceof filesystem_attachments) && $plugin->initialized) {
rcube::raise_error(array(
'file' => __FILE__, 'line' => __LINE__,
'message' => "Can use only one plugin for attachments/file uploads! Using '$plugin_name', ignoring others.",
), true, false);
return;
}
}
$this->initialized = true;
// Save a newly uploaded attachment
$this->add_hook('attachment_upload', array($this, 'upload'));

@ -32,10 +32,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
if (class_exists('filesystem_attachments', false) && !defined('TESTS_DIR')) {
die("Configuration issue. There can be only one enabled plugin for attachments handling");
}
require_once(RCUBE_PLUGINS_DIR . 'filesystem_attachments/filesystem_attachments.php');
class redundant_attachments extends filesystem_attachments

@ -17,7 +17,7 @@
+-----------------------------------------------------------------------+
*/
// location where plugins are loade from
// location where plugins are loaded from
if (!defined('RCUBE_PLUGINS_DIR')) {
define('RCUBE_PLUGINS_DIR', RCUBE_INSTALL_PATH . 'plugins/');
}

Loading…
Cancel
Save