From 54ee31972af4f84e09ad5b12ca512e5712bbd87a Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 11 Jul 2009 10:05:20 +0000 Subject: Fix bug #47775 - Properly convert and show filesize information Authorised by: naderman git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9748 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_content.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'phpBB/includes/functions_content.php') diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 3107177137..630f4105d0 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -853,16 +853,14 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, } } - $filesize = $attachment['filesize']; - $size_lang = ($filesize >= 1048576) ? $user->lang['MIB'] : (($filesize >= 1024) ? $user->lang['KIB'] : $user->lang['BYTES']); - $filesize = get_formatted_filesize($filesize, false); + $filesize = get_formatted_filesize($attachment['filesize'], false); $comment = bbcode_nl2br(censor_text($attachment['attach_comment'])); $block_array += array( 'UPLOAD_ICON' => $upload_icon, - 'FILESIZE' => $filesize, - 'SIZE_LANG' => $size_lang, + 'FILESIZE' => $filesize['value'], + 'SIZE_LANG' => $filesize['unit'], 'DOWNLOAD_NAME' => basename($attachment['real_filename']), 'COMMENT' => $comment, ); -- cgit v1.2.1 From 433f03107de1162744a1d0b8c9fa3c4ba1b3ed21 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 24 Jul 2009 08:56:06 +0000 Subject: Fix bug #31505 - Do not cut post-message in between HTML-Entities on search.php - Patch by leviatan21 Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9842 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_content.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/functions_content.php') diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 630f4105d0..de5df37299 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -250,6 +250,11 @@ function get_context($text, $words, $length = 400) // first replace all whitespaces with single spaces $text = preg_replace('/ +/', ' ', strtr($text, "\t\n\r\x0C ", ' ')); + // we need to turn the entities back into their original form, to not cut the message in between them + $entities = array('<', '>', '[', ']', '.', ':', ':'); + $characters = array('<', '>', '[', ']', '.', ':', ':'); + $text = str_replace($entities, $characters, $text); + $word_indizes = array(); if (sizeof($words)) { @@ -345,13 +350,13 @@ function get_context($text, $words, $length = 400) } } } - return $final_text; + return str_replace($characters, $entities, $final_text); } } if (!sizeof($words) || !sizeof($word_indizes)) { - return (utf8_strlen($text) >= $length + 3) ? utf8_substr($text, 0, $length) . '...' : $text; + return str_replace($characters, $entities, ((utf8_strlen($text) >= $length + 3) ? utf8_substr($text, 0, $length) . '...' : $text)); } } -- cgit v1.2.1 From 2958890439f29b9cf45997c52c8cfa57e0f16bc8 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 1 Aug 2009 12:28:50 +0000 Subject: Apply locale-independent basename() to attachment filenames. New function added: utf8_basename(). (Bug #43335 - Patch by ocean=Yohsuke) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9905 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_content.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/functions_content.php') diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index de5df37299..c4ac48e8e8 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -841,8 +841,8 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, // Some basics... $attachment['extension'] = strtolower(trim($attachment['extension'])); - $filename = $phpbb_root_path . $config['upload_path'] . '/' . basename($attachment['physical_filename']); - $thumbnail_filename = $phpbb_root_path . $config['upload_path'] . '/thumb_' . basename($attachment['physical_filename']); + $filename = $phpbb_root_path . $config['upload_path'] . '/' . utf8_basename($attachment['physical_filename']); + $thumbnail_filename = $phpbb_root_path . $config['upload_path'] . '/thumb_' . utf8_basename($attachment['physical_filename']); $upload_icon = ''; @@ -866,7 +866,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, 'UPLOAD_ICON' => $upload_icon, 'FILESIZE' => $filesize['value'], 'SIZE_LANG' => $filesize['unit'], - 'DOWNLOAD_NAME' => basename($attachment['real_filename']), + 'DOWNLOAD_NAME' => utf8_basename($attachment['real_filename']), 'COMMENT' => $comment, ); -- cgit v1.2.1 From f7009291e20969421f90ab81eed1347a4d977501 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 17 Aug 2009 14:45:14 +0000 Subject: Ability to define constant PHPBB_USE_BOARD_URL_PATH to use board url for images/avatars/ranks/imageset... This feature does not change anything for those not using the constant and this feature is also quite in-flux. We need to test this with some applications and bridges and there may be other locations able to benefit from it. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10008 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_content.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/functions_content.php') diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index c4ac48e8e8..7a30f0069e 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -733,7 +733,8 @@ function smiley_text($text, $force_option = false) } else { - return preg_replace('#', $text); + $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_root_path; + return preg_replace('#', $text); } } -- cgit v1.2.1 From 5d2e4e88ab3266b44101714a101d337e0053361e Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 21 Aug 2009 09:44:55 +0000 Subject: Allow "0" as censor word and replacement. Only obtain word censor list if text is not empty. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10039 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_content.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'phpBB/includes/functions_content.php') diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 7a30f0069e..c265d0ae41 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -685,6 +685,12 @@ function censor_text($text) { static $censors; + // Nothing to do? + if ($text === '') + { + return ''; + } + // We moved the word censor checks in here because we call this function quite often - and then only need to do the check once if (!isset($censors) || !is_array($censors)) { -- cgit v1.2.1