forked from cfjedimaster/ColdFusion-Blog-Aggregator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stats.cfm
105 lines (94 loc) · 2.44 KB
/
stats.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<cfprocessingdirective pageencoding="utf-8">
<!---
Name : stats.cfm
Author : Raymond Camden
Created : July 29, 2007
Last Updated : July 29, 2007
History :
Purpose : The stats page.
--->
<cfset topsearches = application.entries.getTopSearches()>
<!---
Removed because people are stupid freaking idiots.
<cfset lastsearches = application.entries.getLastSearches()>
--->
<cfset onedayago = dateAdd("d", -1, now())>
<cfset topentries = application.entries.getTopEntries(onedayago)>
<cfif structKeyExists(url, "format") and url.format eq "json">
<cfset packet = [] />
<cfloop query="topentries">
<cfset arrayAppend(packet, {
title = topentries.title,
url = topentries.blogurl,
clicks = numberformat(topentries.total)
}) />
</cfloop>
<cfcontent type="application/json" reset="true" /><cfoutput>#serializeJson(packet)#</cfoutput><cfabort/>
</cfif>
<cf_layout title="#application.siteTitle# - Stats">
<h2>Stats</h2>
<cflayout type="tab" style="margin-left: 10px;" align="center">
<cflayoutarea title="Top Entries">
<p>
These are the top entries by click throughs over the past 24 hours.
</p>
<p>
<table border="1" width="90%">
<tr>
<th>Entry</th><th>Blog</th><th>Total</th>
</tr>
<cfoutput query="topentries">
<tr>
<td width="45%"><a href="#topentries.url#">#title#</a></td>
<td width="45%"><a href="#blogurl#">#blog#</a></td>
<td width="10%" align="center">#numberFormat(total)#</td>
</tr>
</cfoutput>
</table>
</p>
<br />
</cflayoutarea>
<!---
<cflayoutarea title="Top Searches">
<p>
These are the top ten searches on ColdFusionBloggers.org.
</p>
<p>
<table border="1" width="90%">
<tr>
<th>Search Term</th><th>Total</th>
</tr>
<cfoutput query="topsearches">
<tr>
<td width="90%"><a href="index.cfm?search_query=#urlEncodedFormat(searchterm)#">#searchterm#</a></td>
<td width="10%" align="center">#numberFormat(total)#</td>
</tr>
</cfoutput>
</table>
</p>
<br />
</cflayoutarea>
--->
<!---
<cflayoutarea title="Last Searches">
<p>
These are the last ten searches on ColdFusionBloggers.org.
</p>
<p>
<table border="1" width="90%">
<tr>
<th>Search Term</th>
</tr>
<cfoutput query="lastsearches">
<tr>
<td width="100%"><a href="index.cfm?search_query=#urlEncodedFormat(searchterm)#">#searchterm#</a></td>
</tr>
</cfoutput>
</table>
</p>
<br />
</cflayoutarea>
--->
</cflayout>
<p />
</cf_layout>