diff options
author | natec <natec@users.sourceforge.net> | 2001-12-11 08:43:05 +0000 |
---|---|---|
committer | natec <natec@users.sourceforge.net> | 2001-12-11 08:43:05 +0000 |
commit | f0bf32c5c1d7bcacab86e0623b0600c2a694303c (patch) | |
tree | cdbc1ec6a224831de763f45df775439e8f5897cf /phpBB/includes/functions.php | |
parent | 46deea9011ccb78637bbcd355f4cba352b0980fd (diff) | |
download | forums-f0bf32c5c1d7bcacab86e0623b0600c2a694303c.tar forums-f0bf32c5c1d7bcacab86e0623b0600c2a694303c.tar.gz forums-f0bf32c5c1d7bcacab86e0623b0600c2a694303c.tar.bz2 forums-f0bf32c5c1d7bcacab86e0623b0600c2a694303c.tar.xz forums-f0bf32c5c1d7bcacab86e0623b0600c2a694303c.zip |
bug #488067: no, preg_quote() didn't always have 2 args.
git-svn-id: file:///svn/phpbb/trunk@1553 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r-- | phpBB/includes/functions.php | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 01ef706e13..204e180dc8 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -839,7 +839,7 @@ function smilies_pass($message) usort($smilies, 'smiley_sort'); for($i = 0; $i < count($smilies); $i++) { - $orig[] = "/(?<=.\\W|\\W.|^\\W)" . preg_quote($smilies[$i]['code'], "/") . "(?=.\\W|\\W.|\\W$)/i"; + $orig[] = "/(?<=.\\W|\\W.|^\\W)" . phpbb_preg_quote($smilies[$i]['code'], "/") . "(?=.\\W|\\W.|\\W$)/i"; $repl[] = '<img src="'. $board_config['smilies_path'] . '/' . $smilies[$i]['smile_url'] . '" alt="' . $smilies[$i]['smile_url'] . '" border="0">'; } @@ -887,7 +887,7 @@ function obtain_word_list(&$orig_word, &$replacement_word) for($i = 0; $i < count($word_list); $i++) { - $word = str_replace("\*", "\w*?", preg_quote($word_list[$i]['word'], "#")); + $word = str_replace("\*", "\w*?", phpbb_preg_quote($word_list[$i]['word'], "#")); $orig_word[] = "#\b(" . $word . ")\b#i"; $replacement_word[] = $word_list[$i]['replacement']; @@ -1177,4 +1177,24 @@ function message_die($msg_code, $msg_text = "", $msg_title = "", $err_line = "", } + + +// +// this does exactly what preg_quote() does in PHP 4-ish: http://www.php.net/manual/en/function.preg-quote.php +// +// This function is here because the 2nd paramter to preg_quote was added in some +// version of php 4.0.x.. So we use this in order to maintain compatibility with +// earlier versions of PHP. +// +// If you just need the 1-parameter preg_quote call, then don't bother using this. +// +function phpbb_preg_quote($str, $delimiter) +{ + $text = preg_quote($str); + $text = str_replace($delimiter, "\\" . $delimiter, $text); + + return $text; +} + + ?> |