diff --git a/CHANGELOG b/CHANGELOG index 21ae867e0..fc469e131 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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) diff --git a/plugins/database_attachments/database_attachments.php b/plugins/database_attachments/database_attachments.php index bd9d681bd..779a9b5d7 100644 --- a/plugins/database_attachments/database_attachments.php +++ b/plugins/database_attachments/database_attachments.php @@ -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 diff --git a/plugins/filesystem_attachments/filesystem_attachments.php b/plugins/filesystem_attachments/filesystem_attachments.php index 9f2940afb..ec32e763c 100644 --- a/plugins/filesystem_attachments/filesystem_attachments.php +++ b/plugins/filesystem_attachments/filesystem_attachments.php @@ -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')); diff --git a/plugins/redundant_attachments/redundant_attachments.php b/plugins/redundant_attachments/redundant_attachments.php index 243b43aea..7ba5da1ac 100644 --- a/plugins/redundant_attachments/redundant_attachments.php +++ b/plugins/redundant_attachments/redundant_attachments.php @@ -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 diff --git a/program/lib/Roundcube/rcube_plugin_api.php b/program/lib/Roundcube/rcube_plugin_api.php index cea6b46d8..dfa078882 100644 --- a/program/lib/Roundcube/rcube_plugin_api.php +++ b/program/lib/Roundcube/rcube_plugin_api.php @@ -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/'); }