Fix object property access in WCF.Template
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 26 Apr 2013 20:16:32 +0000 (22:16 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 26 Apr 2013 20:17:36 +0000 (22:17 +0200)
wcfsetup/install/files/js/WCF.js

index 6c08977146d76ad585bb1b11bfb828d53c448c85..3d5a3da90fc69e76119bcf5431880eb0a695dec9 100755 (executable)
@@ -3314,25 +3314,25 @@ WCF.Template = Class.extend({
                };
                
                template = template.replace(/\{(\$[^\}]+?)\}/g, function(_, content) {
-                       content = unescape(content.replace(/\$([^.\s]+)/g, "(v['$1'])"));
+                       content = unescape(content.replace(/\$([^.\[\s]+)/g, "(v['$1'])"));
                        
                        return "' + WCF.String.escapeHTML(" + content + ") + '";
                })
                // Numeric Variable
                .replace(/\{#(\$[^\}]+?)\}/g, function(_, content) {
-                       content = unescape(content.replace(/\$([^.\s]+)/g, "(v['$1'])"));
+                       content = unescape(content.replace(/\$([^.\[\s]+)/g, "(v['$1'])"));
                        
                        return "' + WCF.String.formatNumeric(" + content + ") + '";
                })
                // Variable without escaping
                .replace(/\{@(\$[^\}]+?)\}/g, function(_, content) {
-                       content = unescape(content.replace(/\$([^.\s]+)/g, "(v['$1'])"));
+                       content = unescape(content.replace(/\$([^.\[\s]+)/g, "(v['$1'])"));
                        
                        return "' + " + content + " + '";
                })
                // {if}
                .replace(/\{if (.+?)\}/g, function(_, content) {
-                       content = unescape(content.replace(/\$([^.\s]+)/g, "(v['$1'])"));
+                       content = unescape(content.replace(/\$([^.\[\s]+)/g, "(v['$1'])"));
                        
                        return  "';\n" +
                                "if (" + content + ") {\n" +
@@ -3340,7 +3340,7 @@ WCF.Template = Class.extend({
                })
                // {elseif}
                .replace(/\{else ?if (.+?)\}/g, function(_, content) {
-                       content = unescape(content.replace(/\$([^.\s]+)/g, "(v['$1'])"));
+                       content = unescape(content.replace(/\$([^.\[\s]+)/g, "(v['$1'])"));
                        
                        return  "';\n" +
                                "}\n" +
@@ -3358,7 +3358,7 @@ WCF.Template = Class.extend({
                        if (typeof $parameters['item'] === 'undefined') throw new Error('Missing item attribute in implode-tag');
                        if (typeof $parameters['glue'] === 'undefined') $parameters['glue'] = "', '";
                        
-                       $parameters['from'] = $parameters['from'].replace(/\$([^.\s]+)/g, "(v.$1)");
+                       $parameters['from'] = $parameters['from'].replace(/\$([^.\[\s]+)/g, "(v.$1)");
                        
                        return  "';\n"+
                                "var $implode_" + $tagID + " = false;\n" +
@@ -3378,7 +3378,7 @@ WCF.Template = Class.extend({
                        
                        if (typeof $parameters['from'] === 'undefined') throw new Error('Missing from attribute in foreach-tag');
                        if (typeof $parameters['item'] === 'undefined') throw new Error('Missing item attribute in foreach-tag');
-                       $parameters['from'] = $parameters['from'].replace(/\$([^.\s]+)/g, "(v.$1)");
+                       $parameters['from'] = $parameters['from'].replace(/\$([^.\[\s]+)/g, "(v.$1)");
                        
                        return  "';\n" +
                                "$foreach_"+$tagID+" = false;\n" +