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 --- nbproject/genfiles.properties | 4 ++-- nbproject/project.properties | 3 +++ nbproject/project.xml | 12 ++++++++++++ src/java/NewMessage.properties | 2 +- src/java/NewMessage_ru.properties | 2 +- 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 ++----------- 8 files changed, 24 insertions(+), 18 deletions(-) diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties index 9f68753d..a836f39b 100644 --- a/nbproject/genfiles.properties +++ b/nbproject/genfiles.properties @@ -3,6 +3,6 @@ build.xml.script.CRC32=c93fa366 build.xml.stylesheet.CRC32=651128d4@1.33.1.1 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=ace7f602 -nbproject/build-impl.xml.script.CRC32=e812c1f8 +nbproject/build-impl.xml.data.CRC32=b3ae4a4b +nbproject/build-impl.xml.script.CRC32=c272645e nbproject/build-impl.xml.stylesheet.CRC32=0cbf5bb7@1.33.1.1 diff --git a/nbproject/project.properties b/nbproject/project.properties index 5b8c8172..e4f4ee12 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -37,6 +37,7 @@ javac.classpath=\ ${reference.com_juick.jar}:\ ${reference.com_juick_server.jar}:\ ${reference.com_juick_xmpp.jar}:\ + ${reference.com_juick_json.jar}:\ ${libs.JSON.classpath} # Space-separated list of extra javac options javac.compilerargs= @@ -67,9 +68,11 @@ lib.dir=${web.docbase.dir}/WEB-INF/lib persistence.xml.dir=${conf.dir} platform.active=default_platform project.com_juick=../com.juick +project.com_juick_json=../com.juick.json project.com_juick_server=../com.juick.server project.com_juick_xmpp=../com.juick.xmpp reference.com_juick.jar=${project.com_juick}/dist/com.juick.jar +reference.com_juick_json.jar=${project.com_juick_json}/dist/com.juick.json.jar reference.com_juick_server.jar=${project.com_juick_server}/dist/com.juick.server.jar reference.com_juick_xmpp.jar=${project.com_juick_xmpp}/dist/com.juick.xmpp.jar resource.dir=setup diff --git a/nbproject/project.xml b/nbproject/project.xml index acac92b2..2b60b093 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -18,6 +18,10 @@ ${reference.com_juick_xmpp.jar} WEB-INF/lib + + ${reference.com_juick_json.jar} + WEB-INF/lib + ${libs.JSON.classpath} WEB-INF/lib @@ -40,6 +44,14 @@ clean jar + + com_juick_json + jar + + jar + clean + jar + com_juick_server jar diff --git a/src/java/NewMessage.properties b/src/java/NewMessage.properties index 93d91111..2108f861 100644 --- a/src/java/NewMessage.properties +++ b/src/java/NewMessage.properties @@ -9,5 +9,5 @@ from\ webcam=from webcam Webcam\ photo=Webcam photo Post=Post Tags=Tags -Photo_JPG=Photo: JPG, up to 10Mb. Video: MP4/3GP/MOV/WMV/AVI/M4V, up to 100Mb. +Photo_JPG=Photo: JPG, PNG, up to 10Mb. Video: MP4/3GP/MOV/WMV/AVI/M4V, up to 100Mb. or=or diff --git a/src/java/NewMessage_ru.properties b/src/java/NewMessage_ru.properties index bb61fe23..5e674cfd 100644 --- a/src/java/NewMessage_ru.properties +++ b/src/java/NewMessage_ru.properties @@ -10,5 +10,5 @@ from\ webcam=\u0441 \u0432\u0435\u0431\u043a\u0430\u043c\u0435\u0440\u044b Webcam\ photo=\u0424\u043e\u0442\u043e \u0441 \u0432\u0435\u0431\u043a\u0430\u043c\u0435\u0440\u044b Post=\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c Tags=\u0422\u0435\u0433\u0438 -Photo_JPG=\u0424\u043e\u0442\u043e: JPG, \u0434\u043e 10\u041c\u0431. \u0412\u0438\u0434\u0435\u043e: MP4/3GP/MOV/WMV/AVI/M4V, \u0434\u043e 100Mb. +Photo_JPG=\u0424\u043e\u0442\u043e: JPG, PNG, \u0434\u043e 10\u041c\u0431. \u0412\u0438\u0434\u0435\u043e: MP4/3GP/MOV/WMV/AVI/M4V, \u0434\u043e 100Mb. or=\u0438\u043b\u0438 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