diff options
| author | Ludovic Arnaud <ludovic_arnaud@users.sourceforge.net> | 2003-04-17 23:47:26 +0000 |
|---|---|---|
| committer | Ludovic Arnaud <ludovic_arnaud@users.sourceforge.net> | 2003-04-17 23:47:26 +0000 |
| commit | ff6fdd67be8d854ce995948538312808399cca95 (patch) | |
| tree | 65d75cf5ca86b1f2380c58da3fe14d86d0aff290 /phpBB/includes/bbcode.php | |
| parent | a79524cb337ca5e467e5a1a9a5e7f8d756698f98 (diff) | |
| download | forums-ff6fdd67be8d854ce995948538312808399cca95.tar forums-ff6fdd67be8d854ce995948538312808399cca95.tar.gz forums-ff6fdd67be8d854ce995948538312808399cca95.tar.bz2 forums-ff6fdd67be8d854ce995948538312808399cca95.tar.xz forums-ff6fdd67be8d854ce995948538312808399cca95.zip | |
More bbcode fixes
git-svn-id: file:///svn/phpbb/trunk@3879 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/bbcode.php')
| -rw-r--r-- | phpBB/includes/bbcode.php | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 70e1698efc..c34092f35c 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -312,18 +312,18 @@ class bbcode switch ($type) { case 'php': + $str_from = array('<', '>', '"', ':', '[', ']', '(', ')', '{', '}', '.', '@'); + $str_to = array('<', '>', '"', ':', '[', ']', '(', ')', '{', '}', '.', '@'); + + $code = str_replace($str_to, $str_from, $code); + $remove_tags = FALSE; - if (!preg_match('/<\?(php)? .*? \?>/', $code)) + if (!preg_match('/\<\?.*?\?\>/is', $code)) { $remove_tags = TRUE; $code = "<?php $code ?>"; } - $str_from = array('<', '>', '"', ':', '[', ']', '(', ')', '{', '}', '.', '@'); - $str_to = array('<', '>', '"', ':', '[', ']', '(', ')', '{', '}', '.', '@'); - - $code = str_replace($str_to, $str_from, $code); - ob_start(); highlight_string($code); $code = ob_get_contents(); @@ -331,10 +331,12 @@ class bbcode if ($remove_tags) { - $code = preg_replace('/(.*?)<\?php (.*)\?>(.*?)/', '\1\2\3', $code); + $code = preg_replace('!^<code>[\n\r\s\t]*<font color="#[a-z0-9]+">[\n\r\s\t]*(<font color="#[a-z0-9]+">)<\?php (.*)\?></font>[\n\r\s\t]*(</font>)[\n\r\s\t]*</code>[\n\r\s\t]*!is', '\1\2\3', $code); + } + else + { + $code = preg_replace('!^<code>[\n\r\s\t]*<font color="#[a-z0-9]+">[\n\r\s\t]*(.*)</font>[\n\r\s\t]*</code>[\n\r\s\t]*!is', '\1', $code); } - - $code = preg_replace('!^<code>[\n\r\s\t]*<font color="#[a-z0-9]+">[\n\r\s\t]*(.*)</font>[\n\r\s\t]*</code>[\n\r\s\t]*!is', '\\1', $code); break; default: |
