Skip to content

Commit

Permalink
Solving double addslashes to DB when the site is running with
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
stronk7 committed Jan 27, 2006
1 parent 65f0d15 commit 67f74d8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
13 changes: 8 additions & 5 deletions mod/wiki/ewiki/fragments/strip_wonderful_slashes.php
Expand Up @@ -20,9 +20,13 @@
#-- this is very evil too
set_magic_quotes_runtime(0);


#-- strip \'s only if the variables garbaging is really enabled
if (get_magic_quotes_gpc()) {
#-- Moodle always addslashes to everything so
#-- we strip them back again here to allow
#-- 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(
"_REQUEST",
Expand All @@ -43,7 +47,6 @@
}
}

}


?>
?>
10 changes: 6 additions & 4 deletions mod/wiki/view.php
Expand Up @@ -112,10 +112,12 @@

define("EWIKI_INIT_PAGES", wiki_content_dir($wiki));

/// # fix broken PHP setup
if (!function_exists("get_magic_quotes_gpc") || get_magic_quotes_gpc()) {
include($CFG->dirroot."/mod/wiki/ewiki/fragments/strip_wonderful_slashes.php");
}
/// # Moodle always addslashes to everything so we are going to strip them always
/// # 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");

if (ini_get("register_globals")) {
# include($CFG->dirroot."/mod/wiki/ewiki/fragments/strike_register_globals.php");
}
Expand Down

0 comments on commit 67f74d8

Please sign in to comment.