OSDN Git Service

changed to binary
[nucleus-jp/nucleus-jp-ancient.git] / euc / nucleus / libs / vars4.1.0.php
1 <?php
2
3 /**
4   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) 
5   * Copyright (C) 2002-2005 The Nucleus Group
6   *
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)
12   *
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 $
15   */
16   
17 function getVar($name) {
18         return undoMagic($_GET[$name]);
19 }
20
21 function postVar($name) {
22         return undoMagic($_POST[$name]);
23 }
24
25 function cookieVar($name) {
26         return undoMagic($_COOKIE[$name]);
27 }
28
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]);
36         else
37                 return;
38 }
39
40 function serverVar($name) {
41         return $_SERVER[$name];
42 }
43
44 // removes magic quotes if that option is enabled
45 function undoMagic($data) {
46         return get_magic_quotes_gpc() ? stripslashes_array($data) : $data;
47 }
48
49 function stripslashes_array($data) {
50         return is_array($data) ? array_map('stripslashes_array', $data) : stripslashes($data);
51 }
52
53 // integer array from request
54 function requestIntArray($name) {
55         return $_REQUEST[$name];
56 }
57
58 // array from request. Be sure to call undoMagic on the strings inside
59 function requestArray($name) {
60         return $_REQUEST[$name];
61 }
62
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')))
68                         $key = 'nextaction';
69
70                 // a nextaction of 'showlogin' makes no sense
71                 if (($key == 'nextaction') && ($value == 'showlogin'))
72                         continue;
73
74                 if (($key != 'login') && ($key != 'password'))
75                         passVar($key, $value);
76         }
77 }
78
79 function postFileInfo($name) {
80         return $_FILES[$name];
81 }
82
83 function setOldAction($value) {
84         $_POST['oldaction'] = $value;
85 }
86
87 ?>