Merge pull request #106 from RamadhanAmizudin/master

Update theme_assets.php
This commit is contained in:
Claude 2013-11-04 05:10:20 -08:00
commit 3d9f22ef48

View File

@ -23,7 +23,7 @@ class Theme_assets extends CI_Controller
function css() function css()
{ {
$css_file = $this->uri->segment(4); $css_file = $this->uri->segment(4);
$css_file = basename( $css_file ); // Fix LFI Vulnerability
//file path //file path
$file_path = 'themes/' . $this->theme . '/css/' . $css_file; $file_path = 'themes/' . $this->theme . '/css/' . $css_file;
@ -33,6 +33,11 @@ class Theme_assets extends CI_Controller
{ {
$file_path = 'themes/default/css/' . $css_file; $file_path = 'themes/default/css/' . $css_file;
} }
// Double checking file
if( !file_exists( $file_path ) ) {
return false;
}
//send //send
header('Content-type: text/css'); header('Content-type: text/css');
@ -43,7 +48,7 @@ class Theme_assets extends CI_Controller
function images() function images()
{ {
$image_file = $this->uri->segment(4); $image_file = $this->uri->segment(4);
$image_file = basename( $image_file );
//file path //file path
$file_path = 'themes/' . $this->theme . '/images/' . $image_file; $file_path = 'themes/' . $this->theme . '/images/' . $image_file;
@ -53,7 +58,11 @@ class Theme_assets extends CI_Controller
{ {
$file_path = 'themes/default/images/' . $image_file; $file_path = 'themes/default/images/' . $image_file;
} }
// double checking file
if( !file_exists( $file_path ) ) {
return false;
}
//send //send
$size = getimagesize($file_path); $size = getimagesize($file_path);
header('Content-type: ' . $size['mime']); header('Content-type: ' . $size['mime']);