📄 viewthreadaction.java
字号:
String postshellcredit = "0";
if (buysMap != null) {
Iterator it = buysMap.keySet().iterator();
if(buycredit>0){
while (it.hasNext()) {
Object key = it.next();
if (buycredit <= Integer.valueOf(buysMap.get(key).toString())) {
postbuycredit = key.toString();
break;
}
}
}
if(shellcredit>0){
while (it.hasNext()) {
Object key = it.next();
if (shellcredit <= Integer.valueOf(buysMap.get(key).toString())) {
postshellcredit = key.toString();
break;
}
}
}
}
request.setAttribute("shellcredit", postshellcredit);
request.setAttribute("buycredit", postbuycredit);
}
Posts post = new Posts();
post.setBbcodeoff(Byte.valueOf(postmap.get("bbcodeoff")));
post.setSmileyoff(Byte.valueOf(postmap.get("smileyoff")));
post.setHtmlon(Byte.valueOf(postmap.get("htmlon")));
post.setMessage(postmap.get("message"));
String message = post.getMessage().trim();
if(threads.get("special").equals("2")){
String tmp[] = message.split("\t\t\t");
message = tmp[0];
}
if(Common.toDigit(threads.get("allowhtml"))<=0&&(postmap.get("htmlon")==null||Common.toDigit(postmap.get("htmlon"))<=0)){
message = Common.dhtmlspecialchars(message);
if(threads.get("jammer").equals("1")&&postmap!=null&&!(uid+"").equals(postmap.get("uid"))){
int counts = 0;
while(message.indexOf("\n")!=-1 && counts<25){
message = StringUtils.replaceOnce(message, "\n", jammer());
counts ++;
}
}
post.setMessage(message);
}
StringBuffer aid = new StringBuffer();
aid.append("0");
if(Common.toDigit(threads.get("allowbbcode"))>0 && post.getBbcodeoff()<=0){
Map<String,String> hidemap = replacehide(post.getMessage(),threads,members,modertar);
request.setAttribute("showatta", hidemap.get("showatta"));
hidemap.remove("showatta");
post.setMessage(hidemap.get("message"));
hidemap.remove("message");
Set<String> keys=hidemap.keySet();
for(String key:keys)
{
aid.append(","+key);
}
hidemap = null;
}
message = parseSmilies(convertInt(parnum),threads,post,bbcodes,smilieslist);
post.setMessage(message);
if (userstatusby==1||postmap.get("groupid").equals("1")|| postmap.get("groupid").equals("2")||postmap.get("groupid").equals("3") || postmap.get("type").equals("spacial")) {
String foruder = getforumfounder(settings,postmap);
if(!foruder.equals("")){
viewthreadvo.setHonor(foruder);
}else{
viewthreadvo.setHonor(postmap.get("grouptitle"));
}
viewthreadvo.setStars(postmap.get("stars"));
viewthreadvo.setColor(postmap.get("color"));
} else if (userstatusby==2&&ranks!=null) {
for (int j = 1; j <= ranks.size(); j++) {
Map<String,String> rank = ranks.get(j);
if (Common.toDigit(postmap.get("posts")) >= Integer.valueOf(rank.get("postshigher"))) {
viewthreadvo.setHonor(rank.get("ranktitle"));
viewthreadvo.setStars(rank.get("stars"));
viewthreadvo.setColor(rank.get("color"));
break;
}
}
}
if (showavatars) {
String avatars = postmap.get("avatar")!=null?postmap.get("avatar"):"";
if ("".equals(avatars)){
viewthreadvo.setAvatars("images/avatars/noavatar.gif");
} else {
viewthreadvo.setAvatars(avatars);
}
}
if (showsignatures) {
String sightml = postmap.get("signature")!=null?postmap.get("signature"):"";
if(postmap.get("allowsigbbcode")!=null && postmap.get("allowsigbbcode").equals("1")){
sightml = jspcode.parsecode(sightml,false);
}
if(postmap.get("allowsigimgcode")!=null && postmap.get("allowsigimgcode").equals("1")){
sightml = jspcode.parseimg(sightml, true);
}
viewthreadvo.setSignatures(sightml);
}
viewthreadvo.setNewpostanchor(Common.toDigit(postmap.get("dateline"))>lastvisit?"<a name='newpost'></a>":"");
viewthreadvo.setLastpostanchor(count==size?"<a name='lastpost'></a>":"");
String vtonlinestatus = settings.get("vtonlinestatus");
if(vtonlinestatus.equals("2")){
String onlinsql = "select uid from jrun_sessions as s where s.uid="+postmap.get("authorid")+" and s.invisible=0";
List<Map<String,String>> onlist = dataBaseService.executeQuery(onlinsql);
if(onlist!=null && onlist.size()>0){
viewthreadvo.setOnlineauthors(1);
}
onlist = null;
}
Map<String,String> attamap = parseAttach(settings,extcreditname,post,showimages,uid,allowgetattach,readaccess,ftpurl,dateformat+" "+timeformat,timeoffset,modertar);
post.setMessage(attamap.get("message"));
attamap.remove("message");
Set<String> keys=attamap.keySet();
for(String key:keys)
{
aid.append(","+key);
}
attamap = null;
int paynum = 0;
if(threadpay){
List<Map<String, String>> paycontlist = dataBaseService.executeQuery("select count(*) count from jrun_paymentlog WHERE tid="+tid);
if(paycontlist!=null || paycontlist.size()>0){
Map<String,String> paylogmap = paycontlist.get(0);
paynum = convertInt(paylogmap.get("count"));
paylogmap = null;
}
paycontlist = null;
}
if(postmap.get("first").equals("1")){
post.setMessage(replacethreadmessage(Common.toDigit(threads.get("price")),creditstrans,post.getMessage(),paynum,tid,threadpay));
}
if(postmap.get("username")!=null){
viewthreadvo.setCustominfo(customeinfo(extname,extunit,custominfoMap,postmap,profiledlist,custom,timeoffset,dateformat));
}
message = post.getMessage();
message = replacemessage(message);
postmap.put("message", message);
if (postmap.get("attachment").equals("1")&&!(threadpay&&postmap.get("first").equals("1"))) {
List<Map<String, String>> attachmentlist = dataBaseService.executeQuery("select * from jrun_attachments as a where a.aid not in ( "+aid+" ) and a.pid="+ postmap.get("pid"));
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,"");
}
payloglist = null;
}
}
attaurl.add(attachmap);
}
viewthreadvo.setAttaurl(attaurl);
viewthreadvo.setAttamentlist(attachmentlist);
attachmentlist = null;
}else{
viewthreadvo.setAttamentlist(null);
viewthreadvo.setAttaurl(null);
}
}
dispost.add(viewthreadvo);
}
if(ratelogpids.length()>0){
Map<String,List<Map<String,String>>> ratelogs=new HashMap<String,List<Map<String,String>>>();
List<Map<String,String>> ratelogslist = dataBaseService.executeQuery("select * from jrun_ratelog where pid IN ("+ratelogpids.substring(1)+") ORDER BY dateline DESC,extcredits ASC");
for(Map<String,String> ratelog : ratelogslist){
String pid=ratelog.get("pid");
List<Map<String,String>> ratelogtemp=ratelogs.get(pid);
if(ratelogtemp==null){
ratelogtemp=new ArrayList<Map<String,String>>();
ratelogs.put(pid, ratelogtemp);
}
if(ratelogtemp.size()<ratelogrecord){
ratelogtemp.add(ratelog);
}
}
request.setAttribute("ratelogs",ratelogs);
}
extunit=null;custominfoMap=null;
request.setAttribute("extcredits",extname);
if (!threads.get("special").equals("0")) {
int index = dispost.size() - 1;
ViewThreadVO viewthread = (ViewThreadVO) dispost.get(index);
dispost.remove(index);
request.setAttribute("viewthread", viewthread);
}
}
smilieslist=null;
postlist = null;
custom = null;
if(threads.get("special").equals("3") && Common.toDigit(threads.get("price"),100000000L,-100000000L).intValue()<0){
threads.put("price", (int)(Math.abs(Double.valueOf(threads.get("price"))))+"");
}
request.setAttribute("thread", threads);
if (dispost == null || dispost.size() == 0) {
request.setAttribute("postlist", null);
} else {
request.setAttribute("postlist", dispost);
}
dispost = null;
request.setAttribute("pageInfo_filter", request.getParameter("filter"));
request.setAttribute("pageInfo_orderby", request.getParameter("orderby"));
request.setAttribute("pageInfo_ascdesc", request.getParameter("ascdesc"));
request.setAttribute("pageInfo_threadpage", threadpage);
request.setAttribute("coloroptions", coloroptions);
int google_searchbox=Common.toDigit(settings.get("google_searchbox"), 10L, 0L).intValue();
int baidu_searchbox=Common.toDigit(settings.get("baidu_searchbox"), 10L, 0L).intValue();
request.setAttribute("google_searchbox", google_searchbox&4);
request.setAttribute("baidu_searchbox", baidu_searchbox&4);
return mapping.findForward(forwad);
}
@SuppressWarnings("unchecked")
private Map<String, List> customeinfo(String[]extname,String[] extunit, Map customMap,Map<String,String>usermap,List<Map<String,String>>profiled,List<String>custom,float timeoffset,String dateformat) {
Map resultMap = new HashMap();
List<String> profievalue = new ArrayList<String>();
for(Map<String,String> profile:profiled){
profievalue.add("<dt>"+profile.get("title")+"</dt><dd>"+(usermap.get("field_"+profile.get("fieldid"))==null?"":usermap.get("field_"+profile.get("fieldid")))+"</dd>");
}
List<String> customvalue = new ArrayList<String>();
String location = (usermap.get("location")==null || usermap.get("location").equals("") ? "" : "<dt>来自</dt><dd>"+usermap.get("location")+"</dd>");
byte gender = Byte.valueOf(usermap.get("gender"));
String genders = "";
if (gender == 1) {
genders = "男";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -