OSDN Git Service

added white-space:nowrap to th/td tag
[nucleus-jp/nucleus-jp-ancient.git] / euc / nucleus / libs / vars4.0.6.php
1 <?php\r
2 \r
3 /**\r
4   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
5   * Copyright (C) 2002-2005 The Nucleus Group\r
6   *\r
7   * This program is free software; you can redistribute it and/or\r
8   * modify it under the terms of the GNU General Public License\r
9   * as published by the Free Software Foundation; either version 2\r
10   * of the License, or (at your option) any later version.\r
11   * (see nucleus/documentation/index.html#license for more info)\r
12   *\r
13   * $Id: vars4.0.6.php,v 1.4 2005-03-16 08:10:35 kimitake Exp $\r
14   * $NucleusJP: vars4.0.6.php,v 1.5 2005/03/12 06:19:05 kimitake Exp $\r
15   */\r
16   \r
17 /**\r
18   * The purpose of the functions below is to avoid declaring HTTP_ vars to be global\r
19   * everywhere, plus to offer support for php versions before 4.1.0, that do not\r
20   * have the _GET etc vars\r
21   */\r
22 function getVar($name) {\r
23         global $HTTP_GET_VARS;\r
24         return undoMagic($HTTP_GET_VARS[$name]);\r
25 }\r
26 \r
27 function postVar($name) {\r
28         global $HTTP_POST_VARS;\r
29         return undoMagic($HTTP_POST_VARS[$name]);\r
30 }\r
31 \r
32 function cookieVar($name) {     \r
33         global $HTTP_COOKIE_VARS;\r
34         return undoMagic($HTTP_COOKIE_VARS[$name]);\r
35 }\r
36 \r
37 // request: either POST or GET\r
38 function requestVar($name) {\r
39         return (postVar($name)) ? postVar($name) : getVar($name);\r
40 }\r
41 \r
42 function serverVar($name) {\r
43         global $HTTP_SERVER_VARS;\r
44         return $HTTP_SERVER_VARS[$name];\r
45 }\r
46 \r
47 // removes magic quotes if that option is enabled\r
48 function undoMagic($data) {\r
49         return get_magic_quotes_gpc() ? stripslashes_array($data) : $data;\r
50 }\r
51 \r
52 function stripslashes_array($data) {\r
53         return is_array($data) ? array_map('stripslashes', $data) : stripslashes($data);\r
54 }\r
55 \r
56 // integer array from request\r
57 function requestIntArray($name) {\r
58         global $HTTP_POST_VARS;\r
59         return $HTTP_POST_VARS[$name];  \r
60 }\r
61 \r
62 // array from request. Be sure to call undoMagic on the strings inside\r
63 function requestArray($name) {\r
64         global $HTTP_POST_VARS;\r
65         return $HTTP_POST_VARS[$name];  \r
66 }\r
67 \r
68 \r
69 // add all the variables from the request as hidden input field\r
70 // @see globalfunctions.php#passVar\r
71 function passRequestVars() {\r
72         global $HTTP_POST_VARS, $HTTP_GET_VARS;\r
73         foreach ($HTTP_POST_VARS as $key => $value) {\r
74                 if (($key == 'action') && ($value != requestVar('nextaction')))\r
75                         $key = 'nextaction';\r
76                 // a nextaction of 'showlogin' makes no sense\r
77                 if (($key == 'nextaction') && ($value == 'showlogin'))\r
78                         continue;\r
79                 if (($key != 'login') && ($key != 'password'))\r
80                         passVar($key, $value);\r
81         }\r
82         foreach ($HTTP_GET_VARS as $key => $value) {\r
83                 if (($key == 'action') && ($value != requestVar('nextaction')))\r
84                         $key = 'nextaction';\r
85                 // a nextaction of 'showlogin' makes no sense\r
86                 if (($key == 'nextaction') && ($value == 'showlogin'))\r
87                         continue;\r
88                 if (($key != 'login') && ($key != 'password'))\r
89                         passVar($key, $value);\r
90         }\r
91 }\r
92 \r
93 function postFileInfo($name) {\r
94         global $HTTP_POST_FILES;\r
95         return $HTTP_POST_FILES[$name];\r
96 }\r
97 \r
98 function setOldAction($value) {\r
99         global $HTTP_POST_VARS;\r
100         $HTTP_POST_VARS['oldaction'] = $value;  \r
101 }\r
102 \r
103 ?>\r