Solving double addslashes to DB when the site is running with

magic_quotes_gpc() disabled (because Moodle addslashes to
everything). Not a pretty hack, but it seems to work.
(http://moodle.org/mod/forum/discuss.php?d=38127)

Merged from MOODLE_15_STABLE
This commit is contained in:
stronk7 2006-01-27 23:01:34 +00:00
parent 00a354a2da
commit 13ca56cf52
2 changed files with 14 additions and 9 deletions

View file

@ -20,9 +20,13 @@
#-- this is very evil too #-- this is very evil too
set_magic_quotes_runtime(0); set_magic_quotes_runtime(0);
#-- Moodle always addslashes to everything so
#-- strip \'s only if the variables garbaging is really enabled #-- we strip them back again here to allow
if (get_magic_quotes_gpc()) { #-- the wiki module itself to add them before
#-- insert. Strange triple add-strip-add but
#-- this was the best way to solve problems
#-- without changing how the rest of the
#-- module works.
$superglobals = array( $superglobals = array(
"_REQUEST", "_REQUEST",
@ -43,7 +47,6 @@
} }
} }
}
?> ?>

View file

@ -111,10 +111,12 @@
define("EWIKI_INIT_PAGES", wiki_content_dir($wiki)); define("EWIKI_INIT_PAGES", wiki_content_dir($wiki));
/// # fix broken PHP setup /// # Moodle always addslashes to everything so we are going to strip them always
if (!function_exists("get_magic_quotes_gpc") || get_magic_quotes_gpc()) { /// # to allow wiki itself to add them again. It's a triple add-strip-add but
/// # was the only way to solve the problem without modifying how the rest of
/// # the module works.
include($CFG->dirroot."/mod/wiki/ewiki/fragments/strip_wonderful_slashes.php"); include($CFG->dirroot."/mod/wiki/ewiki/fragments/strip_wonderful_slashes.php");
}
if (ini_get("register_globals")) { if (ini_get("register_globals")) {
# include($CFG->dirroot."/mod/wiki/ewiki/fragments/strike_register_globals.php"); # include($CFG->dirroot."/mod/wiki/ewiki/fragments/strike_register_globals.php");
} }