aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main/java/com/juick/www/PageTemplates.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-07-10 22:56:58 +0300
committerGravatar Vitaly Takmazov2016-07-10 22:56:58 +0300
commit156ab97673d7552c11784d0cdd53f8f37923a294 (patch)
tree2ae4a8928c869cc428eb5a48cf1bda6606e9f2ea /juick-www/src/main/java/com/juick/www/PageTemplates.java
parenta0fa66fd9587407030d1c1ed3c5ee57d15c280fb (diff)
fix getUserByHash usage, part 2
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/PageTemplates.java')
-rw-r--r--juick-www/src/main/java/com/juick/www/PageTemplates.java20
1 files changed, 9 insertions, 11 deletions
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 f2483ac0..b7883a79 100644
--- a/juick-www/src/main/java/com/juick/www/PageTemplates.java
+++ b/juick-www/src/main/java/com/juick/www/PageTemplates.java
@@ -87,7 +87,7 @@ public class PageTemplates {
}
out.println("/></form></div>");
out.println(" <section id=\"headdiv\">");
- if (visitor != null) {
+ 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>");
@@ -145,7 +145,7 @@ public class PageTemplates {
String queryString = request.getQueryString();
String requestURI = request.getRequestURI();
- if (sapeon && sape != null && (visitor == null || 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);
@@ -155,7 +155,7 @@ public class PageTemplates {
out.println("</div>");
out.println("</div>");
- if (visitor != null) {
+ if (visitor.getUID() > 0) {
out.println("<script type=\"text/javascript\">");
out.println("var hash=\"" + visitor.getAuthHash() + "\";");
out.println("</script>");
@@ -412,11 +412,9 @@ public class PageTemplates {
blUIDs = UserQueries.checkBL(sql, visitor.getUID(), blUIDs);
}
- for (int i = 0; i < msgs.size(); i++) {
-
- com.juick.Message msg = msgs.get(i);
+ for (Message msg : msgs) {
- List<com.juick.Tag> tags = MessagesQueries.getMessageTags(sql, msg.getMID());
+ List<Tag> tags = MessagesQueries.getMessageTags(sql, msg.getMID());
String tagsStr = formatTags(tags);
if (msg.ReadOnly) {
tagsStr += " *readonly";
@@ -450,15 +448,15 @@ public class PageTemplates {
out.print(" <nav class=\"l\">");
msg.ReadOnly |= blUIDs.contains(msg.getUser().getUID());
out.print("<a href=\"#\" onclick=\"return likeMessage(this," + msg.getMID() + ")\">Мне нравится</a>");
- if (visitor == null && !msg.ReadOnly) {
+ if (visitor.getUID() == 0 && !msg.ReadOnly) {
out.print("<a href=\"#\" onclick=\"return openDialogLogin()\">Комментировать</a> ");
- } else if (visitor != null && (!msg.ReadOnly || visitor.getUID() == msg.getUser().getUID())) {
+ } else if (visitor.getUID() > 0 && (!msg.ReadOnly || visitor.getUID() == msg.getUser().getUID())) {
out.print("<a href=\"#\" onclick=\"return showCommentFooter(this)\">Комментировать</a> ");
}
- if (visitor != null && msg.Privacy < 0 && msg.getUser().getUID() == visitor.getUID()) {
+ if (visitor.getUID() > 0 && msg.Privacy < 0 && msg.getUser().getUID() == visitor.getUID()) {
out.print(" <a href=\"#\" onclick=\"return setPrivacy(this," + msg.getMID() + ")\">Открыть доступ</a>");
}
- if (visitor != null && visitor.getUID() == 3694) {
+ if (visitor.getUID() > 0 && visitor.getUID() == 3694) {
out.print(" <a href=\"#\" onclick=\"return setPopular(this," + msg.getMID() + ",2)\">+</a>");
out.print(" <a href=\"#\" onclick=\"return setPopular(this," + msg.getMID() + ",-1)\">-</a>");
out.print(" <a href=\"#\" onclick=\"return setPopular(this," + msg.getMID() + ",-2)\">x</a>");