mikuli.cz

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

commit 45c476ca507276860548e7bffba85f628782f9e9
parent 15e04da19180f67d0ff208f211eb32aed0132c80
Author: markseu <mark2011@mayberg.se>
Date:   Sun,  7 Aug 2016 12:51:23 +0200

System update (for Wunderfeyd)

Diffstat:
Msystem/plugins/commandline.php | 2+-
Msystem/plugins/core.php | 50+++++++++++++++++++++++++++++---------------------
Msystem/plugins/update.php | 6+++---
Msystem/plugins/webinterface.css | 2+-
Msystem/plugins/webinterface.js | 2+-
Msystem/plugins/webinterface.php | 4++--
6 files changed, 37 insertions(+), 29 deletions(-)

diff --git a/system/plugins/commandline.php b/system/plugins/commandline.php @@ -263,7 +263,7 @@ class YellowCommandline $statusCode = 200; if(is_dir($path) && $this->checkStaticDirectory($path)) { - if(!$this->yellow->toolbox->deleteDirectory($path, true)) + if(!$this->yellow->toolbox->deleteDirectory($path)) { $statusCode = 500; echo "ERROR cleaning files: Can't delete directory '$path'!\n"; diff --git a/system/plugins/core.php b/system/plugins/core.php @@ -2742,26 +2742,6 @@ class YellowToolbox return $entries; } - // Delete directory - function deleteDirectory($path, $recursive = false) - { - if($recursive) - { - $iterator = new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS); - $files = new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::CHILD_FIRST); - foreach($files as $file) - { - if($file->isDir()) - { - @rmdir($file->getRealPath()); - } else { - @unlink($file->getRealPath()); - } - } - } - return @rmdir($path); - } - // Return file extension function getFileExtension($fileName) { @@ -2852,11 +2832,39 @@ class YellowToolbox { $ok = @unlink($fileName); } else { + if(!is_dir($pathTrash)) @mkdir($pathTrash, 0777, true); $fileNameDest = $pathTrash; $fileNameDest .= pathinfo($fileName, PATHINFO_FILENAME); $fileNameDest .= "-".str_replace(array(" ", ":"), "-", date("Y-m-d H:i:s", filemtime($fileName))); $fileNameDest .= ".".pathinfo($fileName, PATHINFO_EXTENSION); - $ok = $this->renameFile($fileName, $fileNameDest, true); + $ok = @rename($fileName, $fileNameDest); + } + return $ok; + } + + // Delete directory + function deleteDirectory($path, $pathTrash = "") + { + if(empty($pathTrash)) + { + $iterator = new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS); + $files = new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::CHILD_FIRST); + foreach($files as $file) + { + if($file->isDir()) + { + @rmdir($file->getRealPath()); + } else { + @unlink($file->getRealPath()); + } + } + $ok = @rmdir($path); + } else { + if(!is_dir($pathTrash)) @mkdir($pathTrash, 0777, true); + $pathDest = $pathTrash; + $pathDest .= basename($path); + $pathDest .= "-".str_replace(array(" ", ":"), "-", date("Y-m-d H:i:s", filemtime($path))); + $ok = @rename($path, $pathDest); } return $ok; } diff --git a/system/plugins/update.php b/system/plugins/update.php @@ -5,7 +5,7 @@ // Update plugin class YellowUpdate { - const VERSION = "0.6.5"; + const VERSION = "0.6.6"; var $yellow; //access to API // Handle initialisation @@ -246,7 +246,7 @@ class YellowUpdate $regex = "/^.*\\".$this->yellow->config->get("downloadExtension")."$/"; foreach($this->yellow->toolbox->getDirectoryEntries($path, $regex, true, false) as $entry) { - if(preg_match("/$feature/i", basename($entry))) + if(stristr(basename($entry), $feature)) { if($this->updateSoftwareArchive($entry)!=200) $ok = false; } @@ -437,7 +437,7 @@ class YellowUpdate { if(strnatcasecmp($dataCurrent[$key], $version)<0) $data[$key] = $dataLatest[$key]; } else { - if(preg_match("/$feature/i", $key) && $version) $data[$key] = $dataLatest[$key]; + if(stristr($key, $feature) && $version) $data[$key] = $dataLatest[$key]; } } return array($statusCode, $data); diff --git a/system/plugins/webinterface.css b/system/plugins/webinterface.css @@ -1,4 +1,4 @@ -/* Yellow web interface 0.6.9 */ +/* Yellow web interface 0.6.10 */ .yellow-bar { position:relative; overflow:hidden; height:2em; margin-bottom:10px; } .yellow-bar-left { display:block; float:left; } diff --git a/system/plugins/webinterface.js b/system/plugins/webinterface.js @@ -4,7 +4,7 @@ // Yellow API var yellow = { - version: "0.6.9", + version: "0.6.10", action: function(action) { yellow.webinterface.action(action, "none"); }, onLoad: function() { yellow.webinterface.loadInterface(); }, onClick: function(e) { yellow.webinterface.hidePanesOnClick(yellow.toolbox.getEventElement(e)); }, diff --git a/system/plugins/webinterface.php b/system/plugins/webinterface.php @@ -5,7 +5,7 @@ // Web interface plugin class YellowWebinterface { - const VERSION = "0.6.9"; + const VERSION = "0.6.10"; var $yellow; //access to API var $active; //web interface is active? (boolean) var $userEmail; //web interface user @@ -381,7 +381,7 @@ class YellowWebinterface function processRequestSettings($serverScheme, $serverName, $base, $location, $fileName) { $this->action = "settings"; - $this->status = $this->getUserAccount($this->userEmail, "", $this->action); + $this->status = "ok"; if($this->status=="ok") { $name = trim(preg_replace("/[^\pL\d\-\. ]/u", "-", $_REQUEST["name"]));