/** * Answer true if the content has modified since the cache was last * updated, false otherwise. * * Based on info from: * Simon Willison - http://simonwillison.net/2003/Apr/23/conditionalGet/ * http://fishbowl.pastiche.org/archives/001132.html * * * @param object DateAndTime $timestamp * @param string $eTag * @return boolean * @access private * @since 5/13/08 */ private function changed(DateAndTime $timestamp, $eTag) { if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { $clientTimestamp = DateAndTime::fromString(stripslashes($_SERVER['HTTP_IF_MODIFIED_SINCE'])); } if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) { $clientETag = trim($_SERVER['HTTP_IF_NONE_MATCH']); $eTag = trim($eTag); } // Check the HTTP 1.1 ETag/If None Match parts first. if (isset($clientETag) && $clientETag == $eTag) { return false; } // Check the HTTP 1.0 Modification date if (isset($clientTimestamp) && $timestamp->isLessThanOrEqual($clientTimestamp)) { return false; } return true; }