⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 viewthreadaction.java

📁 论坛软件系统亦称电子公告板(BBS)系统
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
				pmlists.addAll(maps);
			}
			maps=null;
			request.setAttribute("newpmnum", newpmnum);
			request.setAttribute("pmlists", pmlists.size()>0?pmlists:null);
		}
		String replyperm = forumMap.get("replyperm");
		if(((threads.get("closed").equals("0")&&!checkautoclose(threads)) || modertar) && ((replyperm.equals("") && usergroups.get("allowreply").equals("1"))||(!replyperm.equals("")&&Common.forumperm(replyperm, groupid,extgroupids)))){
			request.setAttribute("allowpostreply", true);
		}else{
			request.setAttribute("allowpostreply", false);
		}
		String postnocustom = settings.get("postnocustom");
		if(postnocustom!=null && !postnocustom.equals("")){
			request.setAttribute("postcustom", postnocustom.split("\n"));
		}
		dataBaseService.runQuery("update jrun_members set pageviews=pageviews+1,lastip='"+request.getRemoteAddr()+"' where uid="+uid,true);
		viewthread_updateviews(settings.get("delayviewcount"),tid,realPath+"forumdata/cache/cache_threadviews.log");
		request.setAttribute("attatype",attatypemap);
		request.setAttribute("tid", tid);
		request.setAttribute("fid", Short.valueOf(threads.get("fid")));
		int rewritestatus = Integer.parseInt(settings.get("rewritestatus"));
		boolean forumdisplayurl=(rewritestatus & 1)>0;
		if(settings.get("forumjump").equals("1")){
			List<Map<String,String>> forumlist=dataParse.characterParse(settings.get("forums"));
			if("1".equals(settings.get("jsmenu_1"))){
				request.setAttribute("forummenu", Common.forumselect(forumlist,groupid,extgroupids, threads.get("fid"),forumdisplayurl));
			}
			else{
				request.setAttribute("forumselect", Common.forumselect(forumlist,false, false,groupid,extgroupids,null,forumdisplayurl));
			}				
		}
		String extra=request.getParameter("extra");
		String threadpage = (extra!=null ? extra.replaceAll("^(page=)*", ""):"1");
		String forumname=threads.get("name");
		String navigation=null;
		String backtrack = null;
		if(threads.get("type").equals("sub")){
			List<Map<String,String>> forumsmap = dataBaseService.executeQuery("select fid,name from jrun_forums where fid="+threads.get("fup"));
			String fupforumname=forumsmap.get(0).get("name");
			if(forumdisplayurl && (extra==null||extra.matches("^(page=\\d+)$"))){
				backtrack = "forum-"+threads.get("fid")+"-"+(extra!=null ? extra.replaceAll("^(page=)*", ""):"1")+".html";
				navigation="&raquo; <a href='forum-"+forumsmap.get(0).get("fid")+"-1.html'>"+fupforumname+"</a> &raquo; <a href='forum-"+threads.get("fid")+"-"+(extra!=null ? extra.replaceAll("^(page=)*", ""):"1")+".html'>"+forumname+"</a>";
			}else{
				backtrack = "forumdisplay.jsp?fid="+threads.get("fid")+(extra!=null ? "&amp;"+extra.replaceAll("^(&amp;)*", ""):"");
				navigation="&raquo; <a href='forumdisplay.jsp?fid="+forumsmap.get(0).get("fid")+"'>"+fupforumname+"</a> &raquo; <a href='forumdisplay.jsp?fid="+threads.get("fid")+(extra!=null ? "&amp;"+extra.replaceAll("^(&amp;)*", ""):"")+"'>"+forumname+"</a>";
			}
			forumsmap = null;
			request.setAttribute("navtitle",Common.strip_tags(threads.get("subject")+" - "+forumname+" - "+fupforumname+" - "));
		}else{
			if(forumdisplayurl && (extra==null||extra.matches("^(page=\\d+)$"))){
				backtrack = "forum-"+threads.get("fid")+"-"+(extra!=null ? extra.replaceAll("^(page=)*", ""):"1")+".html";
				navigation="&raquo; <a href='forum-"+threads.get("fid")+"-"+(extra!=null?extra.replaceAll("^(page=)*", ""):"1")+".html'>"+forumname+"</a>";
			}else{
				backtrack = "forumdisplay.jsp?fid="+threads.get("fid")+(extra!=null ? "&amp;"+extra.replaceAll("^(&amp;)*", ""):"");
				navigation="&raquo; <a href='forumdisplay.jsp?fid="+threads.get("fid")+(extra!=null?"&amp;"+extra.replaceAll("^(&amp;)*", ""):"")+"'>"+forumname+"</a>";
			}
			request.setAttribute("navtitle", Common.strip_tags(threads.get("subject")+" - "+forumname+" - "));
		}
		request.setAttribute("backtrack", backtrack);
		request.setAttribute("navigation", navigation.toString());
		int showsettings=Integer.valueOf(settings.get("showsettings"));
		int showcustom = members!=null?members.getCustomshow():26;
		boolean showsignatures;boolean showavatars;boolean showimages;
		if(showcustom>=18){
			showcustom=showcustom%18;
			showsignatures=(showsettings&4)>0;
		}else{
			showsignatures=(showcustom&9)>0;
		}
		if(showcustom>=6){
			showcustom=showcustom%6;
			showavatars=(showsettings&2)>0;
		}else{
			showavatars=(showcustom&3)>0;
		}
		if(showcustom>=2){
			showimages=(showsettings&1)>0;
		}else{
			showimages=(showcustom&1)>0;
		}
		request.setAttribute("showimag", showimages);
		request.setAttribute("isshowsignatures", showsignatures);
		Map<String,String> ftpmap = dataParse.characterParse(settings.get("ftp"), false);
		String ftpurl = ftpmap.get("attachurl");
		ftpmap = null;
		Map<String,String> bbcodes = (Map<String,String>)request.getAttribute("bbcodes");
		List<Map<String,String>> smilieslist = dataBaseService.executeQuery("select s.id,s.typeid,s.code,s.url,i.directory from jrun_smilies s left join jrun_imagetypes  i on s.typeid=i.typeid where s.type='smiley' order by s.displayorder");
		String dateformat = (String)session.getAttribute("dateformat");
		int timeoffset=(int)((Float)session.getAttribute("timeoffset")*3600);
		String timeformat = (String)session.getAttribute("timeformat");
		String sql = null;
		String hsqlcount = null;
		String forwad = null;
		List<Map<String,String>> profiledlist = dataBaseService.executeQuery("select fieldid,title from jrun_profilefields where available=1 and invisible=0 order by displayorder");
		String profileds = "";
		List<String> profields = new ArrayList<String>();
		for(Map<String,String> profiled :profiledlist){
			profileds = profileds+",mf.field_"+profiled.get("fieldid");
			profields.add("field_"+profiled.get("fieldid"));
		}
		List<String> custom = new ArrayList<String>();
		custom.add("uid");custom.add("posts");custom.add("digest");
		custom.add("credits");custom.add("extcredits1");custom.add("extcredits2");
		custom.add("extcredits3");custom.add("extcredits4");custom.add("extcredits5");
		custom.add("extcredits6");custom.add("extcredits7");custom.add("extcredits8");
		custom.addAll(profields);
		custom.add("readperm");custom.add("gender");custom.add("location");
		custom.add("oltime");custom.add("regtime");custom.add("lastdate");
		if (threads.get("special").equals("0")) {
			String authorid = request.getParameter("authorid");
			String sqldate = null;
			if (authorid != null&&!authorid.equals("")) {
				sqldate = " and p.authorid='" + authorid+"'";
			}else{
				sqldate = "";
			}
			forwad = "viewthread";
			sql = "select p.*,m.uid, m.username, m.groupid, m.adminid, m.regdate, m.lastactivity, m.posts, m.digestposts, m.oltime,m.pageviews, m.credits, m.extcredits1, m.extcredits2, m.extcredits3, m.extcredits4, m.extcredits5, m.extcredits6,m.extcredits7, m.extcredits8, m.email, m.gender,m.invisible, mf.nickname, mf.site,mf.icq, mf.qq, mf.yahoo, mf.msn, mf.taobao, mf.alipay, mf.location, mf.medals, mf.avatar, mf.avatarwidth,mf.avatarheight, mf.sightml AS signature, mf.customstatus, mf.spacename,mf.medals,u.stars,u.readaccess,u.grouptitle,u.type,u.creditshigher,u.creditslower,u.color,u.allowsigbbcode,u.allowsigimgcode,u.groupavatar"+profileds+" from jrun_posts as p left join jrun_members as m on p.authorid=m.uid left join jrun_memberfields as mf on mf.uid=m.uid left join jrun_usergroups as u on m.groupid=u.groupid where p.tid='"+tid+"'"+sqldate+ " and  p.invisible='0' order by p.first DESC,p.pid";
			hsqlcount = "select count(*) count from jrun_posts as p where p.tid='"+tid+"'"+ sqldate+" and p.invisible='0'";
		} else if (threads.get("special").equals("1")) {
			forwad = "poll";
			Polls polls = pollService.findPollsBytid(tid);
			List<Polloptions> options = optionService.findPolloptionsBytid(tid);
			request.setAttribute("pollMap", calcSumreson(options));
			request.setAttribute("sparetime",  calcSparetime(polls.getExpiration()));
			request.setAttribute("options", options);
			request.setAttribute("polls", polls);
			request.setAttribute("pagesize",  members != null && members.getPpp() > 0 ? members.getPpp(): Integer.valueOf(settings.get("postperpage")));
			polls=null;
			options=null;
		} else if (threads.get("special").equals("2")) {
			String tradenum = dataBaseService.executeQuery("select count(*) as count from jrun_trades where tid = "+tid).get(0).get("count");
			tradenum = tradenum==null?"0":tradenum;
			List<Map<String,String>> trades = dataBaseService.executeQuery("select * from jrun_trades where tid="+tid+" and displayorder>0 order by displayorder");
			StringBuffer tradesaids = new StringBuffer();
			StringBuffer tradespids = new StringBuffer();
			Map<String,String> attachmap = new HashMap<String,String>();
			int listcount = trades.size();
			int tradelist = Common.toDigit(tradenum) - listcount;
			request.setAttribute("tradelist", tradelist);
			for(Map<String,String>trade:trades){
				if(!trade.get("expiration").equals("0")){
					float expiration = (Common.toDigit(trade.get("expiration"),100000000000L,0L).floatValue()-timestamp)/86400;
					if(expiration>0){
						double expirationhour = Math.floor((expiration-Math.floor(expiration))*24);
						trade.put("expirationhour", (int)expirationhour+"");
						trade.put("expiration", (int)Math.floor(expiration)+"");
					}else{
						trade.put("expiration", "-1");
					}
				}
				tradesaids.append(","+trade.get("aid"));
				tradespids.append(","+trade.get("pid"));
			}
			if(tradespids.length()>0){
				List<Map<String,String>> attachs = dataBaseService.executeQuery("SELECT a.* FROM jrun_attachments a WHERE a.pid IN ("+tradespids.substring(1)+")");
				for(Map<String,String> attach:attachs){
					if(attach.get("isimage").equals("1")&&tradesaids.length()>0&&Common.isinarray(attach.get("aid"), tradesaids.substring(1).split(","))){
						String url = attach.get("remote").equals("1")?ftpurl:settings.get("attachurl");
						url = url+"/"+attach.get("attachment");
						url = attach.get("thumb").equals("1")?url+".thumb.jpg":url;
						attachmap.put(attach.get("pid"), url);
					}
				}
			}
			request.setAttribute("tradenum", tradenum);
			request.setAttribute("attachmap", attachmap);
			request.setAttribute("trades", trades.size()>0?trades:null);
			forwad = "trade";
		} else if (threads.get("special").equals("3")) {
			request.setAttribute("pagesize",  members != null && members.getPpp() > 0 ? members.getPpp(): Integer.valueOf(settings.get("postperpage")));
			threads.put("endreward", "false");
			String parnum = settings.get("maxsmilies");
			Map postmap = null;
			if(Common.toDigit(threads.get("price"))<=0){
				threads.put("endreward", "true");
				postmap = new HashMap();
				List<Posts> postlist = postService.findPostByhql("from Posts as p where p.tid="+tid+" and p.first<>1 order by dateline", 0, 1);
				if(postlist!=null){
					Posts post = postlist.get(0);
					String message = parseSmilies(convertInt(parnum),threads,post,bbcodes,smilieslist);
					String aid = "0";
					if(Common.toDigit(threads.get("allowbbcode"))>0 && post.getBbcodeoff()<=0 && post.getFirst()==1){
						Map<String,String> hidemap = replacehide(message,threads,members,modertar);
						request.setAttribute("showatta", hidemap.get("showatta"));
						hidemap.remove("showatta");
						message = hidemap.get("message");
						hidemap.remove("message");
						Set<String> keys=hidemap.keySet();
						for(String key:keys)
						{
							aid = aid +","+key;
						}
						hidemap = null;
					}
					post.setMessage(message);
					message=null;
					Map<String,String> attamap = parseAttach(settings,extcreditname,post,showimages,uid,allowgetattach,readaccess,ftpurl,dateformat+" "+timeformat,timeoffset,modertar);
					post.setMessage(attamap.get("message"));
					post.setMessage(replacemessage(post.getMessage()));
					Set<String> keys=attamap.keySet();
					for(String key:keys)
					{
						if(!key.equals("message")){
							aid = aid +","+key;
						}
					}
					attamap=null;
					if (post.getAttachment() > 0) {
						List<Map<String, String>> attachmentlist = dataBaseService.executeQuery("select * from jrun_attachments as a where a.pid="+ post.getPid()+" and a.aid not in ( "+aid+" )");
						if(attachmentlist!=null && attachmentlist.size()>0){
							List attaurl = new ArrayList();
							for(int j=0;j<attachmentlist.size();j++){
								Map attachmap = new HashMap();
								Map<String,String> attach = attachmentlist.get(j);
								String url = "";
								if(attach.get("remote").equals("1")){
									url = ftpurl+"/"+attach.get("attachment");
								}else{
									url = settings.get("attachurl")+"/"+attach.get("attachment");
								}
								attach.put("attachment", url);
								if(attach.get("isimage").equals("1")){
									if(attach.get("thumb").equals("1")){
										int index = attach.get("attachment").lastIndexOf(".");
										attachmap.put(attach, attach.get("attachment")+".thumb"+attach.get("attachment").substring(index));
									}else{
										attachmap.put(attach,attach.get("attachment"));
									}
								}else{
									attachmap.put(attach,"");
								}
								if(!attach.get("price").equals("0")){
									 if(!modertar&&!attach.get("uid").equals(uid+"")){
										 List<Map<String,String>> payloglist = dataBaseService.executeQuery("select uid from jrun_attachpaymentlog where aid="+attach.get("aid")+" and uid="+uid);
										 if(payloglist==null || payloglist.size()<=0){
											 attachmap.remove(attach);
											 attach.put("isprice", "5");
											 attachmap.put(attach,"");
										 }
									 }
								}
								attaurl.add(attachmap);
							}
							postmap.put(post, attaurl);
						}else{
							postmap.put(post, null);
						}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -