summaryrefslogtreecommitdiff
path: root/system/helpers/expires.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-01-06 17:05:00 -0800
committerBharat Mediratta <bharat@menalto.com>2010-01-06 17:05:00 -0800
commit10c05c855a1634a60048a52e8d90bc51f187ede7 (patch)
treeb65a9d3b2f2213503e3f143b18af6ebd831bc554 /system/helpers/expires.php
parent058a84ed76df96aeb6ec082d16fe0d8f317faac2 (diff)
parentded8fc593cccaf66236fb271a6d3f962d8c4b337 (diff)
Merge branch 'master' of git@github.com:gallery/gallery3
Diffstat (limited to 'system/helpers/expires.php')
-rw-r--r--system/helpers/expires.php28
1 files changed, 14 insertions, 14 deletions
diff --git a/system/helpers/expires.php b/system/helpers/expires.php
index 5f599e13..81468ce3 100644
--- a/system/helpers/expires.php
+++ b/system/helpers/expires.php
@@ -2,9 +2,7 @@
/**
* Controls headers that effect client caching of pages
*
- * $Id: expires.php 4679 2009-11-10 01:45:52Z isaiah $
- *
- * @package Core
+ * @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2009 Kohana Team
* @license http://kohanaphp.com/license
@@ -15,18 +13,19 @@ class expires_Core {
* Sets the amount of time before content expires
*
* @param integer Seconds before the content expires
- * @return integer Timestamp when the content expires
+ * @param integer Last modified timestamp in seconds(optional)
+ * @return integer Timestamp when the content expires
*/
public static function set($seconds = 60, $last_modified=null)
{
$now = time();
$expires = $now + $seconds;
- if (empty($last_modified))
- {
- $last_modified = $now;
- }
+ if (empty($last_modified))
+ {
+ $last_modified = $now;
+ }
- header('Last-Modified: '.gmdate('D, d M Y H:i:s T', $last_modified));
+ header('Last-Modified: '.gmdate('D, d M Y H:i:s T', $last_modified));
// HTTP 1.0
header('Expires: '.gmdate('D, d M Y H:i:s T', $expires));
@@ -70,7 +69,7 @@ class expires_Core {
* @uses expires::get()
*
* @param integer Maximum age of the content in seconds
- * @param integer Last modified timestamp in seconds
+ * @param integer Last modified timestamp in seconds(optional)
* @return integer|boolean Timestamp of the If-Modified-Since header or FALSE when header is lacking or malformed
*/
public static function check($seconds = 60, $modified=null)
@@ -79,10 +78,11 @@ class expires_Core {
{
$now = time();
- if (empty($modified))
- {
- $modified = $now;
- }
+ if (empty($last_modified))
+ {
+ $last_modified = $now;
+ }
+ $max_age = $expires - time();
if ($modified <= $last_modified)
{