diff options
| author | Christian Schneider | 2007-11-12 18:29:14 +0000 | 
|---|---|---|
| committer | Christian Schneider | 2007-11-12 18:29:14 +0000 | 
| commit | 9c63901111b4a718406f9544bc060958fedf90e6 (patch) | |
| tree | aa320794427d956199d6ec6bd350031ef720d058 /it_auto_prepend.php | |
| parent | f354e7b59b0d20ccb1d1a5b16beebc5715808ba7 (diff) | |
| download | itools-9c63901111b4a718406f9544bc060958fedf90e6.tar.gz itools-9c63901111b4a718406f9544bc060958fedf90e6.tar.bz2 itools-9c63901111b4a718406f9544bc060958fedf90e6.zip  | |
Untaint ULTRAHOME and IT_HOME (e.g. for it::log)
Diffstat (limited to 'it_auto_prepend.php')
| -rw-r--r-- | it_auto_prepend.php | 7 | 
1 files changed, 4 insertions, 3 deletions
diff --git a/it_auto_prepend.php b/it_auto_prepend.php index 263e2fc..44e6c32 100644 --- a/it_auto_prepend.php +++ b/it_auto_prepend.php @@ -41,13 +41,11 @@ function it_initialize()  		else	# Shell  			$GLOBALS['ULTRAHOME'] = dirname(dirname(preg_match('|^/|', $argv[0]) ? $argv[0] : getcwd() . '/' . $argv[0])); -		$GLOBALS['IT_HOME'] = $GLOBALS['ULTRAHOME'];	# IT_HOME is recommended variable name for applications -  		$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['IT_HOME'] . "/tmp"; +			$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>" : "")); @@ -71,6 +69,9 @@ function it_initialize()  			require("itools.lib");	# PHP 4 fallback  		} +		# IT_HOME is recommended variable name for applications +		$GLOBALS['IT_HOME'] = $GLOBALS['ULTRAHOME'] = it_untaint($GLOBALS['ULTRAHOME'], TC_ALL); +  		@set_error_handler("it_errorhandler", E_USER_ERROR | E_RECOVERABLE_ERROR | E_WARNING | E_USER_WARNING | E_NOTICE | E_USER_NOTICE);  		ini_set('include_path', $GLOBALS['IT_SYNTAXCONVERTER_DIR'] . "/it_syntaxconverter:$it_path:$include_path");  		$user_includes = explode(":", $include_path);  |