Version 4.3.6

This commit is contained in:
Neo committed 2025-12-19 05:49:12 -08:00
1 parent fe1acf984a
commit 1a0c7fd3c2
609 files changed
+14707 -5726

No files matched your search

+1 -1
View File
@@ -22,7 +22,7 @@ else
print "<body style='text-align:center'>\n";
print "This script is meant to be run via command line<br />\n";
print "More information:<br />\n";
print "<a href=\"http://www.google.com/search?hl=en&q=php+cli+windows\" target=\"_blank\">http://www.google.com/search?hl=en&q=php+cli+windows</a><br />\n";
print "<a href=\"http://www.google.com/search?hl=en&q=php+cli+windows\" target=\"_blank\" rel=\"noopener\">http://www.google.com/search?hl=en&q=php+cli+windows</a><br />\n";
print "This script will not run through a webserver.<br />\n";
print "</body></html>\n";
exit();
+12 -10
View File
@@ -70,16 +70,18 @@ class IPSUtf8
public static function defaultConstants()
{
return array(
'IPB_FIREWALL' => 1, /* This is a workaround for an old exploit to prevent upgrade issues */
'IPB_LOCK' => TRUE, /* Lock conversion to only IP.Board Databases */
'BYPASS_SAFETY_LOCK' => FALSE,
'FORCE_CONVERT' => FALSE, /* Enforce conversion */
'FORCE_CONVERT_CHARSET' => NULL,
'FORCE_CONVERT_METHOD' => NULL,
'SOURCE_DB_CHARSET' => NULL, /* If set, will force the source database connection to use this charset */
'UTF8_INSERT_ONLY' => FALSE, /* If true, and sql_charset is present and set to utf8 in conf_global.php, then the "fast" method will simply insert without converting. Useful for mixed collation databases where the utf8 tables are real utf8 */
'FORCE_MULTI_CONVERT' => FALSE, /* Forces the converter to use CONVERT(CONVERT(CONVERT(x AS <SOURCE_DB_CHARSET>) AS BINARY) AS UTF8) which is needed in some random old data sets */
'LOG' => FALSE, /* Log Conversion Data */
'IPB_FIREWALL' => 1, /* This is a workaround for an old exploit to prevent upgrade issues */
'IPB_LOCK' => TRUE, /* Lock conversion to only IP.Board Databases */
'BYPASS_SAFETY_LOCK' => FALSE,
'FORCE_CONVERT' => FALSE, /* Enforce conversion */
'FORCE_CONVERT_CHARSET' => NULL,
'FORCE_CONVERT_METHOD' => NULL,
'SOURCE_DB_CHARSET' => NULL, /* If set, will force the source database connection to use this charset */
'UTF8_INSERT_ONLY' => FALSE, /* If true, and sql_charset is present and set to utf8 in conf_global.php, then the "fast" method will simply insert without converting. Useful for mixed collation databases where the utf8 tables are real utf8 */
'FORCE_MULTI_CONVERT' => FALSE, /* Forces the converter to use CONVERT(CONVERT(CONVERT(x AS <SOURCE_DB_CHARSET>) AS BINARY) AS UTF8) which is needed in some random old data sets */
'LOG' => FALSE, /* Log Conversion Data */
'SOURCE_CHARSET_OVERRIDE' => NULL, /* Force the converter to consider this value the value of IPB3's gb_char_set. Note that these are DOCUMENT Character Sets, not MySQL (so ISO-8859-1 for latin1, etc.) */
'MULTI_NO_CMP' => FALSE, /* When using the multi convert option, set this to true to not check the result of the conversion against the same data collated to utf8, which can cause an error in some situations. */
);
}
+8 -1
View File
@@ -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
+25 -18
View File
@@ -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;
}
}