phpBB

Code Changes

File: includes/functions_content.php

  Unmodified   Added   Modified   Removed
Line 336Line 336
	$text = str_replace($entities, $characters, $text);

$word_indizes = array();

	$text = str_replace($entities, $characters, $text);

$word_indizes = array();

	if (sizeof($words))

	if (count($words))

	{
$match = '';
// find the starting indizes of all words

	{
$match = '';
// find the starting indizes of all words

Line 361Line 361
		}
unset($match);


		}
unset($match);


		if (sizeof($word_indizes))

		if (count($word_indizes))

		{
$word_indizes = array_unique($word_indizes);
sort($word_indizes);


		{
$word_indizes = array_unique($word_indizes);
sort($word_indizes);


			$wordnum = sizeof($word_indizes);

			$wordnum = count($word_indizes);

			// number of characters on the right and left side of each word
$sequence_length = (int) ($length / (2 * $wordnum)) - 2;
$final_text = '';

			// number of characters on the right and left side of each word
$sequence_length = (int) ($length / (2 * $wordnum)) - 2;
$final_text = '';

Line 434Line 434
		}
}


		}
}


	if (!sizeof($words) || !sizeof($word_indizes))

	if (!count($words) || !count($word_indizes))

	{
return str_replace($characters, $entities, ((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));
}

Line 557Line 557
function generate_text_for_display($text, $uid, $bitfield, $flags, $censor_text = true)
{
static $bbcode;

function generate_text_for_display($text, $uid, $bitfield, $flags, $censor_text = true)
{
static $bbcode;

 
	global $auth, $config, $user;

	global $phpbb_dispatcher, $phpbb_container;

if ($text === '')

	global $phpbb_dispatcher, $phpbb_container;

if ($text === '')

Line 584Line 585

// Temporarily switch off viewcensors if applicable
$old_censor = $renderer->get_viewcensors();


// Temporarily switch off viewcensors if applicable
$old_censor = $renderer->get_viewcensors();

 

// Check here if the user is having viewing censors disabled (and also allowed to do so).
if (!$user->optionget('viewcensors') && $config['allow_nocensors'] && $auth->acl_get('u_chgcensors'))
{
$censor_text = false;
}


		if ($old_censor !== $censor_text)
{
$renderer->set_viewcensors($censor_text);

		if ($old_censor !== $censor_text)
{
$renderer->set_viewcensors($censor_text);

Line 1013Line 1021
		}
}


		}
}


	if (sizeof($censors))

	if (count($censors))

	{
return preg_replace($censors['match'], $censors['replace'], $text);
}

	{
return preg_replace($censors['match'], $censors['replace'], $text);
}

Line 1071Line 1079
*/
function parse_attachments($forum_id, &$message, &$attachments, &$update_count_ary, $preview = false)
{

*/
function parse_attachments($forum_id, &$message, &$attachments, &$update_count_ary, $preview = false)
{

	if (!sizeof($attachments))

	if (!count($attachments))

	{
return;
}

	{
return;
}

Line 1106Line 1114
	}

// Grab attachments (security precaution)

	}

// Grab attachments (security precaution)

	if (sizeof($attach_ids))

	if (count($attach_ids))

	{
global $db;


	{
global $db;


Line 1143Line 1151

foreach ($attachments as $attachment)
{


foreach ($attachments as $attachment)
{

		if (!sizeof($attachment))

		if (!count($attachment))

		{
continue;
}

		{
continue;
}

Line 1435Line 1443
	$chars = array_map('utf8_htmlspecialchars', $_chars);

// Now check the length ;)

	$chars = array_map('utf8_htmlspecialchars', $_chars);

// Now check the length ;)

	if (sizeof($chars) > $max_length)

	if (count($chars) > $max_length)

	{
// Cut off the last elements from the array
$string = implode('', array_slice($chars, 0, $max_length - utf8_strlen($append)));

	{
// Cut off the last elements from the array
$string = implode('', array_slice($chars, 0, $max_length - utf8_strlen($append)));

Line 1643Line 1651
		return '';
}


		return '';
}


	$count = sizeof($items);

	$count = count($items);

	$last_item = array_pop($items);
$lang_key = 'STRING_LIST_MULTI';


	$last_item = array_pop($items);
$lang_key = 'STRING_LIST_MULTI';