Browse Source

Fix issue #74. Note: This bug may break the display of certain filenames prior to upgrade.

pull/40/head
Michael Foster 11 years ago
parent
commit
d692bce686
  1. 6
      post.php
  2. 4
      templates/post_reply.html

6
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'];

4
templates/post_reply.html

@ -66,9 +66,9 @@
{% if config.show_filename and post.filename %}
,
{% if post.filename|length > config.max_filename_display %}
<span class="postfilename" title="{{ post.filename|bidi_cleanup }}">{{ post.filename|truncate(config.max_filename_display)|bidi_cleanup }}</span>
<span class="postfilename" title="{{ post.filename|e|bidi_cleanup }}">{{ post.filename|truncate(config.max_filename_display)|bidi_cleanup }}</span>
{% else %}
<span class="postfilename">{{ post.filename|bidi_cleanup }}</span>
<span class="postfilename">{{ post.filename|e|bidi_cleanup }}</span>
{% endif %}
{% endif %}
{% if post.thumb != 'file' and config.image_identification %}

Loading…
Cancel
Save