|
@@ -267,11 +267,11 @@ function un_preparsecode($message)
|
|
|
// If $i is a multiple of four (0, 4, 8, ...) then it's not a code section...
|
|
|
if ($i % 4 == 0)
|
|
|
{
|
|
|
- $parts[$i] = preg_replace('~\[html\](.+?)\[/html\]~ie', '\'[html]\' . strtr(htmlspecialchars(\'$1\', ENT_QUOTES), array(\'\\"\' => \'"\', \'&#13;\' => \'<br />\', \'&#32;\' => \' \', \'&#91;\' => \'[\', \'&#93;\' => \']\')) . \'[/html]\'', $parts[$i]);
|
|
|
- // $parts[$i] = preg_replace('~\[html\](.+?)\[/html\]~ie', '\'[html]\' . strtr(htmlspecialchars(\'$1\', ENT_QUOTES), array(\'\\"\' => \'"\', \'&#13;\' => \'<br />\', \'&#32;\' => \' \', \'&#38;\' => \'&\', \'&#91;\' => \'[\', \'&#93;\' => \']\')) . \'[/html]\'', $parts[$i]);
|
|
|
+ $parts[$i] = preg_replace_callback('~\[html\](.+?)\[/html\]~i', create_function('$m', 'return \'[html]\' . strtr(htmlspecialchars(\'$m[1]\', ENT_QUOTES), array(\'\\"\' => \'"\', \'&#13;\' => \'<br />\', \'&#32;\' => \' \', \'&#91;\' => \'[\', \'&#93;\' => \']\')) . \'[/html]\';
|
|
|
+'), $parts[$i]);
|
|
|
|
|
|
// Attempt to un-parse the time to something less awful.
|
|
|
- $parts[$i] = preg_replace('~\[time\](\d{0,10})\[/time\]~ie', '\'[time]\' . timeformat(\'$1\', false) . \'[/time]\'', $parts[$i]);
|
|
|
+ $parts[$i] = preg_replace('~\[time\](\d{0,10})\[/time\]~i', create_function('$m', ' return \'[time]\' . timeformat(\'$m[1]\', false) . \'[/time]\';'), $parts[$i]);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -279,6 +279,21 @@ function un_preparsecode($message)
|
|
|
return preg_replace('~<br( /)?' . '>~', "\n", str_replace(' ', ' ', implode('', $parts)));
|
|
|
}
|
|
|
|
|
|
+function un_preparsecodeCallback($matches)
|
|
|
+{
|
|
|
+ return '[html]' .
|
|
|
+ strtr(
|
|
|
+ htmlspecialchars('$matches[1]', ENT_QUOTES),
|
|
|
+ array(
|
|
|
+ '\\"' => '"',
|
|
|
+ '&#13;' => '<br />',
|
|
|
+ '&#32;' => ' ',
|
|
|
+ '&#91;' => '[',
|
|
|
+ '&#93;' => ']'
|
|
|
+ )
|
|
|
+ ) . '[/html]';
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* Fix any URLs posted - ie. remove 'javascript:'.
|
|
|
* Used by preparsecode, fixes links in message and returns nothing.
|