openrat-cms

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

commit 963ed91606bdc3c59ee3aff5acdb9c37d3a708ac
parent f981fb9db1bebdc5ea01dc557fb82f05f57c2eff
Author: Jan Dankert <develop@jandankert.de>
Date:   Mon, 18 May 2020 00:09:14 +0200

Fix: wellformed JSON-string in links.

Diffstat:
modules/cms/ui/themes/default/html/views/languagelist/show.php | 2+-
modules/cms/ui/themes/default/html/views/login/login.php | 2+-
modules/cms/ui/themes/default/html/views/login/login.tpl.src.xml | 2+-
modules/cms/ui/themes/default/html/views/login/openid.php | 2+-
modules/cms/ui/themes/default/html/views/modellist/show.php | 2+-
modules/cms/ui/themes/default/html/views/object/rights.php | 2+-
modules/cms/ui/themes/default/html/views/pageelement/history.php | 4++--
modules/cms/ui/themes/default/html/views/projectlist/history.php | 2+-
modules/cms/ui/themes/default/html/views/start/projectmenu.php | 2+-
modules/cms/ui/themes/default/html/views/title/show.php | 4++--
modules/cms/ui/themes/default/html/views/userlist/show.php | 2+-
modules/template_engine/components/html/link/Link.class.php | 34++++++++--------------------------
12 files changed, 21 insertions(+), 39 deletions(-)

diff --git a/modules/cms/ui/themes/default/html/views/languagelist/show.php b/modules/cms/ui/themes/default/html/views/languagelist/show.php @@ -37,7 +37,7 @@ <?php $if1=(!$is_default); if($if1) { ?> <td class="<?php echo escapeHtml('clickable') ?>"><?php echo escapeHtml('') ?> <?php $if1=(isset($id)); if($if1) { ?> - <a target="<?php echo escapeHtml('_self') ?>" data-type="<?php echo escapeHtml('post') ?>" data-action="<?php echo escapeHtml('language') ?>" data-method="<?php echo escapeHtml('setdefault') ?>" data-id="<?php echo escapeHtml(''.@$id.'') ?>" data-extra="<?php echo escapeHtml('[]') ?>" data-data="<?php echo escapeHtml('{"action":"language","subaction":"setdefault","id":"'.@$id.'",\"token":"<?php echo token() ?>","none":"0"}"') ?>"><?php echo escapeHtml('') ?> + <a target="<?php echo escapeHtml('_self') ?>" data-type="<?php echo escapeHtml('post') ?>" data-action="<?php echo escapeHtml('language') ?>" data-method="<?php echo escapeHtml('setdefault') ?>" data-id="<?php echo escapeHtml(''.@$id.'') ?>" data-extra="<?php echo escapeHtml('[]') ?>" data-data="<?php echo escapeHtml('{"action":"language","subaction":"setdefault","id":"'.@$id.'","token":"'.@$_token.'","none":"0"}') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('GLOBAL_make_default').'') ?> </span> </a> diff --git a/modules/cms/ui/themes/default/html/views/login/login.php b/modules/cms/ui/themes/default/html/views/login/login.php @@ -141,7 +141,7 @@ </div> </div> </fieldset> - <?php $if1=(intval(1)<intval(size:dbids)); if($if1) { ?> + <?php $if1=(intval(1)<count($dbids)); if($if1) { ?> <fieldset class="<?php echo escapeHtml('or-group toggle-open-close open show') ?>"><?php echo escapeHtml('') ?> <legend class="<?php echo escapeHtml('on-click-open-close') ?>"><?php echo escapeHtml(''.@lang('DATABASE').'') ?> <img src="<?php echo escapeHtml('themes/default/images/icon/method/database.svg" />') ?>" /><?php echo escapeHtml('') ?> diff --git a/modules/cms/ui/themes/default/html/views/login/login.tpl.src.xml b/modules/cms/ui/themes/default/html/views/login/login.tpl.src.xml @@ -130,7 +130,7 @@ <newline /> --> - <if value="size:dbids" greaterthan="1"> + <if value="${dbids}" greaterthan="1"> <!-- Mehr als 1 Datenbank zur Auswahl. Auswahlfeld anzeigen. --> <group title="${message:DATABASE}" icon="database" open="true"> <part class="line"> diff --git a/modules/cms/ui/themes/default/html/views/login/openid.php b/modules/cms/ui/themes/default/html/views/login/openid.php @@ -44,7 +44,7 @@ </div> </div> </fieldset> - <?php $if1=(intval(1)<intval(size:dbids)); if($if1) { ?> + <?php $if1=(intval(1)<count(size:dbids)); if($if1) { ?> <fieldset class="<?php echo escapeHtml('or-group toggle-open-close open show') ?>"><?php echo escapeHtml('') ?> <legend class="<?php echo escapeHtml('on-click-open-close') ?>"><?php echo escapeHtml(''.@lang('DATABASE').'') ?> <img src="<?php echo escapeHtml('themes/default/images/icon/method/database.svg" />') ?>" /><?php echo escapeHtml('') ?> diff --git a/modules/cms/ui/themes/default/html/views/modellist/show.php b/modules/cms/ui/themes/default/html/views/modellist/show.php @@ -33,7 +33,7 @@ <?php $if1=(!$is_default); if($if1) { ?> <td class="<?php echo escapeHtml('clickable') ?>"><?php echo escapeHtml('') ?> <?php $if1=(isset($id)); if($if1) { ?> - <a target="<?php echo escapeHtml('_self') ?>" data-type="<?php echo escapeHtml('post') ?>" data-action="<?php echo escapeHtml('model') ?>" data-method="<?php echo escapeHtml('setdefault') ?>" data-id="<?php echo escapeHtml(''.@$id.'') ?>" data-extra="<?php echo escapeHtml('[]') ?>" data-data="<?php echo escapeHtml('{"action":"model","subaction":"setdefault","id":"'.@$id.'",\"token":"<?php echo token() ?>","none":"0"}"') ?>"><?php echo escapeHtml('') ?> + <a target="<?php echo escapeHtml('_self') ?>" data-type="<?php echo escapeHtml('post') ?>" data-action="<?php echo escapeHtml('model') ?>" data-method="<?php echo escapeHtml('setdefault') ?>" data-id="<?php echo escapeHtml(''.@$id.'') ?>" data-extra="<?php echo escapeHtml('[]') ?>" data-data="<?php echo escapeHtml('{"action":"model","subaction":"setdefault","id":"'.@$id.'","token":"'.@$_token.'","none":"0"}') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('GLOBAL_make_default').'') ?> </span> </a> diff --git a/modules/cms/ui/themes/default/html/views/object/rights.php b/modules/cms/ui/themes/default/html/views/object/rights.php @@ -73,7 +73,7 @@ </td> <?php } ?> <td class="<?php echo escapeHtml('clickable') ?>"><?php echo escapeHtml('') ?> - <a target="<?php echo escapeHtml('_self') ?>" data-type="<?php echo escapeHtml('post') ?>" data-action="<?php echo escapeHtml('') ?>" data-method="<?php echo escapeHtml('delacl') ?>" data-id="<?php echo escapeHtml('') ?>" data-extra="<?php echo escapeHtml('{\'aclid\':\''.@$aclid.'\'}') ?>" data-data="<?php echo escapeHtml('{"action":"object","subaction":"delacl","id":"",\"token":"<?php echo token() ?>","aclid":"'.@$aclid.'","none":"0"}"') ?>"><?php echo escapeHtml('') ?> + <a target="<?php echo escapeHtml('_self') ?>" data-type="<?php echo escapeHtml('post') ?>" data-action="<?php echo escapeHtml('') ?>" data-method="<?php echo escapeHtml('delacl') ?>" data-id="<?php echo escapeHtml('') ?>" data-extra="<?php echo escapeHtml('{\'aclid\':\''.@$aclid.'\'}') ?>" data-data="<?php echo escapeHtml('{"action":"object","subaction":"delacl","id":"","token":"'.@$_token.'","aclid":"'.@$aclid.'","none":"0"}') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('GLOBAL_DELETE').'') ?> </span> </a> diff --git a/modules/cms/ui/themes/default/html/views/pageelement/history.php b/modules/cms/ui/themes/default/html/views/pageelement/history.php @@ -101,7 +101,7 @@ <?php if(!$if1) { ?> <?php $if1=(isset($releaseUrl)); if($if1) { ?> <td class="<?php echo escapeHtml('clickable') ?>"><?php echo escapeHtml('') ?> - <a title="<?php echo escapeHtml(''.@lang('GLOBAL_RELEASE_DESC').'') ?>" target="<?php echo escapeHtml('_self') ?>" data-type="<?php echo escapeHtml('post') ?>" data-action="<?php echo escapeHtml('') ?>" data-method="<?php echo escapeHtml('release') ?>" data-id="<?php echo escapeHtml(''.@$objectid.'') ?>" data-extra="<?php echo escapeHtml('{\'valueid\':\''.@$valueid.'\'}') ?>" data-data="<?php echo escapeHtml('{"action":"pageelement","subaction":"release","id":"'.@$objectid.'",\"token":"<?php echo token() ?>","valueid":"'.@$valueid.'","none":"0"}"') ?>"><?php echo escapeHtml('') ?> + <a title="<?php echo escapeHtml(''.@lang('GLOBAL_RELEASE_DESC').'') ?>" target="<?php echo escapeHtml('_self') ?>" data-type="<?php echo escapeHtml('post') ?>" data-action="<?php echo escapeHtml('') ?>" data-method="<?php echo escapeHtml('release') ?>" data-id="<?php echo escapeHtml(''.@$objectid.'') ?>" data-extra="<?php echo escapeHtml('{\'valueid\':\''.@$valueid.'\'}') ?>" data-data="<?php echo escapeHtml('{"action":"pageelement","subaction":"release","id":"'.@$objectid.'","token":"'.@$_token.'","valueid":"'.@$valueid.'","none":"0"}') ?>"><?php echo escapeHtml('') ?> <strong><?php echo escapeHtml(''.@lang('GLOBAL_RELEASE').'') ?> </strong> </a> @@ -123,7 +123,7 @@ <?php if(!$if1) { ?> <?php $if1=(isset($useUrl)); if($if1) { ?> <td class="<?php echo escapeHtml('clickable') ?>"><?php echo escapeHtml('') ?> - <a title="<?php echo escapeHtml(''.@lang('GLOBAL_USE_DESC').'') ?>" target="<?php echo escapeHtml('_self') ?>" data-type="<?php echo escapeHtml('post') ?>" data-action="<?php echo escapeHtml('') ?>" data-method="<?php echo escapeHtml('use') ?>" data-id="<?php echo escapeHtml(''.@$objectid.'') ?>" data-extra="<?php echo escapeHtml('{\'valueid\':\''.@$valueid.'\'}') ?>" data-data="<?php echo escapeHtml('{"action":"pageelement","subaction":"use","id":"'.@$objectid.'",\"token":"<?php echo token() ?>","valueid":"'.@$valueid.'","none":"0"}"') ?>"><?php echo escapeHtml('') ?> + <a title="<?php echo escapeHtml(''.@lang('GLOBAL_USE_DESC').'') ?>" target="<?php echo escapeHtml('_self') ?>" data-type="<?php echo escapeHtml('post') ?>" data-action="<?php echo escapeHtml('') ?>" data-method="<?php echo escapeHtml('use') ?>" data-id="<?php echo escapeHtml(''.@$objectid.'') ?>" data-extra="<?php echo escapeHtml('{\'valueid\':\''.@$valueid.'\'}') ?>" data-data="<?php echo escapeHtml('{"action":"pageelement","subaction":"use","id":"'.@$objectid.'","token":"'.@$_token.'","valueid":"'.@$valueid.'","none":"0"}') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('GLOBAL_USE').'') ?> </span> </a> diff --git a/modules/cms/ui/themes/default/html/views/projectlist/history.php b/modules/cms/ui/themes/default/html/views/projectlist/history.php @@ -27,7 +27,7 @@ <?php foreach((array)$timeline as $list_key=>$list_value) { extract($list_value); ?> <tr class="<?php echo escapeHtml('data') ?>"><?php echo escapeHtml('') ?> <td class="<?php echo escapeHtml('clickable') ?>"><?php echo escapeHtml('') ?> - <a target="<?php echo escapeHtml('_self') ?>" data-type="<?php echo escapeHtml('post') ?>" data-action="<?php echo escapeHtml('start') ?>" data-method="<?php echo escapeHtml('projectmenu') ?>" data-id="<?php echo escapeHtml(''.@$projectid.'') ?>" data-extra="<?php echo escapeHtml('[]') ?>" data-data="<?php echo escapeHtml('{"action":"start","subaction":"projectmenu","id":"'.@$projectid.'",\"token":"<?php echo token() ?>","none":"0"}"') ?>"><?php echo escapeHtml('') ?> + <a target="<?php echo escapeHtml('_self') ?>" data-type="<?php echo escapeHtml('post') ?>" data-action="<?php echo escapeHtml('start') ?>" data-method="<?php echo escapeHtml('projectmenu') ?>" data-id="<?php echo escapeHtml(''.@$projectid.'') ?>" data-extra="<?php echo escapeHtml('[]') ?>" data-data="<?php echo escapeHtml('{"action":"start","subaction":"projectmenu","id":"'.@$projectid.'","token":"'.@$_token.'","none":"0"}') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@$projectname.'') ?> </span> </a> diff --git a/modules/cms/ui/themes/default/html/views/start/projectmenu.php b/modules/cms/ui/themes/default/html/views/start/projectmenu.php @@ -30,7 +30,7 @@ <?php foreach((array)$projects as $list_key=>$list_value) { extract($list_value); ?> <tr class="<?php echo escapeHtml('data') ?>"><?php echo escapeHtml('') ?> <td class="<?php echo escapeHtml('clickable') ?>"><?php echo escapeHtml('') ?> - <a title="<?php echo escapeHtml(''.@lang('TREE_CHOOSE_PROJECT').'') ?>" target="<?php echo escapeHtml('_self') ?>" data-type="<?php echo escapeHtml('post') ?>" data-action="<?php echo escapeHtml('') ?>" data-method="<?php echo escapeHtml('') ?>" data-id="<?php echo escapeHtml(''.@$id.'') ?>" data-extra="<?php echo escapeHtml('[]') ?>" data-data="<?php echo escapeHtml('{"action":"start","subaction":"projectmenu","id":"'.@$id.'",\"token":"<?php echo token() ?>","none":"0"}"') ?>"><?php echo escapeHtml('') ?> + <a title="<?php echo escapeHtml(''.@lang('TREE_CHOOSE_PROJECT').'') ?>" target="<?php echo escapeHtml('_self') ?>" data-type="<?php echo escapeHtml('post') ?>" data-action="<?php echo escapeHtml('') ?>" data-method="<?php echo escapeHtml('') ?>" data-id="<?php echo escapeHtml(''.@$id.'') ?>" data-extra="<?php echo escapeHtml('[]') ?>" data-data="<?php echo escapeHtml('{"action":"start","subaction":"projectmenu","id":"'.@$id.'","token":"'.@$_token.'","none":"0"}') ?>"><?php echo escapeHtml('') ?> <?php { $project= project; ?> <?php } ?> <img src="<?php echo escapeHtml('./modules/cms/ui/themes/default/images/icon_project.png') ?>" /><?php echo escapeHtml('') ?> diff --git a/modules/cms/ui/themes/default/html/views/title/show.php b/modules/cms/ui/themes/default/html/views/title/show.php @@ -148,7 +148,7 @@ <div class="<?php echo escapeHtml('divide') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('entry clickable') ?>"><?php echo escapeHtml('') ?> - <a title="<?php echo escapeHtml(''.@lang('USER_LOGOUT_DESC').'') ?>" target="<?php echo escapeHtml('_self') ?>" data-type="<?php echo escapeHtml('post') ?>" data-action="<?php echo escapeHtml('login') ?>" data-method="<?php echo escapeHtml('logout') ?>" data-id="<?php echo escapeHtml('') ?>" data-extra="<?php echo escapeHtml('[]') ?>" data-data="<?php echo escapeHtml('{"action":"login","subaction":"logout","id":"",\"token":"<?php echo token() ?>","none":"0"}"') ?>" class="<?php echo escapeHtml('entry') ?>"><?php echo escapeHtml('') ?> + <a title="<?php echo escapeHtml(''.@lang('USER_LOGOUT_DESC').'') ?>" target="<?php echo escapeHtml('_self') ?>" data-type="<?php echo escapeHtml('post') ?>" data-action="<?php echo escapeHtml('login') ?>" data-method="<?php echo escapeHtml('logout') ?>" data-id="<?php echo escapeHtml('') ?>" data-extra="<?php echo escapeHtml('[]') ?>" data-data="<?php echo escapeHtml('{"action":"login","subaction":"logout","id":"","token":"'.@$_token.'","none":"0"}') ?>" class="<?php echo escapeHtml('entry') ?>"><?php echo escapeHtml('') ?> <i class="<?php echo escapeHtml('image-icon image-icon--method-logout') ?>"><?php echo escapeHtml('') ?> </i> <span><?php echo escapeHtml(''.@lang('USER_LOGOUT').'') ?> @@ -404,7 +404,7 @@ <div class="<?php echo escapeHtml('divide') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('entry clickable') ?>"><?php echo escapeHtml('') ?> - <a data-after-success="<?php echo escapeHtml('reloadAll') ?>" title="<?php echo escapeHtml(''.@lang('USER_LOGOUT_DESC').'') ?>" target="<?php echo escapeHtml('_self') ?>" data-type="<?php echo escapeHtml('post') ?>" data-action="<?php echo escapeHtml('login') ?>" data-method="<?php echo escapeHtml('logout') ?>" data-id="<?php echo escapeHtml('') ?>" data-extra="<?php echo escapeHtml('[]') ?>" data-data="<?php echo escapeHtml('{"action":"login","subaction":"logout","id":"",\"token":"<?php echo token() ?>","none":"0"}"') ?>" class="<?php echo escapeHtml('entry') ?>"><?php echo escapeHtml('') ?> + <a data-after-success="<?php echo escapeHtml('reloadAll') ?>" title="<?php echo escapeHtml(''.@lang('USER_LOGOUT_DESC').'') ?>" target="<?php echo escapeHtml('_self') ?>" data-type="<?php echo escapeHtml('post') ?>" data-action="<?php echo escapeHtml('login') ?>" data-method="<?php echo escapeHtml('logout') ?>" data-id="<?php echo escapeHtml('') ?>" data-extra="<?php echo escapeHtml('[]') ?>" data-data="<?php echo escapeHtml('{"action":"login","subaction":"logout","id":"","token":"'.@$_token.'","none":"0"}') ?>" class="<?php echo escapeHtml('entry') ?>"><?php echo escapeHtml('') ?> <i class="<?php echo escapeHtml('image-icon image-icon--method-logout') ?>"><?php echo escapeHtml('') ?> </i> <span><?php echo escapeHtml(''.@lang('USER_LOGOUT').'') ?> diff --git a/modules/cms/ui/themes/default/html/views/userlist/show.php b/modules/cms/ui/themes/default/html/views/userlist/show.php @@ -45,7 +45,7 @@ <?php } ?> </td> <td class="<?php echo escapeHtml('clickable') ?>"><?php echo escapeHtml('') ?> - <a target="<?php echo escapeHtml('_self') ?>" data-type="<?php echo escapeHtml('post') ?>" data-action="<?php echo escapeHtml('user') ?>" data-method="<?php echo escapeHtml('switch') ?>" data-id="<?php echo escapeHtml(''.@$userid.'') ?>" data-extra="<?php echo escapeHtml('[]') ?>" data-data="<?php echo escapeHtml('{"action":"user","subaction":"switch","id":"'.@$userid.'",\"token":"<?php echo token() ?>","none":"0"}"') ?>"><?php echo escapeHtml('') ?> + <a target="<?php echo escapeHtml('_self') ?>" data-type="<?php echo escapeHtml('post') ?>" data-action="<?php echo escapeHtml('user') ?>" data-method="<?php echo escapeHtml('switch') ?>" data-id="<?php echo escapeHtml(''.@$userid.'') ?>" data-extra="<?php echo escapeHtml('[]') ?>" data-data="<?php echo escapeHtml('{"action":"user","subaction":"switch","id":"'.@$userid.'","token":"'.@$_token.'","none":"0"}') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('LOGIN').'') ?> </span> </a> diff --git a/modules/template_engine/components/html/link/Link.class.php b/modules/template_engine/components/html/link/Link.class.php @@ -123,37 +123,19 @@ class LinkComponent extends Component // Zusammenbau eines einzeligen JSON-Strings. // Aufpassen: Keine doppelten Hochkommas, keine Zeilenumbr├╝che. - $data = '{'; + $data = array(); - $data.= "\"action\":\""; - if (! empty($this->action)) - $data.= $this->action; - else - $data.= $this->request->action; - $data.= "\","; - - $data.= "\"subaction\":\""; - if (! empty($this->subaction)) - $data.= $this->subaction; - else - $data.= $this->request->method; - $data.= "\","; - - $data.= "\"id\":\""; - if (! empty($this->id)) - $data.= $this->id; - else - $data.= ""; - $data.= "\","; - - $data.= '\"'.REQ_PARAM_TOKEN . "\":\"" . '<?php echo token() ?>' . "\","; + $data['action' ] = (!empty($this->action ))?$this->action :$this->request->action; + $data['subaction'] = (!empty($this->subaction))?$this->subaction:$this->request->method; + $data['id' ] = (!empty($this->id ))?$this->id :''; + $data[REQ_PARAM_TOKEN] = '${_token}'; foreach( $this->getExtraParamArray() as $varname => $varvalue ) - $data.= "\"".$varname."\":\"" . $varvalue . "\","; + $data[$varname] = $varvalue; - $data.= "\"none\":\"0\"}\""; + $data['none'] = '0'; - $link->addAttribute('data-data',$data); + $link->addAttribute('data-data',str_replace(array("\t", "\r", "\n"),'',$json->encode($data))); break; case 'html':