* $Author:: $ *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
- * Copyright (c) 2009 - 2011 by Mailer Developer Team *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team *
* For more information visit: http://mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
// 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)) {
- return ((isset($GLOBALS['raw_request']['post'][$element])) && (('' . $GLOBALS['raw_request']['post'][$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] . '') != ''));
}
}
$GLOBALS['cache_request']['post'][$element][null] = $value;
}
-// Checks wether a form was sent. If so, the $_POST['ok'] element must be set
+// Checks whether a form was sent. If so, the $_POST['ok'] element must be set
function isFormSent ($requestParameter = 'ok') {
// Simply wrap it!
return isPostRequestElementSet($requestParameter);
}
-// Checks if 'content_type' is set
-function isContentTypeSet () {
- return isset($GLOBALS['content_type']);
-}
-
-// Setter for content type
-function setContentType ($contentType) {
- $GLOBALS['content_type'] = (string) $contentType;
-}
-
-// Getter for content type
-function getContentType () {
- return $GLOBALS['content_type'];
-}
-
// Getter for request URI
function getRequestUri () {
+ // Is it not set?
+ if (!isset($_SERVER['REQUEST_URI'])) {
+ // Return empty string
+ return '';
+ } // END - if
+
+ // Return it
return $_SERVER['REQUEST_URI'];
}