diff options
author | Andrew Dolgov <[email protected]> | 2009-12-15 14:40:36 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2009-12-15 14:40:36 +0300 |
commit | 2a41fc979057240ab5251e83a3d3f18146ea8b66 (patch) | |
tree | 76b1a9e64143764e94349645d7206255129643e5 /functions.php | |
parent | 24ecbcae503da6a104ad38bf2b618c3f6024be64 (diff) |
only accept favicons which are actual images while using CURL (closes #261)
Diffstat (limited to 'functions.php')
-rw-r--r-- | functions.php | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/functions.php b/functions.php index 7980b68d8..dfe1a41c6 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; |