diff options
Diffstat (limited to 'program')
-rw-r--r-- | program/include/rcmail_output_html.php | 30 | ||||
-rw-r--r-- | program/js/app.js | 8 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_plugin.php | 10 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_plugin_api.php | 39 | ||||
-rw-r--r-- | program/steps/mail/func.inc | 3 | ||||
-rw-r--r-- | program/steps/settings/about.inc | 6 | ||||
-rw-r--r-- | program/steps/settings/folders.inc | 2 |
7 files changed, 78 insertions, 20 deletions
diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php index 705a72ece..a84824648 100644 --- a/program/include/rcmail_output_html.php +++ b/program/include/rcmail_output_html.php @@ -1139,7 +1139,8 @@ EOF; */ public function button($attrib) { - static $s_button_count = 100; + static $s_button_count = 100; + static $disabled_actions = null; // these commands can be called directly via url $a_static_commands = array('compose', 'list', 'preferences', 'folders', 'identities'); @@ -1148,9 +1149,14 @@ EOF; return ''; } + // try to find out the button type if ($attrib['type']) { $attrib['type'] = strtolower($attrib['type']); + if ($pos = strpos($attrib['type'], '-menuitem')) { + $attrib['type'] = substr($attrib['type'], 0, -9); + $menuitem = true; + } } else { $attrib['type'] = ($attrib['image'] || $attrib['imagepas'] || $attrib['imageact']) ? 'image' : 'link'; @@ -1158,8 +1164,21 @@ EOF; $command = $attrib['command']; - if ($attrib['task']) - $command = $attrib['task'] . '.' . $command; + if ($attrib['task']) { + $element = $command = $attrib['task'] . '.' . $command; + } + else { + $element = ($this->env['task'] ? $this->env['task'] . '.' : '') . $command; + } + + if ($disabled_actions === null) { + $disabled_actions = (array) $this->config->get('disabled_actions'); + } + + // remove buttons for disabled actions + if (in_array($element, $disabled_actions)) { + return ''; + } if (!$attrib['image']) { $attrib['image'] = $attrib['imagepas'] ? $attrib['imagepas'] : $attrib['imageact']; @@ -1292,6 +1311,11 @@ EOF; $out = html::tag($attrib['wrapper'], null, $out); } + if ($menuitem) { + $class = $attrib['menuitem-class'] ? ' class="' . $attrib['menuitem-class'] . '"' : ''; + $out = '<li role="menuitem"' . $class . '>' . $out . '</li>'; + } + return $out; } diff --git a/program/js/app.js b/program/js/app.js index 490234b4a..8ac5ca2e9 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -1451,7 +1451,7 @@ function rcube_webmail() this.is_framed = function() { - return (this.env.framed && parent.rcmail && parent.rcmail != this && parent.rcmail.command); + return this.env.framed && parent.rcmail && parent.rcmail != this && typeof parent.rcmail.command == 'function'; }; this.save_pref = function(prop) @@ -5989,8 +5989,10 @@ function rcube_webmail() this.replace_folder_row = function(oldid, id, name, display_name, is_protected, class_name) { if (!this.gui_objects.subscriptionlist) { - if (this.is_framed) - return parent.rcmail.replace_folder_row(oldid, id, name, display_name, is_protected, class_name); + if (this.is_framed()) { + // @FIXME: for some reason this 'parent' variable need to be prefixed with 'window.' + return window.parent.rcmail.replace_folder_row(oldid, id, name, display_name, is_protected, class_name); + } return false; } diff --git a/program/lib/Roundcube/rcube_plugin.php b/program/lib/Roundcube/rcube_plugin.php index 01c340deb..cc7c7977f 100644 --- a/program/lib/Roundcube/rcube_plugin.php +++ b/program/lib/Roundcube/rcube_plugin.php @@ -94,7 +94,15 @@ abstract class rcube_plugin /** * Provide information about this * - * @return array Meta information about a plugin or false if not implemented + * @return array Meta information about a plugin or false if not implemented: + * As hash array with the following keys: + * name: The plugin name + * vendor: Name of the plugin developer + * version: Plugin version name + * license: License name (short form according to http://spdx.org/licenses/) + * uri: The URL to the plugin homepage or source repository + * src_uri: Direct download URL to the source code of this plugin + * require: List of plugins required for this one (as array of plugin names) */ public static function info() { diff --git a/program/lib/Roundcube/rcube_plugin_api.php b/program/lib/Roundcube/rcube_plugin_api.php index feeeb192e..335348cef 100644 --- a/program/lib/Roundcube/rcube_plugin_api.php +++ b/program/lib/Roundcube/rcube_plugin_api.php @@ -38,6 +38,7 @@ class rcube_plugin_api public $handlers = array(); public $allowed_prefs = array(); public $allowed_session_prefs = array(); + public $active_plugins = array(); protected $plugins = array(); protected $tasks = array(); @@ -189,7 +190,7 @@ class rcube_plugin_api $fn = $plugins_dir . DIRECTORY_SEPARATOR . $plugin_name . DIRECTORY_SEPARATOR . $plugin_name . '.php'; - if (file_exists($fn)) { + if (is_readable($fn)) { if (!class_exists($plugin_name, false)) { include $fn; } @@ -197,6 +198,8 @@ class rcube_plugin_api // instantiate class if exists if (class_exists($plugin_name, false)) { $plugin = new $plugin_name($this); + $this->active_plugins[] = $plugin_name; + // check inheritance... if (is_subclass_of($plugin, 'rcube_plugin')) { // ... task, request type and framed mode @@ -252,6 +255,9 @@ class rcube_plugin_api 'GPL-3.0' => 'http://www.gnu.org/licenses/gpl-3.0.html', 'GPL-3.0+' => 'http://www.gnu.org/licenses/gpl.html', 'GPL-2.0+' => 'http://www.gnu.org/licenses/gpl.html', + 'AGPLv3' => 'http://www.gnu.org/licenses/agpl.html', + 'AGPLv3+' => 'http://www.gnu.org/licenses/agpl.html', + 'AGPL-3.0' => 'http://www.gnu.org/licenses/agpl.html', 'LGPL' => 'http://www.gnu.org/licenses/lgpl.html', 'LGPLv2' => 'http://www.gnu.org/licenses/lgpl-2.0.html', 'LGPLv2.1' => 'http://www.gnu.org/licenses/lgpl-2.1.html', @@ -275,8 +281,12 @@ class rcube_plugin_api $fn = unslashify($dir->path) . DIRECTORY_SEPARATOR . $plugin_name . DIRECTORY_SEPARATOR . $plugin_name . '.php'; $info = false; - if (!class_exists($plugin_name)) - include($fn); + if (!class_exists($plugin_name, false)) { + if (is_readable($fn)) + include($fn); + else + return false; + } if (class_exists($plugin_name)) $info = $plugin_name::info(); @@ -284,12 +294,17 @@ class rcube_plugin_api // fall back to composer.json file if (!$info) { $composer = INSTALL_PATH . "/plugins/$plugin_name/composer.json"; - if (file_exists($composer) && ($json = @json_decode(file_get_contents($composer), true))) { + if (is_readable($composer) && ($json = @json_decode(file_get_contents($composer), true))) { list($info['vendor'], $info['name']) = explode('/', $json['name']); $info['version'] = $json['version']; $info['license'] = $json['license']; - if ($license_uri = $license_uris[$info['license']]) - $info['license_uri'] = $license_uri; + $info['uri'] = $json['homepage']; + $info['require'] = array_filter(array_keys((array)$json['require']), function($pname) { + if (strpos($pname, '/') == false) + return false; + list($vendor, $name) = explode('/', $pname); + return !($name == 'plugin-installer' || $vendor == 'pear-pear'); + }); } // read local composer.lock file (once) @@ -313,7 +328,7 @@ class rcube_plugin_api // fall back to package.xml file if (!$info) { $package = INSTALL_PATH . "/plugins/$plugin_name/package.xml"; - if (file_exists($package) && ($file = file_get_contents($package))) { + if (is_readable($package) && ($file = file_get_contents($package))) { $doc = new DOMDocument(); $doc->loadXML($file); $xpath = new DOMXPath($doc); @@ -337,11 +352,19 @@ class rcube_plugin_api $deps = $xpath->evaluate('//rc:package/rc:dependencies/rc:required/rc:package/rc:name'); for ($i = 0; $i < $deps->length; $i++) { $dn = $deps->item($i)->nodeValue; - $info['requires'][] = $dn; + $info['require'][] = $dn; } } } + // At least provide the name + if (!$info && class_exists($plugin_name)) { + $info = array('name' => $plugin_name, 'version' => '--'); + } + else if ($info['license'] && empty($info['license_uri']) && ($license_uri = $license_uris[$info['license']])) { + $info['license_uri'] = $license_uri; + } + return $info; } diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 8774c08fe..c6c0b95e6 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -117,7 +117,7 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list') { 'movingmessage', 'copyingmessage', 'deletingmessage', 'markingmessage', 'copy', 'move', 'quota', 'replyall', 'replylist', 'stillsearching', 'flagged', 'unflagged', 'unread', 'deleted', 'replied', 'forwarded', - 'priority', 'withattachment'); + 'priority', 'withattachment', 'fileuploaderror'); } $pagetitle = $RCMAIL->localize_foldername($mbox_name, true); @@ -2075,6 +2075,7 @@ function rcmail_message_import_form($attrib = array()) )); $content = html::tag('input', array('type' => 'hidden', 'name' => '_unlock', 'value' => '')) + . html::tag('input', array('type' => 'hidden', 'name' => '_framed', 'value' => '1')) . html::div(null, $fileinput->show()) . html::div('hint', $RCMAIL->gettext(array('name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize)))); diff --git a/program/steps/settings/about.inc b/program/steps/settings/about.inc index 026bfc1a2..73d0b0f0d 100644 --- a/program/steps/settings/about.inc +++ b/program/steps/settings/about.inc @@ -50,7 +50,7 @@ function rcmail_plugins_list($attrib) $attrib['id'] = 'rcmpluginlist'; } - $plugins = array_filter((array) $RCMAIL->config->get('plugins')); + $plugins = array_filter($RCMAIL->plugins->active_plugins); $plugin_info = array(); foreach ($plugins as $name) { @@ -61,8 +61,8 @@ function rcmail_plugins_list($attrib) // load info from required plugins, too foreach ($plugin_info as $name => $info) { - if (is_array($info['required']) && !empty($info['required'])) { - foreach ($info['required'] as $req_name) { + if (is_array($info['require']) && !empty($info['require'])) { + foreach ($info['require'] as $req_name) { if (!isset($plugin_info[$req_name]) && ($req_info = $RCMAIL->plugins->get_info($req_name))) { $plugin_info[$req_name] = $req_info; } diff --git a/program/steps/settings/folders.inc b/program/steps/settings/folders.inc index 19c4457a1..061cd8893 100644 --- a/program/steps/settings/folders.inc +++ b/program/steps/settings/folders.inc @@ -373,7 +373,7 @@ function rcube_subscription_form($attrib) array_unshift($plugin['list'], $root); - for ($i = 0, $length = count($plugin['list'])-1; $i<$length; $i++) { + for ($i = 0, $length = count($plugin['list']); $i<$length; $i++) { $folders[] = rcmail_folder_tree_element($plugin['list'], $i, $js_folders); } |