From 02fa30624211b46c8f2adcd0c459ffeb1c35a743 Mon Sep 17 00:00:00 2001 From: Ugnich Anton Date: Fri, 6 Sep 2013 15:02:30 +0700 Subject: Bugfixes: PNG, tags, htmlencode --- src/java/com/juick/http/www/Blogs.java | 4 ++-- src/java/com/juick/http/www/User.java | 2 +- src/java/com/juick/http/www/Utils.java | 13 ++----------- 3 files changed, 5 insertions(+), 14 deletions(-) (limited to 'src/java/com/juick/http/www') diff --git a/src/java/com/juick/http/www/Blogs.java b/src/java/com/juick/http/www/Blogs.java index 8e459dc1..0f13d946 100644 --- a/src/java/com/juick/http/www/Blogs.java +++ b/src/java/com/juick/http/www/Blogs.java @@ -213,7 +213,7 @@ public class Blogs { out.println("
  • " + rb.getString("With photos") + "
  • "); out.println(" "); out.println("
    "); - out.println("

    " + getTags(sql, 40) + "

    "); + out.println("

    " + getTags(sql, 45) + "

    "); out.println(""); out.println(""); // topwrapper @@ -233,7 +233,7 @@ public class Blogs { PreparedStatement stmt = null; ResultSet rs = null; try { - stmt = sql.prepareStatement("SELECT tags.name AS name,COUNT(DISTINCT messages.user_id) AS cnt FROM (messages INNER JOIN messages_tags ON (messages.ts>TIMESTAMPADD(DAY,-3,NOW()) AND messages.message_id=messages_tags.message_id)) INNER JOIN tags ON messages_tags.tag_id=tags.tag_id WHERE tags.tag_id NOT IN (SELECT tag_id FROM tags_ignore) GROUP BY tags.tag_id ORDER BY cnt DESC LIMIT ?"); + stmt = sql.prepareStatement("SELECT tags.name AS name,COUNT(DISTINCT messages.user_id) AS cnt FROM (messages INNER JOIN messages_tags ON (messages.ts>TIMESTAMPADD(MONTH,-1,NOW()) AND messages.message_id=messages_tags.message_id)) INNER JOIN tags ON messages_tags.tag_id=tags.tag_id WHERE tags.tag_id NOT IN (SELECT tag_id FROM tags_ignore) GROUP BY tags.tag_id ORDER BY cnt DESC LIMIT ?"); stmt.setInt(1, cnt); rs = stmt.executeQuery(); rs.beforeFirst(); diff --git a/src/java/com/juick/http/www/User.java b/src/java/com/juick/http/www/User.java index 83226089..3b526727 100644 --- a/src/java/com/juick/http/www/User.java +++ b/src/java/com/juick/http/www/User.java @@ -304,7 +304,7 @@ public class User { } else { out.println("
  • "); } - if (!UserQueries.isInBL(sql, user.UID, visitor.UID)) { + if (!UserQueries.isInBL(sql, user.UID, visitor.UID) && !UserQueries.isInBL(sql, visitor.UID, user.UID)) { out.println("
  • "); } out.println(" "); diff --git a/src/java/com/juick/http/www/Utils.java b/src/java/com/juick/http/www/Utils.java index 4c41555e..b2d9a999 100644 --- a/src/java/com/juick/http/www/Utils.java +++ b/src/java/com/juick/http/www/Utils.java @@ -107,20 +107,11 @@ public class Utils { } public static String encodeHTML(String str) { - String ret = str; - ret = ret.replaceAll("&", "&"); - ret = ret.replaceAll("<", "<"); - ret = ret.replaceAll(">", ">"); - ret = ret.replaceAll("'", "'"); - ret = ret.replaceAll("\"", """); - ret = ret.replaceAll("\n", " "); - return str; + return str.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("'", "'").replaceAll("\"", """).replaceAll("\n", " "); } public static String encodeSphinx(String str) { - String ret = str; - ret = ret.replaceAll("@", "\\\\@"); - return ret; + return str.replaceAll("@", "\\\\@"); } public static String fetchURL(String url) { -- cgit v1.2.3