aboutsummaryrefslogtreecommitdiff
path: root/src/java/com/juick/http/www/Blogs.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/com/juick/http/www/Blogs.java')
-rw-r--r--src/java/com/juick/http/www/Blogs.java55
1 files changed, 0 insertions, 55 deletions
diff --git a/src/java/com/juick/http/www/Blogs.java b/src/java/com/juick/http/www/Blogs.java
index 4f455760..8e459dc1 100644
--- a/src/java/com/juick/http/www/Blogs.java
+++ b/src/java/com/juick/http/www/Blogs.java
@@ -42,24 +42,6 @@ import javax.servlet.http.HttpServletResponse;
*/
public class Blogs {
- private int relatedTagsStartMID = 0;
-
- public Blogs(Connection sql) {
- PreparedStatement stmt = null;
- ResultSet rs = null;
- try {
- stmt = sql.prepareStatement("SELECT MIN(message_id) FROM messages WHERE ts>DATE_ADD(NOW(),INTERVAL -6 MONTH)");
- rs = stmt.executeQuery();
- if (rs.first()) {
- relatedTagsStartMID = rs.getInt(1);
- }
- } catch (SQLException e) {
- System.err.println(e);
- } finally {
- Utils.finishSQL(rs, stmt);
- }
- }
-
protected void doGet(Connection sql, Connection sqlSearch, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String paramTagStrQuery = request.getParameter("tag");
if (paramTagStrQuery != null) {
@@ -234,17 +216,6 @@ public class Blogs {
out.println(" <p>" + getTags(sql, 40) + "</p>");
out.println("</div>");
- out.println("<div id=\"rcol\" class=\"abs\">");
- //PageTemplates.pageYandexAd(out, visitor == null ? 2 : 3); // разный ID для залогиненых и нет
- if (paramTag > 0 && relatedTagsStartMID > 0) {
- String related = getRelatedTags(sql, paramTag, 15);
- if (!related.isEmpty()) {
- out.println("<h3>Related tags:</h3>");
- out.println("<ul id=\"reltags\">" + related + "</ul>");
- }
- }
- out.println("</div>");
-
out.println("</div>"); // topwrapper
PageTemplates.pageDialogTemplate(out, locale);
@@ -302,30 +273,4 @@ public class Blogs {
return ret;
}
-
- private String getRelatedTags(Connection sql, int tag_id, int cnt) {
- String ret = "";
-
- PreparedStatement stmt = null;
- ResultSet rs = null;
- try {
- stmt = sql.prepareStatement("SELECT tags.name,COUNT(message_id) AS cnt FROM messages_tags INNER JOIN tags ON messages_tags.tag_id=tags.tag_id WHERE messages_tags.message_id>" + relatedTagsStartMID + " AND messages_tags.message_id IN (SELECT message_id FROM messages_tags WHERE tag_id=?) AND messages_tags.tag_id NOT IN (SELECT tag_id FROM tags_ignore) GROUP BY messages_tags.tag_id HAVING cnt>1 ORDER BY cnt DESC LIMIT 1,?");
- stmt.setInt(1, tag_id);
- stmt.setInt(2, cnt);
- rs = stmt.executeQuery();
- rs.beforeFirst();
- while (rs.next()) {
- try {
- ret += "<li><a href=\"/tag/" + URLEncoder.encode(rs.getString(1), "UTF-8") + "\">" + Utils.encodeHTML(rs.getString(1)) + "</a></li>";
- } catch (UnsupportedEncodingException e) {
- }
- }
- } catch (SQLException e) {
- System.err.println(e);
- } finally {
- Utils.finishSQL(rs, stmt);
- }
-
- return ret;
- }
}