diff --git a/inc/database.php b/inc/database.php index b3fb24b0..f5ea73bd 100644 --- a/inc/database.php +++ b/inc/database.php @@ -101,12 +101,6 @@ function sql_open() { } } -// 5.6.10 becomes 50610 HACK: hardcoded to be above critical value 50803 due to laziness -function mysql_version() { - // TODO delete all references of this function everywhere - return 80504; -} - function prepare($query) { global $pdo, $debug, $config; diff --git a/inc/functions.php b/inc/functions.php index 5d0d6933..eecf7eb1 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -2082,9 +2082,6 @@ function markup(&$body, $track_cites = false, $op = 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'); - if ($config['markup_code']) { $code_markup = array(); $body = preg_replace_callback($config['markup_code'], function($matches) use (&$code_markup) { diff --git a/inc/mod/pages.php b/inc/mod/pages.php index f45fd839..b980c844 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -520,9 +520,6 @@ function mod_new_board() { $query = Element('posts.sql', array('board' => $board['uri'])); - if (mysql_version() < 50503) - $query = preg_replace('/(CHARSET=|CHARACTER SET )utf8mb4/', '$1utf8', $query); - query($query) or error(db_error()); if ($config['cache']['enabled']) diff --git a/install.php b/install.php index 94a589b1..bc3ba7d4 100644 --- a/install.php +++ b/install.php @@ -52,11 +52,7 @@ if (file_exists($config['has_installed'])) { function __query($sql) { sql_open(); - - if (mysql_version() >= 50503) - return query($sql); - else - return query(str_replace('utf8mb4', 'utf8', $sql)); + return query($sql); } $boards = listBoards(); @@ -939,7 +935,6 @@ if ($step == 0) { $sql = @file_get_contents('install.sql') or error("Couldn't load install.sql."); sql_open(); - $mysql_version = mysql_version(); // This code is probably horrible, but what I'm trying // to do is find all of the SQL queires and put them @@ -952,8 +947,6 @@ if ($step == 0) { $sql_errors = ''; $sql_err_count = 0; foreach ($queries as $query) { - if ($mysql_version < 50503) - $query = preg_replace('/(CHARSET=|CHARACTER SET )utf8mb4/', '$1utf8', $query); $query = preg_replace('/^([\w\s]*)`([0-9a-zA-Z$_\x{0080}-\x{FFFF}]+)`/u', '$1``$2``', $query); if (!query($query)) { $sql_err_count++; diff --git a/post.php b/post.php index ebb1d474..bebb2fa0 100644 --- a/post.php +++ b/post.php @@ -35,35 +35,6 @@ function md5_hash_of_file($config, $file) } } -/** - * Strip the markup from the given string - * - * @param string $post_body The body of the post. - * @return string - */ -function strip_markup($post_body) -{ - if (mysql_version() >= 50503) { - // Assume we're using the utf8mb4 charset. - return $post_body; - } else { - // MySQL's `utf8` charset only supports up to 3-byte symbols. - // Remove anything >= 0x010000. - - $chars = preg_split('//u', $post_body, -1, PREG_SPLIT_NO_EMPTY); - $res = ''; - foreach ($chars as $char) { - $o = 0; - $ord = ordutf8($char, $o); - if ($ord >= 0x010000) - continue; - $res .= $char; - } - - return $res; - } -} - /** * Checks if the user at the remote ip passed the captcha. * @@ -1314,7 +1285,7 @@ function handle_post() } } - $post['body_nomarkup'] = strip_markup($post['body']); + $post['body_nomarkup'] = $post['body']; $post['tracked_cites'] = markup($post['body'], true); if ($post['has_file']) {