Browse Source

System update (coding style)

markseu 9 years ago
parent
commit
3cc235b5f9

+ 19 - 19
system/plugins/commandline.php

@@ -5,7 +5,7 @@
 // Command line plugin
 class YellowCommandline
 {
-	const Version = "0.6.14";
+	const VERSION = "0.6.14";
 	var $yellow;					//access to API
 	var $files;						//number of files
 	var $errors;					//number of errors
@@ -45,7 +45,7 @@ class YellowCommandline
 	// Show available commands
 	function helpCommand()
 	{
-		echo "Yellow ".YellowCore::Version."\n";
+		echo "Yellow ".YellowCore::VERSION."\n";
 		$lineCounter = 0;
 		foreach($this->getCommandHelp() as $line) echo (++$lineCounter>1 ? "        " : "Syntax: ")."yellow.php $line\n";
 		return 200;
@@ -97,7 +97,7 @@ class YellowCommandline
 			}
 			foreach($this->locationsArgsPagination as $location)
 			{
-				if(substru($location, -1) != $this->yellow->toolbox->getLocationArgsSeparator())
+				if(substru($location, -1)!=$this->yellow->toolbox->getLocationArgsSeparator())
 				{
 					$statusCode = max($statusCode, $this->buildStaticFile($path, $location, false, true));
 				}
@@ -105,7 +105,7 @@ class YellowCommandline
 				{
 					$statusCodeLocation = $this->buildStaticFile($path, $location.$pageNumber, false, true);
 					$statusCode = max($statusCode, $statusCodeLocation);
-					if($statusCodeLocation == 100) break;
+					if($statusCodeLocation==100) break;
 				}
 			}
 			foreach($this->getMediaLocations() as $location)
@@ -137,7 +137,7 @@ class YellowCommandline
 			{
 				$fileData = ob_get_contents();
 				$modified = strtotime($this->yellow->page->getHeader("Last-Modified"));
-				if($modified == 0) $modified = filemtime($this->yellow->page->fileName);
+				if($modified==0) $modified = filemtime($this->yellow->page->fileName);
 				if($statusCode>=301 && $statusCode<=303)
 				{
 					$fileData = $this->getStaticRedirect($this->yellow->page->getHeader("Location"));
@@ -167,8 +167,8 @@ class YellowCommandline
 		if($statusCode==200 && $analyse) $this->analyseStaticFile($fileData);
 		if($statusCode==404 && $error) $statusCode = 200;
 		if($statusCode==404 && $probe) $statusCode = 100;
-		if($statusCode >= 200) ++$this->files;
-		if($statusCode >= 400)
+		if($statusCode>=200) ++$this->files;
+		if($statusCode>=400)
 		{
 			++$this->errors;
 			echo "ERROR building location '$location', ".$this->yellow->page->getStatusCode(true)."\n";
@@ -201,11 +201,11 @@ class YellowCommandline
 			if(preg_match("/^(.*?)#(.*)$/", $match, $tokens)) $match = $tokens[1];
 			if(preg_match("/^\w+:\/+(.*?)(\/.*)$/", $match, $tokens))
 			{
-				if($tokens[1] != $serverName) continue;
+				if($tokens[1]!=$serverName) continue;
 				$match = $tokens[2];
 			}
 			if(!$this->yellow->toolbox->isLocationArgs($match)) continue;
-			if(substru($match, 0, strlenu($serverBase)) != $serverBase) continue;
+			if(substru($match, 0, strlenu($serverBase))!=$serverBase) continue;
 			$location = rawurldecode(substru($match, strlenu($serverBase)));
 			if(!$this->yellow->toolbox->isLocationArgsPagination($location, $pagination))
 			{
@@ -294,11 +294,11 @@ class YellowCommandline
 		$statusCode = 0;
 		foreach($this->yellow->plugins->plugins as $key=>$value)
 		{
-			if($key == "commandline") continue;
+			if($key=="commandline") continue;
 			if(method_exists($value["obj"], "onCommand"))
 			{
 				$statusCode = $value["obj"]->onCommand(func_get_args());
-				if($statusCode != 0) break;
+				if($statusCode!=0) break;
 			}
 		}
 		return $statusCode;
@@ -309,13 +309,13 @@ class YellowCommandline
 	{
 		$statusCode = 0;
 		$serverSoftware = $this->yellow->toolbox->getServerSoftware();
-		echo "Yellow ".YellowCore::Version.", PHP ".PHP_VERSION.", $serverSoftware\n";
+		echo "Yellow ".YellowCore::VERSION.", PHP ".PHP_VERSION.", $serverSoftware\n";
 		list($command) = $args;
 		list($statusCode, $dataCurrent) = $this->getSoftwareVersion();
 		list($statusCode, $dataLatest) = $this->getSoftwareVersion(true);
 		foreach($dataCurrent as $key=>$value)
 		{
-			if(strnatcasecmp($dataCurrent[$key], $dataLatest[$key]) >= 0)
+			if(strnatcasecmp($dataCurrent[$key], $dataLatest[$key])>=0)
 			{
 				echo "$key $value\n";
 			} else {
@@ -323,7 +323,7 @@ class YellowCommandline
 				++$updates;
 			}
 		}
-		if($statusCode != 200) echo "ERROR checking updates: ".$this->yellow->page->get("pageError")."\n";
+		if($statusCode!=200) echo "ERROR checking updates: ".$this->yellow->page->get("pageError")."\n";
 		if($updates) echo "Yellow $command: $updates update".($updates==1 ? "":"s")." available\n";
 		return $statusCode;
 	}
@@ -344,8 +344,8 @@ class YellowCommandline
 		$ok = false;
 		if(!empty($path))
 		{
-			if($path == rtrim($this->yellow->config->get("staticDir"), '/')) $ok = true;
-			if($path == rtrim($this->yellow->config->get("trashDir"), '/')) $ok = true;			
+			if($path==rtrim($this->yellow->config->get("staticDir"), '/')) $ok = true;
+			if($path==rtrim($this->yellow->config->get("trashDir"), '/')) $ok = true;
 			if(is_file("$path/".$this->yellow->config->get("staticDefaultFile"))) $ok = true;
 			if(is_file("$path/yellow.php")) $ok = false;
 		}
@@ -355,11 +355,11 @@ class YellowCommandline
 	// Return static file
 	function getStaticFile($path, $location, $statusCode)
 	{
-		if($statusCode < 400)
+		if($statusCode<400)
 		{
 			$fileName = $path.$location;
 			if(!$this->yellow->lookup->isFileLocation($location)) $fileName .= $this->yellow->config->get("staticDefaultFile");
-		} else if($statusCode == 404) {
+		} else if($statusCode==404) {
 			$fileName = $path."/".$this->yellow->config->get("staticErrorFile");
 		}
 		return $fileName;
@@ -462,5 +462,5 @@ class YellowCommandline
 	}
 }
 	
-$yellow->plugins->register("commandline", "YellowCommandline", YellowCommandline::Version);
+$yellow->plugins->register("commandline", "YellowCommandline", YellowCommandline::VERSION);
 ?>

+ 99 - 99
system/plugins/core.php

@@ -5,7 +5,7 @@
 // Yellow core
 class YellowCore
 {
-	const Version = "0.6.4";
+	const VERSION = "0.6.4";
 	var $page;				//current page
 	var $pages;				//pages from file system
 	var $files;				//files from file system
@@ -82,7 +82,7 @@ class YellowCore
 		if(defined("DEBUG") && DEBUG>=3)
 		{
 			$serverSoftware = $this->toolbox->getServerSoftware();
-			echo "Yellow ".YellowCore::Version.", PHP ".PHP_VERSION.", $serverSoftware<br>\n";
+			echo "Yellow ".YellowCore::VERSION.", PHP ".PHP_VERSION.", $serverSoftware<br>\n";
 		}
 		$this->config->load($this->config->get("configDir").$this->config->get("configFile"));
 		$this->text->load($this->config->get("pluginDir").$this->config->get("textFile"));
@@ -105,10 +105,10 @@ class YellowCore
 			{
 				$this->pages->requestHandler = $key;
 				$statusCode = $value["obj"]->onRequest($serverScheme, $serverName, $base, $location, $fileName);
-				if($statusCode != 0) break;
+				if($statusCode!=0) break;
 			}
 		}
-		if($statusCode == 0)
+		if($statusCode==0)
 		{
 			$this->pages->requestHandler = "core";
 			$statusCode = $this->processRequest($serverScheme, $serverName, $base, $location, $fileName, true);
@@ -147,7 +147,7 @@ class YellowCore
 				$this->sendStatus($statusCode, $location);
 			}
 		}
-		if($statusCode == 0)
+		if($statusCode==0)
 		{
 			if($this->isStaticFile($location, $fileName, $cacheable))
 			{
@@ -178,7 +178,7 @@ class YellowCore
 	// Read page
 	function readPage($serverScheme, $serverName, $base, $location, $fileName, $cacheable, $statusCode, $pageError)
 	{
-		if($statusCode >= 400)
+		if($statusCode>=400)
 		{
 			$fileName = $this->config->get("configDir").$this->config->get("errorFile");
 			$fileName = strreplaceu("(.*)", $statusCode, $fileName);
@@ -249,7 +249,7 @@ class YellowCore
 	}
 	
 	// Handle command
-	function command($args = NULL)
+	function command($args = null)
 	{
 		$statusCode = 0;
 		$this->toolbox->timerStart($time);
@@ -258,10 +258,10 @@ class YellowCore
 			if(method_exists($value["obj"], "onCommand"))
 			{
 				$statusCode = $value["obj"]->onCommand(func_get_args());
-				if($statusCode != 0) break;
+				if($statusCode!=0) break;
 			}
 		}
-		if($statusCode == 0)
+		if($statusCode==0)
 		{
 			$statusCode = 400;
 			list($command) = func_get_args();
@@ -273,7 +273,7 @@ class YellowCore
 	}
 	
 	// Parse snippet
-	function snippet($name, $args = NULL)
+	function snippet($name, $args = null)
 	{
 		$this->pages->snippetArgs = func_get_args();
 		$this->page->parseSnippet($name);
@@ -291,13 +291,13 @@ class YellowCore
 		{
 			$pluginLocationLength = strlenu($this->config->get("pluginLocation"));
 			$themeLocationLength = strlenu($this->config->get("themeLocation"));
-			if(substru($location, 0, $pluginLocationLength) == $this->config->get("pluginLocation")) {
+			if(substru($location, 0, $pluginLocationLength)==$this->config->get("pluginLocation")) {
 				$fileName = $this->config->get("pluginDir").substru($location, $pluginLocationLength);
-			} else if(substru($location, 0, $themeLocationLength) == $this->config->get("themeLocation")) {
+			} else if(substru($location, 0, $themeLocationLength)==$this->config->get("themeLocation")) {
 				$fileName = $this->config->get("themeDir").substru($location, $themeLocationLength);
-			} else if($location == "/".$this->config->get("robotsFile")) {
+			} else if($location=="/".$this->config->get("robotsFile")) {
 				$fileName = $this->config->get("configDir").$this->config->get("robotsFile");
-			} else if($location == "/".$this->config->get("faviconFile")) {
+			} else if($location=="/".$this->config->get("faviconFile")) {
 				$fileName = $this->config->get("assetDir").$this->config->get("siteicon").".png";
 			}
 		}
@@ -349,8 +349,8 @@ class YellowCore
 		$fileName = $this->getStaticFileFromCache($location, $fileName, $cacheable);
 		$staticDirLength = strlenu($this->config->get("staticDir"));
 		$systemDirLength = strlenu($this->config->get("systemDir"));
-		return substru($fileName, 0, $staticDirLength) == $this->config->get("staticDir") ||
-			substru($fileName, 0, $systemDirLength) == $this->config->get("systemDir");
+		return substru($fileName, 0, $staticDirLength)==$this->config->get("staticDir") ||
+			substru($fileName, 0, $systemDirLength)==$this->config->get("systemDir");
 	}
 	
 	// Check if request can be redirected into content directory
@@ -418,7 +418,7 @@ class YellowPage
 	{
 		$this->lastModified = 0;
 		$this->rawData = $rawData;
-		$this->parser = NULL;
+		$this->parser = null;
 		$this->parserData = "";
 		$this->parserSafeMode = intval($this->yellow->config->get("parserSafeMode"));
 		$this->available = true;
@@ -432,7 +432,7 @@ class YellowPage
 	// Parse page data update
 	function parseDataUpdate()
 	{
-		if($this->statusCode == 0)
+		if($this->statusCode==0)
 		{
 			$this->rawData = $this->yellow->toolbox->readFile($this->fileName);
 			$this->statusCode = 200;
@@ -474,13 +474,13 @@ class YellowPage
 				$this->set("title", $parts[2]);
 			}
 			
-			$titleHeader = ($this->location == $this->yellow->pages->getHomeLocation($this->location)) ?
+			$titleHeader = ($this->location==$this->yellow->pages->getHomeLocation($this->location)) ?
 				$this->get("sitename") : $this->get("title")." - ".$this->get("sitename");
 			if(!$this->isExisting("titleContent")) $this->set("titleContent", $this->get("title"));
 			if(!$this->isExisting("titleHeader")) $this->set("titleHeader", $titleHeader);
 			if(!$this->isExisting("titleNavigation")) $this->set("titleNavigation", $this->get("title"));
-			if($this->get("titleContent") == "-") $this->set("titleContent", "");
-			if($this->get("status") == "hidden") $this->available = false;
+			if($this->get("titleContent")=="-") $this->set("titleContent", "");
+			if($this->get("status")=="hidden") $this->available = false;
 			$this->set("pageRead", $this->yellow->lookup->normaliseUrl(
 				$this->yellow->config->get("serverScheme"),
 				$this->yellow->config->get("serverName"),
@@ -547,7 +547,7 @@ class YellowPage
 	// Parse page content block
 	function parseContentBlock($name, $text, $shortcut)
 	{
-		$output = NULL;
+		$output = null;
 		foreach($this->yellow->plugins->plugins as $key=>$value)
 		{
 			if(method_exists($value["obj"], "onParseContentBlock"))
@@ -560,14 +560,14 @@ class YellowPage
 		{
 			if($name=="yellow" && $shortcut)
 			{
-				$output = "Yellow ".YellowCore::Version;
+				$output = "Yellow ".YellowCore::VERSION;
 				if(!empty($text))
 				{
 					$output = "<span class=\"".htmlspecialchars($name)."\">\n";
-					if($text == "version")
+					if($text=="version")
 					{
 						$serverSoftware = $this->yellow->toolbox->getServerSoftware();
-						$output .= "Yellow ".YellowCore::Version.", PHP ".PHP_VERSION.", $serverSoftware<br />\n";
+						$output .= "Yellow ".YellowCore::VERSION.", PHP ".PHP_VERSION.", $serverSoftware<br />\n";
 						foreach($this->yellow->plugins->getData() as $key=>$value)
 						{
 							$output .= htmlspecialchars("$key $value")."<br />\n";
@@ -594,7 +594,7 @@ class YellowPage
 	// Parse page
 	function parsePage()
 	{
-		$this->outputData = NULL;
+		$this->outputData = null;
 		if(!$this->isError())
 		{
 			foreach($this->yellow->plugins->plugins as $key=>$value)
@@ -636,7 +636,7 @@ class YellowPage
 		{
 			$this->error(404);
 		}
-		if($this->isExisting("pageClean")) $this->outputData = NULL;
+		if($this->isExisting("pageClean")) $this->outputData = null;
 	}
 	
 	// Parse template
@@ -713,14 +713,14 @@ class YellowPage
 		return $text;
 	}
 	
-	// Return parent page relative to current page, NULL if none
+	// Return parent page relative to current page, null if none
 	function getParent()
 	{
 		$parentLocation = $this->yellow->pages->getParentLocation($this->location);
 		return $this->yellow->pages->find($parentLocation);
 	}
 	
-	// Return top-level page for current page, NULL if none
+	// Return top-level page for current page, null if none
 	function getParentTop($homeFailback = true)
 	{
 		$parentTopLocation = $this->yellow->pages->getParentTopLocation($this->location);
@@ -798,7 +798,7 @@ class YellowPage
 				if(!is_null($outputPlugin)) $output .= $outputPlugin;
 			}
 		}
-		if($name == "header")
+		if($name=="header")
 		{
 			if(is_file($this->yellow->config->get("themeDir").$this->get("theme").".css"))
 			{
@@ -1043,7 +1043,7 @@ class YellowPageCollection extends ArrayObject
 					foreach(preg_split("/,\s*/", $page->get($key)) as $pageValue)
 					{
 						$pageValueLength = $exactMatch ? strlenu($pageValue) : $valueLength;
-						if($value == substru(strreplaceu(' ', '-', strtoloweru($pageValue)), 0, $pageValueLength))
+						if($value==substru(strreplaceu(' ', '-', strtoloweru($pageValue)), 0, $pageValueLength))
 						{
 							$this->filterValue = substru($pageValue, 0, $pageValueLength);
 							array_push($array, $page);
@@ -1102,7 +1102,7 @@ class YellowPageCollection extends ArrayObject
 					if(stristr($page->get("tag"), $token)) $searchScore += 5;
 					if(stristr($page->get("author"), $token)) $searchScore += 2;
 				}
-				if($page->location != $location)
+				if($page->location!=$location)
 				{
 					$page->set("searchscore", $searchScore);
 					array_push($array, $page);
@@ -1167,8 +1167,8 @@ class YellowPageCollection extends ArrayObject
 		$this->paginationCount = ceil($this->count() / $limit);
 		$pagination = $this->yellow->config->get("contentPagination");
 		if(isset($_REQUEST[$pagination])) $this->paginationNumber = intval($_REQUEST[$pagination]);
-		if($this->paginationNumber > $this->paginationCount) $this->paginationNumber = 0;
-		if($this->paginationNumber >= 1)
+		if($this->paginationNumber>$this->paginationCount) $this->paginationNumber = 0;
+		if($this->paginationNumber>=1)
 		{
 			$array = $this->getArrayCopy();
 			if($reverse) $array = array_reverse($array);
@@ -1235,7 +1235,7 @@ class YellowPageCollection extends ArrayObject
 	// Check if there is a pagination
 	function isPagination()
 	{
-		return $this->paginationCount > 1;
+		return $this->paginationCount>1;
 	}
 }
 
@@ -1282,7 +1282,7 @@ class YellowPages
 					$page->setRequestInformation($serverScheme, $serverName, $base,
 						$this->yellow->lookup->findLocationFromFile($fileName), $fileName);
 					$page->parseData($this->yellow->toolbox->readFile($fileName, 4096), false, 0);
-					if(strlenb($page->rawData) < 4096) $page->statusCode = 200;
+					if(strlenb($page->rawData)<4096) $page->statusCode = 200;
 					array_push($this->pages[$location], $page);
 				}
 			}
@@ -1290,18 +1290,18 @@ class YellowPages
 		return $this->pages[$location];
 	}	
 
-	// Return page from file system, NULL if not found
+	// Return page from file system, null if not found
 	function find($location, $absoluteLocation = false)
 	{
 		if($absoluteLocation) $location = substru($location, strlenu($this->yellow->page->base));
 		foreach($this->scanLocation($this->getParentLocation($location)) as $page)
 		{
-			if($page->location == $location)
+			if($page->location==$location)
 			{
 				if(!$this->yellow->lookup->isRootLocation($page->location)) { $found = true; break; }
 			}
 		}
-		return $found ? $page : NULL;
+		return $found ? $page : null;
 	}
 	
 	// Return page collection with all pages
@@ -1489,22 +1489,22 @@ class YellowFiles
 			{
 				$file = new YellowPage($this->yellow);
 				$file->setRequestInformation($serverScheme, $serverName, $base, "/".$fileName, $fileName);
-				$file->parseData(NULL, false, 0);
+				$file->parseData(null, false, 0);
 				array_push($this->files[$location], $file);
 			}
 		}
 		return $this->files[$location];
 	}
 	
-	// Return page with media file information, NULL if not found
+	// Return page with media file information, null if not found
 	function find($location, $absoluteLocation = false)
 	{
 		if($absoluteLocation) $location = substru($location, strlenu($this->yellow->page->base));
 		foreach($this->scanLocation($this->getParentLocation($location)) as $file)
 		{
-			if($file->location == $location) { $found = true; break; }
+			if($file->location==$location) { $found = true; break; }
 		}
-		return $found ? $file : NULL;
+		return $found ? $file : null;
 	}
 	
 	// Return page collection with all media files
@@ -1622,7 +1622,7 @@ class YellowPlugins
 	{
 		if(!$this->isExisting($name))
 		{
-			if($priority == 0) $priority = count($this->plugins) + 10;
+			if($priority==0) $priority = count($this->plugins) + 10;
 			$this->plugins[$name] = array();
 			$this->plugins[$name]["plugin"] = $plugin;
 			$this->plugins[$name]["version"] = $version;
@@ -1640,7 +1640,7 @@ class YellowPlugins
 	function getData()
 	{
 		$data = array();
-		$data["YellowCore"] = YellowCore::Version;
+		$data["YellowCore"] = YellowCore::VERSION;
 		foreach($this->plugins as $key=>$value) $data[$value["plugin"]] = $value["version"];
 		uksort($data, strnatcasecmp);
 		return $data;
@@ -1770,7 +1770,7 @@ class YellowConfig
 		{
 			preg_match("/^\s*(.*?)\s*:\s*(.*?)\s*$/", $line, $matches);
 			$keyOriginal = $matches[1]; $keySearch = strtoloweru($matches[1]); $keyFound = "";
-			foreach($config as $key=>$value) if(strtoloweru($key) == $keySearch) { $keyFound = $key; break; }
+			foreach($config as $key=>$value) if(strtoloweru($key)==$keySearch) { $keyFound = $key; break; }
 			if(!empty($keyFound))
 			{
 				$fileDataNew .= "$keyOriginal: $config[$keyFound]\n";
@@ -1936,7 +1936,7 @@ class YellowText
 			} else {
 				foreach($this->text[$language] as $key=>$value)
 				{
-					if(substru($key, 0, strlenu($filterStart)) == $filterStart) $text[$key] = $value;
+					if(substru($key, 0, strlenu($filterStart))==$filterStart) $text[$key] = $value;
 				}
 			}
 		}
@@ -2033,7 +2033,7 @@ class YellowLookup
 			foreach($this->yellow->toolbox->getDirectoryEntries($path, "/.*/", true, true, false) as $entry)
 			{
 				if(empty($firstRoot)) { $firstRoot = $token = $entry; }
-				if($this->normaliseName($entry) == $root) { $token = $entry; break; }
+				if($this->normaliseName($entry)==$root) { $token = $entry; break; }
 			}
 			$pathRoot = $this->normaliseName($token)."/";
 			$path .= "$firstRoot/";
@@ -2044,7 +2044,7 @@ class YellowLookup
 			foreach($this->yellow->toolbox->getDirectoryEntries($path, "/.*/", true, true, false) as $entry)
 			{
 				if(empty($firstHome)) { $firstHome = $token = $entry; }
-				if($this->normaliseName($entry) == $home) { $token = $entry; break; }
+				if($this->normaliseName($entry)==$home) { $token = $entry; break; }
 			}
 			$pathHome = $this->normaliseName($token)."/";
 			if(count($this->yellow->toolbox->getDirectoryEntries($path.$token, "/.*/", true, true, false))) $invalid = true;
@@ -2063,7 +2063,7 @@ class YellowLookup
 			foreach($this->yellow->toolbox->getDirectoryEntries($pathBase, "/.*/", true, true, false) as $entry)
 			{
 				$token = $this->normaliseName($entry)."/";
-				if($token == $pathRoot) $token = "";
+				if($token==$pathRoot) $token = "";
 				array_push($locations, $includePath ? "root/$token $pathBase$entry/" : "root/$token");
 				if(defined("DEBUG") && DEBUG>=2) echo "YellowLookup::findRootLocations root/$token<br/>\n";
 			}
@@ -2082,7 +2082,7 @@ class YellowLookup
 		$pathHome = $this->yellow->config->get("contentHomeDir");
 		$fileDefault = $this->yellow->config->get("contentDefaultFile");
 		$fileExtension = $this->yellow->config->get("contentExtension");
-		if(substru($fileName, 0, strlenu($pathBase)) == $pathBase)
+		if(substru($fileName, 0, strlenu($pathBase))==$pathBase)
 		{
 			$fileName = substru($fileName, strlenu($pathBase));
 			$tokens = explode('/', $fileName);
@@ -2101,7 +2101,7 @@ class YellowLookup
 			$fileFolder = $this->normaliseName($tokens[$i-1]).$fileExtension;
 			if($token!=$fileDefault && $token!=$fileFolder) $location .= $this->normaliseName($tokens[$i], true, true);
 			$extension = ($pos = strrposu($fileName, '.')) ? substru($fileName, $pos) : "";
-			if($extension != $fileExtension) $invalid = true;
+			if($extension!=$fileExtension) $invalid = true;
 		} else {
 			$invalid = true;
 		}
@@ -2126,24 +2126,24 @@ class YellowLookup
 		{
 			if(!empty($pathRoot))
 			{
-				$token = (count($tokens) > 2) ? $tokens[1] : rtrim($pathRoot, '/');
+				$token = (count($tokens)>2) ? $tokens[1] : rtrim($pathRoot, '/');
 				$path .= $this->findFileDirectory($path, $token, true, true, $found, $invalid);
 			}
 		} else {
 			if(!empty($pathRoot))
 			{
-				if(count($tokens) > 2)
+				if(count($tokens)>2)
 				{
-					if($this->normaliseName($tokens[1]) == $this->normaliseName($pathRoot)) $invalid = true;
+					if($this->normaliseName($tokens[1])==$this->normaliseName($pathRoot)) $invalid = true;
 					$path .= $this->findFileDirectory($path, $tokens[1], false, true, $found, $invalid);
 					if($found) array_shift($tokens);
 				}
 				if(!$found) $path .= $this->findFileDirectory($path, rtrim($pathRoot, '/'), true, true, $found, $invalid);
 				
 			}
-			if(count($tokens) > 2)
+			if(count($tokens)>2)
 			{
-				if($this->normaliseName($tokens[1]) == $this->normaliseName($pathHome)) $invalid = true;
+				if($this->normaliseName($tokens[1])==$this->normaliseName($pathHome)) $invalid = true;
 				for($i=1; $i<count($tokens)-1; ++$i)
 				{
 					$path .= $this->findFileDirectory($path, $tokens[$i], true, true, $found, $invalid);
@@ -2177,13 +2177,13 @@ class YellowLookup
 	// Return file or directory that matches token
 	function findFileDirectory($path, $token, $tokenFailback, $directory, &$found, &$invalid)
 	{
-		if($this->normaliseName($token) != $token) $invalid = true;
+		if($this->normaliseName($token)!=$token) $invalid = true;
 		if(!$invalid)
 		{
 			$regex = "/^[\d\-\_\.]*".strreplaceu('-', '.', $token)."$/";
 			foreach($this->yellow->toolbox->getDirectoryEntries($path, $regex, false, $directory, false) as $entry)
 			{
-				if($this->normaliseName($entry) == $token) { $token = $entry; $found = true; break; }
+				if($this->normaliseName($entry)==$token) { $token = $entry; $found = true; break; }
 			}
 		}
 		if($directory) $token .= '/';
@@ -2200,8 +2200,8 @@ class YellowLookup
 			$regex = "/^[\d\-\_\.]*($fileDefault|$fileFolder)$/";
 			foreach($this->yellow->toolbox->getDirectoryEntries($path, $regex, true, false, false) as $entry)
 			{
-				if($this->normaliseName($entry) == $fileDefault) { $token = $entry; break; }
-				if($this->normaliseName($entry) == $fileFolder) { $token = $entry; break; }
+				if($this->normaliseName($entry)==$fileDefault) { $token = $entry; break; }
+				if($this->normaliseName($entry)==$fileFolder) { $token = $entry; break; }
 			}
 		}
 		return $includePath ? "$path/$token" : $token;
@@ -2227,9 +2227,9 @@ class YellowLookup
 				$regex = "/^.*\\".$fileExtension."$/";
 				foreach($this->yellow->toolbox->getDirectoryEntries($path, $regex, true, false, false) as $entry)
 				{
-					if($this->normaliseName($entry) == $fileDefault) continue;
-					if($this->normaliseName($entry) == $fileFolder) continue;
-					if($this->normaliseName($entry, true, true) == "") continue;
+					if($this->normaliseName($entry)==$fileDefault) continue;
+					if($this->normaliseName($entry)==$fileFolder) continue;
+					if($this->normaliseName($entry, true, true)=="") continue;
 					array_push($fileNames, $path.$entry);
 				}
 			}
@@ -2247,7 +2247,7 @@ class YellowLookup
 		{
 			$fileName = substru($fileName, strlenu($pathBase));
 			if(preg_match("/^(.+?)\//", $fileName, $matches)) $name = $this->normaliseName($matches[1]);
-			if(strlenu($name) == 2) $language = $name;
+			if(strlenu($name)==2) $language = $name;
 		}
 		return $language;
 	}
@@ -2351,13 +2351,13 @@ class YellowLookup
 	// Check if location is specifying root
 	function isRootLocation($location)
 	{
-		return $location[0] != "/";
+		return $location[0]!="/";
 	}
 	
 	// Check if location is specifying file or directory
 	function isFileLocation($location)
 	{
-		return substru($location, -1, 1) != "/";
+		return substru($location, -1, 1)!="/";
 	}
 	
 	// Check if location is visible
@@ -2365,7 +2365,7 @@ class YellowLookup
 	{
 		$visible = true;
 		$pathBase = $this->yellow->config->get("contentDir");
-		if(substru($fileName, 0, strlenu($pathBase)) == $pathBase)
+		if(substru($fileName, 0, strlenu($pathBase))==$pathBase)
 		{
 			$fileName = substru($fileName, strlenu($pathBase));
 			$tokens = explode('/', $fileName);
@@ -2386,7 +2386,7 @@ class YellowLookup
 		{
 			$active = $currentLocation==$location;
 		} else {
-			if($location == $this->yellow->pages->getHomeLocation($location))
+			if($location==$this->yellow->pages->getHomeLocation($location))
 			{
 				$active = $this->getDirectoryLocation($currentLocation)==$location;
 			} else {
@@ -2402,7 +2402,7 @@ class YellowLookup
 		$string = "";
 		$tokens = explode('/', $location);
 		for($i=1; $i<count($tokens); ++$i) $string .= '/'.$this->normaliseName($tokens[$i]);
-		return $location == $string;
+		return $location==$string;
 	}
 	
 	// Check if file is valid
@@ -2411,9 +2411,9 @@ class YellowLookup
 		$contentDirLength = strlenu($this->yellow->config->get("contentDir"));
 		$mediaDirLength = strlenu($this->yellow->config->get("mediaDir"));
 		$systemDirLength = strlenu($this->yellow->config->get("systemDir"));
-		return substru($fileName, 0, $contentDirLength) == $this->yellow->config->get("contentDir") ||
-			substru($fileName, 0, $mediaDirLength) == $this->yellow->config->get("mediaDir") ||
-			substru($fileName, 0, $systemDirLength) == $this->yellow->config->get("systemDir");
+		return substru($fileName, 0, $contentDirLength)==$this->yellow->config->get("contentDir") ||
+			substru($fileName, 0, $mediaDirLength)==$this->yellow->config->get("mediaDir") ||
+			substru($fileName, 0, $systemDirLength)==$this->yellow->config->get("systemDir");
 	}
 }
 
@@ -2502,7 +2502,7 @@ class YellowToolbox
 		foreach(explode('/', $_SERVER["LOCATION_ARGS"]) as $token)
 		{
 			preg_match("/^(.*?)$separator(.*)$/", $token, $matches);
-			if($matches[1] == $args[1]) { $matches[2] = $args[2]; $found = true; }
+			if($matches[1]==$args[1]) { $matches[2] = $args[2]; $found = true; }
 			if(!empty($matches[1]) && !strempty($matches[2]))
 			{
 				if(!empty($locationArgs)) $locationArgs .= '/';
@@ -2546,7 +2546,7 @@ class YellowToolbox
 	// Return location arguments separator
 	function getLocationArgsSeparator()
 	{
-		return (strtoupperu(substru(PHP_OS, 0, 3)) != "WIN") ? ':' : '=';
+		return (strtoupperu(substru(PHP_OS, 0, 3))!="WIN") ? ':' : '=';
 	}
 	
 	// Check if location contains location arguments
@@ -2567,7 +2567,7 @@ class YellowToolbox
 	// Check if script location is requested
 	function isRequestSelf()
 	{
-		return $_SERVER["REQUEST_URI"] == $_SERVER["SCRIPT_NAME"];
+		return $_SERVER["REQUEST_URI"]==$_SERVER["SCRIPT_NAME"];
 	}
 
 	// Check if clean URL is requested
@@ -2602,10 +2602,10 @@ class YellowToolbox
 		{
 			if($text[$pos]=='/' || $pos==0)
 			{
-				if($text[$pos+1] == '/') continue;
-				if($text[$pos+1] == '.')
+				if($text[$pos+1]=='/') continue;
+				if($text[$pos+1]=='.')
 				{
-					$posNew = $pos+1; while($text[$posNew] == '.') ++$posNew;
+					$posNew = $pos+1; while($text[$posNew]=='.') ++$posNew;
 					if($text[$posNew]=='/' || $text[$posNew]=='')
 					{
 						$pos = $posNew-1;
@@ -2706,9 +2706,9 @@ class YellowToolbox
 		if($dirHandle)
 		{
 			$path = rtrim($path, '/');
-			while(($entry = readdir($dirHandle)) !== false)
+			while(($entry = readdir($dirHandle))!==false)
 			{
-				if(substru($entry, 0, 1) == ".") continue;
+				if(substru($entry, 0, 1)==".") continue;
 				$entry = $this->normaliseUnicode($entry);
 				if(preg_match($regex, $entry))
 				{
@@ -2731,7 +2731,7 @@ class YellowToolbox
 	{
 		--$levelMax;
 		$entries = $this->getDirectoryEntries($path, $regex, $sort, $directories);
-		if($levelMax != 0)
+		if($levelMax!=0)
 		{
 			foreach($this->getDirectoryEntries($path, "/.*/", $sort, true) as $entry)
 			{
@@ -2771,7 +2771,7 @@ class YellowToolbox
 	function getFileModified($fileName)
 	{
 		$modified = is_readable($fileName) ? filemtime($fileName) : 0;
-		if($modified == 0)
+		if($modified==0)
 		{
 			$path = dirname($fileName);
 			$modified = is_readable($path) ? filemtime($path) : 0;
@@ -2866,7 +2866,7 @@ class YellowToolbox
 		$lines = array();
 		$split = preg_split("/(\R)/u", $text, -1, PREG_SPLIT_DELIM_CAPTURE);
 		for($i=0; $i<count($split)-1; $i+=2) array_push($lines, $split[$i].$split[$i+1]);
-		if($split[$i] != '') array_push($lines, $split[$i]);
+		if($split[$i]!='') array_push($lines, $split[$i]);
 		return $lines;
 	}
 	
@@ -2875,7 +2875,7 @@ class YellowToolbox
 	{
 		$text = preg_replace("/\s+/s", " ", trim($text));
 		$tokens = str_getcsv($text, ' ', '"');
-		foreach($tokens as $key=>$value) if($value == $optional) $tokens[$key] = "";
+		foreach($tokens as $key=>$value) if($value==$optional) $tokens[$key] = "";
 		return $tokens;
 	}
 	
@@ -2898,14 +2898,14 @@ class YellowToolbox
 				$string = preg_replace("/\s+/s", " ", $string);
 				if(substru($string, 0, 1)==" " && (empty($output) || substru($output, -1)==' ')) $string = substru($string, 1);
 				$length = strlenu($string);
-				$output .= substru($string, 0, $length < $lengthMax ? $length : $lengthMax-1);
+				$output .= substru($string, 0, $length<$lengthMax ? $length : $lengthMax-1);
 				$lengthMax -= $length;
 				if(!empty($element) && $element==$endMarker) { $lengthMax = 0; $endMarkerFound = true; }
 				if($lengthMax<=0 || !$elementFound) break;
 				$offsetBytes = $elementOffsetBytes + strlenb($element);
 			}
 			$output = rtrim($output);
-			if($lengthMax <= 0) $output .= $endMarkerFound ? $endMarkerText : "…";
+			if($lengthMax<=0) $output .= $endMarkerFound ? $endMarkerText : "…";
 		} else {
 			$elementsOpen = array();
 			while(true)
@@ -2917,14 +2917,14 @@ class YellowToolbox
 				$elementOffsetBytes = $elementFound ? $matches[0][1] : strlenb($text);
 				$string = substrb($text, $offsetBytes, $elementOffsetBytes - $offsetBytes);
 				$length = strlenu($string);
-				$output .= substru($string, 0, $length < $lengthMax ? $length : $lengthMax-1);
+				$output .= substru($string, 0, $length<$lengthMax ? $length : $lengthMax-1);
 				$lengthMax -= $length + ($element[0]=='&' ? 1 : 0);
 				if(!empty($element) && $element==$endMarker) { $lengthMax = 0; $endMarkerFound = true; }
 				if($lengthMax<=0 || !$elementFound) break;
 				if(!empty($elementName) && substru($elementText, -1)!='/' &&
 				   !preg_match("/^(area|br|col|hr|img|input|col|param|!)/i", $elementName))
 				{
-					if($elementName[0] != '/')
+					if($elementName[0]!='/')
 					{
 						array_push($elementsOpen, $elementName);
 					} else {
@@ -2940,7 +2940,7 @@ class YellowToolbox
 				if(!preg_match("/^(dl|ol|ul|table|tbody|thead|tfoot|tr)/i", $elementsOpen[$i])) break;
 				$output .= "</".$elementsOpen[$i].">";
 			}
-			if($lengthMax <= 0) $output .= $endMarkerFound ? $endMarkerText : "…";
+			if($lengthMax<=0) $output .= $endMarkerFound ? $endMarkerText : "…";
 			for(; $i>=0; --$i) $output .= "</".$elementsOpen[$i].">";
 		}
 		return $output;
@@ -2950,7 +2950,7 @@ class YellowToolbox
 	function createTextKeywords($text, $keywordsMax = 0)
 	{
 		$tokens = array_unique(preg_split("/[,\s\(\)\+\-]/", strtoloweru($text)));
-		foreach($tokens as $key=>$value) if(strlenu($value) < 3) unset($tokens[$key]);
+		foreach($tokens as $key=>$value) if(strlenu($value)<3) unset($tokens[$key]);
 		if($keywordsMax) $tokens = array_slice($tokens, 0, $keywordsMax);
 		return implode(", ", $tokens);
 	}
@@ -2975,7 +2975,7 @@ class YellowToolbox
 		{
 			$dataBuffer = @openssl_random_pseudo_bytes($dataBufferSize);
 		}
-		if(strlenb($dataBuffer) == $dataBufferSize)
+		if(strlenb($dataBuffer)==$dataBufferSize)
 		{
 			if($bcryptFormat)
 			{
@@ -3021,7 +3021,7 @@ class YellowToolbox
 								$hashCalculated = crypt($text, $hash);
 							}
 							break;
-			case "sha256":	if(substrb($hash, 0, 4) == "$5y$")
+			case "sha256":	if(substrb($hash, 0, 4)=="$5y$")
 							{
 								$prefix = substrb($hash, 0, 4);
 								$salt = substrb($hash, 4, 32);
@@ -3030,7 +3030,7 @@ class YellowToolbox
 							break;
 		}
 		$ok = !empty($hashCalculated) && strlenb($hashCalculated)==strlenb($hash);
-		if($ok) for($i=0; $i<strlenb($hashCalculated); ++$i) $ok &= $hashCalculated[$i] == $hash[$i];
+		if($ok) for($i=0; $i<strlenb($hashCalculated); ++$i) $ok &= $hashCalculated[$i]==$hash[$i];
 		return $ok;
 	}
 	
@@ -3057,7 +3057,7 @@ class YellowToolbox
 		$fileHandle = @fopen($fileName, "rb");
 		if($fileHandle)
 		{
-			if(substru(strtoloweru($fileName), -3) == "png")
+			if(substru(strtoloweru($fileName), -3)=="png")
 			{
 				$dataSignature = fread($fileHandle, 8);
 				$dataHeader = fread($fileHandle, 16);
@@ -3067,7 +3067,7 @@ class YellowToolbox
 					$height = (ord($dataHeader[14])<<8) + ord($dataHeader[15]);
 					$type = "png";
 				}
-			} else if(substru(strtoloweru($fileName), -3) == "jpg") {
+			} else if(substru(strtoloweru($fileName), -3)=="jpg") {
 				$dataBufferSizeMax = filesize($fileName);
 				$dataBufferSize = min($dataBufferSizeMax, 4096);
 				$dataBuffer = fread($fileHandle, $dataBufferSize);
@@ -3076,7 +3076,7 @@ class YellowToolbox
 				{
 					for($pos=2; $pos+8<$dataBufferSize; $pos+=$length)
 					{
-						if($dataBuffer[$pos] != "\xff") break;
+						if($dataBuffer[$pos]!="\xff") break;
 						if($dataBuffer[$pos+1]=="\xc0" || $dataBuffer[$pos+1]=="\xc2")
 						{
 							$width = (ord($dataBuffer[$pos+7])<<8) + ord($dataBuffer[$pos+8]);
@@ -3085,9 +3085,9 @@ class YellowToolbox
 							break;
 						}
 						$length = (ord($dataBuffer[$pos+2])<<8) + ord($dataBuffer[$pos+3]) + 2;
-						while($pos+$length+8 >= $dataBufferSize)
+						while($pos+$length+8>=$dataBufferSize)
 						{
-							if($dataBufferSize == $dataBufferSizeMax) break;
+							if($dataBufferSize==$dataBufferSizeMax) break;
 							$dataBufferDiff = min($dataBufferSizeMax, $dataBufferSize*2) - $dataBufferSize;
 							$dataBufferSize += $dataBufferDiff;
 							$dataBuffer .= fread($fileHandle, $dataBufferDiff);

+ 2 - 2
system/plugins/language.php

@@ -5,7 +5,7 @@
 // Language plugin
 class YellowLanguage
 {
-	const Version = "0.6.5";
+	const VERSION = "0.6.5";
 	var $yellow;			//access to API
 	
 	// Handle initialisation
@@ -15,5 +15,5 @@ class YellowLanguage
 	}
 }
 
-$yellow->plugins->register("language", "YellowLanguage", YellowLanguage::Version);
+$yellow->plugins->register("language", "YellowLanguage", YellowLanguage::VERSION);
 ?>

+ 5 - 5
system/plugins/markdown.php

@@ -5,7 +5,7 @@
 // Markdown plugin
 class YellowMarkdown
 {
-	const Version = "0.6.3";
+	const VERSION = "0.6.3";
 	var $yellow;			//access to API
 	
 	// Handle initialisation
@@ -75,7 +75,7 @@ class YellowMarkdownParser extends MarkdownExtraParser
 	{
 		$text = $matches[1];
 		$output = "<!--".htmlspecialchars($text, ENT_NOQUOTES)."-->";
-		if($text[0] == '-') $output = "";
+		if($text[0]=='-') $output = "";
 		return $this->hashBlock($output);
 	}
 	
@@ -112,9 +112,9 @@ class YellowMarkdownParser extends MarkdownExtraParser
 	// Handle headers, text style
 	function _doHeaders_callback_setext($matches)
 	{
-		if($matches[3] == '-' && preg_match('{^- }', $matches[1])) return $matches[0];
+		if($matches[3]=='-' && preg_match('{^- }', $matches[1])) return $matches[0];
 		$text = $matches[1];
-		$level = $matches[3]{0} == '=' ? 1 : 2;
+		$level = $matches[3]{0}=='=' ? 1 : 2;
 		$attr = $this->doExtraAttributes("h$level", $dummy =& $matches[2]);
 		if(empty($attr) && $level>=2 && $level<=3) $attr = $this->getIdAttribute($text);
 		$output = "<h$level$attr>".$this->runSpanGamut($text)."</h$level>";
@@ -3409,5 +3409,5 @@ class MarkdownExtraParser extends MarkdownParser {
 	}
 }
 
-$yellow->plugins->register("markdown", "YellowMarkdown", YellowMarkdown::Version);
+$yellow->plugins->register("markdown", "YellowMarkdown", YellowMarkdown::VERSION);
 ?>

+ 30 - 30
system/plugins/update.php

@@ -5,7 +5,7 @@
 // Update plugin
 class YellowUpdate
 {
-	const Version = "0.6.4";
+	const VERSION = "0.6.4";
 	var $yellow;					//access to API
 	
 	// Handle initialisation
@@ -63,12 +63,12 @@ class YellowUpdate
 				list($version, $url) = explode(',', $value);
 				echo "$key $version\n";
 			}
-			if($statusCode == 200) $statusCode = $this->download($data);
-			if($statusCode == 200) $statusCode = $this->update();
-			if($statusCode != 200) echo "ERROR updating files: ".$this->yellow->page->get("pageError")."\n";
+			if($statusCode==200) $statusCode = $this->download($data);
+			if($statusCode==200) $statusCode = $this->update();
+			if($statusCode!=200) echo "ERROR updating files: ".$this->yellow->page->get("pageError")."\n";
 			echo "Yellow $command: Software ".($statusCode!=200 ? "not " : "")."updated\n";
 		} else {
-			if($statusCode != 200) echo "ERROR updating files: ".$this->yellow->page->get("pageError")."\n";
+			if($statusCode!=200) echo "ERROR updating files: ".$this->yellow->page->get("pageError")."\n";
 			echo "Yellow $command: No updates available\n";
 		}
 		return $statusCode;
@@ -78,9 +78,9 @@ class YellowUpdate
 	function updateCommandPending($args)
 	{
 		$statusCode = $this->update();
-		if($statusCode != 0)
+		if($statusCode!=0)
 		{
-			if($statusCode != 200) echo "ERROR updating files: ".$this->yellow->page->get("pageError")."\n";
+			if($statusCode!=200) echo "ERROR updating files: ".$this->yellow->page->get("pageError")."\n";
 			echo "Yellow has ".($statusCode!=200 ? "not " : "")."been updated: Please run command again\n";
 		}
 		return $statusCode;
@@ -104,7 +104,7 @@ class YellowUpdate
 				break;
 			}
 		}
-		if($statusCode == 200)
+		if($statusCode==200)
 		{
 			foreach($data as $key=>$value)
 			{
@@ -128,10 +128,10 @@ class YellowUpdate
 			if(method_exists($value["obj"], "onUpdate"))
 			{
 				$statusCode = $value["obj"]->onUpdate($this->yellow->getRequestHandler());
-				if($statusCode != 0) break;
+				if($statusCode!=0) break;
 			}
 		}
-		if($statusCode == 0)
+		if($statusCode==0)
 		{
 			$path = $this->yellow->config->get("pluginDir");
 			foreach($this->yellow->toolbox->getDirectoryEntries($path, "/^.*\.zip$/", true, false) as $entry)
@@ -154,7 +154,7 @@ class YellowUpdate
 	{
 		$statusCode = 0;
 		$zip = new ZipArchive();
-		if($zip->open($path) === true)
+		if($zip->open($path)===true)
 		{
 			$fileNameInformation = $this->yellow->config->get("updateInformationFile");
 			for($i=0; $i<$zip->numFiles; ++$i)
@@ -165,7 +165,7 @@ class YellowUpdate
 					preg_match("#^(.*\/).*?$#", $fileName, $matches);
 					$pathBase = $matches[1];
 				}
-				if($fileName == $pathBase.$fileNameInformation)
+				if($fileName==$pathBase.$fileNameInformation)
 				{
 					$fileData = $zip->getFromIndex($i);
 					break;
@@ -183,7 +183,7 @@ class YellowUpdate
 					$metaData = $zip->statName($pathBase.$fileName);
 					$modified = $metaData ? $metaData["mtime"] : 0;
 					$statusCode = $this->updateSoftwareFile($matches[1], $fileData, $modified, $flags, $software);
-					if($statusCode != 200) break;
+					if($statusCode!=200) break;
 				}
 			}
 			$zip->close();
@@ -247,7 +247,7 @@ class YellowUpdate
 		if($this->isContentFile($fileName))
 		{
 			$statusCode = $this->update();
-			if($statusCode == 200)
+			if($statusCode==200)
 			{
 				$statusCode = 303;
 				$location = $this->yellow->lookup->normaliseUrl($serverScheme, $serverName, $base, $location);
@@ -276,7 +276,7 @@ class YellowUpdate
 			$password = trim($_REQUEST["password"]);
 			$language = trim($_REQUEST["language"]);
 			$status = trim($_REQUEST["status"]);
-			if($status == "install")
+			if($status=="install")
 			{
 				$status = "ok";
 				$fileNameHome = $this->yellow->lookup->findFileFromLocation("/");
@@ -284,26 +284,26 @@ class YellowUpdate
 				if($fileData==$this->getRawDataHome("en") && $language!="en")
 				{
 					$status = $this->yellow->toolbox->createFile($fileNameHome, $this->getRawDataHome($language)) ? "ok" : "error";
-					if($status == "error") $this->yellow->page->error(500, "Can't write file '$fileNameHome'!");
+					if($status=="error") $this->yellow->page->error(500, "Can't write file '$fileNameHome'!");
 				}
 			}
-			if($status == "ok")
+			if($status=="ok")
 			{
 				if(!empty($email) && !empty($password) && $this->yellow->plugins->isExisting("webinterface"))
 				{
 					$fileNameUser = $this->yellow->config->get("configDir").$this->yellow->config->get("webinterfaceUserFile");
 					$status = $this->yellow->plugins->get("webinterface")->users->update($fileNameUser, $email, $password, $name, $language) ? "ok" : "error";
-					if($status == "error") $this->yellow->page->error(500, "Can't write file '$fileNameUser'!");
+					if($status=="error") $this->yellow->page->error(500, "Can't write file '$fileNameUser'!");
 				}
 			}
-			if($status == "ok")
+			if($status=="ok")
 			{
-				if($this->yellow->config->get("sitename") == "Yellow") $_REQUEST["sitename"] = $name;
+				if($this->yellow->config->get("sitename")=="Yellow") $_REQUEST["sitename"] = $name;
 				$fileNameConfig = $this->yellow->config->get("configDir").$this->yellow->config->get("configFile");
 				$status = $this->yellow->config->update($fileNameConfig, $this->getConfigData()) ? "done" : "error";
-				if($status == "error") $this->yellow->page->error(500, "Can't write file '$fileNameConfig'!");
+				if($status=="error") $this->yellow->page->error(500, "Can't write file '$fileNameConfig'!");
 			}
-			if($status == "done")
+			if($status=="done")
 			{
 				$statusCode = 303;
 				$location = $this->yellow->lookup->normaliseUrl($serverScheme, $serverName, $base, $location);
@@ -327,7 +327,7 @@ class YellowUpdate
 			$rawData .= "<p><label for=\"name\">".$this->yellow->text->get("webinterfaceSignupName")."</label><br /><input class=\"form-control\" type=\"text\" maxlength=\"64\" name=\"name\" id=\"name\" value=\"\"></p>\n";
 			$rawData .= "<p><label for=\"email\">".$this->yellow->text->get("webinterfaceSignupEmail")."</label><br /><input class=\"form-control\" type=\"text\" maxlength=\"64\" name=\"email\" id=\"email\" value=\"\"></p>\n";
 			$rawData .= "<p><label for=\"password\">".$this->yellow->text->get("webinterfaceSignupPassword")."</label><br /><input class=\"form-control\" type=\"password\" maxlength=\"64\" name=\"password\" id=\"password\" value=\"\"></p>\n";
-			if(count($this->yellow->text->getLanguages()) > 1)
+			if(count($this->yellow->text->getLanguages())>1)
 			{
 				$rawData .= "<p>";
 				foreach($this->yellow->text->getLanguages() as $language)
@@ -379,7 +379,7 @@ class YellowUpdate
 			list($version, $url) = explode(',', $dataLatest[$key]);
 			if(empty($feature))
 			{
-				if(strnatcasecmp($dataCurrent[$key], $version) < 0) $data[$key] = $dataLatest[$key];
+				if(strnatcasecmp($dataCurrent[$key], $version)<0) $data[$key] = $dataLatest[$key];
 			} else {
 				if(preg_match("/$feature/i", $key) && $version) $data[$key] = $dataLatest[$key];
 			}
@@ -398,7 +398,7 @@ class YellowUpdate
 			list($statusCodePlugins, $fileDataPlugins) = $this->getSoftwareFile($urlPlugins, $rawFormat);
 			list($statusCodeThemes, $fileDataThemes) = $this->getSoftwareFile($urlThemes, $rawFormat);
 			$statusCode = max($statusCodePlugins, $statusCodeThemes);
-			if($statusCode == 200)
+			if($statusCode==200)
 			{
 				foreach($this->yellow->toolbox->getTextLines($fileDataPlugins."\n".$fileDataThemes) as $line)
 				{
@@ -431,16 +431,16 @@ class YellowUpdate
 			}
 			$curlHandle = curl_init();
 			curl_setopt($curlHandle, CURLOPT_URL, $urlRequest);
-			curl_setopt($curlHandle, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; YellowCore/".YellowCore::Version).")";
+			curl_setopt($curlHandle, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; YellowCore/".YellowCore::VERSION).")";
 			curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, 1);
 			curl_setopt($curlHandle, CURLOPT_CONNECTTIMEOUT, 30);
 			$rawData = curl_exec($curlHandle);
 			$statusCode = curl_getinfo($curlHandle, CURLINFO_HTTP_CODE);
 			curl_close($curlHandle);
-			if($statusCode == 200)
+			if($statusCode==200)
 			{
 				$fileData = $rawData;
-			} else if($statusCode == 0) {
+			} else if($statusCode==0) {
 				$statusCode = 444;
 				$this->yellow->page->error($statusCode, "No response from server!");
 			} else {
@@ -471,9 +471,9 @@ class YellowUpdate
 	function isContentFile($fileName)
 	{
 		$contentDirLength = strlenu($this->yellow->config->get("contentDir"));
-		return substru($fileName, 0, $contentDirLength) == $this->yellow->config->get("contentDir");
+		return substru($fileName, 0, $contentDirLength)==$this->yellow->config->get("contentDir");
 	}
 }
 	
-$yellow->plugins->register("update", "YellowUpdate", YellowUpdate::Version, 1);
+$yellow->plugins->register("update", "YellowUpdate", YellowUpdate::VERSION, 1);
 ?>

+ 1 - 1
system/plugins/webinterface.js

@@ -729,7 +729,7 @@ yellow.toolbox =
 	// Check if element exists and is visible
 	isVisible: function(element)
 	{
-		return element && element.style.display != "none";
+		return element && element.style.display!="none";
 	},
 	
 	// Encode newline characters

+ 81 - 81
system/plugins/webinterface.php

@@ -5,7 +5,7 @@
 // Web interface plugin
 class YellowWebinterface
 {
-	const Version = "0.6.9";
+	const VERSION = "0.6.9";
 	var $yellow;				//access to API
 	var $active;				//web interface is active? (boolean)
 	var $userEmail;				//web interface user
@@ -60,19 +60,19 @@ class YellowWebinterface
 			{
 				if(empty($this->rawDataSource)) $this->rawDataSource = $page->rawData;
 				if(empty($this->rawDataEdit)) $this->rawDataEdit = $page->rawData;
-				if($page->statusCode == 424) $this->rawDataEdit = $this->getRawDataNew($page->location);
+				if($page->statusCode==424) $this->rawDataEdit = $this->getRawDataNew($page->location);
 			}
 			if(empty($this->userLanguage)) $this->userLanguage = $page->get("language");
 			if(empty($this->action)) $this->action = $this->isUser() ? "none" : "login";
 			if(empty($this->status)) $this->status = "none";
-			if($this->status == "error") $this->action = "error";
+			if($this->status=="error") $this->action = "error";
 		}
 	}
 	
 	// Handle page content parsing of custom block
 	function onParseContentBlock($page, $name, $text, $shortcut)
 	{
-		$output = NULL;
+		$output = null;
 		if($name=="edit" && $shortcut)
 		{
 			$editText = "$name $text";
@@ -85,7 +85,7 @@ class YellowWebinterface
 	// Handle page extra HTML data
 	function onExtra($name)
 	{
-		$output = NULL;
+		$output = null;
 		if($this->isActive() && $name=="header")
 		{
 			$location = $this->yellow->config->get("serverBase").$this->yellow->config->get("pluginLocation")."webinterface";
@@ -126,11 +126,11 @@ class YellowWebinterface
 	{
 		$statusCode = 0;
 		list($command, $path) = $args;
-		if($path == "all")
+		if($path=="all")
 		{
 			$fileNameUser = $this->yellow->config->get("configDir").$this->yellow->config->get("webinterfaceUserFile");
 			if(!$this->users->clean($fileNameUser)) $statusCode = 500;
-			if($statusCode == 500) echo "ERROR cleaning configuration: Can't write file '$fileNameUser'!\n";
+			if($statusCode==500) echo "ERROR cleaning configuration: Can't write file '$fileNameUser'!\n";
 		}
 		return $statusCode;
 	}
@@ -149,17 +149,17 @@ class YellowWebinterface
 				case "invalid":	echo "ERROR updating configuration: Please enter a valid email!\n"; break;
 				case "weak": echo "ERROR updating configuration: Please enter a different password!\n"; break;
 			}
-			if($status == "ok")
+			if($status=="ok")
 			{
 				$fileNameUser = $this->yellow->config->get("configDir").$this->yellow->config->get("webinterfaceUserFile");
 				$status = $this->users->update($fileNameUser, $email, $password, $name, $language, "active") ? "ok" : "error";
-				if($status == "error") echo "ERROR updating configuration: Can't write file '$fileNameUser'!\n";
+				if($status=="error") echo "ERROR updating configuration: Can't write file '$fileNameUser'!\n";
 			}
-			if($status == "ok")
+			if($status=="ok")
 			{
 				$algorithm = $this->yellow->config->get("webinterfaceUserHashAlgorithm");
 				$status = substru($this->users->getHash($email), 0, 5)!="error-hash" ? "ok" : "error";
-				if($status == "error") echo "ERROR updating configuration: Hash algorithm '$algorithm' not supported!\n";
+				if($status=="error") echo "ERROR updating configuration: Hash algorithm '$algorithm' not supported!\n";
 			}
 			$statusCode = $status=="ok" ? 200 : 500;
 			echo "Yellow $command: User account ".($statusCode!=200 ? "not " : "");
@@ -201,10 +201,10 @@ class YellowWebinterface
 				case "recover":		$statusCode = $this->processRequestRecover($serverScheme, $serverName, $base, $location, $fileName); break;
 			}
 		}
-		if($statusCode == 0)
+		if($statusCode==0)
 		{
 			$statusCode = $this->yellow->processRequest($serverScheme, $serverName, $base, $location, $fileName, false);
-			if($this->action == "fail") $this->yellow->page->error(500, "Login failed, [please log in](javascript:yellow.action('login');)!");
+			if($this->action=="fail") $this->yellow->page->error(500, "Login failed, [please log in](javascript:yellow.action('login');)!");
 		}
 		return $statusCode;
 	}
@@ -237,7 +237,7 @@ class YellowWebinterface
 	{
 		$statusCode = 0;
 		$home = $this->users->getHome($this->userEmail);
-		if(substru($location, 0, strlenu($home)) == $home)
+		if(substru($location, 0, strlenu($home))==$home)
 		{
 			$statusCode = 303;
 			$location = $this->yellow->lookup->normaliseUrl($serverScheme, $serverName, $base, $location);
@@ -273,19 +273,19 @@ class YellowWebinterface
 		$email = trim($_REQUEST["email"]);
 		$password = trim($_REQUEST["password"]);
 		if(empty($name) || empty($email) || empty($password)) $this->status = "incomplete";
-		if($this->status == "ok") $this->status = $this->getUserAccount($email, $password, $this->action);
-		if($this->status == "ok" && !$this->users->isWebmaster()) $this->status = "next";
-		if($this->status == "ok" && $this->users->isExisting($email)) $this->status = "next";
-		if($this->status == "ok")
+		if($this->status=="ok") $this->status = $this->getUserAccount($email, $password, $this->action);
+		if($this->status=="ok" && !$this->users->isWebmaster()) $this->status = "next";
+		if($this->status=="ok" && $this->users->isExisting($email)) $this->status = "next";
+		if($this->status=="ok")
 		{
 			$fileNameUser = $this->yellow->config->get("configDir").$this->yellow->config->get("webinterfaceUserFile");
 			$this->status = $this->users->update($fileNameUser, $email, $password, $name, "", "unconfirmed") ? "ok" : "error";
-			if($this->status == "error") $this->yellow->page->error(500, "Can't write file '$fileNameUser'!");
+			if($this->status=="error") $this->yellow->page->error(500, "Can't write file '$fileNameUser'!");
 		}
-		if($this->status == "ok")
+		if($this->status=="ok")
 		{
 			$this->status = $this->sendMail($serverScheme, $serverName, $base, $email, "confirm") ? "next" : "error";
-			if($this->status == "error") $this->yellow->page->error(500, "Can't send email on this server!");
+			if($this->status=="error") $this->yellow->page->error(500, "Can't send email on this server!");
 		}
 		$statusCode = $this->yellow->processRequest($serverScheme, $serverName, $base, $location, $fileName, false);
 		return $statusCode;
@@ -298,16 +298,16 @@ class YellowWebinterface
 		$this->status = "ok";
 		$email = $_REQUEST["email"];
 		$this->status = $this->getUserRequest($email, $_REQUEST["action"], $_REQUEST["expire"], $_REQUEST["id"]);
-		if($this->status == "ok")
+		if($this->status=="ok")
 		{
 			$fileNameUser = $this->yellow->config->get("configDir").$this->yellow->config->get("webinterfaceUserFile");
 			$this->status = $this->users->update($fileNameUser, $email, "", "", "", "unapproved") ? "ok" : "error";
-			if($this->status == "error") $this->yellow->page->error(500, "Can't write file '$fileNameUser'!");
+			if($this->status=="error") $this->yellow->page->error(500, "Can't write file '$fileNameUser'!");
 		}
-		if($this->status == "ok")
+		if($this->status=="ok")
 		{
 			$this->status = $this->sendMail($serverScheme, $serverName, $base, $email, "approve") ? "done" : "error";
-			if($this->status == "error") $this->yellow->page->error(500, "Can't send email on this server!");
+			if($this->status=="error") $this->yellow->page->error(500, "Can't send email on this server!");
 		}
 		$statusCode = $this->yellow->processRequest($serverScheme, $serverName, $base, $location, $fileName, false);
 		return $statusCode;
@@ -320,16 +320,16 @@ class YellowWebinterface
 		$this->status = "ok";
 		$email = $_REQUEST["email"];
 		$this->status = $this->getUserRequest($email, $_REQUEST["action"], $_REQUEST["expire"], $_REQUEST["id"]);
-		if($this->status == "ok")
+		if($this->status=="ok")
 		{
 			$fileNameUser = $this->yellow->config->get("configDir").$this->yellow->config->get("webinterfaceUserFile");
 			$this->status = $this->users->update($fileNameUser, $email, "", "", "", "active") ? "ok" : "error";
-			if($this->status == "error") $this->yellow->page->error(500, "Can't write file '$fileNameUser'!");
+			if($this->status=="error") $this->yellow->page->error(500, "Can't write file '$fileNameUser'!");
 		}
-		if($this->status == "ok")
+		if($this->status=="ok")
 		{
 			$this->status = $this->sendMail($serverScheme, $serverName, $base, $email, "welcome") ? "done" : "error";
-			if($this->status == "error") $this->yellow->page->error(500, "Can't send email on this server!");
+			if($this->status=="error") $this->yellow->page->error(500, "Can't send email on this server!");
 		}
 		$statusCode = $this->yellow->processRequest($serverScheme, $serverName, $base, $location, $fileName, false);
 		return $statusCode;
@@ -345,31 +345,31 @@ class YellowWebinterface
 		if(empty($_REQUEST["id"]))
 		{
 			if(!filter_var($email, FILTER_VALIDATE_EMAIL)) $this->status = "invalid";
-			if($this->status == "ok" && !$this->users->isWebmaster()) $this->status = "next";
-			if($this->status == "ok" && !$this->users->isExisting($email)) $this->status = "next";
-			if($this->status == "ok")
+			if($this->status=="ok" && !$this->users->isWebmaster()) $this->status = "next";
+			if($this->status=="ok" && !$this->users->isExisting($email)) $this->status = "next";
+			if($this->status=="ok")
 			{
 				$this->status = $this->sendMail($serverScheme, $serverName, $base, $email, "recover") ? "next" : "error";
-				if($this->status == "error") $this->yellow->page->error(500, "Can't send email on this server!");
+				if($this->status=="error") $this->yellow->page->error(500, "Can't send email on this server!");
 			}
 		} else {
 			$this->status = $this->getUserRequest($email, $_REQUEST["action"], $_REQUEST["expire"], $_REQUEST["id"]);
-			if($this->status == "ok")
+			if($this->status=="ok")
 			{
 				if(empty($password)) $this->status = "password";
-				if($this->status == "ok") $this->status = $this->getUserAccount($email, $password, $this->action);
-				if($this->status == "ok")
+				if($this->status=="ok") $this->status = $this->getUserAccount($email, $password, $this->action);
+				if($this->status=="ok")
 				{
 					$fileNameUser = $this->yellow->config->get("configDir").$this->yellow->config->get("webinterfaceUserFile");
 					$this->status = $this->users->update($fileNameUser, $email, $password) ? "ok" : "error";
-					if($this->status == "error") $this->yellow->page->error(500, "Can't write file '$fileNameUser'!");
+					if($this->status=="error") $this->yellow->page->error(500, "Can't write file '$fileNameUser'!");
 				}
-				if($this->status == "ok")
+				if($this->status=="ok")
 				{
 					$this->userEmail = "";
 					$this->users->destroyCookie("login");
 					$this->status = $this->sendMail($serverScheme, $serverName, $base, $email, "information") ? "done" : "error";
-					if($this->status == "error") $this->yellow->page->error(500, "Can't send email on this server!");
+					if($this->status=="error") $this->yellow->page->error(500, "Can't send email on this server!");
 				}
 			}
 		}
@@ -382,15 +382,15 @@ class YellowWebinterface
 	{
 		$this->action = "settings";
 		$this->status = $this->getUserAccount($this->userEmail, "", $this->action);
-		if($this->status == "ok")
+		if($this->status=="ok")
 		{
 			$name = trim(preg_replace("/[^\pL\d\-\. ]/u", "-", $_REQUEST["name"]));
 			$language = trim($_REQUEST["language"]);
 			$fileNameUser = $this->yellow->config->get("configDir").$this->yellow->config->get("webinterfaceUserFile");
 			$this->status = $this->users->update($fileNameUser, $this->userEmail, "", $name, $language) ? "done" : "error";
-			if($this->status == "error") $this->yellow->page->error(500, "Can't write file '$fileNameUser'!");
+			if($this->status=="error") $this->yellow->page->error(500, "Can't write file '$fileNameUser'!");
 		}
-		if($this->status == "done")
+		if($this->status=="done")
 		{
 			$statusCode = 303;
 			$location = $this->yellow->lookup->normaliseUrl($serverScheme, $serverName, $base, $location);
@@ -495,7 +495,7 @@ class YellowWebinterface
 			$id = $this->users->createUserRequestId($email, $action, $expire);
 			$url = "$serverScheme://$serverName$base"."/action:$action/email:$email/expire:$expire/id:$id/";
 		}
-		if($action == "approve")
+		if($action=="approve")
 		{
 			$account = $email;
 			$name = $this->yellow->config->get("author");
@@ -531,7 +531,7 @@ class YellowWebinterface
 		   $this->yellow->toolbox->getServerName()==$this->yellow->config->get("webinterfaceServerName"))
 		{
 			$locationLength = strlenu($this->yellow->config->get("webinterfaceLocation"));
-			$this->active = substru($location, 0, $locationLength) == $this->yellow->config->get("webinterfaceLocation");
+			$this->active = substru($location, 0, $locationLength)==$this->yellow->config->get("webinterfaceLocation");
 		}
 		return $this->isActive();
 	}
@@ -539,7 +539,7 @@ class YellowWebinterface
 	// Check web interface user
 	function checkUser($location, $fileName)
 	{
-		if($_POST["action"] == "login")
+		if($_POST["action"]=="login")
 		{
 			$email = $_POST["email"];
 			$password = $_POST["password"];
@@ -585,7 +585,7 @@ class YellowWebinterface
 	// Return user account changes
 	function getUserAccount($email, $password, $action)
 	{
-		$status = NULL;
+		$status = null;
 		foreach($this->yellow->plugins->plugins as $key=>$value)
 		{
 			if(method_exists($value["obj"], "onUserAccount"))
@@ -606,7 +606,7 @@ class YellowWebinterface
 	// Return user restrictions to change page
 	function getUserRestrictions($email, $location, $fileName)
 	{
-		$userRestrictions = NULL;
+		$userRestrictions = null;
 		foreach($this->yellow->plugins->plugins as $key=>$value)
 		{
 			if(method_exists($value["obj"], "onUserRestrictions"))
@@ -618,7 +618,7 @@ class YellowWebinterface
 		if(is_null($userRestrictions))
 		{
 			$userRestrictions = !is_dir(dirname($fileName)) || strlenu(basename($fileName))>128;
-			$userRestrictions |= substru($location, 0, strlenu($this->users->getHome($email))) != $this->users->getHome($email);
+			$userRestrictions |= substru($location, 0, strlenu($this->users->getHome($email)))!=$this->users->getHome($email);
 		}
 		return $userRestrictions;
 	}
@@ -717,7 +717,7 @@ class YellowWebinterface
 					$page->get($prefix), $page->get("title"), $fileName,
 					$this->yellow->config->get("contentDefaultFile"), $this->yellow->config->get("contentExtension"));
 				$page->location = $this->yellow->lookup->findLocationFromFile($page->fileName);
-				if($pageSource->location != $page->location)
+				if($pageSource->location!=$page->location)
 				{
 					if(!$this->yellow->lookup->isFileLocation($page->location))
 					{
@@ -769,7 +769,7 @@ class YellowWebinterface
 			$data["pageFile"] = $this->yellow->page->get("pageFile");
 			$data["parserSafeMode"] = $this->yellow->page->parserSafeMode;
 		}
-		if($this->action != "none") $data = array_merge($data, $this->getRequestData());
+		if($this->action!="none") $data = array_merge($data, $this->getRequestData());
 		$data["action"] = $this->action;
 		$data["status"] = $this->status;
 		$data["statusCode"] = $this->yellow->page->statusCode;
@@ -797,7 +797,7 @@ class YellowWebinterface
 			{
 				$data["serverLanguages"][$language] = $this->yellow->text->getTextHtml("languageDescription", $language);
 			}
-			$data["serverVersion"] = "Yellow ".YellowCore::Version;
+			$data["serverVersion"] = "Yellow ".YellowCore::VERSION;
 		} else {
 			$data["loginEmail"] = $this->yellow->config->get("loginEmail");
 			$data["loginPassword"] = $this->yellow->config->get("loginPassword");
@@ -1076,7 +1076,7 @@ class YellowUsers
 	// Check if web master exists
 	function isWebmaster()
 	{
-		return substru($this->yellow->config->get("email"), 0, 7) != "noreply";
+		return substru($this->yellow->config->get("email"), 0, 7)!="noreply";
 	}
 	
 	// Check if user exists
@@ -1090,20 +1090,20 @@ class YellowUsers
 class YellowMerge
 {
 	var $yellow;		//access to API
-	const Add = '+';	//merge types
-	const Modify = '*';
-	const Remove = '-';
-	const Same = ' ';
+	const ADD = '+';	//merge types
+	const MODIFY = '*';
+	const REMOVE = '-';
+	const SAME = ' ';
 	
 	function __construct($yellow)
 	{
 		$this->yellow = $yellow;
 	}
 	
-	// Merge text, NULL if not possible
+	// Merge text, null if not possible
 	function merge($textSource, $textMine, $textYours, $showDiff = false)
 	{
-		if($textMine != $textYours)
+		if($textMine!=$textYours)
 		{
 			$diffMine = $this->buildDiff($textSource, $textMine);
 			$diffYours = $this->buildDiff($textSource, $textYours);
@@ -1130,37 +1130,37 @@ class YellowMerge
 		{
 			--$sourceEnd; --$otherEnd;
 		}
-		for($pos=0; $pos<$textStart; ++$pos) array_push($diff, array(YellowMerge::Same, $textSource[$pos], false));
+		for($pos=0; $pos<$textStart; ++$pos) array_push($diff, array(YellowMerge::SAME, $textSource[$pos], false));
 		$lcs = $this->buildDiffLCS($textSource, $textOther, $textStart, $sourceEnd-$textStart, $otherEnd-$textStart);
 		for($x=0,$y=0,$xEnd=$otherEnd-$textStart,$yEnd=$sourceEnd-$textStart; $x<$xEnd || $y<$yEnd;)
 		{
 			$max = $lcs[$y][$x];
 			if($y<$yEnd && $lcs[$y+1][$x]==$max)
 			{
-				array_push($diff, array(YellowMerge::Remove, $textSource[$textStart+$y], false));
-				if($lastRemove == -1) $lastRemove = count($diff)-1;
+				array_push($diff, array(YellowMerge::REMOVE, $textSource[$textStart+$y], false));
+				if($lastRemove==-1) $lastRemove = count($diff)-1;
 				++$y;
 				continue;
 			}
 			if($x<$xEnd && $lcs[$y][$x+1]==$max)
 			{
-				if($lastRemove==-1 || $diff[$lastRemove][0]!=YellowMerge::Remove)
+				if($lastRemove==-1 || $diff[$lastRemove][0]!=YellowMerge::REMOVE)
 				{
-					array_push($diff, array(YellowMerge::Add, $textOther[$textStart+$x], false));
+					array_push($diff, array(YellowMerge::ADD, $textOther[$textStart+$x], false));
 					$lastRemove = -1;
 				} else {
-					$diff[$lastRemove] = array(YellowMerge::Modify, $textOther[$textStart+$x], false);
+					$diff[$lastRemove] = array(YellowMerge::MODIFY, $textOther[$textStart+$x], false);
 					++$lastRemove; if(count($diff)==$lastRemove) $lastRemove = -1;
 				}
 				++$x;
 				continue;
 			}
-			array_push($diff, array(YellowMerge::Same, $textSource[$textStart+$y], false));
+			array_push($diff, array(YellowMerge::SAME, $textSource[$textStart+$y], false));
 			$lastRemove = -1;
 			++$x;
 			++$y;
 		}
-		for($pos=$sourceEnd;$pos<$sourceSize; ++$pos) array_push($diff, array(YellowMerge::Same, $textSource[$pos], false));
+		for($pos=$sourceEnd;$pos<$sourceSize; ++$pos) array_push($diff, array(YellowMerge::SAME, $textSource[$pos], false));
 		return $diff;
 	}
 	
@@ -1172,7 +1172,7 @@ class YellowMerge
 		{
 			for($x=$xEnd-1; $x>=0; --$x)
 			{
-				if($textSource[$textStart+$y] == $textOther[$textStart+$x])
+				if($textSource[$textStart+$y]==$textOther[$textStart+$x])
 				{
 					$lcs[$y][$x] = $lcs[$y+1][$x+1]+1;
 				} else {
@@ -1192,29 +1192,29 @@ class YellowMerge
 		{
 			$typeMine = $diffMine[$posMine][0];
 			$typeYours = $diffYours[$posYours][0];
-			if($typeMine==YellowMerge::Same)
+			if($typeMine==YellowMerge::SAME)
 			{
 				array_push($diff, $diffYours[$posYours]);
-			} else if($typeYours==YellowMerge::Same) {
+			} else if($typeYours==YellowMerge::SAME) {
 				array_push($diff, $diffMine[$posMine]);
-			} else if($typeMine==YellowMerge::Add && $typeYours==YellowMerge::Add) {
+			} else if($typeMine==YellowMerge::ADD && $typeYours==YellowMerge::ADD) {
 				$this->mergeConflict($diff, $diffMine[$posMine], $diffYours[$posYours], false);
-			} else if($typeMine==YellowMerge::Modify && $typeYours==YellowMerge::Modify) {
+			} else if($typeMine==YellowMerge::MODIFY && $typeYours==YellowMerge::MODIFY) {
 				$this->mergeConflict($diff, $diffMine[$posMine], $diffYours[$posYours], false);
-			} else if($typeMine==YellowMerge::Remove && $typeYours==YellowMerge::Remove) {
+			} else if($typeMine==YellowMerge::REMOVE && $typeYours==YellowMerge::REMOVE) {
 				array_push($diff, $diffMine[$posMine]);
-			} else if($typeMine==YellowMerge::Add) {
+			} else if($typeMine==YellowMerge::ADD) {
 				array_push($diff, $diffMine[$posMine]);
-			} else if($typeYours==YellowMerge::Add) {
+			} else if($typeYours==YellowMerge::ADD) {
 				array_push($diff, $diffYours[$posYours]);
 			} else {
 				$this->mergeConflict($diff, $diffMine[$posMine], $diffYours[$posYours], true);
 			}
 			if(defined("DEBUG") && DEBUG>=2) echo "YellowMerge::mergeDiff $typeMine $typeYours pos:$posMine\t$posYours<br/>\n";
-			if($typeMine==YellowMerge::Add || $typeYours==YellowMerge::Add)
+			if($typeMine==YellowMerge::ADD || $typeYours==YellowMerge::ADD)
 			{
-				if($typeMine==YellowMerge::Add) ++$posMine;
-				if($typeYours==YellowMerge::Add) ++$posYours;
+				if($typeMine==YellowMerge::ADD) ++$posMine;
+				if($typeYours==YellowMerge::ADD) ++$posYours;
 			} else {
 				++$posMine;
 				++$posYours;
@@ -1247,7 +1247,7 @@ class YellowMerge
 		}
 	}
 	
-	// Return merged text, NULL if not possible
+	// Return merged text, null if not possible
 	function getOutput($diff, $showDiff = false)
 	{
 		$output = "";
@@ -1255,7 +1255,7 @@ class YellowMerge
 		{
 			for($i=0; $i<count($diff); ++$i)
 			{
-				if($diff[$i][0] != YellowMerge::Remove) $output .= $diff[$i][1];
+				if($diff[$i][0]!=YellowMerge::REMOVE) $output .= $diff[$i][1];
 				$conflict |= $diff[$i][2];
 			}
 		} else {
@@ -1265,9 +1265,9 @@ class YellowMerge
 				$output .= $diff[$i][1];
 			}
 		}
-		return !$conflict ? $output : NULL;
+		return !$conflict ? $output : null;
 	}
 }
 
-$yellow->plugins->register("webinterface", "YellowWebinterface", YellowWebinterface::Version);
+$yellow->plugins->register("webinterface", "YellowWebinterface", YellowWebinterface::VERSION);
 ?>

+ 1 - 1
system/themes/snippets/content-sidebar.php

@@ -1,6 +1,6 @@
 <?php if($yellow->page->isPage("sidebar")): ?>
 <div class="content sidebar">
-<?php if($yellow->page->get("navigation") == "navigation-sidebar"): ?>
+<?php if($yellow->page->get("navigation")=="navigation-sidebar"): ?>
 <?php $page = $yellow->page->getParentTop(false) ?>
 <?php $pages = $page ? $page->getChildren(!$page->isVisible()): $yellow->pages->clean() ?>
 <?php $yellow->snippet("navigation-sidebar", $pages, true) ?>

+ 1 - 1
system/themes/snippets/header.php

@@ -14,7 +14,7 @@
 <body>
 <?php $yellow->page->set("pageClass", "page") ?>
 <?php $yellow->page->set("pageClass", $yellow->page->get("pageClass")." ".$yellow->page->get("template")) ?>
-<?php if($yellow->page->get("navigation") == "navigation-sidebar") $yellow->page->setPage("sidebar", $yellow->page); ?>
+<?php if($yellow->page->get("navigation")=="navigation-sidebar") $yellow->page->setPage("sidebar", $yellow->page); ?>
 <?php if($page = $yellow->pages->find($yellow->lookup->getDirectoryLocation($yellow->page->location).$yellow->page->get("sidebar"))) $yellow->page->setPage("sidebar", $page) ?>
 <?php if($yellow->page->isPage("sidebar")) $yellow->page->set("pageClass", $yellow->page->get("pageClass")." with-sidebar") ?>
 <div class="<?php echo $yellow->page->getHtml("pageClass") ?>">