From a0a9e4151991111886d88b565fda7db9fba1dfd8 Mon Sep 17 00:00:00 2001 From: Ugnich Anton Date: Fri, 25 Jul 2014 17:56:18 +0700 Subject: SEO, advertising --- src/java/com/juick/http/www/Discover.java | 12 +++++++++++- src/java/com/juick/http/www/Home.java | 10 +++++----- src/java/com/juick/http/www/PageTemplates.java | 4 ++-- src/java/com/juick/http/www/User.java | 19 +++++++++++-------- src/java/com/juick/http/www/UserThread.java | 2 +- 5 files changed, 30 insertions(+), 17 deletions(-) (limited to 'src/java') diff --git a/src/java/com/juick/http/www/Discover.java b/src/java/com/juick/http/www/Discover.java index ca78f41eb..201139c41 100644 --- a/src/java/com/juick/http/www/Discover.java +++ b/src/java/com/juick/http/www/Discover.java @@ -17,6 +17,7 @@ */ package com.juick.http.www; +import com.juick.server.AdsQueries; import com.juick.server.MessagesQueries; import com.juick.server.TagQueries; import java.io.IOException; @@ -90,7 +91,16 @@ public class Discover { out.println("
"); if (mids.size() > 0) { - PageTemplates.printMessages(out, sql, null, mids, visitor, visitor == null ? 2 : 3, 0); + int vuid = visitor != null ? visitor.UID : 0; + int ad_mid = AdsQueries.getAdMID(sql, vuid); + if (ad_mid > 0 && mids.indexOf(ad_mid) == -1) { + mids.add(0, ad_mid); + AdsQueries.logAdMID(sql, vuid, ad_mid); + } else { + ad_mid = 0; + } + + PageTemplates.printMessages(out, sql, null, mids, visitor, visitor == null ? 2 : 3, ad_mid); } if (mids.size() >= 20) { diff --git a/src/java/com/juick/http/www/Home.java b/src/java/com/juick/http/www/Home.java index f54128f4f..8b4ec6a6f 100644 --- a/src/java/com/juick/http/www/Home.java +++ b/src/java/com/juick/http/www/Home.java @@ -94,7 +94,7 @@ public class Home { PrintWriter out = response.getWriter(); try { String head = ""; - if (paramBefore > 0) { + if (paramBefore > 0 || paramShow != null) { head = ""; } PageTemplates.pageHead(out, title, head); @@ -122,12 +122,12 @@ public class Home { if (mids.size() > 0) { int ad_mid = 0; - if (visitor != null && (paramShow == null || paramShow.equals("top") || paramShow.equals("all"))) { - ad_mid = AdsQueries.getAdMID(sql, visitor.UID); - + if (paramShow == null || paramShow.equals("top") || paramShow.equals("all")) { + int vuid = visitor != null ? visitor.UID : 0; + ad_mid = AdsQueries.getAdMID(sql, vuid); if (ad_mid > 0 && mids.indexOf(ad_mid) == -1) { mids.add(0, ad_mid); - AdsQueries.logAdMID(sql, visitor.UID, ad_mid); + AdsQueries.logAdMID(sql, vuid, ad_mid); } else { ad_mid = 0; } diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java index c64f99dde..da4c0b81d 100644 --- a/src/java/com/juick/http/www/PageTemplates.java +++ b/src/java/com/juick/http/www/PageTemplates.java @@ -73,7 +73,7 @@ public class PageTemplates { out.println("
Juick
"); out.print(" "); out.print("
"; if (paramTag != null && TagQueries.getTagNoIndex(sql, paramTag.TID)) { head += ""; - } else if (paramBefore > 0) { + } else if (paramBefore > 0 || paramShow != null) { head += ""; } PageTemplates.pageHead(out, title, head); @@ -170,7 +170,8 @@ public class User { response.setContentType("text/html; charset=UTF-8"); PrintWriter out = response.getWriter(); try { - PageTemplates.pageHead(out, "Теги " + user.UName, null); + String head = ""; + PageTemplates.pageHead(out, "Теги " + user.UName, head); PageTemplates.pageNavigation(out, visitor, null); pageUserColumn(out, sql, user, visitor); @@ -195,7 +196,8 @@ public class User { response.setContentType("text/html; charset=UTF-8"); PrintWriter out = response.getWriter(); try { - PageTemplates.pageHead(out, "Подписки " + user.UName, null); + String head = ""; + PageTemplates.pageHead(out, "Подписки " + user.UName, head); PageTemplates.pageNavigation(out, visitor, null); pageUserColumn(out, sql, user, visitor); @@ -243,7 +245,8 @@ public class User { response.setContentType("text/html; charset=UTF-8"); PrintWriter out = response.getWriter(); try { - PageTemplates.pageHead(out, "Читатели " + user.UName, null); + String head = ""; + PageTemplates.pageHead(out, "Читатели " + user.UName, head); PageTemplates.pageNavigation(out, visitor, null); pageUserColumn(out, sql, user, visitor); @@ -317,14 +320,14 @@ public class User { } out.println(" "); out.println("
"); out.println(" "); out.println("

"); out.println("
"); - out.println("

" + pageUserTags(sql, user, visitor, 20) + "...

"); + out.println("

" + pageUserTags(sql, user, visitor, 20) + "...

"); out.println("
"); out.println("
    "); out.println("
  • Я читаю: " + UserQueries.getStatsIRead(sql, user.UID) + "
  • "); @@ -393,7 +396,7 @@ public class User { for (int i = 0; i < cnt; i++) { String tag = Utils.encodeHTML(tags[i].Name); try { - tag = "" + tag + ""; + tag = "" + tag + ""; } catch (UnsupportedEncodingException e) { } diff --git a/src/java/com/juick/http/www/UserThread.java b/src/java/com/juick/http/www/UserThread.java index c2d7cb148..46242e2b8 100644 --- a/src/java/com/juick/http/www/UserThread.java +++ b/src/java/com/juick/http/www/UserThread.java @@ -98,7 +98,7 @@ public class UserThread { public static com.juick.Message printMessage(PrintWriter out, Connection sql, com.juick.Message msg, com.juick.User visitor) { msg.VisitorCanComment = visitor != null; - String tags = (msg.Tags.isEmpty()) ? "" : PageTemplates.formatTags(msg.Tags, msg.User); + String tags = (msg.Tags.isEmpty()) ? "" : PageTemplates.formatTags(msg.Tags, null); //msg.User); if (msg.ReadOnly) { tags += " *readonly"; msg.VisitorCanComment = false; -- cgit v1.2.3