X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=inc%2Frequest-functions.php;h=d314a2bee06c3d449abe332d7a2da452dbfc22e3;hb=f39ec6e67b8a43bfa91212f0c6bd1c52e707f896;hp=0066994f26757168c63a4fbe8aef21bde6e2f150;hpb=d8148e3f1f3a6762b2e786dbe99ada269dcf2ea0;p=mailer.git diff --git a/inc/request-functions.php b/inc/request-functions.php index 0066994f26..d314a2bee0 100644 --- a/inc/request-functions.php +++ b/inc/request-functions.php @@ -10,7 +10,12 @@ * -------------------------------------------------------------------- * * Kurzbeschreibung : Spezialle Funktionen fuer die Anfragebehandlung * * -------------------------------------------------------------------- * - * * + * $Revision:: 856 $ * + * $Date:: 2009-03-06 20:24:32 +0100 (Fr, 06. Mär 2009) $ * + * $Tag:: 0.2.1-FINAL $ * + * $Author:: stelzi $ * + * Needs to be in all Files and every File needs "svn propset * + * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2008 by Roland Haeder * * For more information visit: http://www.mxchange.org * @@ -42,10 +47,16 @@ function REQUEST_GET ($element) { // By default no element is there $value = null; - // Is the element there? - if (REQUEST_ISSET_GET($element)) { - // Then use it - $value = $_GET[$element]; + // Is the element cached or there? + if (isset($GLOBALS['cache_array']['request_get'][$element])) { + // Then use the cache + $value = $GLOBALS['cache_array']['request_get'][$element]; + } elseif (REQUEST_ISSET_GET($element)) { + // Then get it directly + $value = SQL_ESCAPE($_GET[$element]); + + // Store it in cache + $GLOBALS['cache_array']['request_get'][$element] = $value; } // END - if // Return value @@ -53,8 +64,12 @@ function REQUEST_GET ($element) { } // Checks if an element in $_GET exists -function REQUEST_ISSET_GET ($element) { - return (isset($_GET['element'])); +function REQUEST_ISSET_GET ($element, $subElement="") { + if (empty($subElement)) { + return (isset($_GET[$element])); + } else { + return (isset($_GET[$element][$subElement])); + } } // Removes an element from $_GET @@ -84,8 +99,13 @@ function REQUEST_GET_COUNT () { // Return value } +// Setter for element in $_GET +function REQUEST_SET_GET ($element, $value) { + $_GET[SQL_ESCAPE($element)] = SQL_ESCAPE($value); +} + // Wrapper for elements in $_POST -function REQUEST_POST ($element) { +function REQUEST_POST ($element, $subElement=null) { // By default no element is there $value = null; @@ -93,6 +113,12 @@ function REQUEST_POST ($element) { if (REQUEST_ISSET_POST($element)) { // Then use it $value = $_POST[$element]; + + // Is $subElement set? + if ((!is_null($subElement)) && (REQUEST_ISSET_POST($element, $subElement))) { + // Then use this + $value = $value[$subElement]; + } // END - if } // END - if // Return value @@ -100,8 +126,12 @@ function REQUEST_POST ($element) { } // Checks if an element in $_POST exists -function REQUEST_ISSET_POST ($element) { - return (isset($_POST['element'])); +function REQUEST_ISSET_POST ($element, $subElement=null) { + if (is_null($subElement)) { + return (isset($_POST[$element])); + } else { + return (isset($_POST[$element][$subElement])); + } } // Removes an element from $_POST @@ -131,6 +161,29 @@ function REQUEST_POST_COUNT () { // Return value } +// Setter for element in $_POST +function REQUEST_SET_POST ($element, $value) { + if (is_array($element)) { + // Set array + $eval = "\$_POST['"; + + // Add all entries + $eval .= implode("', '", $element); + + // Finish eval() command + $eval .= sprintf("'] = \"%s\";", SQL_ESCAPE($value)); + + // And run it + eval($eval); + } elseif (is_array($value)) { + // Value is an array so set it directly + $_POST[SQL_ESCAPE($element)] = $value; + } else { + // Set regular entry + $_POST[SQL_ESCAPE($element)] = SQL_ESCAPE($value); + } +} + // Checks wether a form was sent. If so, the $_POST['ok'] element must be set function IS_FORM_SENT () { // Simply wrap it!