From cc616ece3f636d26f932c1121c464aecef8864e7 Mon Sep 17 00:00:00 2001 From: michaeloffner Date: Fri, 8 Sep 2023 17:58:42 +0200 Subject: [PATCH] rename "limitIsDefined to "limitEvaluation" and extend it for more functions --- core/src/main/cfml/context/admin/overview.cfm | 2 +- .../cfml/context/admin/server.security.cfm | 21 +++++++++--------- .../admin/services.datasource.list.cfm | 2 +- .../java/lucee/runtime/PageContextImpl.java | 6 ++--- .../lucee/runtime/config/ConfigAdmin.java | 6 ++--- .../java/lucee/runtime/config/ConfigImpl.java | 10 ++++----- .../java/lucee/runtime/config/ConfigPro.java | 2 +- .../runtime/config/ConfigWebFactory.java | 16 +++++++------- .../lucee/runtime/config/ConfigWebImpl.java | 4 ++-- .../config/SingleContextConfigWeb.java | 4 ++-- .../interpreter/VariableInterpreter.java | 4 ++-- .../listener/ApplicationContextSupport.java | 4 ++-- .../listener/ClassicApplicationContext.java | 14 ++++++------ .../listener/ModernApplicationContext.java | 22 +++++++++---------- .../main/java/lucee/runtime/tag/Admin.java | 4 ++-- .../java/lucee/runtime/tag/SaveContent.java | 5 ++++- loader/build.xml | 2 +- loader/pom.xml | 2 +- 18 files changed, 67 insertions(+), 63 deletions(-) diff --git a/core/src/main/cfml/context/admin/overview.cfm b/core/src/main/cfml/context/admin/overview.cfm index aa3cb6284d..de4bf2e2af 100644 --- a/core/src/main/cfml/context/admin/overview.cfm +++ b/core/src/main/cfml/context/admin/overview.cfm @@ -18,7 +18,7 @@ Defaults ---> - + diff --git a/core/src/main/cfml/context/admin/server.security.cfm b/core/src/main/cfml/context/admin/server.security.cfm index ef8690d56f..2824e0d54b 100755 --- a/core/src/main/cfml/context/admin/server.security.cfm +++ b/core/src/main/cfml/context/admin/server.security.cfm @@ -32,7 +32,7 @@ Defaults ---> action="updateSecurity" type="#request.adminType#" password="#session["password"&request.adminType]#" - limitIsDefined="#form.limitIsDefined?:false#" + limitEvaluation="#form.limitEvaluation?:false#" varUsage="#form.varUsage#" remoteClients="#request.getRemoteClients()#"> @@ -44,7 +44,7 @@ Defaults ---> action="updateSecurity" type="#request.adminType#" password="#session["password"&request.adminType]#" - limitIsDefined="" + limitEvaluation="" varUsage="" remoteClients="#request.getRemoteClients()#"> @@ -109,23 +109,24 @@ Error Output ---> - stText.security.limitIsDefined="Limit function IsDefined"; - stText.security.limitIsDefinedDesc="If enable you can use expression within of [] in variable name checked by the function Isdefined like this: susi[getVariableName()]"; + stText.security.limitEvaluation="Limit variable evaluation in functions/tags"; + stText.security.limitEvaluationDesc="If enable you cannot use expression within ""[ ]"" like this susi[getVariableName()] . + This affects the following functions [IsDefined, structGet, empty] and the following tags [savecontent attribute ""variable""]."; - #stText.security.limitIsDefined# + #stText.security.limitEvaluation# - checked="checked" name="limitIsDefined" value="true" /> + checked="checked" name="limitEvaluation" value="true" /> - - #yesNoFormat(security.limitIsDefined)# + + #yesNoFormat(security.limitEvaluation)# -
#stText.security.limitIsDefinedDesc#
+
#stText.security.limitEvaluationDesc#
- this.security.limitIsDefined=#security.limitIsDefined?:true#; + this.security.limitEvaluation=#security.limitEvaluation?:true#; diff --git a/core/src/main/cfml/context/admin/services.datasource.list.cfm b/core/src/main/cfml/context/admin/services.datasource.list.cfm index dad333aae0..6192f9764e 100644 --- a/core/src/main/cfml/context/admin/services.datasource.list.cfm +++ b/core/src/main/cfml/context/admin/services.datasource.list.cfm @@ -297,7 +297,7 @@ list all mappings and display necessary edit fields ---> #srcLocal.name# #label#
#stText.Settings.noDriver#
- +
#stText.settings.datasource.databaseName#: #qDbInfo.DATABASE_PRODUCTNAME# #qDbInfo.DATABASE_VERSION#
#stText.settings.datasource.driverName#: #qDbInfo.DRIVER_NAME# #qDbInfo.DRIVER_VERSION# (JDBC #qDbInfo.JDBC_MAJOR_VERSION#.#qDbInfo.JDBC_MINOR_VERSION#)
diff --git a/core/src/main/java/lucee/runtime/PageContextImpl.java b/core/src/main/java/lucee/runtime/PageContextImpl.java index a1cdc6a371..def2d0d771 100755 --- a/core/src/main/java/lucee/runtime/PageContextImpl.java +++ b/core/src/main/java/lucee/runtime/PageContextImpl.java @@ -3903,8 +3903,8 @@ private static synchronized int getIdCounter() { return _idCounter; } - public boolean limitIsDefined() { - if (applicationContext != null) return applicationContext.getLimitIsDefined(); - return ((ConfigPro) config).limitIsDefined(); + public boolean limitEvaluation() { + if (applicationContext != null) return applicationContext.getLimitEvaluation(); + return ((ConfigPro) config).limitEvaluation(); } } diff --git a/core/src/main/java/lucee/runtime/config/ConfigAdmin.java b/core/src/main/java/lucee/runtime/config/ConfigAdmin.java index 3cb946e0c5..ffca4fa0d6 100755 --- a/core/src/main/java/lucee/runtime/config/ConfigAdmin.java +++ b/core/src/main/java/lucee/runtime/config/ConfigAdmin.java @@ -3046,7 +3046,7 @@ public void updateCTPathCache(Boolean ctPathCache) throws SecurityException { root.setEL("customTagUseCachePath", Caster.toString(ctPathCache, "")); } - public void updateSecurity(String varUsage, Boolean limitIsDefined) throws SecurityException { + public void updateSecurity(String varUsage, Boolean limitEvaluation) throws SecurityException { checkWriteAccess(); Struct el = _getRootElement("security"); @@ -3054,8 +3054,8 @@ public void updateSecurity(String varUsage, Boolean limitIsDefined) throws Secur if (!StringUtil.isEmpty(varUsage)) el.setEL("variableUsage", Caster.toString(varUsage)); else rem(el, "variableUsage"); - if (limitIsDefined != null) el.setEL("limitIsDefined", limitIsDefined); - else rem(el, "limitIsDefined"); + if (limitEvaluation != null) el.setEL("limitEvaluation", limitEvaluation); + else rem(el, "limitEvaluation"); } } diff --git a/core/src/main/java/lucee/runtime/config/ConfigImpl.java b/core/src/main/java/lucee/runtime/config/ConfigImpl.java index 06b3dfc31a..fea32a4b1c 100755 --- a/core/src/main/java/lucee/runtime/config/ConfigImpl.java +++ b/core/src/main/java/lucee/runtime/config/ConfigImpl.java @@ -210,7 +210,7 @@ public abstract class ConfigImpl extends ConfigBase implements ConfigPro { private short type = SCOPE_STANDARD; private boolean _allowImplicidQueryCall = true; - private boolean _limitIsDefined = false; + private boolean _limitEvaluation = false; private boolean _mergeFormAndURL = false; @@ -558,8 +558,8 @@ public boolean allowImplicidQueryCall() { } @Override - public boolean limitIsDefined() { - return _limitIsDefined; + public boolean limitEvaluation() { + return _limitEvaluation; } @Override @@ -1235,8 +1235,8 @@ protected void setAllowImplicidQueryCall(boolean _allowImplicidQueryCall) { this._allowImplicidQueryCall = _allowImplicidQueryCall; } - protected void setLimitIsDefined(boolean _limitIsDefined) { - this._limitIsDefined = _limitIsDefined; + protected void setLimitEvaluation(boolean _limitEvaluation) { + this._limitEvaluation = _limitEvaluation; } /** diff --git a/core/src/main/java/lucee/runtime/config/ConfigPro.java b/core/src/main/java/lucee/runtime/config/ConfigPro.java index cfac1dd39e..b63662fc38 100644 --- a/core/src/main/java/lucee/runtime/config/ConfigPro.java +++ b/core/src/main/java/lucee/runtime/config/ConfigPro.java @@ -358,5 +358,5 @@ public interface ConfigPro extends Config { public void setLastModified(); - public boolean limitIsDefined(); + public boolean limitEvaluation(); } diff --git a/core/src/main/java/lucee/runtime/config/ConfigWebFactory.java b/core/src/main/java/lucee/runtime/config/ConfigWebFactory.java index 65df585c08..a1ab435b0e 100644 --- a/core/src/main/java/lucee/runtime/config/ConfigWebFactory.java +++ b/core/src/main/java/lucee/runtime/config/ConfigWebFactory.java @@ -4049,21 +4049,21 @@ private static void _loadScope(ConfigServerImpl configServer, ConfigImpl config, // limit isdefined if (mode == ConfigPro.MODE_STRICT) { - config.setLimitIsDefined(true); + config.setLimitEvaluation(true); } else { - Boolean limitIsDefined = Caster.toBoolean(SystemUtil.getSystemPropOrEnvVar("lucee.isdefined.limit", null), null); - if (limitIsDefined == null) limitIsDefined = Caster.toBoolean(SystemUtil.getSystemPropOrEnvVar("lucee.security.isdefined", null), null); - if (limitIsDefined == null) { + Boolean limitEvaluation = Caster.toBoolean(SystemUtil.getSystemPropOrEnvVar("lucee.isdefined.limit", null), null); + if (limitEvaluation == null) limitEvaluation = Caster.toBoolean(SystemUtil.getSystemPropOrEnvVar("lucee.security.isdefined", null), null); + if (limitEvaluation == null) { Struct security = ConfigWebUtil.getAsStruct("security", root); if (security != null) { - limitIsDefined = Caster.toBoolean(getAttr(security, "limitIsDefined"), null); + limitEvaluation = Caster.toBoolean(getAttr(security, "limitEvaluation"), null); } } - if (hasAccess && limitIsDefined != null) { - config.setLimitIsDefined(limitIsDefined.booleanValue()); + if (hasAccess && limitEvaluation != null) { + config.setLimitEvaluation(limitEvaluation.booleanValue()); } - else if (hasCS) config.setLimitIsDefined(configServer.limitIsDefined()); + else if (hasCS) config.setLimitEvaluation(configServer.limitEvaluation()); } // Merge url and Form diff --git a/core/src/main/java/lucee/runtime/config/ConfigWebImpl.java b/core/src/main/java/lucee/runtime/config/ConfigWebImpl.java index 93fbf79211..98bbad4b6f 100644 --- a/core/src/main/java/lucee/runtime/config/ConfigWebImpl.java +++ b/core/src/main/java/lucee/runtime/config/ConfigWebImpl.java @@ -614,8 +614,8 @@ public boolean allowImplicidQueryCall() { } @Override - public boolean limitIsDefined() { - return instance.limitIsDefined(); + public boolean limitEvaluation() { + return instance.limitEvaluation(); } @Override diff --git a/core/src/main/java/lucee/runtime/config/SingleContextConfigWeb.java b/core/src/main/java/lucee/runtime/config/SingleContextConfigWeb.java index 4a247dae0d..26cb5ef6f0 100644 --- a/core/src/main/java/lucee/runtime/config/SingleContextConfigWeb.java +++ b/core/src/main/java/lucee/runtime/config/SingleContextConfigWeb.java @@ -187,8 +187,8 @@ public boolean allowImplicidQueryCall() { } @Override - public boolean limitIsDefined() { - return cs.limitIsDefined(); + public boolean limitEvaluation() { + return cs.limitEvaluation(); } @Override diff --git a/core/src/main/java/lucee/runtime/interpreter/VariableInterpreter.java b/core/src/main/java/lucee/runtime/interpreter/VariableInterpreter.java index 11589560f9..f2dd7a9d34 100755 --- a/core/src/main/java/lucee/runtime/interpreter/VariableInterpreter.java +++ b/core/src/main/java/lucee/runtime/interpreter/VariableInterpreter.java @@ -221,7 +221,7 @@ else if (scope instanceof Undefined) { * @throws SecurityInterpreterException */ public static Object getVariableEL(PageContext pc, String var, Object defaultValue) throws SecurityInterpreterException { - StringList list = parse(pc, new ParserString(var), false, false); + StringList list = parse(pc, new ParserString(var), false, ((PageContextImpl) pc).limitEvaluation()); if (list == null) return defaultValue; Object _null = NullSupportHelper.NULL(pc); @@ -427,7 +427,7 @@ public static Object removeVariable(PageContext pc, String var) throws PageExcep * @throws SecurityInterpreterException */ public static boolean isDefined(PageContext pc, String var) throws SecurityInterpreterException { - StringList list = parse(pc, new ParserString(var), false, ((PageContextImpl) pc).limitIsDefined()); + StringList list = parse(pc, new ParserString(var), false, ((PageContextImpl) pc).limitEvaluation()); if (list == null) return false; try { int scope = scopeString2Int(pc.ignoreScopes(), list.next()); diff --git a/core/src/main/java/lucee/runtime/listener/ApplicationContextSupport.java b/core/src/main/java/lucee/runtime/listener/ApplicationContextSupport.java index b85d6f7679..c279cda3cb 100644 --- a/core/src/main/java/lucee/runtime/listener/ApplicationContextSupport.java +++ b/core/src/main/java/lucee/runtime/listener/ApplicationContextSupport.java @@ -485,8 +485,8 @@ private static LoggerAndSourceData addLogger(Collection.Key name, int level, Cla public abstract void setPreciseMath(boolean preciseMath); - public abstract boolean getLimitIsDefined(); + public abstract boolean getLimitEvaluation(); - public abstract void setLimitIsDefined(boolean limitIsDefined); + public abstract void setLimitEvaluation(boolean limitEvaluation); } \ No newline at end of file diff --git a/core/src/main/java/lucee/runtime/listener/ClassicApplicationContext.java b/core/src/main/java/lucee/runtime/listener/ClassicApplicationContext.java index d5b33b563a..e9e41f1446 100755 --- a/core/src/main/java/lucee/runtime/listener/ClassicApplicationContext.java +++ b/core/src/main/java/lucee/runtime/listener/ClassicApplicationContext.java @@ -153,7 +153,7 @@ public class ClassicApplicationContext extends ApplicationContextSupport { private Map customAttrs; private boolean allowImplicidQueryCall; - private boolean limitIsDefined; + private boolean limitEvaluation; private Regex regex; private boolean preciseMath; @@ -190,7 +190,7 @@ public ClassicApplicationContext(ConfigWeb config, String name, boolean isDefaul this.fullNullSupport = config.getFullNullSupport(); this.scopeCascading = config.getScopeCascadingType(); this.allowImplicidQueryCall = config.allowImplicidQueryCall(); - this.limitIsDefined = ((ConfigPro) config).limitIsDefined(); + this.limitEvaluation = ((ConfigPro) config).limitEvaluation(); this.webCharset = ((ConfigPro) config).getWebCharSet(); this.resourceCharset = ((ConfigPro) config).getResourceCharSet(); @@ -264,7 +264,7 @@ public ApplicationContext duplicate() { dbl.fullNullSupport = fullNullSupport; dbl.scopeCascading = scopeCascading; dbl.allowImplicidQueryCall = allowImplicidQueryCall; - dbl.limitIsDefined = limitIsDefined; + dbl.limitEvaluation = limitEvaluation; dbl.webCharset = webCharset; dbl.resourceCharset = resourceCharset; dbl.sessionType = sessionType; @@ -881,13 +881,13 @@ public void setAllowImplicidQueryCall(boolean allowImplicidQueryCall) { } @Override - public boolean getLimitIsDefined() { - return limitIsDefined; + public boolean getLimitEvaluation() { + return limitEvaluation; } @Override - public void setLimitIsDefined(boolean limitIsDefined) { - this.limitIsDefined = limitIsDefined; + public void setLimitEvaluation(boolean limitEvaluation) { + this.limitEvaluation = limitEvaluation; } @Override diff --git a/core/src/main/java/lucee/runtime/listener/ModernApplicationContext.java b/core/src/main/java/lucee/runtime/listener/ModernApplicationContext.java index 6b5239d1dd..98701a93b6 100644 --- a/core/src/main/java/lucee/runtime/listener/ModernApplicationContext.java +++ b/core/src/main/java/lucee/runtime/listener/ModernApplicationContext.java @@ -162,7 +162,7 @@ public class ModernApplicationContext extends ApplicationContextSupport { private static final Key XML_FEATURES = KeyImpl.getInstance("xmlFeatures"); private static final Key SEARCH_QUERIES = KeyImpl.getInstance("searchQueries"); private static final Key SEARCH_RESULTS = KeyImpl.getInstance("searchResults"); - private static final Key LIMIT_ISDEFINED = KeyImpl.getInstance("limitIsDefined"); + private static final Key LIMIT_EVALUATION = KeyImpl.getInstance("limitEvaluation"); private static final Key REGEX = KeyImpl.getInstance("regex"); private static final Key ENGINE = KeyImpl.getInstance("engine"); private static final Key DIALECT = KeyConstants._dialect; @@ -312,7 +312,7 @@ public class ModernApplicationContext extends ApplicationContextSupport { private boolean initFuncDirs = false; private boolean allowImplicidQueryCall; - private boolean limitIsDefined; + private boolean limitEvaluation; private Regex regex; public ModernApplicationContext(PageContext pc, Component cfc, RefBoolean throwsErrorWhileInit) { @@ -351,7 +351,7 @@ public ModernApplicationContext(PageContext pc, Component cfc, RefBoolean throws this.sessionStorage = ci.getSessionStorage(); this.clientStorage = ci.getClientStorage(); this.allowImplicidQueryCall = config.allowImplicidQueryCall(); - this.limitIsDefined = ci.limitIsDefined(); + this.limitEvaluation = ci.limitEvaluation(); this.triggerComponentDataMember = config.getTriggerComponentDataMember(); this.restSetting = config.getRestSetting(); this.javaSettings = new JavaSettingsImpl(); @@ -366,7 +366,7 @@ public ModernApplicationContext(PageContext pc, Component cfc, RefBoolean throws initSameFieldAsArray(pc); initWebCharset(pc); initAllowImplicidQueryCall(); - initLimitIsDefined(); + initLimitEvaluation(); pc.addPageSource(component.getPageSource(), true); try { @@ -402,13 +402,13 @@ private void initAllowImplicidQueryCall() { if (o != null) allowImplicidQueryCall = Caster.toBooleanValue(o, allowImplicidQueryCall); } - private void initLimitIsDefined() { + private void initLimitEvaluation() { Object o = get(component, KeyConstants._security, null); if (o instanceof Struct) { Struct sct = (Struct) o; - o = sct.get(LIMIT_ISDEFINED, null); - if (o != null) limitIsDefined = Caster.toBooleanValue(o, limitIsDefined); + o = sct.get(LIMIT_EVALUATION, null); + if (o != null) limitEvaluation = Caster.toBooleanValue(o, limitEvaluation); } } @@ -1916,13 +1916,13 @@ public void setXmlFeatures(Struct xmlFeatures) { } @Override - public boolean getLimitIsDefined() { - return limitIsDefined; + public boolean getLimitEvaluation() { + return limitEvaluation; } @Override - public void setLimitIsDefined(boolean limitIsDefined) { - this.limitIsDefined = limitIsDefined; + public void setLimitEvaluation(boolean limitEvaluation) { + this.limitEvaluation = limitEvaluation; } @Override diff --git a/core/src/main/java/lucee/runtime/tag/Admin.java b/core/src/main/java/lucee/runtime/tag/Admin.java index db5f904960..a794d12101 100755 --- a/core/src/main/java/lucee/runtime/tag/Admin.java +++ b/core/src/main/java/lucee/runtime/tag/Admin.java @@ -1439,7 +1439,7 @@ private void doGetSecurity() throws PageException { pageContext.setVariable(getString("admin", action, "returnVariable"), sct); sct.set("varUsage", AppListenerUtil.toVariableUsage(config.getQueryVarUsage(), "ignore")); - sct.set("limitIsDefined", config.limitIsDefined()); + sct.set("limitEvaluation", config.limitEvaluation()); } /** @@ -1759,7 +1759,7 @@ private Double _fillSecDataDS(short access) { } private void doUpdateSecurity() throws PageException { - admin.updateSecurity(getString("varUsage", ""), getBool("limitIsDefined", null)); + admin.updateSecurity(getString("varUsage", ""), getBool("limitEvaluation", null)); store(); adminSync.broadcast(attributes, config); } diff --git a/core/src/main/java/lucee/runtime/tag/SaveContent.java b/core/src/main/java/lucee/runtime/tag/SaveContent.java index 09a7e002c6..4c9f479971 100755 --- a/core/src/main/java/lucee/runtime/tag/SaveContent.java +++ b/core/src/main/java/lucee/runtime/tag/SaveContent.java @@ -84,7 +84,10 @@ public int doAfterBody() throws PageException { String value = trim ? bodyContent.getString().trim() : bodyContent.getString(); if (append) { - value = Caster.toString(VariableInterpreter.getVariableEL(pageContext, variable, ""), "") + value; // prepend the current variable or empty-string if not found + value = Caster.toString(VariableInterpreter.getVariableEL(pageContext, variable, ""), "") + value; // prepend the + // current + // variable or empty-string + // if not found } pageContext.setVariable(variable, value); bodyContent.clearBody(); diff --git a/loader/build.xml b/loader/build.xml index 397ccad861..0be7043ba9 100644 --- a/loader/build.xml +++ b/loader/build.xml @@ -2,7 +2,7 @@ - + diff --git a/loader/pom.xml b/loader/pom.xml index 3b02df9fd3..b8f0123741 100644 --- a/loader/pom.xml +++ b/loader/pom.xml @@ -3,7 +3,7 @@ org.lucee lucee - 6.0.0.537-SNAPSHOT + 6.0.0.538-SNAPSHOT jar Lucee Loader Build