X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Frequest-functions.php;h=353e24b4e8a6acba00e0c8fb770d44fd25022c0a;hb=7957bf99511c45f993cdad1304ade6700385fef8;hp=0ae3de0a6a52c4d17edc49eb04507f38ddf6a8b6;hpb=2592ef433edd0c7cbde318e76792a521b6ec155e;p=mailer.git diff --git a/inc/request-functions.php b/inc/request-functions.php index 0ae3de0a6a..353e24b4e8 100644 --- a/inc/request-functions.php +++ b/inc/request-functions.php @@ -1,7 +1,7 @@ '; + } elseif (isPostRequestElementSet($element)) { // Then use it $value = $GLOBALS['raw_request']['post'][$element]; // Is $subElement set? - if (($subElement != -1) && (REQUEST_ISSET_POST($element, $subElement))) { + if ((!is_null($subElement)) && (isPostRequestElementSet($element, $subElement))) { // Then use this $value = SQL_ESCAPE($value[$subElement]); + //* DEBUG: */ print 'sub!
'; } elseif (!is_array($value)) { // Escape it here $value = SQL_ESCAPE($value); + //* DEBUG: */ print 'no-array!
'; } // Set it in cache - $GLOBALS['cache_request']['request_post'][$element][$subElement] = $value; + //* DEBUG: */ print $element.'/'.$subElement.'='.$value.'
'; + //* DEBUG: */ print('
'.print_r($_POST,true).'
'); + $GLOBALS['cache_request']['post'][$element][$subElement] = $value; } // END - if // Return value @@ -143,48 +152,48 @@ function REQUEST_POST ($element, $subElement=-1) { } // Checks if an element in $_POST exists -function REQUEST_ISSET_POST ($element, $subElement=null) { +function isPostRequestElementSet ($element, $subElement = NULL) { if (is_null($subElement)) { - return ((isset($GLOBALS['raw_request']['post'][$element])) && (!empty($GLOBALS['raw_request']['post'][$element]))); + return ((isset($GLOBALS['raw_request']['post'][$element])) && (('' . $GLOBALS['raw_request']['post'][$element] . '') != '')); } else { - return ((isset($GLOBALS['raw_request']['post'][$element][$subElement])) && (!empty($GLOBALS['raw_request']['post'][$element][$subElement]))); + return ((isset($GLOBALS['raw_request']['post'][$element][$subElement])) && (('' . $GLOBALS['raw_request']['post'][$element][$subElement] . '') != '')); } } // Removes an element from $_POST -function REQUEST_UNSET_POST ($element) { +function unsetPostRequestElement ($element) { unset($GLOBALS['raw_request']['post'][$element]); } // Getter for whole $_POST array -function REQUEST_POST_ARRAY () { +function postRequestArray () { return $GLOBALS['raw_request']['post']; } // Setter for whole $_POST array -function REQUEST_SET_POST_ARRAY (array $POST) { - $GLOBALS['raw_request']['post'] = $POST; +function setPostRequestArray ($postData) { + $GLOBALS['raw_request']['post'] = $postData; } // Counts entries in $_POST or returns false if not an array -function REQUEST_POST_COUNT () { +function countRequestPost () { // By default this is not an array $count = false; // Get the array - $POST = REQUEST_POST_ARRAY(); + $postData = postRequestArray(); // Is it an array? - if (is_array($POST)) { + if (is_array($postData)) { // Then count it - $count = count($POST); + $count = count($postData); } // END - if // Return value } // Setter for element in $_POST -function REQUEST_SET_POST ($element, $value) { +function setPostRequestElement ($element, $value) { // Is $element or $value an array? if (is_array($element)) { // Set array @@ -214,20 +223,34 @@ function REQUEST_SET_POST ($element, $value) { } // Update cache - $GLOBALS['cache_request']['request_post'][$element] = $value; + $GLOBALS['cache_request']['post'][$element][null] = $value; } // Checks wether a form was sent. If so, the $_POST['ok'] element must be set -function isFormSent () { +function isFormSent ($requestParameter = 'ok') { // Simply wrap it! - return REQUEST_ISSET_POST('ok'); + return isPostRequestElementSet($requestParameter); } -// Initialize the request elements -function initRequest () { - $GLOBALS['raw_request']['get'] = $_GET; - $GLOBALS['raw_request']['post'] = $_POST; +// 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 () { + return $_SERVER['REQUEST_URI']; } -// +// [EOF] ?>