diff options
| author | Christian Schneider | 2007-11-12 15:48:44 +0000 | 
|---|---|---|
| committer | Christian Schneider | 2007-11-12 15:48:44 +0000 | 
| commit | ec3173ad91a45c8c6a21a64fba33fce77ea192ab (patch) | |
| tree | b427f4ed64fcd012aaa66e87ab5d301f4b246574 /it_auto_prepend.php | |
| parent | 1f760f7da5c5160fc2087ba2e40c2fef9abb38ef (diff) | |
| download | itools-ec3173ad91a45c8c6a21a64fba33fce77ea192ab.tar.gz itools-ec3173ad91a45c8c6a21a64fba33fce77ea192ab.tar.bz2 itools-ec3173ad91a45c8c6a21a64fba33fce77ea192ab.zip  | |
Enhance syntax conversion system
Diffstat (limited to 'it_auto_prepend.php')
| -rw-r--r-- | it_auto_prepend.php | 12 | 
1 files changed, 7 insertions, 5 deletions
diff --git a/it_auto_prepend.php b/it_auto_prepend.php index 4d7dcb9..263e2fc 100644 --- a/it_auto_prepend.php +++ b/it_auto_prepend.php @@ -32,7 +32,7 @@ function it_initialize()  	{  		$it_path = dirname(__FILE__); -		if ($_SERVER['REMOTE_ADDR'])	# Web? +		if ($webmode = $_SERVER['REMOTE_ADDR'])	# Web?  		{  			$GLOBALS['ULTRAHOME'] = dirname($_SERVER['DOCUMENT_ROOT']);  			umask(0002); # Work around bugs.php.net/bug.php?id=28401 @@ -43,15 +43,17 @@ function it_initialize()  		$GLOBALS['IT_HOME'] = $GLOBALS['ULTRAHOME'];	# IT_HOME is recommended variable name for applications -		if (!$GLOBALS['IT_SYNTAXCONVERTER_DIR']) +		$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";  			if (!is_writeable($GLOBALS['IT_SYNTAXCONVERTER_DIR']) || getmyuid() != fileowner($GLOBALS['IT_SYNTAXCONVERTER_DIR'])) -				die("Running in shared environment, set \$GLOBALS['IT_SYNTAXCONVERTER_DIR'] manually in\n$it_path/auto_prepend_local.php to either\n  FALSE (syntax conversion disabled) or\n  a path to a writeable directory (NOTE: /tmp IS UNSAFE!)\n"); +				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>" : ""));  		} - -		$needsconvert = ($GLOBALS['IT_SYNTAXCONVERTER_DIR'] !== false) && !@eval("return is_array(42=>69,);");	# Check if PHP is patched to support our syntax, see http://cschneid.com/php/ +		else +			$needsconvert = false;  		$include_path = ini_get('include_path');  |