. ** ** itjs.php - Delivers /itjs/ files through AliasMatch in httpd.conf */ require "itools/itools.lib"; if (EDC('slowjs')) sleep(20); $data = ""; $files = itjs::filenames(it::match('/itjs/([a-z0-9_,.-]*)', $_SERVER['PHP_SELF'])); foreach ($files as $file) { ob_start(); # Needs to capture inside loop to guarantee file order $data .= it::replace(array('^1$' => ""), @include($file)); $data .= ob_get_clean(); } $checksum = strlen($data) . itjs::checksum($files); if (it::match('\.gif$', $file)) { header("Content-Type: image/gif"); } else if (it::match('\.css', $_SERVER['PHP_SELF'])) { header("Content-Type: text/css"); ob_start('ob_gzhandler'); $data .= "\n#it_boot_dom { display:none }\n"; # Append magic style for it_boot if (!it::match('^devel', $GLOBALS['ULTRASERVERTYPE'])) $data = it::replace(array('[ \t]*([{};])[ \t]*' => '$1', '/\*.*?\*/'=> ""), $data); } else if (!it::match('\.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 it_untaint($data); } else header("HTTP/1.0 304 Not Modified"); ?>