Strip characters that shouldn't be in xml. Fixes http://laconi.ca/PITS/00253 for future messages, or all after a regeneration of rendered messages

darcs-hash:20080720122832-533db-7fda43b257160b90788f0d860d50df995d463ee8.gz
This commit is contained in:
Mike Cochrane 2008-07-20 08:28:32 -04:00
parent 26f6c917a7
commit de81e92f0b
1 changed files with 2 additions and 0 deletions

View File

@ -647,6 +647,8 @@ define('URL_REGEX', '^|[ \t\r\n])((ftp|http|https|gopher|mailto|news|nntp|telnet
function common_render_content($text, $notice) {
$r = htmlspecialchars($text);
$r = preg_replace('/[\x{0}-\x{8}\x{b}-\x{c}\x{e}-\x{19}]/', '', $r);
$id = $notice->profile_id;
$r = preg_replace('@https?://[^)\]>\s]+@', '<a href="\0" class="extlink">\0</a>', $r);
$r = preg_replace('/(^|\s+)@([a-z0-9]{1,64})/e', "'\\1@'.common_at_link($id, '\\2')", $r);