workaround against markup being broken by cache_images()

This commit is contained in:
Andrew Dolgov 2011-12-28 23:03:55 +04:00
parent 4cd3011163
commit 487f0750c8
2 changed files with 7 additions and 5 deletions

View File

@ -4,12 +4,14 @@
require_once "config.php"; require_once "config.php";
$filename = CACHE_DIR . '/images/' . sha1($_GET['url']) . '.png'; $url = base64_decode($_GET['url']);
$filename = CACHE_DIR . '/images/' . sha1($url) . '.png';
if (file_exists($filename)) { if (file_exists($filename)) {
header("Content-type: image/png"); header("Content-type: image/png");
echo file_get_contents($filename); echo file_get_contents($filename);
} else { } else {
header("Location: " . $_GET['url']); header("Location: $url");
} }
?> ?>

View File

@ -683,7 +683,7 @@
if ($_REQUEST["xdebug"] == 2) { if ($_REQUEST["xdebug"] == 2) {
print "update_rss_feed: content: "; print "update_rss_feed: content: ";
print_r(htmlspecialchars($entry_content)); print $entry_content;
print "\n"; print "\n";
} }
@ -732,7 +732,7 @@
$entry_content = db_escape_string($entry_content, false); $entry_content = db_escape_string($entry_content, false);
$content_hash = "SHA1:x" . sha1(strip_tags($entry_content)); $content_hash = "SHA1:" . sha1(strip_tags($entry_content));
$entry_title = db_escape_string($entry_title); $entry_title = db_escape_string($entry_title);
$entry_link = db_escape_string($entry_link); $entry_link = db_escape_string($entry_link);
@ -1341,7 +1341,7 @@
if (file_exists($local_filename)) { if (file_exists($local_filename)) {
$entry->setAttribute('src', SELF_URL_PATH . '/image.php?url=' . $entry->setAttribute('src', SELF_URL_PATH . '/image.php?url=' .
htmlspecialchars($src)); base64_encode($src));
} }
} }
} }