summaryrefslogtreecommitdiff
path: root/inc/pageutils.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/pageutils.php')
-rw-r--r--inc/pageutils.php92
1 files changed, 0 insertions, 92 deletions
diff --git a/inc/pageutils.php b/inc/pageutils.php
index 105cfa18e..872191d12 100644
--- a/inc/pageutils.php
+++ b/inc/pageutils.php
@@ -528,97 +528,5 @@ function isVisiblePage($id){
return !isHiddenPage($id);
}
-/**
- * Checks and sets HTTP headers for conditional HTTP requests
- *
- * @author Simon Willison <swillison@gmail.com>
- * @link http://simon.incutio.com/archive/2003/04/23/conditionalGet
- * @param timestamp $timestamp lastmodified time of the cache file
- * @returns void or exits with previously header() commands executed
- */
-function http_conditionalRequest($timestamp){
- // A PHP implementation of conditional get, see
- // http://fishbowl.pastiche.org/archives/001132.html
- $last_modified = substr(gmdate('r', $timestamp), 0, -5).'GMT';
- $etag = '"'.md5($last_modified).'"';
- // Send the headers
- header("Last-Modified: $last_modified");
- header("ETag: $etag");
- // See if the client has provided the required headers
- if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])){
- $if_modified_since = stripslashes($_SERVER['HTTP_IF_MODIFIED_SINCE']);
- }else{
- $if_modified_since = false;
- }
-
- if (isset($_SERVER['HTTP_IF_NONE_MATCH'])){
- $if_none_match = stripslashes($_SERVER['HTTP_IF_NONE_MATCH']);
- }else{
- $if_none_match = false;
- }
-
- if (!$if_modified_since && !$if_none_match){
- return;
- }
-
- // At least one of the headers is there - check them
- if ($if_none_match && $if_none_match != $etag) {
- return; // etag is there but doesn't match
- }
-
- if ($if_modified_since && $if_modified_since != $last_modified) {
- return; // if-modified-since is there but doesn't match
- }
-
- // Nothing has changed since their last request - serve a 304 and exit
- header('HTTP/1.0 304 Not Modified');
-
- // don't produce output, even if compression is on
- ob_end_clean();
- exit;
-}
-/**
- * Let the webserver send the given file vi x-sendfile method
- *
- * @author Chris Smith <chris.eureka@jalakai.co.uk>
- * @returns void or exits with previously header() commands executed
- */
-function http_sendfile($file) {
- global $conf;
-
- //use x-sendfile header to pass the delivery to compatible webservers
- if($conf['xsendfile'] == 1){
- header("X-LIGHTTPD-send-file: $file");
- ob_end_clean();
- exit;
- }elseif($conf['xsendfile'] == 2){
- header("X-Sendfile: $file");
- ob_end_clean();
- exit;
- }elseif($conf['xsendfile'] == 3){
- header("X-Accel-Redirect: $file");
- ob_end_clean();
- exit;
- }
-
- return false;
-}
-
-/**
- * Check for a gzipped version and create if necessary
- *
- * return true if there exists a gzip version of the uncompressed file
- * (samepath/samefilename.sameext.gz) created after the uncompressed file
- *
- * @author Chris Smith <chris.eureka@jalakai.co.uk>
- */
-function http_gzip_valid($uncompressed_file) {
- $gzip = $uncompressed_file.'.gz';
- if (filemtime($gzip) < filemtime($uncompressed_file)) { // filemtime returns false (0) if file doesn't exist
- return copy($uncompressed_file, 'compress.zlib://'.$gzip);
- }
-
- return true;
-}
//Setup VIM: ex: et ts=2 enc=utf-8 :