Bläddra i källkod

Better location handling (remix by Datenanalyst David)

markseu 12 år sedan
förälder
incheckning
61fe77ac41
2 ändrade filer med 6 tillägg och 7 borttagningar
  1. 2 3
      system/core/core.php
  2. 4 4
      system/core/core_commandline.php

+ 2 - 3
system/core/core.php

@@ -878,10 +878,9 @@ class Yellow_Toolbox
 	// Check if location is valid
 	// Check if location is valid
 	static function isValidLocation($location)
 	static function isValidLocation($location)
 	{
 	{
-		$string = "/";
+		$string = "";
 		$tokens = explode('/', $location);
 		$tokens = explode('/', $location);
-		for($i=1; $i<count($tokens)-1; ++$i) $string .= self::normaliseName($tokens[$i]).'/';
-		$string .= self::normaliseName($tokens[$i]);
+		for($i=1; $i<count($tokens); ++$i) $string .= '/'.self::normaliseName($tokens[$i]);
 		return $location == $string;
 		return $location == $string;
 	}
 	}
 	
 	

+ 4 - 4
system/core/core_commandline.php

@@ -54,12 +54,9 @@ class Yellow_Commandline
 		{
 		{
 			if($this->yellow->config->isExisting("serverName") && $this->yellow->config->isExisting("serverBase"))
 			if($this->yellow->config->isExisting("serverName") && $this->yellow->config->isExisting("serverBase"))
 			{
 			{
-				$this->yellow->toolbox->timerStart($time);
 				$serverName = $this->yellow->config->get("serverName");
 				$serverName = $this->yellow->config->get("serverName");
 				$serverBase = $this->yellow->config->get("serverBase");
 				$serverBase = $this->yellow->config->get("serverBase");
 				list($statusCode, $contentCount, $mediaCount, $errorCount) = $this->buildStatic($serverName, $serverBase, $location, $path);
 				list($statusCode, $contentCount, $mediaCount, $errorCount) = $this->buildStatic($serverName, $serverBase, $location, $path);
-				$this->yellow->toolbox->timerStop($time);
-				if(defined("DEBUG") && DEBUG>=1) echo "Yellow_Commandline::build time:$time ms\n";
 			} else {
 			} else {
 				list($statusCode, $contentCount, $mediaCount, $errorCount) = array(500, 0, 0, 1);
 				list($statusCode, $contentCount, $mediaCount, $errorCount) = array(500, 0, 0, 1);
 				$fileName = $this->yellow->config->get("configDir").$this->yellow->config->get("configFile");
 				$fileName = $this->yellow->config->get("configDir").$this->yellow->config->get("configFile");
@@ -77,6 +74,7 @@ class Yellow_Commandline
 	// Build static files
 	// Build static files
 	function buildStatic($serverName, $serverBase, $location, $path)
 	function buildStatic($serverName, $serverBase, $location, $path)
 	{
 	{
+		$this->yellow->toolbox->timerStart($time);
 		$statusCodeMax = $errorCount = 0;
 		$statusCodeMax = $errorCount = 0;
 		if(empty($location))
 		if(empty($location))
 		{
 		{
@@ -109,6 +107,8 @@ class Yellow_Commandline
 			}
 			}
 			if(defined("DEBUG") && DEBUG>=1) echo "Yellow_Commandline::buildStatic status:$statusCode file:$fileName\n";
 			if(defined("DEBUG") && DEBUG>=1) echo "Yellow_Commandline::buildStatic status:$statusCode file:$fileName\n";
 		}
 		}
+		$this->yellow->toolbox->timerStop($time);
+		if(defined("DEBUG") && DEBUG>=1) echo "Yellow_Commandline::buildStatic time:$time ms\n";
 		return array($statusCodeMax, count($pages), count($fileNames), $errorCount);
 		return array($statusCodeMax, count($pages), count($fileNames), $errorCount);
 	}
 	}
 	
 	
@@ -123,7 +123,7 @@ class Yellow_Commandline
 		$statusCode = $this->yellow->request();
 		$statusCode = $this->yellow->request();
 		if($statusCode != 404)
 		if($statusCode != 404)
 		{
 		{
-			$ok = true;
+			$ok = false;
 			$modified = strtotime($this->yellow->page->getHeader("Last-Modified"));
 			$modified = strtotime($this->yellow->page->getHeader("Last-Modified"));
 			if(preg_match("/^(\w+)\/(\w+)/", $this->yellow->page->getHeader("Content-Type"), $matches)) 
 			if(preg_match("/^(\w+)\/(\w+)/", $this->yellow->page->getHeader("Content-Type"), $matches)) 
 			{
 			{