|
| |
|
|
| |
для: cheops
(11.03.2007 в 15:03)
| | | Спасибо cheops :) | |
| |
|
|
| |
|
|
| |
для: SnooPI
(11.03.2007 в 11:53)
| | | Очень просто, сначала обработайте текст функцией htmlspecialchars(), затем преобразуйте bbCode. | |
| |
|
|
| |
|
|
| |
для: simsalabim
(11.03.2007 в 12:17)
| | | http://www.php.net/manual/ru/function.htmlspecialchars.php
вообще странно что у тебя это блочит вывод квадратных скобок, в описании такого нетути... | |
| |
|
|
| |
|
|
| |
для: SnooPI
(11.03.2007 в 11:53)
| | | а ты дополнительные параметры в htmlspecialchars задай и разреши выводить [] | |
| |
|
|
| |
|
|
| | Есть у меня бб коды..
<?php
$content = preg_replace("#\\n#si", "<br />", $content);
$content = preg_replace("#\[b\](.*?)\[/b\]#si", "<span style=\"font-weight:bold\">\\1</span>",$content);
$content = preg_replace("#\[i\](.*?)\[/i\]#si", "<span style=\"font-style:italic\">\\1</span>", $content);
$content = preg_replace("#\[u\](.*?)\[/U\]#si", "<span style=\"text-decoration:underline\">\\1</span>", $content);
$content = preg_replace("#\[s\](.*?)\[/s\]#si", "<s>\\1</s>", $content);
$content = preg_replace("#\[php\](.*)\[\/php\]#sie", 'highlight_string(html_entity_decode("\\1"), true)', $content);
$content = preg_replace("#\[google\](.*?)\[/google\]#si", "<a href=\"http://www.google.com/search?q=\\1\" target=\"_blank\"><span style=\"font-weight:bold; color:#575CCA\">≡Google≡</span></a>", $content);
$content = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#\"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", "'<img src=\"\\1' . str_replace(' ', '%20', '\\3') . '\" width=\"500\" />'", $content);
$content = preg_replace("#\[url=(.*?)\](.*?)\[/url\]#si", "<a target=\"_blank\" title=\"\\2\" href=\"\\1\">\\2</a>", $content);
$content = preg_replace("#\[url\](.*?)\[/url\]#si", "<a target=\"_blank\" title=\"\\1\" href=\"\\1\">\\1</a>", $content);
$content = preg_replace("#\[color=(\#[0-9A-F]{6}|[a-z\-]+)\](.*?)\[/color\]#si", "<font style=\"color:\\1\">\\2</font>", $content);
?>
|
И есть вывод сообщений
<?php
echo htmlspecialchars($content);
?>
|
Но при хтмлспешиалчрас не работают бб коды, если убрать хтмлспешлчарс, то работают, но можно сделать xss!!
Как решить такую проблему? | |
| |
|
|
|