From b408e0bc532e6023248c6671c5cef52d1c06f3f3 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Fri, 30 May 2014 04:53:19 -0400
Subject: [PATCH] Display a warning if popup window was blocked (#1489618)

---
 program/lib/Roundcube/html.php |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/program/lib/Roundcube/html.php b/program/lib/Roundcube/html.php
index 33517fb..a88570d 100644
--- a/program/lib/Roundcube/html.php
+++ b/program/lib/Roundcube/html.php
@@ -269,19 +269,27 @@
             return '';
         }
 
-        $allowed_f = array_flip((array)$allowed);
+        $allowed_f  = array_flip((array)$allowed);
         $attrib_arr = array();
+
         foreach ($attrib as $key => $value) {
             // skip size if not numeric
             if ($key == 'size' && !is_numeric($value)) {
                 continue;
             }
 
-            // ignore "internal" or not allowed attributes
-            if ($key == 'nl' || ($allowed && !isset($allowed_f[$key])) || $value === null) {
+            // ignore "internal" or empty attributes
+            if ($key == 'nl' || $value === null) {
                 continue;
             }
 
+            // ignore not allowed attributes, except data-*
+            if (!empty($allowed)) {
+                if (!isset($allowed_f[$key]) && @substr_compare($key, 'data-', 0, 5) !== 0) {
+                    continue;
+                }
+            }
+
             // skip empty eventhandlers
             if (preg_match('/^on[a-z]+/', $key) && !$value) {
                 continue;

--
Gitblit v1.9.1