Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/bjverde/formDin
Browse files Browse the repository at this point in the history
  • Loading branch information
bjverde committed Mar 12, 2019
2 parents fc6aa8f + d8ae137 commit ff4a816
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions base/classes/webform/TPDOConnection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,22 +159,22 @@ public static function connect( $configFile = null, $boolRequired = true, $boolU
}

/**
* Verifica se o SGBD é MySQL, rodando no Windows
* Verifica se o SGBD é MySQL
* Encoding do banco é UTF 8
* @return boolean
*/
public static function isMySqlWinDbUtf8(){
public static function isMySqlDbUtf8(){
$result = false;
$DBMS = self::getDBMS();
$boolUtf8_Decode = self::getUtfDecode();
if( ($DBMS == DBMS_MYSQL) && (PHP_OS != "Linux" ) && $boolUtf8_Decode==false ){
if( ($DBMS == DBMS_MYSQL) && $boolUtf8_Decode==false ){
$result = true;
}
return $result;
}

public static function getExtraConfigPDO(){
if( self::isMySqlWinDbUtf8() ){
if( self::isMySqlDbUtf8() ){
self::$instance[ self::getDatabaseName()]->exec('SET CHARACTER SET utf8'); // acerta a acentuação vinda do banco de dados
}
}
Expand Down Expand Up @@ -770,7 +770,7 @@ public static function encodeArray( $arrDados = null ) {
foreach( $arrDados as $k => $v ) {
if ( ! is_null( $v ) ) {

if( !self::isMySqlWinDbUtf8() ){
if( !self::isMySqlDbUtf8() ){
$boolUtf8_DecodeDataBase = self::getUtfDecode();
$arrDados[ $k ] = self::getStrUtf8OrAnsi(!$boolUtf8_DecodeDataBase, $v);
}
Expand Down Expand Up @@ -812,7 +812,7 @@ public static function encodeArray( $arrDados = null ) {
foreach( $arrDados as $k => $v ) {
if ( !is_null($v) && !empty($v) ){
$v = self::verifyformtDateYMD( $v );
if( !self::isMySqlWinDbUtf8() ){
if( !self::isMySqlDbUtf8() ){
$boolUtf8_DecodeDataBase = self::getUtfDecode();
$arrDados[ $k ] = self::getStrUtf8OrAnsi(!$boolUtf8_DecodeDataBase, $v);
}
Expand Down Expand Up @@ -1149,15 +1149,17 @@ public static function dmy( $date = null )
* @param string $string
* @return NULL|string
*/
public static function getStrUtf8OrAnsi( $boolUtf8_Decode , $string ) {
public static function getStrUtf8OrAnsi( $boolUtf8_Decode , $string )
{
$retorno = null;
if( (self::$banco == DBMS_SQLSERVER) && (PHP_OS != "Linux" ) ){
$retorno = $string;
}elseif ( (self::$banco == DBMS_SQLSERVER) && (PHP_OS == "Linux" ) && (version_compare(PHP_VERSION, '7.0.0') >= 0) ) {
$retorno = $string;
}elseif (self::$banco == DBMS_SQLITE) {
$retorno = $string;
} if( self::isMySqlWinDbUtf8() ){
}
elseif( self::isMySqlDbUtf8() ){
$retorno = $string;
} else{
if ( $boolUtf8_Decode ) {
Expand Down

0 comments on commit ff4a816

Please sign in to comment.