Renamed function so it might be more understandable
[mailer.git] / inc / request-functions.php
index ed1a0a78c2b7fcba37bd783f132553eea29d2d00..5a4f04621694f0c5c6a7ac858d722095d1bf786e 100644 (file)
  * $Date::                                                            $ *
  * $Tag:: 0.2.1-FINAL                                                 $ *
  * $Author::                                                          $ *
- * Needs to be in all Files and every File needs "svn propset           *
- * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -48,7 +47,7 @@ function initRequest () {
 }
 
 // Wrapper for elements in $_GET
-function getRequestElement ($element) {
+function getRequestParameter ($element) {
        // By default no element is there
        $value = null;
 
@@ -56,7 +55,7 @@ function getRequestElement ($element) {
        if (isset($GLOBALS['cache_request']['request_get'][$element])) {
                // Then use the cache
                $value = $GLOBALS['cache_request']['request_get'][$element];
-       } elseif (isGetRequestElementSet($element)) {
+       } elseif (isGetRequestParameterSet($element)) {
                // Then get it directly
                $value = SQL_ESCAPE($GLOBALS['raw_request']['get'][$element]);
 
@@ -69,7 +68,7 @@ function getRequestElement ($element) {
 }
 
 // Checks if an element in $_GET exists
-function isGetRequestElementSet ($element, $subElement = '') {
+function isGetRequestParameterSet ($element, $subElement = '') {
        if (empty($subElement)) {
                return ((isset($GLOBALS['raw_request']['get'][$element])) && (!empty($GLOBALS['raw_request']['get'][$element])));
        } else {
@@ -78,7 +77,7 @@ function isGetRequestElementSet ($element, $subElement = '') {
 }
 
 // Removes an element from $_GET
-function unsetGetRequestElement ($element) {
+function unsetGetRequestParameter ($element) {
        unset($GLOBALS['raw_request']['get'][$element]);
 }
 
@@ -105,7 +104,7 @@ function countRequestGet () {
 }
 
 // Setter for element in $_GET
-function setRequestGetElement ($element, $value) {
+function setGetRequestParameter ($element, $value) {
        // Escape both
        $element = SQL_ESCAPE($element);
        $value   = SQL_ESCAPE($value);
@@ -118,7 +117,7 @@ function setRequestGetElement ($element, $value) {
 }
 
 // Wrapper for elements in $_POST
-function postRequestElement ($element, $subElement=null) {
+function postRequestParameter ($element, $subElement=null) {
        // By default no element is there
        $value = null;
 
@@ -126,12 +125,12 @@ function postRequestElement ($element, $subElement=null) {
        if (isset($GLOBALS['cache_request']['request_post'][$element][$subElement])) {
                // Then use it
                $value = $GLOBALS['cache_request']['request_post'][$element][$subElement];
-       } elseif (isPostRequestElementSet($element)) {
+       } elseif (isPostRequestParameterSet($element)) {
                // Then use it
                $value = $GLOBALS['raw_request']['post'][$element];
 
                // Is $subElement set?
-               if ((!is_null($subElement)) && (isPostRequestElementSet($element, $subElement))) {
+               if ((!is_null($subElement)) && (isPostRequestParameterSet($element, $subElement))) {
                        // Then use this
                        $value = SQL_ESCAPE($value[$subElement]);
                } elseif (!is_array($value)) {
@@ -148,7 +147,7 @@ function postRequestElement ($element, $subElement=null) {
 }
 
 // Checks if an element in $_POST exists
-function isPostRequestElementSet ($element, $subElement=null) {
+function isPostRequestParameterSet ($element, $subElement=null) {
        if (is_null($subElement)) {
                return ((isset($GLOBALS['raw_request']['post'][$element])) && (isset($GLOBALS['raw_request']['post'][$element])));
        } else {
@@ -157,7 +156,7 @@ function isPostRequestElementSet ($element, $subElement=null) {
 }
 
 // Removes an element from $_POST
-function unsetPostRequestElement ($element) {
+function unsetPostRequestParameter ($element) {
        unset($GLOBALS['raw_request']['post'][$element]);
 }
 
@@ -189,7 +188,7 @@ function countRequestPost () {
 }
 
 // Setter for element in $_POST
-function setRequestPostElement ($element, $value) {
+function setPostRequestParameter ($element, $value) {
        // Is $element or $value an array?
        if (is_array($element)) {
                // Set array
@@ -223,9 +222,14 @@ function setRequestPostElement ($element, $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 isPostRequestParameterSet($requestParameter);
+}
+
+// Checks if 'content_type' is set
+function isContentTypeSet () {
+       return isset($GLOBALS['content_type']);
 }
 
 // Setter for content type