From 08ca84a3e7fe7f8aa837792be9f3a55e62f77345 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 31 Jul 2011 15:34:45 +0200 Subject: [ticket/10299] Fix typo in comment about $max_store_length in truncate_string() PHPBB3-10299 --- phpBB/includes/functions_content.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_content.php') diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index faff9dd0de..b7650ecd6a 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -1107,7 +1107,7 @@ function extension_allowed($forum_id, $extension, &$extensions) * @param int $max_length Maximum length of string (multibyte character count as 1 char / Html entity count as 1 char) * @param int $max_store_length Maximum character length of string (multibyte character count as 1 char / Html entity count as entity chars). * @param bool $allow_reply Allow Re: in front of string -* NOTE: This parameter can cause undesired behavior (returning strings longer than $max_store_legnth) and is deprecated. +* NOTE: This parameter can cause undesired behavior (returning strings longer than $max_store_length) and is deprecated. * @param string $append String to be appended */ function truncate_string($string, $max_length = 60, $max_store_length = 255, $allow_reply = false, $append = '') -- cgit v1.2.1 From f9dbe33fa7917b6220a85a01ed9f395f3f1bb888 Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Thu, 14 Jul 2011 18:05:34 +0100 Subject: [ticket/10240] Added code to strip control characters from messages. It is possible to evade the word filter using control characters. Seeing as control characters have no practical application in a bulletin board software, it doesn't do any harm to remove them entirely. That is what this commit does. PHPBB3-10240 --- phpBB/includes/functions_content.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'phpBB/includes/functions_content.php') diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index faff9dd0de..872ee8c7cc 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -691,6 +691,9 @@ function censor_text($text) return ''; } + // Strip control characters + $text = preg_replace('/[\x00-\x0f]/', '', $text); + // 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 From 459207636699ce5c554af115a7677f42630a430e Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Sun, 21 Aug 2011 13:14:30 +0100 Subject: [ticket/10240] Reverted a commit which added buggy code. This reverts commit f9dbe33fa7917b6220a85a01ed9f395f3f1bb888. The code which was added also removed new lines and tabs. PHPBB3-10240 --- phpBB/includes/functions_content.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'phpBB/includes/functions_content.php') diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index b34976db2a..b7650ecd6a 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -691,9 +691,6 @@ function censor_text($text) return ''; } - // Strip control characters - $text = preg_replace('/[\x00-\x0f]/', '', $text); - // 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 From 88ae40a4b19360645d5e5a614cc378e7cce4afe3 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 14 Sep 2011 00:28:52 +0200 Subject: [ticket/10345] Make use of the plural function in some basic places PHPBB3-10345 --- phpBB/includes/functions_content.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'phpBB/includes/functions_content.php') diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index b1294a2f14..894e261c12 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -938,12 +938,12 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, } $download_link = append_sid("{$phpbb_root_path}download/file.$phpEx", 'id=' . $attachment['attach_id']); + $l_downloaded_viewed = 'VIEWED_COUNTS'; switch ($display_cat) { // Images case ATTACHMENT_CATEGORY_IMAGE: - $l_downloaded_viewed = 'VIEWED_COUNT'; $inline_link = append_sid("{$phpbb_root_path}download/file.$phpEx", 'id=' . $attachment['attach_id']); $download_link .= '&mode=view'; @@ -957,7 +957,6 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, // Images, but display Thumbnail case ATTACHMENT_CATEGORY_THUMB: - $l_downloaded_viewed = 'VIEWED_COUNT'; $thumbnail_link = append_sid("{$phpbb_root_path}download/file.$phpEx", 'id=' . $attachment['attach_id'] . '&t=1'); $download_link .= '&mode=view'; @@ -971,7 +970,6 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, // Windows Media Streams case ATTACHMENT_CATEGORY_WM: - $l_downloaded_viewed = 'VIEWED_COUNT'; // Giving the filename directly because within the wm object all variables are in local context making it impossible // to validate against a valid session (all params can differ) @@ -990,7 +988,6 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, // Real Media Streams case ATTACHMENT_CATEGORY_RM: case ATTACHMENT_CATEGORY_QUICKTIME: - $l_downloaded_viewed = 'VIEWED_COUNT'; $block_array += array( 'S_RM_FILE' => ($display_cat == ATTACHMENT_CATEGORY_RM) ? true : false, @@ -1007,8 +1004,6 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, case ATTACHMENT_CATEGORY_FLASH: list($width, $height) = @getimagesize($filename); - $l_downloaded_viewed = 'VIEWED_COUNT'; - $block_array += array( 'S_FLASH_FILE' => true, 'WIDTH' => $width, @@ -1021,7 +1016,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, break; default: - $l_downloaded_viewed = 'DOWNLOAD_COUNT'; + $l_downloaded_viewed = 'DOWNLOAD_COUNTS'; $block_array += array( 'S_FILE' => true, @@ -1029,11 +1024,14 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, break; } - $l_download_count = (!isset($attachment['download_count']) || $attachment['download_count'] == 0) ? $user->lang[$l_downloaded_viewed . '_NONE'] : (($attachment['download_count'] == 1) ? sprintf($user->lang[$l_downloaded_viewed], $attachment['download_count']) : sprintf($user->lang[$l_downloaded_viewed . 'S'], $attachment['download_count'])); + if (!isset($attachment['download_count'])) + { + $attachment['download_count'] = 0; + } $block_array += array( 'U_DOWNLOAD_LINK' => $download_link, - 'L_DOWNLOAD_COUNT' => $l_download_count + 'L_DOWNLOAD_COUNT' => $user->lang($l_downloaded_viewed, (int) $attachment['download_count']), ); } -- cgit v1.2.1 From 7a04c9048c110f0bd21ea3e9e869e17b408d640e Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 31 Dec 2011 13:32:52 +0000 Subject: [ticket/9916] Updating header license and removing Version $Id$ PHPBB3-9916 --- phpBB/includes/functions_content.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'phpBB/includes/functions_content.php') diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 894e261c12..3a0124934e 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -2,9 +2,8 @@ /** * * @package phpBB3 -* @version $Id$ * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ -- cgit v1.2.1 From 4f59990d900b699cdd2cfe4b43e6972bf99d977b Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Fri, 9 Mar 2012 07:34:52 +0000 Subject: [ticket/10510] Added phpbb_add_quickmod_option and moved existing to it. PHPBB3-10510 --- phpBB/includes/functions_content.php | 19 +++++++++++++++++-- 1 file changed, 17 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 3a0124934e..b9ab2d8a7a 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -1103,8 +1103,8 @@ function extension_allowed($forum_id, $extension, &$extensions) * @param string $string The text to truncate to the given length. String is specialchared. * @param int $max_length Maximum length of string (multibyte character count as 1 char / Html entity count as 1 char) * @param int $max_store_length Maximum character length of string (multibyte character count as 1 char / Html entity count as entity chars). -* @param bool $allow_reply Allow Re: in front of string -* NOTE: This parameter can cause undesired behavior (returning strings longer than $max_store_length) and is deprecated. +* @param bool $allow_reply Allow Re: in front of string +* NOTE: This parameter can cause undesired behavior (returning strings longer than $max_store_length) and is deprecated. * @param string $append String to be appended */ function truncate_string($string, $max_length = 60, $max_store_length = 255, $allow_reply = false, $append = '') @@ -1258,6 +1258,21 @@ function get_username_string($mode, $user_id, $username, $username_colour = '', return str_replace(array('{PROFILE_URL}', '{USERNAME_COLOUR}', '{USERNAME}'), array($profile_url, $username_colour, $username), (!$username_colour) ? $_profile_cache['tpl_profile'] : $_profile_cache['tpl_profile_colour']); } +/** + * Add an option to the quick-mod tools. + * + * @param string $option The value of the option. + * @param string $lang_string The language string to use. + */ +function phpbb_add_quickmod_option($option, $lang_string, $condition = true) +{ + global $template; + $template->assign_block_vars('quickmod', array( + 'VALUE' => $option, + 'TITLE' => $lang_string, + )); +} + /** * @package phpBB3 */ -- cgit v1.2.1 From 784c9725f3394ce866ab260485b32d501e07a628 Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Sun, 11 Mar 2012 19:20:13 +0000 Subject: [ticket/10510] Made a couple improvements to phpbb_add_quickmod_option. PHPBB3-10510 --- phpBB/includes/functions_content.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_content.php') diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index b9ab2d8a7a..872d071b91 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -1264,7 +1264,7 @@ function get_username_string($mode, $user_id, $username, $username_colour = '', * @param string $option The value of the option. * @param string $lang_string The language string to use. */ -function phpbb_add_quickmod_option($option, $lang_string, $condition = true) +function phpbb_add_quickmod_option($option, $lang_string) { global $template; $template->assign_block_vars('quickmod', array( -- cgit v1.2.1 From 79a987ffcb19832e1ddefe8be535b181f8acbd73 Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Mon, 12 Mar 2012 07:43:01 +0000 Subject: [ticket/10510] Moved a $user->lang call into the function. PHPBB3-10510 --- phpBB/includes/functions_content.php | 5 +++-- 1 file changed, 3 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 872d071b91..f2faf20f43 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -1261,12 +1261,13 @@ function get_username_string($mode, $user_id, $username, $username_colour = '', /** * Add an option to the quick-mod tools. * - * @param string $option The value of the option. + * @param string $option The language key for the value of the option. * @param string $lang_string The language string to use. */ function phpbb_add_quickmod_option($option, $lang_string) { - global $template; + global $template, $user; + $lang_string = $user->lang($lang_string); $template->assign_block_vars('quickmod', array( 'VALUE' => $option, 'TITLE' => $lang_string, -- cgit v1.2.1 From 06d26ef46e914c823889dab37627e7fa39d883ce Mon Sep 17 00:00:00 2001 From: Hari Sankar R Date: Mon, 2 Apr 2012 00:35:39 +0530 Subject: [ticket/10438] Alligning the Smileys on the same line as the text. Changed the styling of smilies to appear at the same level as text, by adding vertical-align: text-bottom css property to all smilies. Edited functions_content.php to add class="smilies" to all parsed smilies. PHPBB3-10438 --- phpBB/includes/functions_content.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_content.php') diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index f2faf20f43..6b2ee98d7a 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -739,7 +739,7 @@ function smiley_text($text, $force_option = false) else { $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_root_path; - return preg_replace('#', $text); + return preg_replace('#