Wikka Hack
This hacking is for Wikka Wiki 1.1.6.5
After the applying the hack,
- UTF-8 character should be displayed properly on edit screen when re-editting
- UTF-8 character should be displayed properly on PHPAdmin MySQL client
- Search function to UTF-8 data should work
- UTF-8 character and not just ascii coded entity should be displayed and saved
Hack to save UTF-8 data to
MySQL properly so that it can be displayed properly via PHPAdmin SQL client.
Hacking code taken from
MySQL collation charset problem and patch for NucleusCMS and WikkaWiki∞
Change libs\Wakka.class.php
add line 60 to 62 inclusively
add line 73 to 91 inclusively
/**
* Constructor
*/
function Wakka($config)
{
$this->config = $config;
$this->
dblink = @
mysql_connect($this->
config["mysql_host"],
$this->
config["mysql_user"],
$this->
config["mysql_password"])
if ($this->dblink)
{
$charset = $this->_getDbCharset($this->config["mysql_database"]);
if($charset)
{
$this->dblink = false;
}
}
$this->VERSION = WAKKA_VERSION;
}
function _getDbCharset($db) {
if (!$db) {
return false;
}
// We use a SHOW CREATE DATABASE command to show the original
// SQL character set when DB was created.
$result =
mysql_query("SHOW CREATE DATABASE `$db`",
$this->
dblink);
// The specified db name is wrong!
return false;
}
$pattern = '/40100 DEFAULT CHARACTER SET (\w+) /';
if ( (preg_match($pattern,
$dbInfo[1],
$match) >
0) ) {
return $match[1];
}
return false;
}
/**
* Database methods
*/
Hack to display UTF-8 character properly on edit screen when re-editting
Change libs\Wakka.class.php
change line 1773
// raw page handler
elseif ($this->method == "raw")
{
header("Content-type: text/plain; charset=UTF-8");
print($this->
Method($this->
method));
}
// grabcode page handler
elseif ($this->method == "grabcode")
Change templates\header.php
Add line 2
Change line 14
<?php
header('Content-type: text/html; charset=UTF-8');
$message = $this->GetRedirectMessage();
$user = $this->GetUser();
$site_base = $this->GetConfigValue("base_url");
if ( substr_count($site_base,
'wikka.php?wakka=') >
0 ) $site_base =
substr($site_base,
0,
-16);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php
echo $this->
GetWakkaName().
": ".
$this->
PageTitle(); ?></title>
<base href="<?php echo $site_base ?>" />
<?php if ($this->
GetMethod() !=
'show' ||
$this->
page["latest"] ==
'N' ||
$this->
page["tag"] ==
'SandBox') echo "<meta name=\"robots\" content=\"noindex, nofollow, noarchive\" />\n";
?>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="keywords" content="<?php echo $this->GetConfigValue("meta_keywords") ?>" />
Reference
Wikka project leader page containing wikka hack to make wikka as UTF-8 capable or as an invisible wiki engine etc.∞
CategoryHome
There are no comments on this page. [Add comment]