[TEP-COMMIT] [CVS catalog] shift the direction of focus by stripping slashes from GET, POST, and COOKIE variables instead of adding slashes
anonymous-OfajU3CKLf1/[email protected] 22 Jul 2004 16:36:23 -0000
| Newsgroups | gmane.comp.web.oscommerce.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit in catalog/catalog/includes/functions on MAIN
compatibility.php +20 -9 1.21 -> 1.22
shift the direction of focus by stripping slashes from GET, POST, and COOKIE variables instead of adding slashes
magic_quotes_gpc is enabled by default in php.ini (for some reason); it can be disabled via .htaccess to help performance
new osc_draw_* form field functions take this setting into consideration
----------
catalog /catalog /includes /functions
compatibility.php 1.21 -> 1.22
diff -u -r1.21 -r1.22
--- compatibility.php 2004/04/13 08:10:15 1.21
+++ compatibility.php 2004/07/22 16:36:22 1.22
@@ -5,7 +5,7 @@
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
- Copyright (c) 2003 osCommerce
+ Copyright (c) 2004 osCommerce
Released under the GNU General Public License
*/
@@ -20,22 +20,33 @@
}
// Recursively handle magic_quotes_gpc turned off.
- function do_magic_quotes_gpc(&$ar) {
- if (!is_array($ar)) return false;
+ function osc_remove_magic_quotes(&$array) {
+ if (!is_array($array) || (sizeof($array) < 1)) {
+ return false;
+ }
- while (list($key, $value) = each($ar)) {
+ foreach ($array as $key => $value) {
if (is_array($value)) {
- do_magic_quotes_gpc($value);
+ osc_remove_magic_quotes($array[$key]);
} else {
- $ar[$key] = addslashes($value);
+ $array[$key] = stripslashes($value);
}
}
}
// handle magic_quotes_gpc turned off.
- if (!get_magic_quotes_gpc()) {
- do_magic_quotes_gpc($_GET);
- do_magic_quotes_gpc($_POST);
+ if (get_magic_quotes_gpc() > 0) {
+ if (isset($_GET)) {
+ osc_remove_magic_quotes($_GET);
+ }
+
+ if (isset($_POST)) {
+ osc_remove_magic_quotes($_POST);
+ }
+
+ if (isset($_COOKIE)) {
+ osc_remove_magic_quotes($_COOKIE);
+ }
}
if (!function_exists('constant')) {
CVSspam 0.2.8
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click