summaryrefslogtreecommitdiff
path: root/itjs.php
diff options
context:
space:
mode:
authorChristian Schneider2007-10-11 00:39:30 +0000
committerChristian Schneider2007-10-11 00:39:30 +0000
commit35fe33f7364329dacf415c950bff01b6de9ef88e (patch)
treeb0e6b018b50038ca20266723c53750268f508df5 /itjs.php
parent1f95711ff3e9697cd85a54545ab42e5fd3611317 (diff)
downloaditools-35fe33f7364329dacf415c950bff01b6de9ef88e.tar.gz
itools-35fe33f7364329dacf415c950bff01b6de9ef88e.tar.bz2
itools-35fe33f7364329dacf415c950bff01b6de9ef88e.zip
Populated release branch
Diffstat (limited to 'itjs.php')
-rw-r--r--itjs.php59
1 files changed, 59 insertions, 0 deletions
diff --git a/itjs.php b/itjs.php
new file mode 100644
index 0000000..818f9b8
--- /dev/null
+++ b/itjs.php
@@ -0,0 +1,59 @@
+<?php
+/*
+** $Id$
+**
+** itjs.php - Delivers /itjs/ files through AliasMatch in httpd.conf
+**
+** ITools - the Internet Tools Library
+**
+** Copyright (C) 1995-2003 by the ITools Authors.
+** This program is free software; you can redistribute it and/or
+** modify it under the terms of either the GNU General Public License
+** or the GNU Lesser General Public License, as published by the Free
+** Software Foundation. See http://www.gnu.org/licenses/ for details.
+*/
+
+require "itools/itools.lib";
+
+if (EDC('slowjs'))
+ sleep(20);
+
+$data = "";
+$files = itjs::filenames(basename($_SERVER['PHP_SELF']));
+
+foreach ($files as $file)
+ $data .= ereg('\.php|\.html$', $file) ? @include($file) : @file_get_contents($file);
+
+$checksum = strlen($data) . itjs::checksum($files);
+
+if (ereg('\.gif$', $file))
+ header("Content-Type: image/gif");
+else if (!ereg('\.html$', $file))
+{
+ if ($_REQUEST['boot'] && !$_REQUEST['retry'])
+ ob_start('ob_gzhandler');
+
+ header("Content-Type: application/x-javascript; charset=iso-8859-1");
+}
+
+@header("Etag: $checksum");
+
+if ($checksum != $_SERVER['HTTP_IF_NONE_MATCH'])
+{
+ if (!preg_match('/Opera/', $_SERVER['HTTP_USER_AGENT']))
+ header("Cache-Control: max-age=900");
+
+ $data = itjs::strip($data);
+
+ if ($_REQUEST['boot'])
+ {
+ $data .= "window.it_boot_init();\n";
+ $data .= sprintf("/*sln:% 8d*/", strlen($data) + 16);
+ }
+
+ echo $data;
+}
+else
+ header("HTTP/1.0 304 Not Modified");
+
+?>