commit 52a9db7a44f2376b578f040698c0eb7e1a0ba900
parent 06c837bdae11872c46de224bcccf2b3ef25ba3ea
Author: markseu <mark2011@mayberg.se>
Date: Mon, 2 Feb 2015 14:39:53 +0100
Core update (better response handling)
Diffstat:
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/README.md b/README.md
@@ -1,4 +1,4 @@
-Yellow 0.4.24
+Yellow 0.4.25
=============
[](https://gitter.im/markseu/yellowcms)
diff --git a/system/core/core.php b/system/core/core.php
@@ -5,7 +5,7 @@
// Yellow main class
class Yellow
{
- const Version = "0.4.24";
+ const Version = "0.4.25";
var $page; //current page
var $pages; //pages from file system
var $config; //configuration
@@ -185,14 +185,6 @@ class Yellow
$statusCode = 304;
$this->page->clean($statusCode);
}
- if($statusCode==200 && $this->getRequestHandler()=="core" && $this->page->isExisting("redirect"))
- {
- $statusCode = 301;
- $location = $this->toolbox->normaliseLocation($this->page->get("redirect"), $this->page->base, $this->page->location);
- $locationHeader = $this->toolbox->getLocationHeader($this->page->serverScheme, $this->page->serverName, "", $location);
- $this->page->clean($statusCode, $locationHeader);
- $this->page->setHeader("Cache-Control", "no-cache, must-revalidate");
- }
if($this->page->isExisting("pageClean")) ob_clean();
if(PHP_SAPI != "cli")
{
@@ -586,10 +578,18 @@ class YellowPage
{
$this->error(500, "Parser '".$this->get("parser")."' does not exist!");
}
- if(!$this->yellow->toolbox->isValidContentType($this->getHeader("Content-Type"), $this->getLocation()))
+ if($this->statusCode==200 && $this->yellow->getRequestHandler()=="core" &&
+ !$this->yellow->toolbox->isValidContentType($this->getHeader("Content-Type"), $this->getLocation()))
{
$this->error(500, "Type '".$this->getHeader("Content-Type")."' does not match file name!");
}
+ if($this->statusCode==200 && $this->yellow->getRequestHandler()=="core" && $this->isExisting("redirect"))
+ {
+ $location = $this->yellow->toolbox->normaliseLocation($this->get("redirect"), $this->base, $this->location);
+ $locationHeader = $this->yellow->toolbox->getLocationHeader($this->serverScheme, $this->serverName, "", $location);
+ $this->clean(301, $locationHeader);
+ $this->setHeader("Cache-Control", "no-cache, must-revalidate");
+ }
}
// Set page response header