diff options
author | Christian Schneider | 2006-10-26 13:35:12 +0000 |
---|---|---|
committer | Christian Schneider | 2006-10-26 13:35:12 +0000 |
commit | a5a19fd672bc0b8113d620669b557f17dccd343a (patch) | |
tree | 876ba4fec8362ac2e9374f61b9b7f67fcd2b8e59 /itjs.php | |
download | itools-a5a19fd672bc0b8113d620669b557f17dccd343a.tar.gz itools-a5a19fd672bc0b8113d620669b557f17dccd343a.tar.bz2 itools-a5a19fd672bc0b8113d620669b557f17dccd343a.zip |
Moved itools to live branch
Diffstat (limited to 'itjs.php')
-rw-r--r-- | itjs.php | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/itjs.php b/itjs.php new file mode 100644 index 0000000..204235a --- /dev/null +++ b/itjs.php @@ -0,0 +1,57 @@ +<?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['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 ($_REQUEST['init']) + $data .= "window.it_boot_init();"; + + if ($_REQUEST['boot']) + { + $data = itjs::strip($data); + echo itjs::serialize(array('code' => $data, 'len' => strlen($data))); + } + else + echo itjs::strip($data); +} +else + header("HTTP/1.0 304 Not Modified"); + +?> |