From 34da94d887ae7be134d17c4bc9e101a8c198b300 Mon Sep 17 00:00:00 2001 From: Ugnich Anton Date: Mon, 20 Feb 2012 21:38:29 +0700 Subject: Bugfixes --- nbproject/project.properties | 1 + src/java/Global.properties | 4 +++ src/java/Global_ru.properties | 4 +++ src/java/com/juick/http/www/Blogs.java | 36 ++++++++++++++++++------ src/java/com/juick/http/www/Login.java | 4 +-- src/java/com/juick/http/www/Main.java | 2 +- src/java/com/juick/http/www/NewMessage.java | 12 ++++++-- src/java/com/juick/http/www/PageTemplates.java | 13 ++++++--- src/java/com/juick/http/www/UserThread.java | 38 ++++++++++++++++++++------ web/scripts3.js | 4 +-- web/style3.css | 19 +++++++++---- 11 files changed, 104 insertions(+), 33 deletions(-) diff --git a/nbproject/project.properties b/nbproject/project.properties index 1ae4ca76..3855d649 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -1,5 +1,6 @@ annotation.processing.enabled=true annotation.processing.enabled.in.editor=true +annotation.processing.processors.list= annotation.processing.run.all.processors=true annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output build.classes.dir=${build.web.dir}/WEB-INF/classes diff --git a/src/java/Global.properties b/src/java/Global.properties index ebede501..9f618c91 100644 --- a/src/java/Global.properties +++ b/src/java/Global.properties @@ -17,3 +17,7 @@ Newer=Newer (replies)\ by=by Comment=Comment Sponsored\ by=Sponsored by +Block\ user=Block user +Send\ private\ message=Send private message +Recommend\ message=Recommend message +in\ reply\ to=in reply to diff --git a/src/java/Global_ru.properties b/src/java/Global_ru.properties index 34d7418a..f87f4c75 100644 --- a/src/java/Global_ru.properties +++ b/src/java/Global_ru.properties @@ -17,3 +17,7 @@ Newer=\u041d\u043e\u0432\u044b\u0435 (replies)\ by=\u043e\u0442 Comment=\u041e\u0442\u0432\u0435\u0442\u0438\u0442\u044c Sponsored\ by=\u041f\u0440\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0435 +Block\ user=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f +Send\ private\ message=\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 +Recommend\ message=\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 +in\ reply\ to=\u0432 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 diff --git a/src/java/com/juick/http/www/Blogs.java b/src/java/com/juick/http/www/Blogs.java index 1e212b7a..a1cfdeb0 100644 --- a/src/java/com/juick/http/www/Blogs.java +++ b/src/java/com/juick/http/www/Blogs.java @@ -83,17 +83,37 @@ public class Blogs { mids = MessagesQueries.getAll(sql, paramBefore); } } else if (paramShow.equals("my")) { - title = rb.getString("My feed"); - mids = MessagesQueries.getMyFeed(sql, visitor.UID, paramBefore); + if (visitor != null) { + title = rb.getString("My feed"); + mids = MessagesQueries.getMyFeed(sql, visitor.UID, paramBefore); + } else { + response.sendError(404); + return; + } } else if (paramShow.equals("private")) { - title = rb.getString("Private"); - mids = MessagesQueries.getPrivate(sql, visitor.UID, paramBefore); + if (visitor != null) { + title = rb.getString("Private"); + mids = MessagesQueries.getPrivate(sql, visitor.UID, paramBefore); + } else { + response.sendError(404); + return; + } } else if (paramShow.equals("incoming")) { - title = rb.getString("Incoming"); - mids = MessagesQueries.getIncoming(sql, visitor.UID, paramBefore); + if (visitor != null) { + title = rb.getString("Incoming"); + mids = MessagesQueries.getIncoming(sql, visitor.UID, paramBefore); + } else { + response.sendError(404); + return; + } } else if (paramShow.equals("recommended")) { - title = rb.getString("Recommended"); - mids = MessagesQueries.getRecommended(sql, visitor.UID, paramBefore); + if (visitor != null) { + title = rb.getString("Recommended"); + mids = MessagesQueries.getRecommended(sql, visitor.UID, paramBefore); + } else { + response.sendError(404); + return; + } } else if (paramShow.equals("top")) { title = rb.getString("Popular"); mids = MessagesQueries.getPopular(sql, paramBefore); diff --git a/src/java/com/juick/http/www/Login.java b/src/java/com/juick/http/www/Login.java index 1baf6e43..0006f9d0 100644 --- a/src/java/com/juick/http/www/Login.java +++ b/src/java/com/juick/http/www/Login.java @@ -73,7 +73,7 @@ public class Login { if (com.juick.server.UserQueries.getUIDbyHash(sql, hash) > 0) { Cookie c = new Cookie("hash", hash); c.setDomain(".juick.com"); - c.setMaxAge(0); + c.setMaxAge(365 * 24 * 60 * 60); response.addCookie(c); response.sendRedirect("/"); @@ -95,7 +95,7 @@ public class Login { String hash = com.juick.server.UserQueries.getHashByUID(sql, uid); Cookie c = new Cookie("hash", hash); c.setDomain(".juick.com"); - c.setMaxAge(0); + c.setMaxAge(365 * 24 * 60 * 60); response.addCookie(c); String referer = request.getHeader("Referer"); diff --git a/src/java/com/juick/http/www/Main.java b/src/java/com/juick/http/www/Main.java index b7f95a4a..910a554f 100644 --- a/src/java/com/juick/http/www/Main.java +++ b/src/java/com/juick/http/www/Main.java @@ -149,7 +149,7 @@ public class Main extends HttpServlet implements XmppListener { //TODO settings } else if (uri.matches("^/\\d+$")) { rootRedirects.doGetPostID(sql, request, response); - } else if (uri.matches("^/[^/]$")) { + } else if (uri.matches("^/[^/]+$")) { rootRedirects.doGetUsername(sql, request, response); } else if (uri.matches("^/.+/.*")) { String uriparts[] = uri.split("/"); diff --git a/src/java/com/juick/http/www/NewMessage.java b/src/java/com/juick/http/www/NewMessage.java index 1beacf62..d35af8f3 100644 --- a/src/java/com/juick/http/www/NewMessage.java +++ b/src/java/com/juick/http/www/NewMessage.java @@ -54,10 +54,18 @@ public class NewMessage { out.println("