\n"; $scriptpath = realpath(substr($_SERVER['SCRIPT_FILENAME'],0,strrpos($_SERVER['SCRIPT_FILENAME'],"/"))); if ($scriptpath == substr(realpath("./" . $cache_dir),0,strlen($scriptpath))) { $cacheURL = "http://" . $_SERVER['HTTP_HOST'] . substr($_SERVER['PHP_SELF'],0,strrpos($_SERVER['PHP_SELF'],"/")) . substr($abs_output,strlen($scriptpath)); } else { $cacheURL = $cache_base_URL; } if(strlen($cacheURL)>0) { $html_output .= "However, the websnap shot has been written to the cache directory and can be accessed there.
\n"; $webfilename=findwebfile($abs_output); if (strlen($webfilename)>0) { $html_output .= "Click here to access the file that looks most like the main file for the websnapshot (or wait 5 seconds to be redirected there).
\n"; $html_output .= "If that doens't work, check out the entire websnapshot folder and look for the main file yourself."; $html_output = "\n\n\n\n\n" . $html_output . "\n"; } else { $html_output .= "I didn't find a file that looks most like the main file for the websnapshot, "; $html_output .= "so you might want to check out the entire websnapshot folder and look for the main file yourself."; $html_output = "\n\n\n\n" . $html_output . "\n"; } } else { $html_output .= "However, if you use a cache directory which is located in the same directory as this script "; $html_output .= "($scriptpath) or you provide the base URL to whichever cache directory in the settings.php, "; $html_output .= "you would be able to use the workaround provided by this script."; $html_output = "\n\n\n\n" . $html_output . "\n"; } echo ($html_output); } else { header("Content-type: " . $mimeType); header("Content-Disposition: filename=\"" . pathinfo($result, PATHINFO_BASENAME) . "\""); readfile($result); } } else { echo("AN ERROR HAS OCCURRED! - " . $result); } //purge old files from the cache again if $cache_age=0 (ie immediate deletion of cache files) if (($cache_age==0) && (strlen($cacheURL)==0)) { // do not purge immediately if web accessible websnapshot has been un zipped purge_cache(realpath("./" . $cache_dir), -1); } ?>