view src/global/web/Index.jtp @ 28:03e68185c2f5

block spam forums
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 02 Jul 2020 21:19:24 -0600
parents e0c501fb5229
children 5ea557eece1f
line wrap: on
line source

<%
package global.web;

import fschmidt.util.servlet.JtpContext;
import fschmidt.util.servlet.ServletUtils;
import global.HtmlGlobalUtils;
import global.Site;
import nabble.view.web.more.ForumStart;
import nabble.view.web.more.MailingListRequest;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.ScoreDoc;
import org.apache.lucene.search.TopDocs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;


public final class Index extends HttpServlet {

	private static final Logger logger = LoggerFactory.getLogger(Index.class);

//	private static boolean hasJobsAtNabble = Init.get("hasJobsAtNabble",false);

	public static String path() {
		return "/";
	}

	protected void service(HttpServletRequest request,HttpServletResponse response)
		throws ServletException, IOException
	{
		JtpContext jtpContext = (JtpContext)getServletContext().getAttribute(JtpContext.attrName);
		jtpContext.setEtag(request,response,"x");
		PrintWriter out = response.getWriter();
%>
<!DOCTYPE html>
<html lang="en">
	<head>
		<% HtmlGlobalUtils.head(request, response, "Free Forum &bull; Embeddable Web Apps"); %>
		<link rel="canonical" href="https://www.nabble.com/">
		<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." />
		<meta name="keywords" content="free forum, free mailing list, mailing list archive, free photo gallery, free newspaper, free blog, best forum, free message board, message board hosting, bulletin board, customizable, private forum, phpBB, vBulletin, hosted, communities">
		<meta name="google-site-verification" content="SUurO4gVJ46SZyzANkH4pJBGH8q-6Bv5P-ZgRBH8Cck" />
		<style>
			div[actions] i.fa.fa-chevron-right {
				color: #DDD;
				float: right;
			}
			a[fixed] {
				margin-top: -3em;
				position: absolute;
				right: 1em;
				text-decoration: none;
				background-color: #555;
				border-radius: .5em;
				padding: .5em;
				color: #D0D0D0;
				text-shadow: 0px 1px 1px black;
				border-bottom: 1px dotted #757474;
			}
			@media (max-width: 950px) {
				div[footer] {
					padding-bottom: 5em;
				}
			}
			div[note] {
				margin-top: 1em;
				text-align: right;
			}
		</style>
		<script async="true" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
		<script>
			 (adsbygoogle = window.adsbygoogle || []).push({
				  google_ad_client: "ca-pub-6750305871516672",
				  enable_page_level_ads: true
			 });
		</script>
	</head>
	<body lato>
		<% HtmlGlobalUtils.header(request,response); %>
		<div full>
			<div content center>
			<span style="display:inline-block">
				<div col1 center>
					<h1 oswald>Free Forum Hosting &amp; Online Web Apps!</h1>
					<h2 lato gray>Clean Look <span light>&bull;</span> Embeddable <span light>&bull;</span> Customizable</h2>
					<img src="/assets/images/home.png" alt="Free forum hosting and online embeddable apps"/>
				</div>
				<div col2 actions>
					<ul>
						<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>
						<li><a href="<%=HtmlGlobalUtils.nabbleContextUrl%><%=MailingListRequest.path()%>" title="Click to archive a mailing list">Archive Mailing List</a> <i class="fa fa-chevron-right"></i></li>
						<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>
						<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>
						<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>
					</ul>
				</div>
				<div note>
					To prevent spam, new forums and other apps will only be visible to registered users.
				</div>
			</span>
			</div>
			<div content paddingTop>
				<div col33 center>
					<h2 oswald>Multi Language</h2>
					<ul floating>
						<li>English</li>
						<li>Čeština (Czech Republic)</li>
						<li>Español</li>
						<li>Français</li>
						<li>Polski</li>
						<li>Português (Brasil)</li>
						<li>Svenska</li>
						<li>Türkçe</li>
						<li>Русский</li>
						<li>Ελληνικά</li>
						<li>中文 (简体)</li>
						<li><a href="http://support.nabble.com/Nabble-Translations-f6669344.html">Translate to other languages</a> &raquo;</li>
					</ul>
				</div>
				<div col33 center>
					<h2 oswald>Embed into any Website</h2>
					<p lineHeight marginHorizontal>All Nabble apps are naturally embeddable, which means that they can be easily displayed inside any web page.
					</p>
				</div>
				<div col33 center>
					<h2 oswald>Fully Customizable</h2>
					<p lineHeight marginHorizontal>All Nabble apps are built with NAML, a scripting language that gives you full control over the app pages.</p>
				</div>
			</div>
			<div content center paddingTop>
				<h2 oswald>Browse Active Nabble Apps</h2>
				<% topSites(out); %>
			</div>
		</div>
		<% HtmlGlobalUtils.footer(request,response); %>
<%/*%>
		<a fixed href="http://www.blasma.com">Help design a new forum <i class="fa fa-chevron-right"></i></a>
<%*/%>
	</body>
</html>
<%
	}

	static Query query = new TermQuery(new Term(Site.EMBARRASSING_FLD,"false"));

	private static void topSites(PrintWriter out)
		throws ServletException, IOException
	{
		IndexSearcher searcher;
		TopDocs hits;
		try {
			searcher = new IndexSearcher(Site.dir());
			hits = searcher.search( query, 60, Site.SORT_BY_VALUE );
		} catch(IOException e) {
			logger.error("Index error", e);
			%>[Rebuilding Index]<%
			return;
		}
		try {
			%>
			<ul floating center>
			<%
			for( ScoreDoc sd : hits.scoreDocs ) {
				Site site = new Site( searcher.doc(sd.doc) );
				%>
				<li><%=site.link()%></li>
				<%
			}
				%>
			</ul>
			<div style="padding-top:.5em;clear:both">
				<a bold href="<%=RootForums.path()%>" title="View more active forums and apps">View More</a></b> <i class="fa fa-chevron-right"></i>
			</div>
			<%
		} finally {
			searcher.close();
		}
	}

}
%>