]> git.wh0rd.org Git - tt-rss.git/commitdiff
workaround against markup being broken by cache_images()
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 28 Dec 2011 19:03:55 +0000 (23:03 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 28 Dec 2011 19:03:55 +0000 (23:03 +0400)
image.php
include/rssfuncs.php

index d240dbc68ff9330d32e79c96a9b70e7d9d7340d2..89d05d66036a49d379b3d39241365b22e7d729e7 100644 (file)
--- a/image.php
+++ b/image.php
@@ -4,12 +4,14 @@
 
        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)) {
                header("Content-type: image/png");
                echo file_get_contents($filename);
        } else {
-               header("Location: " . $_GET['url']);
+               header("Location: $url");
        }
 ?>
index 4cb81cd063b947250a427a52de9e293180609d4d..15d0d80ae5a3065a5828dfe831c2f8849009d3c4 100644 (file)
 
                                if ($_REQUEST["xdebug"] == 2) {
                                        print "update_rss_feed: content: ";
-                                       print_r(htmlspecialchars($entry_content));
+                                       print $entry_content;
                                        print "\n";
                                }
 
 
                                $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_link = db_escape_string($entry_link);
 
                                if (file_exists($local_filename)) {
                                        $entry->setAttribute('src', SELF_URL_PATH . '/image.php?url=' .
-                                               htmlspecialchars($src));
+                                               base64_encode($src));
                                }
                        }
                }