diff --git a/htdocs/application/controllers/Theme_assets.php b/htdocs/application/controllers/Theme_assets.php index f0b2294..fda8b8e 100644 --- a/htdocs/application/controllers/Theme_assets.php +++ b/htdocs/application/controllers/Theme_assets.php @@ -26,28 +26,82 @@ class Theme_assets extends CI_Controller $css_file = $this->uri->segment(4); $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 - - if (!file_exists($file_path)) + //file path + $file_path = 'themes/' . $this->theme . '/css/fonts/' . $font_file; + + 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 - header('Content-type: text/css'); - $this->_expires_header(1); - readfile($file_path); + //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)) + { + $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() diff --git a/htdocs/themes/i386/fonts/Fixedsys500c.eot b/htdocs/themes/i386/css/fonts/Fixedsys500c.eot similarity index 100% rename from htdocs/themes/i386/fonts/Fixedsys500c.eot rename to htdocs/themes/i386/css/fonts/Fixedsys500c.eot diff --git a/htdocs/themes/i386/fonts/Fixedsys500c.otf b/htdocs/themes/i386/css/fonts/Fixedsys500c.otf similarity index 100% rename from htdocs/themes/i386/fonts/Fixedsys500c.otf rename to htdocs/themes/i386/css/fonts/Fixedsys500c.otf diff --git a/htdocs/themes/i386/fonts/Fixedsys500c.svg b/htdocs/themes/i386/css/fonts/Fixedsys500c.svg similarity index 100% rename from htdocs/themes/i386/fonts/Fixedsys500c.svg rename to htdocs/themes/i386/css/fonts/Fixedsys500c.svg diff --git a/htdocs/themes/i386/fonts/Fixedsys500c.ttf b/htdocs/themes/i386/css/fonts/Fixedsys500c.ttf similarity index 100% rename from htdocs/themes/i386/fonts/Fixedsys500c.ttf rename to htdocs/themes/i386/css/fonts/Fixedsys500c.ttf diff --git a/htdocs/themes/i386/fonts/Fixedsys500c.woff b/htdocs/themes/i386/css/fonts/Fixedsys500c.woff similarity index 100% rename from htdocs/themes/i386/fonts/Fixedsys500c.woff rename to htdocs/themes/i386/css/fonts/Fixedsys500c.woff diff --git a/htdocs/themes/i386/views/defaults/header.php b/htdocs/themes/i386/views/defaults/header.php index 7d73167..b75ac15 100644 --- a/htdocs/themes/i386/views/defaults/header.php +++ b/htdocs/themes/i386/views/defaults/header.php @@ -17,8 +17,8 @@ $page_title .= $this->config->item('site_name'); //Carabiner $this->carabiner->config(array( - 'script_dir' => 'themes/bootstrap/js/', - 'style_dir' => 'themes/bootstrap/css/', + 'script_dir' => 'themes/i386/js/', + 'style_dir' => 'themes/i386/css/', 'cache_dir' => 'static/asset/', 'base_uri' => base_url(), 'combine' => true, @@ -44,7 +44,7 @@ $searchparams = ($this->input->get('search') ? '?search=' . $this->input->get('s