new option: STRIP_UNSAFE_TAGS

This commit is contained in:
Andrew Dolgov 2007-05-16 07:50:00 +01:00
parent 8fd55df16f
commit f826eee150
5 changed files with 18 additions and 2 deletions

View File

@ -2608,10 +2608,10 @@
function sanitize_rss($str) { function sanitize_rss($str) {
$res = $str; $res = $str;
$res = preg_replace('/<script.*?>/i', /* $res = preg_replace('/<script.*?>/i',
"<p class=\"scriptWarn\">Disabled script: ", $res); "<p class=\"scriptWarn\">Disabled script: ", $res);
$res = preg_replace('/<\/script.*?>/i', "</p>", $res); $res = preg_replace('/<\/script.*?>/i', "</p>", $res); */
/* $res = preg_replace('/<embed.*?>/i', "", $res); /* $res = preg_replace('/<embed.*?>/i', "", $res);
@ -2619,6 +2619,10 @@
"<p class=\"objectWarn\">(Disabled html object "<p class=\"objectWarn\">(Disabled html object
- flash or other embedded content)</p>", $res); */ - flash or other embedded content)</p>", $res); */
if (get_pref("STRIP_UNSAFE_TAGS")) {
$res = strip_tags($res, "<p><a><i><em><b><strong><blockquote><br><img>");
}
return $res; return $res;
} }

View File

@ -276,6 +276,9 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) valu
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_INFOBOX_DISABLE_OVERLAY', 1, 'false', '', 1); insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_INFOBOX_DISABLE_OVERLAY', 1, 'false', '', 1);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('STRIP_UNSAFE_TAGS', 1, 'true', 'Strip unsafe tags from articles', 3,
'This option strips all, but most common HTML tags when reading articles.');
create table ttrss_user_prefs ( create table ttrss_user_prefs (
owner_uid integer not null, owner_uid integer not null,
pref_name varchar(250), pref_name varchar(250),

View File

@ -256,6 +256,9 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) valu
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_INFOBOX_DISABLE_OVERLAY', 1, 'false', '', 1); insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_INFOBOX_DISABLE_OVERLAY', 1, 'false', '', 1);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('STRIP_UNSAFE_TAGS', 1, 'true', 'Strip unsafe tags from articles', 3,
'This option strips all, but most common HTML tags when reading articles.');
create table ttrss_user_prefs ( create table ttrss_user_prefs (
owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE, owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
pref_name varchar(250) not null references ttrss_prefs(pref_name) ON DELETE CASCADE, pref_name varchar(250) not null references ttrss_prefs(pref_name) ON DELETE CASCADE,

View File

@ -2,4 +2,7 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) valu
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_INFOBOX_DISABLE_OVERLAY', 1, 'false', '', 1); insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_INFOBOX_DISABLE_OVERLAY', 1, 'false', '', 1);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('STRIP_UNSAFE_TAGS', 1, 'true', 'Strip unsafe tags from articles', 3,
'This option strips all, but most common HTML tags when reading articles.');
update ttrss_version set schema_version = 17; update ttrss_version set schema_version = 17;

View File

@ -2,4 +2,7 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) valu
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_INFOBOX_DISABLE_OVERLAY', 1, 'false', '', 1); insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_INFOBOX_DISABLE_OVERLAY', 1, 'false', '', 1);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('STRIP_UNSAFE_TAGS', 1, 'true', 'Strip unsafe tags from articles', 3,
'This option strips all, but most common HTML tags when reading articles.');
update ttrss_version set schema_version = 17; update ttrss_version set schema_version = 17;