]> git.wh0rd.org Git - tt-rss.git/commitdiff
only accept favicons which are actual images while using CURL (closes #261)
authorAndrew Dolgov <fox@bah.org.ru>
Tue, 15 Dec 2009 11:40:36 +0000 (14:40 +0300)
committerAndrew Dolgov <fox@bah.org.ru>
Tue, 15 Dec 2009 11:40:36 +0000 (14:40 +0300)
functions.php

index 7980b68d8bd7a9d5b3422ddbf0b40229a39a26f7..dfe1a41c6359eea3b3e8c6fee1b7121979106e3b 100644 (file)
                                curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15);
                                curl_setopt($ch, CURLOPT_TIMEOUT, 45);
                                curl_exec($ch);
-                               curl_close($ch);
-                               fclose($fp);                                    
+
+                               if (strpos(curl_getinfo($ch, CURLINFO_CONTENT_TYPE), "image/") !== false) {
+                                       curl_close($ch);
+                                       fclose($fp);                                    
+                                       $contents = file_get_contents($tmpfile);
+                               } else {
+                                       curl_close($ch);
+                                       fclose($fp);                                    
+                               }
                        }
 
-                       $contents =  file_get_contents($tmpfile);
                        unlink($tmpfile);
 
                        return $contents;