mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-26 04:51:08 -05:00
code formatter
This commit is contained in:
parent
57b2efcfdc
commit
a11b6f76d1
@ -4,6 +4,7 @@
|
|||||||
* Function list:
|
* Function list:
|
||||||
* - __construct()
|
* - __construct()
|
||||||
* - css()
|
* - css()
|
||||||
|
* - fonts()
|
||||||
* - images()
|
* - images()
|
||||||
* - js()
|
* - js()
|
||||||
* - _expires_header()
|
* - _expires_header()
|
||||||
@ -24,7 +25,9 @@ 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
|
||||||
|
|
||||||
$file_path = 'themes/' . $this->theme . '/css/' . $css_file;
|
$file_path = 'themes/' . $this->theme . '/css/' . $css_file;
|
||||||
|
|
||||||
//fallback to default css if view in theme not found
|
//fallback to default css if view in theme not found
|
||||||
@ -35,7 +38,9 @@ class Theme_assets extends CI_Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Double checking file
|
// Double checking file
|
||||||
if( !file_exists( $file_path ) ) {
|
|
||||||
|
if (!file_exists($file_path))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,11 +53,14 @@ class Theme_assets extends CI_Controller
|
|||||||
function fonts()
|
function fonts()
|
||||||
{
|
{
|
||||||
$font_file = $this->uri->segment(4);
|
$font_file = $this->uri->segment(4);
|
||||||
|
|
||||||
//file path
|
//file path
|
||||||
$file_path = 'themes/' . $this->theme . '/fonts/' . $font_file;
|
$file_path = 'themes/' . $this->theme . '/fonts/' . $font_file;
|
||||||
|
|
||||||
//no fallback to default, since default has no such fonts
|
//no fallback to default, since default has no such fonts
|
||||||
//since no fallbcack, there is no doucle checking for file
|
//since no fallbcack, there is no doucle checking for file
|
||||||
|
|
||||||
|
|
||||||
if (!file_exists($file_path))
|
if (!file_exists($file_path))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -60,22 +68,34 @@ class Theme_assets extends CI_Controller
|
|||||||
|
|
||||||
//send
|
//send
|
||||||
$path_parts = pathinfo(dirname(dirname(dirname(__FILE__))) . '/' . $file_path);
|
$path_parts = pathinfo(dirname(dirname(dirname(__FILE__))) . '/' . $file_path);
|
||||||
if ( $path_parts['extension'] == "woff" ) {
|
|
||||||
|
if ($path_parts['extension'] == "woff")
|
||||||
|
{
|
||||||
header('Content-type: application/font-woff');
|
header('Content-type: application/font-woff');
|
||||||
}
|
}
|
||||||
if ( $path_parts['extension'] == "eot" ) {
|
|
||||||
|
if ($path_parts['extension'] == "eot")
|
||||||
|
{
|
||||||
header('Content-type: application/vnd.ms-fontobject');
|
header('Content-type: application/vnd.ms-fontobject');
|
||||||
}
|
}
|
||||||
if ( $path_parts['extension'] == "ttf" || $path_parts['extension'] == "ttc" ) {
|
|
||||||
|
if ($path_parts['extension'] == "ttf" || $path_parts['extension'] == "ttc")
|
||||||
|
{
|
||||||
header('Content-type: application/x-font-ttf');
|
header('Content-type: application/x-font-ttf');
|
||||||
}
|
}
|
||||||
if ( $path_parts['extension'] == "otf" ) {
|
|
||||||
|
if ($path_parts['extension'] == "otf")
|
||||||
|
{
|
||||||
header('Content-type: font/opentype');
|
header('Content-type: font/opentype');
|
||||||
}
|
}
|
||||||
if ( $path_parts['extension'] == "svg" ) {
|
|
||||||
|
if ($path_parts['extension'] == "svg")
|
||||||
|
{
|
||||||
header('Content-type: image/svg+xml');
|
header('Content-type: image/svg+xml');
|
||||||
}
|
}
|
||||||
if ( $path_parts['extension'] == "svgz" ) {
|
|
||||||
|
if ($path_parts['extension'] == "svgz")
|
||||||
|
{
|
||||||
header("Content-Encoding: gzip");
|
header("Content-Encoding: gzip");
|
||||||
header('Content-type: image/svg+xml');
|
header('Content-type: image/svg+xml');
|
||||||
}
|
}
|
||||||
@ -87,6 +107,7 @@ class Theme_assets extends CI_Controller
|
|||||||
{
|
{
|
||||||
$image_file = $this->uri->segment(4);
|
$image_file = $this->uri->segment(4);
|
||||||
$image_file = basename($image_file);
|
$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;
|
||||||
|
|
||||||
@ -98,9 +119,12 @@ class Theme_assets extends CI_Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
// double checking file
|
// double checking file
|
||||||
if( !file_exists( $file_path ) ) {
|
|
||||||
|
if (!file_exists($file_path))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//send
|
//send
|
||||||
$size = getimagesize($file_path);
|
$size = getimagesize($file_path);
|
||||||
header('Content-type: ' . $size['mime']);
|
header('Content-type: ' . $size['mime']);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user