aboutsummaryrefslogtreecommitdiff
path: root/src/java/com/juick/http
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2013-01-03 17:24:54 +0700
committerGravatar Ugnich Anton2013-01-03 17:24:54 +0700
commit881bc336c1cef93d08cd1f14e37f3a3feeb07e58 (patch)
treefcd3ea5ff881a1f59e4d42fd57dee7003b5bcdc1 /src/java/com/juick/http
parent84e5ac3a172e15f11b04203cf9e93c9d5c8174ed (diff)
many bugfixes
message number js autoselection privacy fix
Diffstat (limited to 'src/java/com/juick/http')
-rw-r--r--src/java/com/juick/http/www/Blogs.java11
-rw-r--r--src/java/com/juick/http/www/Help.java2
-rw-r--r--src/java/com/juick/http/www/Login.java4
-rw-r--r--src/java/com/juick/http/www/NewMessage.java2
-rw-r--r--src/java/com/juick/http/www/PageTemplates.java110
-rw-r--r--src/java/com/juick/http/www/User.java10
-rw-r--r--src/java/com/juick/http/www/UserThread.java6
7 files changed, 65 insertions, 80 deletions
diff --git a/src/java/com/juick/http/www/Blogs.java b/src/java/com/juick/http/www/Blogs.java
index 44c734d2..4af75cd3 100644
--- a/src/java/com/juick/http/www/Blogs.java
+++ b/src/java/com/juick/http/www/Blogs.java
@@ -92,11 +92,12 @@ public class Blogs {
}
com.juick.Place place = null;
+ int visitor_uid = visitor != null ? visitor.UID : 0;
if (paramShow == null) {
if (paramTag > 0) {
title = "*" + Utils.encodeHTML(paramTagStr);
- mids = MessagesQueries.getTag(sql, paramTag, paramBefore);
+ mids = MessagesQueries.getTag(sql, paramTag, visitor_uid, paramBefore);
} else if (paramSearch != null) {
title = rb.getString("Search") + ": " + Utils.encodeHTML(paramSearch);
mids = MessagesQueries.getSearch(sql, sqlSearch, Utils.encodeSphinx(paramSearch), paramBefore);
@@ -109,14 +110,14 @@ public class Blogs {
place = com.juick.server.PlacesQueries.getPlace(sql, place_id);
if (place != null) {
title = place.name;
- mids = MessagesQueries.getPlace(sql, place_id, paramBefore);
+ mids = MessagesQueries.getPlace(sql, place_id, visitor_uid, paramBefore);
} else {
response.sendError(404);
return;
}
} else {
title = rb.getString("Last messages");
- mids = MessagesQueries.getAll(sql, paramBefore);
+ mids = MessagesQueries.getAll(sql, visitor_uid, paramBefore);
}
} else if (paramShow.equals("my")) {
if (visitor != null) {
@@ -155,7 +156,7 @@ public class Blogs {
mids = MessagesQueries.getPopular(sql, paramBefore);
} else if (paramShow.equals("photos")) {
title = rb.getString("With photos");
- mids = MessagesQueries.getPhotos(sql, paramBefore);
+ mids = MessagesQueries.getPhotos(sql, visitor_uid, paramBefore);
} else {
response.sendError(404);
return;
@@ -222,7 +223,7 @@ public class Blogs {
out.println("</div>"); // topwrapper
PageTemplates.pageDialogTemplate(out, locale);
- PageTemplates.pageFooter(request, out, locale, visitor);
+ PageTemplates.pageFooter(request, out, locale, visitor, true);
} finally {
out.close();
}
diff --git a/src/java/com/juick/http/www/Help.java b/src/java/com/juick/http/www/Help.java
index e780e196..3dfe1f80 100644
--- a/src/java/com/juick/http/www/Help.java
+++ b/src/java/com/juick/http/www/Help.java
@@ -92,7 +92,7 @@ public class Help {
out.println("</div>");
- PageTemplates.pageFooter(request, out, locale, visitor);
+ PageTemplates.pageFooter(request, out, locale, visitor, false);
} finally {
out.close();
}
diff --git a/src/java/com/juick/http/www/Login.java b/src/java/com/juick/http/www/Login.java
index 326206da..e2585909 100644
--- a/src/java/com/juick/http/www/Login.java
+++ b/src/java/com/juick/http/www/Login.java
@@ -46,6 +46,7 @@ public class Login {
PageTemplates.pageHead(out, rb.getString("Login"), "");
PageTemplates.pageNavigation(out, locale, visitor, null);
+ out.println("<div id=\"topwrapper\">");
out.println("<div id=\"wrapper\">");
out.println("<div id=\"content\">");
out.println("<form action=\"/login\" method=\"post\">");
@@ -55,8 +56,9 @@ public class Login {
out.println("</form>");
out.println("</div>");
out.println("</div>");
+ out.println("</div>"); // topwrapper
- PageTemplates.pageFooter(request, out, locale, visitor);
+ PageTemplates.pageFooter(request, out, locale, visitor, false);
} finally {
out.close();
}
diff --git a/src/java/com/juick/http/www/NewMessage.java b/src/java/com/juick/http/www/NewMessage.java
index b66b87d1..369e9de3 100644
--- a/src/java/com/juick/http/www/NewMessage.java
+++ b/src/java/com/juick/http/www/NewMessage.java
@@ -76,7 +76,7 @@ public class NewMessage {
out.println("</div>");
out.println("</div>");
- PageTemplates.pageFooter(request, out, locale, visitor);
+ PageTemplates.pageFooter(request, out, locale, visitor, false);
} finally {
out.close();
}
diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java
index 67f036fc..080752d1 100644
--- a/src/java/com/juick/http/www/PageTemplates.java
+++ b/src/java/com/juick/http/www/PageTemplates.java
@@ -23,9 +23,6 @@ import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -55,11 +52,11 @@ public class PageTemplates {
out.println("<html>");
out.println("<head>");
out.println(" <title>" + title + "</title>");
- out.println(" <link rel=\"stylesheet\" href=\"//static.juick.com/style3.2013010101.css\"/>");
+ out.println(" <link rel=\"stylesheet\" href=\"//static.juick.com/style3.2013010300.css\"/>");
out.println(" <link rel=\"icon\" type=\"image/png\" href=\"//static.juick.com/favicon.png\"/>");
out.println(" <script type=\"text/javascript\" src=\"//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js\" defer=\"defer\"></script>");
out.println(" <script type=\"text/javascript\" src=\"//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js\" defer=\"defer\" async=\"async\"></script>");
- out.println(" <script type=\"text/javascript\" src=\"//static.juick.com/scripts3.2013010100.js\" defer=\"defer\"></script>");
+ out.println(" <script type=\"text/javascript\" src=\"//static.juick.com/scripts3.2013010300.js\" defer=\"defer\"></script>");
if (headers != null) {
out.println(headers);
}
@@ -85,69 +82,54 @@ public class PageTemplates {
out.println(" <li class=\"right\"><a href=\"/" + user.UName + "\" class=\"wide\"><img src=\"//i.juick.com/as/" + user.UID + ".png\" alt=\"" + user.UName + "\"/><label>" + user.UName + "</label></a></li>");
out.println(" <li class=\"right\"><a href=\"/post\" class=\"wide\"><div class=\"head-ico\" id=\"hi-post\"></div><label>" + rb.getString("Post") + "</label></a></li>");
} else {
- out.println(" <li class=\"right\"><a href=\"/login\" class=\"wide\">" + rb.getString("Login") + "</a></li>");
+ out.println(" <li class=\"right\"><a href=\"/login\" class=\"wide\" rel=\"nofollow\">" + rb.getString("Login") + "</a></li>");
}
out.println("</ul>");
out.println("</div>");
}
/*
- public static void pageFilters(PrintWriter out, Locale loc, com.juick.User user) {
- ResourceBundle rb = ResourceBundle.getBundle("Global", loc);
+ public static void pageUserTitle(PrintWriter out, Connection sql, Locale loc, com.juick.User user, com.juick.User visitor) {
+ ResourceBundle rb = ResourceBundle.getBundle("User", loc);
- out.println("<div id=\"filters\">");
- out.println("<ul>");
- out.println(" <li><a href=\"#\">Messages</a></li>");
- out.println(" <li><a href=\"#\">Photos</a></li>");
- out.println(" <li><a href=\"#\">Recommendations</a></li>");
- out.println(" <li><a href=\"#\">Private</a></li>");
- out.println(" <li><a href=\"#\">Tags</a></li>");
- out.println(" <li><a href=\"#\">Users</a></li>");
- out.println("</ul>");
+ // Full name and description
+ String fullname = null;
+ String description = null;
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ try {
+ stmt = sql.prepareStatement("SELECT fullname,descr FROM usersinfo WHERE user_id=?");
+ stmt.setInt(1, user.UID);
+ rs = stmt.executeQuery();
+ if (rs.first()) {
+ fullname = rs.getString(1) + " (" + user.UName + ")";
+ description = rs.getString(2);
+ }
+ } catch (SQLException e) {
+ System.err.println(e);
+ } finally {
+ Utils.finishSQL(rs, stmt);
+ }
+ if (fullname == null) {
+ fullname = user.UName;
+ }
+ if (description == null) {
+ description = "";
+ }
+
+ out.println("<div id=\"title\">");
+ out.println(" <div id=\"title-av\"><a href=\"/" + user.UName + "/\"><img src=\"//i.juick.com/a/" + user.UID + ".png\" width=\"96\" height=\"96\" alt=\"" + user.UName + "\"/></a></div>");
+ out.println(" <div id=\"title-stats\"><ul>");
+ out.println(" <li><a href=\"/" + user.UName + "/friends\">" + rb.getString("(Stats) I read") + ": " + UserQueries.getStatsIRead(sql, user.UID) + "</a></li>");
+ out.println(" <li><a href=\"/" + user.UName + "/readers\">" + rb.getString("(Stats) My readers") + ": " + UserQueries.getStatsMyReaders(sql, user.UID) + "</a></li>");
+ out.println(" <li>" + rb.getString("(Stats) Messages") + ": " + UserQueries.getStatsMessages(sql, user.UID) + "</li>");
+ out.println(" <li>" + rb.getString("(Stats) Replies") + ": " + UserQueries.getStatsReplies(sql, user.UID) + "</li>");
+ out.println(" </ul></div>");
+ out.println(" <div id=\"title-username\"><h1>" + fullname + "</h1><p>" + description + "</p></div>");
out.println("</div>");
+ out.println();
}
*/
- public static void pageUserTitle(PrintWriter out, Connection sql, Locale loc, com.juick.User user, com.juick.User visitor) {
- ResourceBundle rb = ResourceBundle.getBundle("User", loc);
-
- // Full name and description
- String fullname = null;
- String description = null;
- PreparedStatement stmt = null;
- ResultSet rs = null;
- try {
- stmt = sql.prepareStatement("SELECT fullname,descr FROM usersinfo WHERE user_id=?");
- stmt.setInt(1, user.UID);
- rs = stmt.executeQuery();
- if (rs.first()) {
- fullname = rs.getString(1) + " (" + user.UName + ")";
- description = rs.getString(2);
- }
- } catch (SQLException e) {
- System.err.println(e);
- } finally {
- Utils.finishSQL(rs, stmt);
- }
- if (fullname == null) {
- fullname = user.UName;
- }
- if (description == null) {
- description = "";
- }
-
- out.println("<div id=\"title\">");
- out.println(" <div id=\"title-av\"><a href=\"/" + user.UName + "/\"><img src=\"//i.juick.com/a/" + user.UID + ".png\" width=\"96\" height=\"96\" alt=\"" + user.UName + "\"/></a></div>");
- out.println(" <div id=\"title-stats\"><ul>");
- out.println(" <li><a href=\"/" + user.UName + "/friends\">" + rb.getString("(Stats) I read") + ": " + UserQueries.getStatsIRead(sql, user.UID) + "</a></li>");
- out.println(" <li><a href=\"/" + user.UName + "/readers\">" + rb.getString("(Stats) My readers") + ": " + UserQueries.getStatsMyReaders(sql, user.UID) + "</a></li>");
- out.println(" <li>" + rb.getString("(Stats) Messages") + ": " + UserQueries.getStatsMessages(sql, user.UID) + "</li>");
- out.println(" <li>" + rb.getString("(Stats) Replies") + ": " + UserQueries.getStatsReplies(sql, user.UID) + "</li>");
- out.println(" </ul></div>");
- out.println(" <div id=\"title-username\"><h1>" + fullname + "</h1><p>" + description + "</p></div>");
- out.println("</div>");
- out.println();
- }
-
public static void pageYandexAd(PrintWriter out, int stat_id) {
out.println("<div id=\"yandex_ad\"></div>");
out.println("<script type=\"text/javascript\">");
@@ -183,9 +165,9 @@ public class PageTemplates {
ResourceBundle rb = ResourceBundle.getBundle("Global", locale);
out.println("<div id=\"dialogb\" onclick=\"$('#dialogb').hide();$('#dialogw').hide()\"></div>");
out.println("<div id=\"dialogw\">" + rb.getString("(Dialog) Link to message") + ":");
- out.println("<div id=\"dialogl\"></div>");
+ out.println("<div id=\"dialogl\" onclick=\"$(this).selectText()\"></div>");
out.println(rb.getString("(Dialog) Message number") + ":");
- out.println("<div id=\"dialogn\"></div>");
+ out.println("<div id=\"dialogn\" onclick=\"$(this).selectText()\"></div>");
out.println(rb.getString("(Dialog) Share") + ":");
out.println("<ul>");
out.println(" <li><a id=\"sharefb\"></a></li>");
@@ -196,12 +178,12 @@ public class PageTemplates {
out.println("</div>");
}
- public static void pageFooter(HttpServletRequest request, PrintWriter out, Locale loc, com.juick.User visitor) {
+ public static void pageFooter(HttpServletRequest request, PrintWriter out, Locale loc, com.juick.User visitor, boolean sapeon) {
ResourceBundle rb = ResourceBundle.getBundle("Global", loc);
out.println("<div id=\"fwrapper\"><div id=\"footer\">");
- out.println(" <div id=\"footer-right\"><a href=\"/help/ru/contacts\">" + rb.getString("Contacts") + "</a> &#183; <a href=\"/help/\">" + rb.getString("Help") + "</a></div>");
- out.print(" <div id=\"footer-left\">juick.com &copy; 2008-2012");
- if (sape != null && (visitor == null || visitor.UID == 1)) {
+ out.println(" <div id=\"footer-right\"><a href=\"/help/ru/contacts\" rel=\"nofollow\">" + rb.getString("Contacts") + "</a> &#183; <a href=\"/help/\" rel=\"nofollow\">" + rb.getString("Help") + "</a></div>");
+ out.print(" <div id=\"footer-left\">juick.com &copy; 2008-2013");
+ if (sapeon && sape != null && (visitor == null || visitor.UID == 1)) {
String links = sape.getPageLinks(request.getRequestURI(), request.getCookies()).render();
if (links != null && !links.isEmpty()) {
out.print("<br/>" + rb.getString("Sponsored by") + ": " + links);
diff --git a/src/java/com/juick/http/www/User.java b/src/java/com/juick/http/www/User.java
index 0236a352..1d331956 100644
--- a/src/java/com/juick/http/www/User.java
+++ b/src/java/com/juick/http/www/User.java
@@ -136,7 +136,7 @@ public class User {
out.println("</div>"); // topwrapper
PageTemplates.pageDialogTemplate(out, locale);
- PageTemplates.pageFooter(request, out, locale, visitor);
+ PageTemplates.pageFooter(request, out, locale, visitor, true);
} finally {
out.close();
}
@@ -167,7 +167,7 @@ public class User {
out.println("</div>");
PageTemplates.pageDialogTemplate(out, locale);
- PageTemplates.pageFooter(request, out, locale, visitor);
+ PageTemplates.pageFooter(request, out, locale, visitor, false);
} finally {
out.close();
}
@@ -218,7 +218,7 @@ public class User {
out.println("</div>");
PageTemplates.pageDialogTemplate(out, locale);
- PageTemplates.pageFooter(request, out, locale, visitor);
+ PageTemplates.pageFooter(request, out, locale, visitor, false);
} finally {
out.close();
}
@@ -232,7 +232,7 @@ public class User {
response.setContentType("text/html; charset=UTF-8");
PrintWriter out = response.getWriter();
try {
- PageTemplates.pageHead(out, "@" + user.UName + ": " + rb.getString("(Stats) I read"), null);
+ PageTemplates.pageHead(out, "@" + user.UName + ": " + rb.getString("(Stats) My readers"), null);
PageTemplates.pageNavigation(out, locale, visitor, null);
//PageTemplates.pageUserTitle(out, sql, locale, user, visitor);
@@ -269,7 +269,7 @@ public class User {
out.println("</div>");
PageTemplates.pageDialogTemplate(out, locale);
- PageTemplates.pageFooter(request, out, locale, visitor);
+ PageTemplates.pageFooter(request, out, locale, visitor, false);
} finally {
out.close();
}
diff --git a/src/java/com/juick/http/www/UserThread.java b/src/java/com/juick/http/www/UserThread.java
index 0cb0243c..e0d2a4af 100644
--- a/src/java/com/juick/http/www/UserThread.java
+++ b/src/java/com/juick/http/www/UserThread.java
@@ -80,7 +80,7 @@ public class UserThread {
out.println("</div>"); // topwrapper
PageTemplates.pageDialogTemplate(out, locale);
- PageTemplates.pageFooter(request, out, locale, visitor);
+ PageTemplates.pageFooter(request, out, locale, visitor, false);
} finally {
out.close();
}
@@ -293,7 +293,7 @@ public class UserThread {
if (msg.AttachmentType.equals("jpg")) {
out.println(" <div class=\"msg-media\"><a href=\"//i.juick.com/p/" + msg.MID + "-" + msg.RID + ".jpg\"><img src=\"//i.juick.com/photos-512/" + msg.MID + "-" + msg.RID + ".jpg\" alt=\"\"/></a></div>");
} else {
- out.println(" <div class=\"msg-media\"><div id=\"video-" + msg.MID + "-" + msg.RID + "\"><a href=\"//i.juick.com/video/" + msg.MID + "-" + msg.RID + ".mp4\" onclick=\"inlinevideo(" + msg.MID + "-" + msg.RID + "); return false\"><img src=\"//i.juick.com/thumbs/" + msg.MID + "-" + msg.RID + ".jpg\" alt=\"\"/></a></div></div>");
+ out.println(" <div class=\"msg-media\"><div id=\"video-" + msg.MID + "-" + msg.RID + "\"><a href=\"//i.juick.com/video/" + msg.MID + "-" + msg.RID + ".mp4\" onclick=\"inlinevideo('" + msg.MID + "-" + msg.RID + "'); return false\"><img src=\"//i.juick.com/thumbs/" + msg.MID + "-" + msg.RID + ".jpg\" alt=\"\"/></a></div></div>");
}
}
out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.User.UName + "/\"><img src=\"//i.juick.com/a/" + msg.User.UID + ".png\" alt=\"" + msg.User.UName + "\"/></a></div>");
@@ -332,7 +332,7 @@ public class UserThread {
if (msg.AttachmentType.equals("jpg")) {
out.println(" <div class=\"msg-media\"><a href=\"//i.juick.com/p/" + msg.MID + "-" + msg.RID + ".jpg\"><img src=\"//i.juick.com/photos-512/" + msg.MID + "-" + msg.RID + ".jpg\" alt=\"\"/></a></div>");
} else {
- out.println(" <div class=\"msg-media\"><div id=\"video-" + msg.MID + "-" + msg.RID + "\"><a href=\"//i.juick.com/video/" + msg.MID + "-" + msg.RID + ".mp4\" onclick=\"inlinevideo(" + msg.MID + "-" + msg.RID + "); return false\"><img src=\"//i.juick.com/thumbs/" + msg.MID + "-" + msg.RID + ".jpg\" alt=\"\"/></a></div></div>");
+ out.println(" <div class=\"msg-media\"><div id=\"video-" + msg.MID + "-" + msg.RID + "\"><a href=\"//i.juick.com/video/" + msg.MID + "-" + msg.RID + ".mp4\" onclick=\"inlinevideo('" + msg.MID + "-" + msg.RID + "'); return false\"><img src=\"//i.juick.com/thumbs/" + msg.MID + "-" + msg.RID + ".jpg\" alt=\"\"/></a></div></div>");
}
}
out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.User.UName + "/\"><img src=\"//i.juick.com/a/" + msg.User.UID + ".png\"></a></div>");