Skip to content

Commit 3fa39e9

Browse files
committed
Merge branch 'development'
2 parents 67c0007 + c7a7847 commit 3fa39e9

File tree

12 files changed

+129
-114
lines changed

12 files changed

+129
-114
lines changed

.cflintrc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
{
22
"rule": [],
33
"includes": [
4-
{ "code": "AVOID_USING_STRUCTNEW" },
5-
{ "code": "AVOID_USING_ARRAYNEW" },
64
{ "code": "AVOID_USING_CFINCLUDE_TAG" },
75
{ "code": "AVOID_USING_CFABORT_TAG" },
86
{ "code": "AVOID_USING_CFEXECUTE_TAG" },
97
{ "code": "AVOID_USING_DEBUG_ATTR" },
10-
{ "code": "AVOID_USING_CREATEOBJECT" },
118
{ "code": "AVOID_USING_ABORT" },
129
{ "code": "AVOID_USING_ISDATE" },
1310
{ "code": "AVOID_USING_ISDEBUGMODE" },
@@ -41,7 +38,6 @@
4138
{ "code": "FUNCTION_HINT_MISSING" },
4239
{ "code": "FILE_SHOULD_START_WITH_LOWERCASE" },
4340
{ "code": "LOCAL_LITERAL_VALUE_USED_TOO_OFTEN" },
44-
{ "code": "GLOBAL_VAR" },
4541
{ "code": "GLOBAL_LITERAL_VALUE_USED_TOO_OFTEN" },
4642
{ "code": "MISSING_VAR" },
4743
{ "code" : "METHOD_INVALID_NAME" },
@@ -57,8 +53,7 @@
5753
{ "code": "SCOPE_ALLCAPS_NAME" },
5854
{ "code": "VAR_ALLCAPS_NAME" },
5955
{ "code": "VAR_INVALID_NAME" },
60-
{ "code": "VAR_TOO_WORDY" },
61-
{ "code": "VAR_IS_TEMPORARY" }
56+
{ "code": "VAR_TOO_WORDY" }
6257
],
6358
"inheritParent": false,
6459
"parameters": {

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ notifications:
77

88
env:
99
global:
10-
- COLDBOX_VERSION=5.1.2
10+
- COLDBOX_VERSION=5.2.0
1111
matrix:
1212
- ENGINE=lucee@4.5 ANT_TARGET=build.all
1313
- ENGINE=lucee@5 ANT_TARGET=run-tests

build/build.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
<!-- UPDATE ON EACH VERSION CYCLE -->
1212
<property name="groupID" value="ortussolutions" />
1313

14-
<property name="coldbox.version" value="5.1.2" />
15-
<property name="coldbox.stableversion" value="5.1.1" />
14+
<property name="coldbox.version" value="5.2.0" />
15+
<property name="coldbox.stableversion" value="5.1.2" />
1616

1717
<property name="coldbox.slug" value="coldbox"/>
1818
<property name="cachebox.slug" value="cachebox"/>

system/core/util/Util.cfc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ Description :
2626
<cfargument name="in" type="array" required="true" hint="The array to convert"/>
2727
<cfscript>
2828
return arguments.in.reduce( function( result, item, index ){
29-
var target = result ?: structNew();
29+
var target = {};
30+
if( !isNull( result ) ){
31+
target = result;
32+
}
3033
target[ index ] = item;
3134
return target;
3235
} );

system/logging/LogBox.cfc

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212
component accessors="true"{
1313

14-
14+
1515
/**
1616
* The LogBox unique ID
1717
*/
@@ -21,12 +21,12 @@ component accessors="true"{
2121
* The LogBox operating version
2222
*/
2323
property name="version";
24-
24+
2525
/**
2626
* The appender registration map
2727
*/
2828
property name="appenderRegistry" type="struct";
29-
29+
3030
/**
3131
* The Logger registration map
3232
*/
@@ -67,7 +67,7 @@ component accessors="true"{
6767
variables.categoryAppenders = "";
6868
// Version
6969
variables.version = "@build.version@+@build.number@";
70-
70+
7171
// Link incoming ColdBox argument
7272
variables.coldbox = arguments.coldbox;
7373

@@ -79,7 +79,7 @@ component accessors="true"{
7979

8080
/**
8181
* Configure logbox for operation. You can also re-configure LogBox programmatically. Basically we register all appenders here and all categories
82-
*
82+
*
8383
* @config The LogBoxConfig object to use to configure this instance of LogBox: coldbox.system.logging.config.LogBoxConfig
8484
* @config.doc_generic coldbox.system.logging.config.LogBoxConfig
8585
*/
@@ -109,7 +109,7 @@ component accessors="true"{
109109
levelMax = rootConfig.levelMax,
110110
appenders = getAppendersMap( rootConfig.appenders )
111111
};
112-
112+
113113
//Save in Registry
114114
variables.loggerRegistry = {
115115
"ROOT" = new coldbox.system.logging.Logger( argumentCollection=args )
@@ -119,7 +119,7 @@ component accessors="true"{
119119

120120
/**
121121
* Get the root logger object
122-
*
122+
*
123123
* @return coldbox.system.logging.Logger
124124
*/
125125
function getRootLogger(){
@@ -128,16 +128,16 @@ component accessors="true"{
128128

129129
/**
130130
* Get a logger object configured with a category name and appenders. If not configured, then it reverts to the root logger defined for this instance of LogBox
131-
*
131+
*
132132
* @category The category name to use in this logger or pass in the target object will log from and we will inspect the object and use its metadata name
133-
*
133+
*
134134
* @return coldbox.system.logging.Logger
135135
*/
136136
function getLogger( required category ){
137137
var root = getRootLogger();
138138

139139
// is category object?
140-
if( isObject( arguments.category ) ){
140+
if( isObject( arguments.category ) ){
141141
arguments.category = getMetadata( arguments.category ).name;
142142
}
143143

@@ -202,7 +202,7 @@ component accessors="true"{
202202

203203
/**
204204
* Register a new appender object in the appender registry.
205-
*
205+
*
206206
* @name A unique name for the appender to register. Only unique names can be registered per variables.
207207
* @class The appender's class to register. We will create, init it and register it for you.
208208
* @properties The structure of properties to configure this appender with.
@@ -222,9 +222,9 @@ component accessors="true"{
222222
if( !structKeyExists( variables.appenderRegistry, arguments.name ) ){
223223

224224
lock name="#variables.logboxID#.registerappender.#name#" type="exclusive" timeout="15" throwOnTimeout="true"{
225-
225+
226226
if( !structKeyExists( variables.appenderRegistry, arguments.name ) ){
227-
227+
228228
// Create appender and linking
229229
var oAppender = new "#arguments.class#"( argumentCollection=arguments );
230230
oAppender.setColdBox( variables.coldbox );
@@ -247,7 +247,7 @@ component accessors="true"{
247247

248248
/**
249249
* Get a parent logger according to category convention inheritance. If not found, it returns the root logger.
250-
*
250+
*
251251
* @category The category name to investigate for parents
252252
*/
253253
private function locateCategoryParentLogger( required category ){
@@ -278,20 +278,24 @@ component accessors="true"{
278278

279279
/**
280280
* Get a map of appenders by list. Usually called to get a category of appenders
281-
*
281+
*
282282
* @appenders The list of appenders to get
283283
*/
284284
struct function getAppendersMap( required appenders ){
285285
var results = arguments.appenders
286286
.listToArray()
287287
.reduce( function( result, item, index ){
288-
var target = result ?: structNew();
288+
var target = {};
289+
if( !isNull( arguments.result ) ){
290+
target = result;
291+
}
289292
target[ item ] = variables.appenderRegistry[ item ];
290293
return target;
291294
} );
292-
return results ?: structnew();
295+
296+
return ( isNull( results ) ? structNew() : results );
293297
}
294-
298+
295299
/**
296300
* Get Utility Object
297301
*/

system/modules/HTMLHelper/models/HTMLHelper.cfc

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ component extends="coldbox.system.FrameworkSupertype" accessors=true singleton{
118118
// Load Asset
119119
if( findNoCase( ".js", item ) ){
120120
sb.append(
121-
'<script src="#jsPath##item#" #asyncStr##deferStr#></script>'
121+
'<script src="#jsPath##encodeForHTMLAttribute( item )#" #asyncStr##deferStr#></script>'
122122
);
123123
} else {
124124
sb.append(
125-
'<link href="#cssPath##item#" type="text/css" rel="stylesheet" />'
125+
'<link href="#cssPath##encodeForHTMLAttribute( item )#" type="text/css" rel="stylesheet" />'
126126
);
127127
}
128128

@@ -619,15 +619,15 @@ component extends="coldbox.system.FrameworkSupertype" accessors=true singleton{
619619
// Add single source
620620
if( arrayLen(arguments.src) eq 1){
621621
arguments.src[1] = prepareBaseLink(arguments.noBaseURL, arguments.src[1]);
622-
video.append(' src="#arguments.src[1]#" />');
622+
video.append(' src="#encodeForHTMLAttribute( arguments.src[ 1 ] )#" />');
623623
return video.toString();
624624
}
625625

626626
// create source tags
627627
video.append(">");
628628
for(x=1; x lte arrayLen(arguments.src); x++){
629629
arguments.src[ x ] = prepareBaseLink(arguments.noBaseURL, arguments.src[ x ]);
630-
video.append('<source src="#arguments.src[ x ]#"/>');
630+
video.append('<source src="#encodeForHTMLAttribute( arguments.src[ x ] )#"/>');
631631
}
632632
video.append("</video>");
633633

@@ -684,15 +684,15 @@ component extends="coldbox.system.FrameworkSupertype" accessors=true singleton{
684684
// Add single source
685685
if( arrayLen(arguments.src) eq 1){
686686
arguments.src[1] = prepareBaseLink(arguments.noBaseURL, arguments.src[1]);
687-
audio.append(' src="#arguments.src[1]#" />');
687+
audio.append(' src="#encodeForHTMLAttribute( arguments.src[1] )#" />');
688688
return audio.toString();
689689
}
690690

691691
// create source tags
692692
audio.append(">");
693693
for(x=1; x lte arrayLen(arguments.src); x++){
694694
arguments.src[ x ] = prepareBaseLink(arguments.noBaseURL, arguments.src[ x ]);
695-
audio.append('<source src="#arguments.src[ x ]#"/>');
695+
audio.append('<source src="#encodeForHTMLAttribute( arguments.src[ x ] )#"/>');
696696
}
697697
audio.append("</audio>");
698698

@@ -964,7 +964,7 @@ component extends="coldbox.system.FrameworkSupertype" accessors=true singleton{
964964

965965
// create textarea
966966
buffer.append("<textarea");
967-
flattenAttributes(arguments,"value,label,wrapper,labelWrapper,groupWrapper,labelAttrs,labelClass,bind,bindProperty,inputInsideLabel",buffer).append(">#arguments.value#</textarea>");
967+
flattenAttributes(arguments,"value,label,wrapper,labelWrapper,groupWrapper,labelAttrs,labelClass,bind,bindProperty,inputInsideLabel",buffer).append(">#encodeForHTML( arguments.value )#</textarea>");
968968

969969
//wrapper?
970970
wrapTag(buffer,arguments.wrapper,1);
@@ -2348,7 +2348,10 @@ component extends="coldbox.system.FrameworkSupertype" accessors=true singleton{
23482348
var key = "";
23492349

23502350
// Metadata
2351-
var firstMetadata = getMetadata( arguments.data[ 1 ] ?: {} );
2351+
var firstMetadata = {};
2352+
if( !isNull( arguments.data[ 1 ] ) ){
2353+
firstMetadata = getMetadata( arguments.data[ 1 ] );
2354+
}
23522355
// All properties
23532356
var properties = structKeyExists( firstMetadata, "properties" ) ? firstMetadata.properties : [];
23542357
// Filtered properties
@@ -2398,7 +2401,9 @@ component extends="coldbox.system.FrameworkSupertype" accessors=true singleton{
23982401
required buffer
23992402
){
24002403
// Guess columns from first struct found
2401-
var columns = structKeyArray( data[ 1 ] ?: {} )
2404+
var thisData = ( isNull( data[ 1 ] ) ? structNew() : data[ 1 ] );
2405+
2406+
var columns = structKeyArray( thisData )
24022407
.filter( function( item ){
24032408
return ( passIncludeExclude( item, includes, excludes ) );
24042409
} );

system/remote/RemotingUtil.cfc

Lines changed: 40 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,45 @@
1-
<!-----------------------------------------------------------------------
2-
********************************************************************************
3-
Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
4-
www.ortussolutions.com
5-
********************************************************************************
1+
/**
2+
* Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
3+
* www.ortussolutions.com
4+
* ---
5+
* @author Luis Majano <lmajano@ortussolutions.com>
6+
* Remoting Utility
7+
*/
8+
component{
69

7-
Author : Luis Majano
8-
Description :
9-
A cool remoting utililty component
10-
----------------------------------------------------------------------->
11-
<cfcomponent output="false" hint="A cool remoting utililty component" >
12-
13-
<!---
10+
/*
1411
Based on original function by Elliot Sprehn, found here
1512
http://livedocs.adobe.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=ColdFusion_Documentation&file=00000271.htm
1613
by Chris Blackwell
17-
--->
18-
<cffunction name="clearHeaderBuffer" output="false" access="public" returntype="void" hint="Clear the CFHTMLHead buffer">
19-
<cfset var my = structnew() />
20-
21-
<cfswitch expression="#trim(server.coldfusion.productname)#">
22-
23-
<cfcase value="ColdFusion Server">
24-
<cfset my.out = getPageContext().getOut() />
25-
26-
<!--- It's necessary to iterate over this until we get to a coldfusion.runtime.NeoJspWriter --->
27-
<cfloop condition="getMetaData(my.out).getName() is 'coldfusion.runtime.NeoBodyContent'">
28-
<cfset my.out = my.out.getEnclosingWriter() />
29-
</cfloop>
30-
31-
<cfset my.method = my.out.getClass().getDeclaredMethod("initHeaderBuffer", arrayNew(1)) />
32-
<cfset my.method.setAccessible(true) />
33-
<cfset my.method.invoke(my.out, arrayNew(1)) />
34-
35-
</cfcase>
36-
37-
38-
<cfcase value="Lucee">
39-
40-
<cfset my.out = getPageContext().getOut() />
41-
42-
<cfloop condition="getMetaData(my.out).getName() is 'lucee.runtime.writer.BodyContentImpl'">
43-
<cfset my.out = my.out.getEnclosingWriter() />
44-
</cfloop>
45-
46-
<cfset my.headData = my.out.getClass().getDeclaredField("headData") />
47-
<cfset my.headData.setAccessible(true) />
48-
<cfset my.headData.set(my.out, createObject("java", "java.lang.String").init("")) />
49-
50-
</cfcase>
51-
52-
</cfswitch>
53-
</cffunction>
14+
*/
5415

55-
</cfcomponent>
16+
/**
17+
* Clear the CFHTMLHead buffer
18+
*/
19+
void function clearHeaderBuffer(){
20+
var my = {};
21+
22+
switch ( trim( server.coldfusion.productname ) ) {
23+
case "ColdFusion Server" :
24+
my.out = getPageContext().getOut();
25+
// It's necessary to iterate over this until we get to a coldfusion.runtime.NeoJspWriter
26+
while( condition="getMetaData( my.out ).getName() == 'coldfusion.runtime.NeoBodyContent'" ) {
27+
my.out = my.out.getEnclosingWriter();
28+
}
29+
my.method = my.out.getClass().getDeclaredMethod( "initHeaderBuffer", [] );
30+
my.method.setAccessible( true );
31+
my.method.invoke( my.out, [] );
32+
break;
33+
case "Lucee" :
34+
my.out = getPageContext().getOut();
35+
while ( condition="getMetaData( my.out ).getName() == 'lucee.runtime.writer.BodyContentImpl'" ) {
36+
my.out = my.out.getEnclosingWriter();
37+
}
38+
my.headData = my.out.getClass().getDeclaredField( "headData" );
39+
my.headData.setAccessible( true );
40+
my.headData.set( my.out, createObject( "java", "java.lang.String" ).init( "" ) );
41+
break;
42+
}
43+
}
44+
45+
}

0 commit comments

Comments
 (0)