📄 viewthreadaction.java
字号:
attachmentlist = null;
}else{
postmap.put(post, null);
}
}
}
request.setAttribute("postmap", postmap);
forwad = "reward";
} else if (threads.get("special").equals("4")) {
request.setAttribute("pagesize", members != null && members.getPpp() > 0 ? members.getPpp(): Integer.valueOf(settings.get("postperpage")));
List applist = new ArrayList();
List<Map<String, String>> activitslist = dataBaseService.executeQuery("select * from jrun_activities as a where a.tid="+ tid);
List<Map<String, String>> activiapplist = dataBaseService.executeQuery("select a.*,m.avatar from jrun_activityapplies as a left join jrun_memberfields as m on a.uid=m.uid where a.tid="+ tid);
if(activitslist.size()<=0){
request.setAttribute("errorInfo", "未定义操作,请返回。");
return mapping.findForward("showMessage");
}
request.setAttribute("activitslist", activitslist.get(0));
Map<String,String> activitsmap = activitslist.get(0);
activitslist = null;
if(convertInt(activitsmap.get("expiration"))-timestamp<=0){
request.setAttribute("activityclose", "true");
}else{
request.setAttribute("activityclose", "false");
}
if(activitsmap.get("expiration").equals("0")){
request.setAttribute("activityclose", "");
}
activitsmap = null;
if (activiapplist == null || activiapplist.size()<=0) {
request.setAttribute("activiapplist", null);
} else {
for (Map<String,String> activityapp:activiapplist) {
ActivitappliesVO appvo = new ActivitappliesVO();
if (!activityapp.get("avatar").equals("")) {
appvo.setAvatar(activityapp.get("avatar"));
} else {
appvo.setAvatar("images/avatars/noavatar.gif");
}
appvo.setUid(convertInt(activityapp.get("uid")));
appvo.setUsername(activityapp.get("username"));
appvo.setVerified(activityapp.get("verified"));
applist.add(appvo);
}
request.setAttribute("activiapplist", applist);
}
List<Map<String, String>> count = dataBaseService.executeQuery("SELECT COUNT(*) count FROM jrun_activityapplies WHERE tid=" + tid + " and verified=1");
int size = (count != null && count.size() > 0 ? Integer .valueOf(count.get(0).get("count")) : 0);
count = null;activiapplist=null;
request.setAttribute("resoncount", size);
forwad = "activity";
} else if (threads.get("special").equals("5")) {
request.setAttribute("pagesize", members != null && members.getPpp() > 0 ? members.getPpp(): Integer.valueOf(settings.get("postperpage")));
List<Map<String, String>> debatelist = dataBaseService.executeQuery("select * from jrun_debates as d where d.tid="+ tid);
if(debatelist.size()<=0){
request.setAttribute("errorInfo", "未定义操作,请返回。");
return mapping.findForward("showMessage");
}
request.setAttribute("debates", debatelist.get(0));
debatelist = null;
List<Map<String,String>> firststandlist = dataBaseService.executeQuery("SELECT stand FROM jrun_debateposts WHERE tid='"+tid+"' AND uid='"+uid+"' AND stand<>'0' ORDER BY dateline LIMIT 1");
if(firststandlist!=null && firststandlist.size()>0){
Map<String,String> firsta = firststandlist.get(0);
String firstand = firsta.get("stand");
request.setAttribute("firststand", firstand);
}
firststandlist = null;
forwad = "debate";
}
request.setAttribute("subject", threads.get("subject"));
int typeid = Common.toDigit(threads.get("typeid"));
int threadtype = threadtypes.get("types")!=null&&((Map)threadtypes.get("types")).get(typeid)!=null?1:0;
request.setAttribute("typeid", typeid);
String typetemplate = "";
Map<String,String> optiondata = new HashMap<String,String>();
Map<String,Map<String,String>> optionlist = new TreeMap<String,Map<String,String>>();
List optionMaplist = new ArrayList();
if(typeid>0&&threadtype>0){
if(((Map)threadtypes.get("special")).get(typeid)!=null){
Common.include(request, response, servlet, "./forumdata/cache/threadtype_"+typeid+".jsp", null);
Map<String, String> threadtypesf = (Map<String, String>) request.getAttribute("threadtype");
if(threadtypesf!=null){
Map<Integer, Map<String, String>> dtype = dataParse.characterParse(threadtypesf.get("dtype"),true);
List<Map<String,String>> optionvalues = dataBaseService.executeQuery("SELECT optionid, value FROM jrun_typeoptionvars WHERE tid='"+tid+"'");
for(Map<String,String> option:optionvalues){
optiondata.put(option.get("optionid"), option.get("value"));
}
Set<Integer> dtypes = dtype.keySet();
for(Integer optionid:dtypes){
Map<String,String> option = dtype.get(optionid);
Map<String,String> optionoption = new HashMap<String,String>();
optionoption.put("title", option.get("title"));
if(option.get("type").equals("checkbox")){
String [] choicesvalue = optiondata.get(optionid+"").split("\t");
String [] choicesname = option.get("choices").split("\\\\n");
StringBuffer value = new StringBuffer();
for(String choiceid:choicesvalue){
int chooseid = Common.toDigit(choiceid);
value.append(" "+(chooseid>0?choicesname[chooseid-1]:""));
}
optionoption.put("value",value.toString());
}else if(Common.isinarray(option.get("type"), new String[]{"radio","select"})){
String [] choicesname = option.get("choices").split("\\\\n");
int chooseid = Common.toDigit(optiondata.get(optionid+""));
String value = chooseid>0?choicesname[chooseid-1]:"";
optionoption.put("value",value);
}else if(option.get("type").equals("image")){
String maxwidth = option.get("maxwidth")!=null?"width=\""+option.get("maxwidth")+"\"":"";
String maxheight = option.get("maxheight")!=null?"height=\""+option.get("maxheight")+"\"":"";
String value = optiondata.get(optionid+"")!=null?"<a href=\""+optiondata.get(optionid+"")+"\" target=\"_blank\"><img src=\""+optiondata.get(optionid+"")+"\" "+maxwidth+" "+maxheight+" border=\"0\"></a>":"";
optionoption.put("value", value);
}else if(option.get("type").equals("url")){
String value = optiondata.get(optionid+"")!=null?"<a href=\""+optiondata.get(optionid+"")+"\" target=\"_blank\">"+optiondata.get(optionid+"")+"</a>":"";
optionoption.put("value", value);
}else{
optionoption.put("value", optiondata.get(optionid+""));
}
optionMaplist.add(optionoption);
optionlist.put(option.get("identifier"), optionoption);
}
Set<String> optionkey = optionlist.keySet();
if(!Common.isEmpty(threadtypesf.get("dtypeTemplate"))){
String dtypeTemplate = threadtypesf.get("dtypeTemplate");
for(String key:optionkey){
Map<String,String> option = optionlist.get(key);
String value = option.get("value").equals("")?"none":option.get("value");
dtypeTemplate = dtypeTemplate.replaceAll("\\{"+key+"\\}",option.get("title"));
dtypeTemplate = dtypeTemplate.replaceAll("\\["+key+"value\\]",value);
}
typetemplate = dtypeTemplate;
}
}
request.setAttribute("typetemplate", typetemplate);
request.setAttribute("optionlist", optionMaplist);
}
String subject = Common.toDigit(threadtypes.get("listable").toString())>0?"<a href=\"forumdisplay.jsp?fid="+threads.get("fid")+"&filter=type&typeid="+threads.get("typeid")+"\">["+((Map)threadtypes.get("types")).get(typeid)+"]</a> "+threads.get("subject"):"["+((Map)threadtypes.get("types")).get(typeid)+"] "+threads.get("subject");
threads.put("subject", subject);
}
List<Map<String,String>> postlist = null;
if (threads.get("special").equals("0")) {
boolean viewthreadurl=(rewritestatus & 2)>0 && (extra==null||extra.matches("^(page=\\d+)$"));
String url = "viewthread.jsp?tid="+tid+(extra!=null?"&extra="+Common.encode(extra):"");
if(viewthreadurl){
url = "thread-"+tid+"-"+(extra!=null?extra.replaceAll("^(page=)*", ""):"1");
}
if(extra!=null){
extra =Common.encode(extra);
}
request.setAttribute("extra", extra);
Map<String,Integer> pages = multi(request,response,uid,hsqlcount,url,null,viewthreadurl,0);
postlist = dataBaseService.executeQuery(sql+" limit "+pages.get("beginsize")+","+pages.get("pagesize"));
pages = null;
}else{
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,mf.buyercredit,mf.sellercredit,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 + "' and p.invisible='0' and p.first=1";
postlist = dataBaseService.executeQuery(sql);
}
String parnum = settings.get("maxsmilies");
List<Map<String,String>>threadmod = dataBaseService.executeQuery("select username,dateline,action from jrun_threadsmod as m where m.tid="+tid+" order by m.dateline desc limit 1");
if (threadmod.size()>0) {
Map<String,String> threadmodmap = threadmod.get(0);
MessageResources mr = getResources(request);
String actionname = mr.getMessage(getLocale(request),threadmodmap.get("action"));
threadmodmap.put("action", actionname);
request.setAttribute("threadmod", threadmodmap);
} else {
request.setAttribute("threadmod", null);
}
threadmod = null;
List<ViewThreadVO> dispost = new ArrayList<ViewThreadVO>();
if (postlist != null) {
int userstatusby = Integer.valueOf(settings.get("userstatusby"));
Map<Integer,Map<String,String>> ranks=null;
if(userstatusby==2){
ranks=dataParse.characterParse(((Map<String,String>)request.getAttribute("ranks")).get("ranks"),false);
}
String custominfo = settings.get("customauthorinfo");
Map custominfoMap = dataParse.characterParse(custominfo, false);
Map<String,String[]> custommap = getCreditsunit(extcrditsMap);
String extname[] = custommap.get("extname");
String extunit[] = custommap.get("extunit");
custommap = null;
Map<String,Map<String,String>> medals=null;
if(threads.get("special").equals("0")){
medals=dataParse.characterParse(((Map<String,String>)request.getAttribute("medals")).get("medals"),true);
}
int lastvisit=members!=null?members.getLastvisit():0;
int size = postlist.size();
int count =0;
byte tagstatus = Common.toDigit(settings.get("tagstatus"), 255L, 0L).byteValue();
if(tagstatus==1){
List<Map<String, String>> taglist = dataBaseService.executeQuery("SELECT tagname FROM jrun_threadtags WHERE tid="+tid);
if(taglist==null || taglist.size()<=0){
request.setAttribute("taglist", null);
}else{
String metakeywords = "";
for(Map<String,String> tag:taglist){
metakeywords = metakeywords+tag.get("tagname")+",";
}
request.setAttribute("metakeywords", metakeywords);
request.setAttribute("taglist", taglist);
}
taglist = null;
}
StringBuffer ratelogpids=new StringBuffer();
int ratelogrecord = Integer.valueOf(settings.get("ratelogrecord"));
for (Map<String,String> postmap:postlist) {
ViewThreadVO viewthreadvo = new ViewThreadVO();
count++;
if(postmap.get("username")!=null){
String []result = Common.getgroupid(null, settings.get("creditsformula"), postmap, null);
postmap.put("groupid", result[0]);
postmap.put("grouptitle",result[1]);
postmap.put("credits",result[2]);
postmap.put("color", result[3]);
postmap.put("stars", result[4]);
postmap.put("groupavatar", result[5]);
result = null;
}
viewthreadvo.setUsermap(postmap);
if (threads.get("special").equals("0")){
String medal = postmap.get("medals");
if(medal!=null){
if(medals!=null && medals.size()>0){
List medallists = new ArrayList();
for(int j=0;j<medals.size();j++){
if(Common.matches(medal,"(^|\t)(" + medals.get(j).get("medalid") + ")(\t|$)")){
medallists.add(medals.get(j));
}
}
viewthreadvo.setMedalslist(medallists);
}
}
if(ratelogrecord>0&&Integer.valueOf(postmap.get("ratetimes"))>0){
ratelogpids.append(","+postmap.get("pid"));
}
}
int ratings = (int)Math.ceil((double)Math.abs(Common.toDigit(postmap.get("rate"),1000000L,-1000000L).intValue()) / (double)Common.toDigit(postmap.get("ratetimes")));
if((Math.abs(Common.toDigit(postmap.get("rate"),100000L,-100000L).intValue())<5 && ratings>2 )|| ratings>6){
viewthreadvo.setRatings(2);
}else{
viewthreadvo.setRatings(ratings);
}
if (threads.get("special").equals("2")) {
int buycredit = convertInt(postmap.get("buyercredit"));
int shellcredit = convertInt(postmap.get("sellercredit"));
String ec_credit = settings.get("ec_credit");
Map buycreditMap = dataParse.characterParse(ec_credit, true);
Map buysMap = (Map) buycreditMap.get("rank");
String postbuycredit = "0";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -