swithed to use codepot_readfile in place of readfile in wiki.php

This commit is contained in:
hyung-hwan 2017-06-23 07:59:08 +00:00
parent 2390464e0e
commit 7a693f4aab
2 changed files with 7 additions and 30 deletions

View File

@ -364,19 +364,7 @@ class Wiki extends Controller
return;
}
header ('Content-Type: ' . mime_content_type($path));
header ('Content-Length: ' . $stat['size']);
header ('Content-Disposition: inline; filename=' . $name);
flush ();
$x = @readfile($path);
if ($x === FALSE)
{
$data['project'] = $project;
$data['message'] = sprintf (
$this->lang->line('MSG_FAILED_TO_READ_FILE'), $name);
$this->load->view ($this->VIEW_ERROR, $data);
}
codepot_readfile ($path, $name, mime_content_type($path), 'inline');
}
}
}
@ -451,19 +439,7 @@ class Wiki extends Controller
return;
}
header ('Content-Type: ' . mime_content_type($path));
header ('Content-Length: ' . $stat['size']);
header ('Content-Disposition: inline; filename=' . $filename);
flush ();
$x = @readfile($path);
if ($x === FALSE)
{
$data['project'] = $project;
$data['message'] = sprintf (
$this->lang->line('MSG_FAILED_TO_READ_FILE'), $filename);
$this->load->view ($this->VIEW_ERROR, $data);
}
codepot_readfile ($path, $filename, mime_content_type($path), 'inline');
}
}
}

View File

@ -519,7 +519,8 @@ if (!function_exists ('codepot_get_fa_file_type'))
if ( ! function_exists('codepot_readfile'))
{
function codepot_readfile ($location, $filename, $mimeType='application/octet-stream')
function codepot_readfile ($location, $filename, $mimeType='application/octet-stream', $disposition = 'attachment')
{
if(!file_exists($location))
{
@ -535,8 +536,8 @@ if ( ! function_exists('codepot_readfile'))
header("Content-Type: $mimeType");
header('Cache-Control: public, must-revalidate, max-age=0');
header('Pragma: no-cache');
header('Content-Length: ' . $size);
header('Content-Disposition: attachment; filename=' . $filename);
header("Content-Length: $size");
header("Content-Disposition: $disposition; filename=$filename");
header('Content-Transfer-Encoding: binary');
header('Connection: close');
header("Last-Modified: $time");
@ -581,7 +582,7 @@ if ( ! function_exists('codepot_readfile'))
header('Accept-Ranges: bytes');
header('Content-Length:' . ($end - $begin));
header("Content-Range: bytes $begin-" . ($end - 1) . "/$size");
header("Content-Disposition: attachment; filename=$filename");
header("Content-Disposition: $disposition; filename=$filename");
header("Content-Transfer-Encoding: binary");
header("Last-Modified: $time");
header('Connection: close');