enable caching of images
This commit is contained in:
parent
fb67e2ba58
commit
bc0f078560
|
@ -167,12 +167,10 @@
|
||||||
// Cache directory for RSS feeds when using SimplePie
|
// Cache directory for RSS feeds when using SimplePie
|
||||||
|
|
||||||
define('SIMPLEPIE_CACHE_IMAGES', false);
|
define('SIMPLEPIE_CACHE_IMAGES', false);
|
||||||
// Ignore this option for now on, it doesn't work yet.
|
// Allow caching feed images when using SimplePie, to bypass hotlink
|
||||||
|
// prevention and such at expense of local disk space and bandwidth.
|
||||||
// Cache feed images when using SimplePie. This will allow you to
|
// Note that you (or your users) also have to enable image caching
|
||||||
// see images in feeds when originating server uses some sort of
|
// in feed editor.
|
||||||
// hotlink prevention at the expense of local bandwidth and
|
|
||||||
// disk space.
|
|
||||||
|
|
||||||
define('COUNTERS_MAX_AGE', 365);
|
define('COUNTERS_MAX_AGE', 365);
|
||||||
// Hard limit for unread counters calculation. Try tweaking this
|
// Hard limit for unread counters calculation. Try tweaking this
|
||||||
|
|
|
@ -430,13 +430,14 @@
|
||||||
_debug("update_rss_feed: start");
|
_debug("update_rss_feed: start");
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = db_query($link, "SELECT update_interval,auth_login,auth_pass
|
$result = db_query($link, "SELECT update_interval,auth_login,auth_pass,cache_images
|
||||||
FROM ttrss_feeds WHERE id = '$feed'");
|
FROM ttrss_feeds WHERE id = '$feed'");
|
||||||
|
|
||||||
$auth_login = db_fetch_result($result, 0, "auth_login");
|
$auth_login = db_fetch_result($result, 0, "auth_login");
|
||||||
$auth_pass = db_fetch_result($result, 0, "auth_pass");
|
$auth_pass = db_fetch_result($result, 0, "auth_pass");
|
||||||
|
|
||||||
$update_interval = db_fetch_result($result, 0, "update_interval");
|
$update_interval = db_fetch_result($result, 0, "update_interval");
|
||||||
|
$cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images"));
|
||||||
|
|
||||||
if ($update_interval < 0) { return; }
|
if ($update_interval < 0) { return; }
|
||||||
|
|
||||||
|
@ -475,9 +476,13 @@
|
||||||
$rss->set_feed_url($fetch_url);
|
$rss->set_feed_url($fetch_url);
|
||||||
$rss->set_output_encoding('UTF-8');
|
$rss->set_output_encoding('UTF-8');
|
||||||
|
|
||||||
/* if (SIMPLEPIE_CACHE_IMAGES) {
|
if (SIMPLEPIE_CACHE_IMAGES && $cache_images) {
|
||||||
|
if (defined('DAEMON_EXTENDED_DEBUG') || $_GET['xdebug']) {
|
||||||
|
_debug("enabling image cache");
|
||||||
|
}
|
||||||
|
|
||||||
$rss->set_image_handler('./image.php', 'i');
|
$rss->set_image_handler('./image.php', 'i');
|
||||||
} */
|
}
|
||||||
|
|
||||||
if (defined('DAEMON_EXTENDED_DEBUG') || $_GET['xdebug']) {
|
if (defined('DAEMON_EXTENDED_DEBUG') || $_GET['xdebug']) {
|
||||||
_debug("feed update interval (sec): " .
|
_debug("feed update interval (sec): " .
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
// This should be modifed as your own use warrants.
|
require_once "config.php";
|
||||||
|
require_once "simplepie/simplepie.inc";
|
||||||
|
|
||||||
require_once('../simplepie.inc');
|
SimplePie_Misc::display_cached_file($_GET['i'], SIMPLEPIE_CACHE_DIR, 'spi');
|
||||||
SimplePie_Misc::display_cached_file($_GET['i'], './cache', 'spi');
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -318,6 +318,27 @@
|
||||||
name=\"include_in_digest\"
|
name=\"include_in_digest\"
|
||||||
$checked><label for=\"include_in_digest\">".__('Include in e-mail digest')."</label>";
|
$checked><label for=\"include_in_digest\">".__('Include in e-mail digest')."</label>";
|
||||||
|
|
||||||
|
$cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images"));
|
||||||
|
|
||||||
|
if ($cache_images) {
|
||||||
|
$checked = "checked";
|
||||||
|
} else {
|
||||||
|
$checked = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ENABLE_SIMPLEPIE && SIMPLEPIE_CACHE_IMAGES) {
|
||||||
|
$disabled = "";
|
||||||
|
$label_class = "";
|
||||||
|
} else {
|
||||||
|
$disabled = "disabled";
|
||||||
|
$label_class = "class='insensitive'";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<br><input type=\"checkbox\" id=\"cache_images\"
|
||||||
|
name=\"cache_images\" $disabled
|
||||||
|
$checked><label $label_class for=\"cache_images\">".
|
||||||
|
__('Cache images locally')."</label>";
|
||||||
|
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
@ -351,6 +372,8 @@
|
||||||
$hidden = checkbox_to_sql_bool(db_escape_string($_POST["hidden"]));
|
$hidden = checkbox_to_sql_bool(db_escape_string($_POST["hidden"]));
|
||||||
$include_in_digest = checkbox_to_sql_bool(
|
$include_in_digest = checkbox_to_sql_bool(
|
||||||
db_escape_string($_POST["include_in_digest"]));
|
db_escape_string($_POST["include_in_digest"]));
|
||||||
|
$cache_images = checkbox_to_sql_bool(
|
||||||
|
db_escape_string($_POST["cache_images"]));
|
||||||
|
|
||||||
if (get_pref($link, 'ENABLE_FEED_CATS')) {
|
if (get_pref($link, 'ENABLE_FEED_CATS')) {
|
||||||
if ($cat_id && $cat_id != 0) {
|
if ($cat_id && $cat_id != 0) {
|
||||||
|
@ -371,6 +394,12 @@
|
||||||
$parent_qpart = 'parent_feed = NULL';
|
$parent_qpart = 'parent_feed = NULL';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ENABLE_SIMPLEPIE && SIMPLEPIE_CACHE_IMAGES) {
|
||||||
|
$cache_images_qpart = "cache_images = $cache_images,";
|
||||||
|
} else {
|
||||||
|
$cache_images_qpart = "";
|
||||||
|
}
|
||||||
|
|
||||||
$result = db_query($link, "UPDATE ttrss_feeds SET
|
$result = db_query($link, "UPDATE ttrss_feeds SET
|
||||||
$category_qpart $parent_qpart,
|
$category_qpart $parent_qpart,
|
||||||
title = '$feed_title', feed_url = '$feed_link',
|
title = '$feed_title', feed_url = '$feed_link',
|
||||||
|
@ -381,6 +410,7 @@
|
||||||
private = $private,
|
private = $private,
|
||||||
rtl_content = $rtl_content,
|
rtl_content = $rtl_content,
|
||||||
hidden = $hidden,
|
hidden = $hidden,
|
||||||
|
$cache_images_qpart
|
||||||
include_in_digest = $include_in_digest
|
include_in_digest = $include_in_digest
|
||||||
WHERE id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]);
|
WHERE id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]);
|
||||||
|
|
||||||
|
|
|
@ -668,7 +668,7 @@ span.feed_error {
|
||||||
color : red;
|
color : red;
|
||||||
}
|
}
|
||||||
|
|
||||||
span.insensitive, div.insensitive, li.insensitive {
|
span.insensitive, div.insensitive, li.insensitive, label.insensitive {
|
||||||
color : gray;
|
color : gray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue