📄 votepost.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: VotePost.java
package com.laoer.bbscs.web.action;
import com.laoer.bbscs.bean.*;
import com.laoer.bbscs.business.*;
import com.laoer.bbscs.sys.*;
import com.laoer.bbscs.web.form.VotePostForm;
import com.laoer.bbscs.web.servlet.UserCheck;
import com.laoer.comm.util.Util;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.*;
import org.apache.struts.util.MessageResources;
// Referenced classes of package com.laoer.bbscs.web.action:
// BaseAction
public class VotePost extends BaseAction
{
public VotePost()
{
}
public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
{
ActionErrors errors = new ActionErrors();
VotePostForm form = (VotePostForm)actionForm;
UserCheck uc = getUserCheck(httpServletRequest, httpServletResponse, form.getBid());
if(uc.isGuest())
{
errors.add("error.pleaselogin", new ActionError("error.pleaselogin"));
saveErrors(httpServletRequest, errors);
return SysUtil.getPassLogin(actionMapping);
}
if(uc.getBs() == null)
{
errors.add("error.baordsno", new ActionError("error.baordsno"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
if(!uc.isCanPost())
{
errors.add("error.forum.cannotpost", new ActionError("error.forum.cannotpost"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
UserInfo ui = getUserCache().getUserInfoFromCache(uc.getId());
if(ui == null)
{
errors.add("error.getusererror", new ActionError("error.getusererror"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
if(!uc.isSuperAdmin() && !uc.isManager() && !uc.isBulletin() && ui.getExp() < SysInfo.getInstance().getVoteexp())
{
errors.add("error.vote.exp", new ActionError("error.vote.exp", String.valueOf(SysInfo.getInstance().getVoteexp())));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
httpServletRequest.setAttribute("ui", ui);
httpServletRequest.setAttribute("uc", uc);
if(form.getAction().equals("new"))
{
form.setAction("addvote");
form.setDeadLineYear(Util.getYear());
form.setDeadLineMon(Util.getMonth());
httpServletRequest.setAttribute("votePostForm", form);
return actionMapping.findForward("vote");
}
if(form.getAction().equals("addvote"))
{
if(uc.getPower() <= 0 && !uc.isCanPostNotNeedExp())
{
errors.add("nopower", new ActionError("error.post.nopower"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
String IP = httpServletRequest.getRemoteAddr();
long atime = SysUtil.getLongTime();
String details[] = form.getDetail().split("\n");
if(details.length > getSysInfo().getVotenum())
{
errors.add("error.vote.itemnum", new ActionError("error.vote.itemnum", String.valueOf(getSysInfo().getVotenum())));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("vote");
}
MessageResources messages = getResources(httpServletRequest);
java.util.Locale locale = getLocale(httpServletRequest);
Vote vote = new Vote();
vote.setDeadLine(Util.Date2Long(form.getDeadLineYear(), form.getDeadLineMon(), form.getDeadLineDay()));
vote.setIsM(form.getIsM());
vote.setTitle("[" + messages.getMessage(locale, "post.vote") + "]" + form.getTitle());
List vis = new ArrayList();
for(int i = 0; i < details.length; i++)
{
VoteItem vi = new VoteItem();
vi.setItem(details[i]);
vi.setItemValue(0);
vis.add(vi);
}
Result r = getVoteService().createVote(vote, vis);
if(!r.isRight())
return actionMapping.findForward("error");
String detail = (String)r.getObject();
Forum forum = ForumFactory.getInstance(form.getBid());
forum.setAgree(0);
forum.setAmend("");
forum.setArtSize(detail.length());
forum.setAuditing(uc.getBs().getAttrib8());
forum.setBeAgainst(0);
forum.setBoardID(form.getBid());
forum.setBoardName(uc.getBs().getBoardsName());
forum.setCanNotDel((short)0);
forum.setCanNotRe((short)0);
forum.setCanReadExp(0);
forum.setClick(0);
forum.setDelIP("");
forum.setDelSign((short)0);
forum.setDelTime(0L);
forum.setDelUserID(0L);
forum.setDelUserName("");
forum.setDetail(detail);
forum.setDoEliteName("");
forum.setDoEliteTime(0L);
forum.setElite(0L);
forum.setEliteID(0L);
forum.setEmailInform((short)0);
forum.setFace((short)0);
forum.setHavePic((short)0);
forum.setId1(0L);
forum.setId2(0L);
forum.setIpAddress(IP);
forum.setIsB((short)0);
forum.setIsLock((short)0);
forum.setIsNew((short)1);
forum.setIsTop((short)0);
forum.setIsVote((short)1);
forum.setLastPostNickName("---");
forum.setLastPostTitle("---");
forum.setLastPostUserName("---");
forum.setLastTime(atime);
forum.setMsgInform((short)0);
forum.setNickName(uc.getNickname());
forum.setPicName("");
forum.setPostTime(atime);
forum.setReNum(0);
forum.setSign("");
forum.setTitle(form.getTitle());
forum.setUserID(uc.getId());
forum.setUserName(uc.getUsername());
forum.setVtime("");
r = getForumService().createForum("new", forum, uc, null);
if(!r.isRight())
{
errors.add("posterror", new ActionError(r.getMsg()));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
if(uc.getBs().getAttrib3() == 0)
{
ui.setArticleNum(ui.getArticleNum() + 1);
if(!uc.isCanPostNotNeedExp())
ui.setPower((short)(ui.getPower() - 1));
ui = getUserInfoService().saveUserInfo(ui);
if(ui != null)
{
uc.addCookies(ui);
getUserCache().putUserInfoInCache(ui);
}
}
ActionForward f = new ActionForward("/forum" + Constant.FILEPREFIX + "?bid=" + form.getBid(), true);
return f;
} else
{
return actionMapping.findForward("error");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -