4 * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
5 * Copyright (C) 2002-2005 The Nucleus Group
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 * (see nucleus/documentation/index.html#license for more info)
13 * $Id: vars4.1.0.php,v 1.5 2006-12-18 20:31:58 kmorimatsu Exp $
14 * $NucleusJP: vars4.1.0.php,v 1.5 2005/03/12 06:19:05 kimitake Exp $
17 function getVar($name) {
18 return undoMagic($_GET[$name]);
21 function postVar($name) {
22 return undoMagic($_POST[$name]);
25 function cookieVar($name) {
26 return undoMagic($_COOKIE[$name]);
29 function requestVar($name) {
30 if(array_key_exists($name,$_REQUEST))
31 return undoMagic($_REQUEST[$name]);
32 elseif( array_key_exists($name,$_GET))
33 return undoMagic($_GET[$name]);
34 elseif( array_key_exists($name,$_POST))
35 return undoMagic($_POST[$name]);
40 function serverVar($name) {
41 return $_SERVER[$name];
44 // removes magic quotes if that option is enabled
45 function undoMagic($data) {
46 return get_magic_quotes_gpc() ? stripslashes_array($data) : $data;
49 function stripslashes_array($data) {
50 return is_array($data) ? array_map('stripslashes_array', $data) : stripslashes($data);
53 // integer array from request
54 function requestIntArray($name) {
55 return $_REQUEST[$name];
58 // array from request. Be sure to call undoMagic on the strings inside
59 function requestArray($name) {
60 return $_REQUEST[$name];
63 // add all the variables from the request as hidden input field
64 // @see globalfunctions.php#passVar
65 function passRequestVars() {
66 foreach ($_REQUEST as $key => $value) {
67 if (($key == 'action') && ($value != requestVar('nextaction')))
70 // a nextaction of 'showlogin' makes no sense
71 if (($key == 'nextaction') && ($value == 'showlogin'))
74 if (($key != 'login') && ($key != 'password'))
75 passVar($key, $value);
79 function postFileInfo($name) {
80 return $_FILES[$name];
83 function setOldAction($value) {
84 $_POST['oldaction'] = $value;