OC_Response: add setExpiresHeader function
This commit is contained in:
parent
45bb6f5fd4
commit
125cf79a37
|
@ -27,9 +27,7 @@ OC_JSON::checkLoggedIn();
|
||||||
OC_Util::checkAppEnabled('contacts');
|
OC_Util::checkAppEnabled('contacts');
|
||||||
|
|
||||||
function getStandardImage(){
|
function getStandardImage(){
|
||||||
$date = new DateTime('now');
|
OC_Response::setExpiresHeader('P10D');
|
||||||
$date->add(new DateInterval('P10D'));
|
|
||||||
header('Expires: '.$date->format(DateTime::RFC2822));
|
|
||||||
OC_Response::enableCaching();
|
OC_Response::enableCaching();
|
||||||
OC_Response::redirect(OC_Helper::imagePath('contacts', 'person.png'));
|
OC_Response::redirect(OC_Helper::imagePath('contacts', 'person.png'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,18 @@ class OC_Response {
|
||||||
header('Location: '.$location);
|
header('Location: '.$location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static public function setExpiresHeader($expires) {
|
||||||
|
if (is_string($expires) && $expires[0] == 'P') {
|
||||||
|
$interval = $expires;
|
||||||
|
$expires = new DateTime('now');
|
||||||
|
$expires->add(new DateInterval(expires));
|
||||||
|
}
|
||||||
|
if ($expires instanceof DateTime) {
|
||||||
|
$expires = $expires->format(DateTime::RFC2822);
|
||||||
|
}
|
||||||
|
header('Expires: '.expires);
|
||||||
|
}
|
||||||
|
|
||||||
static public function setETagHeader($etag) {
|
static public function setETagHeader($etag) {
|
||||||
if (empty($etag)) {
|
if (empty($etag)) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue