thomascube
2008-10-27 cb15aaa2654c00ecc78880c7daec7acee6fa61ec
Also check for negative image size + set caching headers for 1 hour

1 files modified
17 ■■■■■ changed files
bin/quotaimg.php 17 ●●●●● patch | view | raw | blame | history
bin/quotaimg.php
@@ -98,8 +98,7 @@
        return false; 
    }
    if (strpos($used, '?') !== false || strpos($total, '?') !== false
        && $used != 0) {
    if (strpos($used, '?') !== false || strpos($total, '?') !== false && $used != 0) {
        $unknown = true; 
    }
@@ -169,15 +168,21 @@
    header('Content-Type: image/gif');
    
    // @todo is harcoding GMT necessary?
    header('Expires: ' . gmdate('D, d M Y H:i:s', mktime()+86400) . ' GMT');
    header('Cache-Control: ');
    header('Pragma: ');
    // cache for 1 hour
    $maxage = 3600;
    header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$maxage). ' GMT');
    header('Cache-Control: max-age=' . $maxage);
    
    imagegif($im);
    imagedestroy($im);
}
if ($width > 1 && $height > 1) {
genQuota($used, $quota, $width, $height);
}
else {
    header("HTTP/1.0 404 Not Found");
}
exit;
?>