utf8 support
git-svn-id: file:///home/shish/svn/shimmie2/trunk@233 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
cec93d8a4d
commit
e0d279f347
6 changed files with 17 additions and 3 deletions
|
@ -34,6 +34,7 @@ class Database {
|
|||
require_once "config.php";
|
||||
$this->db = NewADOConnection($database_dsn);
|
||||
$this->db->SetFetchMode(ADODB_FETCH_ASSOC);
|
||||
$this->db->Execute("SET NAMES utf8"); // FIXME: mysql specific :|
|
||||
$this->extensions = $this->db->GetAssoc("SELECT name, version FROM extensions");
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -26,8 +26,8 @@ class ViewImage extends Extension {
|
|||
$image = $event->get_image();
|
||||
|
||||
global $page;
|
||||
$page->set_title("Image {$image->id}: ".$image->get_tag_list());
|
||||
$page->set_heading($image->get_tag_list());
|
||||
$page->set_title("Image {$image->id}: ".html_escape($image->get_tag_list()));
|
||||
$page->set_heading(html_escape($image->get_tag_list()));
|
||||
$page->add_block(new Block("Navigation", $this->build_navigation($image->id), "left", 0));
|
||||
$page->add_block(new Block("Image", $this->build_image_view($image), "main", 0));
|
||||
$page->add_block(new Block(null, $this->build_info($image), "main", 10));
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
function html_escape($input) {
|
||||
return htmlentities($input);
|
||||
return htmlentities($input, ENT_QUOTES, "UTF-8");
|
||||
}
|
||||
|
||||
function int_escape($input) {
|
||||
|
|
|
@ -60,6 +60,16 @@ class Upgrade extends Extension {
|
|||
$config->set_int("db_version", 5);
|
||||
$config->set_bool("in_upgrade", false);
|
||||
}
|
||||
|
||||
if($config->get_int("db_version") == 5) {
|
||||
$config->set_bool("in_upgrade", true);
|
||||
$tables = $database->db->GetCol("SHOW TABLES");
|
||||
foreach($tables as $table) {
|
||||
$database->Execute("ALTER TABLE $table CONVERT TO CHARACTER SET utf8");
|
||||
}
|
||||
$config->set_int("db_version", 6);
|
||||
$config->set_bool("in_upgrade", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
add_event_listener(new Upgrade(), 5);
|
||||
|
|
|
@ -447,6 +447,8 @@ function move_data($old_dsn, $new_dsn, $old_data) {
|
|||
function create_tables_mysql($db) {
|
||||
$db->StartTrans();
|
||||
|
||||
$db->Execute("SET NAMES utf8"); // FIXME: mysql-specific :(
|
||||
|
||||
$db->Execute("DROP TABLE IF EXISTS aliases");
|
||||
$db->Execute("CREATE TABLE aliases (
|
||||
oldtag varchar(255) NOT NULL,
|
||||
|
|
|
@ -47,6 +47,7 @@ class Layout {
|
|||
<html>
|
||||
<head>
|
||||
<title>{$page->title}</title>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
||||
<link rel="stylesheet" href="$data_href/themes/$theme_name/style.css" type="text/css">
|
||||
$header_html
|
||||
<script src='$data_href/themes/$theme_name/sidebar.js' type='text/javascript'></script>
|
||||
|
|
Reference in a new issue