Hi guys,
I went through a big script that I had (well, it was about 2,000
lines) and I figured out which chunks I think should be UDF's and
included in a CFC, and left what is unique to the script alone. I had
to rework some things, but here's what I ended up with.
Assuming the business logic is right, and everything works as I want
it to, does anybody see any red flags? This chunk of code runs when a
404 error is generated. It parses the requested url, breaks it into
domain/subfolder, and determines if there is a match in my redirect
table. aka is details.at/openbd a legit 404, or is there a listed
redirect for that? ie details.at/openbd should forward to openbd.org
There's a few types of matches, and if any of them match, it reacts
accordingly.
<!-- begin-->
<cfinvoke
component="admin.cfc.dns"
method="dnsParseURL"
returnvariable="dnsParseURL"
url="#cgi.server_name#"
/>
<cfinvoke
component="admin.cfc.dns"
method="dnsLookup"
returnvariable="dnsLookup"
domain="#dnsParseURL.domain#"
subfolder="#dnsParseURL.subFolder#"
/>
<cfif dnsLookup.recordcount eq 1>
<cfif dnsParseURL.displayInfo eq "yes">
<cflocation
url="http://details.at/dns/dnsStats.cfm?domain=#dnsParseURL.domain#&subFolder=#dnsParseURL.subFolder#&graph=now">
<cfelse>
<cfinvoke component="admin.cfc.dns"
method="dnsLookupUserIDxURL"
returnvariable="dnsLookupUserIDxURL"
subFolder="#dnsParseURL.subFolder#"
/>
<cfinvoke component="admin.cfc.dns"
method="dnsUpdateStats"
returnvariable="dnsUpdateStatsURL"
dnsID="#dnsLookup.dnsID#"
referer="#cgi.http_referer#"
browser="#cgi.http_user_agent#"
/>
<cfif dnsLookupUserIDxURL.recordCount eq 1 and
"#dnsParseURL.domain#" eq "#hOST#">
<cfinvoke component="admin.cfc.dns"
method="dnsCheckUserURLStatus"
returnvariable="dnsCheckUserURLStatus"
userID="#dnsLookupUserIDxURL.userID#"
/>
<cfif dnsCheckUserURLStatus.status eq 1>
<cflocation
url="http://#host#/users/users.cfm?q=mpv1&url=#dnsParseURL.subFolder#">
<cfelseif dnsCheckUserURLStatus.status eq 2>
<cflocation
url="http://#host#/users/users.cfm?q=miv1&name=#dnsParseURL.subFolder#">
<cfelseif dnsCheckUserURLStatus.status eq 3>
<cfinvoke component="admin.cfc.pages"
method="userProfilePageIDLookup"
returnvariable="userProfilePageIDLookup"
userID="#dnsLookupUserIDxURL.userID#"
/>
<cfif userProfilePageIDLookup.recordCount eq 1>
<cflocation
url="http://#host#/pages.cfm?p=#userProfilePageIDLookup.pageID#">
<cfelse>
<cflocation
url="http://#host#/users/users.cfm?q=mpv1&url=#dnsParseURL.subFolder#">
</cfif>
<cfelseif dnsCheckUserURLStatus.status eq 4>
<cflocation url="#dnsLookup.dnsRedirectURL#">
</cfif>
<cfelse>
<cfif dnsLookup.dnsStatus eq 1>
<cflocation url="#dnsLookup.dnsRedirectURL#">
</cfif>
</cfif>
</cfif>
<cfelse>
</cfif>
<!--- end --->
--
online documentation: http://openbd.org/manual/
http://groups.google.com/group/openbd?hl=en