Prechádzať zdrojové kódy

System update (for Wunderfeyd)

markseu 9 rokov pred
rodič
commit
45c476ca50

+ 1 - 1
system/plugins/commandline.php

@@ -263,7 +263,7 @@ class YellowCommandline
 		$statusCode = 200;
 		$statusCode = 200;
 		if(is_dir($path) && $this->checkStaticDirectory($path))
 		if(is_dir($path) && $this->checkStaticDirectory($path))
 		{
 		{
-			if(!$this->yellow->toolbox->deleteDirectory($path, true))
+			if(!$this->yellow->toolbox->deleteDirectory($path))
 			{
 			{
 				$statusCode = 500;
 				$statusCode = 500;
 				echo "ERROR cleaning files: Can't delete directory '$path'!\n";
 				echo "ERROR cleaning files: Can't delete directory '$path'!\n";

+ 29 - 21
system/plugins/core.php

@@ -2742,26 +2742,6 @@ class YellowToolbox
 		return $entries;
 		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
 	// Return file extension
 	function getFileExtension($fileName)
 	function getFileExtension($fileName)
 	{
 	{
@@ -2852,11 +2832,39 @@ class YellowToolbox
 		{
 		{
 			$ok = @unlink($fileName);
 			$ok = @unlink($fileName);
 		} else {
 		} else {
+			if(!is_dir($pathTrash)) @mkdir($pathTrash, 0777, true);
 			$fileNameDest = $pathTrash;
 			$fileNameDest = $pathTrash;
 			$fileNameDest .= pathinfo($fileName, PATHINFO_FILENAME);
 			$fileNameDest .= pathinfo($fileName, PATHINFO_FILENAME);
 			$fileNameDest .= "-".str_replace(array(" ", ":"), "-", date("Y-m-d H:i:s", filemtime($fileName)));
 			$fileNameDest .= "-".str_replace(array(" ", ":"), "-", date("Y-m-d H:i:s", filemtime($fileName)));
 			$fileNameDest .= ".".pathinfo($fileName, PATHINFO_EXTENSION);
 			$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;
 		return $ok;
 	}
 	}

+ 3 - 3
system/plugins/update.php

@@ -5,7 +5,7 @@
 // Update plugin
 // Update plugin
 class YellowUpdate
 class YellowUpdate
 {
 {
-	const VERSION = "0.6.5";
+	const VERSION = "0.6.6";
 	var $yellow;					//access to API
 	var $yellow;					//access to API
 	
 	
 	// Handle initialisation
 	// Handle initialisation
@@ -246,7 +246,7 @@ class YellowUpdate
 		$regex = "/^.*\\".$this->yellow->config->get("downloadExtension")."$/";
 		$regex = "/^.*\\".$this->yellow->config->get("downloadExtension")."$/";
 		foreach($this->yellow->toolbox->getDirectoryEntries($path, $regex, true, false) as $entry)
 		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;
 				if($this->updateSoftwareArchive($entry)!=200) $ok = false;
 			}
 			}
@@ -437,7 +437,7 @@ class YellowUpdate
 			{
 			{
 				if(strnatcasecmp($dataCurrent[$key], $version)<0) $data[$key] = $dataLatest[$key];
 				if(strnatcasecmp($dataCurrent[$key], $version)<0) $data[$key] = $dataLatest[$key];
 			} else {
 			} 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);
 		return array($statusCode, $data);

+ 1 - 1
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 { position:relative; overflow:hidden; height:2em; margin-bottom:10px; }
 .yellow-bar-left { display:block; float:left; }
 .yellow-bar-left { display:block; float:left; }

+ 1 - 1
system/plugins/webinterface.js

@@ -4,7 +4,7 @@
 // Yellow API
 // Yellow API
 var yellow =
 var yellow =
 {
 {
-	version: "0.6.9",
+	version: "0.6.10",
 	action: function(action) { yellow.webinterface.action(action, "none"); },
 	action: function(action) { yellow.webinterface.action(action, "none"); },
 	onLoad: function() { yellow.webinterface.loadInterface(); },
 	onLoad: function() { yellow.webinterface.loadInterface(); },
 	onClick: function(e) { yellow.webinterface.hidePanesOnClick(yellow.toolbox.getEventElement(e)); },
 	onClick: function(e) { yellow.webinterface.hidePanesOnClick(yellow.toolbox.getEventElement(e)); },

+ 2 - 2
system/plugins/webinterface.php

@@ -5,7 +5,7 @@
 // Web interface plugin
 // Web interface plugin
 class YellowWebinterface
 class YellowWebinterface
 {
 {
-	const VERSION = "0.6.9";
+	const VERSION = "0.6.10";
 	var $yellow;				//access to API
 	var $yellow;				//access to API
 	var $active;				//web interface is active? (boolean)
 	var $active;				//web interface is active? (boolean)
 	var $userEmail;				//web interface user
 	var $userEmail;				//web interface user
@@ -381,7 +381,7 @@ class YellowWebinterface
 	function processRequestSettings($serverScheme, $serverName, $base, $location, $fileName)
 	function processRequestSettings($serverScheme, $serverName, $base, $location, $fileName)
 	{
 	{
 		$this->action = "settings";
 		$this->action = "settings";
-		$this->status = $this->getUserAccount($this->userEmail, "", $this->action);
+		$this->status = "ok";
 		if($this->status=="ok")
 		if($this->status=="ok")
 		{
 		{
 			$name = trim(preg_replace("/[^\pL\d\-\. ]/u", "-", $_REQUEST["name"]));
 			$name = trim(preg_replace("/[^\pL\d\-\. ]/u", "-", $_REQUEST["name"]));