소스 검색

System update (better PHP support)

markseu 9 년 전
부모
커밋
bc8b86ffad
2개의 변경된 파일17개의 추가작업 그리고 5개의 파일을 삭제
  1. 2 1
      system/plugins/commandline.php
  2. 15 4
      system/plugins/core.php

+ 2 - 1
system/plugins/commandline.php

@@ -62,7 +62,8 @@ class YellowCommandline
 	function versionCommand($args)
 	function versionCommand($args)
 	{
 	{
 		$statusCode = 0;
 		$statusCode = 0;
-		echo "Yellow ".YellowCore::Version."\n";
+		$serverSoftware = $this->yellow->toolbox->getServerSoftware();
+		echo "Yellow ".YellowCore::Version.", PHP ".PHP_VERSION.", $serverSoftware\n";
 		$url = $this->yellow->config->get("commandlineVersionUrl");
 		$url = $this->yellow->config->get("commandlineVersionUrl");
 		list($dummy, $command) = $args;
 		list($dummy, $command) = $args;
 		list($statusCode, $versionCurrent) = $this->getPluginVersion();
 		list($statusCode, $versionCurrent) = $this->getPluginVersion();

+ 15 - 4
system/plugins/core.php

@@ -90,6 +90,7 @@ class YellowCore
 		ob_start();
 		ob_start();
 		$statusCode = 0;
 		$statusCode = 0;
 		$this->toolbox->timerStart($time);
 		$this->toolbox->timerStart($time);
+		$this->toolbox->normaliseRequest();
 		list($serverScheme, $serverName, $base, $location, $fileName) = $this->getRequestInformation();
 		list($serverScheme, $serverName, $base, $location, $fileName) = $this->getRequestInformation();
 		$this->page->setRequestInformation($serverScheme, $serverName, $base, $location, $fileName);
 		$this->page->setRequestInformation($serverScheme, $serverName, $base, $location, $fileName);
 		foreach($this->plugins->plugins as $key=>$value)
 		foreach($this->plugins->plugins as $key=>$value)
@@ -541,14 +542,13 @@ class YellowPage
 		}
 		}
 		if(is_null($output))
 		if(is_null($output))
 		{
 		{
-			if($name=="debug" && $shortcut)
+			if($name=="yellow" && $shortcut)
 			{
 			{
 				$output = "<span class=\"".htmlspecialchars($name)."\">\n";
 				$output = "<span class=\"".htmlspecialchars($name)."\">\n";
 				if(empty($text))
 				if(empty($text))
 				{
 				{
 					$serverSoftware = $this->yellow->toolbox->getServerSoftware();
 					$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";
-				} else if($text == "version") {
 					foreach($this->yellow->plugins->getData() as $key=>$value)
 					foreach($this->yellow->plugins->getData() as $key=>$value)
 					{
 					{
 						$output .= htmlspecialchars("$key: $value")."<br />\n";
 						$output .= htmlspecialchars("$key: $value")."<br />\n";
@@ -559,7 +559,7 @@ class YellowPage
 						$output .= htmlspecialchars(ucfirst($key).": ".$value)."<br />\n";
 						$output .= htmlspecialchars(ucfirst($key).": ".$value)."<br />\n";
 					}
 					}
 				}
 				}
-				if(!empty($text) && $this->parserSafeMode) $this->error(500, "Debug '$text' is not allowed in safe mode!");
+				if($this->parserSafeMode) $this->error(500, "Yellow information are not available in safe mode!");
 				$output .= "</span>\n";
 				$output .= "</span>\n";
 			}
 			}
 		}
 		}
@@ -2244,7 +2244,7 @@ class YellowToolbox
 	// Return server software from current HTTP request
 	// Return server software from current HTTP request
 	function getServerSoftware()
 	function getServerSoftware()
 	{
 	{
-		$serverSoftware = PHP_SAPI;
+		$serverSoftware = strtoupperu(PHP_SAPI);
 		if(preg_match("/^(\S+)/", $_SERVER["SERVER_SOFTWARE"], $matches)) $serverSoftware = $matches[1];
 		if(preg_match("/^(\S+)/", $_SERVER["SERVER_SOFTWARE"], $matches)) $serverSoftware = $matches[1];
 		return $serverSoftware." ".PHP_OS;
 		return $serverSoftware." ".PHP_OS;
 	}
 	}
@@ -2403,6 +2403,17 @@ class YellowToolbox
 		return isset($_SERVER["HTTP_IF_MODIFIED_SINCE"]) && $_SERVER["HTTP_IF_MODIFIED_SINCE"]==$lastModifiedFormatted;
 		return isset($_SERVER["HTTP_IF_MODIFIED_SINCE"]) && $_SERVER["HTTP_IF_MODIFIED_SINCE"]==$lastModifiedFormatted;
 	}
 	}
 	
 	
+	// Normalise request data, take care of magic quotes
+	function normaliseRequest()
+	{
+		if(get_magic_quotes_gpc())
+		{
+			function stripArray($data) { return is_array($data) ? array_map("stripArray", $data) : stripslashes($data); }
+			$requestData = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
+			foreach($requestData as &$data) $data = stripArray($data);
+		}
+	}
+	
 	// Normalise location arguments
 	// Normalise location arguments
 	function normaliseArgs($text, $appendSlash = true, $filterStrict = true)
 	function normaliseArgs($text, $appendSlash = true, $filterStrict = true)
 	{
 	{