diff options
author | Christian Schneider | 2008-03-24 15:54:31 +0000 |
---|---|---|
committer | Christian Schneider | 2008-03-24 15:54:31 +0000 |
commit | c226e4acff8b0f06520ee61803bc9b8972a15cbd (patch) | |
tree | 4fb358516e5b77fab24bac764e0417a9a9e04b76 /it_auto_prepend.php | |
parent | 1ffc1f70175a88f176898fd476447e7a15c1aabc (diff) | |
download | itools-c226e4acff8b0f06520ee61803bc9b8972a15cbd.tar.gz itools-c226e4acff8b0f06520ee61803bc9b8972a15cbd.tar.bz2 itools-c226e4acff8b0f06520ee61803bc9b8972a15cbd.zip |
Execute converted main script in global context to support global variables
Diffstat (limited to 'it_auto_prepend.php')
-rw-r--r-- | it_auto_prepend.php | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/it_auto_prepend.php b/it_auto_prepend.php index ace84b1..45ad41d 100644 --- a/it_auto_prepend.php +++ b/it_auto_prepend.php @@ -22,10 +22,15 @@ unset($GLOBALS['IT_SYNTAXCONVERTER_DIR']); # Security measure for register_globals on #$debug_itclassloader = true; -it_initialize(); +if ($it_convertedmainfile = it_initialize()) +{ + require($it_convertedmainfile); + exit; +} function it_initialize() { + $result = false; static $it_initrecursion; if (!$it_initrecursion++) @@ -106,18 +111,17 @@ function it_initialize() if ($needsconvert) { - # Convert syntax and start - $converted = it_convert(it_untaint($_SERVER['SCRIPT_FILENAME'], TC_SELF)); + # Convert syntax (we will return name of converted script to global context to start it there) + $result = it_convert(it_untaint($_SERVER['SCRIPT_FILENAME'], TC_SELF)); /* XXX Disabled as DB not always there if (!$autoloader) # PHP 4 fallback it_dbi::createclasses(); */ - - require($converted); - exit; } } + + return $result; } function it_convert($source) |