Aleksander Machniak
2015-02-19 50b04366ee7472272e2576d17c609e1d26345221
Merge branch 'master' of github.com:roundcube/roundcubemail

Conflicts:
CHANGELOG
7 files modified
93 ■■■■ changed files
CHANGELOG 2 ●●●●● patch | view | raw | blame | history
plugins/managesieve/Changelog 2 ●●●●● patch | view | raw | blame | history
plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php 6 ●●●● patch | view | raw | blame | history
plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php 20 ●●●● patch | view | raw | blame | history
program/include/rcmail.php 8 ●●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_plugin_api.php 47 ●●●● patch | view | raw | blame | history
program/steps/mail/sendmail.inc 8 ●●●● patch | view | raw | blame | history
CHANGELOG
@@ -4,6 +4,8 @@
- Plugin API: Add special onload() method to execute plugin actions before startup (session and GUI initialization)
- Add possibility to print contact information (of a single contact)
- Fix refreshing of drafts list when sending a message which was saved in meantime (#1490238)
- Fix saving/sending emoticon images when assets_dir is set
- Fix PHP fatal error when visiting Vacation interface and there's no sieve script yet
- Fix setting max packet size for DB caches and check packet size also in shared cache
RELEASE 1.1.0
plugins/managesieve/Changelog
@@ -1,3 +1,5 @@
- Fix PHP fatal error when visiting Vacation interface and there's no sieve script yet
* version 8.2 [2015-01-14]
-----------------------------------------------------------
- Fix bug where actions without if/elseif/else in sieve scripts were skipped
plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
@@ -2344,12 +2344,12 @@
     */
    protected function init_script()
    {
        $this->script = $this->sieve->script->as_array();
        if (!$this->script) {
        if (!$this->sieve->script) {
            return;
        }
        $this->script = $this->sieve->script->as_array();
        $headers    = array();
        $exceptions = array('date', 'currentdate', 'size', 'body');
plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php
@@ -562,11 +562,20 @@
                $this->script_name = 'roundcube';
            }
            $this->script = array($rule);
            $script_active = false;
            // use default script contents
            if (!$this->rc->config->get('managesieve_kolab_master')) {
                $script_file = $this->rc->config->get('managesieve_default');
                if ($script_file && is_readable($script_file)) {
                    $content = file_get_contents($script_file);
        }
        // if script exists
        else {
            }
            // create and load script
            if ($this->sieve->save_script($this->script_name, $content)) {
                $this->sieve->load($this->script_name);
            }
        }
            $script_active = in_array($this->script_name, $this->active);
            // re-order rules if needed
@@ -616,6 +625,9 @@
                    }
                }
            }
        if (!$this->sieve->script) {
            return false;
        }
        $this->sieve->script->content = $this->script;
program/include/rcmail.php
@@ -93,6 +93,10 @@
            $this->filename = $basename;
        }
        // load all configured plugins
        $this->plugins->load_plugins((array)$this->config->get('plugins', array()),
                                     array('filesystem_attachments', 'jqueryui'));
        // start session
        $this->session_init();
@@ -124,10 +128,8 @@
            $GLOBALS['OUTPUT'] = $this->load_gui(!empty($_REQUEST['_framed']));
        }
        // load plugins
        // run init method on all the plugins
        $this->plugins->init($this, $this->task);
        $this->plugins->load_plugins((array)$this->config->get('plugins', array()),
            array('filesystem_attachments', 'jqueryui'));
    }
    /**
program/lib/Roundcube/rcube_plugin_api.php
@@ -34,6 +34,8 @@
    public $dir;
    public $url = 'plugins/';
    public $task = '';
    public $initialized = false;
    public $output;
    public $handlers              = array();
    public $allowed_prefs         = array();
@@ -85,12 +87,20 @@
    {
        $this->task   = $task;
        $this->output = $app->output;
        // register an internal hook
        $this->register_hook('template_container', array($this, 'template_container_hook'));
        // maybe also register a shudown function which triggers
        // shutdown functions of all plugin objects
        foreach ($this->plugins as $plugin) {
            // ... task, request type and framed mode
            if (!$this->filter($plugin)) {
                $plugin->init();
            }
        }
        // we have finished initializing all plugins
        $this->initialized = true;
    }
    /**
@@ -171,13 +181,21 @@
                // check inheritance...
                if (is_subclass_of($plugin, 'rcube_plugin')) {
                    // ... task, request type and framed mode
                    if (($force || !$plugin->task || preg_match('/^('.$plugin->task.')$/i', $this->task))
                        && (!$plugin->noajax || (is_object($this->output) && $this->output->type == 'html'))
                        && (!$plugin->noframe || empty($_REQUEST['_framed']))
                    ) {
                        $plugin->init();
                        $this->plugins[$plugin_name] = $plugin;
                    // call onload method on plugin if it exists.
                    // this is useful if you want to be called early in the boot process
                    if (method_exists($plugin, 'onload')) {
                        $plugin->onload();
                    }
                    // init a plugin only if $force is set or if we're called after initialization
                    if (($force || $this->initialized)
                        && !$this->filter($plugin))
                    {
                        $plugin->init();
                    }
                    $this->plugins[$plugin_name] = $plugin;
                    if (!empty($plugin->allowed_prefs)) {
                        $this->allowed_prefs = array_merge($this->allowed_prefs, $plugin->allowed_prefs);
@@ -203,6 +221,19 @@
    }
    /**
     * check if we should prevent this plugin from initialising
     *
     * @param $plugin
     * @return bool
     */
    private function filter($plugin)
    {
        return (($plugin->noajax  && !(is_object($this->output) && $this->output->type == 'html') )
             || ($plugin->task && !preg_match('/^('.$plugin->task.')$/i', $this->task))
             || ($plugin->noframe && !empty($_REQUEST['_framed']))) ? true : false;
    }
    /**
     * Get information about a specific plugin.
     * This is either provided my a plugin's info() method or extracted from a package.xml or a composer.json file
     *
program/steps/mail/sendmail.inc
@@ -766,6 +766,8 @@
    $body = preg_replace('/\x00/', '', $body);
    $searchstr = 'program/js/tinymce/plugins/emoticons/img/';
    $assets_dir = $RCMAIL->config->get('assets_dir');
    $path       = ($assets_dir ?: INSTALL_PATH) . '/' . $searchstr;
    $offset = 0;
    // keep track of added images, so they're only added once
@@ -779,12 +781,14 @@
                // sanitize image name so resulting attachment doesn't leave images dir
                $image_name = preg_replace('/[^a-zA-Z0-9_\.\-]/i', '', $image_name);
                $img_file   = INSTALL_PATH . '/' . $searchstr . $image_name;
                $img_file   = $path . $image_name;
                if (! in_array($image_name, $included_images)) {
                    // add the image to the MIME message
                    if (!$mime_message->addHTMLImage($img_file, 'image/gif', '', true, $image_name)) {
                    $res = $mime_message->addHTMLImage($img_file, 'image/gif', '', true, $image_name);
                    if (PEAR::isError($res)) {
                        $RCMAIL->output->show_message("emoticonerror", 'error');
                        continue;
                    }
                    array_push($included_images, $image_name);