📄 postdelsaction.java
字号:
package com.laoer.bbscs.bbs.action;
import org.apache.struts.action.*;
import javax.servlet.http.*;
import com.laoer.bbscs.bbs.actionform.*;
import com.laoer.bbscs.bbs.business.*;
import com.laoer.bbscs.sysinfo.*;
import com.laoer.bbscs.util.*;
import com.laoer.bbscs.servlet.*;
import com.laoer.bbscs.db.*;
import org.apache.struts.util.*;
import java.util.*;
public class PostDelsAction
extends Action {
public ActionForward execute(ActionMapping actionMapping,
ActionForm actionForm,
HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse) {
ActionErrors errors = new ActionErrors();
PostDelsActionForm form = (PostDelsActionForm) actionForm;
UserSessionCheck myUserSessionCheck = new UserSessionCheck(form.getSid(),
httpServletRequest);
if (!myUserSessionCheck.checkSession(form.getBid())) {
errors.add("error.timeout", new ActionError("error.timeout"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
if (myUserSessionCheck.isGuest()) {
errors.add("noguest", new ActionError("error.user.noguest"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
if (form.getAction().equals("delposts")) {
if (! (myUserSessionCheck.isSuperAdmin() || myUserSessionCheck.isBMaster() ||
myUserSessionCheck.isMainMaster() ||
myUserSessionCheck.isAssiMaster() ||
myUserSessionCheck.isHideMaster())) {
errors.add("purviewerror", new ActionError("error.purviewerror"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
//httpServletRequest.setAttribute("myUserSessionCheck", myUserSessionCheck);
//httpServletRequest.setAttribute("sid", form.getSid());
//httpServletRequest.setAttribute("bid", form.getBid());
//httpServletRequest.setAttribute("theBoards",myUserSessionCheck.getTheBoards());
ForumInfo aForumInfo = new ForumInfo();
aForumInfo.setBoardID(Long.parseLong(form.getBid()));
Forum myForum = ForumFactory.getInstance();
aForumInfo.setDelUserID(myUserSessionCheck.getUserID());
aForumInfo.setDelUserName(myUserSessionCheck.getUserName());
aForumInfo.setDelTime(Util.getaLongTime());
aForumInfo.setDelIP(httpServletRequest.getRemoteAddr());
myForum.setUserSessionCheck(myUserSessionCheck);
myForum.setForumInfo(aForumInfo);
int result = myForum.delPosts(null, form.getDelforum(), form.getDelexp());
aForumInfo = null;
myForum = null;
if (result != Sys.RESULT_RIGHT) {
errors.add("error.post.del1", new ActionError("error.post.del1"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
/*
httpServletRequest.setAttribute("aForwardInfo",
new ForwardInfo("",
Sys.getURL() + "manageAction.do?sid=" + form.getSid() +
"&bid=" + form.getBid() + "&action=m&pages=" + form.getPages()));*/
errors = null;
//form = null;
myUserSessionCheck = null;
//return actionMapping.findForward("forwards");
ActionForward f = new ActionForward("/manageAction.do?sid=" + form.getSid() +
"&bid=" + form.getBid() +
"&action=m&pages=" + form.getPages(), true);
return f;
}
if (form.getAction().equals("delwastes")) {
if (! (myUserSessionCheck.isSuperAdmin() || myUserSessionCheck.isBMaster() ||
myUserSessionCheck.isMainMaster())) {
errors.add("purviewerror", new ActionError("error.purviewerror"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
ForumInfo aForumInfo = new ForumInfo();
aForumInfo.setBoardID(Long.parseLong(form.getBid()));
Forum myForum = ForumFactory.getInstance();
myForum.setForumInfo(aForumInfo);
int result = myForum.realDelPosts(null, form.getDelforum(), "delwaste");
aForumInfo = null;
myForum = null;
if (result != Sys.RESULT_RIGHT) {
errors.add("error.post.del1", new ActionError("error.post.del1"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
/*
httpServletRequest.setAttribute("aForwardInfo",
new ForwardInfo("",
Sys.getURL() + "manageAction.do?sid=" + form.getSid() +
"&bid=" + form.getBid() + "&action=w&pages=" + form.getPages()));*/
errors = null;
//form = null;
myUserSessionCheck = null;
//return actionMapping.findForward("forwards");
ActionForward f = new ActionForward("/manageAction.do?sid=" + form.getSid() +
"&bid=" + form.getBid() +
"&action=w&pages=" + form.getPages(), true);
return f;
}
if (form.getAction().equals("delall")) {
if (! (myUserSessionCheck.isSuperAdmin() || myUserSessionCheck.isBMaster() ||
myUserSessionCheck.isMainMaster())) {
errors.add("purviewerror", new ActionError("error.purviewerror"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
ForumInfo aForumInfo = new ForumInfo();
aForumInfo.setBoardID(Long.parseLong(form.getBid()));
Forum myForum = ForumFactory.getInstance();
myForum.setForumInfo(aForumInfo);
int result = myForum.realDelPosts(null, form.getDelforum(), "delall");
aForumInfo = null;
myForum = null;
if (result != Sys.RESULT_RIGHT) {
errors.add("error.post.del1", new ActionError("error.post.del1"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
/*
httpServletRequest.setAttribute("aForwardInfo",
new ForwardInfo("",
Sys.getURL() + "manageAction.do?sid=" + form.getSid() +
"&bid=" + form.getBid() + "&action=w&pages=" + form.getPages()));*/
errors = null;
//form = null;
myUserSessionCheck = null;
//return actionMapping.findForward("forwards");
ActionForward f = new ActionForward("/manageAction.do?sid=" +
form.getSid() +
"&bid=" + form.getBid() +
"&action=w", true);
return f;
}
return actionMapping.findForward("error");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -