commit 093a35df3fcf3bd7a9afd748e72ab82954b6bc6a
parent c8bfea86d07e24e1a6d59373cb669fb5c70ed411
Author: Jan Dankert <devnull@localhost>
Date: Wed, 4 Jul 2018 01:11:10 +0200
Der Dispatcher muss wissen, ob eine Aktion als Embedded geladen wird.
Diffstat:
2 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/modules/cms-core/Dispatcher.class.php b/modules/cms-core/Dispatcher.class.php
@@ -34,6 +34,7 @@ class Dispatcher
public $subaction;
public $isAction;
+ public $isEmbedded = false;
/**
* @return array data for the client
@@ -55,10 +56,13 @@ class Dispatcher
$this->checkConfiguration();
+ header('Content-Language: ' . config('language','language_code') );
+
// Vorhandene Konfiguration aus der Sitzung lesen.
global $conf;
$conf = Session::getConfig();
+
// Nachdem die Konfiguration gelesen wurde, kann nun der Logger benutzt werden.
require_once(OR_MODULES_DIR . "logger/require." . PHP_EXT);
$this->initializeLogger();
@@ -284,8 +288,9 @@ class Dispatcher
$do = new $actionClassNameWithNamespace;
$do->actionClassName = $actionClassName;
- $do->actionName = $this->action;
- $do->subActionName = $this->subaction;
+ $do->actionName = $this->action;
+ $do->subActionName = $this->subaction;
+ $do->isEmbedded = $this->isEmbedded;
if(!defined('OR_ID'))
if (isset($REQ[REQ_PARAM_ID]))
@@ -303,11 +308,14 @@ class Dispatcher
} else {
// GET-Request => ...View() wird aufgerufen.
$subactionMethodName = $this->subaction . 'View';
+
// Daten werden nur angezeigt, die Sitzung kann also schon geschlossen werden.
- Session::close();
+ // Halt! In Index-Action können Benutzer-Logins gesetzt werden.
+ if ( $this->action != 'index' )
+ Session::close();
}
- Logger::debug("Executing {$this->action}/{$this->subaction}/" . @$REQ[REQ_PARAM_ID]);
+ Logger::debug("Executing {$this->action}/{$this->subaction}/" . @$REQ[REQ_PARAM_ID].' embed='.$this->isEmbedded);
if (!method_exists($do, $subactionMethodName))
throw new BadMethodCallException("Method '$subactionMethodName' does not exist");
diff --git a/modules/cms-core/action/Action.class.php b/modules/cms-core/action/Action.class.php
@@ -62,6 +62,18 @@ namespace cms\action {
*/
protected $request;
+ /**
+ * Handelt es sich um einen Embedded-View?
+ * @var Boolean
+ */
+ public $isEmbedded;
+
+ /**
+ * Zeitpunkt letzte Änderung.
+ * @var integer
+ */
+ private $lastModified;
+
protected function setStyle($style)
{
@@ -88,9 +100,6 @@ namespace cms\action {
$this->templateVars['control'] = array();
$this->templateVars['output'] = array();
- if(!headers_sent())
- header('Content-Language: ' . config('language','language_code') );
-
$this->refresh = false;
}
@@ -356,7 +365,8 @@ namespace cms\action {
*/
protected function lastModified($time, $expirationDuration = 0)
{
- $user = Session::getUser();
+ if ( $this->isEmbedded || $this->isEmbedded == null )
+ return; // Embedded-Views können keine HTTP-Header setzen, daher ist alles weitere überflüssig.
// Conditional-Get eingeschaltet?
if (!config('cache', 'conditional_get'))