From: hickert Date: Thu, 8 Jul 2010 11:17:41 +0000 (+0000) Subject: Added two new methods X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=cb089346796f9860f76fc203a6cf1ed4c6c2e97d;p=gosa.git Added two new methods -one to savely fetch binary content from an HTML input field - and one to assign input field valid value back to the smarty templates this allows us to use < > ' " in names, descriptions.. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18963 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index 993fc46c3..eaa1be78c 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -2909,6 +2909,35 @@ function get_post($name) } +/*! \brief Returns contents of the given POST variable and check magic quotes settings + * + * Depending on the magic quotes settings this returns a stripclashed'ed version of + * a certain POST variable. + * + * \param string 'name' the POST var to return ($_POST[$name]) + * \return string + * */ +function get_binary_post($name) +{ + if(!isset($_POST[$name])){ + trigger_error("Requested POST value (".$name.") does not exists, you should add a check to prevent this message."); + return(FALSE); + } + + $p = str_replace('\0', '', $_POST[$name]); + if(get_magic_quotes_gpc()){ + return(stripcslashes($p)); + }else{ + return($_POST[$p]); + } +} + +function set_post($value) +{ + return(htmlentities($value, ENT_QUOTES, 'utf-8')); +} + + /*! \brief Return class name in correct case */ function get_correct_class_name($cls) {