Extension ext-user for sub id tracking continued:
[mailer.git] / inc / request-functions.php
index c4afd304a919d52d64ef19dbbf0f4d8a7185ffe4..e0051a169edc6da09958b57ae5ac2276f48452b9 100644 (file)
@@ -155,10 +155,19 @@ function postRequestElement ($element, $subElement = NULL) {
 
 // Checks if an element in $_POST exists
 function isPostRequestElementSet ($element, $subElement = NULL) {
+       /*
+        * Always check that $element is a string and that $subElement is NULL or
+        * a string as numerical indexes are not wanted in POST data (in this
+        * project).
+        */
+       assert(is_string($element) && ((is_null($subElement)) || (is_string($subElement)) || (is_int($subElement))));
+
+       // Is a sub element set?
        if (is_null($subElement)) {
-               if (!is_string($element)) die(gettype($element));
+               // No, then only check $element
                return ((isset($GLOBALS['raw_request']['post'][$element])) && ((is_array($GLOBALS['raw_request']['post'][$element])) || (('' . $GLOBALS['raw_request']['post'][$element] . '') != '')));
        } else {
+               // Yes, then check both together
                return ((isset($GLOBALS['raw_request']['post'][$element][$subElement])) && (('' . $GLOBALS['raw_request']['post'][$element][$subElement] . '') != ''));
        }
 }