199 intermediate, state navigation

This commit is contained in:
2026-01-22 14:07:05 +03:00
parent 36048692e2
commit d843620292
7 changed files with 703 additions and 8 deletions
+21 -4
View File
@@ -7,6 +7,7 @@
<!--- v0.04 2025-11-20 columns--->
<!--- v0.05 2025-11-20 multiple field entries in filter, filter became array instead of structure--->
<!--- v0.06 2025-11-22 custom url parser used to prevent comma collision in lists--->
<!--- v0.06 2026-01-22 json-type field validation (isValidX)--->
<cffunction name="empty2null"
access="public"
@@ -102,7 +103,7 @@
<cfset var operator=listGetAt(local.rawValue,1,":")/>
<cfset var value=listGetAt(local.rawValue,2,":")/>
</cfif>
<cfif !isValid(ARGUMENTS.params[local.item].type,value)>
<cfif !isValidX(ARGUMENTS.params[local.item].type,value)>
<cfthrow type="invalidParamValue" message="Filter parameter #urlParamName# value is not a valid #ARGUMENTS.params[local.item].type#"/><!---не выводим значение, чтобы исключить XSS--->
</cfif>
@@ -156,7 +157,7 @@
<cfset var operator=listGetAt(local.rawValue,1,":")/>
<cfset var value=listGetAt(local.rawValue,2,":")/>
</cfif>
<cfif !isValid(ARGUMENTS.params[local.item].type,value)>
<cfif !isValidX(ARGUMENTS.params[local.item].type,value)>
<cfthrow type="invalidParamValue" message="Filter parameter #urlParamName# value is not a valid #ARGUMENTS.params[local.item].type#"/><!---не выводим значение, чтобы исключить XSS--->
</cfif>
@@ -402,6 +403,22 @@
"queryDurationMs":#queryDurationMs#, <cfset runDurationMs=getTickCount()-request.startTickCount/>
"runDurationMs":#runDurationMs#
}</cfoutput>--->
<cffunction name="isValidX"
access="private"
returntype="boolean"
output="false"
>
<cfargument name="type" required=true/>
<cfargument name="value" required=true/>
<cfif arguments.type EQ 'json'>
<cfreturn isJson(arguments.value)/>
<cfelse>
<cfreturn isValid(arguments.type, arguments.value)/>
</cfif>
</cffunction>
<cffunction name="validateField"
access="public"
returntype="any"
@@ -414,7 +431,7 @@
<cfargument name="required" type="boolean" default="false"/>
<cfif structKeyExists(ARGUMENTS.struct, ARGUMENTS.name)>
<cfif NOT isValid(ARGUMENTS.type, ARGUMENTS.struct[ARGUMENTS.name])>
<cfif NOT isValidX(ARGUMENTS.type, ARGUMENTS.struct[ARGUMENTS.name])>
<cfthrow type="invalidParamValue" message="Parameter validation failed" detail="Supplied value of '#ARGUMENTS.name#' is not a valid #ARGUMENTS.type#"/>
</cfif>
<cfelse>
@@ -434,7 +451,7 @@
<cfif structKeyExists(arguments.struct, arguments.key)>
<cfif structKeyExists(arguments, "type")>
<cfset var x=arguments.struct[arguments.key]/>
<cfif isValid(arguments.type, x)>
<cfif isValidX(arguments.type, x)>
<cfif lCase(arguments.type) EQ "string">
<cfif structKeyExists(arguments, "maxLength")>
<cfif ARGUMENTS.maxLength GE 0>