mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-27 17:00:52 +01:00
Upgrade to utf8mb4 charset for MySQL server versions above 5.5.3. Keep support for older versions. Fix charsets for multiple columns and tables.
This commit is contained in:
parent
91bb3182da
commit
8efab06616
@ -51,12 +51,16 @@ function sql_open() {
|
||||
try {
|
||||
$options = array(
|
||||
PDO::ATTR_TIMEOUT => $config['db']['timeout'],
|
||||
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
|
||||
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true
|
||||
);
|
||||
if ($config['db']['persistent'])
|
||||
$options[PDO::ATTR_PERSISTENT] = true;
|
||||
return $pdo = new PDO($dsn, $config['db']['user'], $config['db']['password'], $options);
|
||||
$pdo = new PDO($dsn, $config['db']['user'], $config['db']['password'], $options);
|
||||
if (mysql_version() >= 50503)
|
||||
query('SET NAMES utf8mb4') or error(db_error());
|
||||
else
|
||||
query('SET NAMES utf8') or error(db_error());
|
||||
return $pdo;
|
||||
} catch(PDOException $e) {
|
||||
$message = $e->getMessage();
|
||||
|
||||
@ -65,10 +69,21 @@ function sql_open() {
|
||||
$message = str_replace($config['db']['password'], '<em>hidden</em>', $message);
|
||||
|
||||
// Print error
|
||||
error('Database error: ' . $message);
|
||||
error(_('Database error: ') . $message);
|
||||
}
|
||||
}
|
||||
|
||||
// 5.6.10 becomes 50610
|
||||
function mysql_version() {
|
||||
global $pdo;
|
||||
|
||||
$version = $pdo->getAttribute(PDO::ATTR_SERVER_VERSION);
|
||||
$v = explode('.', $version);
|
||||
if (count($v) != 3)
|
||||
return false;
|
||||
return (int) sprintf("%02d%02d%02d", $v[0], $v[1], $v[2]);
|
||||
}
|
||||
|
||||
function prepare($query) {
|
||||
global $pdo, $debug, $config;
|
||||
|
||||
|
@ -1399,6 +1399,9 @@ function markup(&$body, $track_cites = false) {
|
||||
$body = str_replace("\r", '', $body);
|
||||
$body = utf8tohtml($body);
|
||||
|
||||
if (mysql_version() < 50503)
|
||||
$body = mb_encode_numericentity($body, array(0x010000, 0xffffff, 0, 0xffffff), 'UTF-8');
|
||||
|
||||
foreach ($config['markup'] as $markup) {
|
||||
if (is_string($markup[1])) {
|
||||
$body = preg_replace($markup[0], $markup[1], $body);
|
||||
@ -1523,7 +1526,7 @@ function markup(&$body, $track_cites = false) {
|
||||
}
|
||||
|
||||
function utf8tohtml($utf8) {
|
||||
return mb_encode_numericentity(htmlspecialchars($utf8, ENT_NOQUOTES, 'UTF-8'), array(0x010000, 0xffffff, 0, 0xffffff), 'UTF-8');
|
||||
return htmlspecialchars($utf8, ENT_NOQUOTES, 'UTF-8');
|
||||
}
|
||||
|
||||
function ordutf8($string, &$offset) {
|
||||
|
100
install.php
100
install.php
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
// Installation/upgrade file
|
||||
define('VERSION', 'v0.9.6-dev-9');
|
||||
define('VERSION', 'v0.9.6-dev-10');
|
||||
|
||||
require 'inc/functions.php';
|
||||
|
||||
@ -248,6 +248,100 @@ if (file_exists($config['has_installed'])) {
|
||||
$_query->execute() or error(db_error($_query));
|
||||
}
|
||||
}
|
||||
case 'v0.9.6-dev-9':
|
||||
function __query($sql) {
|
||||
if (mysql_version() >= 50503)
|
||||
return query($sql);
|
||||
else
|
||||
return query(str_replace('utf8mb4', 'utf8', $sql));
|
||||
}
|
||||
|
||||
foreach ($boards as &$board) {
|
||||
__query(sprintf("ALTER TABLE `posts_%s`
|
||||
CHANGE `subject` `subject` VARCHAR(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
CHANGE `email` `email` VARCHAR(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
CHANGE `name` `name` VARCHAR(35) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
CHANGE `trip` `trip` VARCHAR(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
CHANGE `capcode` `capcode` VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
CHANGE `body` `body` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
CHANGE `body_nomarkup` `body_nomarkup` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
CHANGE `thumb` `thumb` VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
CHANGE `thumbwidth` `thumbwidth` INT(11) NULL DEFAULT NULL,
|
||||
CHANGE `thumbheight` `thumbheight` INT(11) NULL DEFAULT NULL,
|
||||
CHANGE `file` `file` VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
CHANGE `filename` `filename` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
CHANGE `filehash` `filehash` TEXT CHARACTER SET ascii COLLATE ascii_general_ci NULL DEFAULT NULL,
|
||||
CHANGE `password` `password` VARCHAR(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
CHANGE `ip` `ip` VARCHAR(39) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
|
||||
CHANGE `embed` `embed` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;", $board['uri'])) or error(db_error());
|
||||
}
|
||||
|
||||
__query("ALTER TABLE `antispam`
|
||||
CHANGE `board` `board` VARCHAR( 120 ) CHARACTER SET ASCII COLLATE ascii_general_ci NOT NULL ,
|
||||
CHANGE `hash` `hash` CHAR( 40 ) CHARACTER SET ASCII COLLATE ascii_bin NOT NULL ,
|
||||
DEFAULT CHARACTER SET ASCII COLLATE ascii_bin;") or error(db_error());
|
||||
__query("ALTER TABLE `bans`
|
||||
CHANGE `ip` `ip` VARCHAR( 39 ) CHARACTER SET ASCII COLLATE ascii_general_ci NOT NULL ,
|
||||
CHANGE `reason` `reason` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
|
||||
CHANGE `board` `board` VARCHAR( 120 ) CHARACTER SET ASCII COLLATE ascii_general_ci NULL DEFAULT NULL,
|
||||
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;") or error(db_error());
|
||||
__query("ALTER TABLE `boards`
|
||||
CHANGE `uri` `uri` VARCHAR( 120 ) CHARACTER SET ASCII COLLATE ascii_general_ci NOT NULL ,
|
||||
CHANGE `title` `title` TINYTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
|
||||
CHANGE `subtitle` `subtitle` TINYTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;") or error(db_error());
|
||||
__query("ALTER TABLE `cites`
|
||||
CHANGE `board` `board` VARCHAR( 120 ) CHARACTER SET ASCII COLLATE ascii_general_ci NOT NULL ,
|
||||
CHANGE `target_board` `target_board` VARCHAR( 120 ) CHARACTER SET ASCII COLLATE ascii_general_ci NOT NULL ,
|
||||
DEFAULT CHARACTER SET ASCII COLLATE ascii_general_ci;") or error(db_error());
|
||||
__query("ALTER TABLE `ip_notes`
|
||||
CHANGE `ip` `ip` VARCHAR( 39 ) CHARACTER SET ASCII COLLATE ascii_general_ci NOT NULL ,
|
||||
CHANGE `body` `body` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
|
||||
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;") or error(db_error());
|
||||
__query("ALTER TABLE `ip_notes`
|
||||
CHANGE `ip` `ip` VARCHAR( 39 ) CHARACTER SET ASCII COLLATE ascii_general_ci NOT NULL ,
|
||||
CHANGE `body` `body` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
|
||||
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;") or error(db_error());
|
||||
__query("ALTER TABLE `modlogs`
|
||||
CHANGE `ip` `ip` VARCHAR( 39 ) CHARACTER SET ASCII COLLATE ascii_general_ci NOT NULL ,
|
||||
CHANGE `board` `board` VARCHAR( 120 ) CHARACTER SET ASCII COLLATE ascii_general_ci NULL DEFAULT NULL ,
|
||||
CHANGE `text` `text` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
|
||||
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;") or error(db_error());
|
||||
__query("ALTER TABLE `mods`
|
||||
CHANGE `username` `username` VARCHAR( 30 ) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
|
||||
CHANGE `password` `password` CHAR( 64 ) CHARACTER SET ASCII COLLATE ascii_general_ci NOT NULL COMMENT 'SHA256',
|
||||
CHANGE `salt` `salt` CHAR( 32 ) CHARACTER SET ASCII COLLATE ascii_general_ci NOT NULL ,
|
||||
CHANGE `boards` `boards` TEXT CHARACTER SET ASCII COLLATE ascii_general_ci NOT NULL ,
|
||||
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;") or error(db_error());
|
||||
__query("ALTER TABLE `mutes`
|
||||
CHANGE `ip` `ip` VARCHAR( 39 ) CHARACTER SET ASCII COLLATE ascii_general_ci NOT NULL ,
|
||||
DEFAULT CHARACTER SET ASCII COLLATE ascii_general_ci;") or error(db_error());
|
||||
__query("ALTER TABLE `news`
|
||||
CHANGE `name` `name` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
|
||||
CHANGE `subject` `subject` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
|
||||
CHANGE `body` `body` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
|
||||
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;") or error(db_error());
|
||||
__query("ALTER TABLE `noticeboard`
|
||||
CHANGE `subject` `subject` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
|
||||
CHANGE `body` `body` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
|
||||
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;") or error(db_error());
|
||||
__query("ALTER TABLE `pms`
|
||||
CHANGE `message` `message` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
|
||||
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;") or error(db_error());
|
||||
__query("ALTER TABLE `reports`
|
||||
CHANGE `ip` `ip` VARCHAR( 39 ) CHARACTER SET ASCII COLLATE ascii_general_ci NOT NULL ,
|
||||
CHANGE `board` `board` VARCHAR( 120 ) CHARACTER SET ASCII COLLATE ascii_general_ci NULL DEFAULT NULL ,
|
||||
CHANGE `reason` `reason` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
|
||||
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;") or error(db_error());
|
||||
__query("ALTER TABLE `robot`
|
||||
CHANGE `hash` `hash` VARCHAR( 40 ) CHARACTER SET ASCII COLLATE ascii_bin NOT NULL COMMENT 'SHA1',
|
||||
DEFAULT CHARACTER SET ASCII COLLATE ascii_bin;") or error(db_error());
|
||||
__query("ALTER TABLE `theme_settings`
|
||||
CHANGE `theme` `theme` VARCHAR( 40 ) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
|
||||
CHANGE `name` `name` VARCHAR( 40 ) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
|
||||
CHANGE `value` `value` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
|
||||
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;") or eror(db_error());
|
||||
case false:
|
||||
// Update version number
|
||||
file_write($config['has_installed'], VERSION);
|
||||
@ -547,6 +641,10 @@ if ($step == 0) {
|
||||
|
||||
$sql = @file_get_contents('install.sql') or error("Couldn't load install.sql.");
|
||||
|
||||
sql_open();
|
||||
if (mysql_version() < 50503)
|
||||
$sql = str_replace('utf8', 'utf8mb4', $sql);
|
||||
|
||||
// This code is probably horrible, but what I'm trying
|
||||
// to do is find all of the SQL queires and put them
|
||||
// in an array.
|
||||
|
95
install.sql
95
install.sql
@ -1,25 +1,20 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 3.4.2
|
||||
-- version 4.0.4.1
|
||||
-- http://www.phpmyadmin.net
|
||||
--
|
||||
-- Host: localhost
|
||||
-- Generation Time: Apr 12, 2012 at 11:22 PM
|
||||
-- Server version: 5.1.61
|
||||
-- PHP Version: 5.3.3-7+squeeze8
|
||||
-- Generation Time: Jul 30, 2013 at 09:45 PM
|
||||
-- Server version: 5.6.10
|
||||
-- PHP Version: 5.3.15
|
||||
|
||||
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
|
||||
--
|
||||
-- Database: `tinyboard`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
@ -27,15 +22,15 @@ SET time_zone = "+00:00";
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `antispam` (
|
||||
`board` varchar(255) NOT NULL,
|
||||
`board` varchar(120) CHARACTER SET ascii NOT NULL,
|
||||
`thread` int(11) DEFAULT NULL,
|
||||
`hash` char(40) NOT NULL,
|
||||
`hash` char(40) COLLATE ascii_bin NOT NULL,
|
||||
`created` int(11) NOT NULL,
|
||||
`expires` int(11) DEFAULT NULL,
|
||||
`passed` smallint(6) NOT NULL,
|
||||
PRIMARY KEY (`hash`),
|
||||
KEY `board` (`board`,`thread`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=ascii COLLATE=ascii_bin;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@ -44,17 +39,17 @@ CREATE TABLE IF NOT EXISTS `antispam` (
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `bans` (
|
||||
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`ip` varchar(45) NOT NULL,
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`ip` varchar(39) CHARACTER SET ascii NOT NULL,
|
||||
`mod` int(11) NOT NULL COMMENT 'which mod made the ban',
|
||||
`set` int(11) NOT NULL,
|
||||
`expires` int(11) DEFAULT NULL,
|
||||
`reason` text,
|
||||
`board` varchar(120) DEFAULT NULL,
|
||||
`board` varchar(120) CHARACTER SET ascii DEFAULT NULL,
|
||||
`seen` tinyint(1) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FULLTEXT KEY `ip` (`ip`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@ -63,18 +58,18 @@ CREATE TABLE IF NOT EXISTS `bans` (
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `boards` (
|
||||
`uri` varchar(120) NOT NULL,
|
||||
`uri` varchar(120) CHARACTER SET ascii NOT NULL,
|
||||
`title` tinytext NOT NULL,
|
||||
`subtitle` tinytext,
|
||||
PRIMARY KEY (`uri`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
--
|
||||
-- Dumping data for table `boards`
|
||||
--
|
||||
|
||||
INSERT INTO `boards` (`uri`, `title`, `subtitle`) VALUES
|
||||
('b', 'Beta', 'In development.');
|
||||
INSERT INTO `boards` VALUES
|
||||
('b', 'Random', NULL);
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@ -83,13 +78,13 @@ INSERT INTO `boards` (`uri`, `title`, `subtitle`) VALUES
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cites` (
|
||||
`board` varchar(8) NOT NULL,
|
||||
`board` varchar(120) NOT NULL,
|
||||
`post` int(11) NOT NULL,
|
||||
`target_board` varchar(8) NOT NULL,
|
||||
`target_board` varchar(120) NOT NULL,
|
||||
`target` int(11) NOT NULL,
|
||||
KEY `target` (`target_board`,`target`),
|
||||
KEY `post` (`board`,`post`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=ascii;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@ -98,14 +93,14 @@ CREATE TABLE IF NOT EXISTS `cites` (
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `ip_notes` (
|
||||
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`ip` varchar(45) NOT NULL,
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`ip` varchar(39) CHARACTER SET ascii NOT NULL,
|
||||
`mod` int(11) DEFAULT NULL,
|
||||
`time` int(11) NOT NULL,
|
||||
`body` text NOT NULL,
|
||||
UNIQUE KEY `id` (`id`),
|
||||
KEY `ip` (`ip`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@ -115,12 +110,12 @@ CREATE TABLE IF NOT EXISTS `ip_notes` (
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `modlogs` (
|
||||
`mod` int(11) NOT NULL,
|
||||
`ip` varchar(45) NOT NULL,
|
||||
`board` varchar(120) DEFAULT NULL,
|
||||
`ip` varchar(39) CHARACTER SET ascii NOT NULL,
|
||||
`board` varchar(120) CHARACTER SET ascii DEFAULT NULL,
|
||||
`time` int(11) NOT NULL,
|
||||
`text` text NOT NULL,
|
||||
KEY `time` (`time`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@ -131,19 +126,19 @@ CREATE TABLE IF NOT EXISTS `modlogs` (
|
||||
CREATE TABLE IF NOT EXISTS `mods` (
|
||||
`id` smallint(6) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`username` varchar(30) NOT NULL,
|
||||
`password` char(64) NOT NULL COMMENT 'SHA256',
|
||||
`salt` char(32) NOT NULL,
|
||||
`password` char(64) CHARACTER SET ascii NOT NULL COMMENT 'SHA256',
|
||||
`salt` char(32) CHARACTER SET ascii NOT NULL,
|
||||
`type` smallint(1) NOT NULL COMMENT '0: janitor, 1: mod, 2: admin',
|
||||
`boards` text NOT NULL,
|
||||
`boards` text CHARACTER SET ascii NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `id` (`id`,`username`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=4 ;
|
||||
|
||||
--
|
||||
-- Dumping data for table `mods`
|
||||
--
|
||||
|
||||
INSERT INTO `mods` (`id`, `username`, `password`, `salt`, `type`, `boards`) VALUES
|
||||
INSERT INTO `mods` VALUES
|
||||
(1, 'admin', 'cedad442efeef7112fed0f50b011b2b9bf83f6898082f995f69dd7865ca19fb7', '4a44c6c55df862ae901b413feecb0d49', 2, '*');
|
||||
|
||||
-- --------------------------------------------------------
|
||||
@ -153,10 +148,10 @@ INSERT INTO `mods` (`id`, `username`, `password`, `salt`, `type`, `boards`) VALU
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mutes` (
|
||||
`ip` varchar(45) NOT NULL,
|
||||
`ip` varchar(39) NOT NULL,
|
||||
`time` int(11) NOT NULL,
|
||||
KEY `ip` (`ip`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=ascii;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@ -165,14 +160,14 @@ CREATE TABLE IF NOT EXISTS `mutes` (
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `news` (
|
||||
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` text NOT NULL,
|
||||
`time` int(11) NOT NULL,
|
||||
`subject` text NOT NULL,
|
||||
`body` text NOT NULL,
|
||||
UNIQUE KEY `id` (`id`),
|
||||
KEY `time` (`time`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@ -181,13 +176,13 @@ CREATE TABLE IF NOT EXISTS `news` (
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `noticeboard` (
|
||||
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`mod` int(11) NOT NULL,
|
||||
`time` int(11) NOT NULL,
|
||||
`subject` text NOT NULL,
|
||||
`body` text NOT NULL,
|
||||
UNIQUE KEY `id` (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@ -196,14 +191,14 @@ CREATE TABLE IF NOT EXISTS `noticeboard` (
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `pms` (
|
||||
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`sender` int(11) NOT NULL,
|
||||
`to` int(11) NOT NULL,
|
||||
`message` text NOT NULL,
|
||||
`time` int(11) NOT NULL,
|
||||
`unread` tinyint(1) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@ -212,14 +207,14 @@ CREATE TABLE IF NOT EXISTS `pms` (
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `reports` (
|
||||
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`time` int(11) NOT NULL,
|
||||
`ip` varchar(45) NOT NULL,
|
||||
`board` varchar(120) DEFAULT NULL,
|
||||
`ip` varchar(39) CHARACTER SET ascii NOT NULL,
|
||||
`board` varchar(120) CHARACTER SET ascii DEFAULT NULL,
|
||||
`post` int(11) NOT NULL,
|
||||
`reason` text NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=3 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@ -228,9 +223,9 @@ CREATE TABLE IF NOT EXISTS `reports` (
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `robot` (
|
||||
`hash` varchar(40) NOT NULL COMMENT 'SHA1',
|
||||
`hash` varchar(40) COLLATE ascii_bin NOT NULL COMMENT 'SHA1',
|
||||
PRIMARY KEY (`hash`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=ascii COLLATE=ascii_bin;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@ -243,7 +238,7 @@ CREATE TABLE IF NOT EXISTS `theme_settings` (
|
||||
`name` varchar(40) DEFAULT NULL,
|
||||
`value` text,
|
||||
KEY `theme` (`theme`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
|
5
post.php
5
post.php
@ -378,7 +378,10 @@ if (isset($_POST['delete'])) {
|
||||
|
||||
wordfilters($post['body']);
|
||||
|
||||
$post['body_nomarkup'] = preg_replace('/[\x{010000}-\x{ffffff}]/u', '', $post['body']);
|
||||
if (mysql_version() >= 50503)
|
||||
$post['body_nomarkup'] = $post['body']; // Assume we're using the utf8mb4 charset
|
||||
else
|
||||
$post['body_nomarkup'] = preg_replace('/[\x{010000}-\x{ffffff}]/u', '', $post['body']); // MySQL's `utf8` charset only supports up to 3-byte symbols
|
||||
|
||||
if (!($mod && isset($post['raw']) && $post['raw']))
|
||||
$post['tracked_cites'] = markup($post['body'], true);
|
||||
|
@ -1,32 +1,33 @@
|
||||
CREATE TABLE IF NOT EXISTS `posts_{{ board }}` (
|
||||
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`thread` int(11) DEFAULT NULL,
|
||||
`subject` varchar(100) DEFAULT NULL,
|
||||
`email` varchar(30) DEFAULT NULL,
|
||||
`name` varchar(35) DEFAULT NULL,
|
||||
`trip` varchar(15) DEFAULT NULL,
|
||||
`capcode` varchar(50) DEFAULT NULL,
|
||||
`body` text NOT NULL,
|
||||
`body_nomarkup` text DEFAULT NULL,
|
||||
`time` int(11) NOT NULL,
|
||||
`bump` int(11) DEFAULT NULL,
|
||||
`thumb` varchar(50) DEFAULT NULL,
|
||||
`thumbwidth` int(11) DEFAULT NULL,
|
||||
`thumbheight` int(11) DEFAULT NULL,
|
||||
`file` varchar(50) DEFAULT NULL,
|
||||
`filewidth` int(11) DEFAULT NULL,
|
||||
`fileheight` int(11) DEFAULT NULL,
|
||||
`filesize` int(11) DEFAULT NULL,
|
||||
`filename` text DEFAULT NULL,
|
||||
`filehash` text DEFAULT NULL,
|
||||
`password` varchar(20) DEFAULT NULL,
|
||||
`ip` varchar(45) NOT NULL,
|
||||
`sticky` int(1) NOT NULL,
|
||||
`locked` int(1) NOT NULL,
|
||||
`sage` int(1) NOT NULL,
|
||||
`embed` text,
|
||||
UNIQUE KEY `id` (`id`),
|
||||
KEY `thread_id` (`thread`, `id`),
|
||||
KEY `time` (`time`),
|
||||
FULLTEXT KEY `body` (`body`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`thread` int(11) DEFAULT NULL,
|
||||
`subject` varchar(100) DEFAULT NULL,
|
||||
`email` varchar(30) DEFAULT NULL,
|
||||
`name` varchar(35) DEFAULT NULL,
|
||||
`trip` varchar(15) DEFAULT NULL,
|
||||
`capcode` varchar(50) DEFAULT NULL,
|
||||
`body` text NOT NULL,
|
||||
`body_nomarkup` text,
|
||||
`time` int(11) NOT NULL,
|
||||
`bump` int(11) DEFAULT NULL,
|
||||
`thumb` varchar(50) DEFAULT NULL,
|
||||
`thumbwidth` int(11) DEFAULT NULL,
|
||||
`thumbheight` int(11) DEFAULT NULL,
|
||||
`file` varchar(50) DEFAULT NULL,
|
||||
`filewidth` int(11) DEFAULT NULL,
|
||||
`fileheight` int(11) DEFAULT NULL,
|
||||
`filesize` int(11) DEFAULT NULL,
|
||||
`filename` text,
|
||||
`filehash` text CHARACTER SET ascii,
|
||||
`password` varchar(20) DEFAULT NULL,
|
||||
`ip` varchar(39) CHARACTER SET ascii NOT NULL,
|
||||
`sticky` int(1) NOT NULL,
|
||||
`locked` int(1) NOT NULL,
|
||||
`sage` int(1) NOT NULL,
|
||||
`embed` text,
|
||||
UNIQUE KEY `id` (`id`),
|
||||
KEY `thread_id` (`thread`,`id`),
|
||||
KEY `time` (`time`),
|
||||
FULLTEXT KEY `body` (`body`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ;
|
||||
|
Loading…
Reference in New Issue
Block a user