function isLoggedOn() {
return getAuthUser() neq "";
}
request.udf.isLoggedOn = isLoggedOn;
/**
* Tests passed value to see if it is a valid e-mail address (supports subdomain nesting and new top-level domains).
* Update by David Kearns to support '
* SBrown@xacting.com pointing out regex still wasn't accepting ' correctly.
*
* @param str The string to check. (Required)
* @return Returns a boolean.
* @author Jeff Guillaume (jeff@kazoomis.com)
* @version 2, August 15, 2002
*/
function IsEmail(str) {
//supports new top level tlds
if (REFindNoCase("^['_a-z0-9-]+(\.['_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.(([a-z]{2,3})|(aero|coop|info|museum|name))$",str)) return TRUE;
else return FALSE;
}
request.udf.isEmail = isEmail;
function isValidUsername(str) {
if(reFindNoCase("[^a-z0-9]",str)) return false;
return true;
}
request.udf.isValidUsername = isValidUsername;
function cleanStruct(s) {
var key = "";
for(key in s) {
s[key] = trim(htmlEditFormat(s[key]));
}
return s;
}
request.udf.cleanStruct = cleanStruct;
/**
* Returns a XHTML compliant string wrapped with properly formatted paragraph tags.
*
* @param string String you want XHTML formatted.
* @param attributeString Optional attributes to assign to all opening paragraph tags (i.e. style=""font-family: tahoma"").
* @return Returns a string.
* @author Jeff Howden (jeff@members.evolt.org)
* @version 1.1, January 10, 2002
*/
function XHTMLParagraphFormat(string) {
var attributeString = '';
var returnValue = '';
//added by me to support different line breaks
string = replace(string, chr(10) & chr(10), chr(13) & chr(10), "all");
if(ArrayLen(arguments) GTE 2) attributeString = ' ' & arguments[2];
if(Len(Trim(string)))
returnValue = '' & Replace(string, Chr(13) & Chr(10), '
' & Chr(13) & Chr(10) & '', 'ALL') & '
';
return returnValue;
}
request.udf.XHTMLParagraphFormat = XHTMLParagraphFormat;
function arrayDefinedAt(arr,pos) {
var temp = "";
try {
temp = arr[pos];
return true;
}
catch(coldfusion.runtime.UndefinedElementException ex) {
return false;
}
catch(coldfusion.runtime.CfJspPage$ArrayBoundException ex) {
return false;
}
}
request.udf.arrayDefinedAt = arrayDefinedAt;