openrat-cms

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

commit b5263ec06ec4386bd930736d89494d25d7635b36
parent 2f4f2fe4e4397c6f1eec38b7db42957f37971f02
Author: Jan Dankert <develop@jandankert.de>
Date:   Sat, 11 Jul 2020 00:49:57 +0200

Fix: if-statements with equals-attribute, the attribute is considered as a string.

Diffstat:
modules/cms/ui/themes/default/html/views/folder/inherit.php | 2+-
modules/cms/ui/themes/default/html/views/object/aclform.tpl.src.xml | 2+-
modules/cms/ui/themes/default/html/views/object/inherit.php | 2+-
modules/cms/ui/themes/default/html/views/page/form.php | 2+-
modules/cms/ui/themes/default/html/views/pageelement/value.php | 28++++++++++++++--------------
modules/cms/ui/themes/default/html/views/project/history.php | 10+++++-----
modules/cms/ui/themes/default/html/views/start/userprojecttimeline.php | 8++++----
modules/template_engine/TemplateCompiler.php | 5++++-
modules/template_engine/components/html/if/If.class.php | 2+-
9 files changed, 32 insertions(+), 29 deletions(-)

diff --git a/modules/cms/ui/themes/default/html/views/folder/inherit.php b/modules/cms/ui/themes/default/html/views/folder/inherit.php @@ -7,7 +7,7 @@ <input type="<?php echo escapeHtml('hidden') ?>" name="<?php echo escapeHtml('subaction') ?>" value="<?php echo escapeHtml('inherit') ?>" /><?php echo escapeHtml('') ?> <input type="<?php echo escapeHtml('hidden') ?>" name="<?php echo escapeHtml('id') ?>" value="<?php echo escapeHtml(''.@$_id.'') ?>" /><?php echo escapeHtml('') ?> <div><?php echo escapeHtml('') ?> - <?php $if1=($type==folder); if($if1) { ?> + <?php $if1=($type=='folder'); 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('options').'') ?> <img /><?php echo escapeHtml('') ?> diff --git a/modules/cms/ui/themes/default/html/views/object/aclform.tpl.src.xml b/modules/cms/ui/themes/default/html/views/object/aclform.tpl.src.xml @@ -59,7 +59,7 @@ <part class="input"> <list list="${show}" value="t" key="k"> <part> - <if value="${t}" equals="'read'"> + <if value="${t}" equals="read"> <set var="${t}" value="true" /> <checkbox name="${t}" readonly="true"></checkbox> </if> diff --git a/modules/cms/ui/themes/default/html/views/object/inherit.php b/modules/cms/ui/themes/default/html/views/object/inherit.php @@ -7,7 +7,7 @@ <input type="<?php echo escapeHtml('hidden') ?>" name="<?php echo escapeHtml('subaction') ?>" value="<?php echo escapeHtml('inherit') ?>" /><?php echo escapeHtml('') ?> <input type="<?php echo escapeHtml('hidden') ?>" name="<?php echo escapeHtml('id') ?>" value="<?php echo escapeHtml(''.@$_id.'') ?>" /><?php echo escapeHtml('') ?> <div><?php echo escapeHtml('') ?> - <?php $if1=($type==folder); if($if1) { ?> + <?php $if1=($type=='folder'); 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('options').'') ?> <img /><?php echo escapeHtml('') ?> diff --git a/modules/cms/ui/themes/default/html/views/page/form.php b/modules/cms/ui/themes/default/html/views/page/form.php @@ -56,7 +56,7 @@ <input name="<?php echo escapeHtml(''.@$id.'') ?>" type="<?php echo escapeHtml('text') ?>" maxlength="<?php echo escapeHtml('255') ?>" value="<?php echo escapeHtml(''.@$value.'') ?>" /><?php echo escapeHtml('') ?> </div> <?php } ?> - <?php $if1=($type==longtext); if($if1) { ?> + <?php $if1=($type=='longtext'); if($if1) { ?> <textarea name="<?php echo escapeHtml(''.@$id.'') ?>" class="<?php echo escapeHtml('inputarea') ?>"><?php echo escapeHtml(''.@$value.'') ?> </textarea> <?php } ?> diff --git a/modules/cms/ui/themes/default/html/views/pageelement/value.php b/modules/cms/ui/themes/default/html/views/pageelement/value.php @@ -11,7 +11,7 @@ <input type="<?php echo escapeHtml('hidden') ?>" name="<?php echo escapeHtml('value_time') ?>" value="<?php echo escapeHtml(''.@$value_time.'') ?>" /><?php echo escapeHtml('') ?> <span class="<?php echo escapeHtml('help') ?>"><?php echo escapeHtml(''.@$desc.'') ?> </span> - <?php $if1=($type==date); if($if1) { ?> + <?php $if1=($type=='date'); 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('date').'') ?> <img /><?php echo escapeHtml('') ?> @@ -36,7 +36,7 @@ </div> </fieldset> <?php } ?> - <?php $if1=($type==text); if($if1) { ?> + <?php $if1=($type=='text'); if($if1) { ?> <tr><?php echo escapeHtml('') ?> <td colspan="<?php echo escapeHtml('2') ?>"><?php echo escapeHtml('') ?> <div class="<?php echo escapeHtml('inputholder') ?>"><?php echo escapeHtml('') ?> @@ -45,7 +45,7 @@ </td> </tr> <?php } ?> - <?php $if1=($type==longtext); if($if1) { ?> + <?php $if1=($type=='longtext'); if($if1) { ?> <input type="<?php echo escapeHtml('hidden') ?>" name="<?php echo escapeHtml('format') ?>" value="<?php echo escapeHtml(''.@$format.'') ?>" /><?php echo escapeHtml('') ?> <?php $if1=(isset($preview)); if($if1) { ?> <div class="<?php echo escapeHtml('preview') ?>"><?php echo escapeHtml('') ?> @@ -64,15 +64,15 @@ </fieldset> </div> <?php } ?> - <?php $if1=($editor==markdown); if($if1) { ?> + <?php $if1=($editor=='markdown'); if($if1) { ?> <textarea name="<?php echo escapeHtml('text') ?>" class="<?php echo escapeHtml('editor markdown-editor') ?>"><?php echo escapeHtml(''.@$text.'') ?> </textarea> <?php } ?> - <?php $if1=($editor==html); if($if1) { ?> + <?php $if1=($editor=='html'); if($if1) { ?> <textarea name="<?php echo escapeHtml('text') ?>" id="<?php echo escapeHtml('pageelement_edit_editor') ?>" class="<?php echo escapeHtml('editor html-editor') ?>"><?php echo ''.@$text.'' ?> </textarea> <?php } ?> - <?php $if1=($editor==wiki); if($if1) { ?> + <?php $if1=($editor=='wiki'); if($if1) { ?> <?php $if1=(isset($languagetext)); 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(''.@$languagename.'') ?> @@ -184,13 +184,13 @@ </div> </fieldset> <?php } ?> - <?php $if1=($editor==text); if($if1) { ?> + <?php $if1=($editor=='text'); if($if1) { ?> <textarea name="<?php echo escapeHtml('text') ?>" class="<?php echo escapeHtml('editor raw-editor') ?>"><?php echo escapeHtml(''.@$text.'') ?> </textarea> <?php } ?> <?php } ?> - <?php $if1=($type==link); if($if1) { ?> + <?php $if1=($type=='link'); if($if1) { ?> <fieldset class="<?php echo escapeHtml('or-group toggle-open-close open show') ?>"><?php echo escapeHtml('') ?> <div class="<?php echo escapeHtml('closable') ?>"><?php echo escapeHtml('') ?> <div class="<?php echo escapeHtml('line') ?>"><?php echo escapeHtml('') ?> @@ -220,7 +220,7 @@ </div> </fieldset> <?php } ?> - <?php $if1=($type==list); if($if1) { ?> + <?php $if1=($type=='list'); if($if1) { ?> <fieldset class="<?php echo escapeHtml('or-group toggle-open-close open show') ?>"><?php echo escapeHtml('') ?> <div class="<?php echo escapeHtml('closable') ?>"><?php echo escapeHtml('') ?> <div class="<?php echo escapeHtml('') ?>"><?php echo escapeHtml('') ?> @@ -235,7 +235,7 @@ </div> </fieldset> <?php } ?> - <?php $if1=($type==insert); if($if1) { ?> + <?php $if1=($type=='insert'); if($if1) { ?> <fieldset class="<?php echo escapeHtml('or-group toggle-open-close open show') ?>"><?php echo escapeHtml('') ?> <div class="<?php echo escapeHtml('closable') ?>"><?php echo escapeHtml('') ?> <div class="<?php echo escapeHtml('') ?>"><?php echo escapeHtml('') ?> @@ -250,7 +250,7 @@ </div> </fieldset> <?php } ?> - <?php $if1=($type==number); if($if1) { ?> + <?php $if1=($type=='number'); if($if1) { ?> <fieldset class="<?php echo escapeHtml('or-group toggle-open-close open show') ?>"><?php echo escapeHtml('') ?> <div class="<?php echo escapeHtml('closable') ?>"><?php echo escapeHtml('') ?> <div class="<?php echo escapeHtml('') ?>"><?php echo escapeHtml('') ?> @@ -262,7 +262,7 @@ </div> </fieldset> <?php } ?> - <?php $if1=($type==select); if($if1) { ?> + <?php $if1=($type=='select'); if($if1) { ?> <fieldset class="<?php echo escapeHtml('or-group toggle-open-close open show') ?>"><?php echo escapeHtml('') ?> <div class="<?php echo escapeHtml('closable') ?>"><?php echo escapeHtml('') ?> <div class="<?php echo escapeHtml('') ?>"><?php echo escapeHtml('') ?> @@ -276,8 +276,8 @@ </div> </fieldset> <?php } ?> - <?php $if1=($type==longtext); if($if1) { ?> - <?php $if1=($editor==wiki); if($if1) { ?> + <?php $if1=($type=='longtext'); if($if1) { ?> + <?php $if1=($editor=='wiki'); if($if1) { ?> <?php $if1=(isset($languages)); 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('editor_show_language').'') ?> diff --git a/modules/cms/ui/themes/default/html/views/project/history.php b/modules/cms/ui/themes/default/html/views/project/history.php @@ -25,23 +25,23 @@ </td> </tr> <?php foreach((array)$timeline as $list_key=>$list_value) { extract($list_value); ?> - <?php $if1=($typeid==1); if($if1) { ?> + <?php $if1=($typeid=='1'); if($if1) { ?> <?php { $type= folder; ?> <?php } ?> <?php } ?> - <?php $if1=($typeid==2); if($if1) { ?> + <?php $if1=($typeid=='2'); if($if1) { ?> <?php { $type= file; ?> <?php } ?> <?php } ?> - <?php $if1=($typeid==3); if($if1) { ?> + <?php $if1=($typeid=='3'); if($if1) { ?> <?php { $type= page; ?> <?php } ?> <?php } ?> - <?php $if1=($typeid==4); if($if1) { ?> + <?php $if1=($typeid=='4'); if($if1) { ?> <?php { $type= link; ?> <?php } ?> <?php } ?> - <?php $if1=($typeid==5); if($if1) { ?> + <?php $if1=($typeid=='5'); if($if1) { ?> <?php { $type= url; ?> <?php } ?> <?php } ?> diff --git a/modules/cms/ui/themes/default/html/views/start/userprojecttimeline.php b/modules/cms/ui/themes/default/html/views/start/userprojecttimeline.php @@ -21,19 +21,19 @@ </td> </tr> <?php foreach((array)$timeline as $list_key=>$list_value) { extract($list_value); ?> - <?php $if1=($typeid==1); if($if1) { ?> + <?php $if1=($typeid=='1'); if($if1) { ?> <?php { $type= folder; ?> <?php } ?> <?php } ?> - <?php $if1=($typeid==2); if($if1) { ?> + <?php $if1=($typeid=='2'); if($if1) { ?> <?php { $type= file; ?> <?php } ?> <?php } ?> - <?php $if1=($typeid==4); if($if1) { ?> + <?php $if1=($typeid=='4'); if($if1) { ?> <?php { $type= link; ?> <?php } ?> <?php } ?> - <?php $if1=($typeid==3); if($if1) { ?> + <?php $if1=($typeid=='3'); if($if1) { ?> <?php { $type= page; ?> <?php } ?> <?php } ?> diff --git a/modules/template_engine/TemplateCompiler.php b/modules/template_engine/TemplateCompiler.php @@ -23,6 +23,8 @@ require('../../modules/cms/base/require.php'); echo "Searching in $dir\n"; +$count = 0; + foreach(FileUtils::readDir( $dir ) as $action ) { if ( !is_dir($dir.'/'.$action ) ) @@ -30,11 +32,11 @@ foreach(FileUtils::readDir( $dir ) as $action ) echo "Action: $action\n"; - foreach(FileUtils::readDir( $dir.'/'.$action ) as $file ) { if ( substr($file,-12 ) == '.tpl.src.xml' ) { + $count++; $method = substr($file, 0,-12 ); echo "\tMethod $method\n"; @@ -56,4 +58,5 @@ foreach(FileUtils::readDir( $dir ) as $action ) } } } +echo "\nSummary: Compiled $count files.\n"; diff --git a/modules/template_engine/components/html/if/If.class.php b/modules/template_engine/components/html/if/If.class.php @@ -31,7 +31,7 @@ class IfComponent extends Component elseif ($this->contains) $expr .= 'in_array('.$if->value($this->value).',explode(",",'.$if->value($this->contains).')'; elseif ($this->equals) - $expr .= '' . $if->value($this->value).'=='.$if->value($this->equals); + $expr .= '' . $if->value($this->value).'==\''.$if->value($this->equals).'\''; elseif ($this->lessthan) $expr .= 'intval(' . $if->value($this->lessthan).')>intval('.$if->value($this->value).')'; elseif ($this->greaterthan)