1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-23 20:31:28 +00:00

new option: USE_CURL_FOR_ICONS (closes #101), add some CRs to error messages

This commit is contained in:
Andrew Dolgov
2006-08-20 11:27:25 +01:00
parent 69ff793a6d
commit c798704b29
3 changed files with 59 additions and 31 deletions

View File

@@ -213,32 +213,51 @@
$icon_file = ICONS_DIR . "/$feed.ico";
if (!file_exists($icon_file)) {
error_reporting(0);
$r = fopen($icon_url, "r");
error_reporting (DEFAULT_ERROR_LEVEL);
if ($r) {
$tmpfname = tempnam(TMP_DIRECTORY, "ttrssicon");
$t = fopen($tmpfname, "w");
while (!feof($r)) {
$buf = fread($r, 16384);
fwrite($t, $buf);
if (USE_CURL_FOR_ICONS) {
//error_reporting(0);
$ch = curl_init($icon_url);
$fp = fopen($icon_file, "w");
if ($fp) {
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_exec($ch);
curl_close($ch);
fclose($fp);
}
fclose($r);
fclose($t);
//error_reporting (DEFAULT_ERROR_LEVEL);
} else {
error_reporting(0);
if (!rename($tmpfname, $icon_file)) {
unlink($tmpfname);
}
chmod($icon_file, 0644);
$r = fopen($icon_url, "r");
error_reporting (DEFAULT_ERROR_LEVEL);
if ($r) {
$tmpfname = tempnam(TMP_DIRECTORY, "ttrssicon");
$t = fopen($tmpfname, "w");
while (!feof($r)) {
$buf = fread($r, 16384);
fwrite($t, $buf);
}
fclose($r);
fclose($t);
error_reporting(0);
if (!rename($tmpfname, $icon_file)) {
unlink($tmpfname);
}
chmod($icon_file, 0644);
error_reporting (DEFAULT_ERROR_LEVEL);
}
}
}