diff options
author | fwenzel@mozilla.com <fwenzel@mozilla.com@4eb1ac78-321c-0410-a911-ec516a8615a5> | 2008-09-11 22:48:31 (GMT) |
---|---|---|
committer | fwenzel@mozilla.com <fwenzel@mozilla.com@4eb1ac78-321c-0410-a911-ec516a8615a5> | 2008-09-11 22:48:31 (GMT) |
commit | 289b22d898a42f360ac3ae7405e51c23724c6c7c (patch) | |
tree | ae53b35e496e6a787f1d8d8a655506f4fe9d9087 /site/app/app_controller.php | |
parent | 7ce646337038bdf77b6c77a8a16325dcf7919613 (diff) |
exclude keys from array sanitization (incl. tests) (bug 452456, r=morgamic)
git-svn-id: http://svn.mozilla.org/addons/trunk@18176 4eb1ac78-321c-0410-a911-ec516a8615a5
Diffstat (limited to 'site/app/app_controller.php')
-rw-r--r-- | site/app/app_controller.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/site/app/app_controller.php b/site/app/app_controller.php index 24a492f..d424285 100644 --- a/site/app/app_controller.php +++ b/site/app/app_controller.php @@ -293,11 +293,12 @@ class AppController extends Controller * @param string viewvar Variable name to be made available in the view * @param mixed array or string data to be assigned to the variable name * @param bool sanitizeme do data sanitization on the value before setting it? + * @param bool sanitizekeys clean array keys also? * @return void */ - function publish($viewvar, $value, $sanitizeme = true) { + function publish($viewvar, $value, $sanitizeme = true, $sanitizekeys = false) { if ($sanitizeme) - $this->_sanitizeArray($value); + $this->_sanitizeArray($value, $sanitizekeys); $this->set($viewvar, $value); } @@ -308,7 +309,7 @@ class AppController extends Controller */ function beforeRender() { if (isset($this->data)) - $this->_sanitizeArray($this->data); + $this->_sanitizeArray($this->data, false); return parent::beforeRender(); } @@ -335,7 +336,7 @@ class AppController extends Controller * @param bool clean the array keys as well? * @return void */ - function _sanitizeArray(&$data, $cleankeys = true) { + function _sanitizeArray(&$data, $cleankeys = false) { global $sanitize_patterns; if (is_array($data)) { @@ -347,7 +348,7 @@ class AppController extends Controller // particular array keeps the translations locale strings from // becoming entities if (!in_array($key, $this->dontsanitize, true)) { - $this->_sanitizeArray($data[$key]); + $this->_sanitizeArray($data[$key], $cleankeys); } } |