aboutsummaryrefslogtreecommitdiff
path: root/src/java/com/juick/http/www/Discover.java
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2013-11-02 03:25:18 +0700
committerGravatar Ugnich Anton2013-11-02 03:25:18 +0700
commit796c55d1591acc0188c0c269409d914f0dce12c5 (patch)
tree8bce0a47a1fc21bb71b2fa2a1887973ae47cac05 /src/java/com/juick/http/www/Discover.java
parent79a9182f4ad429fa43ad379028087d04d5abd126 (diff)
Ad messages
Diffstat (limited to 'src/java/com/juick/http/www/Discover.java')
-rw-r--r--src/java/com/juick/http/www/Discover.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/java/com/juick/http/www/Discover.java b/src/java/com/juick/http/www/Discover.java
index a9ae360a..62822ee4 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;
@@ -110,13 +111,24 @@ public class Discover {
out.println("<div id=\"content\">");
if (mids.size() > 0) {
+ int ad_mid = 0;
+ if (visitor != null && paramShow == null && paramTag == 0 && paramSearch == null) {
+ ad_mid = AdsQueries.getAdMID(sql, visitor.UID);
+ if (ad_mid > 0 && mids.indexOf(ad_mid) == -1) {
+ mids.add(0, ad_mid);
+ AdsQueries.logAdMID(sql, visitor.UID, ad_mid);
+ } else {
+ ad_mid = 0;
+ }
+ }
+
out.println("<ul>");
- PageTemplates.printMessages(out, sql, null, mids, visitor, locale, visitor == null ? 2 : 3);
+ PageTemplates.printMessages(out, sql, null, mids, visitor, locale, visitor == null ? 2 : 3, ad_mid);
out.println("</ul>");
}
if (visitor != null) {
- if (mids.size() == 20) {
+ if (mids.size() >= 20) {
String nextpage = "?before=" + mids.get(mids.size() - 1);
if (paramShow != null) {
nextpage += "&amp;show=" + paramShow;