summaryrefslogtreecommitdiff
path: root/post.php
diff options
context:
space:
mode:
authorczaks <marcin@6irc.net>2013-07-31 14:54:20 -0400
committerczaks <marcin@6irc.net>2013-07-31 14:54:20 -0400
commit55c7146d884005f70d15e991a9e8ea31b7021361 (patch)
tree57b6548601dfd1542febe05375efe49d439e1fb4 /post.php
parentee23ec1e24bb2a0cec24af011012e95652ce85a9 (diff)
parent8e4c493a4c5bbff07483fd4a11c44c687c99e441 (diff)
Merge branch 'master' of https://github.com/savetheinternet/Tinyboard
Conflicts: inc/config.php inc/display.php inc/functions.php inc/image.php js/expand.js js/hide-threads.js js/local-time.js js/smartphone-spoiler.js templates/header.html templates/index.html templates/main.js templates/page.html templates/post_reply.html templates/post_thread.html templates/thread.html
Diffstat (limited to 'post.php')
-rw-r--r--post.php18
1 files changed, 15 insertions, 3 deletions
diff --git a/post.php b/post.php
index d2e92be5..45bca539 100644
--- a/post.php
+++ b/post.php
@@ -380,10 +380,22 @@ if (isset($_POST['delete'])) {
wordfilters($post['body']);
- if (mysql_version() >= 50503)
+ 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
+ } 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);
+ $post['body_nomarkup'] = '';
+ foreach ($chars as $char) {
+ $o = 0;
+ $ord = ordutf8($char, $o);
+ if ($ord >= 0x010000)
+ continue;
+ $post['body_nomarkup'] .= $char;
+ }
+ }
if (!($mod && isset($post['raw']) && $post['raw']))
$post['tracked_cites'] = markup($post['body'], true);