From c226e4acff8b0f06520ee61803bc9b8972a15cbd Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Mon, 24 Mar 2008 15:54:31 +0000 Subject: Execute converted main script in global context to support global variables --- it_auto_prepend.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'it_auto_prepend.php') 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) -- cgit v1.2.3