ca858c44ea7acb613ee39ec85af32e234acc0936
[atutor.git] / mods / wiki / fragments / strip_wonderful_slashes.php
1 <?php
2
3 /*
4
5   this strips all "\" from $_REQUEST and
6   disables the runtime garbaging as well
7
8   just include() it before ewiki.php
9   and everythink should work fine
10
11
12   for Apache+mod_php you should however rather use the
13   [.htaccess] PHP reconfiguration trick:
14     php_flag magic_quotes_gpc off
15     php_flag magic_quotes_runtime off
16
17 */
18
19
20  #-- this is very evil too
21  set_magic_quotes_runtime(0);
22
23
24  #-- strip \'s only if the variables garbaging is really enabled
25  if (get_magic_quotes_gpc()) {
26
27     $superglobals = array(
28        "_REQUEST",
29        "_GET",
30        "_POST",
31        "_COOKIE",
32        "_ENV",
33        "_SERVER"
34     );
35
36     foreach ($superglobals as $AREA) {
37
38        foreach ($GLOBALS[$AREA] as $name => $value) {
39
40           if (!is_array($value)) {
41              $GLOBALS[$AREA][$name] = stripslashes($value);
42           }
43        }
44     }
45
46  }
47
48
49 ?>