summaryrefslogtreecommitdiffstats
path: root/application/helpers/filebin_helper.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2012-05-17 22:46:29 +0200
committerFlorian Pritz <bluewind@xinu.at>2012-05-17 22:46:29 +0200
commit27ba952bf8e0199c6f96a31d0d68ad7abca43b6a (patch)
tree80195ec9323eb134bd0cc038a04c80daea562da4 /application/helpers/filebin_helper.php
parentac6d834e2b4f02d656e38fe300b5c6404d1f75e6 (diff)
Move some functions from file_mod to file controller
Models shouldn't really call views Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/helpers/filebin_helper.php')
-rw-r--r--application/helpers/filebin_helper.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/application/helpers/filebin_helper.php b/application/helpers/filebin_helper.php
index d9a490bd6..f6663144e 100644
--- a/application/helpers/filebin_helper.php
+++ b/application/helpers/filebin_helper.php
@@ -221,4 +221,26 @@ function link_with_mtime($file)
return $link;
}
+function handle_etag($etag)
+{
+ $etag = strtolower($etag);
+ $modified = true;
+
+ if(isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
+ $oldtag = trim(strtolower($_SERVER['HTTP_IF_NONE_MATCH']), '"');
+ if($oldtag == $etag) {
+ $modified = false;
+ } else {
+ $modified = true;
+ }
+ }
+
+ header('Etag: "'.$etag.'"');
+
+ if (!$modified) {
+ header("HTTP/1.1 304 Not Modified");
+ exit();
+ }
+}
+
# vim: set noet: