openrat-cms

OpenRat Content Management System
git clone http://git.code.weiherhei.de/openrat-cms.git
Log | Files | Refs | README

commit 24059fc3973fa68deadb6e437a1b6f914c024a47
parent 6fadcab27db6f635999b0ed7f904923544a6e080
Author: Jan Dankert <develop@jandankert.de>
Date:   Fri, 26 Feb 2021 01:06:01 +0100

Refactoring accessing the request parameter values.

Diffstat:
Mmodules/cms/Dispatcher.class.php | 8++++----
Mmodules/cms/action/Action.class.php | 73+++++--------------------------------------------------------------------
Mmodules/cms/action/AliasAction.class.php | 2+-
Mmodules/cms/action/ElementAction.class.php | 4++--
Mmodules/cms/action/FileAction.class.php | 4++--
Mmodules/cms/action/FolderAction.class.php | 2+-
Mmodules/cms/action/GroupAction.class.php | 2+-
Mmodules/cms/action/ImageAction.class.php | 2+-
Mmodules/cms/action/LanguageAction.class.php | 2+-
Mmodules/cms/action/LanguagelistAction.class.php | 2+-
Mmodules/cms/action/LinkAction.class.php | 2+-
Mmodules/cms/action/ModelAction.class.php | 2+-
Mmodules/cms/action/ModellistAction.class.php | 2+-
Mmodules/cms/action/ObjectAction.class.php | 2+-
Mmodules/cms/action/PageAction.class.php | 2+-
Mmodules/cms/action/PageelementAction.class.php | 84++++++++++++++++++++++++++++++++++++++-----------------------------------------
Mmodules/cms/action/ProjectAction.class.php | 2+-
Mmodules/cms/action/RequestParams.class.php | 163++++++++++++++++++++++++++++++++++++++++++++++---------------------------------
Mmodules/cms/action/TemplateAction.class.php | 6+++---
Mmodules/cms/action/TemplatelistAction.class.php | 2+-
Mmodules/cms/action/TextAction.class.php | 2+-
Mmodules/cms/action/UrlAction.class.php | 2+-
Mmodules/cms/action/UserAction.class.php | 2+-
Mmodules/cms/action/element/ElementAdvancedAction.class.php | 54+++++++++++++++++++++++++++---------------------------
Mmodules/cms/action/element/ElementPropAction.class.php | 10+++++-----
Mmodules/cms/action/element/ElementRemoveAction.class.php | 4++--
Mmodules/cms/action/file/FileAdvancedAction.class.php | 4++--
Mmodules/cms/action/file/FileCompressAction.class.php | 6+++---
Mmodules/cms/action/file/FileEditAction.class.php | 6+++---
Mmodules/cms/action/file/FileShowAction.class.php | 2+-
Mmodules/cms/action/file/FileUncompressAction.class.php | 4++--
Mmodules/cms/action/folder/FolderAdvancedAction.class.php | 18+++++++++---------
Mmodules/cms/action/folder/FolderCreatefileAction.class.php | 16++++++++--------
Mmodules/cms/action/folder/FolderCreatefolderAction.class.php | 4++--
Mmodules/cms/action/folder/FolderCreateimageAction.class.php | 12++++++------
Mmodules/cms/action/folder/FolderCreatelinkAction.class.php | 6+++---
Mmodules/cms/action/folder/FolderCreatepageAction.class.php | 8++++----
Mmodules/cms/action/folder/FolderCreatetextAction.class.php | 14+++++++-------
Mmodules/cms/action/folder/FolderCreateurlAction.class.php | 8++++----
Mmodules/cms/action/folder/FolderOrderAction.class.php | 2+-
Mmodules/cms/action/folder/FolderPubAction.class.php | 8++++----
Mmodules/cms/action/folder/FolderRemoveAction.class.php | 2+-
Mmodules/cms/action/group/GroupMembershipsAction.class.php | 4++--
Mmodules/cms/action/group/GroupPropAction.class.php | 6+++---
Mmodules/cms/action/grouplist/GrouplistAddAction.class.php | 4++--
Mmodules/cms/action/image/ImageSizeAction.class.php | 20++++++++++----------
Mmodules/cms/action/language/LanguagePropAction.class.php | 10+++++-----
Mmodules/cms/action/language/LanguageRemoveAction.class.php | 2+-
Mmodules/cms/action/languagelist/LanguagelistAddAction.class.php | 2+-
Mmodules/cms/action/link/LinkValueAction.class.php | 2+-
Mmodules/cms/action/login/LoginLoginAction.class.php | 12++++++------
Mmodules/cms/action/login/LoginOidcAction.class.php | 4++--
Mmodules/cms/action/login/LoginPasswordAction.class.php | 6+++---
Mmodules/cms/action/login/LoginPasswordcodeAction.class.php | 6+++---
Mmodules/cms/action/login/LoginRegisterAction.class.php | 2+-
Mmodules/cms/action/login/LoginRegistercodeAction.class.php | 12++++++------
Mmodules/cms/action/model/ModelPropAction.class.php | 6+++---
Mmodules/cms/action/model/ModelRemoveAction.class.php | 2+-
Mmodules/cms/action/modellist/ModellistAddAction.class.php | 4++--
Mmodules/cms/action/object/ObjectAclformAction.class.php | 34+++++++++++++++++-----------------
Mmodules/cms/action/object/ObjectCopyAction.class.php | 10+++++-----
Mmodules/cms/action/object/ObjectDelaclAction.class.php | 2+-
Mmodules/cms/action/object/ObjectInheritAction.class.php | 6+++---
Mmodules/cms/action/object/ObjectNameAction.class.php | 10+++++-----
Mmodules/cms/action/object/ObjectPropAction.class.php | 12++++++------
Mmodules/cms/action/object/ObjectRightsAction.class.php | 2+-
Mmodules/cms/action/object/ObjectSettingsAction.class.php | 10+++++-----
Mmodules/cms/action/page/PageAllAction.class.php | 26+++++++++++++-------------
Mmodules/cms/action/page/PageChangetemplateselectelementsAction.class.php | 6+++---
Mmodules/cms/action/page/PageEditAction.class.php | 60++++++++++++++++++++++++++++++------------------------------
Mmodules/cms/action/page/PageFormAction.class.php | 8++++----
Mmodules/cms/action/page/PageNameAction.class.php | 8++++----
Mmodules/cms/action/pageelement/PageelementDiffAction.class.php | 4++--
Mmodules/cms/action/pageelement/PageelementReleaseAction.class.php | 2+-
Mmodules/cms/action/pageelement/PageelementRestoreAction.class.php | 2+-
Mmodules/cms/action/pageelement/PageelementValueAction.class.php | 2+-
Mmodules/cms/action/profile/ProfileAvailableAction.class.php | 2+-
Mmodules/cms/action/profile/ProfileConfirmmailAction.class.php | 2+-
Mmodules/cms/action/profile/ProfileEditAction.class.php | 18+++++++++---------
Mmodules/cms/action/profile/ProfileMailAction.class.php | 2+-
Mmodules/cms/action/profile/ProfilePwAction.class.php | 10+++++-----
Mmodules/cms/action/project/ProjectCopyAction.class.php | 4++--
Mmodules/cms/action/project/ProjectMaintenanceAction.class.php | 2+-
Mmodules/cms/action/project/ProjectPropAction.class.php | 24++++++++++++------------
Mmodules/cms/action/projectlist/ProjectlistAddAction.class.php | 4++--
Mmodules/cms/action/search/SearchQuicksearchAction.class.php | 2+-
Mmodules/cms/action/search/SearchResultAction.class.php | 14+++++++-------
Mmodules/cms/action/template/TemplateAddelAction.class.php | 6+++---
Mmodules/cms/action/template/TemplatePreviewAction.class.php | 2+-
Mmodules/cms/action/template/TemplatePropAction.class.php | 2+-
Mmodules/cms/action/template/TemplateShowAction.class.php | 2+-
Mmodules/cms/action/template/TemplateSrcAction.class.php | 8++++----
Mmodules/cms/action/template/TemplateSrcelementAction.class.php | 6+++---
Mmodules/cms/action/templatelist/TemplatelistAddAction.class.php | 10+++++-----
Mmodules/cms/action/text/TextValueAction.class.php | 2+-
Mmodules/cms/action/url/UrlValueAction.class.php | 2+-
Mmodules/cms/action/user/UserAddgrouptouserAction.class.php | 2+-
Mmodules/cms/action/user/UserMembershipsAction.class.php | 4++--
Mmodules/cms/action/user/UserPropAction.class.php | 24++++++++++++------------
Mmodules/cms/action/user/UserPwAction.class.php | 8++++----
Mmodules/cms/action/userlist/UserlistAddAction.class.php | 3+--
Mmodules/cms/ui/action/tree/TreeBranchAction.class.php | 6+++---
Mmodules/cms/ui/action/tree/TreePathAction.class.php | 4++--
103 files changed, 503 insertions(+), 542 deletions(-)

diff --git a/modules/cms/Dispatcher.class.php b/modules/cms/Dispatcher.class.php @@ -352,14 +352,14 @@ class Dispatcher if ( ! $this->request->isAction && $this->request->action != 'index' && $this->request->method != 'oidc' ) Session::close(); - Logger::debug("Dispatcher executing {$action}/{$method}/" . $this->request->getRequestId().' -> '.$actionClassName->get().'#'.$subactionMethodName.'()'); + Logger::debug("Dispatcher executing {$action}/{$method}/" . $this->request->getId().' -> '.$actionClassName->get().'#'.$subactionMethodName.'()'); try { $method = new \ReflectionMethod($do,$subactionMethodName); $params = []; foreach( $method->getParameters() as $parameter ) { - $params[ $parameter->getName() ] = $this->request->getRequiredRequestVar($parameter->getName(),RequestParams::FILTER_RAW); + $params[ $parameter->getName() ] = $this->request->getRequiredVar($parameter->getName(),RequestParams::FILTER_RAW); } $method->invokeArgs($do,$params); // <== Executing the Action @@ -404,8 +404,8 @@ class Dispatcher $possibleDbIds = []; - if ( $this->request->hasRequestVar('dbid') ) - $possibleDbIds[] = $this->request->getRequestAlphanum('dbid' ); + if ( $this->request->has('dbid') ) + $possibleDbIds[] = $this->request->getAlphanum('dbid' ); if ( Session::getDatabaseId() ) $possibleDbIds[] = Session::getDatabaseId(); diff --git a/modules/cms/action/Action.class.php b/modules/cms/action/Action.class.php @@ -44,14 +44,15 @@ class Action ]; /** - * Aktuell angemeldeter Benutzer.<br> - * Wird im Konstruktor gesetzt. + * Current user. * - * @var Object Benutzer + * @var User User */ - var $currentUser; + public $currentUser; /** + * Request + * * @var RequestParams */ public $request; @@ -71,70 +72,6 @@ class Action $this->currentUser = Session::getUser(); } - /** - * Liest eine Session-Variable - * - * @param String $varName Schl�ssel - * @return mixed - */ - protected function getSessionVar($varName) - { - return Session::get($varName); - } - - - /** - * Setzt eine Session-Variable - * - * @param string $varName Schluessel - * @param mixed $value Inhalt - * @return mixed - */ - protected function setSessionVar($varName, $value) - { - Session::set($varName,$value); - } - - - /** - * Ermittelt den Inhalt der gew�nschten Request-Variablen. - * Falls nicht vorhanden, wird "" zur�ckgegeben. - * - * @param String $varName Schl�ssel - * @return String Inhalt - */ - protected function getRequestVar($varName, $transcode = RequestParams::FILTER_TEXT) - { - return $this->request->getRequestVar($varName,$transcode); - } - - - /** - * Ermittelt, ob der aktuelle Request eine Variable mit dem - * angegebenen Namen enth�lt. - * - * @param String $varName Schl�ssel - * @return boolean true, falls vorhanden. - */ - protected function hasRequestVar($varName) - { - return $this->request->hasRequestVar($varName); - } - - - /** - * Ermittelt die aktuelle Id aus dem Request.<br> - * Um welche ID es sich handelt, ist abh�ngig von der Action. - * - * @return Integer - */ - protected function getRequestId( $name = null ) - { - if ( is_null($name) ) - return $this->request->getRequestId(); - else - return intval($this->request->getRequestVar($name,RequestParams::FILTER_NUMBER)); - } /** diff --git a/modules/cms/action/AliasAction.class.php b/modules/cms/action/AliasAction.class.php @@ -56,7 +56,7 @@ class AliasAction extends ObjectAction public function init() { - $this->alias = new Alias( $this->getRequestId() ); + $this->alias = new Alias( $this->request->getId() ); $this->alias->load(); parent::init(); diff --git a/modules/cms/action/ElementAction.class.php b/modules/cms/action/ElementAction.class.php @@ -42,10 +42,10 @@ class ElementAction extends BaseAction public function init() { - if ( $this->getRequestId() == 0 ) + if ( $this->request->getId() == 0 ) throw new \util\exception\ValidationException('no element-id available'); - $this->element = new Element( $this->getRequestId() ); + $this->element = new Element( $this->request->getId() ); $this->element->load(); $this->setTemplateVar( 'elementid' ,$this->element->elementid ); diff --git a/modules/cms/action/FileAction.class.php b/modules/cms/action/FileAction.class.php @@ -58,8 +58,8 @@ class FileAction extends ObjectAction public function init() { - $file = new File( $this->getRequestId() ); - $file->languageid = $this->getRequestVar(RequestParams::PARAM_LANGUAGE_ID); + $file = new File( $this->request->getId() ); + $file->languageid = $this->request->getLanguageId(); $file->load(); $this->setBaseObject( $file ); diff --git a/modules/cms/action/FolderAction.class.php b/modules/cms/action/FolderAction.class.php @@ -52,7 +52,7 @@ class FolderAction extends ObjectAction public function init() { - $folder = new Folder( $this->getRequestId() ); + $folder = new Folder( $this->request->getId() ); $folder->languageid = $this->request->getLanguageId(); // FIXME $folder->load(); diff --git a/modules/cms/action/GroupAction.class.php b/modules/cms/action/GroupAction.class.php @@ -52,7 +52,7 @@ class GroupAction extends BaseAction public function init() { - $this->group = new Group( $this->getRequestId() ); + $this->group = new Group( $this->request->getId() ); $this->group->load(); $this->setTemplateVar( 'groupid',$this->group->groupid ); } diff --git a/modules/cms/action/ImageAction.class.php b/modules/cms/action/ImageAction.class.php @@ -30,7 +30,7 @@ class ImageAction extends FileAction public function init() { - $image = new Image( $this->getRequestId() ); + $image = new Image( $this->request->getId() ); $image->load(); $this->setBaseObject( $image ); diff --git a/modules/cms/action/LanguageAction.class.php b/modules/cms/action/LanguageAction.class.php @@ -52,7 +52,7 @@ class LanguageAction extends BaseAction public function init() { - $this->language = new Language( $this->getRequestId() ); + $this->language = new Language( $this->request->getId() ); $this->language->load(); } diff --git a/modules/cms/action/LanguagelistAction.class.php b/modules/cms/action/LanguagelistAction.class.php @@ -56,6 +56,6 @@ class LanguagelistAction extends BaseAction public function init() { - $this->project = new Project( $this->request->getRequestId()); + $this->project = new Project( $this->request->getId()); } } \ No newline at end of file diff --git a/modules/cms/action/LinkAction.class.php b/modules/cms/action/LinkAction.class.php @@ -52,7 +52,7 @@ class LinkAction extends ObjectAction public function init() { - $link = new Link( $this->getRequestId() ); + $link = new Link( $this->request->getId() ); $link->load(); $this->setBaseObject( $link ); diff --git a/modules/cms/action/ModelAction.class.php b/modules/cms/action/ModelAction.class.php @@ -49,7 +49,7 @@ class ModelAction extends BaseAction public function init() { - $this->model = new Model( $this->getRequestId() ); + $this->model = new Model( $this->request->getId() ); $this->model->load(); } diff --git a/modules/cms/action/ModellistAction.class.php b/modules/cms/action/ModellistAction.class.php @@ -49,7 +49,7 @@ class ModellistAction extends BaseAction public function init() { - $this->project = new Project( $this->request->getRequestId()); + $this->project = new Project( $this->request->getId()); } diff --git a/modules/cms/action/ObjectAction.class.php b/modules/cms/action/ObjectAction.class.php @@ -45,7 +45,7 @@ class ObjectAction extends BaseAction public function init() { - $baseObject = new BaseObject( $this->getRequestId() ); + $baseObject = new BaseObject( $this->request->getId() ); $baseObject->objectLoad(); $this->setBaseObject( $baseObject ); diff --git a/modules/cms/action/PageAction.class.php b/modules/cms/action/PageAction.class.php @@ -49,7 +49,7 @@ class PageAction extends ObjectAction public function init() { - $page = new Page( $this->getRequestId() ); + $page = new Page( $this->request->getId() ); //$context = new PageContext(); //$context->sourceObjectId = $page->objectid; diff --git a/modules/cms/action/PageelementAction.class.php b/modules/cms/action/PageelementAction.class.php @@ -110,16 +110,16 @@ class PageelementAction extends BaseAction } else { - $pageid = $this->getRequestId(); - $elementid = $this->getRequestVar('elementid'); + $pageid = $this->request->getId(); + $elementid = $this->request->getText('elementid'); } if ( $pageid != 0 ) { $this->page = new Page( $pageid ); - if ( $this->hasRequestVar('languageid')) - $this->page->languageid = $this->getRequestId('languageid'); + if ( $this->request->has('languageid')) + $this->page->languageid = $this->request->getNumber('languageid'); $this->page->load(); } @@ -259,10 +259,6 @@ class PageelementAction extends BaseAction $this->setTemplateVar('objects' ,$objects); $this->setTemplateVar('linkobjectid',$this->value->linkToObjectId); - - if ( $this->getSessionVar('pageaction') != '' ) - $this->setTemplateVar('old_pageaction',$this->getSessionVar('pageaction')); - else $this->setTemplateVar('old_pageaction','show' ); } @@ -284,9 +280,9 @@ class PageelementAction extends BaseAction */ protected function editlongtext() { - if ( $this->hasRequestVar('format') ) + if ( $this->request->has('format') ) // Individual format from request. - $format = $this->getRequestId('format'); + $format = $this->request->getNumber('format'); elseif ( $this->value->format != null ) $format = $this->value->format; else @@ -324,17 +320,17 @@ class PageelementAction extends BaseAction $value->objectid = $this->page->objectid; $value->pageid = Page::getPageIdFromObjectId( $this->page->objectid ); - if ( !$this->hasRequestVar('elementid') ) + if ( !$this->request->has('elementid') ) throw new ValidationException('elementid'); - $value->element = new Element( $this->getRequestVar('elementid') ); + $value->element = new Element( $this->request->getText('elementid') ); $value->element->load(); $value->load(); - if ( $this->hasRequestVar('linkobjectid') ) - $value->linkToObjectId = $this->getRequestVar('linkobjectid'); + if ( $this->request->has('linkobjectid') ) + $value->linkToObjectId = $this->request->getText('linkobjectid'); else - $value->text = $this->getRequestVar('text','raw'); + $value->text = $this->request->getRaw('text'); $this->afterSave($value); } @@ -361,13 +357,13 @@ class PageelementAction extends BaseAction // Inhalt sofort freigegeben, wenn // - Recht vorhanden // - Freigabe gewuenscht - if ( $value->page->hasRight( Permission::ACL_RELEASE ) && $this->hasRequestVar('release') ) + if ( $value->page->hasRight( Permission::ACL_RELEASE ) && $this->request->has('release') ) $value->publish = true; else $value->publish = false; // Up-To-Date-Check - $lastChangeTime = $value->getLastChangeSinceByAnotherUser( $this->getRequestVar('value_time'), Session::getUser()->userid ); + $lastChangeTime = $value->getLastChangeSinceByAnotherUser( $this->request->getText('value_time'), Session::getUser()->userid ); if ( $lastChangeTime ) $this->addWarningFor( $this->value,Messages::CONCURRENT_VALUE_CHANGE, array('last_change_time'=>date(L::lang('DATE_FORMAT'),$lastChangeTime))); @@ -395,7 +391,7 @@ class PageelementAction extends BaseAction $this->page->setTimestamp(); // "Letzte Aenderung" setzen // Falls ausgewaehlt die Seite sofort veroeffentlichen - if ( $value->page->hasRight( Permission::ACL_PUBLISH ) && $this->hasRequestVar('publish') ) + if ( $value->page->hasRight( Permission::ACL_PUBLISH ) && $this->request->has('publish') ) { $this->publishPage(); } @@ -416,20 +412,20 @@ class PageelementAction extends BaseAction $value->pageid = Page::getPageIdFromObjectId( $this->page->objectid ); - if ( !$this->hasRequestVar('elementid') ) + if ( !$this->request->has('elementid') ) throw new ValidationException('elementid'); - $value->element = new Element( $this->getRequestVar('elementid') ); + $value->element = new Element( $this->request->getText('elementid') ); $value->element->load(); $value->load(); - if ( $this->hasRequestVar('format') ) - $value->format = $this->getRequestId('format'); + if ( $this->request->has('format') ) + $value->format = $this->request->getNumber('format'); else // Fallback: Format of the element. $value->format = $this->element->format; - $value->text = $this->compactOIDs( $this->getRequestVar('text','raw') ); + $value->text = $this->compactOIDs( $this->request->getRaw('text') ); $this->afterSave($value); @@ -449,17 +445,17 @@ class PageelementAction extends BaseAction $value->pageid = Page::getPageIdFromObjectId( $this->page->objectid ); $value->publisher = $this->page->publisher; - if ( !$this->hasRequestVar('elementid') ) + if ( !$this->request->has('elementid') ) throw new ValidationException('elementid'); - $value->element = new Element( $this->getRequestVar('elementid') ); + $value->element = new Element( $this->request->getText('elementid') ); $value->element->load(); $value->load(); - if ( $this->hasRequestVar('linkobjectid') ) - $value->linkToObjectId = $this->getRequestVar('linkobjectid'); + if ( $this->request->has('linkobjectid') ) + $value->linkToObjectId = $this->request->getText('linkobjectid'); else { - $value->date = strtotime( $this->getRequestVar( 'date' ).' '.$this->getRequestVar( 'time' ) ); + $value->date = strtotime( $this->request->getText( 'date' ).' '.$this->request->getText( 'time' ) ); } @@ -481,14 +477,14 @@ class PageelementAction extends BaseAction $value->pageid = Page::getPageIdFromObjectId( $this->page->objectid ); $value->publisher = $this->page->publisher; - if ( !$this->hasRequestVar('elementid') ) + if ( !$this->request->has('elementid') ) throw new ValidationException('elementid'); - $value->element = new Element( $this->getRequestVar('elementid') ); + $value->element = new Element( $this->request->getText('elementid') ); $value->element->load(); $value->load(); - $value->text = $this->getRequestVar('text'); + $value->text = $this->request->getText('text'); $this->afterSave($value); } @@ -508,17 +504,17 @@ class PageelementAction extends BaseAction $value->objectid = $this->page->objectid; $value->pageid = Page::getPageIdFromObjectId( $this->page->objectid ); - if ( !$this->hasRequestVar('elementid') ) + if ( !$this->request->has('elementid') ) throw new ValidationException('elementid'); - $value->element = new Element( $this->getRequestVar('elementid') ); + $value->element = new Element( $this->request->getText('elementid') ); $value->element->load(); $value->load(); - if ( $this->hasRequestVar('linkurl') ) - $value->linkToObjectId = $this->parseSimpleOID($this->getRequestVar('linkurl')); + if ( $this->request->has('linkurl') ) + $value->linkToObjectId = $this->parseSimpleOID($this->request->getText('linkurl')); else - $value->linkToObjectId = intval($this->getRequestVar('linkobjectid')); + $value->linkToObjectId = intval($this->request->getText('linkobjectid')); $this->afterSave($value); } @@ -550,14 +546,14 @@ class PageelementAction extends BaseAction $value->objectid = $this->page->objectid; $value->pageid = Page::getPageIdFromObjectId( $this->page->objectid ); - if ( !$this->hasRequestVar('elementid') ) + if ( !$this->request->has('elementid') ) throw new ValidationException('elementid'); - $value->element = new Element( $this->getRequestVar('elementid') ); + $value->element = new Element( $this->request->getText('elementid') ); $value->element->load(); $value->load(); - $value->linkToObjectId = intval($this->getRequestVar('linkobjectid')); + $value->linkToObjectId = intval($this->request->getText('linkobjectid')); $this->afterSave($value); } @@ -577,17 +573,17 @@ class PageelementAction extends BaseAction $value->objectid = $this->page->objectid; $value->pageid = Page::getPageIdFromObjectId( $this->page->objectid ); - if ( !$this->hasRequestVar('elementid') ) + if ( !$this->request->has('elementid') ) throw new ValidationException('elementid'); - $value->element = new Element( $this->getRequestVar('elementid') ); + $value->element = new Element( $this->request->getText('elementid') ); $value->element->load(); $value->load(); - if ( $this->hasRequestVar('linkobjectid') ) - $value->linkToObjectId = $this->getRequestVar('linkobjectid'); + if ( $this->request->has('linkobjectid') ) + $value->linkToObjectId = $this->request->getText('linkobjectid'); else - $value->number = $this->getRequestVar('number') * pow(10,$value->element->decimals); + $value->number = $this->request->getText('number') * pow(10,$value->element->decimals); $this->afterSave($value); } diff --git a/modules/cms/action/ProjectAction.class.php b/modules/cms/action/ProjectAction.class.php @@ -51,7 +51,7 @@ class ProjectAction extends BaseAction public function init() { - $this->project = new Project( $this->getRequestId() ); + $this->project = new Project( $this->request->getId() ); $this->project->load(); } diff --git a/modules/cms/action/RequestParams.class.php b/modules/cms/action/RequestParams.class.php @@ -14,12 +14,9 @@ class RequestParams const PARAM_ACTION = 'action' ; const PARAM_SUBACTION = 'subaction' ; const PARAM_ID = 'id' ; - const PARAM_OBJECT_ID = 'objectid' ; const PARAM_LANGUAGE_ID = 'languageid' ; const PARAM_MODEL_ID = 'modelid' ; const PARAM_PROJECT_ID = 'projectid' ; - const PARAM_ELEMENT_ID = 'elementid' ; - const PARAM_TEMPLATE_ID = 'templateid' ; const PARAM_DATABASE_ID = 'dbid' ; /* Filter Types */ @@ -49,11 +46,24 @@ class RequestParams */ public function __construct() { - $headers = array_change_key_case(getallheaders(), CASE_LOWER); - // Is this a POST request? $this->isAction = @$_SERVER['REQUEST_METHOD'] == 'POST'; + $this->setParameterStore(); + + $this->id = $this->getId(); + $this->action = $this->getAlphanum(self::PARAM_ACTION ); + $this->method = $this->getAlphanum(self::PARAM_SUBACTION); + } + + + /** + * Setting the source for request parameters. + */ + protected function setParameterStore() { + + $headers = array_change_key_case(getallheaders(), CASE_LOWER); + $contenttype = trim(explode( ';',@$headers['content-type'])[0]); if ( !$this->isAction ) @@ -82,16 +92,12 @@ class RequestParams throw new \LogicException('HTTP-POST with unknown content type: ' . $contenttype); } - $this->id = $this->getRequestId(); - $this->action = $this->getRequestAlphanum(self::PARAM_ACTION ); - $this->method = $this->getRequestAlphanum(self::PARAM_SUBACTION); } + public function getRequiredVar($varName, $transcode ) { - public function getRequiredRequestVar( $varName, $transcode ) { - - $value = $this->getRequestVar($varName,$transcode); + $value = $this->getVar($varName,$transcode); if ( empty( $value ) ) throw new ValidationException($varName); @@ -108,9 +114,10 @@ class RequestParams * @throws ValidationException */ public function getRequiredText( $nameOfRequestParameter ) { - return $this->getRequiredRequestVar( $nameOfRequestParameter, self::FILTER_TEXT ); + return $this->getRequiredVar( $nameOfRequestParameter, self::FILTER_TEXT ); } + /** * Ermittelt den Inhalt der gew�nschten Request-Variablen. * Falls nicht vorhanden, wird "" zur�ckgegeben. @@ -118,7 +125,7 @@ class RequestParams * @param String $varName Schl�ssel * @return String Inhalt */ - public function getRequestVar($varName, $transcode = self::FILTER_TEXT) + public function getVar($varName, $transcode = self::FILTER_TEXT) { if (!isset($this->parameter[$varName])) return ''; @@ -127,49 +134,16 @@ class RequestParams } - public function getRequestAlphanum( $varName ) { - return $this->getRequestVar( $varName,self::FILTER_ALPHANUM ); + public function getAlphanum($varName ) { + return $this->getVar( $varName,self::FILTER_ALPHANUM ); } - public function cleanText( $value, $transcode ) - { - switch ($transcode) { - case self::FILTER_ALPHA: - $white = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; - break; - - case self::FILTER_ALPHANUM: - $white = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,_-!?%&/()'; - break; - - case self::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 self::FILTER_MAIL: - $white = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-@'; - break; - - case self::FILTER_TEXT: - // Allow all UTF-8 characters. - return mb_convert_encoding($value, 'UTF-8', 'UTF-8'); - - case self::FILTER_NUMBER: - $white = '1234567890.'; - break; - - case self::FILTER_RAW: - return $value; - - default: - throw new \LogicException('Unknown request filter', 'not found: ' . $transcode); - } + public function getRaw($varName ) { + return $this->getVar( $varName,self::FILTER_RAW ); + } - return Text::clean($value, $white); + public function getText($varName ) { + return $this->getVar( $varName,self::FILTER_TEXT ); } /** @@ -179,15 +153,15 @@ class RequestParams * @param String $varName Schl�ssel * @return boolean true, falls vorhanden. */ - public function hasRequestVar($varName) + public function has($varName) { return (isset($this->parameter[$varName]) && (!empty($this->parameter[$varName]) || $this->parameter[$varName] == '0')); } - public function getRequiredRequestId( $varName ) { + public function getRequiredId($varName ) { - $id = intval($this->getRequestVar( $varName )); + $id = intval($this->getVar( $varName )); if ( $id == 0 ) throw new ValidationException($varName); @@ -196,50 +170,105 @@ class RequestParams } /** + * Gets the ID for the current action. + * + * @return Integer + */ + public function getId() + { + return intval($this->getNumber( self::PARAM_ID )); + } + + + + /** * Ermittelt die aktuelle Id aus dem Request.<br> * Um welche ID es sich handelt, ist abh�ngig von der Action. * + * @param string $varName name of parameter * @return Integer */ - public function getRequestId() + public function getNumber($varName ) { - if ($this->hasRequestVar('idvar')) - return intval($this->getRequestVar($this->getRequestVar('idvar'))); - else - return intval($this->getRequestVar(self::PARAM_ID)); + return $this->getVar( $varName,self::FILTER_NUMBER ); } + + public function hasLanguageId() { - return $this->hasRequestVar(self::PARAM_LANGUAGE_ID); + return $this->has(self::PARAM_LANGUAGE_ID); } public function getLanguageId() { - return $this->getRequestVar(self::PARAM_LANGUAGE_ID,self::FILTER_NUMBER); + return $this->getVar(self::PARAM_LANGUAGE_ID,self::FILTER_NUMBER); } public function hasModelId() { - return $this->hasRequestVar(self::PARAM_MODEL_ID); + return $this->has(self::PARAM_MODEL_ID); } public function getModelId() { - return $this->getRequestVar(self::PARAM_MODEL_ID,self::FILTER_NUMBER); + return $this->getVar(self::PARAM_MODEL_ID,self::FILTER_NUMBER); } public function getProjectId() { - return $this->getRequestVar(self::PARAM_PROJECT_ID,self::FILTER_NUMBER); + return $this->getVar(self::PARAM_PROJECT_ID,self::FILTER_NUMBER); } public function getToken() { - return $this->getRequestVar(self::PARAM_TOKEN,self::FILTER_ALPHANUM); + return $this->getVar(self::PARAM_TOKEN,self::FILTER_ALPHANUM); + } + + + protected function cleanText( $value, $transcode ) + { + switch ($transcode) { + case self::FILTER_ALPHA: + $white = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; + break; + + case self::FILTER_ALPHANUM: + $white = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,_-!?%&/()'; + break; + + case self::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 self::FILTER_MAIL: + $white = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-@'; + break; + + case self::FILTER_TEXT: + // Allow all UTF-8 characters. + return mb_convert_encoding($value, 'UTF-8', 'UTF-8'); + + case self::FILTER_NUMBER: + $white = '1234567890.'; + break; + + case self::FILTER_RAW: + return $value; + + default: + throw new \LogicException('Unknown request filter', 'not found: ' . $transcode); + } + + return Text::clean($value, $white); } + public function __toString() { return 'Request '.$this->action.'/'.$this->method.'/'.$this->id; } diff --git a/modules/cms/action/TemplateAction.class.php b/modules/cms/action/TemplateAction.class.php @@ -60,15 +60,15 @@ class TemplateAction extends BaseAction public function init() { - $this->template = new Template( $this->getRequestId() ); + $this->template = new Template( $this->request->getId() ); $this->template->load(); $this->setTemplateVar( 'templateid',$this->template->templateid ); - if ( intval($this->getRequestVar('elementid')) != 0 ) + if ( intval($this->request->getText('elementid')) != 0 ) { - $this->element = new Element( $this->getRequestVar('elementid') ); + $this->element = new Element( $this->request->getText('elementid') ); $this->element->load(); $this->setTemplateVar( 'elementid',$this->element->elementid ); } diff --git a/modules/cms/action/TemplatelistAction.class.php b/modules/cms/action/TemplatelistAction.class.php @@ -50,7 +50,7 @@ class TemplatelistAction extends BaseAction public function init() { - $this->project = new Project( $this->request->getRequestId()); + $this->project = new Project( $this->request->getId()); } } \ No newline at end of file diff --git a/modules/cms/action/TextAction.class.php b/modules/cms/action/TextAction.class.php @@ -49,7 +49,7 @@ class TextAction extends FileAction public function init() { - $text = new Text($this->getRequestId()); + $text = new Text($this->request->getId()); $text->load(); $this->setBaseObject( $text ); diff --git a/modules/cms/action/UrlAction.class.php b/modules/cms/action/UrlAction.class.php @@ -51,7 +51,7 @@ class UrlAction extends ObjectAction public function init() { - $url = new Url( $this->getRequestId() ); + $url = new Url( $this->request->getId() ); $url->load(); $this->setBaseObject( $url ); diff --git a/modules/cms/action/UserAction.class.php b/modules/cms/action/UserAction.class.php @@ -62,7 +62,7 @@ class UserAction extends BaseAction public function init() { - $this->user = new User( $this->getRequestId() ); + $this->user = new User( $this->request->getId() ); $this->user->load(); $this->setTemplateVar('userid',$this->user->userid); } diff --git a/modules/cms/action/element/ElementAdvancedAction.class.php b/modules/cms/action/element/ElementAdvancedAction.class.php @@ -426,46 +426,46 @@ class ElementAdvancedAction extends ElementAction implements Method { public function post() { $ini_date_format = Configuration::subset('date')->get('format',[] ); - if ( $this->hasRequestVar('format')) - $this->element->format = $this->getRequestId('format'); + if ( $this->request->has('format')) + $this->element->format = $this->request->getNumber('format'); - if ( $this->hasRequestVar('dateformat')) - $this->element->dateformat = @$ini_date_format[$this->getRequestVar('dateformat')]; + if ( $this->request->has('dateformat')) + $this->element->dateformat = @$ini_date_format[$this->request->getText('dateformat')]; - if ( $this->hasRequestVar('default_longtext')) - $this->element->defaultText = $this->getRequestVar('default_longtext',RequestParams::FILTER_TEXT); + if ( $this->request->has('default_longtext')) + $this->element->defaultText = $this->request->getText('default_longtext'); else - $this->element->defaultText = $this->getRequestVar('default_text',RequestParams::FILTER_TEXT); + $this->element->defaultText = $this->request->getText('default_text'); - $this->element->subtype = $this->getRequestVar('subtype'); + $this->element->subtype = $this->request->getText('subtype'); - $this->element->html = $this->hasRequestVar('html'); - $this->element->withIcon = $this->hasRequestVar('with_icon'); - $this->element->allLanguages = $this->hasRequestVar('all_languages'); - $this->element->writable = $this->hasRequestVar('writable'); - $this->element->inherit = $this->hasRequestVar('inherit'); + $this->element->html = $this->request->has('html'); + $this->element->withIcon = $this->request->has('with_icon'); + $this->element->allLanguages = $this->request->has('all_languages'); + $this->element->writable = $this->request->has('writable'); + $this->element->inherit = $this->request->has('inherit'); - $this->element->decimals = $this->getRequestVar('decimals'); - $this->element->decPoint = $this->getRequestVar('dec_point'); - $this->element->thousandSep = $this->getRequestVar('thousand_sep'); - $this->element->folderObjectId = $this->getRequestVar('folderobjectid' ); - $this->element->defaultObjectId = $this->getRequestVar('default_objectid'); + $this->element->decimals = $this->request->getText('decimals'); + $this->element->decPoint = $this->request->getText('dec_point'); + $this->element->thousandSep = $this->request->getText('thousand_sep'); + $this->element->folderObjectId = $this->request->getText('folderobjectid' ); + $this->element->defaultObjectId = $this->request->getText('default_objectid'); - if ( $this->hasRequestVar('select_items')) - $this->element->code = $this->getRequestVar('select_items'); + if ( $this->request->has('select_items')) + $this->element->code = $this->request->getText('select_items'); else - $this->element->code = $this->getRequestVar('code' ,RequestParams::FILTER_RAW); + $this->element->code = $this->request->getRaw('code'); - if ( $this->hasRequestVar('name') ) - $this->element->name = $this->getRequestVar('name'); + if ( $this->request->has('name') ) + $this->element->name = $this->request->getText('name'); - if ( $this->hasRequestVar('linkelement') ) - $this->element->setPrefix( $this->getRequestVar('linkelement') ); + if ( $this->request->has('linkelement') ) + $this->element->setPrefix( $this->request->getText('linkelement') ); - if ( $this->hasRequestVar('parameters')) - $this->element->code = $this->getRequestVar('parameters',RequestParams::FILTER_RAW); + if ( $this->request->has('parameters')) + $this->element->code = $this->request->getVar('parameters',RequestParams::FILTER_RAW); $this->element->save(); $this->addNoticeFor( $this->element, Messages::SAVED); diff --git a/modules/cms/action/element/ElementPropAction.class.php b/modules/cms/action/element/ElementPropAction.class.php @@ -35,15 +35,15 @@ class ElementPropAction extends ElementAction implements Method { public function post() { - if ( !$this->userIsAdmin() && $this->getRequestVar('type') == 'code' ) + if ( !$this->userIsAdmin() && $this->request->getVar('type') == 'code' ) // Code-Elemente fuer Nicht-Administratoren nicht benutzbar throw new \util\exception\ValidationException('type'); - $this->element->typeid = $this->getRequestId('typeid'); + $this->element->typeid = $this->request->getNumber('typeid'); - $this->element->name = $this->getRequestVar('name' ,RequestParams::FILTER_ALPHANUM); - $this->element->label= $this->getRequestVar('label' ,RequestParams::FILTER_TEXT); - $this->element->desc = $this->getRequestVar('description',RequestParams::FILTER_TEXT); + $this->element->name = $this->request->getVar('name' ,RequestParams::FILTER_ALPHANUM); + $this->element->label= $this->request->getVar('label' ,RequestParams::FILTER_TEXT); + $this->element->desc = $this->request->getVar('description',RequestParams::FILTER_TEXT); $this->element->save(); diff --git a/modules/cms/action/element/ElementRemoveAction.class.php b/modules/cms/action/element/ElementRemoveAction.class.php @@ -12,10 +12,10 @@ class ElementRemoveAction extends ElementAction implements Method { } public function post() { - if ( !$this->hasRequestVar('confirm') ) + if ( !$this->request->has('confirm') ) throw new \util\exception\ValidationException('confirm'); - $type = $this->getRequestVar('type','abc'); + $type = $this->request->getVar('type','abc'); if ( $type == 'value' ) { diff --git a/modules/cms/action/file/FileAdvancedAction.class.php b/modules/cms/action/file/FileAdvancedAction.class.php @@ -25,9 +25,9 @@ class FileAdvancedAction extends FileAction implements Method { public function post() { - $this->file->extension = $this->getRequestVar('extension' ,RequestParams::FILTER_FILENAME); + $this->file->extension = $this->request->getVar('extension' ,RequestParams::FILTER_FILENAME); - $typeid = $this->getRequestVar('type',RequestParams::FILTER_NUMBER ); + $typeid = $this->request->getVar('type',RequestParams::FILTER_NUMBER ); if ( ! in_array($typeid,[BaseObject::TYPEID_FILE,BaseObject::TYPEID_IMAGE,BaseObject::TYPEID_TEXT])) throw new ValidationException('type'); diff --git a/modules/cms/action/file/FileCompressAction.class.php b/modules/cms/action/file/FileCompressAction.class.php @@ -17,12 +17,12 @@ class FileCompressAction extends FileAction implements Method { $this->setTemplateVar('formats' ,$formats ); } public function post() { - $format = $this->getRequestVar('format',RequestParams::FILTER_ALPHANUM); + $format = $this->request->getVar('format',RequestParams::FILTER_ALPHANUM); switch( $format ) { case 'gz': - if ( $this->getRequestVar('replace',RequestParams::FILTER_NUMBER)=='1' ) + if ( $this->request->getVar('replace',RequestParams::FILTER_NUMBER)=='1' ) { $this->file->value = gzencode( $this->file->loadValue(),1 ); $this->file->parse_filename( $this->file->filename.'.'.$this->file->extension.'.gz',FORCE_GZIP ); @@ -43,7 +43,7 @@ class FileCompressAction extends FileAction implements Method { break; case 'bzip2': - if ( $this->getRequestVar('replace')=='1' ) + if ( $this->request->getText('replace')=='1' ) { $this->file->value = bzcompress( $this->file->loadValue() ); $this->file->parse_filename( $this->file->filename.'.'.$this->file->extension.'.bz2' ); diff --git a/modules/cms/action/file/FileEditAction.class.php b/modules/cms/action/file/FileEditAction.class.php @@ -35,12 +35,12 @@ class FileEditAction extends FileAction implements Method { $this->file->value = $upload->value; $this->file->saveValue(); } - elseif( $this->hasRequestVar('value') ) + elseif( $this->request->has('value') ) { // File value received - $this->file->value = $this->getRequestVar('value'); + $this->file->value = $this->request->getText('value'); - if ( strtolower($this->getRequestVar('encoding')) == 'base64') + if ( strtolower($this->request->getText('encoding')) == 'base64') // file value is base64-encoded $this->file->value = base64_decode($this->file->value); diff --git a/modules/cms/action/file/FileShowAction.class.php b/modules/cms/action/file/FileShowAction.class.php @@ -56,7 +56,7 @@ class FileShowAction extends FileAction implements Method { header('Content-Length: '.$this->file->size ); - if ( $this->request->getRequestVar('encoding') == 'base64') + if ( $this->request->getAlphanum('encoding') == 'base64') { $encodingFunction = function($value) { return base64_encode($value); diff --git a/modules/cms/action/file/FileUncompressAction.class.php b/modules/cms/action/file/FileUncompressAction.class.php @@ -16,7 +16,7 @@ class FileUncompressAction extends FileAction implements Method { switch( $this->file->extension ) { case 'gz': - if ( $this->getRequestVar('replace') ) + if ( $this->request->getVar('replace') ) { if ( strcmp(substr($this->file->loadValue(),0,2),"\x1f\x8b")) { @@ -45,7 +45,7 @@ class FileUncompressAction extends FileAction implements Method { break; case 'bz2': - if ( $this->getRequestVar('replace') ) + if ( $this->request->getVar('replace') ) { $this->file->value = bzdecompress($this->file->loadValue()); $this->file->parse_filename( $this->file->filename ); diff --git a/modules/cms/action/folder/FolderAdvancedAction.class.php b/modules/cms/action/folder/FolderAdvancedAction.class.php @@ -49,7 +49,7 @@ class FolderAdvancedAction extends FolderAction implements Method { $list[$id]['date'] = date( \cms\base\Language::lang('DATE_FORMAT'),$o->lastchangeDate ); $list[$id]['user'] = $o->lastchangeUser; - if ( $this->hasRequestVar("markall") || $this->hasRequestVar('obj'.$id) ) + if ( $this->request->has("markall") || $this->request->has('obj'.$id) ) $this->setTemplateVar('obj'.$id,'1'); } } @@ -85,7 +85,7 @@ class FolderAdvancedAction extends FolderAction implements Method { } $this->setTemplateVar('actionlist',$actionList ); - $this->setTemplateVar('defaulttype',$this->getRequestVar('type','alpha')); + $this->setTemplateVar('defaulttype',$this->request->getAlphanum('type')); $this->setTemplateVar('object' ,$list ); $this->setTemplateVar('act_objectid',$this->folder->id); @@ -101,9 +101,9 @@ class FolderAdvancedAction extends FolderAction implements Method { public function post() { - $type = $this->getRequestVar('type'); - $ids = explode(',',$this->getRequestVar('ids')); - $targetObjectId = $this->getRequestVar('targetobjectid'); + $type = $this->request->getText('type'); + $ids = explode(',',$this->request->getText('ids')); + $targetObjectId = $this->request->getText('targetobjectid'); // Prüfen, ob Schreibrechte im Zielordner bestehen. switch( $type ) @@ -141,7 +141,7 @@ class FolderAdvancedAction extends FolderAction implements Method { foreach( $ids as $id ) { // Nur, wenn Objekt ausgewaehlt wurde - if ( !$this->hasRequestVar('obj'.$id) ) + if ( !$this->request->has('obj'.$id) ) continue; $o = new BaseObject( $id ); @@ -202,8 +202,8 @@ class FolderAdvancedAction extends FolderAction implements Method { // TAR speichern. $tarFile = new File(); - $tarFile->name = \cms\base\Language::lang('ARCHIVE').' '.$this->getRequestVar('filename'); - $tarFile->filename = $this->getRequestVar('filename'); + $tarFile->name = \cms\base\Language::lang('ARCHIVE').' '.$this->request->getText('filename'); + $tarFile->filename = $this->request->getText('filename'); $tarFile->extension = 'tar'; $tarFile->parentid = $this->folder->objectid; @@ -322,7 +322,7 @@ class FolderAdvancedAction extends FolderAction implements Method { case 'delete': - if ( $this->hasRequestVar('confirm') ) + if ( $this->request->has('confirm') ) { switch( $o->getType() ) { diff --git a/modules/cms/action/folder/FolderCreatefileAction.class.php b/modules/cms/action/folder/FolderCreatefileAction.class.php @@ -21,17 +21,17 @@ class FolderCreatefileAction extends FolderAction implements Method { public function post() { - $type = $this->getRequestVar('type' ); - $name = $this->getRequestVar('name' ); - $filename = $this->getRequestVar('filename' ); - $description = $this->getRequestVar('description'); + $type = $this->request->getText('type' ); + $name = $this->request->getText('name' ); + $filename = $this->request->getText('filename' ); + $description = $this->request->getText('description'); $file = new File(); // Die neue Datei wird über eine URL geladen und dann im CMS gespeichert. - if ( $this->hasRequestVar('url') ) + if ( $this->request->has('url') ) { - $url = $this->getRequestVar('url'); + $url = $this->request->getText('url'); $http = new Http(); $http->setUrl( $url ); @@ -51,11 +51,11 @@ class FolderCreatefileAction extends FolderAction implements Method { $file->parentid = $this->folder->objectid; $file->projectid = $this->folder->projectid; } - elseif ( $this->hasRequestVar('value') ) + elseif ( $this->request->has('value') ) { // New file is inserted. $file->filename = BaseObject::urlify( $filename ); - $file->value = $this->getRequestVar('value'); + $file->value = $this->request->getText('value'); $file->size = strlen($file->value); $file->parentid = $this->folder->objectid; $file->projectid = $this->folder->projectid; diff --git a/modules/cms/action/folder/FolderCreatefolderAction.class.php b/modules/cms/action/folder/FolderCreatefolderAction.class.php @@ -15,8 +15,8 @@ class FolderCreatefolderAction extends FolderAction implements Method { public function post() { - $name = $this->getRequestVar('name'); - $description = $this->getRequestVar('description'); + $name = $this->request->getText('name'); + $description = $this->request->getText('description'); $f = new Folder(); $f->projectid = $this->folder->projectid; diff --git a/modules/cms/action/folder/FolderCreateimageAction.class.php b/modules/cms/action/folder/FolderCreateimageAction.class.php @@ -21,17 +21,17 @@ class FolderCreateimageAction extends FolderAction implements Method { public function post() { - $type = $this->getRequestVar('type' ); - $name = $this->getRequestVar('name' ); - $filename = $this->getRequestVar('filename' ); - $description = $this->getRequestVar('description'); + $type = $this->request->getText('type' ); + $name = $this->request->getText('name' ); + $filename = $this->request->getText('filename' ); + $description = $this->request->getText('description'); $image = new Image(); // Die neue Datei wird über eine URL geladen und dann im CMS gespeichert. - if ( $this->hasRequestVar('url') ) + if ( $this->request->has('url') ) { - $url = $this->getRequestVar('url'); + $url = $this->request->getText('url'); $http = new Http(); $http->setUrl( $url ); diff --git a/modules/cms/action/folder/FolderCreatelinkAction.class.php b/modules/cms/action/folder/FolderCreatelinkAction.class.php @@ -16,14 +16,14 @@ class FolderCreatelinkAction extends FolderAction implements Method { public function post() { - $name = $this->getRequestVar('name'); - $description = $this->getRequestVar('description'); + $name = $this->request->getText('name'); + $description = $this->request->getText('description'); $link = new Link(); $link->filename = BaseObject::urlify( $name ); $link->parentid = $this->folder->objectid; - $link->linkedObjectId = $this->getRequestVar('targetobjectid'); + $link->linkedObjectId = $this->request->getText('targetobjectid'); $link->projectid = $this->folder->projectid; $link->persist(); diff --git a/modules/cms/action/folder/FolderCreatepageAction.class.php b/modules/cms/action/folder/FolderCreatepageAction.class.php @@ -25,13 +25,13 @@ class FolderCreatepageAction extends FolderAction implements Method { public function post() { - $name = $this->getRequestVar('name' ); - $filename = $this->getRequestVar('filename' ); - $description = $this->getRequestVar('description'); + $name = $this->request->getText('name' ); + $filename = $this->request->getText('filename' ); + $description = $this->request->getText('description'); $page = new Page(); $page->filename = BaseObject::urlify( $name ); - $page->templateid = $this->getRequestVar('templateid'); + $page->templateid = $this->request->getText('templateid'); $page->parentid = $this->folder->objectid; $page->projectid = $this->folder->projectid; diff --git a/modules/cms/action/folder/FolderCreatetextAction.class.php b/modules/cms/action/folder/FolderCreatetextAction.class.php @@ -22,17 +22,17 @@ class FolderCreatetextAction extends FolderAction implements Method { public function post() { - $name = $this->getRequestVar('name' ); - $description = $this->getRequestVar('description'); + $name = $this->request->getText('name' ); + $description = $this->request->getText('description'); $text = new Text(); $text->parentid = $this->folder->objectid; $text->projectid = $this->folder->projectid; // Die neue Datei wird über eine URL geladen und dann im CMS gespeichert. - if ( $this->hasRequestVar('url') ) + if ( $this->request->has('url') ) { - $url = $this->getRequestVar('url'); + $url = $this->request->getText('url'); $http = new Http(); $http->setUrl( $url ); @@ -72,9 +72,9 @@ class FolderCreatetextAction extends FolderAction implements Method { $text->value = $upload->value; } else { - $text->filename = $this->getRequestVar('filename'); - $text->extension = $this->getRequestVar('extension'); - $text->value = $this->getRequestVar('text'); + $text->filename = $this->request->getText('filename'); + $text->extension = $this->request->getText('extension'); + $text->value = $this->request->getText('text'); $text->size = strlen( $text->value ); } } diff --git a/modules/cms/action/folder/FolderCreateurlAction.class.php b/modules/cms/action/folder/FolderCreateurlAction.class.php @@ -11,16 +11,16 @@ class FolderCreateurlAction extends FolderAction implements Method { public function view() { } public function post() { - $description = $this->getRequestVar('description'); - $filename = $this->getRequestVar('filename' ); - $name = $this->getRequestVar('name' ); + $description = $this->request->getText('description'); + $filename = $this->request->getText('filename' ); + $name = $this->request->getText('name' ); $url = new Url(); $url->filename = BaseObject::urlify( $name ); $url->parentid = $this->folder->objectid; $url->projectid = $this->folder->projectid; - $url->url = $this->getRequestVar('url'); + $url->url = $this->request->getText('url'); $url->persist(); $url->setNameForAllLanguages( $name,$description ); diff --git a/modules/cms/action/folder/FolderOrderAction.class.php b/modules/cms/action/folder/FolderOrderAction.class.php @@ -44,7 +44,7 @@ class FolderOrderAction extends FolderAction implements Method { $ids = $this->folder->getObjectIds(); $seq = 0; - $order = explode(',',$this->getRequestVar('order') ); + $order = explode(',',$this->request->getText('order') ); foreach( $order as $objectid ) { diff --git a/modules/cms/action/folder/FolderPubAction.class.php b/modules/cms/action/folder/FolderPubAction.class.php @@ -51,7 +51,7 @@ class FolderPubAction extends FolderAction implements Method { $folderList = [ $this->folder->objectid ]; // Add all subfolders to the list - if ( $this->request->hasRequestVar('subdirs') ) + if ( $this->request->has('subdirs') ) $folderList = array_merge( $folderList, $this->folder->getAllSubFolderIds() ); foreach( $folderList as $folderId ) { @@ -60,7 +60,7 @@ class FolderPubAction extends FolderAction implements Method { $folder->load(); // Publish all pages - if ( $this->request->hasRequestVar('pages' ) ) { + if ( $this->request->has('pages' ) ) { foreach( $folder->getPages() as $pageObjectId ) { @@ -90,7 +90,7 @@ class FolderPubAction extends FolderAction implements Method { } // Publish all files - if ( $this->hasRequestVar('files' ) ) { + if ( $this->request->has('files' ) ) { foreach( $folder->getFiles() as $fileid ) { @@ -107,7 +107,7 @@ class FolderPubAction extends FolderAction implements Method { // Cleanup the target directory (if supported by the underlying target) - if ( $this->hasRequestVar('clean') ) + if ( $this->request->has('clean') ) $publisher->cleanOlderThan( Startup::getStartTime() ); diff --git a/modules/cms/action/folder/FolderRemoveAction.class.php b/modules/cms/action/folder/FolderRemoveAction.class.php @@ -14,7 +14,7 @@ class FolderRemoveAction extends FolderAction implements Method { public function post() { - if ( $this->hasRequestVar( 'withChildren')) + if ( $this->request->has( 'withChildren')) $this->folder->deleteAll(); // Delete with children else if ( $this->folder->hasChildren() ) diff --git a/modules/cms/action/group/GroupMembershipsAction.class.php b/modules/cms/action/group/GroupMembershipsAction.class.php @@ -39,10 +39,10 @@ class GroupMembershipsAction extends GroupAction implements Method { { $hasUser = array_key_exists($id,$groupUsers); - if ( !$hasUser && $this->hasRequestVar('user'.$id) ) + if ( !$hasUser && $this->request->has('user'.$id) ) $this->group->addUser($id); - if ( $hasUser && !$this->hasRequestVar('user'.$id) ) + if ( $hasUser && !$this->request->has('user'.$id) ) $this->group->delUser($id); } diff --git a/modules/cms/action/group/GroupPropAction.class.php b/modules/cms/action/group/GroupPropAction.class.php @@ -24,11 +24,11 @@ class GroupPropAction extends GroupAction implements Method { public function post() { - if ( ! $this->getRequestVar('name') ) + if ( ! $this->request->getText('name') ) throw new \util\exception\ValidationException('name'); - $this->group->name = $this->getRequestVar('name'); - $this->group->parentid = $this->getRequestId('parentid'); + $this->group->name = $this->request->getText('name'); + $this->group->parentid = $this->request->getNumber('parentid'); if ( ! $this->group->parentid ) $this->group->parentid = null; diff --git a/modules/cms/action/grouplist/GrouplistAddAction.class.php b/modules/cms/action/grouplist/GrouplistAddAction.class.php @@ -11,10 +11,10 @@ class GrouplistAddAction extends GrouplistAction implements Method { } public function post() { - if ( $this->getRequestVar('name') != '') + if ( $this->request->getText('name') != '') { $this->group = new Group(); - $this->group->name = $this->getRequestVar('name'); + $this->group->name = $this->request->getText('name'); $this->group->persist(); $this->addNoticeFor( $this->group, Messages::ADDED); } diff --git a/modules/cms/action/image/ImageSizeAction.class.php b/modules/cms/action/image/ImageSizeAction.class.php @@ -44,22 +44,22 @@ class ImageSizeAction extends ImageAction implements Method { public function post() { - $width = intval($this->getRequestVar('width' )); - $height = intval($this->getRequestVar('height' )); - $jpegcompression = $this->getRequestVar('jpeg_compression') ; - $format = $this->getRequestVar('format' ) ; - $factor = $this->getRequestVar('factor' ) ; + $width = intval($this->request->getText('width' )); + $height = intval($this->request->getText('height' )); + $jpegcompression = $this->request->getText('jpeg_compression') ; + $format = $this->request->getText('format' ) ; + $factor = $this->request->getText('factor' ) ; - if ( $this->getRequestVar('type') == 'input' && - ! $this->hasRequestVar('width' ) && - ! $this->hasRequestVar('height') ) + if ( $this->request->getText('type') == 'input' && + ! $this->request->has('width' ) && + ! $this->request->has('height') ) { $this->addValidationError('width','INPUT_NEW_IMAGE_SIZE' ); $this->addValidationError('height',''); return; } - if ( $this->hasRequestVar('copy') ) + if ( $this->request->has('copy') ) { // Datei neu anlegen. $imageFile = new Image($this->image->objectid); @@ -75,7 +75,7 @@ class ImageSizeAction extends ImageAction implements Method { $imageFile = $this->image; } - if ( $this->getRequestVar('type') == 'factor') + if ( $this->request->getText('type') == 'factor') { $width = 0; $height = 0; diff --git a/modules/cms/action/language/LanguagePropAction.class.php b/modules/cms/action/language/LanguagePropAction.class.php @@ -16,20 +16,20 @@ class LanguagePropAction extends LanguageAction implements Method { } public function post() { - if ( $this->hasRequestVar('name') ) + if ( $this->request->has('name') ) { - $this->language->name = $this->getRequestVar('name' ); - $this->language->isoCode = $this->getRequestVar('isocode'); + $this->language->name = $this->request->getText('name' ); + $this->language->isoCode = $this->request->getText('isocode'); } else { $countries = Configuration::subset('countries'); - $iso = $this->getRequestVar('isocode'); + $iso = $this->request->getText('isocode'); $this->language->name = $countries->get($iso,$iso); $this->language->isoCode = strtolower( $iso ); } - if ( $this->hasRequestVar('is_default') ) + if ( $this->request->has('is_default') ) $this->language->setDefault(); $this->language->save(); diff --git a/modules/cms/action/language/LanguageRemoveAction.class.php b/modules/cms/action/language/LanguageRemoveAction.class.php @@ -9,7 +9,7 @@ class LanguageRemoveAction extends LanguageAction implements Method { $this->setTemplateVar('name' ,$this->language->name ); } public function post() { - if ( $this->getRequestVar('confirm') == '1' ) + if ( $this->request->getText('confirm') == '1' ) $this->language->delete(); } } diff --git a/modules/cms/action/languagelist/LanguagelistAddAction.class.php b/modules/cms/action/languagelist/LanguagelistAddAction.class.php @@ -29,7 +29,7 @@ class LanguagelistAddAction extends LanguagelistAction implements Method { $countryList = Configuration::Conf()->get('countries',[]); - $iso = $this->getRequestVar('isocode'); + $iso = $this->request->getText('isocode'); $language = new Language(); $language->projectid = $this->project->projectid; $language->isoCode = $iso; diff --git a/modules/cms/action/link/LinkValueAction.class.php b/modules/cms/action/link/LinkValueAction.class.php @@ -30,7 +30,7 @@ class LinkValueAction extends LinkAction implements Method { public function post() { - $this->link->linkedObjectId = $this->getRequestVar('targetobjectid'); + $this->link->linkedObjectId = $this->request->getText('targetobjectid'); $this->link->save(); $this->addNoticeFor( $this->link, Messages::SAVED); diff --git a/modules/cms/action/login/LoginLoginAction.class.php b/modules/cms/action/login/LoginLoginAction.class.php @@ -77,11 +77,11 @@ class LoginLoginAction extends LoginAction implements Method { if ( Configuration::subset('login')->is('nologin',false ) ) throw new SecurityException('login disabled'); - $loginName = $this->getRequestVar('login_name' ,RequestParams::FILTER_ALPHANUM); - $loginPassword = $this->getRequestVar('login_password',RequestParams::FILTER_ALPHANUM); - $newPassword1 = $this->getRequestVar('password1' ,RequestParams::FILTER_ALPHANUM); - $newPassword2 = $this->getRequestVar('password2' ,RequestParams::FILTER_ALPHANUM); - $token = $this->getRequestVar('user_token' ,RequestParams::FILTER_ALPHANUM); + $loginName = $this->request->getAlphanum('login_name' ); + $loginPassword = $this->request->getVar('login_password',RequestParams::FILTER_ALPHANUM); + $newPassword1 = $this->request->getVar('password1' ,RequestParams::FILTER_ALPHANUM); + $newPassword2 = $this->request->getVar('password2' ,RequestParams::FILTER_ALPHANUM); + $token = $this->request->getVar('user_token' ,RequestParams::FILTER_ALPHANUM); // Jedes Authentifizierungsmodul durchlaufen, bis ein Login erfolgreich ist. @@ -243,7 +243,7 @@ class LoginLoginAction extends LoginAction implements Method { $this->setCookie(Action::COOKIE_DB_ID ,DB::get()->id ); $this->setCookie(Action::COOKIE_USERNAME,$user->name ); - if ( $this->hasRequestVar('remember') ) { + if ( $this->request->has('remember') ) { // Sets the login token cookie $this->setCookie(Action::COOKIE_TOKEN ,$user->createNewLoginToken() ); } diff --git a/modules/cms/action/login/LoginOidcAction.class.php b/modules/cms/action/login/LoginOidcAction.class.php @@ -18,8 +18,8 @@ class LoginOidcAction extends LoginAction implements Method { public function view() { - if ( $this->hasRequestVar("id")) { - $providerName = $this->request->getRequestVar('id',RequestParams::FILTER_ALPHANUM); + if ( $this->request->has("id")) { + $providerName = $this->request->getAlphanum('id'); Session::set(Session::KEY_OIDC_PROVIDER,$providerName); }else { $providerName = Session::get( Session::KEY_OIDC_PROVIDER); diff --git a/modules/cms/action/login/LoginPasswordAction.class.php b/modules/cms/action/login/LoginPasswordAction.class.php @@ -32,7 +32,7 @@ class LoginPasswordAction extends LoginAction implements Method { public function post() { - $username = $this->getRequestVar('username'); + $username = $this->request->getText('username'); if ( ! $username ) throw new ValidationException('username'); @@ -44,7 +44,7 @@ class LoginPasswordAction extends LoginAction implements Method { { srand ((double)microtime()*1000003); $code = rand(); - $this->setSessionVar(Session::KEY_PASSWORD_COMMIT_CODE,$code); + Session::set(Session::KEY_PASSWORD_COMMIT_CODE,$code); $eMail = new Mail($user->mail,Messages::MAIL_SUBJECT_PASSWORD_COMMIT_CODE,Messages::MAIL_TEXT_PASSWORD_COMMIT_CODE); $eMail->setVar('name',$user->getName()); @@ -52,7 +52,7 @@ class LoginPasswordAction extends LoginAction implements Method { try { $eMail->send(); - $this->setSessionVar(Session::KEY_PASSWORD_COMMIT_NAME,$user->name); + Session::set(Session::KEY_PASSWORD_COMMIT_NAME,$user->name); } catch( \Exception $e ) { Logger::warn( $e ); diff --git a/modules/cms/action/login/LoginPasswordcodeAction.class.php b/modules/cms/action/login/LoginPasswordcodeAction.class.php @@ -16,10 +16,10 @@ class LoginPasswordcodeAction extends LoginAction implements Method { } public function post() { - $username = $this->getSessionVar(Session::KEY_PASSWORD_COMMIT_NAME); + $username = Session::get(Session::KEY_PASSWORD_COMMIT_NAME); - if ( $this->getRequestVar("code")=='' || - $this->getSessionVar(Session::KEY_PASSWORD_COMMIT_CODE) != $this->getRequestVar("code") ) + if ( $this->request->getText("code")=='' || + Session::get(Session::KEY_PASSWORD_COMMIT_CODE) != $this->request->getText("code") ) { $this->addValidationError('code','PASSWORDCODE_NOT_MATCH'); return; diff --git a/modules/cms/action/login/LoginRegisterAction.class.php b/modules/cms/action/login/LoginRegisterAction.class.php @@ -17,7 +17,7 @@ class LoginRegisterAction extends LoginAction implements Method { } public function post() { - $email_address = $this->getRequestVar('mail',RequestParams::FILTER_MAIL); + $email_address = $this->request->getVar('mail',RequestParams::FILTER_MAIL); if ( ! Mail::checkAddress($email_address) ) { diff --git a/modules/cms/action/login/LoginRegistercodeAction.class.php b/modules/cms/action/login/LoginRegistercodeAction.class.php @@ -32,7 +32,7 @@ class LoginRegistercodeAction extends LoginAction implements Method { $conf = Configuration::rawConfig(); $origRegisterCode = Session::get( Session::KEY_REGISTER_CODE ); - $inputRegisterCode = $this->getRequestVar('code'); + $inputRegisterCode = $this->request->getText('code'); if ( $origRegisterCode != $inputRegisterCode ) throw new ValidationException('code', Messages::CODE_NOT_MATCH ); // Validation code does not match. @@ -40,29 +40,29 @@ class LoginRegistercodeAction extends LoginAction implements Method { // Best?tigungscode stimmt ?berein. // Neuen Benutzer anlegen. - if ( !$this->hasRequestVar('username') ) + if ( !$this->request->has('username') ) { $this->addValidationError('username'); return; } - $user = User::loadWithName( $this->getRequestVar('username'),User::AUTH_TYPE_INTERNAL ); + $user = User::loadWithName( $this->request->getText('username'),User::AUTH_TYPE_INTERNAL ); if ( $user ) throw new ValidationException('username',Messages::USER_ALREADY_IN_DATABASE ); - if ( strlen($this->getRequestVar('password')) < $conf['security']['password']['min_length'] ) + if ( strlen($this->request->getText('password')) < $conf['security']['password']['min_length'] ) throw new ValidationException('password', Messages::PASSWORD_MINLENGTH/*,[ 'minlength'=>$conf['security']['password']['min_length'] ]*/); $newUser = new User(); - $newUser->name = $this->getRequestVar('username'); + $newUser->name = $this->request->getText('username'); $newUser->fullname = $newUser->name; $newUser->mail = Session::get( Session::KEY_REGISTER_MAIL ); $newUser->persist(); - $newUser->setPassword( $this->getRequestVar('password'),true ); + $newUser->setPassword( $this->request->getText('password'),true ); $this->addNoticeFor( $newUser,Messages::USER_ADDED); } diff --git a/modules/cms/action/model/ModelPropAction.class.php b/modules/cms/action/model/ModelPropAction.class.php @@ -13,12 +13,12 @@ class ModelPropAction extends ModelAction implements Method { } public function post() { - if ( $this->hasRequestVar('name') ) { - $this->model->name = $this->getRequestVar('name'); + if ( $this->request->has('name') ) { + $this->model->name = $this->request->getText('name'); $this->model->save(); } - if ( $this->hasRequestVar('is_default') ) + if ( $this->request->has('is_default') ) $this->model->setDefault(); $this->addNoticeFor( $this->model, Messages::DONE ); diff --git a/modules/cms/action/model/ModelRemoveAction.class.php b/modules/cms/action/model/ModelRemoveAction.class.php @@ -12,7 +12,7 @@ class ModelRemoveAction extends ModelAction implements Method { $this->setTemplateVar( 'name',$this->model->name ); } public function post() { - if ( $this->hasRequestVar('confirm') ) + if ( $this->request->has('confirm') ) { $this->model->delete(); $this->addNoticeFor( $this->model, Messages::DONE ); diff --git a/modules/cms/action/modellist/ModellistAddAction.class.php b/modules/cms/action/modellist/ModellistAddAction.class.php @@ -11,8 +11,8 @@ class ModellistAddAction extends ModellistAction implements Method { public function post() { $model = new Model(); - $model->projectid = $this->getRequestVar('projectid'); - $model->name = $this->getRequestVar('name'); + $model->projectid = $this->request->getText('projectid'); + $model->name = $this->request->getText('name'); $model->persist(); // Wenn kein Namen eingegeben, dann einen setzen. diff --git a/modules/cms/action/object/ObjectAclformAction.class.php b/modules/cms/action/object/ObjectAclformAction.class.php @@ -14,7 +14,7 @@ use language\Messages; class ObjectAclformAction extends ObjectAction implements Method { public function view() { - $o = new BaseObject( $this->getRequestId() ); + $o = new BaseObject( $this->request->getId() ); $o->objectLoadRaw(); $this->setTemplateVars( $o->getAssocRelatedAclTypes() ); @@ -35,7 +35,7 @@ class ObjectAclformAction extends ObjectAction implements Method { public function post() { $permission = new Permission(); - $permission->objectid = $this->getRequestId(); + $permission->objectid = $this->request->getId(); // Nachschauen, ob der Benutzer ueberhaupt berechtigt ist, an // diesem Objekt die ACLs zu aendern. @@ -45,10 +45,10 @@ class ObjectAclformAction extends ObjectAction implements Method { throw new \util\exception\SecurityException('Not allowed to insert permissions.'); // Scheiss Hacker ;) // Handelt es sich um eine Benutzer- oder Gruppen ACL? - switch( $this->getRequestVar('type') ) + switch( $this->request->getText('type') ) { case 'user': - $permission->userid = $this->getRequestVar('userid' ); + $permission->userid = $this->request->getText('userid' ); if ( $permission->userid <= 0 ) { @@ -58,7 +58,7 @@ class ObjectAclformAction extends ObjectAction implements Method { } break; case 'group': - $permission->groupid = $this->getRequestVar('groupid'); + $permission->groupid = $this->request->getText('groupid'); if ( $permission->groupid <= 0 ) { $this->addValidationError('type' ); @@ -73,19 +73,19 @@ class ObjectAclformAction extends ObjectAction implements Method { return; } - $permission->languageid = $this->getRequestVar(RequestParams::PARAM_LANGUAGE_ID); + $permission->languageid = $this->request->getLanguageId(); - $permission->write = ( $this->hasRequestVar('write' ) ); - $permission->prop = ( $this->hasRequestVar('prop' ) ); - $permission->delete = ( $this->hasRequestVar('delete' ) ); - $permission->release = ( $this->hasRequestVar('release' ) ); - $permission->publish = ( $this->hasRequestVar('publish' ) ); - $permission->create_folder = ( $this->hasRequestVar('create_folder') ); - $permission->create_file = ( $this->hasRequestVar('create_file' ) ); - $permission->create_link = ( $this->hasRequestVar('create_link' ) ); - $permission->create_page = ( $this->hasRequestVar('create_page' ) ); - $permission->grant = ( $this->hasRequestVar('grant' ) ); - $permission->transmit = ( $this->hasRequestVar('transmit' ) ); + $permission->write = ( $this->request->has('write' ) ); + $permission->prop = ( $this->request->has('prop' ) ); + $permission->delete = ( $this->request->has('delete' ) ); + $permission->release = ( $this->request->has('release' ) ); + $permission->publish = ( $this->request->has('publish' ) ); + $permission->create_folder = ( $this->request->has('create_folder') ); + $permission->create_file = ( $this->request->has('create_file' ) ); + $permission->create_link = ( $this->request->has('create_link' ) ); + $permission->create_page = ( $this->request->has('create_page' ) ); + $permission->grant = ( $this->request->has('grant' ) ); + $permission->transmit = ( $this->request->has('transmit' ) ); $permission->persist(); diff --git a/modules/cms/action/object/ObjectCopyAction.class.php b/modules/cms/action/object/ObjectCopyAction.class.php @@ -15,10 +15,10 @@ use language\Messages; class ObjectCopyAction extends ObjectAction implements Method { public function view() { - $sourceObject = new BaseObject( $this->getRequestId()); + $sourceObject = new BaseObject( $this->request->getId()); $sourceObject->load(); - $targetFolder = new BaseObject( $this->getRequestVar('targetFolderId',RequestParams::FILTER_NUMBER)); + $targetFolder = new BaseObject( $this->request->getText('targetFolderId',RequestParams::FILTER_NUMBER)); $targetFolder->load(); $this->setTemplateVar('source' ,$sourceObject->getProperties() ); @@ -33,9 +33,9 @@ class ObjectCopyAction extends ObjectAction implements Method { } } public function post() { - $type = $this->getRequestVar('type'); - $targetObjectId = $this->getRequestVar('targetid',RequestParams::FILTER_NUMBER); - $sourceObjectId = $this->getRequestVar('sourceid',RequestParams::FILTER_NUMBER); + $type = $this->request->getText('type'); + $targetObjectId = $this->request->getNumber('targetid'); + $sourceObjectId = $this->request->getVar('sourceid',RequestParams::FILTER_NUMBER); $sourceObject = new BaseObject( $sourceObjectId ); $sourceObject->load(); diff --git a/modules/cms/action/object/ObjectDelaclAction.class.php b/modules/cms/action/object/ObjectDelaclAction.class.php @@ -12,7 +12,7 @@ class ObjectDelaclAction extends ObjectAction implements Method { public function view() { } public function post() { - $permission = new Permission($this->getRequestVar('aclid')); + $permission = new Permission($this->request->getText('aclid')); $permission->load(); // Nachschauen, ob der Benutzer ueberhaupt berechtigt ist, an diff --git a/modules/cms/action/object/ObjectInheritAction.class.php b/modules/cms/action/object/ObjectInheritAction.class.php @@ -12,7 +12,7 @@ use util\Session; class ObjectInheritAction extends ObjectAction implements Method { public function view() { - $o = new BaseObject( $this->getRequestId() ); + $o = new BaseObject( $this->request->getId() ); $o->objectLoadRaw(); $this->setTemplateVar( 'type',$o->getType() ); @@ -22,10 +22,10 @@ class ObjectInheritAction extends ObjectAction implements Method { public function post() { Session::close(); - $folder = new Folder( $this->getRequestId() ); + $folder = new Folder( $this->request->getId() ); $folder->load(); - if ( ! $this->hasRequestVar('inherit') ) + if ( ! $this->request->has('inherit') ) { $this->addWarningFor( $folder,Messages::NOTHING_DONE); return; diff --git a/modules/cms/action/object/ObjectNameAction.class.php b/modules/cms/action/object/ObjectNameAction.class.php @@ -9,7 +9,7 @@ use util\exception\ValidationException; class ObjectNameAction extends ObjectAction implements Method { public function view() { - $name = $this->baseObject->getNameForLanguage( $this->getRequestId('languageid') ); + $name = $this->baseObject->getNameForLanguage( $this->request->getLanguageId() ); $nameProps = $name->getProperties(); @@ -19,13 +19,13 @@ class ObjectNameAction extends ObjectAction implements Method { $this->setTemplateVars( $nameProps ); } public function post() { - if ( ! $this->hasRequestVar('name' ) ) + if ( ! $this->request->has('name' ) ) throw new ValidationException('name'); - $name = $this->baseObject->getNameForLanguage( $this->getRequestId('languageid')); + $name = $this->baseObject->getNameForLanguage( $this->request->getLanguageId() ); - $name->name = $this->getRequestVar( 'name' ); - $name->description = $this->getRequestVar( 'description' ); + $name->name = $this->request->getText( 'name' ); + $name->description = $this->request->getText( 'description' ); $name->persist(); diff --git a/modules/cms/action/object/ObjectPropAction.class.php b/modules/cms/action/object/ObjectPropAction.class.php @@ -23,15 +23,15 @@ class ObjectPropAction extends ObjectAction implements Method { public function post() { - if ( ! $this->hasRequestVar('filename' ) ) + if ( ! $this->request->has('filename' ) ) throw new ValidationException('filename'); - $this->baseObject->filename = BaseObject::urlify( $this->getRequestVar('filename') ); + $this->baseObject->filename = BaseObject::urlify( $this->request->getText('filename') ); $this->baseObject->save(); $alias = $this->baseObject->getAliasForLanguage(null); - $alias->filename = BaseObject::urlify( $this->getRequestVar( 'alias_filename') ); - $alias->parentid = $this->getRequestId('alias_folderid'); + $alias->filename = BaseObject::urlify( $this->request->getText( 'alias_filename') ); + $alias->parentid = $this->request->getNumber('alias_folderid'); // If no alias, remove the alias if ( ! $alias->filename ) @@ -41,8 +41,8 @@ class ObjectPropAction extends ObjectAction implements Method { // Should we do this? - if ( $this->hasRequestVar('creationTimestamp') && $this->userIsAdmin() ) - $this->baseObject->createDate = $this->getRequestVar('creationTimestamp',RequestParams::FILTER_NUMBER); + if ( $this->request->has('creationTimestamp') && $this->userIsAdmin() ) + $this->baseObject->createDate = $this->request->getVar('creationTimestamp',RequestParams::FILTER_NUMBER); $this->baseObject->setCreationTimestamp(); diff --git a/modules/cms/action/object/ObjectRightsAction.class.php b/modules/cms/action/object/ObjectRightsAction.class.php @@ -9,7 +9,7 @@ use cms\model\BaseObject; class ObjectRightsAction extends ObjectAction implements Method { public function view() { - $o = new BaseObject( $this->getRequestId() ); + $o = new BaseObject( $this->request->getId() ); $o->objectLoadRaw(); $this->setTemplateVar( 'show',$o->getRelatedAclTypes() ); $this->setTemplateVar( 'type',$o->getType() ); diff --git a/modules/cms/action/object/ObjectSettingsAction.class.php b/modules/cms/action/object/ObjectSettingsAction.class.php @@ -19,7 +19,7 @@ class ObjectSettingsAction extends ObjectAction implements Method { public function post() { - $this->baseObject->settings = $this->getRequestVar( 'settings'); + $this->baseObject->settings = $this->request->getText( 'settings'); // Validate YAML-Settings try { @@ -31,13 +31,13 @@ class ObjectSettingsAction extends ObjectAction implements Method { } // Gültigkeitszeiträume speichern. - if ($this->hasRequestVar( 'valid_from_date' )) - $this->baseObject->validFromDate = strtotime( $this->getRequestVar( 'valid_from_date' ).' '.$this->getRequestVar( 'valid_from_time' ) ); + if ($this->request->has( 'valid_from_date' )) + $this->baseObject->validFromDate = strtotime( $this->request->getText( 'valid_from_date' ).' '.$this->request->getText( 'valid_from_time' ) ); else $this->baseObject->validFromDate = null; - if ($this->hasRequestVar( 'valid_until_date')) - $this->baseObject->validToDate = strtotime( $this->getRequestVar( 'valid_until_date').' '.$this->getRequestVar( 'valid_until_time') ); + if ($this->request->has( 'valid_until_date')) + $this->baseObject->validToDate = strtotime( $this->request->getText( 'valid_until_date').' '.$this->request->getText( 'valid_until_time') ); else $this->baseObject->validToDate = null; diff --git a/modules/cms/action/page/PageAllAction.class.php b/modules/cms/action/page/PageAllAction.class.php @@ -27,7 +27,7 @@ class PageAllAction extends PageAction implements Method { public function view() { - $languageid = $this->request->getRequiredRequestId('languageid'); + $languageid = $this->request->getRequiredId('languageid'); $language = new Language($languageid); $language->load(); @@ -136,9 +136,9 @@ class PageAllAction extends PageAction implements Method { break; case Element::ELEMENT_TYPE_LONGTEXT: - if ($this->hasRequestVar('format')) + if ($this->request->has('format')) // Individual format from request. - $format = $this->getRequestId('format'); + $format = $this->request->getNumber('format'); elseif ($value->format != null) $format = $value->format; else @@ -179,7 +179,7 @@ class PageAllAction extends PageAction implements Method { { - $languageid = $this->request->getRequiredRequestId('languageid'); + $languageid = $this->request->getRequiredId('languageid'); $language = new Language($languageid); $language->load(); @@ -199,26 +199,26 @@ class PageAllAction extends PageAction implements Method { switch ($element->typeid) { case Element::ELEMENT_TYPE_TEXT: - $value->text = $this->getRequestVar($element->name, 'raw'); + $value->text = $this->request->getVar($element->name, 'raw'); break; case Element::ELEMENT_TYPE_LONGTEXT: - $value->text = $this->compactOIDs($this->getRequestVar($element->name, 'raw')); + $value->text = $this->compactOIDs($this->request->getVar($element->name, 'raw')); break; case Element::ELEMENT_TYPE_DATE: - $value->date = strtotime($this->getRequestVar($element->name.'_date') . $this->getRequestVar($element->name.'_time')); + $value->date = strtotime($this->request->getText($element->name.'_date') . $this->request->getText($element->name.'_time')); break; case Element::ELEMENT_TYPE_SELECT: - $value->text = $this->getRequestVar($element->name); + $value->text = $this->request->getText($element->name); break; case Element::ELEMENT_TYPE_LINK: case Element::ELEMENT_TYPE_INSERT: - $value->linkToObjectId = intval($this->getRequestVar($element->name)); + $value->linkToObjectId = intval($this->request->getVar($element->name)); break; case Element::ELEMENT_TYPE_NUMBER: - $value->number = $this->getRequestVar($element->name) * pow(10, $value->element->decimals); + $value->number = $this->request->getVar($element->name) * pow(10, $value->element->decimals); break; default: throw new \LogicException('Unknown element type: '.$element->getTypeName() ); @@ -230,10 +230,10 @@ class PageAllAction extends PageAction implements Method { // Inhalt sofort freigegeben, wenn // - Recht vorhanden // - Freigabe gewuenscht - $value->publish = $value->page->hasRight(Permission::ACL_RELEASE) && $this->hasRequestVar('release'); + $value->publish = $value->page->hasRight(Permission::ACL_RELEASE) && $this->request->has('release'); // Up-To-Date-Check - $lastChangeTime = $value->getLastChangeSinceByAnotherUser($this->getRequestVar('value_time'), Session::getUser()->userid); + $lastChangeTime = $value->getLastChangeSinceByAnotherUser($this->request->getVar('value_time'), Session::getUser()->userid); if ($lastChangeTime) $this->addWarningFor($value, Messages::CONCURRENT_VALUE_CHANGE, array('last_change_time' => date(L::lang('DATE_FORMAT'), $lastChangeTime))); @@ -256,7 +256,7 @@ class PageAllAction extends PageAction implements Method { } // Falls ausgewaehlt die Seite sofort veroeffentlichen - if ($value->page->hasRight(Permission::ACL_PUBLISH) && $this->hasRequestVar('publish')) { + if ($value->page->hasRight(Permission::ACL_PUBLISH) && $this->request->has('publish')) { $this->publishPage( $languageid ); } diff --git a/modules/cms/action/page/PageChangetemplateselectelementsAction.class.php b/modules/cms/action/page/PageChangetemplateselectelementsAction.class.php @@ -10,7 +10,7 @@ use language\Messages; class PageChangetemplateselectelementsAction extends PageAction implements Method { public function view() { - $newTemplateId = $this->getRequestVar( 'newtemplateid' ); + $newTemplateId = $this->request->getText( 'newtemplateid' ); if ( $newTemplateId != 0 ) { @@ -54,12 +54,12 @@ class PageChangetemplateselectelementsAction extends PageAction implements Metho public function post() { - $newTemplateId = $this->getRequestVar('newtemplateid'); + $newTemplateId = $this->request->getText('newtemplateid'); $replaceElementMap = Array(); $oldTemplate = new Template( $this->page->templateid ); foreach( $oldTemplate->getElementIds() as $elementid ) - $replaceElementMap[$elementid] = $this->getRequestVar('from'.$elementid); + $replaceElementMap[$elementid] = $this->request->getText('from'.$elementid); if ( $newTemplateId != 0 ) { diff --git a/modules/cms/action/page/PageEditAction.class.php b/modules/cms/action/page/PageEditAction.class.php @@ -45,23 +45,23 @@ class PageEditAction extends PageAction implements Method { $value->objectid = $this->page->objectid; $value->pageid = Page::getPageIdFromObjectId( $this->page->objectid ); - if ( ! $this->hasRequestVar('elementid') ) + if ( ! $this->request->has('elementid') ) $this->addValidationError('elementid' ); - $value->element = new Element( $this->getRequestVar('elementid') ); + $value->element = new Element( $this->request->getText('elementid') ); $value->element->load(); $value->load(); - $value->number = $this->getRequestVar('number') * pow(10,$value->element->decimals); - $value->linkToObjectId = intval($this->getRequestVar('linkobjectid')); - $value->text = $this->getRequestVar('text'); + $value->number = $this->request->getText('number') * pow(10,$value->element->decimals); + $value->linkToObjectId = intval($this->request->getText('linkobjectid')); + $value->text = $this->request->getText('text'); // Vorschau anzeigen - if ( $value->element->type=='longtext' && ($this->hasRequestVar('preview')||$this->hasRequestVar('addmarkup')) ) + if ( $value->element->type=='longtext' && ($this->request->has('preview')||$this->request->has('addmarkup')) ) { /* - if ( $this->hasRequestVar('preview') ) + if ( $this->request->hasRequestVar('preview') ) { $value->page = $this->page; $value->simple = false; @@ -71,35 +71,35 @@ class PageEditAction extends PageAction implements Method { $this->setTemplateVar('preview_text',$value->value ); }*/ - if ( $this->hasRequestVar('addmarkup') ) + if ( $this->request->has('addmarkup') ) { - $addText = $this->getRequestVar('addtext'); + $addText = $this->request->getText('addtext'); if ( !empty($addText) ) // Nur, wenn ein Text eingegeben wurde { - $addText = $this->getRequestVar('addtext'); + $addText = $this->request->getText('addtext'); - if ( $this->hasRequestVar('strong') ) + if ( $this->request->has('strong') ) $value->text .= '*'.$addText.'*'; - if ( $this->hasRequestVar('emphatic') ) + if ( $this->request->has('emphatic') ) $value->text .= '_'.$addText.'_'; - if ( $this->hasRequestVar('link') ) - $value->text .= '"'.$addText.'"->"'.$this->getRequestVar('objectid').'"'; + if ( $this->request->has('link') ) + $value->text .= '"'.$addText.'"->"'.$this->request->getText('objectid').'"'; } - if ( $this->hasRequestVar('table') ) + if ( $this->request->has('table') ) $value->text .= "|$addText | |\n|$addText | |\n|$addText | |\n"; - if ( $this->hasRequestVar('list') ) + if ( $this->request->has('list') ) $value->text .= "\n- ".$addText."\n".'- '.$addText."\n".'- '.$addText."\n"; - if ( $this->hasRequestVar('numlist') ) + if ( $this->request->has('numlist') ) $value->text .= "\n# ".$addText."\n".'# '.$addText."\n".'# '.$addText."\n"; - if ( $this->hasRequestVar('image') ) - $value->text .= '{'.$this->getRequestVar('objectid').'}'; + if ( $this->request->has('image') ) + $value->text .= '{'.$this->request->getText('objectid').'}'; } // Ermitteln aller verlinkbaren Objekte (fuer Editor) @@ -132,23 +132,23 @@ class PageEditAction extends PageAction implements Method { return; } - if ( $this->hasRequestVar('year') ) // Wird ein Datum gespeichert? + if ( $this->request->has('year') ) // Wird ein Datum gespeichert? { // Wenn ein ANSI-Datum eingegeben wurde, dann dieses verwenden - if ( $this->getRequestVar('ansidate') != $this->getRequestVar('ansidate_orig') ) - $value->date = strtotime($this->getRequestVar('ansidate') ); + if ( $this->request->getVar('ansidate') != $this->request->getVar('ansidate_orig') ) + $value->date = strtotime($this->request->getVar('ansidate') ); else // Sonst die Zeitwerte einzeln zu einem Datum zusammensetzen - $value->date = mktime( $this->getRequestVar('hour' ), - $this->getRequestVar('minute'), - $this->getRequestVar('second'), - $this->getRequestVar('month' ), - $this->getRequestVar('day' ), - $this->getRequestVar('year' ) ); + $value->date = mktime( $this->request->getVar('hour' ), + $this->request->getVar('minute'), + $this->request->getVar('second'), + $this->request->getVar('month' ), + $this->request->getVar('day' ), + $this->request->getVar('year' ) ); } else $value->date = 0; // Datum nicht gesetzt. - $value->text = $this->getRequestVar('text'); + $value->text = $this->request->getVar('text'); $value->page = new Page( $value->objectid ); $value->page->load(); @@ -156,7 +156,7 @@ class PageEditAction extends PageAction implements Method { // Inhalt sofort freigegeben, wenn // - Recht vorhanden // - Freigabe gewuenscht - if ( $value->page->hasRight( Permission::ACL_RELEASE ) && $this->getRequestVar('release')!='' ) + if ( $value->page->hasRight( Permission::ACL_RELEASE ) && $this->request->getVar('release')!='' ) $value->publish = true; else $value->publish = false; diff --git a/modules/cms/action/page/PageFormAction.class.php b/modules/cms/action/page/PageFormAction.class.php @@ -103,7 +103,7 @@ class PageFormAction extends PageAction implements Method { public function post() { foreach( $this->page->getElements() as $elementid=>$name ) { - if ( $this->hasRequestVar('saveid'.$elementid) ) + if ( $this->request->has('saveid'.$elementid) ) { $value = new Value(); $value->objectid = $this->page->objectid; @@ -113,7 +113,7 @@ class PageFormAction extends PageAction implements Method { $value->load(); // Eingegebenen Inhalt aus dem Request lesen - $inhalt = $this->getRequestVar( 'id'.$elementid ); + $inhalt = $this->request->getText( 'id'.$elementid ); // Den Inhalt speichern. switch( $value->element->type ) @@ -142,7 +142,7 @@ class PageFormAction extends PageAction implements Method { $value->page = &$this->page; // Ermitteln, ob Inhalt sofort freigegeben werden kann und soll - if ( $this->page->hasRight( Permission::ACL_RELEASE ) && $this->hasRequestVar('release') ) + if ( $this->page->hasRight( Permission::ACL_RELEASE ) && $this->request->has('release') ) $value->publish = true; else $value->publish = false; @@ -165,7 +165,7 @@ class PageFormAction extends PageAction implements Method { else { // sonst nur 1x speichern (fuer die aktuelle Sprache) - $value->languageid = $this->getRequestVar(RequestParams::PARAM_LANGUAGE_ID); + $value->languageid = $this->request->getVar(RequestParams::PARAM_LANGUAGE_ID); $value->add(); } } diff --git a/modules/cms/action/page/PageNameAction.class.php b/modules/cms/action/page/PageNameAction.class.php @@ -13,7 +13,7 @@ class PageNameAction extends PageAction implements Method { public function view() { - $languageId = $this->getRequestVar('languageid'); + $languageId = $this->request->getText('languageid'); $name = $this->page->getNameForLanguage($languageId); @@ -36,10 +36,10 @@ class PageNameAction extends PageAction implements Method { $parentAction->init(); $parentAction->post(); // Save name and description - $alias = $this->page->getAliasForLanguage( $this->getRequestId('languageid')); + $alias = $this->page->getAliasForLanguage( $this->request->getLanguageId() ); - $alias->filename = BaseObject::urlify( $this->getRequestVar( 'alias_filename') ); - $alias->parentid = $this->getRequestId('alias_folderid'); + $alias->filename = BaseObject::urlify( $this->request->getText( 'alias_filename') ); + $alias->parentid = $this->request->getNumber('alias_folderid'); // If no alias, remove the alias if ( ! $alias->filename ) { diff --git a/modules/cms/action/pageelement/PageelementDiffAction.class.php b/modules/cms/action/pageelement/PageelementDiffAction.class.php @@ -10,8 +10,8 @@ use util\Text; class PageelementDiffAction extends PageelementAction implements Method { public function view() { - $value1id = $this->getRequestVar('compareid'); - $value2id = $this->getRequestVar('withid' ); + $value1id = $this->request->getText('compareid'); + $value2id = $this->request->getVar('withid' ); // Wenn Value1-Id groesser als Value2-Id, dann Variablen tauschen if ( $value1id == $value2id ) diff --git a/modules/cms/action/pageelement/PageelementReleaseAction.class.php b/modules/cms/action/pageelement/PageelementReleaseAction.class.php @@ -18,7 +18,7 @@ class PageelementReleaseAction extends PageelementAction implements Method { $this->value->elementid = $this->element->elementid; $this->value->element->load(); - $this->value->valueid = intval($this->getRequestVar('valueid')); + $this->value->valueid = intval($this->request->getVar('valueid')); $this->value->loadWithId(); if ( $this->value->pageid != $this->page->pageid ) diff --git a/modules/cms/action/pageelement/PageelementRestoreAction.class.php b/modules/cms/action/pageelement/PageelementRestoreAction.class.php @@ -12,7 +12,7 @@ class PageelementRestoreAction extends PageelementAction implements Method { } public function post() { - $this->value->valueid = $this->getRequestVar('valueid'); + $this->value->valueid = $this->request->getText('valueid'); $this->value->loadWithId(); $this->value->element = new Element( $this->value->elementid ); diff --git a/modules/cms/action/pageelement/PageelementValueAction.class.php b/modules/cms/action/pageelement/PageelementValueAction.class.php @@ -17,7 +17,7 @@ class PageelementValueAction extends PageelementAction implements Method { $this->value->publish = false; - $valueId =$this->getRequestId('valueid'); + $valueId =$this->request->getNumber('valueid'); if ( $valueId ) { $this->value->valueid = $valueId; $this->value->loadWithId(); diff --git a/modules/cms/action/profile/ProfileAvailableAction.class.php b/modules/cms/action/profile/ProfileAvailableAction.class.php @@ -11,7 +11,7 @@ class ProfileAvailableAction extends ProfileAction implements Method { public function view() { - $action = $this->getRequestVar('queryaction'); + $action = $this->request->getText('queryaction'); $viewMethods = array_filter( [ // All UI-related methods (reachable via dropdown menus) diff --git a/modules/cms/action/profile/ProfileConfirmmailAction.class.php b/modules/cms/action/profile/ProfileConfirmmailAction.class.php @@ -12,7 +12,7 @@ class ProfileConfirmmailAction extends ProfileAction implements Method { public function post() { $sessionCode = Session::get( Session::KEY_MAIL_CHANGE_CODE ); $newMail = Session::get( Session::KEY_MAIL_CHANGE_MAIL ); - $inputRegisterCode = $this->getRequestVar('code'); + $inputRegisterCode = $this->request->getText('code'); if ( $sessionCode == $inputRegisterCode ) { diff --git a/modules/cms/action/profile/ProfileEditAction.class.php b/modules/cms/action/profile/ProfileEditAction.class.php @@ -44,14 +44,14 @@ class ProfileEditAction extends ProfileAction implements Method { } public function post() { - $this->user->fullname = $this->getRequestVar('fullname'); - $this->user->tel = $this->getRequestVar('tel' ); - $this->user->desc = $this->getRequestVar('desc' ); - $this->user->style = $this->getRequestVar('style' ); - $this->user->language = $this->getRequestVar('language'); - $this->user->timezone = $this->getRequestVar('timezone'); - $this->user->hotp = $this->hasRequestVar('hotp' ); - $this->user->totp = $this->hasRequestVar('totp' ); + $this->user->fullname = $this->request->getText('fullname'); + $this->user->tel = $this->request->getText('tel' ); + $this->user->desc = $this->request->getText('desc' ); + $this->user->style = $this->request->getText('style' ); + $this->user->language = $this->request->getText('language'); + $this->user->timezone = $this->request->getText('timezone'); + $this->user->hotp = $this->request->has('hotp' ); + $this->user->totp = $this->request->has('totp' ); Session::setUser( $this->user ); @@ -68,7 +68,7 @@ class ProfileEditAction extends ProfileAction implements Method { // Ausgewählte Sprache sofort verwenden. - $l = $this->getRequestVar('language'); + $l = $this->request->getText('language'); if ( $l ) $this->setLanguage($l); diff --git a/modules/cms/action/profile/ProfileMailAction.class.php b/modules/cms/action/profile/ProfileMailAction.class.php @@ -17,7 +17,7 @@ class ProfileMailAction extends ProfileAction implements Method { public function post() { srand ((double)microtime()*1000003); $code = rand(); // Zufalls-Freischaltcode erzeugen - $newMail = $this->getRequestVar('mail'); + $newMail = $this->request->getText('mail'); if ( !$newMail ) { diff --git a/modules/cms/action/profile/ProfilePwAction.class.php b/modules/cms/action/profile/ProfilePwAction.class.php @@ -26,25 +26,25 @@ class ProfilePwAction extends ProfileAction implements Method { if ( $this->user->type != User::AUTH_TYPE_INTERNAL ) throw new \LogicException('password change only possible for internal users.'); - if ( ! $this->user->checkPassword( $this->getRequestVar('act_password') ) ) + if ( ! $this->user->checkPassword( $this->request->getText('act_password') ) ) { $this->addValidationError('act_password'); } - elseif ( $this->getRequestVar('password1') == '' ) + elseif ( $this->request->getText('password1') == '' ) { $this->addValidationError('password1'); } - elseif ( $this->getRequestVar('password1') != $this->getRequestVar('password2') ) + elseif ( $this->request->getText('password1') != $this->request->getText('password2') ) { $this->addValidationError('password2','PASSWORDS_DO_NOT_MATCH'); } - elseif ( strlen($this->getRequestVar('password1'))<$pwMinLength ) + elseif ( strlen($this->request->getText('password1'))<$pwMinLength ) { $this->addValidationError('password1','PASSWORD_MINLENGTH',array('minlength'=> $pwMinLength)); } else { - $this->user->setPassword( $this->getRequestVar('password1') ); + $this->user->setPassword( $this->request->getText('password1') ); $this->addNoticeFor( $this->user,Messages::SAVED); // Send mail to user to inform about the new password. diff --git a/modules/cms/action/project/ProjectCopyAction.class.php b/modules/cms/action/project/ProjectCopyAction.class.php @@ -25,9 +25,9 @@ class ProjectCopyAction extends ProjectAction implements Method { $this->setTemplateVar( 'dbids',$dbids ); - if ( $this->hasRequestVar('ok') ) + if ( $this->request->has('ok') ) { - $this->project->export( $this->getRequestVar('dbid') ); + $this->project->export( $this->request->getVar('dbid') ); $this->addNoticeFor($this->project,Messages::DONE); } diff --git a/modules/cms/action/project/ProjectMaintenanceAction.class.php b/modules/cms/action/project/ProjectMaintenanceAction.class.php @@ -8,7 +8,7 @@ class ProjectMaintenanceAction extends ProjectAction implements Method { public function view() { } public function post() { - switch( $this->getRequestVar('type') ) + switch( $this->request->getText('type') ) { case 'check_files': // Konsistenzprüfungen diff --git a/modules/cms/action/project/ProjectPropAction.class.php b/modules/cms/action/project/ProjectPropAction.class.php @@ -17,19 +17,19 @@ class ProjectPropAction extends ProjectAction implements Method { } public function post() { - if ( $this->getRequestVar('name') != '') + if ( $this->request->getText('name') != '') { - $this->project->name = $this->getRequestVar('name' ,RequestParams::FILTER_ALPHANUM); - $this->project->url = $this->getRequestVar('url' ,RequestParams::FILTER_ALPHANUM); - $this->project->target_dir = $this->getRequestVar('target_dir' ,RequestParams::FILTER_RAW ); - $this->project->ftp_url = $this->getRequestVar('ftp_url' ,RequestParams::FILTER_RAW ); - $this->project->ftp_passive = $this->getRequestVar('ftp_passive' ,RequestParams::FILTER_RAW ); - $this->project->cmd_after_publish = $this->getRequestVar('cmd_after_publish' ,RequestParams::FILTER_RAW ); - $this->project->content_negotiation = $this->getRequestVar('content_negotiation',RequestParams::FILTER_NUMBER ); - $this->project->cut_index = $this->getRequestVar('cut_index' ,RequestParams::FILTER_NUMBER ); - $this->project->publishFileExtension = $this->getRequestVar('publishFileExtension',RequestParams::FILTER_NUMBER ); - $this->project->publishPageExtension = $this->getRequestVar('publishPageExtension',RequestParams::FILTER_NUMBER ); - $this->project->linkAbsolute = $this->getRequestVar('linksAbsolute' ,RequestParams::FILTER_NUMBER ) == '1'; + $this->project->name = $this->request->getVar('name' ,RequestParams::FILTER_ALPHANUM); + $this->project->url = $this->request->getVar('url' ,RequestParams::FILTER_ALPHANUM); + $this->project->target_dir = $this->request->getVar('target_dir' ,RequestParams::FILTER_RAW ); + $this->project->ftp_url = $this->request->getVar('ftp_url' ,RequestParams::FILTER_RAW ); + $this->project->ftp_passive = $this->request->getVar('ftp_passive' ,RequestParams::FILTER_RAW ); + $this->project->cmd_after_publish = $this->request->getVar('cmd_after_publish' ,RequestParams::FILTER_RAW ); + $this->project->content_negotiation = $this->request->getVar('content_negotiation',RequestParams::FILTER_NUMBER ); + $this->project->cut_index = $this->request->getVar('cut_index' ,RequestParams::FILTER_NUMBER ); + $this->project->publishFileExtension = $this->request->getVar('publishFileExtension',RequestParams::FILTER_NUMBER ); + $this->project->publishPageExtension = $this->request->getVar('publishPageExtension',RequestParams::FILTER_NUMBER ); + $this->project->linkAbsolute = $this->request->getVar('linksAbsolute' ,RequestParams::FILTER_NUMBER ) == '1'; $this->addNoticeFor($this->project,Messages::SAVED); $this->project->save(); // speichern diff --git a/modules/cms/action/projectlist/ProjectlistAddAction.class.php b/modules/cms/action/projectlist/ProjectlistAddAction.class.php @@ -21,7 +21,7 @@ class ProjectlistAddAction extends ProjectlistAction implements Method { if( !$this->userIsAdmin()) throw new SecurityException(); - $projectid = $this->getRequestVar('projectid'); + $projectid = $this->request->getVar('projectid'); if ( $projectid ) { @@ -32,7 +32,7 @@ class ProjectlistAddAction extends ProjectlistAction implements Method { $this->addNoticeFor($project,Messages::DONE); } else { - $name = $this->hasRequestVar('name'); + $name = $this->request->has('name'); if ( !$name ) throw new \util\exception\ValidationException('name'); diff --git a/modules/cms/action/search/SearchQuicksearchAction.class.php b/modules/cms/action/search/SearchQuicksearchAction.class.php @@ -8,7 +8,7 @@ class SearchQuicksearchAction extends SearchAction implements Method { public function view() { $searchConfig = Configuration::subset('search')->subset('quicksearch'); - $text = $this->getRequestVar('search'); + $text = $this->request->getText('search'); $flag = $searchConfig->subset('flag'); diff --git a/modules/cms/action/search/SearchResultAction.class.php b/modules/cms/action/search/SearchResultAction.class.php @@ -7,14 +7,14 @@ class SearchResultAction extends SearchAction implements Method { public function view() { - $suchText = $this->getRequestVar('text'); + $suchText = $this->request->getText('text'); $searchFlags = 0; - if ( $this->hasRequestVar('id' ) ) $searchFlags |= self::FLAG_ID; - if ( $this->hasRequestVar('filename' ) ) $searchFlags |= self::FLAG_FILENAME; - if ( $this->hasRequestVar('name' ) ) $searchFlags |= self::FLAG_NAME; - if ( $this->hasRequestVar('description') ) $searchFlags |= self::FLAG_DESCRIPTION; - if ( $this->hasRequestVar('content' ) ) $searchFlags |= self::FLAG_VALUE; + if ( $this->request->has('id' ) ) $searchFlags |= self::FLAG_ID; + if ( $this->request->has('filename' ) ) $searchFlags |= self::FLAG_FILENAME; + if ( $this->request->has('name' ) ) $searchFlags |= self::FLAG_NAME; + if ( $this->request->has('description') ) $searchFlags |= self::FLAG_DESCRIPTION; + if ( $this->request->has('content' ) ) $searchFlags |= self::FLAG_VALUE; $this->performSearch($suchText, $searchFlags); @@ -25,7 +25,7 @@ class SearchResultAction extends SearchAction implements Method { $language = Session::getProjectLanguage(); $e->languageid = $language->languageid; - $listObjectIds = $e->getObjectIdsByLastChangeUserId( $this->getRequestVar('userid') ); + $listObjectIds = $e->getObjectIdsByLastChangeUserId( $this->request->getRequestVar('userid') ); break; }*/ } diff --git a/modules/cms/action/template/TemplateAddelAction.class.php b/modules/cms/action/template/TemplateAddelAction.class.php @@ -32,14 +32,14 @@ class TemplateAddelAction extends TemplateAction implements Method { } public function post() { - $name = $this->getRequestVar('name',RequestParams::FILTER_ALPHANUM); + $name = $this->request->getVar('name',RequestParams::FILTER_ALPHANUM); if ( empty($name) ) throw new \util\exception\ValidationException('name'); - $newElement = $this->template->addElement( $name,$this->getRequestVar('description'),$this->getRequestVar('typeid') ); + $newElement = $this->template->addElement( $name,$this->request->getText('description'),$this->request->getText('typeid') ); - if ( $this->hasRequestVar('addtotemplate') ) + if ( $this->request->has('addtotemplate') ) { $project = new Project( $this->template->projectid); $modelIds = $project->getModelIds(); diff --git a/modules/cms/action/template/TemplatePreviewAction.class.php b/modules/cms/action/template/TemplatePreviewAction.class.php @@ -14,7 +14,7 @@ class TemplatePreviewAction extends TemplateAction implements Method { $this->setTemplateVar('models',$project->getModels() ); - $modelId = $this->request->getRequestVar(RequestParams::PARAM_MODEL_ID); + $modelId = $this->request->getModelId(); if ( ! $modelId ) $modelId = Project::create( $this->template->projectid )->getDefaultModelId(); diff --git a/modules/cms/action/template/TemplatePropAction.class.php b/modules/cms/action/template/TemplatePropAction.class.php @@ -19,7 +19,7 @@ class TemplatePropAction extends TemplateAction implements Method { public function post() { $this->template->name = $this->request->getRequiredText('name'); - $this->template->publish = $this->request->hasRequestVar('publish'); + $this->template->publish = $this->request->has('publish'); $this->template->save(); $this->addNoticeFor($this->template,Messages::SAVED); diff --git a/modules/cms/action/template/TemplateShowAction.class.php b/modules/cms/action/template/TemplateShowAction.class.php @@ -10,7 +10,7 @@ use cms\model\TemplateModel; class TemplateShowAction extends TemplateAction implements Method { public function view() { - $modelId = $this->request->getRequestVar(RequestParams::PARAM_MODEL_ID); + $modelId = $this->request->getModelId(); if ( ! $modelId ) $modelId = Project::create( $this->template->projectid )->getDefaultModelId(); diff --git a/modules/cms/action/template/TemplateSrcAction.class.php b/modules/cms/action/template/TemplateSrcAction.class.php @@ -13,7 +13,7 @@ use language\Messages; class TemplateSrcAction extends TemplateAction implements Method { public function view() { $project = new Project( $this->template->projectid ); - $modelId = $this->getRequestId('modelid'); + $modelId = $this->request->getModelId(); $modelSrc = array(); @@ -55,12 +55,12 @@ class TemplateSrcAction extends TemplateAction implements Method { public function post() { - $modelId = $this->getRequestId('modelid'); + $modelId = $this->request->getModelId(); $templatemodel = new TemplateModel($this->template->templateid, $modelId); $templatemodel->load(); - $newSource = $this->request->getRequestVar('source',RequestParams::FILTER_RAW); + $newSource = $this->request->getRaw('source'); /* // Not useful any more. Technical name of a element should not be changed. @@ -75,7 +75,7 @@ class TemplateSrcAction extends TemplateAction implements Method { */ $templatemodel->src = $newSource; - $templatemodel->extension = $this->getRequestVar('extension'); + $templatemodel->extension = $this->request->getText('extension'); $templatemodel->persist(); $this->addNoticeFor($this->template,Messages::SAVED); diff --git a/modules/cms/action/template/TemplateSrcelementAction.class.php b/modules/cms/action/template/TemplateSrcelementAction.class.php @@ -31,12 +31,12 @@ class TemplateSrcelementAction extends TemplateAction implements Method { public function post() { - $tplModel = $this->template->loadTemplateModelFor( $this->request->getRequestVar(RequestParams::PARAM_MODEL_ID)); + $tplModel = $this->template->loadTemplateModelFor( $this->request->getModelId() ); - $elementToAdd = new Element( $this->getRequestVar('elementid') ); + $elementToAdd = new Element( $this->request->getText('elementid') ); $elementToAdd->load(); - switch( $this->getRequestVar('type') ) + switch( $this->request->getText('type') ) { case 'addelement': $tplModel->src .= "\n".'{{'.$elementToAdd->name.'}}'; diff --git a/modules/cms/action/templatelist/TemplatelistAddAction.class.php b/modules/cms/action/templatelist/TemplatelistAddAction.class.php @@ -33,7 +33,7 @@ class TemplatelistAddAction extends TemplatelistAction implements Method { public function post() { - $name = $this->getRequestVar('name'); + $name = $this->request->getText('name'); // create a new template. $template = new Template(); @@ -43,7 +43,7 @@ class TemplatelistAddAction extends TemplatelistAction implements Method { $this->addNoticeFor($template, Messages::ADDED); - $copytemplateid = $this->getRequestId('copytemplateid'); + $copytemplateid = $this->request->getNumber('copytemplateid'); if ( $copytemplateid ) { // Template kopieren. @@ -83,12 +83,12 @@ class TemplatelistAddAction extends TemplatelistAction implements Method { $template = new Template(); $template->projectid = $this->project->projectid; - $template->add( $this->getRequestVar('name') ); + $template->add( $this->request->getRequestVar('name') ); $templateModel = $template->loadTemplateModelFor( $this->project->getDefaultModelId() ); // FIXME - $example = parse_ini_file('examples/templates/'.$this->getRequestVar('example'),true); + $example = parse_ini_file('examples/templates/'.$this->request->getRequestVar('example'),true); foreach( $example as $exampleKey=>$exampleElement ) { @@ -111,7 +111,7 @@ class TemplatelistAddAction extends TemplatelistAction implements Method { $element->save(); } } - $template->name = $this->getRequestVar('name'); + $template->name = $this->request->getRequestVar('name'); $templateModel->src = str_replace(';',"\n",$templateModel->src); foreach( $template->getElementNames() as $elid=>$elname ) diff --git a/modules/cms/action/text/TextValueAction.class.php b/modules/cms/action/text/TextValueAction.class.php @@ -14,7 +14,7 @@ class TextValueAction extends TextAction implements Method { } public function post() { - $this->text->value = $this->getRequestVar('text', RequestParams::FILTER_RAW); + $this->text->value = $this->request->getVar('text', RequestParams::FILTER_RAW); $this->text->saveValue(); $this->addNoticeFor($this->text,Messages::VALUE_SAVED); diff --git a/modules/cms/action/url/UrlValueAction.class.php b/modules/cms/action/url/UrlValueAction.class.php @@ -18,7 +18,7 @@ class UrlValueAction extends UrlAction implements Method { public function post() { - $this->url->url = $this->getRequestVar('url'); + $this->url->url = $this->request->getVar('url'); $this->url->save(); $this->addNoticeFor( $this->url,Messages::SAVED ); diff --git a/modules/cms/action/user/UserAddgrouptouserAction.class.php b/modules/cms/action/user/UserAddgrouptouserAction.class.php @@ -10,7 +10,7 @@ class UserAddgrouptouserAction extends UserAction implements Method { } public function post() { - $group = new Group( $this->request->getRequiredRequestId('groupid' ) ); + $group = new Group( $this->request->getRequiredId('groupid' ) ); $group->load(); $this->user->addGroup( $group->groupid ); diff --git a/modules/cms/action/user/UserMembershipsAction.class.php b/modules/cms/action/user/UserMembershipsAction.class.php @@ -37,10 +37,10 @@ class UserMembershipsAction extends UserAction implements Method { { $hasGroup = array_key_exists($id,$userGroups); - if ( !$hasGroup && $this->hasRequestVar('group'.$id) ) + if ( !$hasGroup && $this->request->has('group'.$id) ) $this->user->addGroup($id); - if ( $hasGroup && !$this->hasRequestVar('group'.$id) ) + if ( $hasGroup && !$this->request->has('group'.$id) ) $this->user->delGroup($id); } diff --git a/modules/cms/action/user/UserPropAction.class.php b/modules/cms/action/user/UserPropAction.class.php @@ -43,24 +43,24 @@ class UserPropAction extends UserAction implements Method { public function post() { - if ( ! $this->getRequestVar('name') ) + if ( ! $this->request->getText('name') ) throw new \util\exception\ValidationException( 'name'); // Benutzer speichern - $this->user->name = $this->getRequestVar('name' ); - $this->user->fullname = $this->getRequestVar('fullname'); - $this->user->isAdmin = $this->hasRequestVar('is_admin'); - $this->user->tel = $this->getRequestVar('tel' ); - $this->user->desc = $this->getRequestVar('desc' ); - $this->user->language = $this->getRequestVar('language'); - $this->user->timezone = $this->getRequestVar('timezone'); - $this->user->hotp = $this->hasRequestVar('hotp' ); - $this->user->totp = $this->hasRequestVar('totp' ); + $this->user->name = $this->request->getText('name' ); + $this->user->fullname = $this->request->getText('fullname'); + $this->user->isAdmin = $this->request->has('is_admin'); + $this->user->tel = $this->request->getText('tel' ); + $this->user->desc = $this->request->getText('desc' ); + $this->user->language = $this->request->getText('language'); + $this->user->timezone = $this->request->getText('timezone'); + $this->user->hotp = $this->request->has('hotp' ); + $this->user->totp = $this->request->has('totp' ); if ( Configuration::get(['security','user','show_admin_mail']) ) - $this->user->mail = $this->getRequestVar('mail' ); + $this->user->mail = $this->request->getText('mail' ); - $this->user->style = $this->getRequestVar('style' ); + $this->user->style = $this->request->getText('style' ); $this->user->persist(); $this->addNoticeFor($this->user,Messages::SAVED); diff --git a/modules/cms/action/user/UserPwAction.class.php b/modules/cms/action/user/UserPwAction.class.php @@ -17,18 +17,18 @@ class UserPwAction extends UserAction implements Method { public function post() { - $password = $this->getRequestVar('password'); + $password = $this->request->getText('password'); if ( !$password ) - $password = $this->getRequestVar('password_proposal'); + $password = $this->request->getVar('password_proposal'); if ( strlen($password) < Configuration::subset(['security','password'])->get('min_length',8) ) throw new ValidationException('password',Messages::PASSWORD_MINLENGTH ); - $this->user->setPassword($password,!$this->hasRequestVar('timeout') ); // Kennwort setzen + $this->user->setPassword($password,!$this->request->has('timeout') ); // Kennwort setzen // E-Mail mit dem neuen Kennwort an Benutzer senden - if ( $this->hasRequestVar('email') && + if ( $this->request->has('email') && $this->user->mail && // user has an e-mail. Configuration::subset('mail')->is('enabled',true) ) { diff --git a/modules/cms/action/userlist/UserlistAddAction.class.php b/modules/cms/action/userlist/UserlistAddAction.class.php @@ -16,8 +16,7 @@ class UserlistAddAction extends UserlistAction implements Method { public function view() { } public function post( ) { - $name = $this->getRequestVar('name'); - $name = $this->request->cleanText($name,RequestParams::FILTER_ALPHANUM); + $name = $this->request->getAlphanum('name'); $user = User::loadWithName($name,User::AUTH_TYPE_INTERNAL); diff --git a/modules/cms/ui/action/tree/TreeBranchAction.class.php b/modules/cms/ui/action/tree/TreeBranchAction.class.php @@ -7,7 +7,7 @@ use util\Tree; class TreeBranchAction extends TreeAction implements Method { public function view() { - $type = $this->getRequestVar('type'); + $type = $this->request->getVar('type'); $branch = $this->loadTreeBranch( $type ); @@ -26,8 +26,8 @@ class TreeBranchAction extends TreeAction implements Method { try { $method = new \ReflectionMethod($tree,$type); - if ( $this->hasRequestVar('id')) - $method->invoke($tree, $this->getRequestVar('id') ); + if ( $this->request->has('id')) + $method->invoke($tree, $this->request->getVar('id') ); else $method->invoke($tree); // <== Executing the Action } diff --git a/modules/cms/ui/action/tree/TreePathAction.class.php b/modules/cms/ui/action/tree/TreePathAction.class.php @@ -18,8 +18,8 @@ use cms\action\Method; class TreePathAction extends TreeAction implements Method { public function view() { - $type = $this->getRequestVar('type'); - $id = $this->getRequestVar('id', RequestParams::FILTER_ALPHANUM); + $type = $this->request->getVar('type'); + $id = $this->request->getVar('id', RequestParams::FILTER_ALPHANUM); // Calculating the path to the actual object $result = $this->calculatePath($type, $id);