OSDN Git Service

stripslashes_array() function bug fix
authorkmorimatsu <kmorimatsu@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Mon, 18 Dec 2006 20:31:58 +0000 (20:31 +0000)
committerkmorimatsu <kmorimatsu@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Mon, 18 Dec 2006 20:31:58 +0000 (20:31 +0000)
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/nucleus-jp/trunk@173 1ca29b6e-896d-4ea0-84a5-967f57386b96

euc/nucleus/libs/vars4.0.6.php
euc/nucleus/libs/vars4.1.0.php
utf8/nucleus/libs/vars4.0.6.php
utf8/nucleus/libs/vars4.1.0.php

index 45210c7..8169e55 100755 (executable)
-<?php\r
-\r
-/**\r
-  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
-  * Copyright (C) 2002-2005 The Nucleus Group\r
-  *\r
-  * This program is free software; you can redistribute it and/or\r
-  * modify it under the terms of the GNU General Public License\r
-  * as published by the Free Software Foundation; either version 2\r
-  * of the License, or (at your option) any later version.\r
-  * (see nucleus/documentation/index.html#license for more info)\r
-  *\r
-  * $Id: vars4.0.6.php,v 1.4 2005-03-16 08:10:35 kimitake Exp $\r
-  * $NucleusJP: vars4.0.6.php,v 1.5 2005/03/12 06:19:05 kimitake Exp $\r
-  */\r
-  \r
-/**\r
-  * The purpose of the functions below is to avoid declaring HTTP_ vars to be global\r
-  * everywhere, plus to offer support for php versions before 4.1.0, that do not\r
-  * have the _GET etc vars\r
-  */\r
-function getVar($name) {\r
-       global $HTTP_GET_VARS;\r
-       return undoMagic($HTTP_GET_VARS[$name]);\r
-}\r
-\r
-function postVar($name) {\r
-       global $HTTP_POST_VARS;\r
-       return undoMagic($HTTP_POST_VARS[$name]);\r
-}\r
-\r
-function cookieVar($name) {    \r
-       global $HTTP_COOKIE_VARS;\r
-       return undoMagic($HTTP_COOKIE_VARS[$name]);\r
-}\r
-\r
-// request: either POST or GET\r
-function requestVar($name) {\r
-       return (postVar($name)) ? postVar($name) : getVar($name);\r
-}\r
-\r
-function serverVar($name) {\r
-       global $HTTP_SERVER_VARS;\r
-       return $HTTP_SERVER_VARS[$name];\r
-}\r
-\r
-// removes magic quotes if that option is enabled\r
-function undoMagic($data) {\r
-       return get_magic_quotes_gpc() ? stripslashes_array($data) : $data;\r
-}\r
-\r
-function stripslashes_array($data) {\r
-       return is_array($data) ? array_map('stripslashes', $data) : stripslashes($data);\r
-}\r
-\r
-// integer array from request\r
-function requestIntArray($name) {\r
-       global $HTTP_POST_VARS;\r
-       return $HTTP_POST_VARS[$name];  \r
-}\r
-\r
-// array from request. Be sure to call undoMagic on the strings inside\r
-function requestArray($name) {\r
-       global $HTTP_POST_VARS;\r
-       return $HTTP_POST_VARS[$name];  \r
-}\r
-\r
-\r
-// add all the variables from the request as hidden input field\r
-// @see globalfunctions.php#passVar\r
-function passRequestVars() {\r
-       global $HTTP_POST_VARS, $HTTP_GET_VARS;\r
-       foreach ($HTTP_POST_VARS as $key => $value) {\r
-               if (($key == 'action') && ($value != requestVar('nextaction')))\r
-                       $key = 'nextaction';\r
-               // a nextaction of 'showlogin' makes no sense\r
-               if (($key == 'nextaction') && ($value == 'showlogin'))\r
-                       continue;\r
-               if (($key != 'login') && ($key != 'password'))\r
-                       passVar($key, $value);\r
-       }\r
-       foreach ($HTTP_GET_VARS as $key => $value) {\r
-               if (($key == 'action') && ($value != requestVar('nextaction')))\r
-                       $key = 'nextaction';\r
-               // a nextaction of 'showlogin' makes no sense\r
-               if (($key == 'nextaction') && ($value == 'showlogin'))\r
-                       continue;\r
-               if (($key != 'login') && ($key != 'password'))\r
-                       passVar($key, $value);\r
-       }\r
-}\r
-\r
-function postFileInfo($name) {\r
-       global $HTTP_POST_FILES;\r
-       return $HTTP_POST_FILES[$name];\r
-}\r
-\r
-function setOldAction($value) {\r
-       global $HTTP_POST_VARS;\r
-       $HTTP_POST_VARS['oldaction'] = $value;  \r
-}\r
-\r
-?>\r
+<?php
+
+/**
+  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) 
+  * Copyright (C) 2002-2005 The Nucleus Group
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  * (see nucleus/documentation/index.html#license for more info)
+  *
+  * $Id: vars4.0.6.php,v 1.5 2006-12-18 20:31:39 kmorimatsu Exp $
+  * $NucleusJP: vars4.0.6.php,v 1.5 2005/03/12 06:19:05 kimitake Exp $
+  */
+  
+/**
+  * The purpose of the functions below is to avoid declaring HTTP_ vars to be global
+  * everywhere, plus to offer support for php versions before 4.1.0, that do not
+  * have the _GET etc vars
+  */
+function getVar($name) {
+       global $HTTP_GET_VARS;
+       return undoMagic($HTTP_GET_VARS[$name]);
+}
+
+function postVar($name) {
+       global $HTTP_POST_VARS;
+       return undoMagic($HTTP_POST_VARS[$name]);
+}
+
+function cookieVar($name) {
+       global $HTTP_COOKIE_VARS;
+       return undoMagic($HTTP_COOKIE_VARS[$name]);
+}
+
+// request: either POST or GET
+function requestVar($name) {
+       return (postVar($name)) ? postVar($name) : getVar($name);
+}
+
+function serverVar($name) {
+       global $HTTP_SERVER_VARS;
+       return $HTTP_SERVER_VARS[$name];
+}
+
+// removes magic quotes if that option is enabled
+function undoMagic($data) {
+       return get_magic_quotes_gpc() ? stripslashes_array($data) : $data;
+}
+
+function stripslashes_array($data) {
+       return is_array($data) ? array_map('stripslashes_array', $data) : stripslashes($data);
+}
+
+// integer array from request
+function requestIntArray($name) {
+       global $HTTP_POST_VARS;
+       return $HTTP_POST_VARS[$name];
+}
+
+// array from request. Be sure to call undoMagic on the strings inside
+function requestArray($name) {
+       global $HTTP_POST_VARS;
+       return $HTTP_POST_VARS[$name];
+}
+
+
+// add all the variables from the request as hidden input field
+// @see globalfunctions.php#passVar
+function passRequestVars() {
+       global $HTTP_POST_VARS, $HTTP_GET_VARS;
+       foreach ($HTTP_POST_VARS as $key => $value) {
+               if (($key == 'action') && ($value != requestVar('nextaction')))
+                       $key = 'nextaction';
+               // a nextaction of 'showlogin' makes no sense
+               if (($key == 'nextaction') && ($value == 'showlogin'))
+                       continue;
+               if (($key != 'login') && ($key != 'password'))
+                       passVar($key, $value);
+       }
+       foreach ($HTTP_GET_VARS as $key => $value) {
+               if (($key == 'action') && ($value != requestVar('nextaction')))
+                       $key = 'nextaction';
+               // a nextaction of 'showlogin' makes no sense
+               if (($key == 'nextaction') && ($value == 'showlogin'))
+                       continue;
+               if (($key != 'login') && ($key != 'password'))
+                       passVar($key, $value);
+       }
+}
+
+function postFileInfo($name) {
+       global $HTTP_POST_FILES;
+       return $HTTP_POST_FILES[$name];
+}
+
+function setOldAction($value) {
+       global $HTTP_POST_VARS;
+       $HTTP_POST_VARS['oldaction'] = $value;
+}
+
+?>
index f6893fa..6ba8bcb 100755 (executable)
@@ -1,87 +1,87 @@
-<?php\r
-\r
-/**\r
-  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
-  * Copyright (C) 2002-2005 The Nucleus Group\r
-  *\r
-  * This program is free software; you can redistribute it and/or\r
-  * modify it under the terms of the GNU General Public License\r
-  * as published by the Free Software Foundation; either version 2\r
-  * of the License, or (at your option) any later version.\r
-  * (see nucleus/documentation/index.html#license for more info)\r
-  *\r
-  * $Id: vars4.1.0.php,v 1.4 2005-03-16 08:10:35 kimitake Exp $\r
-  * $NucleusJP: vars4.1.0.php,v 1.5 2005/03/12 06:19:05 kimitake Exp $\r
-  */\r
-  \r
-function getVar($name) {\r
-       return undoMagic($_GET[$name]);\r
-}\r
-\r
-function postVar($name) {\r
-       return undoMagic($_POST[$name]);\r
-}\r
-\r
-function cookieVar($name) {    \r
-       return undoMagic($_COOKIE[$name]);\r
-}\r
-\r
-function requestVar($name) {\r
-       if(array_key_exists($name,$_REQUEST))\r
-               return undoMagic($_REQUEST[$name]);\r
-       elseif( array_key_exists($name,$_GET))   \r
-               return undoMagic($_GET[$name]);\r
-       elseif( array_key_exists($name,$_POST))   \r
-               return undoMagic($_POST[$name]);\r
-       else\r
-               return;\r
-}\r
-\r
-function serverVar($name) {\r
-       return $_SERVER[$name];\r
-}\r
-\r
-// removes magic quotes if that option is enabled\r
-function undoMagic($data) {\r
-       return get_magic_quotes_gpc() ? stripslashes_array($data) : $data;\r
-}\r
-\r
-function stripslashes_array($data) {\r
-       return is_array($data) ? array_map('stripslashes', $data) : stripslashes($data);\r
-}\r
-\r
-// integer array from request\r
-function requestIntArray($name) {\r
-       return $_REQUEST[$name];        \r
-}\r
-\r
-// array from request. Be sure to call undoMagic on the strings inside\r
-function requestArray($name) {\r
-       return $_REQUEST[$name];        \r
-}\r
-\r
-// add all the variables from the request as hidden input field\r
-// @see globalfunctions.php#passVar\r
-function passRequestVars() {\r
-       foreach ($_REQUEST as $key => $value) {\r
-               if (($key == 'action') && ($value != requestVar('nextaction')))\r
-                       $key = 'nextaction';\r
-                       \r
-               // a nextaction of 'showlogin' makes no sense\r
-               if (($key == 'nextaction') && ($value == 'showlogin'))\r
-                       continue;\r
-                       \r
-               if (($key != 'login') && ($key != 'password'))\r
-                       passVar($key, $value);\r
-       }\r
-}\r
-\r
-function postFileInfo($name) {\r
-       return $_FILES[$name];\r
-}\r
-\r
-function setOldAction($value) {\r
-       $_POST['oldaction'] = $value;   \r
-}\r
-\r
-?>\r
+<?php
+
+/**
+  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) 
+  * Copyright (C) 2002-2005 The Nucleus Group
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  * (see nucleus/documentation/index.html#license for more info)
+  *
+  * $Id: vars4.1.0.php,v 1.5 2006-12-18 20:31:58 kmorimatsu Exp $
+  * $NucleusJP: vars4.1.0.php,v 1.5 2005/03/12 06:19:05 kimitake Exp $
+  */
+  
+function getVar($name) {
+       return undoMagic($_GET[$name]);
+}
+
+function postVar($name) {
+       return undoMagic($_POST[$name]);
+}
+
+function cookieVar($name) {
+       return undoMagic($_COOKIE[$name]);
+}
+
+function requestVar($name) {
+       if(array_key_exists($name,$_REQUEST))
+               return undoMagic($_REQUEST[$name]);
+       elseif( array_key_exists($name,$_GET))   
+               return undoMagic($_GET[$name]);
+       elseif( array_key_exists($name,$_POST))   
+               return undoMagic($_POST[$name]);
+       else
+               return;
+}
+
+function serverVar($name) {
+       return $_SERVER[$name];
+}
+
+// removes magic quotes if that option is enabled
+function undoMagic($data) {
+       return get_magic_quotes_gpc() ? stripslashes_array($data) : $data;
+}
+
+function stripslashes_array($data) {
+       return is_array($data) ? array_map('stripslashes_array', $data) : stripslashes($data);
+}
+
+// integer array from request
+function requestIntArray($name) {
+       return $_REQUEST[$name];
+}
+
+// array from request. Be sure to call undoMagic on the strings inside
+function requestArray($name) {
+       return $_REQUEST[$name];
+}
+
+// add all the variables from the request as hidden input field
+// @see globalfunctions.php#passVar
+function passRequestVars() {
+       foreach ($_REQUEST as $key => $value) {
+               if (($key == 'action') && ($value != requestVar('nextaction')))
+                       $key = 'nextaction';
+
+               // a nextaction of 'showlogin' makes no sense
+               if (($key == 'nextaction') && ($value == 'showlogin'))
+                       continue;
+
+               if (($key != 'login') && ($key != 'password'))
+                       passVar($key, $value);
+       }
+}
+
+function postFileInfo($name) {
+       return $_FILES[$name];
+}
+
+function setOldAction($value) {
+       $_POST['oldaction'] = $value;
+}
+
+?>
index f6250da..8a2fb69 100755 (executable)
@@ -13,8 +13,8 @@
 /**
  * @license http://nucleuscms.org/license.txt GNU General Public License
  * @copyright Copyright (C) 2002-2006 The Nucleus Group
- * @version $Id: vars4.0.6.php,v 1.8 2006-07-20 08:01:52 kimitake Exp $
- * @version $NucleusJP: vars4.0.6.php,v 1.7 2006/07/12 07:11:47 kimitake Exp $
+ * @version $Id: vars4.0.6.php,v 1.9 2006-12-18 20:30:48 kmorimatsu Exp $
+ * @version $NucleusJP: vars4.0.6.php,v 1.8 2006/07/20 08:01:52 kimitake Exp $
  */
 
 /**
@@ -78,7 +78,7 @@ function undoMagic($data) {
 }
 
 function stripslashes_array($data) {
-       return is_array($data) ? array_map('stripslashes', $data) : stripslashes($data);
+       return is_array($data) ? array_map('stripslashes_array', $data) : stripslashes($data);
 }
 
 function undoSybaseQuotes_array($data) {
index 7b0aa8d..8a01799 100755 (executable)
@@ -13,8 +13,8 @@
 /**
  * @license http://nucleuscms.org/license.txt GNU General Public License
  * @copyright Copyright (C) 2002-2006 The Nucleus Group
- * @version $Id: vars4.1.0.php,v 1.8 2006-07-20 08:01:52 kimitake Exp $
- * @version $NucleusJP: vars4.1.0.php,v 1.7 2006/07/12 07:11:47 kimitake Exp $
+ * @version $Id: vars4.1.0.php,v 1.9 2006-12-18 20:31:08 kmorimatsu Exp $
+ * @version $NucleusJP: vars4.1.0.php,v 1.8 2006/07/20 08:01:52 kimitake Exp $
  */
 
 function getVar($name) {
@@ -71,7 +71,7 @@ function undoMagic($data) {
 }
 
 function stripslashes_array($data) {
-       return is_array($data) ? array_map('stripslashes', $data) : stripslashes($data);
+       return is_array($data) ? array_map('stripslashes_array', $data) : stripslashes($data);
 }
 
 function undoSybaseQuotes_array($data) {
@@ -128,5 +128,4 @@ function setOldAction($value) {
        $_POST['oldaction'] = $value;
 }
 
-
 ?>