?? move.java
字號:
package com.laoer.bbscs.web.action;
import com.laoer.bbscs.web.form.*;
import com.laoer.bbscs.bean.*;
import com.laoer.bbscs.web.servlet.*;
import com.laoer.bbscs.sys.*;
import com.laoer.comm.util.*;
import org.apache.struts.action.*;
import javax.servlet.http.*;
import org.apache.struts.util.*;
import java.util.*;
/**
* <p>Title: TianYi BBS</p>
* <p>Description: TianYi BBS System</p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: LAOER.COM/TIANYISOFT.NET</p>
* @author laoer
* @version 6.0
*/
public class Move
extends BaseAction {
public ActionForward execute(ActionMapping actionMapping,
ActionForm actionForm,
HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse) {
ActionErrors errors = new ActionErrors();
MoveForm form = (MoveForm) actionForm;
UserCheck uc = this.getUserCheck(httpServletRequest, httpServletResponse,
form.getBid());
if (uc.isGuest()) {
errors.add("error.pleaselogin", new ActionError("error.pleaselogin"));
saveErrors(httpServletRequest, errors);
//return actionMapping.findForward("login");
return SysUtil.getPassLogin(actionMapping);
}
if (uc.getBs() == null) {
errors.add("error.baordsno", new ActionError("error.baordsno"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
httpServletRequest.setAttribute("uc", uc);
if (form.getAction().equals("show")) {
form.setAction("move");
return actionMapping.findForward("move");
}
if (form.getAction().equals("move")) {
uc = this.getUserCheck(httpServletRequest, httpServletResponse,
form.getMoveto());
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");
}
if (uc.getPower() <= 0 && !uc.isCanPostNotNeedExp()) {
errors.add("nopower", new ActionError("error.post.nopower"));
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");
}
MessageResources messages = getResources(httpServletRequest);
Locale locale = getLocale(httpServletRequest);
Forum forum = this.getForumService().getForum(form.getId(), form.getBid());
if (forum == null) {
errors.add("getpost", new ActionError("error.post.getpost"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
String content = messages.getMessage(locale, "zhuantie.zhuanzaizi",
forum.getBoardName(),
forum.getUserName(), forum.getTitle()) +
"<br>" + FileIO.readFile(SysUtil.getForumPath(forum.
getBoardID(), forum.getPostTime()) + forum.getDetail(),
Constant.CHARSET);
long atime = SysUtil.getLongTime();
String IP = httpServletRequest.getRemoteAddr();
Forum toforum = ForumFactory.getInstance(form.getMoveto());
toforum.setAgree(0);
toforum.setAmend("");
toforum.setArtSize(forum.getArtSize());
toforum.setAuditing(uc.getBs().getAttrib8());
toforum.setBeAgainst(0);
toforum.setBoardID(form.getMoveto());
toforum.setBoardName(uc.getBs().getBoardsName());
toforum.setCanNotDel( (short) 0);
toforum.setCanNotRe( (short) 0);
toforum.setCanReadExp(0);
toforum.setClick(0);
toforum.setDelIP("");
toforum.setDelSign( (short) 0);
toforum.setDelTime(0);
toforum.setDelUserID(0);
toforum.setDelUserName("");
toforum.setDetail(content);
toforum.setDoEliteName("");
toforum.setDoEliteTime(0);
toforum.setElite(0);
toforum.setEliteID(0);
toforum.setEmailInform( (short) 0);
toforum.setFace(forum.getFace());
toforum.setHavePic( (short) 0);
toforum.setId1(0);
toforum.setId2(0);
toforum.setIpAddress(IP);
toforum.setIsB( (short) 0);
toforum.setIsLock( (short) 0);
toforum.setIsNew( (short) 1);
toforum.setIsTop( (short) 0);
toforum.setIsVote( (short) 0);
toforum.setLastPostNickName("---");
toforum.setLastPostTitle("---");
toforum.setLastPostUserName("---");
toforum.setLastTime(atime);
toforum.setMsgInform( (short) 0);
toforum.setNickName(uc.getNickname());
toforum.setPicName("");
toforum.setPostTime(atime);
toforum.setReNum(0);
toforum.setSign("");
toforum.setTitle(messages.getMessage(locale, "zhuantie.zhuanzai") +
forum.getTitle());
toforum.setUserID(uc.getId());
toforum.setUserName(uc.getUsername());
toforum.setVtime("");
Result r = getForumService().createForum("new", toforum, uc, null);
if (!r.isRight()) {
errors.add("posterror", new ActionError(r.getMsg()));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
toforum = (Forum) r.getObject();
if (forum.getHavePic() != 0 && forum.getPicName() != null &&
uc.getBs().getAttrib9() == 1) {
toforum.setHavePic(forum.getHavePic());
String picFileName = "file_" + toforum.getId().longValue() + "_" +
toforum.getPostTime() + SysUtil.getFileExt(forum.getPicName());
toforum.setPicName(picFileName);
SysUtil.cpoyFile(SysUtil.getUpFilePath(forum.getBoardID(),
forum.getPostTime()) +
forum.getPicName(),
SysUtil.getUpFilePath(toforum.getBoardID(),
toforum.getPostTime()) +
picFileName);
this.getForumService().saveForum(toforum);
}
ActionForward forward = new ActionForward(SysUtil.getResultUrl(
"zhuantie.ok",
"read" + Constant.FILEPREFIX + "?bid=" + form.getBid() + "&id=" +
form.getMainid() +
"&page=" + form.getPage() + "&inpages=" + form.getInpages()), true);
return forward;
}
return actionMapping.findForward("error");
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -