]> git.mxchange.org Git - mailer.git/blobdiff - inc/request-functions.php
More constant rewrites
[mailer.git] / inc / request-functions.php
index 0066994f26757168c63a4fbe8aef21bde6e2f150..740f7bd52eea4aeedb9fbe6e1b3f2521930b276f 100644 (file)
@@ -42,10 +42,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 +59,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, $extra="") {
+       if (empty($extra)) {
+               return (isset($_GET[$element]));
+       } else {
+               return (isset($_GET[$element][$extra]));
+       }
 }
 
 // Removes an element from $_GET
@@ -84,6 +94,11 @@ 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) {
        // By default no element is there
@@ -100,8 +115,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, $extra="") {
+       if (empty($extra)) {
+               return (isset($_POST[$element]));
+       } else {
+               return (isset($_POST[$element][$extra]));
+       }
 }
 
 // Removes an element from $_POST
@@ -131,6 +150,26 @@ 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);
+       } 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!