⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 postdo.java

📁 天乙社区6.0是一套基于JAVA技术的网络虚拟社区
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
      String content = FileIO.readFile(SysUtil.getForumPath(forum.
          getBoardID(), forum.getPostTime()) + forum.getDetail(),
                                       Constant.CHARSET);

      SendMail.sendMail(SysInfo.getInstance().getWebmasteremail(),
                        title, content);

      ActionForward forward = new ActionForward(SysUtil.getResultUrl(
          "jubao.return",
          "read" + Constant.FILEPREFIX + "?bid=" + form.getBid() +
          "&id=" + form.getMainid() + "&page=" + form.getPage() + "&inpages=" +
          form.getInpages()), true);
      return forward;
    }

    if (form.getAction().equals("lock")) {
      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");
      }
      if (!uc.isCanPostNotNeedExp()) {
        errors.add("error.purviewerror", new ActionError("error.purviewerror"));
        saveErrors(httpServletRequest, errors);
        return actionMapping.findForward("error");
      }
      if (forum.getIsLock() != 1) {
        forum.setIsLock( (short) 1);
        if (this.getForumService().saveForum(forum) == null) {
          errors.add("error.handlerror", new ActionError("error.handlerror"));
          saveErrors(httpServletRequest, errors);
          return actionMapping.findForward("error");
        }
      }
      ActionForward f = new ActionForward("/read" + Constant.FILEPREFIX +
                                          "?bid=" + form.getBid() +
                                          "&id=" + form.getMainid() + "&page=" +
                                          form.getPage() + "&inpages=" +
                                          form.getInpages(), true);
      return f;
    }

    if (form.getAction().equals("unlock")) {
      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");
      }
      if (!uc.isCanPostNotNeedExp()) {
        errors.add("error.purviewerror", new ActionError("error.purviewerror"));
        saveErrors(httpServletRequest, errors);
        return actionMapping.findForward("error");
      }
      if (forum.getIsLock() != 0) {
        forum.setIsLock( (short) 0);
        if (this.getForumService().saveForum(forum) == null) {
          errors.add("error.handlerror", new ActionError("error.handlerror"));
          saveErrors(httpServletRequest, errors);
          return actionMapping.findForward("error");
        }
      }
      ActionForward f = new ActionForward("/read" + Constant.FILEPREFIX +
                                          "?bid=" + form.getBid() +
                                          "&id=" + form.getMainid() + "&page=" +
                                          form.getPage() + "&inpages=" +
                                          form.getInpages(), true);
      return f;
    }

    if (form.getAction().equals("top")) {
      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");
      }
      if (!uc.isCanPostNotNeedExp()) {
        errors.add("error.purviewerror", new ActionError("error.purviewerror"));
        saveErrors(httpServletRequest, errors);
        return actionMapping.findForward("error");
      }
      if (forum.getIsTop() != 1) {
        forum.setIsTop( (short) 1);
        if (this.getForumService().saveForum(forum) == null) {
          errors.add("error.handlerror", new ActionError("error.handlerror"));
          saveErrors(httpServletRequest, errors);
          return actionMapping.findForward("error");
        }
      }
      ActionForward f = new ActionForward("/read" + Constant.FILEPREFIX +
                                          "?bid=" + form.getBid() +
                                          "&id=" + form.getMainid() + "&page=" +
                                          form.getPage() + "&inpages=" +
                                          form.getInpages(), true);
      return f;
    }

    if (form.getAction().equals("untop")) {
      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");
      }
      if (!uc.isCanPostNotNeedExp()) {
        errors.add("error.purviewerror", new ActionError("error.purviewerror"));
        saveErrors(httpServletRequest, errors);
        return actionMapping.findForward("error");
      }
      if (forum.getIsTop() != 0) {
        forum.setIsTop( (short) 0);
        if (this.getForumService().saveForum(forum) == null) {
          errors.add("error.handlerror", new ActionError("error.handlerror"));
          saveErrors(httpServletRequest, errors);
          return actionMapping.findForward("error");
        }
      }
      ActionForward f = new ActionForward("/read" + Constant.FILEPREFIX +
                                          "?bid=" + form.getBid() +
                                          "&id=" + form.getMainid() + "&page=" +
                                          form.getPage() + "&inpages=" +
                                          form.getInpages(), true);
      return f;
    }

    if (form.getAction().equals("cannotdel")) {
      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");
      }
      if (!uc.isCanPostNotNeedExp()) {
        errors.add("error.purviewerror", new ActionError("error.purviewerror"));
        saveErrors(httpServletRequest, errors);
        return actionMapping.findForward("error");
      }
      if (forum.getCanNotDel() == 0) {
        forum.setCanNotDel( (short) 1);
        if (this.getForumService().saveForum(forum) == null) {
          errors.add("error.handlerror", new ActionError("error.handlerror"));
          saveErrors(httpServletRequest, errors);
          return actionMapping.findForward("error");
        }
      }
      ActionForward f = new ActionForward("/read" + Constant.FILEPREFIX +
                                          "?bid=" + form.getBid() +
                                          "&id=" + form.getMainid() + "&page=" +
                                          form.getPage() + "&inpages=" +
                                          form.getInpages(), true);
      return f;
    }

    if (form.getAction().equals("votyes")) {
      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");
      }

      forum.setAgree(forum.getAgree() + 1);
      if (this.getForumService().saveForum(forum) == null) {
        errors.add("error.handlerror", new ActionError("error.handlerror"));
        saveErrors(httpServletRequest, errors);
        return actionMapping.findForward("error");
      }
      ActionForward f = new ActionForward("/read" + Constant.FILEPREFIX +
                                          "?bid=" + form.getBid() +
                                          "&id=" + form.getMainid() + "&page=" +
                                          form.getPage() + "&inpages=" +
                                          form.getInpages(), true);
      return f;
    }

    if (form.getAction().equals("votno")) {
      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");
      }

      forum.setAgree(forum.getAgree() - 1);
      if (this.getForumService().saveForum(forum) == null) {
        errors.add("error.handlerror", new ActionError("error.handlerror"));
        saveErrors(httpServletRequest, errors);
        return actionMapping.findForward("error");
      }
      ActionForward f = new ActionForward("/read" + Constant.FILEPREFIX +
                                          "?bid=" + form.getBid() +
                                          "&id=" + form.getMainid() + "&page=" +
                                          form.getPage() + "&inpages=" +
                                          form.getInpages(), true);
      return f;
    }

    if (form.getAction().equals("commend")) {
      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");
      }

      if (! (uc.isSuperAdmin() || uc.isBmaster() || uc.isBulletin() ||
             uc.isMainMaster())) {
        errors.add("error.purviewerror", new ActionError("error.purviewerror"));
        saveErrors(httpServletRequest, errors);
        return actionMapping.findForward("error");
      }

      if (getCommendService().findCommendByPostID(form.getId(), (short) 1) != null) {
        errors.add("error.commend.exist", new ActionError("error.commend.exist"));
        saveErrors(httpServletRequest, errors);
        return actionMapping.findForward("error");
      }

      forum.setIsB( (short) 1);
      if (this.getForumService().saveForum(forum) == null) {
        errors.add("error.handlerror", new ActionError("error.handlerror"));
        saveErrors(httpServletRequest, errors);
        return actionMapping.findForward("error");
      }

      Commend commend = new Commend();
      commend.setAddTime(SysUtil.getLongTime());
      commend.setBid(form.getBid());
      commend.setBoardName(forum.getBoardName());
      commend.setIsBull( (short) 1);
      commend.setPostID(forum.getId().longValue());
      commend.setPostID2(forum.getId2());
      commend.setTitle(forum.getTitle());
      this.getCommendService().createCommend(commend);
      String url = "read" + Constant.FILEPREFIX + "?bid=" + form.getBid() +
          "&id=" + form.getMainid() +
          "&page=" + form.getPage() + "&inpages=" + form.getInpages();
      ActionForward f = new ActionForward(SysUtil.getResultUrl(
          "commend.topic.ok", url));
      return f;
    }

    return actionMapping.findForward("error");
  }

  private void jbInit() throws Exception {
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -