commit 61fe77ac4118945b1d5c34faec74dc58d659dba1
parent a17580f2d18e4915577c962cc2ab3cd0e43f8cbc
Author: markseu <mark2011@mayberg.se>
Date: Tue, 30 Jul 2013 11:31:40 +0200
Better location handling (remix by Datenanalyst David)
Diffstat:
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/system/core/core.php b/system/core/core.php
@@ -878,10 +878,9 @@ class Yellow_Toolbox
// Check if location is valid
static function isValidLocation($location)
{
- $string = "/";
+ $string = "";
$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;
}
diff --git a/system/core/core_commandline.php b/system/core/core_commandline.php
@@ -54,12 +54,9 @@ class Yellow_Commandline
{
if($this->yellow->config->isExisting("serverName") && $this->yellow->config->isExisting("serverBase"))
{
- $this->yellow->toolbox->timerStart($time);
$serverName = $this->yellow->config->get("serverName");
$serverBase = $this->yellow->config->get("serverBase");
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 {
list($statusCode, $contentCount, $mediaCount, $errorCount) = array(500, 0, 0, 1);
$fileName = $this->yellow->config->get("configDir").$this->yellow->config->get("configFile");
@@ -77,6 +74,7 @@ class Yellow_Commandline
// Build static files
function buildStatic($serverName, $serverBase, $location, $path)
{
+ $this->yellow->toolbox->timerStart($time);
$statusCodeMax = $errorCount = 0;
if(empty($location))
{
@@ -109,6 +107,8 @@ class Yellow_Commandline
}
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);
}
@@ -123,7 +123,7 @@ class Yellow_Commandline
$statusCode = $this->yellow->request();
if($statusCode != 404)
{
- $ok = true;
+ $ok = false;
$modified = strtotime($this->yellow->page->getHeader("Last-Modified"));
if(preg_match("/^(\w+)\/(\w+)/", $this->yellow->page->getHeader("Content-Type"), $matches))
{