From: Andrew Dolgov Date: Tue, 15 Dec 2009 11:40:36 +0000 (+0300) Subject: only accept favicons which are actual images while using CURL (closes #261) X-Git-Tag: 1.4.0~183^2~15 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=2a41fc979057240ab5251e83a3d3f18146ea8b66;p=tt-rss.git only accept favicons which are actual images while using CURL (closes #261) --- diff --git a/functions.php b/functions.php index 7980b68d..dfe1a41c 100644 --- a/functions.php +++ b/functions.php @@ -362,11 +362,17 @@ 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;