public ActionForward process(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws SystemException {
HttpSession session = request.getSession();
MessageForm messageForm = new MessageForm();
ProcessMessageForm pmForm = (ProcessMessageForm) form;
ForumDAO dao = ForumDAO.getInstance();
User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
try {
int fid = Integer.parseInt(pmForm.getFid());
boolean isUserMod = dao.checkMod(fid, user);
Forum currForum = dao.getForumInfo(fid);
// check access rights if forum invisible
getServlet().log("check access rights if forum invisible");
if ((currForum.getLocked() == IConst.Forum.STATUS_INVISIBLE)
&& (user.getStatus() < Integer.parseInt(Configurator
.getInstance().get(IConst.CONFIG.INVADER1)))) {
return (mapping.findForward(IConst.TOKEN.DENIED));
}
Topic currThread = dao.getThreadInfo(Integer.parseInt(pmForm
.getTid()));
// check user access rights if current topic or completely forum is
// locked
getServlet()
.log(
"check user access rights if current topic or completely forum is locked");
if (((currThread.getLocked() == IConst.Topic.STATUS_LOCKED) || (currForum
.getLocked() == IConst.Forum.STATUS_COMPLETELY_LOCKED))
&& (!isUserMod)) {
return (mapping.findForward(IConst.TOKEN.DENIED));
}
session.setAttribute(IConst.REQUEST.CURR_THREAD, currThread);
currThread.setSubject(dao.getThreadSubject(pmForm.getTid()));
Message mess = dao.getMessage(pmForm.getMid());
if (mess == null) {
return (new ActionForward("/ShowThread.do?fid="
+ pmForm.getFid() + "&tid=" + pmForm.getTid()
+ "&block=" + pmForm.getBlock(), true));
} else {
String fname = fillMessageForm(messageForm, mess, pmForm,
request);
request.setAttribute(fname, messageForm);
}