]> git.mxchange.org Git - mailer.git/blobdiff - inc/request-functions.php
A lot has been rewritten, ext-teams added, ext-forced continued:
[mailer.git] / inc / request-functions.php
index b6b45f165f07e5bae6bf4aab58c5bfe86507f4e5..b82c12a7ef810354de2ee467316fbd487511a8e3 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 - 2011 by Mailer Developer Team                   *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -43,25 +42,25 @@ if (!defined('__SECURITY')) {
 
 // Initialize the request elements
 function initRequest () {
-       $GLOBALS['raw_request']['get']  = $_GET;
-       $GLOBALS['raw_request']['post'] = $_POST;
+       $GLOBALS['raw_request']['get']  = (array) $_GET;
+       $GLOBALS['raw_request']['post'] = (array) $_POST;
 }
 
 // Wrapper for elements in $_GET
 function getRequestParameter ($element) {
        // By default no element is there
-       $value = null;
+       $value = NULL;
 
        // Is the element cached or there?
-       if (isset($GLOBALS['cache_request']['request_get'][$element])) {
+       if (isset($GLOBALS['cache_request']['get'][$element])) {
                // Then use the cache
-               $value = $GLOBALS['cache_request']['request_get'][$element];
+               $value = $GLOBALS['cache_request']['get'][$element];
        } elseif (isGetRequestParameterSet($element)) {
                // Then get it directly
                $value = SQL_ESCAPE($GLOBALS['raw_request']['get'][$element]);
 
                // Store it in cache
-               $GLOBALS['cache_request']['request_get'][$element] = $value;
+               $GLOBALS['cache_request']['get'][$element] = $value;
        } // END - if
 
        // Return value
@@ -71,9 +70,9 @@ function getRequestParameter ($element) {
 // Checks if an element in $_GET exists
 function isGetRequestParameterSet ($element, $subElement = '') {
        if (empty($subElement)) {
-               return ((isset($GLOBALS['raw_request']['get'][$element])) && (!empty($GLOBALS['raw_request']['get'][$element])));
+               return ((isset($GLOBALS['raw_request']['get'][$element])) && ('' . ($GLOBALS['raw_request']['get'][$element] . '') != ''));
        } else {
-               return ((isset($GLOBALS['raw_request']['get'][$element][$subElement])) && (!empty($GLOBALS['raw_request']['get'][$element][$subElement])));
+               return ((isset($GLOBALS['raw_request']['get'][$element][$subElement])) && ('' . ($GLOBALS['raw_request']['get'][$element][$subElement] . '') != ''));
        }
 }
 
@@ -114,18 +113,18 @@ function setGetRequestParameter ($element, $value) {
        $GLOBALS['raw_request']['get'][$element] = $value;
 
        // Update cache
-       $GLOBALS['cache_request']['request_get'][$element] = $value;
+       $GLOBALS['cache_request']['get'][$element] = $value;
 }
 
 // Wrapper for elements in $_POST
 function postRequestParameter ($element, $subElement=null) {
        // By default no element is there
-       $value = null;
+       $value = NULL;
 
        // Is the element in cache?
-       if (isset($GLOBALS['cache_request']['request_post'][$element][$subElement])) {
+       if (isset($GLOBALS['cache_request']['post'][$element][$subElement])) {
                // Then use it
-               $value = $GLOBALS['cache_request']['request_post'][$element][$subElement];
+               $value = $GLOBALS['cache_request']['post'][$element][$subElement];
        } elseif (isPostRequestParameterSet($element)) {
                // Then use it
                $value = $GLOBALS['raw_request']['post'][$element];
@@ -140,7 +139,7 @@ function postRequestParameter ($element, $subElement=null) {
                }
 
                // Set it in cache
-               $GLOBALS['cache_request']['request_post'][$element][$subElement] = $value;
+               $GLOBALS['cache_request']['post'][$element][$subElement] = $value;
        } // END - if
 
        // Return value
@@ -150,9 +149,9 @@ function postRequestParameter ($element, $subElement=null) {
 // Checks if an element in $_POST exists
 function isPostRequestParameterSet ($element, $subElement=null) {
        if (is_null($subElement)) {
-               return ((isset($GLOBALS['raw_request']['post'][$element])) && (isset($GLOBALS['raw_request']['post'][$element])));
+               return ((isset($GLOBALS['raw_request']['post'][$element])) && (('' . $GLOBALS['raw_request']['post'][$element] . '') != ''));
        } else {
-               return ((isset($GLOBALS['raw_request']['post'][$element][$subElement])) && (isset($GLOBALS['raw_request']['post'][$element][$subElement])));
+               return ((isset($GLOBALS['raw_request']['post'][$element][$subElement])) && (('' . $GLOBALS['raw_request']['post'][$element][$subElement] . '') != ''));
        }
 }
 
@@ -219,13 +218,18 @@ function setPostRequestParameter ($element, $value) {
        }
 
        // Update cache
-       $GLOBALS['cache_request']['request_post'][$element][null] = $value;
+       $GLOBALS['cache_request']['post'][$element][null] = $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 isPostRequestParameterSet('ok');
+       return isPostRequestParameterSet($requestParameter);
+}
+
+// Checks if 'content_type' is set
+function isContentTypeSet () {
+       return isset($GLOBALS['content_type']);
 }
 
 // Setter for content type