From 66a207d4552788a7358ff5d5d69eebd224efbef3 Mon Sep 17 00:00:00 2001 From: Lars Kneschke Date: Tue, 27 Feb 2007 20:04:26 +0000 Subject: [PATCH] make sure the mbstring supports get always enabled. It's needed for the imap conversion(utf-7 => systemcharset). --- phpgwapi/inc/class.translation.inc.php | 38 ++++++++++---------------- 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/phpgwapi/inc/class.translation.inc.php b/phpgwapi/inc/class.translation.inc.php index 9b5e745b15..3e74ec4431 100644 --- a/phpgwapi/inc/class.translation.inc.php +++ b/phpgwapi/inc/class.translation.inc.php @@ -56,41 +56,31 @@ */ function translation($warnings = False) { - for ($i = 1; $i <= 9; $i++) - { + for ($i = 1; $i <= 9; $i++) { $this->placeholders[] = '%'.$i; } $this->db = is_object($GLOBALS['egw']->db) ? $GLOBALS['egw']->db : $GLOBALS['egw_setup']->db; if (is_object($this->db)) $this->db->set_app('phpgwapi'); - if (!isset($GLOBALS['egw_setup'])) - { + if (!isset($GLOBALS['egw_setup'])) { $this->system_charset = @$GLOBALS['egw_info']['server']['system_charset']; - } - else - { + } else { $this->system_charset =& $GLOBALS['egw_setup']->system_charset; } - // load multi-byte-string-extension if needed, and set its internal encodeing to your system_charset - if ($this->system_charset && substr($this->system_charset,0,9) != 'iso-8859-1') - { - if ($this->mbstring = extension_loaded('mbstring') || @dl(PHP_SHLIB_PREFIX.'mbstring.'.PHP_SHLIB_SUFFIX)) - { + + if (extension_loaded('mbstring') || @dl(PHP_SHLIB_PREFIX.'mbstring.'.PHP_SHLIB_SUFFIX)) { + $this->mbstring = true; + if(!empty($this->system_charset)) { ini_set('mbstring.internal_encoding',$this->system_charset); - if (ini_get('mbstring.func_overload') < 7) - { - if ($warnings) - { - echo "

Warning: Please set mbstring.func_overload = 7 in your php.ini for useing $this->system_charset as your charset !!!

\n"; - } + } + if (ini_get('mbstring.func_overload') < 7) { + if ($warnings) { + echo "

Warning: Please set mbstring.func_overload = 7 in your php.ini for useing $this->system_charset as your charset !!!

\n"; } } - else - { - if ($warnings) - { - echo "

Warning: Please get and/or enable the mbstring extension in your php.ini for useing $this->system_charset as your charset, we are defaulting to iconv for now !!!

\n"; - } + } else { + if ($warnings) { + echo "

Warning: Please get and/or enable the mbstring extension in your php.ini for useing $this->system_charset as your charset, we are defaulting to iconv for now !!!

\n"; } } }