Hard Light Productions Forums

Site Management => Site Support / Feedback => Topic started by: NGTM-1R on May 19, 2012, 06:34:06 am

Title: Hey, y'all are screwing up my Let's Play.
Post by: NGTM-1R on May 19, 2012, 06:34:06 am
The forum is automatically censoring image links with profanity in them, and thereby breaking the links. You might want to consider looking at that.
Title: Re: Hey, y'all are screwing up my Let's Play.
Post by: Goober5000 on May 19, 2012, 06:26:53 pm
If anyone knows how to rewrite this section of PHP to not censor text within BBCode, I'd be happy to merge the fixes:

Code: [Select]
if ((!empty($options['show_no_censored']) && $settings['allow_no_censored'] && !$force) || empty($modSettings['censor_vulgar']))
return $text;

// If they haven't yet been loaded, load them.
if ($censor_vulgar == null)
{
$censor_vulgar = explode("\n", $modSettings['censor_vulgar']);
$censor_proper = explode("\n", $modSettings['censor_proper']);

// Quote them for use in regular expressions.
for ($i = 0, $n = count($censor_vulgar); $i < $n; $i++)
{
$censor_vulgar[$i] = strtr(preg_quote($censor_vulgar[$i], '/'), array('\\\\\\*' => '[*]', '\\*' => '[^\s]*?', '&' => '&amp;'));
$censor_vulgar[$i] = (empty($modSettings['censorWholeWord']) ? '/' . $censor_vulgar[$i] . '/' : '/(?<=^|\W)' . $censor_vulgar[$i] . '(?=$|\W)/') . (empty($modSettings['censorIgnoreCase']) ? '' : 'i') . ((empty($modSettings['global_character_set']) ? $txt['lang_character_set'] : $modSettings['global_character_set']) === 'UTF-8' ? 'u' : '');

if (strpos($censor_vulgar[$i], '\'') !== false)
{
$censor_proper[count($censor_vulgar)] = $censor_proper[$i];
$censor_vulgar[count($censor_vulgar)] = strtr($censor_vulgar[$i], array('\'' => '&#039;'));
}
}
}

// Censoring isn't so very complicated :P.
$text = preg_replace($censor_vulgar, $censor_proper, $text);
return $text;