summaryrefslogtreecommitdiff
path: root/itjs.php
diff options
context:
space:
mode:
Diffstat (limited to 'itjs.php')
-rw-r--r--itjs.php31
1 files changed, 17 insertions, 14 deletions
diff --git a/itjs.php b/itjs.php
index 9f5cc78..65a78fe 100644
--- a/itjs.php
+++ b/itjs.php
@@ -26,6 +26,11 @@ require "itools/itools.lib";
if (EDC('slowjs'))
sleep(20);
+if ($_SERVER['HTTP_IF_NONE_MATCH'] && it::is_live() && !$_REQUEST['retry']) {
+ header("HTTP/1.0 304 Not Modified"); # client should always keep the component that fits the page it has
+ exit;
+}
+
$data = "";
$files = itjs::filenames(it::match('/itjs/([a-z0-9_,.-]*)', $_SERVER['PHP_SELF']));
@@ -64,23 +69,21 @@ else if (!it::match('\.html$', $file))
@header("Etag: $checksum");
-if ($checksum != $_SERVER['HTTP_IF_NONE_MATCH'] || $_REQUEST['retry'])
+if (!preg_match('/Opera/', $_SERVER['HTTP_USER_AGENT']) && it::is_live() && !$_REQUEST['retry'])
{
- if (!preg_match('/Opera/', $_SERVER['HTTP_USER_AGENT']) && it::is_live() && !$_REQUEST['retry'])
- header("Cache-Control: max-age=900");
-
- $data = itjs::strip($data);
+ header("Cache-Control: max-age=604800");
+ header("Expires: " . gmdate("D, d M Y H:i:s", time()+604800). " GMT");
+}
- if ($_REQUEST['boot'])
- {
- $data .= "window.it_boot_init();\n";
- if (!$_REQUEST['script'])
- $data = sprintf("/*sln:%d*/\n%s/*eln:%d*/", grapheme_strlen($data), strtr($data, array('%' => "%25", '.' => "%2e", 'e' => "%65", 'i' => "%69")), grapheme_strlen($data)); # Protect from Firewalls/Proxies altering Javascript source code
- }
+$data = itjs::strip($data);
- echo it_untaint($data);
+if ($_REQUEST['boot'])
+{
+ $data .= "window.it_boot_init();\n";
+ if (!$_REQUEST['script'])
+ $data = sprintf("/*sln:%d*/\n%s/*eln:%d*/", grapheme_strlen($data), strtr($data, array('%' => "%25", '.' => "%2e", 'e' => "%65", 'i' => "%69")), grapheme_strlen($data)); # Protect from Firewalls/Proxies altering Javascript source code
}
-else
- header("HTTP/1.0 304 Not Modified");
+
+echo it_untaint($data);
?>