diff options
| -rw-r--r-- | it_auto_prepend.php | 22 | 
1 files changed, 10 insertions, 12 deletions
| 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 ? "<pre>" : "") . "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 ? "</pre>" : "")); -		} -		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 ? "<pre>" : "") . "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 ? "</pre>" : "")); +		} +  		# IT_HOME is recommended variable name for applications  		$GLOBALS['IT_HOME'] = $GLOBALS['ULTRAHOME'] = it_untaint($GLOBALS['ULTRAHOME'], TC_ALL); |