1 43 package net.jforum.view.forum; 44 45 import net.jforum.Command; 46 import net.jforum.JForumExecutionContext; 47 import net.jforum.dao.BannerDAO; 48 import net.jforum.dao.DataAccessDriver; 49 import net.jforum.entities.Banner; 50 import net.jforum.view.forum.common.BannerCommon; 51 52 56 public class BannerAction extends Command 57 { 58 public void list() throws Exception 60 { 61 } 62 63 public void redirect() throws Exception 65 { 66 int bannerId = this.request.getIntParameter("banner_id"); 67 if(!(new BannerCommon()).canBannerDisplay(bannerId)) 68 { 69 JForumExecutionContext.setRedirect(""); 70 return; 71 } 72 73 BannerDAO dao = DataAccessDriver.getInstance().newBannerDAO(); 74 Banner banner = dao.selectById(bannerId); 75 banner.setClicks(banner.getClicks() + 1); 76 dao.update(banner); 77 JForumExecutionContext.setRedirect(banner.getUrl()); 78 } 79 } 80 | Popular Tags |