From dc1d1a3fcd0e6a9e4f1ba791e15765d68b09e6dc Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 16:22:27 -0400 Subject: Issue #125 --- inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo | Bin 19790 -> 19840 bytes inc/locale/pl_PL/LC_MESSAGES/tinyboard.po | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo index 2a31d64e..bc603e67 100644 Binary files a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo and b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo differ diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po index ca4f7ea4..20802b7d 100644 --- a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po +++ b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po @@ -16,7 +16,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" #. There is no previous page. #: /var/www/html/Tinyboard/inc/functions.php:958 -- cgit v1.3 From d692bce68674934a4af2e9cba79d65e72279b0a9 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 16:34:50 -0400 Subject: Fix issue #74. Note: This bug may break the display of certain filenames prior to upgrade. --- post.php | 6 +++--- templates/post_reply.html | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/post.php b/post.php index a82b56ad..8820db2d 100644 --- a/post.php +++ b/post.php @@ -284,7 +284,7 @@ if (isset($_POST['delete'])) { $post['has_file'] = !isset($post['embed']) && (($post['op'] && !isset($post['no_longer_require_an_image_for_op']) && $config['force_image_op']) || (isset($_FILES['file']) && $_FILES['file']['tmp_name'] != '')); if ($post['has_file']) - $post['filename'] = utf8tohtml(get_magic_quotes_gpc() ? stripslashes($_FILES['file']['name']) : $_FILES['file']['name']); + $post['filename'] = urldecode(get_magic_quotes_gpc() ? stripslashes($_FILES['file']['name']) : $_FILES['file']['name']); if (!($post['has_file'] || isset($post['embed'])) || (($post['op'] && $config['force_body_op']) || (!$post['op'] && $config['force_body']))) { $stripped_whitespace = preg_replace('/[\s]/u', '', $post['body']); @@ -347,7 +347,7 @@ if (isset($_POST['delete'])) { } else $noko = false; if ($post['has_file']) { - $post['extension'] = strtolower(substr($post['filename'], strrpos($post['filename'], '.') + 1)); + $post['extension'] = strtolower(mb_substr($post['filename'], mb_strrpos($post['filename'], '.') + 1)); if (isset($config['filename_func'])) $post['file_id'] = $config['filename_func']($post); else @@ -414,7 +414,7 @@ if (isset($_POST['delete'])) { $is_an_image = !in_array($post['extension'], $config['allowed_ext_files']); // Truncate filename if it is too long - $post['filename'] = substr($post['filename'], 0, $config['max_filename_len']); + $post['filename'] = mb_substr($post['filename'], 0, $config['max_filename_len']); $upload = $_FILES['file']['tmp_name']; diff --git a/templates/post_reply.html b/templates/post_reply.html index bc96e74c..b0391f19 100644 --- a/templates/post_reply.html +++ b/templates/post_reply.html @@ -66,9 +66,9 @@ {% if config.show_filename and post.filename %} , {% if post.filename|length > config.max_filename_display %} - {{ post.filename|truncate(config.max_filename_display)|bidi_cleanup }} + {{ post.filename|truncate(config.max_filename_display)|bidi_cleanup }} {% else %} - {{ post.filename|bidi_cleanup }} + {{ post.filename|e|bidi_cleanup }} {% endif %} {% endif %} {% if post.thumb != 'file' and config.image_identification %} -- cgit v1.3 From 6cdf6038754f18af4509ecf078f51894f63c5853 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 16:38:09 -0400 Subject: Fix last commit; Make Tinyboard Twig extension more mb-safe --- inc/lib/Twig/Extensions/Extension/Tinyboard.php | 8 ++++---- templates/post_thread.html | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/inc/lib/Twig/Extensions/Extension/Tinyboard.php b/inc/lib/Twig/Extensions/Extension/Tinyboard.php index 61cf9fc9..58a98c40 100644 --- a/inc/lib/Twig/Extensions/Extension/Tinyboard.php +++ b/inc/lib/Twig/Extensions/Extension/Tinyboard.php @@ -83,9 +83,9 @@ function twig_hasPermission_filter($mod, $permission, $board = null) { } function twig_extension_filter($value, $case_insensitive = true) { - $ext = substr($value, strrpos($value, '.') + 1); + $ext = mb_substr($value, mb_strrpos($value, '.') + 1); if($case_insensitive) - $ext = strtolower($ext); + $ext = mb_strtolower($ext); return $ext; } @@ -96,11 +96,11 @@ function twig_sprintf_filter( $value, $var) { function twig_truncate_filter($value, $length = 30, $preserve = false, $separator = '…') { if (mb_strlen($value) > $length) { if ($preserve) { - if (false !== ($breakpoint = strpos($value, ' ', $length))) { + if (false !== ($breakpoint = mb_strpos($value, ' ', $length))) { $length = $breakpoint; } } - return substr($value, 0, $length) . $separator; + return mb_substr($value, 0, $length) . $separator; } return $value; } diff --git a/templates/post_thread.html b/templates/post_thread.html index 6d14f207..21add308 100644 --- a/templates/post_thread.html +++ b/templates/post_thread.html @@ -23,9 +23,9 @@ {% if config.show_filename and post.filename %} , {% if post.filename|length > config.max_filename_display %} - {{ post.filename|truncate(config.max_filename_display)|bidi_cleanup }} + {{ post.filename|truncate(config.max_filename_display)|bidi_cleanup }} {% else %} - {{ post.filename|bidi_cleanup }} + {{ post.filename|e|bidi_cleanup }} {% endif %} {% endif %} {% if post.thumb != 'file' and config.image_identification %} -- cgit v1.3