changed git call from https to git readonly
[atutor.git] / mods / wiki / fragments / patches / old_php_compat.pl
1 #!/usr/bin/perl
2 #
3 # PHP versions before 4.1 dont know the superglobals for incoming variables
4 # as introduced by later versions. PHP5 then incompatibilized further with
5 # making the older equivalents less accessible.
6
7 # Therefore you have to run a rewrite script over ewiki and its plugins to
8 # make them compatible, if your provider only has an outdated version on
9 # the webserver.
10 #
11 # - exec this from the ewiki/ base directory
12 #
13 # - then place following into your config.php script:
14 #
15 #      $HTTP_POST_VARS = array_merge($HTTP_POST_VARS, $HTTP_GET_VARS);
16 #
17 # - a few plugins still won't work correctly under PHP 4.0
18 #
19 # - load the "plugins/lib/upgrade.php" script for enhancing compatibility
20 #
21
22
23 foreach $file (split /\s+/,`find .|grep php`) {
24
25   if ($file =~ /old_php_compat/) {
26      next;
27   }
28   print "$file\n";
29
30   open F, "$file";
31   $text = "";
32   while (<F>) {
33      $text .= $_;
34   }
35   close F;
36
37   $text =~ s/\$_GET/\$HTTP_GET_VARS/;
38   $text =~ s/\$_POST/\$HTTP_POST_VARS/;
39   $text =~ s/\$_REQUEST/\$HTTP_POST_VARS/;
40   $text =~ s/\$_SERVER/\$HTTP_SERVER_VARS/;
41   $text =~ s/\$_FILES/\$HTTP_POST_FILES/;
42   $text =~ s/\$_COOKIE/\$HTTP_COOKIE_VARS/;
43   $text =~ s/\$_ENV/\$HTTP_ENV_VARS/;
44
45   open F, ">$file";
46   print F $text;
47   close F;
48 }
49