X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Frequest-functions.php;h=d7817ba0c921108d059409c33ac75941c3a28cd2;hb=8202991f32bfb2056e94a11746c0b5308fe4a273;hp=b82c12a7ef810354de2ee467316fbd487511a8e3;hpb=be79afde3071dfc4d6fe845ddb75abf13534eadb;p=mailer.git diff --git a/inc/request-functions.php b/inc/request-functions.php index b82c12a7ef..d7817ba0c9 100644 --- a/inc/request-functions.php +++ b/inc/request-functions.php @@ -17,7 +17,7 @@ * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * * Copyright (c) 2009 - 2011 by Mailer Developer Team * - * For more information visit: http://www.mxchange.org * + * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -47,7 +47,7 @@ function initRequest () { } // Wrapper for elements in $_GET -function getRequestParameter ($element) { +function getRequestElement ($element) { // By default no element is there $value = NULL; @@ -55,7 +55,7 @@ function getRequestParameter ($element) { if (isset($GLOBALS['cache_request']['get'][$element])) { // Then use the cache $value = $GLOBALS['cache_request']['get'][$element]; - } elseif (isGetRequestParameterSet($element)) { + } elseif (isGetRequestElementSet($element)) { // Then get it directly $value = SQL_ESCAPE($GLOBALS['raw_request']['get'][$element]); @@ -68,7 +68,7 @@ function getRequestParameter ($element) { } // Checks if an element in $_GET exists -function isGetRequestParameterSet ($element, $subElement = '') { +function isGetRequestElementSet ($element, $subElement = '') { if (empty($subElement)) { return ((isset($GLOBALS['raw_request']['get'][$element])) && ('' . ($GLOBALS['raw_request']['get'][$element] . '') != '')); } else { @@ -77,7 +77,7 @@ function isGetRequestParameterSet ($element, $subElement = '') { } // Removes an element from $_GET -function unsetGetRequestParameter ($element) { +function unsetGetRequestElement ($element) { unset($GLOBALS['raw_request']['get'][$element]); } @@ -104,7 +104,7 @@ function countRequestGet () { } // Setter for element in $_GET -function setGetRequestParameter ($element, $value) { +function setGetRequestElement ($element, $value) { // Escape both $element = SQL_ESCAPE($element); $value = SQL_ESCAPE($value); @@ -117,7 +117,7 @@ function setGetRequestParameter ($element, $value) { } // Wrapper for elements in $_POST -function postRequestParameter ($element, $subElement=null) { +function postRequestElement ($element, $subElement = NULL) { // By default no element is there $value = NULL; @@ -125,20 +125,25 @@ function postRequestParameter ($element, $subElement=null) { if (isset($GLOBALS['cache_request']['post'][$element][$subElement])) { // Then use it $value = $GLOBALS['cache_request']['post'][$element][$subElement]; - } elseif (isPostRequestParameterSet($element)) { + //* DEBUG: */ print $element.'/'.$subElement.'='.$value.'
'; + } elseif (isPostRequestElementSet($element)) { // Then use it $value = $GLOBALS['raw_request']['post'][$element]; // Is $subElement set? - if ((!is_null($subElement)) && (isPostRequestParameterSet($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 + //* DEBUG: */ print $element.'/'.$subElement.'='.$value.'
'; + //* DEBUG: */ print('
'.print_r($_POST,true).'
'); $GLOBALS['cache_request']['post'][$element][$subElement] = $value; } // END - if @@ -147,7 +152,7 @@ function postRequestParameter ($element, $subElement=null) { } // Checks if an element in $_POST exists -function isPostRequestParameterSet ($element, $subElement=null) { +function isPostRequestElementSet ($element, $subElement = NULL) { if (is_null($subElement)) { return ((isset($GLOBALS['raw_request']['post'][$element])) && (('' . $GLOBALS['raw_request']['post'][$element] . '') != '')); } else { @@ -156,7 +161,7 @@ function isPostRequestParameterSet ($element, $subElement=null) { } // Removes an element from $_POST -function unsetPostRequestParameter ($element) { +function unsetPostRequestElement ($element) { unset($GLOBALS['raw_request']['post'][$element]); } @@ -188,7 +193,7 @@ function countRequestPost () { } // Setter for element in $_POST -function setPostRequestParameter ($element, $value) { +function setPostRequestElement ($element, $value) { // Is $element or $value an array? if (is_array($element)) { // Set array @@ -224,7 +229,7 @@ function setPostRequestParameter ($element, $value) { // Checks wether a form was sent. If so, the $_POST['ok'] element must be set function isFormSent ($requestParameter = 'ok') { // Simply wrap it! - return isPostRequestParameterSet($requestParameter); + return isPostRequestElementSet($requestParameter); } // Checks if 'content_type' is set @@ -247,5 +252,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] ?>