*/
function removeEvilTags($source)
{
- $allowedTags = '<h1><b><i><a><ul><li><pre><hr><blockquote><img><br><font><p><small><big><sup><sub><code>';
+ $allowedTags = '<h1><b><i><a><ul><li><pre><hr><blockquote><img><br><font><p><small><big><sup><sub><code><em>';
$source = strip_tags($source, $allowedTags);
return preg_replace('/<(.*?)>/ie', "'<'.removeEvilAttributes('\\1').'>'", $source);
}
*/
function htmlToPlainText($res)
{
- $res = trim(html_entity_decode(strip_tags($res, '<br>')));
- $res = preg_replace("@<br[^>]>@i", "\n", $res);
+ $res = trim(html_entity_decode(strip_tags($res, '<br><p>')));
+ $res = preg_replace("@</?(br|p)[^>]*>@i", "\n", $res);
if (!is_utf8($res)) {
$res = utf8_encode($res);
}
} else {
$res .= "[<a href=\"?group=$group&artid=$artid&action=new\">"
._b_('RĂ©pondre')."</a>] ";
- if ($banana->post->checkcancel()) {
+ if ($banana->post && $banana->post->checkcancel()) {
$res .= "[<a href=\"?group=$group&artid=$artid&action=cancel\">"
._b_('Annuler ce message')."</a>] ";
}