From aa6af0f8335cbd0fbc718609651544031452a4f2 Mon Sep 17 00:00:00 2001 From: moodler Date: Mon, 28 Jul 2003 16:37:12 +0000 Subject: [PATCH] A hack to get around magic_quotes_gpc being turned off --- lib/setup.php | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/lib/setup.php b/lib/setup.php index 128c591a37..370a47e237 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -117,30 +117,17 @@ $CFG->footer = "$CFG->dirroot/theme/$CFG->theme/footer.html"; +/// A hack to get around magic_quotes_gpc being turned off + + if (!ini_get_bool("magic_quotes_gpc") ) { // Hopefully it's on, though. + foreach ($_GET as $key => $var) { + $_GET[$key] = addslashes($var); + } + foreach ($_POST as $key => $var) { + $_POST[$key] = addslashes($var); + } + } -/// Reference code to remove magic quotes from everything ... just in case. -/// If you have problems with slashes everywhere then you might want to -/// uncomment this code. It will not be necessary on 99.9% of PHP servers. -/// Got this from http://www.php.net/manual/en/configuration.php -// if (ini_get_bool("magic_quotes_gpc") ) { -// foreach ($GLOBALS["HTTP_".$GLOBALS["REQUEST_METHOD"]."_VARS"] as $key => $value) { -// if (!is_array($value)) { // Simple value -// $newval = stripslashes($value); -// $GLOBALS["HTTP_".$GLOBALS["REQUEST_METHOD"]."_VARS"][$key] = $newval; -// if (ini_get_bool("register_globals")) { -// $GLOBALS[$key] = $newval; -// } -// } else { // Array -// foreach ($value as $k => $v) { -// $newval = stripslashes($v); -// $GLOBALS["HTTP_".$GLOBALS["REQUEST_METHOD"]."_VARS"][$key][$k] = $newval; -// if (ini_get_bool("register_globals")) { -// $GLOBALS[$key][$k] = $newval; -// } -// } -// } -// } -// } /// The following is a hack to get around the problem of PHP installations /// that have "register_globals" turned off (default since PHP 4.1.0). -- 2.39.5