diff options
author | robocoder <anthon.pang@gmail.com> | 2009-05-28 03:10:11 +0400 |
---|---|---|
committer | robocoder <anthon.pang@gmail.com> | 2009-05-28 03:10:11 +0400 |
commit | c654e7382820fa5c1155eca30ee9617bd5b86d6d (patch) | |
tree | f02932d8b4491834e41a8ee7285bc3da1eef9de0 /js/index.php | |
parent | 7d6ba208948710b78336a4c63a072ddfd21b979a (diff) |
fixes #355 - OO version of piwik.js which no longer modifies DOM;
remove misc/testJavascripTracker (interactive tests);
add tests/javascript (QUnit unit tests);
fixes #661 - use click event instead of mousedown;
fixes #549 - define your own download/outlink tracking classes;
fixes #82 - add hook interface for module
git-svn-id: http://dev.piwik.org/svn/trunk@1151 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'js/index.php')
-rwxr-xr-x | js/index.php | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/js/index.php b/js/index.php new file mode 100755 index 0000000000..60786f2849 --- /dev/null +++ b/js/index.php @@ -0,0 +1,41 @@ +<?php +/** + * Piwik - Open source web analytics + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later + * @version $Id$ + */ + +$file = "../piwik.js"; + +/* + * Conditional GET + */ +if (file_exists($file)) { + $modifiedSince = ''; + if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { + $modifiedSince = $_SERVER['HTTP_IF_MODIFIED_SINCE']; + } + $lastModified = gmdate('D, d M Y H:i:s', filemtime($file)) . ' GMT'; + + // strip any trailing data appended to header + if (false !== ($semicolon = strpos($modifiedSince, ';'))) { + $modifiedSince = substr($modifiedSince, 0, $semicolon); + } + + if ($modifiedSince == $lastModified) { + header('HTTP/1.1 304 Not Modified'); + } else { + header('Last-Modified: ' . $lastModified); + header('Content-Length: ' . filesize($file)); + header('Content-Type: application/x-javascript'); + + if (!readfile($file)) { + header ("HTTP/1.0 505 Internal server error"); + } + } +} else { + header ("HTTP/1.0 404 Not Found"); +} +exit; |