diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2012-06-11 14:36:11 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2012-06-11 14:36:11 +0200 |
commit | b63795ccb8565197aae8578f7e71ad2f7c15256d (patch) | |
tree | ca431a281892c2a66cacdf30d6d45e0cb92662d6 /lib/template.php | |
parent | c009bc4b87fcbb34b71ba04a5c7d043e4ea5abdc (diff) | |
download | nextcloud-server-b63795ccb8565197aae8578f7e71ad2f7c15256d.tar.gz nextcloud-server-b63795ccb8565197aae8578f7e71ad2f7c15256d.zip |
Handling arrays
Diffstat (limited to 'lib/template.php')
-rw-r--r-- | lib/template.php | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/template.php b/lib/template.php index 1e01b411591..d7a87705e34 100644 --- a/lib/template.php +++ b/lib/template.php @@ -268,14 +268,29 @@ 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 * @param $value value |