2 /************************************************************************
3 * MXChange v0.2.1 Start: 02/28/2009 *
4 * =============== Last change: 02/28/2009 *
6 * -------------------------------------------------------------------- *
7 * File : request-functions.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Special functions for request handling *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Spezialle Funktionen fuer die Anfragebehandlung *
12 * -------------------------------------------------------------------- *
14 * -------------------------------------------------------------------- *
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
16 * For more information visit: http://www.mxchange.org *
18 * This program is free software; you can redistribute it and/or modify *
19 * it under the terms of the GNU General Public License as published by *
20 * the Free Software Foundation; either version 2 of the License, or *
21 * (at your option) any later version. *
23 * This program is distributed in the hope that it will be useful, *
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
26 * GNU General Public License for more details. *
28 * You should have received a copy of the GNU General Public License *
29 * along with this program; if not, write to the Free Software *
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
32 ************************************************************************/
34 // Some security stuff...
35 if (!defined('__SECURITY')) {
36 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
40 // Wrapper for elements in $_GET
41 function REQUEST_GET ($element) {
42 // By default no element is there
45 // Is the element cached or there?
46 if (isset($GLOBALS['cache_array']['request_get'][$element])) {
48 $value = $GLOBALS['cache_array']['request_get'][$element];
49 } elseif (REQUEST_ISSET_GET($element)) {
50 // Then get it directly
51 $value = SQL_ESCAPE($_GET[$element]);
54 $GLOBALS['cache_array']['request_get'][$element] = $value;
61 // Checks if an element in $_GET exists
62 function REQUEST_ISSET_GET ($element, $extra="") {
64 return (isset($_GET[$element]));
66 return (isset($_GET[$element][$extra]));
70 // Removes an element from $_GET
71 function REQUEST_UNSET_GET ($element) {
72 unset($_GET[$element]);
75 // Getter for whole $_GET array
76 function REQUEST_GET_ARRAY () {
80 // Counts entries in $_GET or returns false if not an array
81 function REQUEST_GET_COUNT () {
82 // By default this is not an array
86 $GET = REQUEST_GET_ARRAY();
97 // Wrapper for elements in $_POST
98 function REQUEST_POST ($element) {
99 // By default no element is there
102 // Is the element there?
103 if (REQUEST_ISSET_POST($element)) {
105 $value = $_POST[$element];
112 // Checks if an element in $_POST exists
113 function REQUEST_ISSET_POST ($element, $extra="") {
115 return (isset($_POST[$element]));
117 return (isset($_POST[$element][$extra]));
121 // Removes an element from $_POST
122 function REQUEST_UNSET_POST ($element) {
123 unset($_POST[$element]);
126 // Getter for whole $_POST array
127 function REQUEST_POST_ARRAY () {
131 // Counts entries in $_POST or returns false if not an array
132 function REQUEST_POST_COUNT () {
133 // By default this is not an array
137 $POST = REQUEST_POST_ARRAY();
140 if (is_array($POST)) {
142 $count = count($POST);
148 // Checks wether a form was sent. If so, the $_POST['ok'] element must be set
149 function IS_FORM_SENT () {
151 return REQUEST_ISSET_POST('ok');