Index: trunk/core/kernel/processors/main_processor.php =================================================================== diff -u -N -r8757 -r8860 --- trunk/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 8757) +++ trunk/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 8860) @@ -559,6 +559,10 @@ */ function MyInclude($params) { + if (defined('NPARSER') && NPARSER) { + return $this->Application->Parser->IncludeTemplate($params, isset($params['is_silent']) ? 1 : 0); + } + $BlockParser =& $this->Application->makeClass('TemplateParser'); /* @var $BlockParser TemplateParser */ @@ -991,6 +995,32 @@ { safeDefine('DBG_SKIP_REPORTING', 1); $lang =& $this->Application->recallObject('lang.current'); + + if (isset($params['cache']) && $params['cache']) { + $nextyear = intval(date('Y') + 1); + + $format = "D, d M Y H:i:s"; + $expiration = gmdate($format, gmmktime() + $params['cache']).' GMT'; + $last_modified = gmmktime(); + + header ('Cache-Control: public, cache, max-age='.$params['cache']); + header ("Expires: $expiration"); + header ('Pragma: public'); + + // Getting headers sent by the client. + $headers = request_headers(); + + // Checking if the client is validating his cache and if it is current. + if (isset($headers['If-Modified-Since']) && (strtotime($headers['If-Modified-Since']) > $last_modified-$params['cache'])) { + // Client's cache IS current, so we just respond '304 Not Modified'. + header('Last-Modified: '.gmdate($format, strtotime($headers['If-Modified-Since'])).' GMT', true, 304); + exit(); + } else { + // Image not cached or cache outdated, we respond '200 OK' and output the image. + header('Last-Modified: '.gmdate($format, $last_modified).' GMT', true, 200); + } + } + header('Content-type: text/xml; charset='.$lang->GetDBField('Charset')); }