openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 69cb7c554c1c1159dc78029fdab4acfe0b506dd1
parent 56d69ba830a10b05985ac2216a6fe6058eadba58
Author: Jan Dankert <devnull@localhost>
Date:   Fri,  9 Feb 2018 00:48:31 +0100

Die LanguageId und ModelId an alle Actions durchreichen. Diese sollen nicht mehr aus der Sitzung geladen werden, da nun in unterschiedlichen Tabs auch Objekte mit unterschiedlichen Model/Languages angezeigt werden können.

Diffstat:
modules/cms-core/action/Action.class.php | 112+++++++++++++++++--------------------------------------------------------------
modules/cms-core/action/ConfigurationAction.class.php | 1+
modules/cms-core/action/ElementAction.class.php | 4+++-
modules/cms-core/action/FileAction.class.php | 4+++-
modules/cms-core/action/FolderAction.class.php | 1+
modules/cms-core/action/GroupAction.class.php | 2++
modules/cms-core/action/GrouplistAction.class.php | 1+
modules/cms-core/action/ImageAction.class.php | 2++
modules/cms-core/action/LanguageAction.class.php | 2++
modules/cms-core/action/LanguagelistAction.class.php | 2++
modules/cms-core/action/LinkAction.class.php | 2++
modules/cms-core/action/LoginAction.class.php | 5+++++
modules/cms-core/action/ModelAction.class.php | 2++
modules/cms-core/action/ModellistAction.class.php | 4+++-
modules/cms-core/action/ObjectAction.class.php | 8+++++++-
modules/cms-core/action/PageAction.class.php | 26+++++++++++++++++---------
modules/cms-core/action/PageelementAction.class.php | 10++++++++--
modules/cms-core/action/ProfileAction.class.php | 4+++-
modules/cms-core/action/ProjectAction.class.php | 2++
modules/cms-core/action/ProjectlistAction.class.php | 1+
modules/cms-core/action/RequestParams.class.php | 170+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
modules/cms-core/action/SearchAction.class.php | 1+
modules/cms-core/action/TemplateAction.class.php | 4+++-
modules/cms-core/action/TemplatelistAction.class.php | 1+
modules/cms-core/action/TextAction.class.php | 2++
modules/cms-core/action/TreeAction.class.php | 7++++++-
modules/cms-core/action/UrlAction.class.php | 2++
modules/cms-core/action/UserAction.class.php | 2++
modules/cms-core/action/UserlistAction.class.php | 1+
modules/cms-core/action/WebdavAction.class.php | 4+++-
modules/cms-core/init.php | 13-------------
modules/cms-core/model/Language.class.php | 4----
modules/cms-core/model/Object.class.php | 13-------------
modules/cms-core/model/Page.class.php | 25++++++++++++++++++-------
modules/cms-core/model/Value.class.php | 4----
modules/cms-core/require.php | 1+
modules/util/AdministrationTree.class.php | 16++++++++++------
modules/util/Transformer.class.php | 10+++++++---
modules/wikiparser/renderer/HtmlRenderer.class.php | 3++-
39 files changed, 320 insertions(+), 158 deletions(-)

diff --git a/modules/cms-core/action/Action.class.php b/modules/cms-core/action/Action.class.php @@ -11,17 +11,6 @@ namespace { define('OR_NOTICE_WARN', 'warning'); define('OR_NOTICE_ERROR', 'error'); - define('OR_FILTER_ALPHA', 'abc'); - define('OR_FILTER_ALPHANUM', 'abc123'); - define('OR_FILTER_FILENAME', 'file'); - define('OR_FILTER_MAIL', 'mail'); - define('OR_FILTER_TEXT', 'text'); - define('OR_FILTER_FULL', 'full'); - define('OR_FILTER_NUMBER', '123'); - define('OR_FILTER_RAW', 'raw'); - define('OR_FILTER_ALL', 'all'); - - } @@ -68,6 +57,11 @@ namespace cms\action { */ var $currentUser; + /** + * @var RequestParams + */ + protected $request; + protected function setStyle($style) { @@ -81,16 +75,12 @@ namespace cms\action { } - /** - * Wird durch das Controller-Skript (do.php) nach der Kontruierung des Objektes aufgerufen. - * So koennen Unterklassen ihren eigenen Kontruktor besitzen, ohne den Superkontruktor - * (=diese Funktion) aufrufen zu m�ssen. - */ - public function init() + public function __construct() { - global $conf; - $this->writable = !$conf['security']['readonly']; - $this->publishing = !$conf['security']['nopublish']; + $this->request = new RequestParams(); + + $this->writable = !config('security','readonly'); + $this->publishing = !config('security','nopublish'); $this->currentUser = Session::getUser(); $this->templateVars['errors'] = array(); @@ -99,11 +89,21 @@ namespace cms\action { $this->templateVars['output'] = array(); if(!headers_sent()) - header('Content-Language: ' . $conf['language']['language_code']); + header('Content-Language: ' . config('language','language_code') ); $this->refresh = false; } + /** + * Wird durch das Controller-Skript (do.php) nach der Kontruierung des Objektes aufgerufen. + * So koennen Unterklassen ihren eigenen Kontruktor besitzen, ohne den Superkontruktor + * (=diese Funktion) aufrufen zu m�ssen. + */ + public function init() + { + + } + /** * Liest eine Session-Variable @@ -145,66 +145,7 @@ namespace cms\action { */ protected function getRequestVar($varName, $transcode = OR_FILTER_FULL) { - global $REQ; - - if (!isset($REQ[$varName])) - return ''; - - - switch ($transcode) { - case OR_FILTER_ALPHA: - $white = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; - break; - - case OR_FILTER_ALPHANUM: - $white = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,_-!?%&/()'; - break; - - case OR_FILTER_FILENAME: - // RFC 1738, Section 2.2: - // Thus, only alphanumerics, the special characters "$-_.+!*'(),", and - // reserved characters used for their reserved purposes may be used - // unencoded within a URL. - $white = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789$-_.+!*(),' . "'"; - break; - - case OR_FILTER_MAIL: - $white = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-@'; - break; - - case OR_FILTER_TEXT: - case OR_FILTER_FULL: - case OR_FILTER_ALL: - // Ausfiltern von Control-Chars ( ASCII < 32 außer CR,LF) und HTML (<,>) - $white = ''; - $white .= chr(10) . chr(13); // Line-Feed, Carriage-Return - for ($i = 32; $i <= 59; $i++) $white .= chr($i); // Zahlen - // 60: '<' - $white .= chr(61); - // 62: '>' - for ($i = 63; $i <= 126; $i++) $white .= chr($i); // abc - for ($i = 128; $i <= 255; $i++) $white .= chr($i); // Sonderzeichen incl. UTF-8, UTF-16 (beginnen mit Bit 1) - break; - - case OR_FILTER_NUMBER: - $white = '1234567890.'; - break; - - case OR_FILTER_RAW: - return $REQ[$varName]; - - default: - throw new \LogicException('Unknown request filter', 'not found: ' . $transcode); - return '?'; - } - - $value = $REQ[$varName]; - $newValue = Text::clean($value, $white); - - if (strlen($newValue) != strlen($value)) - $this->addNotice('', '', 'UNEXPECTED_CHARS', OR_NOTICE_WARN); - - return $newValue; + return $this->request->getRequestVar($varName,$transcode); } @@ -217,9 +158,7 @@ namespace cms\action { */ protected function hasRequestVar($varName) { - global $REQ; - - return (isset($REQ[$varName]) && (!empty($REQ[$varName]) || $REQ[$varName] == '0')); + return $this->request->hasRequestVar($varName); } @@ -231,10 +170,7 @@ namespace cms\action { */ protected function getRequestId() { - if ($this->hasRequestVar('idvar')) - return intval($this->getRequestVar($this->getRequestVar('idvar'))); - else - return intval($this->getRequestVar(REQ_PARAM_ID)); + return $this->request->getRequestId(); } diff --git a/modules/cms-core/action/ConfigurationAction.class.php b/modules/cms-core/action/ConfigurationAction.class.php @@ -34,6 +34,7 @@ class ConfigurationAction extends Action */ function __construct() { + parent::__construct(); } diff --git a/modules/cms-core/action/ElementAction.class.php b/modules/cms-core/action/ElementAction.class.php @@ -45,7 +45,9 @@ class ElementAction extends Action */ function __construct() { - if ( $this->getRequestId() == 0 ) + parent::__construct(); + + if ( $this->getRequestId() == 0 ) die('no element-id available'); $this->element = new Element( $this->getRequestId() ); diff --git a/modules/cms-core/action/FileAction.class.php b/modules/cms-core/action/FileAction.class.php @@ -45,7 +45,9 @@ class FileAction extends ObjectAction * Konstruktor */ function __construct() - { + { + parent::__construct(); + $this->file = new File( $this->getRequestId() ); $this->file->load(); } diff --git a/modules/cms-core/action/FolderAction.class.php b/modules/cms-core/action/FolderAction.class.php @@ -51,6 +51,7 @@ class FolderAction extends ObjectAction public function __construct() { + parent::__construct(); $this->folder = new Folder( $this->getRequestId() ); $this->folder->languageid = $this->getRequestVar('languageid'); $this->folder->load(); diff --git a/modules/cms-core/action/GroupAction.class.php b/modules/cms-core/action/GroupAction.class.php @@ -45,6 +45,8 @@ class GroupAction extends Action function __construct() { + parent::__construct(); + $this->group = new Group( $this->getRequestId() ); $this->group->load(); $this->setTemplateVar( 'groupid',$this->group->groupid ); diff --git a/modules/cms-core/action/GrouplistAction.class.php b/modules/cms-core/action/GrouplistAction.class.php @@ -35,6 +35,7 @@ class GrouplistAction extends Action function __construct() { + parent::__construct(); } diff --git a/modules/cms-core/action/ImageAction.class.php b/modules/cms-core/action/ImageAction.class.php @@ -29,6 +29,8 @@ class ImageAction extends FileAction */ public function __construct() { + parent::__construct(); + $this->image = new Image( $this->getRequestId() ); $this->image->load(); diff --git a/modules/cms-core/action/LanguageAction.class.php b/modules/cms-core/action/LanguageAction.class.php @@ -48,6 +48,8 @@ class LanguageAction extends Action */ function __construct() { + parent::__construct(); + $this->language = new Language( $this->getRequestId() ); $this->language->load(); diff --git a/modules/cms-core/action/LanguagelistAction.class.php b/modules/cms-core/action/LanguagelistAction.class.php @@ -43,6 +43,8 @@ class LanguagelistAction extends Action */ function __construct() { + parent::__construct(); + $this->project = Session::getProject(); } diff --git a/modules/cms-core/action/LinkAction.class.php b/modules/cms-core/action/LinkAction.class.php @@ -46,6 +46,8 @@ class LinkAction extends ObjectAction */ function __construct() { + parent::__construct(); + $this->link = new Link( $this->getRequestId() ); $this->link->load(); } diff --git a/modules/cms-core/action/LoginAction.class.php b/modules/cms-core/action/LoginAction.class.php @@ -61,6 +61,11 @@ class LoginAction extends Action public $security = SECURITY_GUEST; + public function __construct() + { + parent::__construct(); + } + /** * Eine Datenbankverbindugn wird aufgebaut und initalisiert. * diff --git a/modules/cms-core/action/ModelAction.class.php b/modules/cms-core/action/ModelAction.class.php @@ -43,6 +43,8 @@ class ModelAction extends Action function __construct() { + parent::__construct(); + $this->model = new Model( $this->getRequestId() ); $this->model->load(); diff --git a/modules/cms-core/action/ModellistAction.class.php b/modules/cms-core/action/ModellistAction.class.php @@ -43,7 +43,9 @@ class ModellistAction extends Action function __construct() { - if ( $this->getRequestId() != 0 ) + parent::__construct(); + + if ( $this->getRequestId() != 0 ) { $this->model = new Model( $this->getRequestId() ); $this->model->load(); diff --git a/modules/cms-core/action/ObjectAction.class.php b/modules/cms-core/action/ObjectAction.class.php @@ -39,11 +39,17 @@ use cms\model\Link; class ObjectAction extends Action { + public $security = SECURITY_USER; private $objectid; - public function copyView() + public function __construct() + { + parent::__construct(); + } + + public function copyView() { $this->actionName = 'object'; global $conf_php; diff --git a/modules/cms-core/action/PageAction.class.php b/modules/cms-core/action/PageAction.class.php @@ -34,14 +34,22 @@ class PageAction extends ObjectAction function __construct() { + parent::__construct(); + $this->page = new Page( $this->getRequestId() ); + + if ( $this->request->hasLanguageId()) + $this->page->languageid = $this->request->getLanguageId(); + if ( $this->request->hasModelId()) + $this->page->modelid = $this->request->getModelId(); + $this->page->load(); // Hier kann leider nicht das Datum der letzten Änderung verwendet werden, // da sich die Seite auch danach ändern kann, z.B. durch Includes anderer // Seiten oder Änderung einer Vorlage oder Änderung des Dateinamens einer // verlinkten Datei. - //$this->lastModified( time() ); + $this->lastModified( time() ); } @@ -335,7 +343,7 @@ class PageAction extends ObjectAction if ( $this->userIsAdmin() ) { - $this->setTemplateVar('template_url',Html::url('main','template',$this->page->templateid)); + $this->setTemplateVar('template_url',Html::url('main','template',$this->page->templateid,array(REQ_PARAM_MODEL_ID=>$this->page->modelid))); } $template = new Template( $this->page->templateid ); @@ -385,7 +393,7 @@ class PageAction extends ObjectAction if ( $this->userIsAdmin() ) { - $this->setTemplateVar('template_url',Html::url('main','template',$this->page->templateid)); + $this->setTemplateVar('template_url',Html::url('main','template',$this->page->templateid,array(REQ_PARAM_MODEL_ID=>$this->page->modelid))); } $template = new Template( $this->page->templateid ); @@ -512,7 +520,7 @@ class PageAction extends ObjectAction } } - $this->setTemplateVar('preview_url',Html::url('page','show',$this->page->objectid,array('withIcons'=>'1') ) ); + $this->setTemplateVar('preview_url',Html::url('page','show',$this->page->objectid,array('withIcons'=>'1',REQ_PARAM_LANGUAGE_ID=>$this->page->languageid,REQ_PARAM_MODEL_ID=>$this->page->modelid) ) ); $this->setTemplateVar('properties',$this->page->getProperties() ); $this->setTemplateVar('el',$list); } @@ -622,7 +630,7 @@ class PageAction extends ObjectAction */ function previewView() { - $this->setTemplateVar('preview_url',Html::url('page','show',$this->page->objectid ) ); + $this->setTemplateVar('preview_url',Html::url('page','show',$this->page->objectid,array(REQ_PARAM_LANGUAGE_ID=>$this->page->languageid,REQ_PARAM_MODEL_ID=>$this->page->modelid) ) ); } /** @@ -641,15 +649,15 @@ class PageAction extends ObjectAction $this->page->load(); $this->page->generate(); - $this->page->write(); header('Content-Type: '.$this->page->mimeType().'; charset=UTF-8' ); // HTTP-Header mit Sprachinformation setzen. - $language = Session::getProjectLanguage(); + $language = new Language( $this->page->languageid); + $language->load(); header('Content-Language: '.$language->isoCode); - Logger::debug("preview page: ".$this->page->tmpfile() ); + Logger::debug("Preview page: ".$this->page->__toString() ); // Wenn if ( ( config('publish','enable_php_in_page_content')=='auto' && $this->page->template->extension == 'php') || @@ -708,7 +716,7 @@ class PageAction extends ObjectAction if ( $this->userIsAdmin() ) { - $this->setTemplateVar('template_url',Html::url('main','template',$this->page->templateid)); + $this->setTemplateVar('template_url',Html::url('main','template',$this->page->templateid,array(REQ_PARAM_MODEL_ID=>$this->page->modelid))); } $template = new Template( $this->page->templateid ); diff --git a/modules/cms-core/action/PageelementAction.class.php b/modules/cms-core/action/PageelementAction.class.php @@ -73,7 +73,9 @@ class PageelementAction extends Action */ function __construct() { - $this->value = new Value(); + parent::__construct(); + + $this->value = new Value(); $id = $this->getRequestVar('id'); $ids = explode('_',$id); @@ -90,7 +92,11 @@ class PageelementAction extends Action if ( $pageid != 0 ) { $this->page = new Page( $pageid ); - $this->page->load(); + + if ( $this->hasRequestVar('languageid')) + $this->page->languageid = $this->getRequestVar('languageid',OR_FILTER_NUMBER); + + $this->page->load(); } if ( $elementid != 0 ) diff --git a/modules/cms-core/action/ProfileAction.class.php b/modules/cms-core/action/ProfileAction.class.php @@ -46,7 +46,9 @@ class ProfileAction extends Action */ function __construct() { - $this->user = Session::getUser(); + parent::__construct(); + + $this->user = Session::getUser(); } diff --git a/modules/cms-core/action/ProjectAction.class.php b/modules/cms-core/action/ProjectAction.class.php @@ -39,6 +39,8 @@ class ProjectAction extends Action function __construct() { + parent::__construct(); + $this->project = new Project( $this->getRequestId() ); $this->project->load(); } diff --git a/modules/cms-core/action/ProjectlistAction.class.php b/modules/cms-core/action/ProjectlistAction.class.php @@ -34,6 +34,7 @@ class ProjectlistAction extends Action function __construct() { + parent::__construct(); } diff --git a/modules/cms-core/action/RequestParams.class.php b/modules/cms-core/action/RequestParams.class.php @@ -0,0 +1,169 @@ +<?php + +namespace { + + /* Request Parameter Names */ + define('REQ_PARAM_TOKEN' ,'token' ); + define('REQ_PARAM_ACTION' ,'action' ); + define('REQ_PARAM_SUBACTION' ,'subaction' ); + define('REQ_PARAM_TARGETSUBACTION','targetSubAction'); + define('REQ_PARAM_ID' ,'id' ); + define('REQ_PARAM_OBJECT_ID' ,'objectid' ); + define('REQ_PARAM_LANGUAGE_ID' ,'languageid' ); + define('REQ_PARAM_MODEL_ID' ,'modelid' ); + define('REQ_PARAM_PROJECT_ID' ,'projectid' ); + define('REQ_PARAM_ELEMENT_ID' ,'elementid' ); + define('REQ_PARAM_TEMPLATE_ID' ,'templateid' ); + define('REQ_PARAM_DATABASE_ID' ,'dbid' ); + define('REQ_PARAM_TARGET' ,'target' ); + + /* Filter Types */ + define('OR_FILTER_ALPHA', 'abc'); + define('OR_FILTER_ALPHANUM', 'abc123'); + define('OR_FILTER_FILENAME', 'file'); + define('OR_FILTER_MAIL', 'mail'); + define('OR_FILTER_TEXT', 'text'); + define('OR_FILTER_FULL', 'full'); + define('OR_FILTER_NUMBER', '123'); + define('OR_FILTER_RAW', 'raw'); + define('OR_FILTER_ALL', 'all'); +} + + +namespace cms\action { + + use Text; + + class RequestParams + { + + /** + * RequestParams constructor. + */ + public function __construct() + { + } + + /** + * Ermittelt den Inhalt der gew�nschten Request-Variablen. + * Falls nicht vorhanden, wird "" zur�ckgegeben. + * + * @param String $varName Schl�ssel + * @return String Inhalt + */ + public function getRequestVar($varName, $transcode = OR_FILTER_FULL) + { + global $REQ; + + if (!isset($REQ[$varName])) + return ''; + + + switch ($transcode) { + case OR_FILTER_ALPHA: + $white = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; + break; + + case OR_FILTER_ALPHANUM: + $white = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,_-!?%&/()'; + break; + + case OR_FILTER_FILENAME: + // RFC 1738, Section 2.2: + // Thus, only alphanumerics, the special characters "$-_.+!*'(),", and + // reserved characters used for their reserved purposes may be used + // unencoded within a URL. + $white = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789$-_.+!*(),' . "'"; + break; + + case OR_FILTER_MAIL: + $white = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-@'; + break; + + case OR_FILTER_TEXT: + case OR_FILTER_FULL: + case OR_FILTER_ALL: + // Ausfiltern von Control-Chars ( ASCII < 32 außer CR,LF) und HTML (<,>) + $white = ''; + $white .= chr(10) . chr(13); // Line-Feed, Carriage-Return + for ($i = 32; $i <= 59; $i++) $white .= chr($i); // Zahlen + // 60: '<' + $white .= chr(61); + // 62: '>' + for ($i = 63; $i <= 126; $i++) $white .= chr($i); // abc + for ($i = 128; $i <= 255; $i++) $white .= chr($i); // Sonderzeichen incl. UTF-8, UTF-16 (beginnen mit Bit 1) + break; + + case OR_FILTER_NUMBER: + $white = '1234567890.'; + break; + + case OR_FILTER_RAW: + return $REQ[$varName]; + + default: + throw new \LogicException('Unknown request filter', 'not found: ' . $transcode); + return '?'; + } + + $value = $REQ[$varName]; + $newValue = Text::clean($value, $white); + +// if (strlen($newValue) != strlen($value)) +// $this->addNotice('', '', 'UNEXPECTED_CHARS', OR_NOTICE_WARN); + + return $newValue; + } + + + /** + * Ermittelt, ob der aktuelle Request eine Variable mit dem + * angegebenen Namen enth�lt. + * + * @param String $varName Schl�ssel + * @return boolean true, falls vorhanden. + */ + public function hasRequestVar($varName) + { + global $REQ; + + return (isset($REQ[$varName]) && (!empty($REQ[$varName]) || $REQ[$varName] == '0')); + } + + + /** + * Ermittelt die aktuelle Id aus dem Request.<br> + * Um welche ID es sich handelt, ist abh�ngig von der Action. + * + * @return Integer + */ + public function getRequestId() + { + if ($this->hasRequestVar('idvar')) + return intval($this->getRequestVar($this->getRequestVar('idvar'))); + else + return intval($this->getRequestVar(REQ_PARAM_ID)); + } + + + public function hasLanguageId() + { + return $this->hasRequestVar(REQ_PARAM_LANGUAGE_ID); + } + + public function getLanguageId() + { + return $this->getRequestVar(REQ_PARAM_LANGUAGE_ID,OR_FILTER_NUMBER); + } + + public function hasModelId() + { + return $this->hasRequestVar(REQ_PARAM_MODEL_ID); + } + + public function getModelId() + { + return $this->getRequestVar(REQ_PARAM_MODEL_ID,OR_FILTER_NUMBER); + } + } +}+ \ No newline at end of file diff --git a/modules/cms-core/action/SearchAction.class.php b/modules/cms-core/action/SearchAction.class.php @@ -57,6 +57,7 @@ class SearchAction extends Action */ function __construct() { + parent::__construct(); } diff --git a/modules/cms-core/action/TemplateAction.class.php b/modules/cms-core/action/TemplateAction.class.php @@ -48,6 +48,8 @@ class TemplateAction extends Action function __construct() { + parent::__construct(); + $this->template = new Template( $this->getRequestId() ); $this->template->load(); $this->setTemplateVar( 'templateid',$this->template->templateid ); @@ -306,7 +308,7 @@ class TemplateAction extends Action */ function showView() { - header('Content-Type: '.$this->template->mimeType().'; charset='.$this->getCharset() ); + header('Content-Type: '.$this->template->mimeType().'; charset=UTF-8' ); $text = $this->template->src; foreach( $this->template->getElementIds() as $elid ) diff --git a/modules/cms-core/action/TemplatelistAction.class.php b/modules/cms-core/action/TemplatelistAction.class.php @@ -36,6 +36,7 @@ class TemplatelistAction extends Action function __construct() { + parent::__construct(); } diff --git a/modules/cms-core/action/TextAction.class.php b/modules/cms-core/action/TextAction.class.php @@ -45,6 +45,8 @@ class TextAction extends FileAction */ function __construct() { + parent::__construct(); + $this->text = new Text( $this->getRequestId() ); $this->text->load(); diff --git a/modules/cms-core/action/TreeAction.class.php b/modules/cms-core/action/TreeAction.class.php @@ -45,7 +45,12 @@ class TreeAction extends Action var $tree; - /** + public function __construct() + { + parent::__construct(); + } + + /** * ?ffnen aller Baumelemente */ function openall() diff --git a/modules/cms-core/action/UrlAction.class.php b/modules/cms-core/action/UrlAction.class.php @@ -47,6 +47,8 @@ class UrlAction extends ObjectAction */ function __construct() { + parent::__construct(); + $this->url = new Url( $this->getRequestId() ); $this->url->load(); } diff --git a/modules/cms-core/action/UserAction.class.php b/modules/cms-core/action/UserAction.class.php @@ -55,6 +55,8 @@ class UserAction extends Action */ function __construct() { + parent::__construct(); + $this->user = new User( $this->getRequestId() ); $this->user->load(); $this->setTemplateVar('userid',$this->user->userid); diff --git a/modules/cms-core/action/UserlistAction.class.php b/modules/cms-core/action/UserlistAction.class.php @@ -34,6 +34,7 @@ class UserlistAction extends Action function __construct() { + parent::__construct(); } diff --git a/modules/cms-core/action/WebdavAction.class.php b/modules/cms-core/action/WebdavAction.class.php @@ -68,7 +68,9 @@ class WebdavAction extends Action */ function __construct() { - if (!defined('E_STRICT')) + parent::__construct(); + + if (!defined('E_STRICT')) define('E_STRICT', 2048); // Nicht notwendig, da wir den Error-Handler umbiegen: diff --git a/modules/cms-core/init.php b/modules/cms-core/init.php @@ -53,19 +53,6 @@ define('SECURITY_GUEST',1); // Jeder (auch nicht angemeldete) dürfen diese Akti define('SECURITY_USER' ,2); // Angemeldete Benutzer dürfen diese Aktion ausführen define('SECURITY_ADMIN',3); // Nur Administratoren dürfen diese Aktion ausführen -define('REQ_PARAM_TOKEN' ,'token' ); -define('REQ_PARAM_ACTION' ,'action' ); -define('REQ_PARAM_SUBACTION' ,'subaction' ); -define('REQ_PARAM_TARGETSUBACTION','targetSubAction'); -define('REQ_PARAM_ID' ,'id' ); -define('REQ_PARAM_OBJECT_ID' ,'objectid' ); -define('REQ_PARAM_LANGUAGE_ID' ,'languageid' ); -define('REQ_PARAM_MODEL_ID' ,'modelid' ); -define('REQ_PARAM_PROJECT_ID' ,'projectid' ); -define('REQ_PARAM_ELEMENT_ID' ,'elementid' ); -define('REQ_PARAM_TEMPLATE_ID' ,'templateid' ); -define('REQ_PARAM_DATABASE_ID' ,'dbid' ); -define('REQ_PARAM_TARGET' ,'target' ); /** diff --git a/modules/cms-core/model/Language.class.php b/modules/cms-core/model/Language.class.php @@ -39,12 +39,8 @@ class Language // Konstruktor function __construct( $languageid='' ) { - global $SESS; - if ( is_numeric($languageid) ) $this->languageid = $languageid; - -// $this->projectid = $SESS['projectid']; } diff --git a/modules/cms-core/model/Object.class.php b/modules/cms-core/model/Object.class.php @@ -182,19 +182,6 @@ namespace cms\model { $this->objectid = $objectid; $this->id = $objectid; } - - - $language = \Session::getProjectLanguage(); - if ( is_object($language) ) - $this->languageid = $language->languageid; - - $model = \Session::getProjectModel(); - if ( is_object($model) ) - $this->modelid = $model->modelid; - - $project = \Session::getProject(); - if ( is_object($project) ) - $this->projectid = $project->projectid; } diff --git a/modules/cms-core/model/Page.class.php b/modules/cms-core/model/Page.class.php @@ -67,6 +67,11 @@ class Page extends Object public $values; + /** + * Inhalt der Seite. + */ + public $value; + function __construct( $objectid='' ) { @@ -156,7 +161,10 @@ class Page extends Object if ( ! Object::available( $objectid) ) return ''; - $param = array('oid'=>'__OID__'.$objectid.'__'); + $param = array( + 'oid' => '__OID__'.$objectid.'__', + REQ_PARAM_MODEL_ID => $this->modelid , + REQ_PARAM_LANGUAGE_ID => $this->languageid ); if ( $this->icons ) $param['withIcons'] = '1'; @@ -620,10 +628,8 @@ class Page extends Object /** * Erzeugen der Inhalte zu allen Elementen dieser Seite * wird von generate() aufgerufen - * - * @access private */ - function generate_elements() + public function generate_elements() { $this->values = array(); @@ -657,7 +663,7 @@ class Page extends Object * * @return String Inhalt */ - function generate() + public function generate() { global $conf; @@ -754,7 +760,7 @@ class Page extends Object /** * Schreiben des Seiteninhaltes in die temporaere Datei */ - function write() + public function write() { if ( !is_file($this->tmpfile())) $this->generate(); @@ -764,7 +770,7 @@ class Page extends Object /** * Generieren dieser Seite in Dateisystem und/oder auf FTP-Server */ - function publish() + public function publish() { global $SESS; $db = db_connection(); @@ -880,6 +886,11 @@ class Page extends Object { return $this->mimeType()=='text/html'; } + + public function __toString() + { + return 'Id '.$this->pageid.' (filename='.$this->filename.',language='.$this->languageid.', modelid='.$this->modelid.', templateid='.$this->templateid.')'; + } } diff --git a/modules/cms-core/model/Value.class.php b/modules/cms-core/model/Value.class.php @@ -147,10 +147,6 @@ class Value { $this->lastchangeUserId = 0; $this->lastchangeTimeStamp = 0; - - $language = \Session::getProjectLanguage(); - if ( is_object($language) ) - $this->languageid = $language->languageid; } diff --git a/modules/cms-core/require.php b/modules/cms-core/require.php @@ -14,6 +14,7 @@ require_once(__DIR__ . '/../language/require.php'); require_once(__DIR__ . '/action/Action.class.php'); require_once(__DIR__ . '/action/ObjectAction.class.php'); require_once(__DIR__ . '/action/FileAction.class.php'); +require_once(__DIR__ . '/action/RequestParams.class.php'); // Internal packages require_once(__DIR__ . "/model/require.php"); diff --git a/modules/util/AdministrationTree.class.php b/modules/util/AdministrationTree.class.php @@ -182,6 +182,7 @@ class AdministrationTree extends AbstractTree $folder->load(); $defaultLanguageId = $project->getDefaultLanguageId(); + $defaultModelId = $project->getDefaultModelId(); // Ermitteln, ob der Benutzer Projektadministrator ist // Projektadministratoren haben das Recht, im Root-Ordner die Eigenschaften zu aendern. @@ -195,7 +196,8 @@ class AdministrationTree extends AbstractTree // $treeElement->text = $folder->name; $treeElement->text = lang('FOLDER_ROOT'); $treeElement->description = lang('FOLDER_ROOT_DESC'); - $treeElement->extraId['languageid'] = $defaultLanguageId; + $treeElement->extraId[REQ_PARAM_LANGUAGE_ID] = $defaultLanguageId; + $treeElement->extraId[REQ_PARAM_MODEL_ID ] = $defaultModelId; $treeElement->icon = 'folder'; $treeElement->action = 'folder'; // $treeElement->url = Html::url( 'folder','',$folder->objectid,array(REQ_PARAM_TARGET=>'content') ); @@ -611,7 +613,8 @@ class AdministrationTree extends AbstractTree function page( $id ) { $page = new Page( $id ); - $page->languageid = $_REQUEST['languageid']; + $page->languageid = $_REQUEST[REQ_PARAM_LANGUAGE_ID]; + $page->modelid = $_REQUEST[REQ_PARAM_MODEL_ID]; $page->load(); @@ -634,7 +637,7 @@ class AdministrationTree extends AbstractTree REQ_PARAM_TARGETSUBACTION=>'edit',REQ_PARAM_TARGET=>'content')); $treeElement->action = 'pageelement'; $treeElement->icon = 'el_'.$element->type; - $treeElement->extraId = array('languageid'=>$page->languageid); + $treeElement->extraId = array(REQ_PARAM_LANGUAGE_ID=>$page->languageid,REQ_PARAM_MODEL_ID=>$page->modelid); $treeElement->description = lang('EL_'.$element->type); @@ -723,7 +726,7 @@ class AdministrationTree extends AbstractTree $treeElement->url = Html::url($o->getType(),'',$o->objectid,array(REQ_PARAM_TARGET=>'content') ); $treeElement->action = $o->getType(); $treeElement->icon = $o->getType(); - $treeElement->extraId = array('languageid'=>$_REQUEST['languageid']); + $treeElement->extraId = array(REQ_PARAM_LANGUAGE_ID=>$_REQUEST[REQ_PARAM_LANGUAGE_ID],REQ_PARAM_MODEL_ID=>$_REQUEST[REQ_PARAM_MODEL_ID]); // Besonderheiten fuer bestimmte Objekttypen @@ -750,7 +753,8 @@ class AdministrationTree extends AbstractTree $f = new Folder( $id ); $t = time(); - $f->languageid = $_REQUEST['languageid']; + $f->languageid = $_REQUEST[REQ_PARAM_LANGUAGE_ID]; + $f->modelid = $_REQUEST[REQ_PARAM_MODEL_ID]; foreach( $f->getObjects() as $o ) { @@ -761,7 +765,7 @@ class AdministrationTree extends AbstractTree $treeElement = new TreeElement(); $treeElement->id = $o->objectid; $treeElement->internalId = $o->objectid; - $treeElement->extraId = array('languageid'=>$f->languageid); + $treeElement->extraId = array(REQ_PARAM_LANGUAGE_ID=>$f->languageid,REQ_PARAM_MODEL_ID=>$f->modelid); $treeElement->target = 'content'; $treeElement->text = $o->name; $treeElement->description= lang( 'GLOBAL_'.$o->getType() ).' '.$o->objectid; diff --git a/modules/util/Transformer.class.php b/modules/util/Transformer.class.php @@ -1,5 +1,9 @@ <?php +use cms\model\Link; +use cms\model\Object; +use cms\model\Url; + /** * Transformieren eines Textes.<br> * Ein Text wird geparst und neu gerendert. @@ -77,11 +81,11 @@ class Transformer try { $o->load(); - if ( $o->isLink ) + if ( $o->isUrl ) { - $l = new Link($objectId); + $l = new Url($objectId); $l->load(); - if ( $l->isLinkToUrl && $this->page->mimeType() == 'text/html' ) + if ( $this->page->mimeType() == 'text/html' ) $targetPath = htmlspecialchars($targetPath); } } diff --git a/modules/wikiparser/renderer/HtmlRenderer.class.php b/modules/wikiparser/renderer/HtmlRenderer.class.php @@ -1,6 +1,7 @@ <?php use cms\model\File; +use cms\model\Image; use cms\model\Object; /** @@ -327,7 +328,7 @@ class HtmlRenderer $attr['border'] = '0'; // Breite/H�he des Bildes bestimmen. - $image = new File( $child->objectId ); + $image = new Image( $child->objectId ); $image->load(); $attr['alt' ] = $image->name;