fix up HTML as it may mess up HTML-Content later on display, if tags are not propper

This commit is contained in:
Klaus Leithoff 2012-01-31 16:44:43 +00:00
parent 874989e242
commit 37a6917ae3
3 changed files with 6 additions and 4 deletions

View File

@ -252,7 +252,7 @@ class ajaxfelamimail
} else {
$this->sessionData['mimeType'] = 'text';
$_content = str_replace(array("\r\n","\n","\r"),array("<br>","<br>","<br>"),$_content);
$_content = $bocompose->_getCleanHTML($_content);
$_content = $bocompose->_getCleanHTML($_content,false,false);
$_content = $bocompose->convertHTMLToText($_content);
}
$htmlObject = html::fckEditorQuick('body', $_mode, $_content);

View File

@ -639,12 +639,12 @@
$this->saveSessionData();
}
static function _getCleanHTML($_body)
static function _getCleanHTML($_body, $usepurify = false, $cleanTags=true)
{
static $nonDisplayAbleCharacters = array('[\016]','[\017]',
'[\020]','[\021]','[\022]','[\023]','[\024]','[\025]','[\026]','[\027]',
'[\030]','[\031]','[\032]','[\033]','[\034]','[\035]','[\036]','[\037]');
bofelamimail::getCleanHTML($_body);
bofelamimail::getCleanHTML($_body, $usepurify, $cleanTags);
$_body = preg_replace($nonDisplayAbleCharacters, '', $_body);
return $_body;

View File

@ -824,7 +824,7 @@
translation::replaceTagsCompletley($_body,$tag,$endtag,$addbracesforendtag);
}
static function getCleanHTML(&$_html, $usepurify = false)
static function getCleanHTML(&$_html, $usepurify = false, $cleanTags=true)
{
// remove CRLF and TAB as it is of no use in HTML.
// but they matter in <pre>, so we rather don't
@ -1101,6 +1101,8 @@
$_html = preg_replace('/([\000-\012])/','',$_html);
//error_log($_html);
}
// using purify above should have tidied the tags already sufficiently
if ($usepurify == false && $cleanTags==true) $_html = html::purify($_html,html::purifyCreateHTMLTidyConfig());
}
/**