if ($sanitize_content) {
$headline_row["content"] = sanitize($link,
- $line["content_preview"], false, false, $line["site_url"]);
+ $line["content_preview"],
+ sql_bool_to_bool($line['hide_images']),
+ false, $line["site_url"]);
} else {
$headline_row["content"] = $line["content_preview"];
}
unset($line["tag_cache"]);
$line["content"] = sanitize($this->link, $line["content_preview"],
- false, false, $entry_site_url);
+ sql_bool_to_bool($line['hide_images']), false, $entry_site_url);
foreach ($pluginhost->get_hooks($pluginhost::HOOK_RENDER_ARTICLE_CDM) as $p) {
$line = $p->hook_render_article_cdm($line);
name=\"always_display_enclosures\"
$checked> <label for=\"always_display_enclosures\">".__('Always display image attachments')."</label>";
+ $hide_images = sql_bool_to_bool(db_fetch_result($result, 0, "hide_images"));
+
+ if ($hide_images) {
+ $checked = "checked=\"1\"";
+ } else {
+ $checked = "";
+ }
+
+ print "<hr/><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" id=\"hide_images\"
+ name=\"hide_images\"
+ $checked> <label for=\"hide_images\">".
+ __('Do not embed images')."</label>";
$cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images"));
print " "; $this->batch_edit_cbox("always_display_enclosures", "always_display_enclosures_l");
+ print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"hide_images\"
+ name=\"hide_images\"
+ dojoType=\"dijit.form.CheckBox\"> <label class='insensitive' id=\"hide_images_l\"
+ for=\"hide_images\">".
+ __('Do not embed images')."</label>";
+
+ print " "; $this->batch_edit_cbox("hide_images", "hide_images_l");
+
print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"cache_images\"
name=\"cache_images\"
dojoType=\"dijit.form.CheckBox\"> <label class='insensitive' id=\"cache_images_l\"
db_escape_string($_POST["include_in_digest"]));
$cache_images = checkbox_to_sql_bool(
db_escape_string($_POST["cache_images"]));
-
+ $hide_images = checkbox_to_sql_bool(
+ db_escape_string($_POST["hide_images"]));
$always_display_enclosures = checkbox_to_sql_bool(
db_escape_string($_POST["always_display_enclosures"]));
auth_pass = '$auth_pass',
private = $private,
cache_images = $cache_images,
+ hide_images = $hide_images,
include_in_digest = $include_in_digest,
always_display_enclosures = $always_display_enclosures,
mark_unread_on_update = $mark_unread_on_update
$qpart = "cache_images = $cache_images";
break;
+ case "hide_images":
+ $qpart = "hide_images = $hide_images";
+ break;
+
case "cat_id":
$qpart = $category_qpart_nocomma;
break;
<?php
define('EXPECTED_CONFIG_VERSION', 26);
- define('SCHEMA_VERSION', 105);
+ define('SCHEMA_VERSION', 106);
$fetch_last_error = false;
$pluginhost = false;
num_comments,
comments,
int_id,
+ hide_images,
unread,feed_id,marked,published,link,last_read,orig_feed_id,
last_marked, last_published,
".SUBSTRING_FOR_DATE."(last_read,1,19) as last_read_noms,
"label_cache," .
"link," .
"last_read," .
+ "hide_images," .
"last_marked, last_published, " .
SUBSTRING_FOR_DATE . "(last_read,1,19) as last_read_noms," .
$since_id_part .
}
- function sanitize($link, $str, $force_strip_tags = false, $owner = false, $site_url = false) {
+ function sanitize($link, $str, $force_remove_images = false, $owner = false, $site_url = false) {
if (!$owner) $owner = $_SESSION["uid"];
$res = trim($str); if (!$res) return '';
- if (get_pref($link, "STRIP_IMAGES", $owner)) {
- $res = preg_replace('/<img[^>]+>/is', '', $res);
- }
-
if (strpos($res, "href=") === false)
$res = rewrite_urls($res);
$entry->setAttribute('src', $src);
}
+
+ if ($entry->nodeName == 'img') {
+ if (get_pref($link, "STRIP_IMAGES", $owner) || $force_remove_images) {
+
+ $p = $doc->createElement('p');
+
+ $a = $doc->createElement('a');
+ $a->setAttribute('href', $entry->getAttribute('src'));
+
+ $a->appendChild(new DOMText($entry->getAttribute('src')));
+ $a->setAttribute('target', '_blank');
+
+ $p->appendChild($a);
+
+ $entry->parentNode->replaceChild($p, $entry);
+ }
+ }
}
if (strtolower($entry->nodeName) == "a") {
}
} catch (e) { }
+ try {
+ if (!query.match("&hide_images=") &&
+ this.getChildByName('hide_images').attr('disabled') == false) {
+ query = query + "&hide_images=false";
+ }
+ } catch (e) { }
+
if (!query.match("&include_in_digest=") &&
this.getChildByName('include_in_digest').attr('disabled') == false) {
query = query + "&include_in_digest=false";
hidden bool not null default false,
include_in_digest boolean not null default true,
cache_images boolean not null default false,
+ hide_images boolean not null default false,
cache_content boolean not null default false,
auth_pass_encrypted boolean not null default false,
last_viewed datetime default null,
create table ttrss_version (schema_version int not null) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
-insert into ttrss_version values (105);
+insert into ttrss_version values (106);
create table ttrss_enclosures (id integer primary key auto_increment,
content_url text not null,
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('VFEED_GROUP_BY_FEED', 1, 'false', 'Group headlines in virtual feeds',2, 'When this option is enabled, headlines in Special feeds and Labels are grouped by feeds');
-insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('STRIP_IMAGES', 1, 'false', 'Hide images in articles', 2);
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('STRIP_IMAGES', 1, 'false', 'Do not embed images in articles', 2);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_DEFAULT_VIEW_ORDER_BY', 2, 'default', '', 1);
include_in_digest boolean not null default true,
rtl_content boolean not null default false,
cache_images boolean not null default false,
+ hide_images boolean not null default false,
cache_content boolean not null default false,
last_viewed timestamp default null,
last_update_started timestamp default null,
create table ttrss_version (schema_version int not null);
-insert into ttrss_version values (105);
+insert into ttrss_version values (106);
create table ttrss_enclosures (id serial not null primary key,
content_url text not null,
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('VFEED_GROUP_BY_FEED', 1, 'false', 'Group headlines in virtual feeds',2, 'When this option is enabled, headlines in Special feeds and Labels are grouped by feeds');
-insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('STRIP_IMAGES', 1, 'false', 'Hide images in articles', 2);
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('STRIP_IMAGES', 1, 'false', 'Do not embed images in articles', 2);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_DEFAULT_VIEW_ORDER_BY', 2, 'default', '', 1);
--- /dev/null
+begin;
+
+update ttrss_prefs set short_desc = 'Do not embed images in articles' where pref_name = 'STRIP_IMAGES';
+
+alter table ttrss_feeds add column hide_images bool;
+update ttrss_feeds set hide_images = false;
+alter table ttrss_feeds change hide_images hide_images bool not null;
+alter table ttrss_feeds alter column hide_images set default false;
+
+update ttrss_version set schema_version = 106;
+
+commit;
--- /dev/null
+begin;
+
+update ttrss_prefs set short_desc = 'Do not embed images in articles' where pref_name = 'STRIP_IMAGES';
+
+alter table ttrss_feeds add column hide_images boolean;
+update ttrss_feeds set hide_images = false;
+alter table ttrss_feeds alter column hide_images set not null;
+alter table ttrss_feeds alter column hide_images set default false;
+
+update ttrss_version set schema_version = 106;
+
+commit;