From 45fc093f879348b855377d9ccf726403098ebe7d Mon Sep 17 00:00:00 2001 From: "zx.asd" Date: Sun, 6 Nov 2016 00:14:53 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=96=E7=B3=96=E5=8F=91=E7=8E=B0=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E9=97=AE=E9=A2=98=E5=B7=B2=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zb_system/function/c_system_base.php | 2 +- zb_system/function/lib/dbmysql.php | 12 ++++++++---- zb_system/function/lib/dbmysqli.php | 10 ++++++---- zb_system/function/lib/dbpdo_mysql.php | 5 ++--- zb_system/function/lib/zblogphp.php | 2 +- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/zb_system/function/c_system_base.php b/zb_system/function/c_system_base.php index 3c563c7b6..edfebb4cf 100644 --- a/zb_system/function/c_system_base.php +++ b/zb_system/function/c_system_base.php @@ -19,7 +19,7 @@ define('ZC_VERSION_MAJOR', '1'); define('ZC_VERSION_MINOR', '5'); define('ZC_VERSION_BUILD', '0'); -define('ZC_VERSION_COMMIT', '1624'); +define('ZC_VERSION_COMMIT', '1626'); define('ZC_VERSION_CODENAME', 'Zero'); define('ZC_VERSION', ZC_VERSION_MAJOR . '.' . ZC_VERSION_MINOR . '.' . ZC_VERSION_BUILD . '.' . ZC_VERSION_COMMIT); define('ZC_VERSION_DISPLAY', ZC_VERSION_MAJOR . '.' . ZC_VERSION_MINOR . ' ' . ZC_VERSION_CODENAME); diff --git a/zb_system/function/lib/dbmysql.php b/zb_system/function/lib/dbmysql.php index 5424a040c..8cfca713d 100644 --- a/zb_system/function/lib/dbmysql.php +++ b/zb_system/function/lib/dbmysql.php @@ -71,12 +71,14 @@ public function Open($array) { $myver = mysql_get_server_info($db_link); $this->version = substr($myver, 0, strpos($myver, "-")); - if(version_compare($this->version, '5.5.3') >= 0 && version_compare(PHP_VERSION, '5.3.0') >= 0){ + if(version_compare($this->version, '5.5.3') >= 0){ $u = "utf8mb4"; }else{ $u = "utf8"; } - mysql_set_charset($u, $db_link); + if( mysql_set_charset($u, $db_link) == false ){ + mysql_set_charset("utf8", $db_link); + } $this->db = $db_link; if (mysql_select_db($array[3], $this->db)) { @@ -107,12 +109,14 @@ public function CreateDB($dbmysql_server, $dbmysql_port, $dbmysql_username, $dbm $myver = mysql_get_server_info($db_link); $myver = substr($myver, 0, strpos($myver, "-")); - if(version_compare($myver, '5.5.3') >= 0 && version_compare(PHP_VERSION, '5.3.0') >= 0){ + if(version_compare($myver, '5.5.3') >= 0){ $u = "utf8mb4"; }else{ $u = "utf8"; } - mysql_set_charset($u, $db_link); + if( mysql_set_charset($u, $db_link) == false ){ + mysql_set_charset("utf8", $db_link); + } $this->db = $db_link; $this->dbname = $dbmysql_name; diff --git a/zb_system/function/lib/dbmysqli.php b/zb_system/function/lib/dbmysqli.php index 3890d8034..c3be8785c 100644 --- a/zb_system/function/lib/dbmysqli.php +++ b/zb_system/function/lib/dbmysqli.php @@ -69,12 +69,13 @@ public function Open($array) { $myver = mysqli_get_server_info($db); $this->version = substr($myver, 0, strpos($myver, "-")); - if(version_compare($this->version, '5.5.3') >= 0 && version_compare(PHP_VERSION, '5.3.0') >= 0){ + if(version_compare($this->version, '5.5.3') >= 0){ $u = "utf8mb4"; }else{ $u = "utf8"; } - mysqli_set_charset($db, $u); + if(mysqli_set_charset($db, $u) == false) + mysqli_set_charset($db, "utf8"); $this->db = $db; $this->dbname = $array[3]; @@ -101,12 +102,13 @@ public function CreateDB($dbmysql_server, $dbmysql_port, $dbmysql_username, $dbm $myver = mysqli_get_server_info($db); $myver = substr($myver, 0, strpos($myver, "-")); - if(version_compare($myver, '5.5.3') >= 0 && version_compare(PHP_VERSION, '5.3.0') >= 0){ + if(version_compare($myver, '5.5.3') >= 0){ $u = "utf8mb4"; }else{ $u = "utf8"; } - mysqli_set_charset($db, $u); + if(mysqli_set_charset($db, $u) == false) + mysqli_set_charset($db, "utf8"); $this->db = $db; $this->dbname = $dbmysql_name; diff --git a/zb_system/function/lib/dbpdo_mysql.php b/zb_system/function/lib/dbpdo_mysql.php index a6c5c196b..671fabc65 100644 --- a/zb_system/function/lib/dbpdo_mysql.php +++ b/zb_system/function/lib/dbpdo_mysql.php @@ -72,12 +72,11 @@ public function Open($array) { $myver = $this->db->getAttribute(PDO::ATTR_SERVER_VERSION); $this->version = substr($myver, 0, strpos($myver, "-")); - if(version_compare($this->version, '5.5.3') >= 0 && version_compare(PHP_VERSION, '5.3.0') >= 0){ + if(version_compare($this->version, '5.5.3') >= 0){ $u = "utf8mb4"; }else{ $u = "utf8"; } - //$db_link->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES '" . $u . "'"); $db_link->query("SET NAMES '" . $u . "'"); return true; @@ -101,7 +100,7 @@ public function CreateDB($dbmysql_server, $dbmysql_port, $dbmysql_username, $dbm $myver = $this->db->getAttribute(PDO::ATTR_SERVER_VERSION); $myver = substr($myver, 0, strpos($myver, "-")); - if(version_compare($myver, '5.5.3') >= 0 && version_compare(PHP_VERSION, '5.3.0') >= 0){ + if(version_compare($myver, '5.5.3') >= 0){ $u = "utf8mb4"; }else{ $u = "utf8"; diff --git a/zb_system/function/lib/zblogphp.php b/zb_system/function/lib/zblogphp.php index ff8086c3a..bba3b2d9f 100644 --- a/zb_system/function/lib/zblogphp.php +++ b/zb_system/function/lib/zblogphp.php @@ -645,7 +645,7 @@ public function OpenConnect() { break; } //add utf8mb4 - if ($this->db->type == 'mysql' && (version_compare($this->db->version, '5.5.3') < 0 || version_compare(PHP_VERSION, '5.3.0') < 0 ) ) { + if ($this->db->type == 'mysql' && version_compare($this->db->version, '5.5.3') < 0 ) { Add_Filter_Plugin('Filter_Plugin_DbSql_Filter', 'utf84mb_filter'); Add_Filter_Plugin('Filter_Plugin_Edit_Begin', 'utf84mb_fixHtmlSpecialChars'); }