aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main/java/com/juick/www
diff options
context:
space:
mode:
Diffstat (limited to 'juick-www/src/main/java/com/juick/www')
-rw-r--r--juick-www/src/main/java/com/juick/www/Discover.java4
-rw-r--r--juick-www/src/main/java/com/juick/www/Home.java24
-rw-r--r--juick-www/src/main/java/com/juick/www/Login.java6
-rw-r--r--juick-www/src/main/java/com/juick/www/Main.java26
-rw-r--r--juick-www/src/main/java/com/juick/www/NewMessage.java34
-rw-r--r--juick-www/src/main/java/com/juick/www/PM.java14
-rw-r--r--juick-www/src/main/java/com/juick/www/PageTemplates.java54
-rw-r--r--juick-www/src/main/java/com/juick/www/Settings.java54
-rw-r--r--juick-www/src/main/java/com/juick/www/SignUp.java4
-rw-r--r--juick-www/src/main/java/com/juick/www/TwitterAuth.java2
-rw-r--r--juick-www/src/main/java/com/juick/www/User.java104
-rw-r--r--juick-www/src/main/java/com/juick/www/UserThread.java134
-rw-r--r--juick-www/src/main/java/com/juick/www/Utils.java4
13 files changed, 232 insertions, 232 deletions
diff --git a/juick-www/src/main/java/com/juick/www/Discover.java b/juick-www/src/main/java/com/juick/www/Discover.java
index 4fd8c3b6..860ad893 100644
--- a/juick-www/src/main/java/com/juick/www/Discover.java
+++ b/juick-www/src/main/java/com/juick/www/Discover.java
@@ -72,7 +72,7 @@ public class Discover {
}
}
- int visitor_uid = visitor.getUID();
+ int visitor_uid = visitor.getUid();
String title = "*" + StringEscapeUtils.escapeHtml4(paramTag.getName());
List<Integer> mids = MessagesQueries.getTag(sql, paramTag.TID, visitor_uid, paramBefore, (visitor_uid == 0) ? 40 : 20);
@@ -91,7 +91,7 @@ public class Discover {
out.println("<section id=\"content\">");
if (mids.size() > 0) {
- int vuid = visitor.getUID();
+ int vuid = visitor.getUid();
int ad_mid = AdsQueries.getAdMID(sql, vuid);
if (ad_mid > 0 && mids.indexOf(ad_mid) == -1) {
mids.add(0, ad_mid);
diff --git a/juick-www/src/main/java/com/juick/www/Home.java b/juick-www/src/main/java/com/juick/www/Home.java
index d8688b68..870c2d55 100644
--- a/juick-www/src/main/java/com/juick/www/Home.java
+++ b/juick-www/src/main/java/com/juick/www/Home.java
@@ -53,9 +53,9 @@ public class Home {
title = "Поиск: " + StringEscapeUtils.escapeHtml4(paramSearch);
mids = MessagesQueries.getSearch(sql, sqlSearch, Utils.encodeSphinx(paramSearch), paramBefore);
} else if (paramShow == null) {
- if (visitor.getUID() > 0) {
+ if (visitor.getUid() > 0) {
title = "Популярные";
- mids = MessagesQueries.getPopular(sql, visitor.getUID(), paramBefore);
+ mids = MessagesQueries.getPopular(sql, visitor.getUid(), paramBefore);
} else {
title = "Микроблоги Juick: популярные записи";
mids = MessagesQueries.getPopular(sql, 0, paramBefore);
@@ -66,27 +66,27 @@ public class Home {
return;
} else if (paramShow.equals("my") && visitor != null) {
title = "Моя лента";
- mids = MessagesQueries.getMyFeed(sql, visitor.getUID(), paramBefore);
+ mids = MessagesQueries.getMyFeed(sql, visitor.getUid(), paramBefore);
} else if (paramShow.equals("private") && visitor != null) {
title = "Приватные";
- mids = MessagesQueries.getPrivate(sql, visitor.getUID(), paramBefore);
+ mids = MessagesQueries.getPrivate(sql, visitor.getUid(), paramBefore);
} else if (paramShow.equals("discuss") && visitor != null) {
title = "Обсуждения";
- mids = MessagesQueries.getDiscussions(sql, visitor.getUID(), paramBefore);
+ mids = MessagesQueries.getDiscussions(sql, visitor.getUid(), paramBefore);
} else if (paramShow.equals("recommended") && visitor != null) {
title = "Рекомендации";
- mids = MessagesQueries.getRecommended(sql, visitor.getUID(), paramBefore);
+ mids = MessagesQueries.getRecommended(sql, visitor.getUid(), paramBefore);
} else if (paramShow.equals("photos")) {
title = "Фотографии";
if (visitor != null) {
- mids = MessagesQueries.getPhotos(sql, visitor.getUID(), paramBefore);
+ mids = MessagesQueries.getPhotos(sql, visitor.getUid(), paramBefore);
} else {
mids = MessagesQueries.getPhotos(sql, 0, paramBefore);
}
} else if (paramShow.equals("all")) {
title = "Все сообщения";
if (visitor != null) {
- mids = MessagesQueries.getAll(sql, visitor.getUID(), paramBefore);
+ mids = MessagesQueries.getAll(sql, visitor.getUid(), paramBefore);
} else {
mids = MessagesQueries.getAll(sql, 0, paramBefore);
}
@@ -110,7 +110,7 @@ public class Home {
out.println("<!--noindex-->");
}
- if (visitor.getUID() > 0) {
+ if (visitor.getUid() > 0) {
out.println("<form action=\"/post\" method=\"post\" enctype=\"multipart/form-data\">");
out.println("<section id=\"newmessage\">");
out.println(" <textarea name=\"body\" placeholder=\"Новое сообщение...\"></textarea>");
@@ -129,7 +129,7 @@ public class Home {
if (mids.size() > 0) {
int ad_mid = 0;
if (paramShow == null || paramShow.equals("top") || paramShow.equals("all")) {
- int vuid = visitor.getUID();
+ int vuid = visitor.getUid();
ad_mid = AdsQueries.getAdMID(sql, vuid);
if (ad_mid > 0 && mids.indexOf(ad_mid) == -1) {
mids.add(0, ad_mid);
@@ -139,7 +139,7 @@ public class Home {
}
}
- PageTemplates.printMessages(out, sql, null, mids, visitor, visitor.getUID() == 0 ? 2 : 3, ad_mid);
+ PageTemplates.printMessages(out, sql, null, mids, visitor, visitor.getUid() == 0 ? 2 : 3, ad_mid);
}
if (mids.size() >= 20) {
@@ -160,7 +160,7 @@ public class Home {
out.println("</section>");
- PageTemplates.pageHomeColumn(out, sql, visitor, paramShow == null && paramBefore == 0 && paramSearch == null && visitor.getUID() == 0);
+ PageTemplates.pageHomeColumn(out, sql, visitor, paramShow == null && paramBefore == 0 && paramSearch == null && visitor.getUid() == 0);
PageTemplates.pageFooter(request, out, visitor, true);
PageTemplates.pageEnd(out);
diff --git a/juick-www/src/main/java/com/juick/www/Login.java b/juick-www/src/main/java/com/juick/www/Login.java
index 55cfa03c..19cc855b 100644
--- a/juick-www/src/main/java/com/juick/www/Login.java
+++ b/juick-www/src/main/java/com/juick/www/Login.java
@@ -34,7 +34,7 @@ public class Login {
protected void doGetLoginForm(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
com.juick.User visitor = Utils.getVisitorUser(sql, request, response);
- if (visitor.getUID() > 0) {
+ if (visitor.getUid() > 0) {
Utils.sendTemporaryRedirect(response, "/");
return;
}
@@ -228,8 +228,8 @@ public class Login {
protected void doGetLogout(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
com.juick.User visitor = Utils.getVisitorUser(sql, request, response);
- if (visitor.getUID() > 0) {
- sql.update("DELETE FROM logins WHERE user_id=?", visitor.getUID());
+ if (visitor.getUid() > 0) {
+ sql.update("DELETE FROM logins WHERE user_id=?", visitor.getUid());
}
Cookie c = new Cookie("hash", "-");
diff --git a/juick-www/src/main/java/com/juick/www/Main.java b/juick-www/src/main/java/com/juick/www/Main.java
index 35617295..4a873cf3 100644
--- a/juick-www/src/main/java/com/juick/www/Main.java
+++ b/juick-www/src/main/java/com/juick/www/Main.java
@@ -172,7 +172,7 @@ public class Main extends HttpServlet implements Stream.StreamListener {
}
} else if (uri.equals("/post")) {
com.juick.User visitor = Utils.getVisitorUser(sql, request, response);
- if (visitor.getUID() > 0) {
+ if (visitor.getUid() > 0) {
pagesNewMessage.doGetNewMessage(sql, request, response, visitor);
} else {
Utils.sendTemporaryRedirect(response, "/login");
@@ -185,7 +185,7 @@ public class Main extends HttpServlet implements Stream.StreamListener {
}
} else if (uri.startsWith("/pm/")) {
com.juick.User visitor = Utils.getVisitorUser(sql, request, response);
- if (visitor.getUID() == 0) {
+ if (visitor.getUid() == 0) {
Utils.sendTemporaryRedirect(response, "/login");
} else {
switch (uri) {
@@ -269,7 +269,7 @@ public class Main extends HttpServlet implements Stream.StreamListener {
if (mid > 0) {
com.juick.User author = com.juick.server.MessagesQueries.getMessageAuthor(sql, mid);
if (author != null) {
- Utils.sendPermanentRedirect(response, "/" + author.getUName() + "/" + mid);
+ Utils.sendPermanentRedirect(response, "/" + author.getName() + "/" + mid);
return;
}
}
@@ -277,14 +277,14 @@ public class Main extends HttpServlet implements Stream.StreamListener {
} else if (uri.matches("^/[^/]+$")) {
com.juick.User user = com.juick.server.UserQueries.getUserByName(sql, request.getRequestURI().substring(1));
if (user != null) {
- Utils.sendPermanentRedirect(response, "/" + user.getUName() + "/");
+ Utils.sendPermanentRedirect(response, "/" + user.getName() + "/");
} else {
Errors.doGet404(sql, request, response);
}
} else if (uri.matches("^/.+/.*")) {
String uriparts[] = uri.split("/");
com.juick.User user = com.juick.server.UserQueries.getUserByName(sql, uriparts[1]);
- if (user != null && user.getUName().equals(uriparts[1]) && !user.Banned) {
+ if (user != null && user.getName().equals(uriparts[1]) && !user.isBanned()) {
if (uriparts.length == 2) { // http://juick.com/username/
pagesUser.doGetBlog(sql, sqlSearch, request, response, user);
} else if (uriparts[2].equals("tags")) {
@@ -302,8 +302,8 @@ public class Main extends HttpServlet implements Stream.StreamListener {
if (mid > 0) {
com.juick.User author = com.juick.server.MessagesQueries.getMessageAuthor(sql, mid);
if (author != null) {
- if (!author.getUName().equals(user.getUName())) {
- Utils.sendPermanentRedirect(response, "/" + author.getUName() + "/" + mid);
+ if (!author.getName().equals(user.getName())) {
+ Utils.sendPermanentRedirect(response, "/" + author.getName() + "/" + mid);
} else {
pagesUserThread.doGetThread(sql, request, response, mid);
}
@@ -314,8 +314,8 @@ public class Main extends HttpServlet implements Stream.StreamListener {
Errors.doGet404(sql, request, response);
}
}
- } else if (user != null && !user.Banned) {
- Utils.sendPermanentRedirect(response, "/" + user.getUName() + "/" + (uriparts.length > 2 ? uriparts[2] : ""));
+ } else if (user != null && !user.isBanned()) {
+ Utils.sendPermanentRedirect(response, "/" + user.getName() + "/" + (uriparts.length > 2 ? uriparts[2] : ""));
} else {
Errors.doGet404(sql, request, response);
}
@@ -341,7 +341,7 @@ public class Main extends HttpServlet implements Stream.StreamListener {
switch (uri) {
case "/post": {
com.juick.User visitor = Utils.getVisitorUser(sql, request, response);
- if (visitor.getUID() > 0 && !visitor.Banned) {
+ if (visitor.getUid() > 0 && !visitor.isBanned()) {
pagesNewMessage.doPostMessage(sql, request, response, xmpp, visitor);
} else {
response.sendError(403);
@@ -350,7 +350,7 @@ public class Main extends HttpServlet implements Stream.StreamListener {
}
case "/comment": {
com.juick.User visitor = Utils.getVisitorUser(sql, request, response);
- if (visitor.getUID() > 0 && !visitor.Banned) {
+ if (visitor.getUid() > 0 && !visitor.isBanned()) {
pagesNewMessage.doPostComment(sql, request, response, xmpp, visitor);
} else {
response.sendError(403);
@@ -359,7 +359,7 @@ public class Main extends HttpServlet implements Stream.StreamListener {
}
case "/like": {
com.juick.User visitor = Utils.getVisitorUser(sql, request, response);
- if (visitor.getUID() > 0 && !visitor.Banned) {
+ if (visitor.getUid() > 0 && !visitor.isBanned()) {
pagesNewMessage.doPostRecomm(sql, request, response, xmpp, visitor);
} else {
response.sendError(403);
@@ -368,7 +368,7 @@ public class Main extends HttpServlet implements Stream.StreamListener {
}
case "/pm/send": {
com.juick.User visitor = Utils.getVisitorUser(sql, request, response);
- if (visitor.getUID() > 0 && !visitor.Banned) {
+ if (visitor.getUid() > 0 && !visitor.isBanned()) {
pm.doPostPM(sql, request, response, xmpp, visitor);
} else {
response.sendError(403);
diff --git a/juick-www/src/main/java/com/juick/www/NewMessage.java b/juick-www/src/main/java/com/juick/www/NewMessage.java
index aaa3e550..310ede73 100644
--- a/juick-www/src/main/java/com/juick/www/NewMessage.java
+++ b/juick-www/src/main/java/com/juick/www/NewMessage.java
@@ -101,7 +101,7 @@ public class NewMessage {
}
void printUserTags(JdbcTemplate sql, PrintWriter out, com.juick.User visitor) {
- List<Tag> tags = TagQueries.getUserTagsAll(sql, visitor.getUID());
+ List<Tag> tags = TagQueries.getUserTagsAll(sql, visitor.getUid());
if (tags.isEmpty()) {
return;
@@ -128,7 +128,7 @@ public class NewMessage {
String taglink = "";
try {
taglink = "<a onclick=\"return addTag('" + StringEscapeUtils.escapeHtml4(tags.get(i).getName()) + "')\" href=\"/" +
- visitor.getUName() + "/?tag=" + URLEncoder.encode(tags.get(i).getName(), "utf-8") +
+ visitor.getName() + "/?tag=" + URLEncoder.encode(tags.get(i).getName(), "utf-8") +
"\" title=\"" + tags.get(i).UsageCnt + "\">" + StringEscapeUtils.escapeHtml4(tags.get(i).getName()) + "</a>";
} catch (UnsupportedEncodingException e) {
}
@@ -197,8 +197,8 @@ public class NewMessage {
}
String attachmentType = attachmentFName != null ? attachmentFName.substring(attachmentFName.length() - 3) : null;
- int mid = MessagesQueries.createMessage(sql, visitor.getUID(), body, attachmentType, tags);
- SubscriptionsQueries.subscribeMessage(sql, mid, visitor.getUID());
+ int mid = MessagesQueries.createMessage(sql, visitor.getUid(), body, attachmentType, tags);
+ SubscriptionsQueries.subscribeMessage(sql, mid, visitor.getUid());
Message xmsg = new Message();
xmsg.from = new JID("juick", "juick.com", null);
@@ -209,7 +209,7 @@ public class NewMessage {
xmsg.addChild(jmsg);
Nickname nick = new Nickname();
- nick.Nickname = "@" + jmsg.getUser().getUName();
+ nick.Nickname = "@" + jmsg.getUser().getName();
xmsg.addChild(nick);
if (attachmentFName != null) {
@@ -236,7 +236,7 @@ public class NewMessage {
for (String tag : tagsArr) {
tagsStr2 += " *" + tag;
}
- xmsg.body = "@" + jmsg.getUser().getUName() + ":" + tagsStr2 + "\n" + body + "\n\n#" + mid + " http://juick.com/" + mid;
+ xmsg.body = "@" + jmsg.getUser().getName() + ":" + tagsStr2 + "\n" + body + "\n\n#" + mid + " http://juick.com/" + mid;
xmsg.to = new JID("juick", "s2s.juick.com", null);
xmpp.send(xmsg);
@@ -289,12 +289,12 @@ public class NewMessage {
out.println("<section id=\"content\">");
out.println("<h1>Сообщение опубликовано</h1>");
out.println("<p>Поделитесь своим новым постом в социальных сетях:</p>");
- if (CrosspostQueries.getTwitterTokens(sql, visitor.getUID()).isPresent()) {
+ if (CrosspostQueries.getTwitterTokens(sql, visitor.getUid()).isPresent()) {
out.println("<p class=\"social\"><a href=\"https://twitter.com/intent/tweet?text=" + URLEncoder.encode(sharetwi, "utf-8") + "\" class=\"ico32-twi sharenew\">Отправить в Twitter</a></p>");
}
out.println("<p class=\"social\"><a href=\"http://www.livejournal.com/update.bml?subject=" + URLEncoder.encode(hashtags, "utf-8") + "&event=" + sharelj + "&prop_taglist=" + URLEncoder.encode(tagscomma, "utf-8") + "\" target=\"_blank\" class=\"ico32-lj sharenew\">Отправить в LiveJournal</a></p>");
out.println("<p class=\"social\"><a href=\"https://vk.com/share.php?url=" + url + "\" class=\"ico32-vk sharenew\">Отправить в ВКонтакте</a></p>");
- if (CrosspostQueries.getFacebookToken(sql, visitor.getUID()).isPresent()) {
+ if (CrosspostQueries.getFacebookToken(sql, visitor.getUid()).isPresent()) {
out.println("<p class=\"social\"><a href=\"https://www.facebook.com/sharer/sharer.php?u=" + url + "\" class=\"ico32-fb sharenew\">Отправить в Facebook</a></p>");
}
out.println("<p class=\"social\"><a href=\"https://plus.google.com/share?url=" + url + "\" class=\"ico32-gp sharenew\">Отправить в Google+</a></p>");
@@ -337,7 +337,7 @@ public class NewMessage {
}
body = body.replace("\r", "");
- if ((msg.ReadOnly && msg.getUser().getUID() != visitor.getUID()) || UserQueries.isInBLAny(sql, msg.getUser().getUID(), visitor.getUID()) || (reply != null && UserQueries.isInBLAny(sql, reply.getUser().getUID(), visitor.getUID()))) {
+ if ((msg.ReadOnly && msg.getUser().getUid() != visitor.getUid()) || UserQueries.isInBLAny(sql, msg.getUser().getUid(), visitor.getUid()) || (reply != null && UserQueries.isInBLAny(sql, reply.getUser().getUid(), visitor.getUid()))) {
response.sendError(403);
return;
}
@@ -363,8 +363,8 @@ public class NewMessage {
}
String attachmentType = attachmentFName != null ? attachmentFName.substring(attachmentFName.length() - 3) : null;
- int ridnew = MessagesQueries.createReply(sql, mid, rid, visitor.getUID(), body, attachmentType);
- SubscriptionsQueries.subscribeMessage(sql, mid, visitor.getUID());
+ int ridnew = MessagesQueries.createReply(sql, mid, rid, visitor.getUid(), body, attachmentType);
+ SubscriptionsQueries.subscribeMessage(sql, mid, visitor.getUid());
Message xmsg = new Message();
xmsg.from = new JID("juick", "juick.com", null);
@@ -380,7 +380,7 @@ public class NewMessage {
}
Nickname nick = new Nickname();
- nick.Nickname = "@" + jmsg.getUser().getUName();
+ nick.Nickname = "@" + jmsg.getUser().getName();
xmsg.addChild(nick);
if (attachmentFName != null) {
@@ -404,7 +404,7 @@ public class NewMessage {
if (xmpp != null) {
- xmsg.body = "Reply by @" + jmsg.getUser().getUName() + ":\n>" + quote + "\n" + body + "\n\n#" + mid + "/" + ridnew + " http://juick.com/" + mid + "#" + ridnew;
+ xmsg.body = "Reply by @" + jmsg.getUser().getName() + ":\n>" + quote + "\n" + body + "\n\n#" + mid + "/" + ridnew + " http://juick.com/" + mid + "#" + ridnew;
xmsg.to = new JID("juick", "s2s.juick.com", null);
xmpp.send(xmsg);
@@ -418,7 +418,7 @@ public class NewMessage {
logger.warn("XMPP unavailable");
}
- Utils.sendTemporaryRedirect(response, "/" + msg.getUser().getUName() + "/" + mid + "#" + ridnew);
+ Utils.sendTemporaryRedirect(response, "/" + msg.getUser().getName() + "/" + mid + "#" + ridnew);
}
public void doPostRecomm(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response, Stream xmpp, com.juick.User visitor) throws ServletException, IOException {
@@ -432,12 +432,12 @@ public class NewMessage {
response.sendError(404);
return;
}
- if (msg.getUser().getUID() == visitor.getUID()) {
+ if (msg.getUser().getUid() == visitor.getUid()) {
response.sendError(403);
return;
}
- boolean res = MessagesQueries.recommendMessage(sql, mid, visitor.getUID());
+ boolean res = MessagesQueries.recommendMessage(sql, mid, visitor.getUid());
if (res) {
if (xmpp != null) {
@@ -445,7 +445,7 @@ public class NewMessage {
xmsg.from = new JID("juick", "juick.com", null);
xmsg.to = new JID("recomm", "s2s.juick.com", null);
JuickMessage jmsg = new JuickMessage();
- jmsg.setMID(mid);
+ jmsg.setMid(mid);
jmsg.setUser(new JuickUser(visitor));
xmsg.addChild(jmsg);
xmpp.send(xmsg);
diff --git a/juick-www/src/main/java/com/juick/www/PM.java b/juick-www/src/main/java/com/juick/www/PM.java
index 8190d65b..2e35ec1c 100644
--- a/juick-www/src/main/java/com/juick/www/PM.java
+++ b/juick-www/src/main/java/com/juick/www/PM.java
@@ -50,7 +50,7 @@ public class PM {
protected void doGetInbox(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response, com.juick.User visitor) throws ServletException, IOException, PebbleException {
String title = "PM: Inbox";
- List<com.juick.Message> msgs = PMQueries.getLastPMInbox(sql, visitor.getUID());
+ List<com.juick.Message> msgs = PMQueries.getLastPMInbox(sql, visitor.getUid());
msgs.forEach(m -> m.setText(Utils.formatMessage(m.getText())));
response.setContentType("text/html; charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
@@ -67,7 +67,7 @@ public class PM {
protected void doGetSent(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response, com.juick.User visitor) throws ServletException, IOException, PebbleException {
String title = "PM: Sent";
- List<com.juick.Message> msgs = PMQueries.getLastPMSent(sql, visitor.getUID());
+ List<com.juick.Message> msgs = PMQueries.getLastPMSent(sql, visitor.getUid());
String uname = request.getParameter("uname");
if (!UserUtils.checkUserNameValid(uname)) {
@@ -103,12 +103,12 @@ public class PM {
return;
}
- if (UserQueries.isInBLAny(sql, uid, visitor.getUID())) {
+ if (UserQueries.isInBLAny(sql, uid, visitor.getUid())) {
response.sendError(403);
return;
}
- if (PMQueries.createPM(sql, visitor.getUID(), uid, body)) {
+ if (PMQueries.createPM(sql, visitor.getUid(), uid, body)) {
if (xmpp != null) {
Message msg = new Message();
msg.from = new JID("juick", "juick.com", null);
@@ -127,12 +127,12 @@ public class PM {
Message mm = new Message();
mm.to = new JID(jid);
mm.type = Message.Type.chat;
- if (PMQueries.havePMinRoster(sql, visitor.getUID(), jid)) {
- mm.from = new JID(jmsg.getUser().getUName(), "juick.com", "Juick");
+ if (PMQueries.havePMinRoster(sql, visitor.getUid(), jid)) {
+ mm.from = new JID(jmsg.getUser().getName(), "juick.com", "Juick");
mm.body = body;
} else {
mm.from = new JID("juick", "juick.com", "Juick");
- mm.body = "Private message from @" + jmsg.getUser().getUName() + ":\n" + body;
+ mm.body = "Private message from @" + jmsg.getUser().getName() + ":\n" + body;
}
xmpp.send(mm);
}
diff --git a/juick-www/src/main/java/com/juick/www/PageTemplates.java b/juick-www/src/main/java/com/juick/www/PageTemplates.java
index f8873739..4f7e17b7 100644
--- a/juick-www/src/main/java/com/juick/www/PageTemplates.java
+++ b/juick-www/src/main/java/com/juick/www/PageTemplates.java
@@ -72,7 +72,7 @@ public class PageTemplates {
out.println("<![endif]-->");
out.println("</head>");
out.flush();
- if (visitor.getUID() > 0) {
+ if (visitor.getUid() > 0) {
out.println("<body id=\"body\" data-hash=\"" + visitor.getAuthHash() + "\">");
} else {
out.println("<body id=\"body\">");
@@ -93,7 +93,7 @@ public class PageTemplates {
}
out.println("/></form></div>");
out.println(" <section id=\"headdiv\">");
- if (visitor.getUID() > 0) {
+ if (visitor.getUid() > 0) {
out.print(" <nav id=\"user\"><ul>");
out.print("<li><a href=\"/?show=my\">Моя лента</a></li>");
out.print("<li><a href=\"/pm/inbox\">Приватные</a></li>");
@@ -102,7 +102,7 @@ public class PageTemplates {
out.println("</ul></nav>");
out.print(" <nav id=\"actions\"><ul>");
out.print("<li><a href=\"/#post\">Написать</a></li>");
- out.print("<li><a href=\"/" + visitor.getUName() + "\">@" + visitor.getUName() + "</a></li>");
+ out.print("<li><a href=\"/" + visitor.getName() + "\">@" + visitor.getName() + "</a></li>");
out.print("<li><a href=\"/logout\">Выйти</a></li>");
out.println("</ul></nav>");
} else {
@@ -151,7 +151,7 @@ public class PageTemplates {
String queryString = request.getQueryString();
String requestURI = request.getRequestURI();
- if (sapeon && sape != null && (visitor.getUID() == 0 || visitor.getUID() == 1) && queryString == null) {
+ if (sapeon && sape != null && (visitor.getUid() == 0 || visitor.getUid() == 1) && queryString == null) {
String links = sape.getPageLinks(requestURI, request.getCookies()).render();
if (links != null && !links.isEmpty()) {
out.print("<br/>Спонсоры: " + links);
@@ -284,7 +284,7 @@ public class PageTemplates {
for (int i = 0; i < msgs.size(); i++) {
com.juick.Message msg = msgs.get(i);
- if (msg.getMID() == ad_mid) {
+ if (msg.getMid() == ad_mid) {
msgs.remove(i);
msgs.add(0, msg);
break;
@@ -294,43 +294,43 @@ public class PageTemplates {
List<Integer> blUIDs = new ArrayList<Integer>(20);
if (visitor != null) {
for (Message msg : msgs) {
- blUIDs.add(msg.getUser().getUID());
+ blUIDs.add(msg.getUser().getUid());
}
- blUIDs = UserQueries.checkBL(sql, visitor.getUID(), blUIDs);
+ blUIDs = UserQueries.checkBL(sql, visitor.getUid(), blUIDs);
}
for (Message msg : msgs) {
- List<Tag> tags = MessagesQueries.getMessageTags(sql, msg.getMID());
+ List<Tag> tags = MessagesQueries.getMessageTags(sql, msg.getMid());
String tagsStr = formatTags(tags);
if (msg.ReadOnly) {
tagsStr += "<a>readonly</a>";
}
- if (msg.Privacy < 0) {
+ if (msg.getPrivacy() < 0) {
tagsStr += "<a>friends</a>";
}
- if (msg.getMID() == ad_mid) {
+ if (msg.getMid() == ad_mid) {
tagsStr += "<a>реклама</a>";
}
String txt;
- if (msg.Tags.stream().anyMatch(t -> t.getName().equals("code"))) {
+ if (msg.getTags().stream().anyMatch(t -> t.getName().equals("code"))) {
txt = Utils.formatMessageCode(msg.getText());
} else {
txt = Utils.formatMessage(msg.getText());
}
- out.println("<article data-mid=\"" + msg.getMID() + "\">");
+ out.println("<article data-mid=\"" + msg.getMid() + "\">");
out.println(" <header class=\"u\">");
- out.println(" @<a href=\"/" + msg.getUser().getUName() + "/\">" + msg.getUser().getUName() + "</a>:");
- out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.getUser().getUName() + "/\"><img src=\"//i.juick.com/a/" + msg.getUser().getUID() + ".png\" alt=\"" + msg.getUser().getUName() + "\"/></a></div>");
- out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.getUser().getUName() + "/" + msg.getMID() + "\"><time datetime=\"" + sdfSQL.format(msg.getDate()) + "Z\" title=\"" + sdfSQL.format(msg.getDate()) + " GMT\">" + formatDate(msg.TimeAgo, msg.getDate()) + "</time></a></div>");
+ out.println(" @<a href=\"/" + msg.getUser().getName() + "/\">" + msg.getUser().getName() + "</a>:");
+ out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.getUser().getName() + "/\"><img src=\"//i.juick.com/a/" + msg.getUser().getUid() + ".png\" alt=\"" + msg.getUser().getName() + "\"/></a></div>");
+ out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.getUser().getName() + "/" + msg.getMid() + "\"><time datetime=\"" + sdfSQL.format(msg.getDate()) + "Z\" title=\"" + sdfSQL.format(msg.getDate()) + " GMT\">" + formatDate(msg.TimeAgo, msg.getDate()) + "</time></a></div>");
out.println(" <div class=\"msg-tags\">" + tagsStr + "</div>");
out.println(" </header>");
if (msg.AttachmentType != null) {
- String fname = msg.getMID() + "." + msg.AttachmentType;
+ String fname = msg.getMid() + "." + msg.AttachmentType;
out.println(" <p class=\"ir\"><a href=\"//i.juick.com/photos-512/" + fname + "\" data-fname=\"" + fname + "\"><img src=\"//i.juick.com/photos-512/" + fname + "\" alt=\"\"/></a></p>");
}
out.println(" <p>" + txt + "</p>");
@@ -338,21 +338,21 @@ public class PageTemplates {
out.println(" <div class=\"irbr\"></div>");
}
out.print(" <nav class=\"l\">");
- msg.ReadOnly |= blUIDs.contains(msg.getUser().getUID());
- if (visitor.getUID() == 0) {
+ msg.ReadOnly |= blUIDs.contains(msg.getUser().getUid());
+ if (visitor.getUid() == 0) {
out.print("<a href=\"#\" class=\"a-login\">Мне нравится</a>");
} else {
- out.print("<a href=\"/post?body=!+%23" + msg.getMID() + "\" class=\"a-like\">Мне нравится</a>");
+ out.print("<a href=\"/post?body=!+%23" + msg.getMid() + "\" class=\"a-like\">Мне нравится</a>");
}
- if (visitor.getUID() == 0 && !msg.ReadOnly) {
- out.print("<a href=\"/"+ msg.getMID() + "\" class=\"a-login\">Комментировать</a> ");
- } else if (visitor.getUID() > 0 && (!msg.ReadOnly || visitor.getUID() == msg.getUser().getUID())) {
- out.print("<a class=\"a-comment\" href=\"/" + msg.getMID() + "\">Комментировать</a> ");
+ if (visitor.getUid() == 0 && !msg.ReadOnly) {
+ out.print("<a href=\"/"+ msg.getMid() + "\" class=\"a-login\">Комментировать</a> ");
+ } else if (visitor.getUid() > 0 && (!msg.ReadOnly || visitor.getUid() == msg.getUser().getUid())) {
+ out.print("<a class=\"a-comment\" href=\"/" + msg.getMid() + "\">Комментировать</a> ");
}
- if (visitor.getUID() > 0 && msg.Privacy < 0 && msg.getUser().getUID() == visitor.getUID()) {
+ if (visitor.getUid() > 0 && msg.getPrivacy() < 0 && msg.getUser().getUid() == visitor.getUid()) {
out.print(" <a href=\"#\" class=\"a-privacy\">Открыть доступ</a>");
}
- if (visitor.getUID() > 0 && visitor.getUID() == 3694) {
+ if (visitor.getUid() > 0 && visitor.getUid() == 3694) {
out.print(" <a href=\"#\" class=\"a-popular-plus\">+</a>");
out.print(" <a href=\"#\" class=\"a-popular-minus\">-</a>");
out.print(" <a href=\"#\" class=\"a-popular-delete\">x</a>");
@@ -361,10 +361,10 @@ public class PageTemplates {
out.print(" <nav class=\"s\">");
if (msg.Likes > 0) {
- out.print("<a href=\"/" + msg.getUser().getUName() + "/" + msg.getMID() + "\" class=\"likes\"><i data-icon=\"ei-heart\" data-size=\"s\"></i>&nbsp;" + msg.Likes + "</a>");
+ out.print("<a href=\"/" + msg.getUser().getName() + "/" + msg.getMid() + "\" class=\"likes\"><i data-icon=\"ei-heart\" data-size=\"s\"></i>&nbsp;" + msg.Likes + "</a>");
}
if (msg.Replies > 0) {
- out.print("<a href=\"/" + msg.getUser().getUName() + "/" + msg.getMID() + "\" class=\"replies\"><i data-icon=\"ei-comment\" data-size=\"s\"></i>&nbsp;" + msg.Replies + "</a>");
+ out.print("<a href=\"/" + msg.getUser().getName() + "/" + msg.getMid() + "\" class=\"replies\"><i data-icon=\"ei-comment\" data-size=\"s\"></i>&nbsp;" + msg.Replies + "</a>");
}
out.println("</nav>");
out.print("</article>");
diff --git a/juick-www/src/main/java/com/juick/www/Settings.java b/juick-www/src/main/java/com/juick/www/Settings.java
index 6be16acc..5c25564f 100644
--- a/juick-www/src/main/java/com/juick/www/Settings.java
+++ b/juick-www/src/main/java/com/juick/www/Settings.java
@@ -71,7 +71,7 @@ public class Settings {
protected void doGet(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, PebbleException {
com.juick.User visitor = Utils.getVisitorUser(sql, request, response);
- if (visitor.getUID() == 0) {
+ if (visitor.getUid() == 0) {
response.sendRedirect("/login");
}
List<String> pages = Arrays.asList("main", "password", "about", "auth-email", "privacy");
@@ -95,17 +95,17 @@ public class Settings {
List<String> hours = IntStream.rangeClosed(0, 23).boxed()
.map(i -> StringUtils.leftPad(String.format("%d", i), 2, "0")).collect(Collectors.toList());
context.put("hours", hours);
- context.put("fbstatus", CrosspostQueries.isFBCrossPostEnabled(sql, visitor.getUID()));
- context.put("twitter_name", CrosspostQueries.getTwitterName(sql, visitor.getUID()));
- context.put("telegram_name", CrosspostQueries.getTelegramName(sql, visitor.getUID()));
+ context.put("fbstatus", CrosspostQueries.isFBCrossPostEnabled(sql, visitor.getUid()));
+ context.put("twitter_name", CrosspostQueries.getTwitterName(sql, visitor.getUid()));
+ context.put("telegram_name", CrosspostQueries.getTelegramName(sql, visitor.getUid()));
context.put("notify_options", SubscriptionsQueries.getNotifyOptions(sql, visitor));
context.put("userinfo", UserQueries.getUserInfo(sql, visitor));
if (page.equals("auth-email")) {
try {
String account = sql.queryForObject("SELECT account FROM auth WHERE user_id=? AND protocol='email' AND authcode=?",
- String.class, visitor.getUID(), request.getParameter("code"));
- sql.update("INSERT INTO emails(user_id,email) VALUES (?,?)", visitor.getUID(), account);
- sql.update("DELETE FROM auth WHERE user_id=? AND authcode=?", visitor.getUID(), request.getParameter("code"));
+ String.class, visitor.getUid(), request.getParameter("code"));
+ sql.update("INSERT INTO emails(user_id,email) VALUES (?,?)", visitor.getUid(), account);
+ sql.update("DELETE FROM auth WHERE user_id=? AND authcode=?", visitor.getUid(), request.getParameter("code"));
context.put("result", "OK!");
} catch (EmptyResultDataAccessException e) {
context.put("result", "Sorry, code unknown.");
@@ -117,7 +117,7 @@ public class Settings {
protected void doPost(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, PebbleException {
com.juick.User visitor = Utils.getVisitorUser(sql, request, response);
- if (visitor.getUID() == 0) {
+ if (visitor.getUid() == 0) {
response.sendError(400);
return;
}
@@ -134,7 +134,7 @@ public class Settings {
case "password":
if (UserQueries.updatePassword(sql, visitor, request.getParameter("password"))) {
result = "<p>Password has been changed.</p>";
- String hash = com.juick.server.UserQueries.getHashByUID(sql, visitor.getUID());
+ String hash = com.juick.server.UserQueries.getHashByUID(sql, visitor.getUid());
Cookie c = new Cookie("hash", hash);
c.setMaxAge(365 * 24 * 60 * 60);
response.addCookie(c);
@@ -158,8 +158,8 @@ public class Settings {
String avatarTmpPath = Utils.receiveMultiPartFile(request, "avatar");
if (StringUtils.isNotEmpty(avatarTmpPath)) {
String originalExtension = FilenameUtils.getExtension(avatarTmpPath);
- String originalName = String.format("%s.%s", visitor.getUID(), originalExtension);
- String targetName = String.format("%s.png", visitor.getUID());
+ String originalName = String.format("%s.%s", visitor.getUid(), originalExtension);
+ String targetName = String.format("%s.png", visitor.getUid());
Path ao = Paths.get(imgPath, "ao", originalName);
Path a = Paths.get(imgPath, "a", targetName);
Path as = Paths.get(imgPath, "as", targetName);
@@ -168,16 +168,16 @@ public class Settings {
Thumbnails.of(ao.toFile()).size(32, 32).toFile(as.toFile());
}
if (UserQueries.updateUserInfo(sql, visitor, info)) {
- result = String.format("<p>Your info is updated.</p><p><a href='/%s/'>Back to blog</a>.</p>", visitor.getUName());
+ result = String.format("<p>Your info is updated.</p><p><a href='/%s/'>Back to blog</a>.</p>", visitor.getName());
}
break;
case "jid-del":
String[] params = request.getParameter("delete").split(";", 2);
int res = -1;
if (params[0].equals("xmpp")) {
- res = sql.update("DELETE FROM jids WHERE user_id=? AND jid=?", visitor.getUID(), params[1]);
+ res = sql.update("DELETE FROM jids WHERE user_id=? AND jid=?", visitor.getUid(), params[1]);
} else if (params[0].equals("xmpp-unauth")) {
- res = sql.update("DELETE FROM auth WHERE user_id=? AND protocol='xmpp' AND account=?", visitor.getUID(), params[1]);
+ res = sql.update("DELETE FROM auth WHERE user_id=? AND protocol='xmpp' AND account=?", visitor.getUid(), params[1]);
}
if (res == 1) {
result = "<p>Deleted. <a href=\"/settings\">Back</a>.</p>";
@@ -198,11 +198,11 @@ public class Settings {
case "email-add":
try {
sql.queryForObject("SELECT authcode FROM auth WHERE user_id=? AND protocol='email' " +
- "AND account=?", String.class, visitor.getUID(), request.getParameter("account"));
+ "AND account=?", String.class, visitor.getUid(), request.getParameter("account"));
} catch (EmptyResultDataAccessException e) {
String authCode = UserUtils.generateHash(8);
if (sql.update("INSERT INTO auth(user_id,protocol,account,authcode) VALUES (?,'email',?,?)",
- visitor.getUID(), request.getParameter("account"), authCode) > 0) {
+ visitor.getUid(), request.getParameter("account"), authCode) > 0) {
Session session = Session.getDefaultInstance(System.getProperties());
try {
MimeMessage message = new MimeMessage(session);
@@ -225,18 +225,18 @@ public class Settings {
}
break;
case "email-del":
- if (sql.update("DELETE FROM emails WHERE user_id=? AND email=?", visitor.getUID(), request.getParameter("account")) > 0) {
+ if (sql.update("DELETE FROM emails WHERE user_id=? AND email=?", visitor.getUid(), request.getParameter("account")) > 0) {
result = "<p>Deleted. <a href=\"/settings\">Back</a>.</p>";
} else {
result = "<p>An error occured while deleting.</p>";
}
break;
case "email-subscr":
- sql.update("UPDATE emails SET subscr_hour=NULL WHERE user_id=?", visitor.getUID());
+ sql.update("UPDATE emails SET subscr_hour=NULL WHERE user_id=?", visitor.getUid());
String email = request.getParameter("account");
if (StringUtils.isNotEmpty(email)) {
sql.update("UPDATE emails SET subscr_hour=? WHERE user_id=? AND email=?",
- request.getParameter("time"), visitor.getUID(), email);
+ request.getParameter("time"), visitor.getUid(), email);
result = String.format("<p>Saved! Will send to <strong>%s</strong> at <strong>%s:00 GMT</strong>." +
"</p><p><a href=\"/settings\">Back</a></p>", email, request.getParameter("time"));
} else {
@@ -244,8 +244,8 @@ public class Settings {
}
break;
case "twitter-del":
- sql.update("DELETE FROM twitter WHERE user_id=?", visitor.getUID());
- sql.update("DELETE FROM subscr_users WHERE user_id=? AND suser_id=1741", visitor.getUID());
+ sql.update("DELETE FROM twitter WHERE user_id=?", visitor.getUid());
+ sql.update("DELETE FROM subscr_users WHERE user_id=? AND suser_id=1741", visitor.getUid());
for (Cookie cookie : request.getCookies()) {
if (cookie.getName().equals("request_token")) {
cookie.setMaxAge(0);
@@ -259,21 +259,21 @@ public class Settings {
result = "<p><a href=\"/settings\">Back</a></p>";
break;
case "telegram-del":
- sql.update("DELETE FROM telegram WHERE user_id=?", visitor.getUID());
+ sql.update("DELETE FROM telegram WHERE user_id=?", visitor.getUid());
result = "<p><a href=\"/settings\">Back</a></p>";
break;
case "facebook-disable":
- sql.update("UPDATE facebook SET crosspost=0 WHERE user_id=?", visitor.getUID());
- sql.update("DELETE FROM subscr_users WHERE user_id=? AND suser_id=5863", visitor.getUID());
+ sql.update("UPDATE facebook SET crosspost=0 WHERE user_id=?", visitor.getUid());
+ sql.update("DELETE FROM subscr_users WHERE user_id=? AND suser_id=5863", visitor.getUid());
result = "<p><a href=\"/settings\">Back</a></p>";
break;
case "facebook-enable":
- sql.update("UPDATE facebook SET crosspost=1 WHERE user_id=?", visitor.getUID());
- sql.update("INSERT INTO subscr_users(user_id,suser_id,jid,active) VALUES (?,5863,'juick@facebook.juick.com',1)", visitor.getUID());
+ sql.update("UPDATE facebook SET crosspost=1 WHERE user_id=?", visitor.getUid());
+ sql.update("INSERT INTO subscr_users(user_id,suser_id,jid,active) VALUES (?,5863,'juick@facebook.juick.com',1)", visitor.getUid());
result = "<p><a href=\"/settings\">Back</a></p>";
break;
case "vk-del":
- sql.update("DELETE FROM vk WHERE user_id=?", visitor.getUID());
+ sql.update("DELETE FROM vk WHERE user_id=?", visitor.getUid());
result = "<p><a href=\"/settings\">Back</a></p>";
break;
default:
diff --git a/juick-www/src/main/java/com/juick/www/SignUp.java b/juick-www/src/main/java/com/juick/www/SignUp.java
index 43c82a9a..ea40c810 100644
--- a/juick-www/src/main/java/com/juick/www/SignUp.java
+++ b/juick-www/src/main/java/com/juick/www/SignUp.java
@@ -97,7 +97,7 @@ public class SignUp {
String action = request.getParameter("action");
if (action.charAt(0) == 'l') {
- if (visitor.getUID() == 0) {
+ if (visitor.getUid() == 0) {
String username = request.getParameter("username");
String password = request.getParameter("password");
if (username == null || password == null || username.length() > 32 || password.isEmpty()) {
@@ -106,7 +106,7 @@ public class SignUp {
}
uid = com.juick.server.UserQueries.checkPassword(sql, username, password);
} else {
- uid = visitor.getUID();
+ uid = visitor.getUid();
}
if (uid <= 0) {
diff --git a/juick-www/src/main/java/com/juick/www/TwitterAuth.java b/juick-www/src/main/java/com/juick/www/TwitterAuth.java
index d4be4335..173ad7b7 100644
--- a/juick-www/src/main/java/com/juick/www/TwitterAuth.java
+++ b/juick-www/src/main/java/com/juick/www/TwitterAuth.java
@@ -48,7 +48,7 @@ public class TwitterAuth {
}
}
com.juick.User user = UserQueries.getUserByHash(sql, hash);
- if ( user == null || user.getUID() == 0) {
+ if ( user == null || user.getUid() == 0) {
response.sendError(403);
return;
}
diff --git a/juick-www/src/main/java/com/juick/www/User.java b/juick-www/src/main/java/com/juick/www/User.java
index 967d06c7..3cc38b37 100644
--- a/juick-www/src/main/java/com/juick/www/User.java
+++ b/juick-www/src/main/java/com/juick/www/User.java
@@ -58,7 +58,7 @@ public class User {
Errors.doGet404(sql, request, response);
return;
} else if (!paramTag.getName().equals(paramTagStr)) {
- String url = "/" + user.getUName() + "/?tag=" + URLEncoder.encode(paramTag.getName(), "UTF-8");
+ String url = "/" + user.getName() + "/?tag=" + URLEncoder.encode(paramTag.getName(), "UTF-8");
Utils.sendPermanentRedirect(response, url);
return;
}
@@ -79,10 +79,10 @@ public class User {
}
int privacy = 0;
- if (visitor.getUID() > 0) {
- if (user.getUID() == visitor.getUID() || visitor.getUID() == 1) {
+ if (visitor.getUid() > 0) {
+ if (user.getUid() == visitor.getUid() || visitor.getUid() == 1) {
privacy = -3;
- } else if (UserQueries.isInWL(sql, user.getUID(), visitor.getUID())) {
+ } else if (UserQueries.isInWL(sql, user.getUid(), visitor.getUid())) {
privacy = -2;
}
}
@@ -90,34 +90,34 @@ public class User {
String title;
if (paramShow == null) {
if (paramTag != null) {
- title = "Блог " + user.getUName() + ": *" + StringEscapeUtils.escapeHtml4(paramTag.getName());
- mids = MessagesQueries.getUserTag(sql, user.getUID(), paramTag.TID, privacy, paramBefore);
+ title = "Блог " + user.getName() + ": *" + StringEscapeUtils.escapeHtml4(paramTag.getName());
+ mids = MessagesQueries.getUserTag(sql, user.getUid(), paramTag.TID, privacy, paramBefore);
} else if (paramSearch != null) {
- title = "Блог " + user.getUName() + ": " + StringEscapeUtils.escapeHtml4(paramSearch);
- mids = MessagesQueries.getUserSearch(sql, sqlSearch, user.getUID(), Utils.encodeSphinx(paramSearch), privacy, paramBefore);
+ title = "Блог " + user.getName() + ": " + StringEscapeUtils.escapeHtml4(paramSearch);
+ mids = MessagesQueries.getUserSearch(sql, sqlSearch, user.getUid(), Utils.encodeSphinx(paramSearch), privacy, paramBefore);
} else {
- title = "Блог " + user.getUName();
- mids = MessagesQueries.getUserBlog(sql, user.getUID(), privacy, paramBefore);
+ title = "Блог " + user.getName();
+ mids = MessagesQueries.getUserBlog(sql, user.getUid(), privacy, paramBefore);
}
} else if (paramShow.equals("recomm")) {
- title = "Рекомендации " + user.getUName();
- mids = MessagesQueries.getUserRecommendations(sql, user.getUID(), paramBefore);
+ title = "Рекомендации " + user.getName();
+ mids = MessagesQueries.getUserRecommendations(sql, user.getUid(), paramBefore);
} else if (paramShow.equals("photos")) {
- title = "Фотографии " + user.getUName();
- mids = MessagesQueries.getUserPhotos(sql, user.getUID(), privacy, paramBefore);
+ title = "Фотографии " + user.getName();
+ mids = MessagesQueries.getUserPhotos(sql, user.getUid(), privacy, paramBefore);
} else {
Errors.doGet404(sql, request, response);
return;
}
- if (visitor.getUID() == 0) {
- pageUserRefCookie(request, response, user.getUID());
+ if (visitor.getUid() == 0) {
+ pageUserRefCookie(request, response, user.getUid());
}
response.setContentType("text/html; charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
String head = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"@" +
- user.getUName() + "\" href=\"//rss.juick.com/" + user.getUName() + "/blog\"/>";
+ user.getName() + "\" href=\"//rss.juick.com/" + user.getName() + "/blog\"/>";
if (paramTag != null && TagQueries.getTagNoIndex(sql, paramTag.TID)) {
head += "<meta name=\"robots\" content=\"noindex,nofollow\"/>";
} else if (paramBefore > 0 || paramShow != null) {
@@ -136,7 +136,7 @@ public class User {
StringEscapeUtils.escapeHtml4(paramTag.getName()) + "</b></a></p>");
}
- PageTemplates.printMessages(out, sql, user, mids, visitor, visitor.getUID() == 0 ? 4 : 5, 0);
+ PageTemplates.printMessages(out, sql, user, mids, visitor, visitor.getUid() == 0 ? 4 : 5, 0);
if (mids.size() >= 20) {
String nextpage = "?before=" + mids.get(mids.size() - 1);
@@ -163,14 +163,14 @@ public class User {
protected void doGetTags(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response, com.juick.User user) throws ServletException, IOException {
com.juick.User visitor = Utils.getVisitorUser(sql, request, response);
- if (visitor.getUID() == 0) {
- pageUserRefCookie(request, response, user.getUID());
+ if (visitor.getUid() == 0) {
+ pageUserRefCookie(request, response, user.getUid());
}
response.setContentType("text/html; charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
String head = "<meta name=\"robots\" content=\"noindex,nofollow\"/>";
- PageTemplates.pageHead(out, visitor, "Теги " + user.getUName(), head);
+ PageTemplates.pageHead(out, visitor, "Теги " + user.getName(), head);
PageTemplates.pageNavigation(out, visitor, null);
pageUserColumn(out, sql, user, visitor);
@@ -186,28 +186,28 @@ public class User {
protected void doGetFriends(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response, com.juick.User user) throws ServletException, IOException {
com.juick.User visitor = Utils.getVisitorUser(sql, request, response);
- if (visitor.getUID() == 0) {
- pageUserRefCookie(request, response, user.getUID());
+ if (visitor.getUid() == 0) {
+ pageUserRefCookie(request, response, user.getUid());
}
response.setContentType("text/html; charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
String head = "<meta name=\"robots\" content=\"noindex\"/>";
- PageTemplates.pageHead(out, visitor, "Подписки " + user.getUName(), head);
+ PageTemplates.pageHead(out, visitor, "Подписки " + user.getName(), head);
PageTemplates.pageNavigation(out, visitor, null);
pageUserColumn(out, sql, user, visitor);
out.println("<section id=\"content\">");
out.println("<table class=\"users\"><tr>");
- List<com.juick.User> friends = UserQueries.getUserFriends(sql, user.getUID());
+ List<com.juick.User> friends = UserQueries.getUserFriends(sql, user.getUid());
for (int i = 0; i < friends.size(); i++) {
if (i % 3 == 0 && i > 0) {
out.print("</tr><tr>");
}
- out.print("<td><a href=\"/" + friends.get(i).getUName()
- + "/\"><img src=\"//i.juick.com/as/" + friends.get(i).getUID() + ".png\"/>"
- + friends.get(i).getUName() + "</a></td>");
+ out.print("<td><a href=\"/" + friends.get(i).getName()
+ + "/\"><img src=\"//i.juick.com/as/" + friends.get(i).getUid() + ".png\"/>"
+ + friends.get(i).getName() + "</a></td>");
}
out.println("</tr></table>");
@@ -221,28 +221,28 @@ public class User {
protected void doGetReaders(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response, com.juick.User user) throws ServletException, IOException {
com.juick.User visitor = Utils.getVisitorUser(sql, request, response);
- if (visitor.getUID() == 0) {
- pageUserRefCookie(request, response, user.getUID());
+ if (visitor.getUid() == 0) {
+ pageUserRefCookie(request, response, user.getUid());
}
response.setContentType("text/html; charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
String head = "<meta name=\"robots\" content=\"noindex\"/>";
- PageTemplates.pageHead(out, visitor, "Читатели " + user.getUName(), head);
+ PageTemplates.pageHead(out, visitor, "Читатели " + user.getName(), head);
PageTemplates.pageNavigation(out, visitor, null);
pageUserColumn(out, sql, user, visitor);
out.println("<section id=\"content\">");
out.println("<table class=\"users\"><tr>");
- List<com.juick.User> readers = UserQueries.getUserReaders(sql, user.getUID());
+ List<com.juick.User> readers = UserQueries.getUserReaders(sql, user.getUid());
for (int i = 0; i < readers.size(); i++) {
if (i % 3 == 0 && i > 0) {
out.print("</tr><tr>");
}
- out.print("<td><a href=\"/" + readers.get(i).getUName()
- + "/\"><img src=\"//i.juick.com/as/" + readers.get(i).getUID() + ".png\"/>"
- + readers.get(i).getUName() + "</a></td>");
+ out.print("<td><a href=\"/" + readers.get(i).getName()
+ + "/\"><img src=\"//i.juick.com/as/" + readers.get(i).getUid() + ".png\"/>"
+ + readers.get(i).getName() + "</a></td>");
}
out.println("</tr></table>");
@@ -267,21 +267,21 @@ public class User {
public static void pageUserColumn(PrintWriter out, JdbcTemplate sql, com.juick.User user, com.juick.User visitor) {
out.println("<aside id=\"column\">");
- out.println(" <div id=\"ctitle\"><a href=\"./\"><img src=\"//i.juick.com/as/" + user.getUID() + ".png\" alt=\"\"/>" + user.getUName() + "</a></div>");
- if (visitor.getUID() > 0 && visitor.getUID() != user.getUID()) {
+ out.println(" <div id=\"ctitle\"><a href=\"./\"><img src=\"//i.juick.com/as/" + user.getUid() + ".png\" alt=\"\"/>" + user.getName() + "</a></div>");
+ if (visitor.getUid() > 0 && visitor.getUid() != user.getUid()) {
out.println(" <ul id=\"ctoolbar\">");
- if (UserQueries.isSubscribed(sql, visitor.getUID(), user.getUID())) {
- out.println(" <li><a href=\"/post?body=U+%40" + user.getUName() + "\" title=\"Подписан\"><div style=\"background-position: -48px 0\"></div></a></li>");
+ if (UserQueries.isSubscribed(sql, visitor.getUid(), user.getUid())) {
+ out.println(" <li><a href=\"/post?body=U+%40" + user.getName() + "\" title=\"Подписан\"><div style=\"background-position: -48px 0\"></div></a></li>");
} else {
- out.println(" <li><a href=\"/post?body=S+%40" + user.getUName() + "\" title=\"Подписаться\"><div style=\"background-position: -16px 0\"></div></a></li>");
+ out.println(" <li><a href=\"/post?body=S+%40" + user.getName() + "\" title=\"Подписаться\"><div style=\"background-position: -16px 0\"></div></a></li>");
}
- if (UserQueries.isInBL(sql, visitor.getUID(), user.getUID())) {
- out.println(" <li><a href=\"/post?body=BL+%40" + user.getUName() + "\" title=\"Разблокировать\"><div style=\"background-position: -96px 0\"></div></a></li>");
+ if (UserQueries.isInBL(sql, visitor.getUid(), user.getUid())) {
+ out.println(" <li><a href=\"/post?body=BL+%40" + user.getName() + "\" title=\"Разблокировать\"><div style=\"background-position: -96px 0\"></div></a></li>");
} else {
- out.println(" <li><a href=\"/post?body=BL+%40" + user.getUName() + "\" title=\"Заблокировать\"><div style=\"background-position: -80px 0\"></div></a></li>");
+ out.println(" <li><a href=\"/post?body=BL+%40" + user.getName() + "\" title=\"Заблокировать\"><div style=\"background-position: -80px 0\"></div></a></li>");
}
- if (!UserQueries.isInBLAny(sql, user.getUID(), visitor.getUID())) {
- out.println(" <li><a href=\"/pm/sent?uname=" + user.getUName() + "\" title=\"Написать приватное сообщение\"><div style=\"background-position: -112px 0\"></div></a></li>");
+ if (!UserQueries.isInBLAny(sql, user.getUid(), visitor.getUid())) {
+ out.println(" <li><a href=\"/pm/sent?uname=" + user.getName() + "\" title=\"Написать приватное сообщение\"><div style=\"background-position: -112px 0\"></div></a></li>");
}
out.println(" </ul>");
} else {
@@ -299,13 +299,13 @@ public class User {
out.println(" <p class=\"tags\">" + pageUserTags(sql, user, visitor, 20) + "<a href=\"./tags\" rel=\"nofollow\">...</a></p>");
out.println(" <hr/>");
out.println(" <div id=\"ustats\"><ul>");
- out.println(" <li><a href=\"./friends\">Я читаю: " + UserQueries.getStatsIRead(sql, user.getUID()) + "</a></li>");
- out.println(" <li><a href=\"./readers\">Мои подписчики: " + UserQueries.getStatsMyReaders(sql, user.getUID()) + "</a></li>");
- out.println(" <li>Сообщений: " + UserQueries.getStatsMessages(sql, user.getUID()) + "</li>");
- out.println(" <li>Комментариев: " + UserQueries.getStatsReplies(sql, user.getUID()) + "</li>");
+ out.println(" <li><a href=\"./friends\">Я читаю: " + UserQueries.getStatsIRead(sql, user.getUid()) + "</a></li>");
+ out.println(" <li><a href=\"./readers\">Мои подписчики: " + UserQueries.getStatsMyReaders(sql, user.getUid()) + "</a></li>");
+ out.println(" <li>Сообщений: " + UserQueries.getStatsMessages(sql, user.getUid()) + "</li>");
+ out.println(" <li>Комментариев: " + UserQueries.getStatsReplies(sql, user.getUid()) + "</li>");
out.println(" </ul>");
- List<com.juick.User> iread = UserQueries.getUserReadLeastPopular(sql, user.getUID(), 8);
+ List<com.juick.User> iread = UserQueries.getUserReadLeastPopular(sql, user.getUid(), 8);
if (!iread.isEmpty()) {
out.println("<table class=\"iread\"><tr>");
for (int i = 0; i < iread.size(); i++) {
@@ -313,7 +313,7 @@ public class User {
out.println("</tr><tr>");
}
com.juick.User u = iread.get(i);
- out.println("<td><a href=\"/" + u.getUName() + "/\"><img src=\"//i.juick.com/a/" + u.getUID() + ".png\" alt=\"" + u.getUName() + "\"/></a></td>");
+ out.println("<td><a href=\"/" + u.getName() + "/\"><img src=\"//i.juick.com/a/" + u.getUid() + ".png\" alt=\"" + u.getName() + "\"/></a></td>");
}
out.println("</tr></table>");
}
@@ -323,7 +323,7 @@ public class User {
}
public static String pageUserTags(JdbcTemplate sql, com.juick.User user, com.juick.User visitor, int cnt) {
- List<Tag> tags = TagQueries.getUserTagsAll(sql, user.getUID()).stream()
+ List<Tag> tags = TagQueries.getUserTagsAll(sql, user.getUid()).stream()
.sorted((e1, e2) -> Integer.compare(e2.UsageCnt, e1.UsageCnt)).collect(Collectors.toList());
int maxUsageCnt = tags.stream().map(t -> t.UsageCnt).max(Integer::max).orElse(0);
String ret = "";
diff --git a/juick-www/src/main/java/com/juick/www/UserThread.java b/juick-www/src/main/java/com/juick/www/UserThread.java
index 5f9f7e9a..3dee9697 100644
--- a/juick-www/src/main/java/com/juick/www/UserThread.java
+++ b/juick-www/src/main/java/com/juick/www/UserThread.java
@@ -40,7 +40,7 @@ public class UserThread {
protected void doGetThread(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response, int MID) throws ServletException, IOException {
com.juick.User visitor = Utils.getVisitorUser(sql, request, response);
- if (!MessagesQueries.canViewThread(sql, MID, visitor.getUID())) {
+ if (!MessagesQueries.canViewThread(sql, MID, visitor.getUid())) {
response.sendError(403);
return;
}
@@ -52,27 +52,27 @@ public class UserThread {
if (paramView != null) {
if (paramView.equals("list")) {
listview = true;
- if (visitor.getUID() > 0) {
- UserQueries.setUserOptionInt(sql, visitor.getUID(), "repliesview", 1);
+ if (visitor.getUid() > 0) {
+ UserQueries.setUserOptionInt(sql, visitor.getUid(), "repliesview", 1);
}
- } else if (paramView.equals("tree") && visitor.getUID() > 0) {
- UserQueries.setUserOptionInt(sql, visitor.getUID(), "repliesview", 0);
+ } else if (paramView.equals("tree") && visitor.getUid() > 0) {
+ UserQueries.setUserOptionInt(sql, visitor.getUid(), "repliesview", 0);
}
- } else if (visitor.getUID() > 0 && UserQueries.getUserOptionInt(sql, visitor.getUID(), "repliesview", 0) == 1) {
+ } else if (visitor.getUid() > 0 && UserQueries.getUserOptionInt(sql, visitor.getUid(), "repliesview", 0) == 1) {
listview = true;
}
- String title = msg.getUser().getUName() + ": " + msg.getTagsString();
+ String title = msg.getUser().getName() + ": " + msg.getTagsString();
- if (visitor.getUID() > 0) {
- User.pageUserRefCookie(request, response, msg.getUser().getUID());
+ if (visitor.getUid() > 0) {
+ User.pageUserRefCookie(request, response, msg.getUser().getUid());
}
response.setContentType("text/html; charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
- String headers = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"@" + msg.getUser().getUName() + "\" href=\"//rss.juick.com/" + msg.getUser().getUName() + "/blog\"/>";
+ String headers = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"@" + msg.getUser().getName() + "\" href=\"//rss.juick.com/" + msg.getUser().getName() + "/blog\"/>";
if (paramView != null) {
- headers += "<link rel=\"canonical\" href=\"http://juick.com/" + msg.getUser().getUName() + "/" + msg.getMID() + "\"/>";
+ headers += "<link rel=\"canonical\" href=\"http://juick.com/" + msg.getUser().getName() + "/" + msg.getMid() + "\"/>";
}
if (msg.Hidden) {
headers += "<meta name=\"robots\" content=\"noindex\"/>";
@@ -80,7 +80,7 @@ public class UserThread {
PageTemplates.pageHead(out, visitor, title, headers);
PageTemplates.pageNavigation(out, visitor, null);
- out.println("<section id=\"content\" data-mid=\"" + msg.getMID() + "\" style=\"margin-left: 0; width: 100%\">");
+ out.println("<section id=\"content\" data-mid=\"" + msg.getMid() + "\" style=\"margin-left: 0; width: 100%\">");
printMessage(out, sql, msg, visitor);
printReplies(out, sql, msg, visitor, listview);
out.println("</section>");
@@ -92,20 +92,20 @@ public class UserThread {
}
public static com.juick.Message printMessage(PrintWriter out, JdbcTemplate sql, com.juick.Message msg, com.juick.User visitor) {
- msg.VisitorCanComment = visitor.getUID() > 0;
+ msg.VisitorCanComment = visitor.getUid() > 0;
- List<Tag> tags = MessagesQueries.getMessageTags(sql, msg.getMID());
+ List<Tag> tags = MessagesQueries.getMessageTags(sql, msg.getMid());
String tagsStr = PageTemplates.formatTags(tags);
if (msg.ReadOnly) {
tagsStr += "<a>readonly</a>";
msg.VisitorCanComment = false;
}
- if (msg.Privacy < 0) {
+ if (msg.getPrivacy() < 0) {
tagsStr += "<a>friends</a>";
}
String txt;
- if (msg.Tags.stream().anyMatch(t -> t.getName().equals("code"))) {
+ if (msg.getTags().stream().anyMatch(t -> t.getName().equals("code"))) {
txt = Utils.formatMessageCode(msg.getText());
} else {
txt = Utils.formatMessage(msg.getText());
@@ -116,24 +116,24 @@ public class UserThread {
}
out.println("<ul>");
- out.println(" <li id=\"msg-" + msg.getMID() + "\" data-mid=\"" + msg.getMID() + "\" class=\"msg msgthread\">");
+ out.println(" <li id=\"msg-" + msg.getMid() + "\" data-mid=\"" + msg.getMid() + "\" class=\"msg msgthread\">");
out.println(" <div class=\"msg-cont\">");
out.println(" <div class=\"msg-menu\"><a href=\"#\"></a></div>");
out.println(" <div class=\"msg-ts\">" + PageTemplates.formatJSLocalTime(msg.getDate()) + "</div>");
- out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.getUser().getUName() + "/\"><img src=\"//i.juick.com/a/" + msg.getUser().getUID() + ".png\" alt=\"" + msg.getUser().getUName() + "\"/></a></div>");
- out.println(" <div class=\"msg-header\">@<a href=\"/" + msg.getUser().getUName() + "/\">" + msg.getUser().getUName() + "</a>:" + tagsStr + "</div>");
+ out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.getUser().getName() + "/\"><img src=\"//i.juick.com/a/" + msg.getUser().getUid() + ".png\" alt=\"" + msg.getUser().getName() + "\"/></a></div>");
+ out.println(" <div class=\"msg-header\">@<a href=\"/" + msg.getUser().getName() + "/\">" + msg.getUser().getName() + "</a>:" + tagsStr + "</div>");
out.println(" <div class=\"msg-txt\">" + txt + "</div>");
if (msg.AttachmentType != null) {
- out.println(" <div class=\"msg-media\"><a href=\"//i.juick.com/p/" + msg.getMID() + "." + msg.AttachmentType + "\"><img src=\"//i.juick.com/photos-512/" + msg.getMID() + "." + msg.AttachmentType + "\" alt=\"\"/></a></div>");
+ out.println(" <div class=\"msg-media\"><a href=\"//i.juick.com/p/" + msg.getMid() + "." + msg.AttachmentType + "\"><img src=\"//i.juick.com/photos-512/" + msg.getMid() + "." + msg.AttachmentType + "\" alt=\"\"/></a></div>");
}
boolean visitorInBL = false;
- if (visitor.getUID() > 0) {
- if (visitor.getUID() == msg.getUser().getUID()) {
+ if (visitor.getUid() > 0) {
+ if (visitor.getUid() == msg.getUser().getUid()) {
msg.VisitorCanComment = true;
} else {
- visitorInBL = UserQueries.isInBL(sql, msg.getUser().getUID(), visitor.getUID());
+ visitorInBL = UserQueries.isInBL(sql, msg.getUser().getUid(), visitor.getUid());
if (visitorInBL) {
msg.VisitorCanComment = false;
}
@@ -141,12 +141,12 @@ public class UserThread {
}
if (msg.VisitorCanComment) {
- out.println(" <form action=\"/comment\" method=\"POST\" enctype=\"multipart/form-data\"><input type=\"hidden\" name=\"mid\" value=\"" + msg.getMID() + "\"/>");
+ out.println(" <form action=\"/comment\" method=\"POST\" enctype=\"multipart/form-data\"><input type=\"hidden\" name=\"mid\" value=\"" + msg.getMid() + "\"/>");
out.println(" <div class=\"msg-comment\"><div class=\"ta-wrapper\"><textarea name=\"body\" rows=\"1\" class=\"reply\" placeholder=\"Написать комментарий\"></textarea></div></div>");
out.println(" </form>");
}
- List<String> recomm = MessagesQueries.getMessageRecommendations(sql, msg.getMID());
+ List<String> recomm = MessagesQueries.getMessageRecommendations(sql, msg.getMid());
if (!recomm.isEmpty()) {
out.print(" <div class=\"" + (msg.VisitorCanComment ? "msg-recomms" : "msg-comments") + "\">Рекомендовали (" + recomm.size() + "): ");
for (int i = 0; i < recomm.size(); i++) {
@@ -161,19 +161,19 @@ public class UserThread {
out.println(" </li>");
out.println(" <li id=\"mtoolbar\"><ul>");
- out.println(" <li><a href=\"/" + msg.getMID() + "\"><div style=\"background-position: -64px 0\"></div>" + msg.getMID() + "</a></li>");
- if (visitor.getUID() > 0) {
- if (visitor.getUID() != msg.getUser().getUID()) {
- if (MessagesQueries.isSubscribed(sql, visitor.getUID(), msg.getMID())) {
- out.println(" <li><a href=\"/post?body=U+%23" + msg.getMID() + "\"><div style=\"background-position: -48px 0\"></div>Подписан</a></li>");
+ out.println(" <li><a href=\"/" + msg.getMid() + "\"><div style=\"background-position: -64px 0\"></div>" + msg.getMid() + "</a></li>");
+ if (visitor.getUid() > 0) {
+ if (visitor.getUid() != msg.getUser().getUid()) {
+ if (MessagesQueries.isSubscribed(sql, visitor.getUid(), msg.getMid())) {
+ out.println(" <li><a href=\"/post?body=U+%23" + msg.getMid() + "\"><div style=\"background-position: -48px 0\"></div>Подписан</a></li>");
} else {
- out.println(" <li><a href=\"/post?body=S+%23" + msg.getMID() + "\"><div style=\"background-position: -16px 0\"></div>Подписаться</a></li>");
+ out.println(" <li><a href=\"/post?body=S+%23" + msg.getMid() + "\"><div style=\"background-position: -16px 0\"></div>Подписаться</a></li>");
}
if (!visitorInBL) {
- out.println(" <li><a href=\"/post?body=%21+%23" + msg.getMID() + "\"><div style=\"background-position: -32px 0\"></div>Рекомендовать</a></li>");
+ out.println(" <li><a href=\"/post?body=%21+%23" + msg.getMid() + "\"><div style=\"background-position: -32px 0\"></div>Рекомендовать</a></li>");
}
} else {
- out.println(" <li><a href=\"/post?body=D+%23" + msg.getMID() + "\"><div style=\"background-position: 0\"></div>Удалить</a></li>");
+ out.println(" <li><a href=\"/post?body=D+%23" + msg.getMid() + "\"><div style=\"background-position: 0\"></div>Удалить</a></li>");
}
}
out.println(" </ul></li>");
@@ -183,38 +183,38 @@ public class UserThread {
}
public static void printReplies(PrintWriter out, JdbcTemplate sql, com.juick.Message msg, com.juick.User visitor, boolean listview) {
- List<com.juick.Message> replies = MessagesQueries.getReplies(sql, msg.getMID());
+ List<com.juick.Message> replies = MessagesQueries.getReplies(sql, msg.getMid());
List<Integer> blUIDs = new ArrayList<Integer>();
for (int i = 0; i < replies.size(); i++) {
com.juick.Message reply = replies.get(i);
- if (reply.getUser().getUID() != msg.getUser().getUID() && !blUIDs.contains(reply.getUser().getUID())) {
- blUIDs.add(reply.getUser().getUID());
+ if (reply.getUser().getUid() != msg.getUser().getUid() && !blUIDs.contains(reply.getUser().getUid())) {
+ blUIDs.add(reply.getUser().getUid());
}
- if (reply.ReplyTo > 0) {
+ if (reply.getReplyto() > 0) {
boolean added = false;
for (int n = 0; n < replies.size(); n++) {
- if (replies.get(n).getRID() == reply.ReplyTo) {
+ if (replies.get(n).getRid() == reply.getReplyto()) {
replies.get(n).childs.add(reply);
added = true;
break;
}
}
if (!added) {
- reply.ReplyTo = 0;
+ reply.setReplyto(0);
}
}
}
if (!replies.isEmpty()) {
- if (visitor.getUID() > 0 && msg.getUser().getUID() == visitor.getUID()) {
+ if (visitor.getUid() > 0 && msg.getUser().getUid() == visitor.getUid()) {
for (Message reply : replies) {
reply.VisitorCanComment = true;
}
- } else if (visitor.getUID() > 0 && msg.VisitorCanComment) {
- blUIDs = UserQueries.checkBL(sql, visitor.getUID(), blUIDs);
+ } else if (visitor.getUid() > 0 && msg.VisitorCanComment) {
+ blUIDs = UserQueries.checkBL(sql, visitor.getUid(), blUIDs);
for (Message reply : replies) {
- reply.VisitorCanComment = reply.getUser().getUID() == visitor.getUID() || !blUIDs.contains(reply.getUser().getUID());
+ reply.VisitorCanComment = reply.getUser().getUid() == visitor.getUid() || !blUIDs.contains(reply.getUser().getUid());
}
} else {
for (Message reply : replies) {
@@ -268,9 +268,9 @@ public class UserThread {
for (int i = 0; i < replies.size(); i++) {
com.juick.Message msg = replies.get(i);
- if (msg.ReplyTo == ReplyTo) {
+ if (msg.getReplyto() == ReplyTo) {
- out.print(" <li id=\"" + msg.getRID() + "\" class=\"msg\" style=\"");
+ out.print(" <li id=\"" + msg.getRid() + "\" class=\"msg\" style=\"");
if (margin > 0) {
out.print("margin-left: " + margin + "px;");
}
@@ -280,26 +280,26 @@ public class UserThread {
out.println("\">");
out.println(" <div class=\"msg-cont\">");
out.println(" <div class=\"msg-header\">");
- if (!msg.getUser().Banned) {
- out.println(" @<a href=\"/" + msg.getUser().getUName() + "/\">" + msg.getUser().getUName() + "</a>:");
- out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.getUser().getUName() + "/\"><img src=\"//i.juick.com/a/" + msg.getUser().getUID() + ".png\" alt=\"" + msg.getUser().getUName() + "\"/></a></div>");
+ if (!msg.getUser().isBanned()) {
+ out.println(" @<a href=\"/" + msg.getUser().getName() + "/\">" + msg.getUser().getName() + "</a>:");
+ out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.getUser().getName() + "/\"><img src=\"//i.juick.com/a/" + msg.getUser().getUid() + ".png\" alt=\"" + msg.getUser().getName() + "\"/></a></div>");
} else {
out.println(" [удалено]:");
out.println(" <div class=\"msg-avatar\"><img src=\"//i.juick.com/av-96.png\"/></div>");
}
out.println(" <div class=\"msg-menu\"><a href=\"#\" class=\"a-thread-links\"></a></div>");
- out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.getMID() + "#" + msg.getRID() + "\" title=\"" + PageTemplates.sdfSQL.format(msg.getDate()) + " GMT\">" + PageTemplates.formatDate(msg.TimeAgo, msg.getDate()) + "</a></div>");
+ out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.getMid() + "#" + msg.getRid() + "\" title=\"" + PageTemplates.sdfSQL.format(msg.getDate()) + " GMT\">" + PageTemplates.formatDate(msg.TimeAgo, msg.getDate()) + "</a></div>");
out.println(" </div>");
out.println(" <div class=\"msg-txt\">" + Utils.formatMessage(msg.getText()) + "</div>");
if (msg.AttachmentType != null) {
- out.println(" <div class=\"msg-media\"><a href=\"//i.juick.com/p/" + msg.getMID() + "-" + msg.getRID() + "." + msg.AttachmentType + "\"><img src=\"//i.juick.com/photos-512/" + msg.getMID() + "-" + msg.getRID() + "." + msg.AttachmentType + "\" alt=\"\"/></a></div>");
+ out.println(" <div class=\"msg-media\"><a href=\"//i.juick.com/p/" + msg.getMid() + "-" + msg.getRid() + "." + msg.AttachmentType + "\"><img src=\"//i.juick.com/photos-512/" + msg.getMid() + "-" + msg.getRid() + "." + msg.AttachmentType + "\" alt=\"\"/></a></div>");
}
- out.print(" <div class=\"msg-links\">/" + msg.getRID());
- if (msg.ReplyTo > 0) {
- out.print(" в ответ на <a href=\"#" + msg.ReplyTo + "\">/" + msg.ReplyTo + "</a>");
+ out.print(" <div class=\"msg-links\">/" + msg.getRid());
+ if (msg.getReplyto() > 0) {
+ out.print(" в ответ на <a href=\"#" + msg.getReplyto() + "\">/" + msg.getReplyto() + "</a>");
}
if (msg.VisitorCanComment) {
- out.println(" &#183; <a href=\"/post?body=%23" + msg.getMID() + "/" + msg.getRID() + "%20\" class=\"a-thread-comment\">Ответить</a></div>");
+ out.println(" &#183; <a href=\"/post?body=%23" + msg.getMid() + "/" + msg.getRid() + "%20\" class=\"a-thread-comment\">Ответить</a></div>");
out.println(" <div class=\"msg-comment\" style=\"display: none\"></div>");
} else if (visitor == null) {
out.println(" &#183; <a href=\"#\" class=\"a-login\">Ответить</a></div>");
@@ -313,9 +313,9 @@ public class UserThread {
out.println(" </li>");
if (ReplyTo == 0 && childs > 1 && replies.size() > 10) {
- printTree(out, msg.childs, visitor, msg.getRID(), margin + 20, true);
+ printTree(out, msg.childs, visitor, msg.getRid(), margin + 20, true);
} else if (childs > 0) {
- printTree(out, msg.childs, visitor, msg.getRID(), margin + 20, hidden);
+ printTree(out, msg.childs, visitor, msg.getRid(), margin + 20, hidden);
}
}
}
@@ -323,32 +323,32 @@ public class UserThread {
public static void printList(PrintWriter out, List<com.juick.Message> replies, com.juick.User visitor) {
for (Message msg : replies) {
- out.print(" <li id=\"" + msg.getRID() + "\" class=\"msg\">");
+ out.print(" <li id=\"" + msg.getRid() + "\" class=\"msg\">");
out.println(" <div class=\"msg-cont\">");
out.println(" <div class=\"msg-header\">");
- if (!msg.getUser().Banned) {
- out.println(" @<a href=\"/" + msg.getUser().getUName() + "/\">" + msg.getUser().getUName() + "</a>:");
- out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.getUser().getUName() + "/\"><img src=\"//i.juick.com/a/" + msg.getUser().getUID() + ".png\" alt=\"" + msg.getUser().getUName() + "\"/></a></div>");
+ if (!msg.getUser().isBanned()) {
+ out.println(" @<a href=\"/" + msg.getUser().getName() + "/\">" + msg.getUser().getName() + "</a>:");
+ out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.getUser().getName() + "/\"><img src=\"//i.juick.com/a/" + msg.getUser().getUid() + ".png\" alt=\"" + msg.getUser().getName() + "\"/></a></div>");
} else {
out.println(" [удалено]:");
out.println(" <div class=\"msg-avatar\"><img src=\"//i.juick.com/av-96.png\"/></div>");
}
out.println(" <div class=\"msg-menu\"><a href=\"#\" class=\"a-thread-links\"></a></div>");
- out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.getMID() + "#" + msg.getRID() + "\" title=\"" + PageTemplates.sdfSQL.format(msg.getDate()) + " GMT\">" + PageTemplates.formatDate(msg.TimeAgo, msg.getDate()) + "</a></div>");
+ out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.getMid() + "#" + msg.getRid() + "\" title=\"" + PageTemplates.sdfSQL.format(msg.getDate()) + " GMT\">" + PageTemplates.formatDate(msg.TimeAgo, msg.getDate()) + "</a></div>");
out.println(" </div>");
out.println(" <div class=\"msg-txt\">" + Utils.formatMessage(msg.getText()) + "</div>");
if (msg.AttachmentType != null) {
- out.println(" <div class=\"msg-media\"><a href=\"//i.juick.com/p/" + msg.getMID() + "-" + msg.getRID() + "." + msg.AttachmentType + "\"><img src=\"//i.juick.com/photos-512/" + msg.getMID() + "-" + msg.getRID() + "." + msg.AttachmentType + "\" alt=\"\"/></a></div>");
+ out.println(" <div class=\"msg-media\"><a href=\"//i.juick.com/p/" + msg.getMid() + "-" + msg.getRid() + "." + msg.AttachmentType + "\"><img src=\"//i.juick.com/photos-512/" + msg.getMid() + "-" + msg.getRid() + "." + msg.AttachmentType + "\" alt=\"\"/></a></div>");
}
- out.print(" <div class=\"msg-links\">/" + msg.getRID());
- if (msg.ReplyTo > 0) {
- out.print(" в ответ на <a href=\"#" + msg.ReplyTo + "\">/" + msg.ReplyTo + "</a>");
+ out.print(" <div class=\"msg-links\">/" + msg.getRid());
+ if (msg.getReplyto() > 0) {
+ out.print(" в ответ на <a href=\"#" + msg.getReplyto() + "\">/" + msg.getReplyto() + "</a>");
}
if (msg.VisitorCanComment) {
out.println(" &#183; <a href=\"#\" class=\"a-thread-comment\">Ответить</a></div>");
out.println(" <div class=\"msg-comment\" style=\"display: none\"></div>");
- } else if (visitor.getUID() == 0) {
- out.println(" <div class=\"msg-links\"><a href=\"/post?body=%23" + msg.getMID() + "/" + msg.getRID() + "%20\" class=\"a-thread-comment\">Ответить</a></div>");
+ } else if (visitor.getUid() == 0) {
+ out.println(" <div class=\"msg-links\"><a href=\"/post?body=%23" + msg.getMid() + "/" + msg.getRid() + "%20\" class=\"a-thread-comment\">Ответить</a></div>");
}
out.println(" </div>");
out.println(" </li>");
diff --git a/juick-www/src/main/java/com/juick/www/Utils.java b/juick-www/src/main/java/com/juick/www/Utils.java
index c236ac62..988ecb17 100644
--- a/juick-www/src/main/java/com/juick/www/Utils.java
+++ b/juick-www/src/main/java/com/juick/www/Utils.java
@@ -86,8 +86,8 @@ public class Utils {
String hash = getCookie(request, "hash");
if (hash != null) {
com.juick.User visitor = com.juick.server.UserQueries.getUserByHash(sql, hash);
- if (response != null && visitor.getUID() > 0) {
- response.setHeader("X-Username", visitor.getUName());
+ if (response != null && visitor.getUid() > 0) {
+ response.setHeader("X-Username", visitor.getName());
}
return visitor;
} else {