Removing deprecated tags for xhtml and removing invalid tags from Title post.

master
vbracco 2008-02-20 19:08:40 +00:00
parent 0f7c6e546b
commit 80dcdc66ba
2 changed files with 7 additions and 3 deletions

View File

@ -70,7 +70,7 @@ if ($user->isAdmin()) {
$textile = new Textile();
$_POST["title"] = $textile->TextileThis(removeBadTags($_POST["title"]));
$_POST["title"] = $textile->TextileThis(removeBadTags($_POST["title"],true));
$_POST["description"] = $textile->TextileThis(removeBadTags($_POST["description"]));
if (isset($_POST["id_post"])) {

View File

@ -395,8 +395,12 @@ if(!defined('entry') || !entry) die('Not a valid page');
return $dirs;
}
function removeBadTags($source) {
$validTags ='<p><ol><ul><li><a><abbr><acronym><blockquote><code><pre><em><i><strike><s><strong><b><br><span><div><img>';
function removeBadTags($source,$secure=false) {
if($secure){
$validTags ='<abbr><acronym><em><i><strong><b><span>';
} else {
$validTags ='<p><ol><ul><li><a><abbr><acronym><blockquote><code><pre><em><i><strong><b><br><span><div><img>';
}
$source = strip_tags($source, $validTags);
return preg_replace('/<(.*?)>/ie', "'<'.removeBadAtributes('\\1').'>'", $source);
}