diff options
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/User.java')
-rw-r--r-- | juick-www/src/main/java/com/juick/www/User.java | 104 |
1 files changed, 52 insertions, 52 deletions
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 = ""; |