Version 4.3.6
This commit is contained in:
1 parent
fe1acf984a
commit
1a0c7fd3c2
609 files changed
+14707
-5726
No files matched your search
@@ -341,7 +341,14 @@ class Convert
|
||||
$source_charset = SOURCE_DB_CHARSET;
|
||||
}
|
||||
|
||||
$select[] = 'CASE WHEN STRCMP(CONVERT(CONVERT(CONVERT(`' . $col . '` USING ' . $source_charset . ') USING BINARY) USING ' . $using . '), `' . $col . '` COLLATE ' . $collation . ') = 0 THEN CONVERT(`' . $col . '` USING BINARY) ELSE CONVERT(CONVERT(CONVERT(`' . $col . '` USING ' . $source_charset . ') USING BINARY) USING ' . $using . ') END';
|
||||
if ( defined( 'MULTI_NO_CMP' ) AND MULTI_NO_CMP === TRUE )
|
||||
{
|
||||
$select[] = "CONVERT(CONVERT(CONVERT(`{$col}` USING {$source_charset}) USING BINARY) USING {$using})";
|
||||
}
|
||||
else
|
||||
{
|
||||
$select[] = 'CASE WHEN STRCMP(CONVERT(CONVERT(CONVERT(`' . $col . '` USING ' . $source_charset . ') USING BINARY) USING ' . $using . '), `' . $col . '` COLLATE ' . $collation . ') = 0 THEN CONVERT(`' . $col . '` USING BINARY) ELSE CONVERT(CONVERT(CONVERT(`' . $col . '` USING ' . $source_charset . ') USING BINARY) USING ' . $using . ') END';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -247,27 +247,34 @@ class Session
|
||||
catch( \UnderflowException $ex ) { }
|
||||
}
|
||||
|
||||
if ( $ipbVersion >= 40000 )
|
||||
if ( !SOURCE_CHARSET_OVERRIDE )
|
||||
{
|
||||
/* >= 4.0 is UTF-8 */
|
||||
$charSet = 'utf-8';
|
||||
}
|
||||
else if ( $ipbVersion !== null )
|
||||
{
|
||||
/* Attempt to grab current CHARSET if this is an IPB 3 */
|
||||
if ( \IPSUtf8\Db::i()->checkForTable('core_sys_conf_settings' ) )
|
||||
if ( $ipbVersion >= 40000 )
|
||||
{
|
||||
try
|
||||
{
|
||||
$row = \IPSUtf8\Db::i()->select( '*', 'core_sys_conf_settings', array( 'conf_key=?', 'gb_char_set' ) )->first();
|
||||
|
||||
if ( ! empty( $row['conf_key'] ) )
|
||||
{
|
||||
$charSet = ( $row['conf_value'] ) ? $row['conf_value'] : $row['conf_default'];
|
||||
}
|
||||
}
|
||||
catch( \UnderflowException $ex ) { }
|
||||
/* >= 4.0 is UTF-8 */
|
||||
$charSet = 'utf-8';
|
||||
}
|
||||
else if ( $ipbVersion !== null )
|
||||
{
|
||||
/* Attempt to grab current CHARSET if this is an IPB 3 */
|
||||
if ( \IPSUtf8\Db::i()->checkForTable('core_sys_conf_settings' ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
$row = \IPSUtf8\Db::i()->select( '*', 'core_sys_conf_settings', array( 'conf_key=?', 'gb_char_set' ) )->first();
|
||||
|
||||
if ( ! empty( $row['conf_key'] ) )
|
||||
{
|
||||
$charSet = ( $row['conf_value'] ) ? $row['conf_value'] : $row['conf_default'];
|
||||
}
|
||||
}
|
||||
catch( \UnderflowException $ex ) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$charSet = strtolower( SOURCE_CHARSET_OVERRIDE );
|
||||
}
|
||||
|
||||
$tableData = $this->_getTables();
|
||||
|
||||
@@ -63,6 +63,10 @@ abstract class Charset
|
||||
{
|
||||
self::$method = 'recode';
|
||||
}
|
||||
else if ( class_exists( 'UConverter' ) )
|
||||
{
|
||||
self::$method = 'uconverter';
|
||||
}
|
||||
else
|
||||
{
|
||||
self::$method = 'internal';
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Conversion module
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Tools
|
||||
* @since 4 Sept 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPSUtf8\Text\Module;
|
||||
|
||||
/**
|
||||
* Native MB Conversion class
|
||||
*/
|
||||
class Uconverter extends \IPSUtf8\Text\Charset
|
||||
{
|
||||
/**
|
||||
* @brief The class
|
||||
*/
|
||||
protected $_class = NULL;
|
||||
|
||||
/**
|
||||
* Converts a text string from its current charset to a destination charset using iconv
|
||||
*
|
||||
* @param string Text string
|
||||
* @param string Text string char set (original)
|
||||
* @param string Desired character set (destination)
|
||||
* @return @e string
|
||||
*/
|
||||
public function convert( $string, $from, $to='UTF-8' )
|
||||
{
|
||||
if ( static::needsConverting( $string, $from, $to ) === false )
|
||||
{
|
||||
return $string;
|
||||
}
|
||||
|
||||
$text = NULL;
|
||||
|
||||
if ( class_exists( 'UConverter' ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( $this->_class === NULL )
|
||||
{
|
||||
$this->_class = new \UConverter( $to, $from );
|
||||
}
|
||||
$text = $this->_class->convert( $string );
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
static::$errors[] = $e->getMessage();
|
||||
}
|
||||
catch( \Throwable $e )
|
||||
{
|
||||
static::$errors[] = $e->getMessage();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
static::$errors[] = "NO_UCONVERTER_CLASS";
|
||||
}
|
||||
|
||||
return $text ? $text : $string;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user