mikuli.cz

:)
git clone https://git.sr.ht/~ashymad/mikuli.cz
Log | Files | Refs

commit c51cd8eda15534a4703a6c3f500a4343b96a1c57
parent e721dcc5616ea366a0ac72c315f49483491ea26e
Author: markseu <mark2011@mayberg.se>
Date:   Wed,  9 Aug 2017 14:08:02 +0200

Plugins update (summer remix)

Diffstat:
Msystem/config/config.ini | 1-
Msystem/plugins/core.php | 21++++++++++-----------
Msystem/plugins/update.php | 6+++---
3 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/system/config/config.ini b/system/config/config.ini @@ -34,7 +34,6 @@ ContentDefaultFile: page.txt ContentExtension: .txt ConfigExtension: .ini DownloadExtension: .download -InstallationExtension: .installation TextFile: text.ini LanguageFile: language-(.*).txt ErrorFile: page-error-(.*).txt diff --git a/system/plugins/core.php b/system/plugins/core.php @@ -60,7 +60,6 @@ class YellowCore $this->config->setDefault("contentExtension", ".txt"); $this->config->setDefault("configExtension", ".ini"); $this->config->setDefault("downloadExtension", ".download"); - $this->config->setDefault("installationExtension", ".installation"); $this->config->setDefault("configFile", "config.ini"); $this->config->setDefault("textFile", "text.ini"); $this->config->setDefault("languageFile", "language-(.*).txt"); @@ -496,7 +495,7 @@ class YellowPage rtrim($this->yellow->config->get("editLocation"), '/').$this->location)); $this->set("pageFile", $this->yellow->lookup->getPageFile($this->fileName)); } else { - $this->set("type", $this->yellow->toolbox->getFileExtension($this->fileName)); + $this->set("type", $this->yellow->toolbox->getFileType($this->fileName)); $this->set("modified", date("Y-m-d H:i:s", $this->yellow->toolbox->getFileModified($this->fileName))); $this->set("pageFile", $this->yellow->lookup->getPageFile($this->fileName, true)); } @@ -2923,7 +2922,8 @@ class YellowToolbox // Return MIME content type function getMimeContentType($fileName) { - $mimeTypes = array( + $contentType = ""; + $contentTypes = array( "css" => "text/css", "gif" => "image/gif", "html" => "text/html; charset=utf-8", @@ -2936,13 +2936,12 @@ class YellowToolbox "woff" => "application/font-woff", "woff2" => "application/font-woff2", "xml" => "text/xml; charset=utf-8"); - $contentType = ""; - $extension = $this->getFileExtension($fileName); - if(empty($extension)) + $fileType = $this->getFileType($fileName); + if(empty($fileType)) { - $contentType = $mimeTypes["html"]; - } else if(array_key_exists($extension, $mimeTypes)) { - $contentType = $mimeTypes[$extension]; + $contentType = $contentTypes["html"]; + } else if(array_key_exists($fileType, $contentTypes)) { + $contentType = $contentTypes[$fileType]; } return $contentType; } @@ -3113,8 +3112,8 @@ class YellowToolbox return is_file($fileName) ? filemtime($fileName) : 0; } - // Return file extension - function getFileExtension($fileName) + // Return file type + function getFileType($fileName) { return strtoloweru(($pos = strrposu($fileName, '.')) ? substru($fileName, $pos+1) : ""); } diff --git a/system/plugins/update.php b/system/plugins/update.php @@ -5,7 +5,7 @@ class YellowUpdate { - const VERSION = "0.7.4"; + const VERSION = "0.7.5"; var $yellow; //access to API var $updates; //number of updates @@ -507,7 +507,7 @@ class YellowUpdate { $statusCode = 200; $path = $this->yellow->config->get("pluginDir"); - $regex = "/^.*\\".$this->yellow->config->get("installationExtension")."$/"; + $regex = "/^.*\.installation$/"; foreach($this->yellow->toolbox->getDirectoryEntries($path, $regex, true, false) as $entry) { if(preg_match("/^(.*?)-(.*?)\./", basename($entry), $matches)) @@ -705,7 +705,7 @@ class YellowUpdate { $data = array("website"); $path = $this->yellow->config->get("pluginDir"); - $regex = "/^.*\\".$this->yellow->config->get("installationExtension")."$/"; + $regex = "/^.*\.installation$/"; foreach($this->yellow->toolbox->getDirectoryEntries($path, $regex, true, false, false) as $entry) { if(preg_match("/^(.*?)-(.*?)\./", $entry, $matches))