From 7bdd3e22b56b17df7f15d2179f7918c9a5d15da1 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Fri, 29 Oct 2010 06:50:53 -0400
Subject: [PATCH] - Fix address parsing for situation when encoded words are used inside quoted string (#1484961)

---
 program/include/rcube_plugin_api.php |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/program/include/rcube_plugin_api.php b/program/include/rcube_plugin_api.php
index 2313d69..f0fe8c2 100644
--- a/program/include/rcube_plugin_api.php
+++ b/program/include/rcube_plugin_api.php
@@ -31,6 +31,7 @@
   public $dir;
   public $url = 'plugins/';
   public $output;
+  public $config;
   
   public $handlers = array();
   private $plugins = array();
@@ -39,7 +40,6 @@
   private $actionmap = array();
   private $objectsmap = array();
   private $template_contents = array();
-  
   private $required_plugins = array('filesystem_attachments');
   private $active_hook = false;
 
@@ -107,6 +107,7 @@
   {
     $rcmail = rcmail::get_instance();
     $this->output = $rcmail->output;
+    $this->config = $rcmail->config;
 
     $plugins_dir = dir($this->dir);
     $plugins_dir = unslashify($plugins_dir->path);
@@ -121,10 +122,16 @@
         // instantiate class if exists
         if (class_exists($plugin_name, false)) {
           $plugin = new $plugin_name($this);
-          // check inheritance and task specification
-          if (is_subclass_of($plugin, 'rcube_plugin') && (!$plugin->task || preg_match('/^('.$plugin->task.')$/i', $rcmail->task))) {
-            $plugin->init();
-            $this->plugins[] = $plugin;
+          // check inheritance...
+          if (is_subclass_of($plugin, 'rcube_plugin')) {
+            // ... task, request type and framed mode
+            if ((!$plugin->task || preg_match('/^('.$plugin->task.')$/i', $rcmail->task))
+                && (!$plugin->noajax || is_a($this->output, 'rcube_template'))
+                && (!$plugin->noframe || empty($_REQUEST['_framed']))
+            ) {
+              $plugin->init();
+              $this->plugins[] = $plugin;
+            }
           }
         }
         else {
@@ -255,7 +262,7 @@
       $action = $task.'.'.$action;
     else if (strpos($action, 'plugin.') !== 0)
       $action = 'plugin.'.$action;
-    
+
     // can register action only if it's not taken or registered by myself
     if (!isset($this->actionmap[$action]) || $this->actionmap[$action] == $owner) {
       $this->actions[$action] = $callback;

--
Gitblit v1.9.1