Skip to content

Commit

Permalink
糖糖发现的数据库问题已修复;
Browse files Browse the repository at this point in the history
  • Loading branch information
rainbowsoft committed Nov 5, 2016
1 parent 21553d3 commit 45fc093
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion zb_system/function/c_system_base.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 8 additions & 4 deletions zb_system/function/lib/dbmysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 6 additions & 4 deletions zb_system/function/lib/dbmysqli.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions zb_system/function/lib/dbpdo_mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion zb_system/function/lib/zblogphp.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down

0 comments on commit 45fc093

Please sign in to comment.