X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Frequest-functions.php;h=8c49e180d4ba5d67c54279c777ee780c59c659aa;hb=93ccd79d1a3fcb1ee5a101cb6bb670901f154555;hp=f4486a5c6fbfaa4eca461cf2794c16238306ca67;hpb=a975001c8e332a6af3513ea57e9acebeaadf1640;p=mailer.git diff --git a/inc/request-functions.php b/inc/request-functions.php index f4486a5c6f..8c49e180d4 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]; @@ -134,13 +134,17 @@ function postRequestElement ($element, $subElement=null) { 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 @@ -148,11 +152,11 @@ function postRequestElement ($element, $subElement=null) { } // Checks if an element in $_POST exists -function isPostRequestElementSet ($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] . '') != '')); } } @@ -167,7 +171,7 @@ function postRequestArray () { } // Setter for whole $_POST array -function setPostRequestArray (array $postData) { +function setPostRequestArray ($postData) { $GLOBALS['raw_request']['post'] = $postData; } @@ -186,10 +190,11 @@ function countRequestPost () { } // END - if // Return value + return $count; } // Setter for element in $_POST -function setRequestPostElement ($element, $value) { +function setPostRequestElement ($element, $value) { // Is $element or $value an array? if (is_array($element)) { // Set array @@ -219,13 +224,18 @@ function setRequestPostElement ($element, $value) { } // Update cache - $GLOBALS['cache_request']['request_post'][$element][null] = $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 isPostRequestElementSet('ok'); + return isPostRequestElementSet($requestParameter); +} + +// Checks if 'content_type' is set +function isContentTypeSet () { + return isset($GLOBALS['content_type']); } // Setter for content type @@ -243,5 +253,23 @@ function getRequestUri () { return $_SERVER['REQUEST_URI']; } +// Add all GET parameters to a string (without leading sign) +function addAllGetRequestParameters () { + // Init variable + $return = ''; + + // Now add all parameters + foreach (getRequestArray() as $key => $value) { + // Add it secured + $return .= SQL_ESCAPE($key) . '=' . SQL_ESCAPE($value) . '&'; + } // END - foreach + + // Remove trailing & + $return = substr($return, 0, -5); + + // Return it + return $return; +} + // [EOF] ?>