summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-12-29 11:56:22 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-12-29 11:56:22 +0100
commit7584364a4c2b407e97909e94ba274da62620abea (patch)
treeb346b9c8fe1bbc3309ab0c2a468014a9ee4eed9f
parentfcc92fbdf7889bbb70aa8666eb1e02f835727f3b (diff)
Fix behaviour when favicon url is not found
If url is not find, we copy default favicon into favicon dir so at the next try, we don't search the url again. See https://github.com/FreshRSS/FreshRSS/issues/290 See https://github.com/FreshRSS/FreshRSS/issues/727
-rw-r--r--p/f.php8
-rw-r--r--p/themes/icons/default_favicon.icobin0 -> 1150 bytes
-rw-r--r--p/themes/icons/default_favicon.pngbin726 -> 0 bytes
3 files changed, 4 insertions, 4 deletions
diff --git a/p/f.php b/p/f.php
index d00b36eb0..fefbf9a10 100644
--- a/p/f.php
+++ b/p/f.php
@@ -7,19 +7,19 @@ include(LIB_PATH . '/Favicon/DataAccess.php');
$favicons_dir = DATA_PATH . '/favicons/';
-$default_favicon = PUBLIC_PATH . '/themes/icons/default_favicon.png';
+$default_favicon = PUBLIC_PATH . '/themes/icons/default_favicon.ico';
/* Télécharge le favicon d'un site et le place sur le serveur */
function download_favicon($website, $dest) {
- global $favicons_dir;
+ global $favicons_dir, $default_favicon;
$favicon_getter = new \Favicon\Favicon();
$favicon_getter->setCacheDir($favicons_dir);
$favicon_url = $favicon_getter->get($website);
if ($favicon_url === false) {
- return false;
+ return @copy($default_favicon, $dest);
}
$c = curl_init($favicon_url);
@@ -47,7 +47,7 @@ function show_default_favicon() {
global $default_favicon;
header('HTTP/1.1 404 Not Found');
- header('Content-Type: image/png');
+ header('Content-Type: image/ico');
readfile($default_favicon);
die();
}
diff --git a/p/themes/icons/default_favicon.ico b/p/themes/icons/default_favicon.ico
new file mode 100644
index 000000000..e4d5e8f67
--- /dev/null
+++ b/p/themes/icons/default_favicon.ico
Binary files differ
diff --git a/p/themes/icons/default_favicon.png b/p/themes/icons/default_favicon.png
deleted file mode 100644
index 1e660b740..000000000
--- a/p/themes/icons/default_favicon.png
+++ /dev/null
Binary files differ