Mercurial Hosting > nabble
annotate src/global/web/Index.jtp @ 66:3fbe9cb2e325 default tip
security
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 18 Sep 2024 03:51:47 -0600 |
parents | 4987e1a38a6c |
children |
rev | line source |
---|---|
0 | 1 <% |
2 package global.web; | |
3 | |
4 import fschmidt.util.servlet.JtpContext; | |
5 import fschmidt.util.servlet.ServletUtils; | |
6 import global.HtmlGlobalUtils; | |
7 import global.Site; | |
8 import nabble.view.web.more.ForumStart; | |
9 import org.apache.lucene.index.Term; | |
10 import org.apache.lucene.search.IndexSearcher; | |
11 import org.apache.lucene.search.TermQuery; | |
12 import org.apache.lucene.search.Query; | |
13 import org.apache.lucene.search.ScoreDoc; | |
14 import org.apache.lucene.search.TopDocs; | |
55 | 15 import org.apache.lucene.search.BooleanClause; |
16 import org.apache.lucene.search.BooleanQuery; | |
0 | 17 import org.slf4j.Logger; |
18 import org.slf4j.LoggerFactory; | |
19 | |
20 import javax.servlet.ServletException; | |
21 import javax.servlet.http.HttpServlet; | |
22 import javax.servlet.http.HttpServletRequest; | |
23 import javax.servlet.http.HttpServletResponse; | |
24 import java.io.IOException; | |
25 import java.io.PrintWriter; | |
26 | |
27 | |
28 public final class Index extends HttpServlet { | |
29 | |
30 private static final Logger logger = LoggerFactory.getLogger(Index.class); | |
31 | |
32 // private static boolean hasJobsAtNabble = Init.get("hasJobsAtNabble",false); | |
33 | |
34 public static String path() { | |
35 return "/"; | |
36 } | |
37 | |
38 protected void service(HttpServletRequest request,HttpServletResponse response) | |
39 throws ServletException, IOException | |
40 { | |
41 JtpContext jtpContext = (JtpContext)getServletContext().getAttribute(JtpContext.attrName); | |
42 jtpContext.setEtag(request,response,"x"); | |
43 PrintWriter out = response.getWriter(); | |
44 %> | |
45 <!DOCTYPE html> | |
46 <html lang="en"> | |
47 <head> | |
48 <% HtmlGlobalUtils.head(request, response, "Free Forum • Embeddable Web Apps"); %> | |
49 <link rel="canonical" href="https://www.nabble.com/"> | |
50 <meta name="description" content="Create a free forum online in less than one minute. All forums are embeddable and fully customizable with scripting language. Choose a unique style and build a discussion board for your community." /> | |
47
72765b66e2c3
remove mailing list code
Franklin Schmidt <fschmidt@gmail.com>
parents:
35
diff
changeset
|
51 <meta name="keywords" content="free forum, free photo gallery, free newspaper, free blog, best forum, free message board, message board hosting, bulletin board, customizable, private forum, phpBB, vBulletin, hosted, communities"> |
0 | 52 <meta name="google-site-verification" content="SUurO4gVJ46SZyzANkH4pJBGH8q-6Bv5P-ZgRBH8Cck" /> |
53 <style> | |
21 | 54 div[actions] i.fa.fa-chevron-right { |
55 color: #DDD; | |
56 float: right; | |
57 } | |
58 a[fixed] { | |
59 margin-top: -3em; | |
60 position: absolute; | |
61 right: 1em; | |
62 text-decoration: none; | |
63 background-color: #555; | |
64 border-radius: .5em; | |
65 padding: .5em; | |
66 color: #D0D0D0; | |
67 text-shadow: 0px 1px 1px black; | |
68 border-bottom: 1px dotted #757474; | |
69 } | |
70 @media (max-width: 950px) { | |
71 div[footer] { | |
72 padding-bottom: 5em; | |
73 } | |
74 } | |
75 div[note] { | |
76 margin-top: 1em; | |
77 text-align: right; | |
78 } | |
0 | 79 </style> |
80 </head> | |
81 <body lato> | |
82 <% HtmlGlobalUtils.header(request,response); %> | |
83 <div full> | |
21 | 84 <div content center> |
85 <span style="display:inline-block"> | |
0 | 86 <div col1 center> |
87 <h1 oswald>Free Forum Hosting & Online Web Apps!</h1> | |
88 <h2 lato gray>Clean Look <span light>•</span> Embeddable <span light>•</span> Customizable</h2> | |
89 <img src="/assets/images/home.png" alt="Free forum hosting and online embeddable apps"/> | |
90 </div> | |
91 <div col2 actions> | |
92 <ul> | |
93 <li><a href="<%=HtmlGlobalUtils.nabbleContextUrl%><%=ForumStart.path("forum")%>" title="Click to create a free forum">Create Free Forum</a> <i class="fa fa-chevron-right"></i></li> | |
94 <li><a href="<%=HtmlGlobalUtils.nabbleContextUrl%><%=ForumStart.path("gallery")%>" title="Click to create a free photo gallery">Create Photo Gallery</a> <i class="fa fa-chevron-right"></i></li> | |
95 <li><a href="<%=HtmlGlobalUtils.nabbleContextUrl%><%=ForumStart.path("newspaper")%>" title="Click to create a free newspaper">Create News Site</a> <i class="fa fa-chevron-right"></i></li> | |
96 <li><a href="<%=HtmlGlobalUtils.nabbleContextUrl%><%=ForumStart.path("blog")%>" title="Click to create a free blog">Create Blog</a> <i class="fa fa-chevron-right"></i></li> | |
97 </ul> | |
98 </div> | |
21 | 99 </span> |
0 | 100 </div> |
101 <div content paddingTop> | |
102 <div col33 center> | |
103 <h2 oswald>Multi Language</h2> | |
104 <ul floating> | |
105 <li>English</li> | |
106 <li>Čeština (Czech Republic)</li> | |
107 <li>Español</li> | |
108 <li>Français</li> | |
109 <li>Polski</li> | |
110 <li>Português (Brasil)</li> | |
111 <li>Svenska</li> | |
112 <li>Türkçe</li> | |
113 <li>Русский</li> | |
114 <li>Ελληνικά</li> | |
115 <li>中文 (简体)</li> | |
116 <li><a href="http://support.nabble.com/Nabble-Translations-f6669344.html">Translate to other languages</a> »</li> | |
117 </ul> | |
118 </div> | |
119 <div col33 center> | |
120 <h2 oswald>Embed into any Website</h2> | |
121 <p lineHeight marginHorizontal>All Nabble apps are naturally embeddable, which means that they can be easily displayed inside any web page. | |
122 </p> | |
123 </div> | |
124 <div col33 center> | |
125 <h2 oswald>Fully Customizable</h2> | |
126 <p lineHeight marginHorizontal>All Nabble apps are built with NAML, a scripting language that gives you full control over the app pages.</p> | |
127 </div> | |
128 </div> | |
129 <div content center paddingTop> | |
130 <h2 oswald>Browse Active Nabble Apps</h2> | |
131 <% topSites(out); %> | |
132 </div> | |
133 </div> | |
134 <% HtmlGlobalUtils.footer(request,response); %> | |
135 <%/*%> | |
136 <a fixed href="http://www.blasma.com">Help design a new forum <i class="fa fa-chevron-right"></i></a> | |
137 <%*/%> | |
138 </body> | |
139 </html> | |
140 <% | |
141 } | |
142 | |
55 | 143 static BooleanQuery query = new BooleanQuery(); |
144 static { | |
145 query.add(new TermQuery(new Term(Site.EMBARRASSING_FLD,"false")), BooleanClause.Occur.MUST); | |
146 query.add(new TermQuery(new Term(Site.PRIVATE_FLD,"false")), BooleanClause.Occur.MUST); | |
147 } | |
0 | 148 |
149 private static void topSites(PrintWriter out) | |
150 throws ServletException, IOException | |
151 { | |
152 IndexSearcher searcher; | |
153 TopDocs hits; | |
154 try { | |
155 searcher = new IndexSearcher(Site.dir()); | |
53 | 156 hits = searcher.search( query, 60, Site.SORT_BY_ACTIVITY ); |
0 | 157 } catch(IOException e) { |
158 logger.error("Index error", e); | |
159 %>[Rebuilding Index]<% | |
160 return; | |
161 } | |
162 try { | |
163 %> | |
164 <ul floating center> | |
165 <% | |
166 for( ScoreDoc sd : hits.scoreDocs ) { | |
167 Site site = new Site( searcher.doc(sd.doc) ); | |
168 %> | |
169 <li><%=site.link()%></li> | |
170 <% | |
171 } | |
172 %> | |
173 </ul> | |
174 <div style="padding-top:.5em;clear:both"> | |
175 <a bold href="<%=RootForums.path()%>" title="View more active forums and apps">View More</a></b> <i class="fa fa-chevron-right"></i> | |
176 </div> | |
177 <% | |
178 } finally { | |
179 searcher.close(); | |
180 } | |
181 } | |
182 | |
183 } | |
184 %> |