Linux lhjmq-records 5.15.0-118-generic #128-Ubuntu SMP Fri Jul 5 09:28:59 UTC 2024 x86_64
Your IP : 18.218.94.236
<?php
//Includes
include('../administration/lib/navcache.php');
//Check if the content exists already in the nav cache
if(!is_file('../navcache' . $_GET['currentpath']) || !is_file('../navcache' . $_GET['currentpath'].'.mime')){
//Load the standard includes
include('../administration/includes/mysql_connect.php');
//Get this file out of the DB
$file = navcache_get_item($mysql_link, urldecode($_GET['currentpath']));
if(isset($file['id']) && is_numeric($file['id']) && $file['contenttype'] != 'system/folder'){
//Create the tree path
$filename = path_extract_filename($_GET['currentpath']);
$tree = path_split_to_tree(str_replace('/'.$filename, '', $_GET['currentpath']));
path_create_tree($tree, '../navcache', '');
//Output the file to the system
$fp = fopen('../navcache' . $_GET['currentpath'], 'w');
fwrite($fp, $file['data']);
fclose($fp);
//Output the mimetype file to the system
$fp = fopen('../navcache' . $_GET['currentpath'].'.mime', 'w');
fwrite($fp, $file['contenttype']);
fclose($fp);
//Change the permissions of the files we just created
chmod('../navcache' . $_GET['currentpath'], '770');
chmod('../navcache' . $_GET['currentpath'].'.mime', '770');
}else{
header('Content-type: text/plain');
exit('Incorrect specifications');
}
//Load the standard includes footers
include('../administration/includes/mysql_cleanup.php');
}
//Output the file
$filesize=filesize($filepath);
header("Pragma: public");
header("Expires: 0"); // set expiration time
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header('Content-type: ' . file_get_contents('../navcache'.$_GET['currentpath'].'.mime'));
if($_GET['content'] == 'save'){
header('Content-Disposition: attachment; filename=' . path_extract_filename($_GET['currentpath']));
}else{
header('Content-Disposition: inline; filename=' . path_extract_filename($_GET['currentpath']));
}
readfile('../navcache' . $_GET['currentpath']);
?>
|