1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 04:38:27 +01:00

Replaced all direct readfile()s with shim

Fixes: #3528
This commit is contained in:
Nick Liu 2018-10-31 07:38:32 -05:00
parent 60056deb93
commit ee1a5b1278
No known key found for this signature in database
GPG Key ID: 1167C5F9C9897637
2 changed files with 9 additions and 9 deletions

View File

@ -111,7 +111,7 @@ function resize_image($source_file, $destination_file, $type = "upload", $model
{
if (($result = mimeFromFilename($source_file)) === FALSE) { return FALSE; }
header($result);
if (@readfile($source_file) === FALSE) { return FALSE; }
if (e_shims::readfile($source_file) === FALSE) { return FALSE; }
}
else
{

View File

@ -156,6 +156,7 @@ class e_thumbpage
@require($tmp.DIRECTORY_SEPARATOR.'core_functions.php');
//e107 class
@require($tmp.DIRECTORY_SEPARATOR.'e107_class.php');
e107::autoload_register(array('e107', 'autoload'));
$e107_paths = compact(
'ADMIN_DIRECTORY',
@ -324,11 +325,12 @@ class e_thumbpage
$fname = e107::getParser()->thumbCacheFile($this->_src_path, $options);
if(($this->_cache === true) && is_file(e_CACHE_IMAGE.$fname) && is_readable(e_CACHE_IMAGE.$fname) && ($this->_debug !== true))
$cache_filename = e_CACHE_IMAGE . $fname;
if(($this->_cache === true) && is_file($cache_filename) && is_readable($cache_filename) && ($this->_debug !== true))
{
$thumbnfo['lmodified'] = filemtime(e_CACHE_IMAGE.$fname);
$thumbnfo['md5s'] = md5_file(e_CACHE_IMAGE.$fname);
$thumbnfo['fsize'] = filesize(e_CACHE_IMAGE.$fname);
$thumbnfo['lmodified'] = filemtime($cache_filename);
$thumbnfo['md5s'] = md5_file($cache_filename);
$thumbnfo['fsize'] = filesize($cache_filename);
// Send required headers
if($this->_debug !== true)
@ -349,9 +351,7 @@ class e_thumbpage
// Send required headers
//$this->sendHeaders($thumbnfo);
@readfile(e_CACHE_IMAGE.$fname);
e_shims::readfile($cache_filename);
//$bench->end()->logResult('thumb.php', $_GET['src'].' - retrieve cache');
exit;
@ -443,7 +443,7 @@ class e_thumbpage
//exit;
// set cache
$thumb->save(e_CACHE_IMAGE.$fname);
$thumb->save($cache_filename);