]> git.mxchange.org Git - mailer.git/blobdiff - inc/request-functions.php
Fix for 'array-to-string-conversion' bug in request-functions.php
[mailer.git] / inc / request-functions.php
index b110317396d89a7f79617ae8a9edb9b4fc2acf6e..61fdcbb916248c35e2e08cbe6b65a7394d004d39 100644 (file)
@@ -94,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
@@ -145,6 +150,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!