From 18ae9081ff04de3d751fbc4688bdec656c3ea143 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Tue, 13 Nov 2007 14:01:30 +0000 Subject: Fix: Moved check for it_syntaxconvert directory after auto_prepend_local.php --- it_auto_prepend.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'it_auto_prepend.php') diff --git a/it_auto_prepend.php b/it_auto_prepend.php index 44e6c32..58f522b 100644 --- a/it_auto_prepend.php +++ b/it_auto_prepend.php @@ -41,18 +41,6 @@ function it_initialize() else # Shell $GLOBALS['ULTRAHOME'] = dirname(dirname(preg_match('|^/|', $argv[0]) ? $argv[0] : getcwd() . '/' . $argv[0])); - $needsconvert = !@eval("return is_array(42=>69,);"); # Check if PHP is patched to support our syntax, see http://cschneid.com/php/ - - if ($needsconvert && !$GLOBALS['IT_SYNTAXCONVERTER_DIR']) - { - $GLOBALS['IT_SYNTAXCONVERTER_DIR'] = $GLOBALS['ULTRAHOME'] . "/tmp"; - - if (!is_writeable($GLOBALS['IT_SYNTAXCONVERTER_DIR']) || getmyuid() != fileowner($GLOBALS['IT_SYNTAXCONVERTER_DIR'])) - die(($webmode ? "
" : "") . "Seems to be running in shared environment, manually set\n\$GLOBALS['IT_SYNTAXCONVERTER_DIR'] in $it_path/auto_prepend_local.php\nto either:\n a) FALSE (syntax conversion disabled) or\n b) the path to a writeable directory (NOTE: THIS IS UNSAFE!) or\n c) install the PHP patch from http://cschneid.com/php/\n" . ($webmode ? "" : "")); - } - else - $needsconvert = false; - $include_path = ini_get('include_path'); if ($autoloader = function_exists('spl_autoload_register') && spl_autoload_register('it_classloader')) @@ -69,6 +57,16 @@ function it_initialize() require("itools.lib"); # PHP 4 fallback } + $needsconvert = !@eval("return is_array(42=>69,);"); # Check if PHP is patched to support our syntax, see http://cschneid.com/php/ + + if ($needsconvert && !$GLOBALS['IT_SYNTAXCONVERTER_DIR']) + { + $GLOBALS['IT_SYNTAXCONVERTER_DIR'] = $GLOBALS['ULTRAHOME'] . "/tmp"; + + if (!is_writeable($GLOBALS['IT_SYNTAXCONVERTER_DIR']) || getmyuid() != fileowner($GLOBALS['IT_SYNTAXCONVERTER_DIR'])) + die(($webmode ? "
" : "") . "Seems to be running in shared environment, manually set\n\$GLOBALS['IT_SYNTAXCONVERTER_DIR'] in $it_path/auto_prepend_local.php\nto either:\n a) FALSE (syntax conversion disabled) or\n b) the path to a writeable directory (NOTE: THIS IS UNSAFE!) or\n c) install the PHP patch from http://cschneid.com/php/\n" . ($webmode ? "" : "")); + } + # IT_HOME is recommended variable name for applications $GLOBALS['IT_HOME'] = $GLOBALS['ULTRAHOME'] = it_untaint($GLOBALS['ULTRAHOME'], TC_ALL); -- cgit v1.2.3