]> source.dussan.org Git - nextcloud-server.git/commitdiff
Handling arrays
authorLukas Reschke <lukas@statuscode.ch>
Mon, 11 Jun 2012 12:36:11 +0000 (14:36 +0200)
committerLukas Reschke <lukas@statuscode.ch>
Mon, 11 Jun 2012 12:36:11 +0000 (14:36 +0200)
lib/template.php

index 1e01b4115917a49114e16ba3df72ea3859dd67a5..d7a87705e34e6e6b50328047b2cfec1232549d95 100644 (file)
@@ -268,13 +268,28 @@ class OC_Template{
         * If the key existed before, it will be overwritten
         */
        public function assign( $key, $value, $sanitizeHTML=true ){
+               if(is_array($value) && $sanitizeHTML) { 
+                       array_walk_recursive($value,'OC_Template::sanitizeHTML');
+                       $this->vars[$key] = $value;
+                       return true;
+               }
                if($sanitizeHTML) { 
-                       $this->vars[$key] = htmlentities($value);
+                       $this->vars[$key] = htmlentities($value, ENT_QUOTES);
+                       return true;
                }
                $this->vars[$key] = $value;
                return true;
        }
 
+       /**
+        * @brief Internaly used to sanitze HTML
+        *
+        * This function is internally used to sanitize HTML.
+        */
+       private function sanitizeHTML( &$value ){
+        $value = htmlentities( $value, ENT_QUOTES );
+    }
+
        /**
         * @brief Appends a variable
         * @param $key key