-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathfileDisplay.cfm
41 lines (32 loc) · 1.27 KB
/
fileDisplay.cfm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<cfif structKeyExists(URL,"fileName")>
<cffile action="read" file="#URL.fileName#" variable="fileContent" />
<cfparam name="url.lines" default="" >
<cfsetting enablecfoutputonly="true">
<cfoutput><pre></cfoutput>
<cfset totalLines = 0 />
<cfset lineCheckLine = 1 />
<cfset lastLineStart = 1 />
<cfset hasMoreLines = true />
<cfloop condition="hasMoreLines EQ true">
<cfset lineFeedArray = REFind("#chr(13)#?#chr(10)#",fileContent,lineCheckLine,true) />
<cfif lineFeedArray.POS[1] EQ 0>
<cfset hasMoreLines = false />
<cfelse>
<cfset totalLines = totalLines + 1 />
<cfset lineCheckLine = lineFeedArray.POS[1] + lineFeedArray.LEN[1] />
</cfif>
<cfif lineFeedArray.POS[1] -lastLineStart GT 0>
<cfset highlightLine = false >
<cfif listFind(url.lines, totalLines) >
<cfset highlightLine = true >
<cfoutput><b><font color="red"></cfoutput>
</cfif>
<cfoutput><a name="line#totalLines#">#totalLines#: #HTMLEditFormat(mid(fileContent,lastLineStart + 2,lineFeedArray.POS[1] -lastLineStart))#</cfoutput>
<cfif highlightLine >
<cfoutput></font></b></cfoutput>
</cfif>
</cfif>
<cfset lastLineStart = lineFeedArray.POS[1] />
</cfloop>
<cfoutput></pre></cfoutput>
</cfif>