aboutsummaryrefslogtreecommitdiff
path: root/src/java/com/juick/http/www/Home.java
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2014-01-27 05:59:17 +0700
committerGravatar Ugnich Anton2014-01-27 05:59:17 +0700
commit3b388f8b3add54e794bd37172a6973e69a55778d (patch)
tree557ad56c8544302dfb97ef6cb2dbfff0e3582430 /src/java/com/juick/http/www/Home.java
parenta5b5fe42c3ccef860ac56527dfcb79a3a0ecbfa4 (diff)
- discover, pageHomeColumn
Diffstat (limited to 'src/java/com/juick/http/www/Home.java')
-rw-r--r--src/java/com/juick/http/www/Home.java33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/java/com/juick/http/www/Home.java b/src/java/com/juick/http/www/Home.java
index 2705d953..8bf30af5 100644
--- a/src/java/com/juick/http/www/Home.java
+++ b/src/java/com/juick/http/www/Home.java
@@ -23,6 +23,7 @@ import com.juick.server.MessagesQueries;
import com.juick.server.PMQueries;
import java.io.IOException;
import java.io.PrintWriter;
+import java.net.URLEncoder;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Locale;
@@ -50,11 +51,19 @@ public class Home {
}
}
+ String paramSearch = request.getParameter("search");
+ if (paramSearch != null && paramSearch.length() > 64) {
+ paramSearch = null;
+ }
+
String title;
ArrayList<Integer> mids;
String paramShow = request.getParameter("show");
- if (paramShow == null || paramShow.equals("my")) {
+ if (paramSearch != null) {
+ title = rb.getString("Search") + ": " + Utils.encodeHTML(paramSearch);
+ mids = MessagesQueries.getSearch(sql, sqlSearch, Utils.encodeSphinx(paramSearch), paramBefore);
+ } else if (paramShow == null || paramShow.equals("my")) {
title = rb.getString("My feed");
mids = MessagesQueries.getMyFeed(sql, visitor.UID, paramBefore);
} else if (paramShow.equals("private")) {
@@ -69,6 +78,9 @@ public class Home {
} else if (paramShow.equals("top")) {
title = rb.getString("Popular");
mids = MessagesQueries.getPopular(sql, paramBefore);
+ } else if (paramShow.equals("all")) {
+ title = rb.getString("Last messages");
+ mids = MessagesQueries.getAll(sql, visitor.UID, paramBefore);
} else {
response.sendError(404);
return;
@@ -96,7 +108,7 @@ public class Home {
if (mids.size() > 0) {
int ad_mid = 0;
- if (paramShow == null || paramShow.equals("top")) {
+ if (paramShow == null || paramShow.equals("top") || paramShow.equals("all")) {
ad_mid = AdsQueries.getAdMID(sql, visitor.UID);
if (ad_mid > 0 && mids.indexOf(ad_mid) == -1) {
@@ -117,24 +129,17 @@ public class Home {
if (paramShow != null) {
nextpage += "&amp;show=" + paramShow;
}
+ if (paramSearch != null) {
+ nextpage += "&amp;search=" + URLEncoder.encode(paramSearch, "UTF-8");
+ }
+
out.println("<p class=\"page\"><a href=\"" + nextpage + "\">Older →</a></p>");
}
PageTemplates.pageFooter(request, out, locale, visitor, true);
out.println("</div>");
out.println("</div>"); // wrapper
-
- out.println("<div id=\"column\" class=\"abs\">");
- out.println(" <ul>");
- out.println(" <li><a href=\"/\">" + rb.getString("My feed") + "</a></li>");
- out.println(" <li><a href=\"/?show=private\">" + rb.getString("Private") + "</a></li>");
- out.println(" <li><a href=\"/?show=discuss\">" + rb.getString("Discussions") + "</a></li>");
- out.println(" <li><a href=\"/?show=recommended\">" + rb.getString("Recommended") + "</a></li>");
- out.println(" <li class=\"margtop\"><a href=\"/?show=top\">" + rb.getString("Popular") + "</a></li>");
- out.println(" </ul>");
- out.println(" <hr/>");
- out.println(" <ul id=\"pmulist\"></ul>");
- out.println("</div>");
+ PageTemplates.pageHomeColumn(out, sql, locale);
out.println("</div>"); // topwrapper