Skip to content
Permalink
Browse files

Support MySQLi Connection (mysqli API)

  • Loading branch information...
nao-pon committed Sep 7, 2013
1 parent 11ce883 commit 109e1d0c228ad0f162aa78fc4eeb6878a03afcc8
@@ -336,4 +336,23 @@ public static function getUnameByUid($uid){
}
return $unames[$uid] = $uname;
}
/**
* Sets the default client character set
*
* @param string $charset
* @return bool
*/
public static function dbSetCharset($charset = 'utf8') {
static $link = null;
if (is_null($link)) {
$db = XoopsDatabaseFactory::getDatabaseConnection();
$link = (is_object($db->conn) && get_class($db->conn) === 'mysqli')? $db->conn : false;
}
if ($link) {
return mysqli_set_charset($link, $charset);
} else {
return mysql_set_charset($charset);
}
}
}
@@ -110,7 +110,7 @@ protected function init() {
$this->d3dConf =& D3diaryConf::getInstance($mydirname, 0, 'photolist');
if (! is_object($this->d3dConf)) return false;
mysql_set_charset('utf8');
xoops_elFinder::dbSetCharset('utf8');
// make catgory tree
$func =& $this->d3dConf->func ;
@@ -81,7 +81,7 @@ protected function init() {
$this->db =& XoopsDatabaseFactory::getDatabaseConnection();
if (! is_object($this->db)) return false;
mysql_set_charset('utf8');
xoops_elFinder::dbSetCharset('utf8');
$this->mydirname = $this->options['mydirname'];
@@ -188,7 +188,7 @@ protected function init() {
return false;
}
mysql_set_charset('utf8');
xoops_elFinder::dbSetCharset('utf8');
$this->mydirname = $this->options['mydirname'];

0 comments on commit 109e1d0

Please sign in to comment.
You can’t perform that action at this time.