This commit is contained in:
Claude 2015-09-03 16:09:47 +02:00
parent da3b080dfa
commit 18ef419bd8
7 changed files with 74 additions and 20 deletions

View File

@ -26,28 +26,82 @@ class Theme_assets extends CI_Controller
$css_file = $this->uri->segment(4); $css_file = $this->uri->segment(4);
$css_file = basename($css_file); // Fix LFI Vulnerability $css_file = basename($css_file); // Fix LFI Vulnerability
//file path
$file_path = 'themes/' . $this->theme . '/css/' . $css_file;
//fallback to default css if view in theme not found
if (!file_exists($file_path)) if ($css_file == 'fonts')
{ {
$file_path = 'themes/default/css/' . $css_file; $font_file = $this->uri->segment(5);
} $font_file = basename($font_file);
echo $font_file;
// Double checking file //file path
$file_path = 'themes/' . $this->theme . '/css/fonts/' . $font_file;
if (!file_exists($file_path))
if (!file_exists($file_path))
{
return false;
}
$path_parts = pathinfo(dirname(dirname(dirname(__FILE__))) . '/' . $file_path);
if ($path_parts['extension'] == "woff")
{
header('Content-type: application/font-woff');
}
if ($path_parts['extension'] == "eot")
{
header('Content-type: application/vnd.ms-fontobject');
}
if ($path_parts['extension'] == "ttf" || $path_parts['extension'] == "ttc")
{
header('Content-type: application/x-font-ttf');
}
if ($path_parts['extension'] == "otf")
{
header('Content-type: font/opentype');
}
if ($path_parts['extension'] == "svg")
{
header('Content-type: image/svg+xml');
}
if ($path_parts['extension'] == "svgz")
{
header("Content-Encoding: gzip");
header('Content-type: image/svg+xml');
}
//send
$this->_expires_header(1);
readfile($file_path);
}
else
{ {
return false;
}
//send //file path
header('Content-type: text/css'); $file_path = 'themes/' . $this->theme . '/css/' . $css_file;
$this->_expires_header(1);
readfile($file_path); //fallback to default css if view in theme not found
if (!file_exists($file_path))
{
$file_path = 'themes/default/css/' . $css_file;
}
// Double checking file
if (!file_exists($file_path))
{
return false;
}
//send
header('Content-type: text/css');
$this->_expires_header(1);
readfile($file_path);
}
} }
function fonts() function fonts()

View File

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

View File

@ -17,8 +17,8 @@ $page_title .= $this->config->item('site_name');
//Carabiner //Carabiner
$this->carabiner->config(array( $this->carabiner->config(array(
'script_dir' => 'themes/bootstrap/js/', 'script_dir' => 'themes/i386/js/',
'style_dir' => 'themes/bootstrap/css/', 'style_dir' => 'themes/i386/css/',
'cache_dir' => 'static/asset/', 'cache_dir' => 'static/asset/',
'base_uri' => base_url(), 'base_uri' => base_url(),
'combine' => true, 'combine' => true,
@ -44,7 +44,7 @@ $searchparams = ($this->input->get('search') ? '?search=' . $this->input->get('s
</head> </head>
<body> <body>
<header> <header>
<div class="navbar navbar-fixed-top"> <div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner"> <div class="navbar-inner">
<div class="container"> <div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">