From c6e629bf89b2b625f2f84ad73620f5a82b7a207e Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Tue, 13 Aug 2013 01:53:23 +1000 Subject: allow wordfilters to be callbacks --- inc/functions.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'inc/functions.php') diff --git a/inc/functions.php b/inc/functions.php index 74ab96e9..848d9204 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1415,7 +1415,10 @@ function wordfilters(&$body) { foreach ($config['wordfilters'] as $filter) { if (isset($filter[2]) && $filter[2]) { - $body = preg_replace($filter[0], $filter[1], $body); + if (is_callable($filter[1])) + $body = preg_replace_callback($filter[0], $filter[1], $body); + else + $body = preg_replace($filter[0], $filter[1], $body); } else { $body = str_ireplace($filter[0], $filter[1], $body); } -- cgit v1.3 From 07b825c6d2abd3312747fafe49c0a1d3011242ae Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Tue, 13 Aug 2013 21:53:23 +1000 Subject: Don't create anti-bot stuff in buildThread() when asked to return HTML as a string. --- inc/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/functions.php') diff --git a/inc/functions.php b/inc/functions.php index 848d9204..085d911f 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1755,7 +1755,7 @@ function buildThread($id, $return = false, $mod = false) { 'config' => $config, 'id' => $id, 'mod' => $mod, - 'antibot' => $mod ? false : create_antibot($board['uri'], $id), + 'antibot' => $mod || $return ? false : create_antibot($board['uri'], $id), 'boardlist' => createBoardlist($mod), 'return' => ($mod ? '?' . $board['url'] . $config['file_index'] : $config['root'] . $board['dir'] . $config['file_index']) )); -- cgit v1.3