From 9a2e5868e85e20ea9ccad990551d27cc00fb87c4 Mon Sep 17 00:00:00 2001 From: Daniel Winzen Date: Wed, 5 Oct 2016 18:30:44 +0200 Subject: [PATCH] Fix multi-byte after @mention --- README | 4 ++-- README.md | 4 ++-- chat.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README b/README index 9447ed8..42a3e27 100644 --- a/README +++ b/README @@ -39,7 +39,7 @@ You'll need to have php with pdo, pcre, mbstring and date extension and a web-se You will also need the pdo_sqlite, pdo_mysql or pdo_pgsql extension, depending on which database you choose. Optionally, you can install: - the gd extension for the captcha feature -- the json extension for save/restore and a JavaScript helper for clients with enabled JavaScript. +- the json extension for save/restore - a memcached server and the memcached extension and change the configuaration to use memcached. This will lessen the database load a bit. - a MySQL or PostgreSQL server to use as an external database instead of SQLite - the openssl extension for encryption of messages and notes in the database @@ -78,5 +78,5 @@ If you never used regex before, check out this starting guide to begin with regu LIVE DEMO: If you want to see the script in action, you can visit my TOR hidden service http://tt3j2x4k5ycaa5zt.onion/chat.php or via a tor2web proxy like http://tt3j2x4k5ycaa5zt.onion.to/chat.php if you don't have TOR installed. -Considering this is a hidden service, you should be prepared for the worst case, as people often tend to do illegal activities in the TOR network. I'm not online 24/7 so it might not be possible to remove such content right away. +Considering this is a hidden service, you should be prepared for the worst case, as people tend to do illegal activities in the TOR network. I'm not online 24/7 so it might not be possible to remove such content right away. If you should see illegal content, don't panic. Use the contact form on my site to notify me and clean your browser cache afterwards. diff --git a/README.md b/README.md index f383741..ba8e943 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ You'll need to have php with pdo, pcre, mbstring and date extension and a web-se You will also need the pdo_sqlite, pdo_mysql or pdo_pgsql extension, depending on which database you choose. Optionally, you can install: - the gd extension for the captcha feature -- the json extension for save/restore and a JavaScript helper for clients with enabled JavaScript. +- the json extension for save/restore - a memcached server and the memcached extension and change the configuaration to use memcached. This will lessen the database load a bit. - a MySQL or PostgreSQL server to use as an external database instead of SQLite - the openssl extension for encryption of messages and notes in the database @@ -84,5 +84,5 @@ Live demo: ---------- If you want to see the script in action, you can visit my [TOR hidden service](http://tt3j2x4k5ycaa5zt.onion/chat.php) or via a tor2web proxy like [this one](http://tt3j2x4k5ycaa5zt.onion.to/chat.php) if you don't have TOR installed. -Considering this is a hidden service, you should be prepared for the worst case, as people often tend to do illegal activities in the TOR network. I'm not online 24/7 so it might not be possible to remove such content right away. +Considering this is a hidden service, you should be prepared for the worst case, as people tend to do illegal activities in the TOR network. I'm not online 24/7 so it might not be possible to remove such content right away. If you should see illegal content, don't panic. Use the contact form on my site to notify me and clean your browser cache afterwards. I will remove the content as soon as possible. diff --git a/chat.php b/chat.php index 3414de0..28468e3 100644 --- a/chat.php +++ b/chat.php @@ -2997,8 +2997,8 @@ function apply_filter(){ if(strlen($nick)===1){ break; } - $rest=substr($nick, -1).$rest; - $nick=substr($nick, 0, -1); + $rest=mb_substr($nick, -1).$rest; + $nick=mb_substr($nick, 0, -1); } return "$matched[0]"; }, $U['message']);