Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Richard Beales 2013-03-19 19:20:14 +00:00
commit 598a8f37a2
38 changed files with 3693 additions and 3266 deletions

View File

@ -636,7 +636,9 @@ class API extends Handler {
if ($sanitize_content) { if ($sanitize_content) {
$headline_row["content"] = sanitize($link, $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 { } else {
$headline_row["content"] = $line["content_preview"]; $headline_row["content"] = $line["content_preview"];
} }

View File

@ -481,7 +481,7 @@ class Feeds extends Handler_Protected {
unset($line["tag_cache"]); unset($line["tag_cache"]);
$line["content"] = sanitize($this->link, $line["content_preview"], $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) { foreach ($pluginhost->get_hooks($pluginhost::HOOK_RENDER_ARTICLE_CDM) as $p) {
$line = $p->hook_render_article_cdm($line); $line = $p->hook_render_article_cdm($line);

View File

@ -613,6 +613,18 @@ class Pref_Feeds extends Handler_Protected {
name=\"always_display_enclosures\" name=\"always_display_enclosures\"
$checked>&nbsp;<label for=\"always_display_enclosures\">".__('Always display image attachments')."</label>"; $checked>&nbsp;<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>&nbsp;<label for=\"hide_images\">".
__('Do not embed images')."</label>";
$cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images")); $cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images"));
@ -804,6 +816,14 @@ class Pref_Feeds extends Handler_Protected {
print "&nbsp;"; $this->batch_edit_cbox("always_display_enclosures", "always_display_enclosures_l"); print "&nbsp;"; $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\">&nbsp;<label class='insensitive' id=\"hide_images_l\"
for=\"hide_images\">".
__('Do not embed images')."</label>";
print "&nbsp;"; $this->batch_edit_cbox("hide_images", "hide_images_l");
print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"cache_images\" print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"cache_images\"
name=\"cache_images\" name=\"cache_images\"
dojoType=\"dijit.form.CheckBox\">&nbsp;<label class='insensitive' id=\"cache_images_l\" dojoType=\"dijit.form.CheckBox\">&nbsp;<label class='insensitive' id=\"cache_images_l\"
@ -856,7 +876,8 @@ class Pref_Feeds extends Handler_Protected {
db_escape_string($_POST["include_in_digest"])); db_escape_string($_POST["include_in_digest"]));
$cache_images = checkbox_to_sql_bool( $cache_images = checkbox_to_sql_bool(
db_escape_string($_POST["cache_images"])); 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( $always_display_enclosures = checkbox_to_sql_bool(
db_escape_string($_POST["always_display_enclosures"])); db_escape_string($_POST["always_display_enclosures"]));
@ -887,6 +908,7 @@ class Pref_Feeds extends Handler_Protected {
auth_pass = '$auth_pass', auth_pass = '$auth_pass',
private = $private, private = $private,
cache_images = $cache_images, cache_images = $cache_images,
hide_images = $hide_images,
include_in_digest = $include_in_digest, include_in_digest = $include_in_digest,
always_display_enclosures = $always_display_enclosures, always_display_enclosures = $always_display_enclosures,
mark_unread_on_update = $mark_unread_on_update mark_unread_on_update = $mark_unread_on_update
@ -952,6 +974,10 @@ class Pref_Feeds extends Handler_Protected {
$qpart = "cache_images = $cache_images"; $qpart = "cache_images = $cache_images";
break; break;
case "hide_images":
$qpart = "hide_images = $hide_images";
break;
case "cat_id": case "cat_id":
$qpart = $category_qpart_nocomma; $qpart = $category_qpart_nocomma;
break; break;

View File

@ -42,6 +42,12 @@ class Pref_Prefs extends Handler_Protected {
$_SESSION["prefs_cache"] = false; $_SESSION["prefs_cache"] = false;
$boolean_prefs = explode(",", $_POST["boolean_prefs"]);
foreach ($boolean_prefs as $pref) {
if (!isset($_POST[$pref])) $_POST[$pref] = 'false';
}
foreach (array_keys($_POST) as $pref_name) { foreach (array_keys($_POST) as $pref_name) {
$pref_name = db_escape_string($pref_name); $pref_name = db_escape_string($pref_name);
@ -429,6 +435,8 @@ class Pref_Prefs extends Handler_Protected {
$active_section = ""; $active_section = "";
$listed_boolean_prefs = array();
while ($line = db_fetch_assoc($result)) { while ($line = db_fetch_assoc($result)) {
if (in_array($line["pref_name"], $prefs_blacklist)) { if (in_array($line["pref_name"], $prefs_blacklist)) {
@ -463,7 +471,10 @@ class Pref_Prefs extends Handler_Protected {
$def_value = $line["def_value"]; $def_value = $line["def_value"];
$help_text = $line["help_text"]; $help_text = $line["help_text"];
print "<td width=\"40%\" class=\"prefName\" id=\"$pref_name\">" . __($line["short_desc"]); print "<td width=\"40%\" class=\"prefName\" id=\"$pref_name\">";
print "<label for='CB_$pref_name'>";
print __($line["short_desc"]);
print "</label>";
if ($help_text) print "<div class=\"prefHelp\">".__($help_text)."</div>"; if ($help_text) print "<div class=\"prefHelp\">".__($help_text)."</div>";
@ -497,21 +508,19 @@ class Pref_Prefs extends Handler_Protected {
} else if ($type_name == "bool") { } else if ($type_name == "bool") {
if ($value == "true") { array_push($listed_boolean_prefs, $pref_name);
$value = __("Yes");
} else { $checked = ($value == "true") ? "checked=\"checked\"" : "";
$value = __("No");
}
if ($pref_name == "PURGE_UNREAD_ARTICLES" && FORCE_ARTICLE_PURGE != 0) { if ($pref_name == "PURGE_UNREAD_ARTICLES" && FORCE_ARTICLE_PURGE != 0) {
$disabled = "disabled=\"1\""; $disabled = "disabled=\"1\"";
$value = __("Yes"); $checked = "checked=\"checked\"";
} else { } else {
$disabled = ""; $disabled = "";
} }
print_radio($pref_name, $value, __("Yes"), array(__("Yes"), __("No")), print "<input type='checkbox' name='$pref_name' $checked $disabled
$disabled); dojoType='dijit.form.CheckBox' id='CB_$pref_name' value='1'>";
} else if (array_search($pref_name, array('FRESH_ARTICLE_MAX_AGE', 'DEFAULT_ARTICLE_LIMIT', } else if (array_search($pref_name, array('FRESH_ARTICLE_MAX_AGE', 'DEFAULT_ARTICLE_LIMIT',
'PURGE_OLD_DAYS', 'LONG_DATE_FORMAT', 'SHORT_DATE_FORMAT')) !== false) { 'PURGE_OLD_DAYS', 'LONG_DATE_FORMAT', 'SHORT_DATE_FORMAT')) !== false) {
@ -568,6 +577,10 @@ class Pref_Prefs extends Handler_Protected {
print "</table>"; print "</table>";
$listed_boolean_prefs = htmlspecialchars(join(",", $listed_boolean_prefs));
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"boolean_prefs\" value=\"$listed_boolean_prefs\">";
global $pluginhost; global $pluginhost;
$pluginhost->run_hooks($pluginhost::HOOK_PREFS_TAB_SECTION, $pluginhost->run_hooks($pluginhost::HOOK_PREFS_TAB_SECTION,
"hook_prefs_tab_section", "prefPrefsPrefsInside"); "hook_prefs_tab_section", "prefPrefsPrefsInside");

View File

@ -1,6 +1,6 @@
<?php <?php
define('EXPECTED_CONFIG_VERSION', 26); define('EXPECTED_CONFIG_VERSION', 26);
define('SCHEMA_VERSION', 105); define('SCHEMA_VERSION', 106);
$fetch_last_error = false; $fetch_last_error = false;
$pluginhost = false; $pluginhost = false;
@ -2461,6 +2461,7 @@
num_comments, num_comments,
comments, comments,
int_id, int_id,
hide_images,
unread,feed_id,marked,published,link,last_read,orig_feed_id, unread,feed_id,marked,published,link,last_read,orig_feed_id,
last_marked, last_published, last_marked, last_published,
".SUBSTRING_FOR_DATE."(last_read,1,19) as last_read_noms, ".SUBSTRING_FOR_DATE."(last_read,1,19) as last_read_noms,
@ -2505,6 +2506,7 @@
"label_cache," . "label_cache," .
"link," . "link," .
"last_read," . "last_read," .
"hide_images," .
"last_marked, last_published, " . "last_marked, last_published, " .
SUBSTRING_FOR_DATE . "(last_read,1,19) as last_read_noms," . SUBSTRING_FOR_DATE . "(last_read,1,19) as last_read_noms," .
$since_id_part . $since_id_part .
@ -2560,15 +2562,11 @@
} }
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"]; if (!$owner) $owner = $_SESSION["uid"];
$res = trim($str); if (!$res) return ''; $res = trim($str); if (!$res) return '';
if (get_pref($link, "STRIP_IMAGES", $owner)) {
$res = preg_replace('/<img[^>]+>/is', '', $res);
}
if (strpos($res, "href=") === false) if (strpos($res, "href=") === false)
$res = rewrite_urls($res); $res = rewrite_urls($res);
@ -2605,6 +2603,23 @@
$entry->setAttribute('src', $src); $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") { if (strtolower($entry->nodeName) == "a") {

View File

@ -1,4 +1,4 @@
<?php # This file has been generated at: Tue Mar 19 10:14:58 MSK 2013 <?php # This file has been generated at: Tue Mar 19 22:42:44 MSK 2013
__("Title"); __("Title");
__("Title or Content"); __("Title or Content");
@ -54,7 +54,7 @@ __('Automatically expand articles in combined mode');
__('Purge unread articles'); __('Purge unread articles');
__('Show special feeds when hiding read feeds'); __('Show special feeds when hiding read feeds');
__('Group headlines in virtual feeds'); __('Group headlines in virtual feeds');
__('Hide images in articles'); __('Do not embed images in articles');
__('Enable external API'); __('Enable external API');
__('User timezone'); __('User timezone');
__('Customize stylesheet'); __('Customize stylesheet');

View File

@ -722,6 +722,13 @@ function editSelectedFeeds() {
} }
} catch (e) { } } 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=") && if (!query.match("&include_in_digest=") &&
this.getChildByName('include_in_digest').attr('disabled') == false) { this.getChildByName('include_in_digest').attr('disabled') == false) {
query = query + "&include_in_digest=false"; query = query + "&include_in_digest=false";

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -117,6 +117,7 @@ create table ttrss_feeds (id integer not null auto_increment primary key,
hidden bool not null default false, hidden bool not null default false,
include_in_digest boolean not null default true, include_in_digest boolean not null default true,
cache_images 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, cache_content boolean not null default false,
auth_pass_encrypted boolean not null default false, auth_pass_encrypted boolean not null default false,
last_viewed datetime default null, last_viewed datetime default null,
@ -312,7 +313,7 @@ create table ttrss_tags (id integer primary key auto_increment,
create table ttrss_version (schema_version int not null) ENGINE=InnoDB DEFAULT CHARSET=UTF8; 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, create table ttrss_enclosures (id integer primary key auto_increment,
content_url text not null, content_url text not null,
@ -414,7 +415,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,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,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); insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_DEFAULT_VIEW_ORDER_BY', 2, 'default', '', 1);

View File

@ -79,6 +79,7 @@ create table ttrss_feeds (id serial not null primary key,
include_in_digest boolean not null default true, include_in_digest boolean not null default true,
rtl_content boolean not null default false, rtl_content boolean not null default false,
cache_images 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, cache_content boolean not null default false,
last_viewed timestamp default null, last_viewed timestamp default null,
last_update_started timestamp default null, last_update_started timestamp default null,
@ -260,7 +261,7 @@ create index ttrss_tags_post_int_id_idx on ttrss_tags(post_int_id);
create table ttrss_version (schema_version int not 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, create table ttrss_enclosures (id serial not null primary key,
content_url text not null, content_url text not null,
@ -354,7 +355,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,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,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); insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_DEFAULT_VIEW_ORDER_BY', 2, 'default', '', 1);

View File

@ -0,0 +1,12 @@
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;

View File

@ -0,0 +1,12 @@
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;