summaryrefslogtreecommitdiff
path: root/post.php
diff options
context:
space:
mode:
authorczaks <marcin@6irc.net>2013-07-31 02:30:44 -0400
committerczaks <marcin@6irc.net>2013-07-31 02:30:44 -0400
commit96bcf5dd1e8e09bce46c80291a24562d64ebc8dc (patch)
tree3721653471b6586c6fb7c09d4100810c6b419faa /post.php
parent793042ee6ccd2fd1770c68ed55bfb1f58f2bf185 (diff)
parentb22bcdecf9cce8b08c48283290173996b6c8abf2 (diff)
Merge branch 'master' of https://github.com/savetheinternet/Tinyboard
Conflicts: inc/functions.php inc/mod/pages.php install.php js/expand.js mod.php
Diffstat (limited to 'post.php')
-rw-r--r--post.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/post.php b/post.php
index 062acc5f..d2e92be5 100644
--- a/post.php
+++ b/post.php
@@ -172,7 +172,7 @@ if (isset($_POST['delete'])) {
error($config['error']['bot']);
// Check the referrer
- if (!isset($_SERVER['HTTP_REFERER']) || !preg_match($config['referer_match'], $_SERVER['HTTP_REFERER']))
+ if (!isset($_SERVER['HTTP_REFERER']) || !preg_match($config['referer_match'], urldecode($_SERVER['HTTP_REFERER'])))
error($config['error']['referer']);
checkDNSBL();
@@ -380,7 +380,10 @@ if (isset($_POST['delete'])) {
wordfilters($post['body']);
- $post['body_nomarkup'] = $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);
@@ -546,9 +549,9 @@ if (isset($_POST['delete'])) {
// Remove board directories before inserting them into the database.
if ($post['has_file']) {
$post['file_path'] = $post['file'];
- $post['file'] = substr_replace($post['file'], '', 0, mb_strlen($board['dir'] . $config['dir']['img']));
+ $post['file'] = mb_substr($post['file'], mb_strlen($board['dir'] . $config['dir']['img']));
if ($is_an_image && $post['thumb'] != 'spoiler')
- $post['thumb'] = substr_replace($post['thumb'], '', 0, mb_strlen($board['dir'] . $config['dir']['thumb']));
+ $post['thumb'] = mb_substr($post['thumb'], mb_strlen($board['dir'] . $config['dir']['thumb']));
}
$post = (object)$post;