aboutsummaryrefslogtreecommitdiff
path: root/src/java/com/juick/http/www/Home.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/com/juick/http/www/Home.java')
-rw-r--r--src/java/com/juick/http/www/Home.java17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/java/com/juick/http/www/Home.java b/src/java/com/juick/http/www/Home.java
index d2500993..2705d953 100644
--- a/src/java/com/juick/http/www/Home.java
+++ b/src/java/com/juick/http/www/Home.java
@@ -18,6 +18,7 @@
package com.juick.http.www;
import com.juick.json.Users;
+import com.juick.server.AdsQueries;
import com.juick.server.MessagesQueries;
import com.juick.server.PMQueries;
import java.io.IOException;
@@ -94,12 +95,24 @@ public class Home {
out.println("<div id=\"content\">");
if (mids.size() > 0) {
+ int ad_mid = 0;
+ if (paramShow == null || paramShow.equals("top")) {
+ 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 (mids.size() == 20) {
+ if (mids.size() >= 20) {
String nextpage = "?before=" + mids.get(mids.size() - 1);
if (paramShow != null) {
nextpage += "&amp;show=" + paramShow;