diff options
author | Thomas BrĂ¼derli | 2010-04-21 12:27:27 +0000 |
---|---|---|
committer | Thomas BrĂ¼derli | 2010-04-21 12:27:27 +0000 |
commit | b55619a76c3a93e8ce7714e948afb8df74512dda (patch) | |
tree | 897d2cef117d21540df56a99f57ffd7c805176b4 | |
parent | cf4e235bd13cff414a8e5146c179d3b4155e1d9c (diff) | |
download | itools-b55619a76c3a93e8ce7714e948afb8df74512dda.tar.gz itools-b55619a76c3a93e8ce7714e948afb8df74512dda.tar.bz2 itools-b55619a76c3a93e8ce7714e948afb8df74512dda.zip |
Fix disabling of the syntax converter; allow to specify the db connection charset in it_dbi
-rw-r--r-- | it_auto_prepend.php | 4 | ||||
-rw-r--r-- | it_dbi.class | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/it_auto_prepend.php b/it_auto_prepend.php index d946e78..556f167 100644 --- a/it_auto_prepend.php +++ b/it_auto_prepend.php @@ -72,7 +72,7 @@ function it_initialize() # IT_HOME is recommended variable name for applications $GLOBALS['IT_HOME'] = $GLOBALS['ULTRAHOME'] = it_untaint($GLOBALS['ULTRAHOME'], TC_ALL); - $needsconvert = !@eval("return is_array(42=>69,);"); # Check if PHP is patched to support our syntax, see http://cschneid.com/php/ + $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/ if ($needsconvert && !$GLOBALS['IT_SYNTAXCONVERTER_DIR']) { @@ -82,7 +82,7 @@ function it_initialize() 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>" : "")); } - ini_set('include_path', $GLOBALS['IT_SYNTAXCONVERTER_DIR'] . "/it_syntaxconverter" . PATH_SEPARATOR . $it_path . PATH_SEPARATOR . $include_path); + ini_set('include_path', ($GLOBALS['IT_SYNTAXCONVERTER_DIR'] ? $GLOBALS['IT_SYNTAXCONVERTER_DIR'] . "/it_syntaxconverter" . PATH_SEPARATOR : '') . $it_path . PATH_SEPARATOR . $include_path); $user_includes = explode(PATH_SEPARATOR, $include_path); # XXX Note: Comment this out if you want system wide include path converted and auto_prepend.php considered diff --git a/it_dbi.class b/it_dbi.class index 9daf2c3..9ccfd48 100644 --- a/it_dbi.class +++ b/it_dbi.class @@ -33,6 +33,7 @@ class it_dbi 'pw' => "", 'safety' => 1, # 0= never die, 1=die if query invalid, 2=die also if no results #'keyfield' => 'ID', # Don't set to null here, filled later by _get_field_info() + 'charset' => null, # client charset (requires MySQL 5.0.7 or later) 'classprefix' => "", 'getfieldinfo' => true, # do not read schema. only select() allowed ); @@ -219,6 +220,10 @@ function _connect($p = array()) if (!(@mysql_select_db($p['db'], $this->_link))) $this->_fatal("_connect(): can't select database \"{$p['db']}\""); + + # set charset used for this connection + if ($p['charset']) + mysql_set_charset($p['charset'], $this->_link); $state['link'] = $this->_link; it_dbi::_state_put($dbid, $state, false); # Store only locally as link is not shared anyway |