commit 20db055f024bf02a918780cc2a2d1ad8391eedbc
parent aab276ba33d7daa550267ff0e10cb169411d5864
Author: markseu <mark2011@mayberg.se>
Date: Sat, 28 Apr 2018 17:32:43 +0200
Updated core, file types
Diffstat:
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/system/plugins/core.php b/system/plugins/core.php
@@ -510,6 +510,7 @@ class YellowPage
rtrim($this->yellow->config->get("editLocation"), '/').$this->location));
} else {
$this->set("type", $this->yellow->toolbox->getFileType($this->fileName));
+ $this->set("group", $this->yellow->toolbox->getFileGroup($this->fileName, $this->yellow->config->get("mediaDir")));
$this->set("modified", date("Y-m-d H:i:s", $this->yellow->toolbox->getFileModified($this->fileName)));
}
if(!empty($pageError)) $this->set("pageError", $pageError);
@@ -2965,6 +2966,7 @@ class YellowToolbox
"html" => "text/html; charset=utf-8",
"ico" => "image/x-icon",
"js" => "application/javascript",
+ "json" => "application/json",
"jpg" => "image/jpeg",
"png" => "image/png",
"svg" => "image/svg+xml",
@@ -2982,6 +2984,19 @@ class YellowToolbox
return $contentType;
}
+ // Return file type
+ function getFileType($fileName)
+ {
+ return strtoloweru(($pos = strrposu($fileName, '.')) ? substru($fileName, $pos+1) : "");
+ }
+
+ // Return file group
+ function getFileGroup($fileName, $path)
+ {
+ preg_match("#^$path(.+?)\/#", $fileName, $matches);
+ return strtoloweru($matches[1]);
+ }
+
// Return number of bytes
function getNumberBytes($string)
{
@@ -3161,12 +3176,6 @@ class YellowToolbox
return is_file($fileName) ? filemtime($fileName) : 0;
}
- // Return file type
- function getFileType($fileName)
- {
- return strtoloweru(($pos = strrposu($fileName, '.')) ? substru($fileName, $pos+1) : "");
- }
-
// Return lines from text string, including newline
function getTextLines($text)
{