* $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 *
// Removes an element from $_GET
function unsetGetRequestElement ($element) {
+ unset($GLOBALS['cache_request']['get'][$element]);
unset($GLOBALS['raw_request']['get'][$element]);
}
// Wrapper for elements in $_POST
function postRequestElement ($element, $subElement = NULL) {
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element[' . gettype($element) . ']=' . $element . ',subElement[' . gettype($subElement) . ']=' . $subElement . ' - ENTERED!');
// By default no element is there
$value = NULL;
if (isset($GLOBALS['cache_request']['post'][$element][$subElement])) {
// Then use it
$value = $GLOBALS['cache_request']['post'][$element][$subElement];
- //* DEBUG: */ print $element.'/'.$subElement.'='.$value.'<br />';
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element[' . gettype($element) . ']=' . $element . ',subElement[' . gettype($subElement) . ']=' . $subElement . ',value[' . gettype($value) . ']=' . $value . ' - CACHE!');
} elseif (isPostRequestElementSet($element)) {
// Then use it
$value = $GLOBALS['raw_request']['post'][$element];
if ((!is_null($subElement)) && (isPostRequestElementSet($element, $subElement))) {
// Then use this
$value = SQL_ESCAPE($value[$subElement]);
- //* DEBUG: */ print 'sub!<br />';
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',subElement=' . $subElement . ' - SUB!');
} elseif (!is_array($value)) {
// Escape it here
$value = SQL_ESCAPE($value);
- //* DEBUG: */ print 'no-array!<br />';
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ' - REGULAR!');
}
// Set it in cache
- //* DEBUG: */ print $element.'/'.$subElement.'='.$value.'<br />';
- //* DEBUG: */ print('<pre>'.print_r($_POST,true).'</pre>');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',subElement=' . $subElement . ',value=' . $value.' - ADDED!');
$GLOBALS['cache_request']['post'][$element][$subElement] = $value;
} // END - if
// Return value
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element[' . gettype($element) . ']=' . $element . ',subElement[' . gettype($subElement) . ']=' . $subElement . ',value[' . gettype($value) . ']=' . $value . ' - EXIT!');
return $value;
}
// Checks if an element in $_POST exists
function isPostRequestElementSet ($element, $subElement = NULL) {
if (is_null($subElement)) {
- return ((isset($GLOBALS['raw_request']['post'][$element])) && (('' . $GLOBALS['raw_request']['post'][$element] . '') != ''));
+ if (!is_string($element)) die(gettype($element));
+ return ((isset($GLOBALS['raw_request']['post'][$element])) && ((is_array($GLOBALS['raw_request']['post'][$element])) || (('' . $GLOBALS['raw_request']['post'][$element] . '') != '')));
} else {
return ((isset($GLOBALS['raw_request']['post'][$element][$subElement])) && (('' . $GLOBALS['raw_request']['post'][$element][$subElement] . '') != ''));
}
// Removes an element from $_POST
function unsetPostRequestElement ($element) {
unset($GLOBALS['raw_request']['post'][$element]);
+ unset($GLOBALS['cache_request']['post'][$element]);
}
// Getter for whole $_POST array
$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'];
}