openrat-cms

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

commit e779e681c90d66cea84274c1c1b9cb84d857beb1
parent fe95f5b51fb075881840db0eeb4bfdac77b94c68
Author: Jan Dankert <devnull@localhost>
Date:   Wed, 29 Aug 2018 01:33:22 +0200

Aufgeräumt: Die RenderParams werden zu beginn erzeugt und werden in den Dispatcher und die Action reingereicht. Dadurch entfällt das Durchreichen von Action/Method.

Diffstat:
index.php | 9++++++++-
modules/cms-api/API.class.php | 9+++------
modules/cms-core/Dispatcher.class.php | 84++++++++++++++++++++++++++++++++++++-------------------------------------------
modules/cms-core/action/Action.class.php | 37+++++--------------------------------
modules/cms-core/action/FilebrowserAction.class.php | 1-
modules/cms-core/action/ObjectAction.class.php | 10+---------
modules/cms-core/action/PageelementAction.class.php | 34----------------------------------
modules/cms-core/action/RequestParams.class.php | 17+++++++++++++++++
modules/cms-ui/UI.class.php | 111+++++++++++++++++++++++++++++--------------------------------------------------
modules/cms-ui/action/IndexAction.class.php | 2+-
modules/template-engine/components/html/Component.class.php | 11+++++++++--
modules/template-engine/components/html/form/Form.class.php | 12+++++++++---
modules/template-engine/components/html/link/Link.class.php | 6+++++-
modules/template-engine/engine/TemplateEngine.class.php | 10++++++----
modules/util/GlobalFunctions.class.php | 32--------------------------------
modules/util/Html.class.php | 50--------------------------------------------------
modules/util/Http.class.php | 6++++++
modules/wikiparser/parser/WikiParser.class.php | 1-
modules/wikiparser/renderer/fpdf.php | 2+-
19 files changed, 150 insertions(+), 294 deletions(-)

diff --git a/index.php b/index.php @@ -21,7 +21,14 @@ if (!headers_sent()) <style type="text/css">/*! normalize.css v5.0.0 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,footer,header,nav,section{display:block}h1{font-size:2em;margin:.67em 0}figcaption,figure,main{display:block}figure{margin:1em 40px}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent;-webkit-text-decoration-skip:objects}a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:inherit}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}dfn{font-style:italic}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}audio,video{display:inline-block}audio:not([controls]){display:none;height:0}img{border-style:none}svg:not(:root){overflow:hidden}button,input,optgroup,select,textarea{font-family:sans-serif;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{display:inline-block;vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details,menu{display:block}summary{display:list-item}canvas{display:inline-block}template{display:none}[hidden]{display:none}/*! Simple HttpErrorPages | MIT X11 License | https://github.com/AndiDittrich/HttpErrorPages */body,html{width:100%;height:100%;background-color:#21232a}body{color:#fff;text-align:center;text-shadow:0 2px 4px rgba(0,0,0,.5);padding:0;min-height:100%;-webkit-box-shadow:inset 0 0 100px rgba(0,0,0,.8);box-shadow:inset 0 0 100px rgba(0,0,0,.8);display:table;font-family:"Open Sans",Arial,sans-serif}h1{font-family:inherit;font-weight:500;line-height:1.1;color:inherit;font-size:36px}h1 small{font-size:68%;font-weight:400;line-height:1;color:#777}a{text-decoration:none;color:#fff;font-size:inherit;border-bottom:dotted 1px #707070}.lead{color:silver;font-size:21px;line-height:1.4}.cover{display:table-cell;vertical-align:middle;padding:0 20px}footer{position:fixed;width:100%;height:40px;left:0;bottom:0;color:#a0a0a0;font-size:14px}</style> </head> <body> -<div class="cover"><h1>Ooooh, sorry. Our service is currently unavailable... <small>Server Error 500</small></h1><p class="lead"><?php echo $e->getMessage() ?><br/></p></div> +<div class="cover"><h1>Ooooh, sorry. Our service is currently unavailable... <small>Server Error 500</small></h1><p class="lead"><?php echo $e->getMessage() ?><br/></p> + + <p> + <code> + <?php echo $e->__toString(); ?> + </code> + </p> +</div> </body> </html><?php diff --git a/modules/cms-api/API.class.php b/modules/cms-api/API.class.php @@ -3,6 +3,7 @@ namespace cms_api; use BadMethodCallException; +use cms\action\RequestParams; use cms\Dispatcher; use Exception; use JSON; @@ -27,16 +28,12 @@ class API */ public static function execute() { - $data = array(); - try { - $action = $_REQUEST[CMS_API_REQ_PARAM_ACTION]; - $subaction = $_REQUEST[CMS_API_REQ_PARAM_SUBACTION]; + $request = new RequestParams(); $dispatcher = new Dispatcher(); - $dispatcher->action = $action; - $dispatcher->subaction = $subaction; + $dispatcher->request = $request; $data = $dispatcher->doAction(); diff --git a/modules/cms-core/Dispatcher.class.php b/modules/cms-core/Dispatcher.class.php @@ -7,6 +7,7 @@ namespace cms; use BadMethodCallException; use cms\action\Action; +use cms\action\RequestParams; use ConfigurationLoader; use DomainException; use Http; @@ -19,9 +20,6 @@ use OpenRatException; use SecurityException; use Session; -$conf = array(); -$SESS = array(); -$FILES = array(); /** * Dispatcher for all cms actions. @@ -30,33 +28,28 @@ $FILES = array(); */ class Dispatcher { - public $action; - public $subaction; - - public $isAction; - public $isEmbedded = false; + /** + * @var RequestParams + */ + public $request; /** + * Vollständige Abarbeitug einer Aktion. + * Führt die gesamte Abarbeitung einer Aktion durch, incl. Datenbank-Transaktionssteuerung. + * * @return array data for the client */ public function doAction() { - define('PRODUCTION', Conf()->is('production')); - define('DEVELOPMENT', !PRODUCTION); - - // Start the session. All classes should have been loaded up to now. session_start(); - global $SESS; - $SESS = &$_SESSION; - - global $FILES; - $FILES = &$_FILES; - $this->checkConfiguration(); - header('Content-Language: ' . config('language','language_code') ); + define('PRODUCTION', Conf()->is('production')); + define('DEVELOPMENT', !PRODUCTION); + + $this->setContentLanguageHeader(); // Vorhandene Konfiguration aus der Sitzung lesen. global $conf; @@ -78,9 +71,6 @@ class Dispatcher define('FILE_SEP', $conf['interface']['file_separator']); - // Is this a POST request? - $this->isAction = $_SERVER['REQUEST_METHOD'] == 'POST'; - $this->connectToDatabase(); $this->startDatabaseTransaction(); @@ -271,7 +261,7 @@ class Dispatcher public function callActionMethod() { global $REQ; - $actionClassName = ucfirst($this->action) . 'Action'; + $actionClassName = ucfirst($this->request->action) . 'Action'; $actionClassNameWithNamespace = 'cms\\action\\' . $actionClassName; if (!class_exists($actionClassNameWithNamespace)) @@ -280,17 +270,14 @@ class Dispatcher $success = include_once(__DIR__. '/action/' . $actionClassName . '.class.php'); if ( !$success) - throw new LogicException("Action '$this->action' is not available"); + throw new LogicException("Action '$this->request->action' is not available"); } // Erzeugen der Action-Klasse /* @type $do \cms\action\Action */ $do = new $actionClassNameWithNamespace; - $do->actionClassName = $actionClassName; - $do->actionName = $this->action; - $do->subActionName = $this->subaction; - $do->isEmbedded = $this->isEmbedded; + $do->request = $this->request; if(!defined('OR_ID')) if (isset($REQ[REQ_PARAM_ID])) @@ -302,20 +289,17 @@ class Dispatcher $this->checkAccess($do); - if ($this->isAction) { - // POST-Request => ...Post() wird aufgerufen. - $subactionMethodName = $this->subaction . 'Post'; - } else { - // GET-Request => ...View() wird aufgerufen. - $subactionMethodName = $this->subaction . 'View'; - - // Daten werden nur angezeigt, die Sitzung kann also schon geschlossen werden. - // Halt! In Index-Action können Benutzer-Logins gesetzt werden. - if ( $this->action != 'index' ) - Session::close(); - } + // POST-Request => ...Post() wird aufgerufen. + // GET-Request => ...View() wird aufgerufen. + $methodSuffix = $this->request->isAction ? 'Post' : 'View'; + $subactionMethodName = $this->request->method . $methodSuffix; + + // Daten werden nur angezeigt, die Sitzung kann also schon geschlossen werden. + // Halt! In Index-Action können Benutzer-Logins gesetzt werden. + if ( ! $this->request->isAction && $this->request->action != 'index' ) + Session::close(); - Logger::debug("Executing {$this->action}/{$this->subaction}/" . @$REQ[REQ_PARAM_ID].' embed='.$this->isEmbedded); + Logger::debug("Executing {$this->request->action}/{$this->request->method}/" . @$REQ[REQ_PARAM_ID].' embed='.$this->request->isEmbedded); if (!method_exists($do, $subactionMethodName)) throw new BadMethodCallException("Method '$subactionMethodName' does not exist"); @@ -329,8 +313,7 @@ class Dispatcher } // The action is able to change its method name. - $this->subaction = $do->subActionName; - $this->action = $do->actionName; + $this->request = $do->request; $result = $do->getOutputData(); @@ -368,7 +351,7 @@ class Dispatcher if (is_object($db)) { // Transactions are only needed for POST-Request // GET-Request do only read from the database and have no need for transactions. - if ( $this->isAction ) + if ( $this->request->isAction ) $db->start(); } @@ -381,7 +364,7 @@ class Dispatcher if (is_object($db)) // Transactions were only started for POST-Request - if($this->isAction) + if($this->request->isAction) $db->commit(); } @@ -393,7 +376,16 @@ class Dispatcher if (is_object($db)) // Transactions were only started for POST-Request - if($this->isAction) + if($this->request->isAction) $db->rollback(); } + + + /** + * Sets the "Content-Language"-HTTP-Header with the user language. + */ + private function setContentLanguageHeader() + { + header('Content-Language: ' . Conf()->subset('language')->get('language_code') ); + } } \ No newline at end of file diff --git a/modules/cms-core/action/Action.class.php b/modules/cms-core/action/Action.class.php @@ -38,22 +38,13 @@ namespace cms\action { */ class Action { - public $db; - public $actionName; - public $subActionName; - public $actionClassName; - public $writable; - - public $publishing; - public $refresh; - - public $security = SECURITY_USER; + public $security = SECURITY_USER; // Default. protected $templateVars = Array(); /** * Aktuell angemeldeter Benutzer.<br> - * Wird in der Funktion "init()" gesetzt. + * Wird im Konstruktor gesetzt. * * @var Object Benutzer */ @@ -62,19 +53,7 @@ namespace cms\action { /** * @var RequestParams */ - protected $request; - - /** - * Handelt es sich um einen Embedded-View? - * @var Boolean - */ - public $isEmbedded; - - /** - * Zeitpunkt letzte Änderung. - * @var integer - */ - private $lastModified; + public $request; protected function setStyle($style) @@ -91,18 +70,14 @@ namespace cms\action { public function __construct() { - $this->request = new RequestParams(); + $this->request = new RequestParams(); - $this->writable = !config('security','readonly'); - $this->publishing = !config('security','nopublish'); $this->currentUser = Session::getUser(); $this->templateVars['errors'] = array(); $this->templateVars['notices'] = array(); $this->templateVars['control'] = array(); $this->templateVars['output'] = array(); - - $this->refresh = false; } /** @@ -308,8 +283,6 @@ namespace cms\action { */ protected function nextSubAction($subActionName) { - $this->subActionName = $subActionName; - Logger::trace("next subaction is '$subActionName'"); $methodName = $subActionName . ($_SERVER['REQUEST_METHOD'] == 'POST' ? 'Post' : 'View'); @@ -370,7 +343,7 @@ namespace cms\action { */ protected function lastModified($time, $expirationDuration = 0) { - if ( $this->isEmbedded || $this->isEmbedded == null ) + if ( $this->request->isEmbedded ) return; // Embedded-Views können keine HTTP-Header setzen, daher ist alles weitere überflüssig. // Conditional-Get eingeschaltet? diff --git a/modules/cms-core/action/FilebrowserAction.class.php b/modules/cms-core/action/FilebrowserAction.class.php @@ -230,7 +230,6 @@ class FilebrowserAction extends ObjectAction if ( !$upload->isValid() ) { - Html::debug($upload); $this->addValidationError('file','COMMON_VALIDATION_ERROR',array(),$upload->error); return; } diff --git a/modules/cms-core/action/ObjectAction.class.php b/modules/cms-core/action/ObjectAction.class.php @@ -57,9 +57,6 @@ class ObjectAction extends Action public function copyView() { - $this->actionName = 'object'; - global $conf_php; - $sourceObject = new BaseObject( $this->getRequestId()); $sourceObject->load(); @@ -326,7 +323,6 @@ class ObjectAction extends Action */ function rightsView() { - $this->actionName = 'object'; $o = new BaseObject( $this->getRequestId() ); $o->objectLoadRaw(); $this->setTemplateVar( 'show',$o->getRelatedAclTypes() ); @@ -366,8 +362,6 @@ class ObjectAction extends Action */ function inheritView() { - $this->actionName = 'object'; - $o = new BaseObject( $this->getRequestId() ); $o->objectLoadRaw(); $this->setTemplateVar( 'type',$o->getType() ); @@ -448,8 +442,6 @@ class ObjectAction extends Action */ function aclformView() { - $this->actionName = 'object'; - $o = new BaseObject( $this->getRequestId() ); $o->objectLoadRaw(); @@ -466,7 +458,7 @@ class ObjectAction extends Action $languages += $project->getLanguages(); $this->setTemplateVar('languages',$languages ); $this->setTemplateVar('objectid' ,$o->objectid ); - $this->setTemplateVar('action' ,$this->actionName); + $this->setTemplateVar('action' ,$this->request->action); } diff --git a/modules/cms-core/action/PageelementAction.class.php b/modules/cms-core/action/PageelementAction.class.php @@ -1406,40 +1406,6 @@ class PageelementAction extends Action - /** - * Men�eintr�ge aktivieren/deaktivieren. - * - * @param String $name - * @return boolean - */ - function checkMenu( $name ) - { - $type = $this->element->type; - - switch( $name ) - { - case 'edit': - case 'prop': - return true; - - case 'archive': - // Archiv ist nur verf�gbar, wenn es mind. 1 Version des Inhaltes gibt. - - if ( $this->subActionName!='diff' && is_object($this->value) ) - return $this->value->getCountVersions() > 0; - else - return true; - - case 'link': - // Verkn�pfung zu anderen Seiten ist nur m�glich f�r - // Datum, Text, Textabsatz, Ganzzahl. - return in_array($type,array('date','text','longtext','number')); - - default: - return false; - } - } - function linkifyOIDs( $text ) { diff --git a/modules/cms-core/action/RequestParams.class.php b/modules/cms-core/action/RequestParams.class.php @@ -37,12 +37,23 @@ namespace cms\action { class RequestParams { + public $action; + public $method; + public $isEmbedded; + + public $isAction; /** * RequestParams constructor. */ public function __construct() { + $this->action = @$_REQUEST[REQ_PARAM_ACTION]; + $this->method = @$_REQUEST[REQ_PARAM_SUBACTION]; + $this->isEmbedded = @$_REQUEST[REQ_PARAM_EMBED]=='1'; + + // Is this a POST request? + $this->isAction = @$_SERVER['REQUEST_METHOD'] == 'POST'; } /** @@ -54,6 +65,12 @@ namespace cms\action { */ public function getRequestVar($varName, $transcode = OR_FILTER_FULL) { + if($varName == REQ_PARAM_ACTION) + return $this->action; + + if($varName == REQ_PARAM_SUBACTION) + return $this->method; + global $REQ; if (!isset($REQ[$varName])) diff --git a/modules/cms-ui/UI.class.php b/modules/cms-ui/UI.class.php @@ -3,6 +3,7 @@ namespace cms_ui; use BadMethodCallException; +use cms\action\RequestParams; use cms\Dispatcher; use DomainException; use Exception; @@ -27,6 +28,9 @@ class UI */ public static function execute() { + $request = new RequestParams(); + $request->isEmbedded = false; + try { define('COOKIE_PATH',dirname($_SERVER['SCRIPT_NAME'])); @@ -43,53 +47,39 @@ class UI if($isPost) { - $action = $_REQUEST[CMS_UI_REQ_PARAM_ACTION]; - $subaction = $_REQUEST[CMS_UI_REQ_PARAM_SUBACTION]; - $dispatcher = new Dispatcher(); - $dispatcher->action = $action; - if(!defined('OR_ACTION')) - define('OR_ACTION', $action); - - $dispatcher->subaction = $subaction; - if(!defined('OR_METHOD')) - define('OR_METHOD', $subaction); - // Embedded Actions are ALWAYS Queries (means: GET). - $dispatcher->isAction = true; - $dispatcher->isEmbedded = true; + $request->isAction = true; + $dispatcher->request = $request; $data = $dispatcher->doAction(); //$data['notices']; // POST-Action has ended, now we want to show the UI. - $action = 'index'; - $subaction = 'show'; - UI::executeEmbeddedAction($action,$subaction); + $request->action = 'index'; + $request->method = 'show'; + $request->isEmbedded = true; + UI::executeAction($request); } else { - $action = 'index'; - $subaction = 'show'; - UI::executeAction($action,$subaction); + $request->action = 'index'; + $request->method = 'show'; + UI::executeAction($request); } } else { - if (!empty($_REQUEST[CMS_UI_REQ_PARAM_ACTION])) - $action = $_REQUEST[CMS_UI_REQ_PARAM_ACTION]; - else - $action = 'index'; + if (empty($request->action)) + $request->action = 'index'; - if (!empty($_REQUEST[CMS_UI_REQ_PARAM_SUBACTION])) - $subaction = $_REQUEST[CMS_UI_REQ_PARAM_SUBACTION]; - else { - $subaction = 'show'; - } - UI::executeAction($action,$subaction); + if (empty($request->method)) + $request->method = 'show'; + + UI::executeAction($request); } } catch (BadMethodCallException $e) { @@ -114,8 +104,17 @@ class UI */ public static function executeEmbedded($action, $subaction) { + $request = new RequestParams(); + + $request->isEmbedded = true; + $request->action = $action; + $request->method = $subaction; + + // Embedded Actions are ALWAYS Queries (means: GET). + $request->isAction = false; + try { - UI::executeEmbeddedAction($action,$subaction); + UI::executeAction($request); } catch (BadMethodCallException $e) { // Action-Method does not exist. @@ -135,69 +134,41 @@ class UI } } - private static function executeAction( $action, $subaction,$isPost=false ) - { - $dispatcher = new Dispatcher(); - - $dispatcher->action = $action; - if(!defined('OR_ACTION')) - define('OR_ACTION', $action); - - $dispatcher->subaction = $subaction; - if(!defined('OR_METHOD')) - define('OR_METHOD', $subaction); - - - $data = $dispatcher->doAction(); - $dispatcher->isAction = $isPost; - // The action is able to change its method and action name. - $subaction = $dispatcher->subaction; - $action = $dispatcher->action; - - $tplName = $action . '/' . $subaction; - UI::outputTemplate($tplName,$data['output']); - } - - private static function executeEmbeddedAction( $action, $subaction,$isPost=false ) + private static function executeAction($request) { $dispatcher = new Dispatcher(); + $dispatcher->request = $request; - $dispatcher->action = $action; - if(!defined('OR_ACTION')) - define('OR_ACTION', $action); - - $dispatcher->subaction = $subaction; - if(!defined('OR_METHOD')) - define('OR_METHOD', $subaction); + if ( $request->isEmbedded ) + $data = $dispatcher->callActionMethod(); + else + $data = $dispatcher->doAction(); - // Embedded Actions are ALWAYS Queries (means: GET). - $dispatcher->isAction = $isPost; - $dispatcher->isEmbedded = true; - - $data = $dispatcher->callActionMethod(); // The action is able to change its method and action name. - $subaction = $dispatcher->subaction; - $action = $dispatcher->action; + $subaction = $dispatcher->request->method; + $action = $dispatcher->request->action; $tplName = $action . '/' . $subaction; - UI::outputTemplate($tplName,$data['output']); + UI::outputTemplate($request,$tplName, $data['output']); } + /** * Executes and outputs a HTML template. * * @param $templateName string Name of template * @param $outputData array Output data */ - private static function outputTemplate($templateName, $outputData) + private static function outputTemplate($request, $templateName, $outputData) { $templateFile = __DIR__.'/themes/default/html/views/' . $templateName . '.tpl.src.xml'; $engine = new TemplateEngine(); + $engine->request = $request; $engine->executeTemplate( $templateFile, $outputData ); } diff --git a/modules/cms-ui/action/IndexAction.class.php b/modules/cms-ui/action/IndexAction.class.php @@ -80,7 +80,7 @@ class IndexAction extends Action // Gewünschten Dialog direkt öffnen. if($this->hasRequestVar('dialogMethod') ) - $this->setTemplateVar(array('dialogAction'=>$this->actionName,'dialogMethod'=>$this->getRequestVar('dialogMethod'))); + $this->setTemplateVar(array('dialogAction'=>$this->request->action,'dialogMethod'=>$this->getRequestVar('dialogMethod'))); // Is a user logged in? if ( !is_object($user) ) diff --git a/modules/template-engine/components/html/Component.class.php b/modules/template-engine/components/html/Component.class.php @@ -2,12 +2,19 @@ namespace template_engine\components; +use cms\action\RequestParams; + abstract class Component { private $depth; - - public function getDepth() + + /** + * @var RequestParams + */ + public $request; + + public function getDepth() { return $this->depth; } diff --git a/modules/template-engine/components/html/form/Form.class.php b/modules/template-engine/components/html/form/Form.class.php @@ -9,9 +9,9 @@ class FormComponent extends Component public $name = ''; - public $action = '<?php echo OR_ACTION ?>'; + public $action = null; - public $subaction = '<?php echo OR_METHOD ?>'; + public $subaction = null; public $id = '<?php echo OR_ID ?>'; @@ -46,7 +46,13 @@ class FormComponent extends Component if ($this->type == 'upload') $this->submitFunction = ''; - + + // Default: Target is the actual action/method-pair. + if(empty($this->action)) + $this->action = $this->request->action; + if(empty($this->subaction)) + $this->subaction = $this->request->method; + echo '<form'; echo ' name="' . $this->htmlvalue($this->name) . '"'; diff --git a/modules/template-engine/components/html/link/Link.class.php b/modules/template-engine/components/html/link/Link.class.php @@ -125,7 +125,7 @@ class LinkComponent extends Component if (! empty($this->action)) echo $this->htmlvalue($this->action); else - echo "<?php echo OR_ACTION ?>"; + echo $this->htmlvalue($this->request->action); echo "&quot;,"; echo "&quot;subaction&quot;:&quot;"; @@ -187,6 +187,10 @@ class LinkComponent extends Component if (! empty($this->var4)) $vars[$this->var4] = $this->value4; if (! empty($this->var5)) $vars[$this->var5] = $this->value5; + // Bei Dialogen kann der Dialog auch beim Öffnen in einem neuen Fenster direkt geöffnet werden. + if ( $this->type=='dialog') + $vars += array('dialogAction'=>$this->action,'dialogMethod'=>$this->subaction); + return $vars; } } diff --git a/modules/template-engine/engine/TemplateEngine.class.php b/modules/template-engine/engine/TemplateEngine.class.php @@ -20,8 +20,9 @@ class TemplateEngine public $renderType = 'html'; public $config = array(); - - /** + public $request; + + /** * Erzeugt einen Templateparser. */ public function __construct() @@ -35,7 +36,7 @@ class TemplateEngine * @param $srcXmlFilename string Filename of template source * @param $tplOutName string Filename of template code */ - public function compile($srcXmlFilename = '',$tplOutName = '') + public function compile($srcXmlFilename, $tplOutName ) { // Imports the base class of all component types. require_once (dirname(__FILE__).'/../components/'.$this->renderType.'/Component.class.' . PHP_EXT); @@ -99,7 +100,8 @@ class TemplateEngine $className = 'template_engine\components\\'.$className .'Component'; /* @var $component Component */ $component = new $className(); - $component->setDepth($depth); + $component->setDepth($depth); + $component->request = $this->request; foreach ($attributes as $prop => $value) { diff --git a/modules/util/GlobalFunctions.class.php b/modules/util/GlobalFunctions.class.php @@ -34,38 +34,6 @@ class GlobalFunctions } - # Spracheinstellungen laden - - public static function language_from_http() - { - global $SESS, - $HTTP_SERVER_VARS, - $conf_php, - $conf; - - $languages = $HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE']; - $languages = explode(',',$languages); - foreach( $languages as $l ) - { - $l = substr($l,0,2); - if ( file_exists("./language/$l.ini.$conf_php") ) - return( $l ); - } - - // Keine passende Sprache im HTTP-Header gefunden - return $conf['global']['default_language']; - } - - - public static function language_read( $l='' ) - { - global $SESS, - $HTTP_SERVER_VARS, - $conf_php; - - $l = language_from_http(); - $SESS['lang'] = parse_ini_file( "./language/$l.ini.$conf_php" ); - } } ?> \ No newline at end of file diff --git a/modules/util/Html.class.php b/modules/util/Html.class.php @@ -26,28 +26,8 @@ */ class Html { - public static function error( $field ) - { - global $inputErrors; - if ( isset($inputErrors[$field]) ) - return '<span class="error">'.lang($inputErrors[$field]).'</span'; - } - - - - /** - * Ausgabe eines Variablenwertes.<br> - */ - public static function debug( $wert, $text='' ) - { - echo "<strong>DEBUG: $text (".gettype($wert).")</strong><br/>"; - echo "<pre>"; - print_r($wert); - echo "</pre>"; - } - /** * Erzeugt eine relative Url innerhalb von Openrat * @@ -144,35 +124,5 @@ class Html return $src; } - - - - public static function complete_tag($tagname,$attributes) - { - $text = '<'.$tagname; - foreach( $attributes as $attribute_name=>$attribute_value ) - if ( !empty($attribute_value) ) - $text .= ' '.$attribute_name.'="'.$attribute_value.'"'; - $text .= ' />'; - return $text; - } - - - - public static function open_tag($tagname,$attributes) - { - $text = '<'.$tagname; - foreach( $attributes as $attribute_name=>$attribute_value ) - if ( !empty($attribute_value) ) - $text .= ' '.$attribute_name.'="'.$attribute_value.'"'; - $text .= '>'; - return $text; - } - - - public static function close_tag($tagname) - { - return '</'.$tagname.'>'; - } } ?> \ No newline at end of file diff --git a/modules/util/Http.class.php b/modules/util/Http.class.php @@ -542,6 +542,12 @@ class Http <body> <div class="cover"><h1>Ooooh, sorry. This service is currently unavailable... <small>$text $status</small></h1><p class="lead">$message</p></div> + <p> + <code> + <?php echo $reason; ?> + </code> + </p> + </body> </html><?php diff --git a/modules/wikiparser/parser/WikiParser.class.php b/modules/wikiparser/parser/WikiParser.class.php @@ -305,7 +305,6 @@ class WikiParser continue; } - Html::debug($dieseZeile,"Unbekannte Zeile"); die( 'unknown line: '.$dieseZeile ); } diff --git a/modules/wikiparser/renderer/fpdf.php b/modules/wikiparser/renderer/fpdf.php @@ -72,7 +72,7 @@ class FPDF * Public methods * * * *******************************************************************************/ - function FPDF($orientation='P', $unit='mm', $format='A4') + function __construct($orientation='P', $unit='mm', $format='A4') { //Some checks $this->_dochecks();