diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-02-12 20:38:28 +0100 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-02-12 20:40:52 +0100 |
commit | 125cf79a377a1073d18e6c609da9a6fcee64677b (patch) | |
tree | 905b823b4832749cc69363e4a93427a5933176db /lib/response.php | |
parent | 45bb6f5fd49cc5f86107176cf34f1b097698ed72 (diff) | |
download | nextcloud-server-125cf79a377a1073d18e6c609da9a6fcee64677b.tar.gz nextcloud-server-125cf79a377a1073d18e6c609da9a6fcee64677b.zip |
OC_Response: add setExpiresHeader function
Diffstat (limited to 'lib/response.php')
-rw-r--r-- | lib/response.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/response.php b/lib/response.php index 5f095a0affd..7733168b5b9 100644 --- a/lib/response.php +++ b/lib/response.php @@ -42,6 +42,18 @@ class OC_Response { 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) { if (empty($etag)) { return; |