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

📄 post.jsp

📁 这是一个用JSP开发的论坛源 码。。。 按照上在的README可轻松的捅有下JSP论坛
💻 JSP
字号:
<%
/*##################################################################**
**#  程序名称:LyBBS『凌云论坛』                                   #**
**#                                                                #**
**#  程序开发: teddy 『星语凌』                                    #**
**#                                                                #**
**#  版权所有: 凌云创作室 (原流星电脑工作室)                       #**
**#                                                                #**
**#  主页地址: http://www.lybbs.net                                #**
**#  电邮地件: horseye@sina.com                                    #**
**#                                                                #**
**##################################################################*/
%>
<%@ include file="include/config.jsp"%>
<%@ page contentType="text/html;charset=GBK" %>
<jsp:useBean id="smartUpload" scope="page" class="com.lyforum.upload.SmartUpload" />
<%
int forumID=0,
    topic=0,
    postID=0;
String tempSTR="",
       action="",
       action2="",
       submit="";
//取传递变量
smartUpload.initialize(pageContext);
smartUpload.upload();

ParameterUtils.setCharacterEncoding(request);

forumID=ParameterUtils.getInt(request,"forumID");
topic=ParameterUtils.getInt(request,"topic");
postID=ParameterUtils.getInt(request,"postID");
action=ParameterUtils.getString(request,"action");

tempSTR=smartUpload.getRequest().getParameter("go");
if(tempSTR!=null && !tempSTR.equals(""))
  submit=tempSTR;

tempSTR=smartUpload.getRequest().getParameter("action2");
if(tempSTR!=null && !tempSTR.equals(""))
  action2=tempSTR;

if(action.equals("") || forumID==0)
  response.sendRedirect("errorPage.jsp");
%>
<%@ include file="include/boardprepare.jsp"%>

<!--//html from here-->
<%@ include file="include/head.jsp"%>
<body <%=lbbody%>>
<%@ include file="include/userheader.jsp"%>
<p>
<%
//取当前系统时间
ForumDate forumDate=new ForumDate();
String now_time=forumDate.getNow_Time();
Forum forum=(new ForumFactory()).getForum(forumID);
String forumName=forum.getForumName(),
       htmlStat=forum.getHtmlStat(),
       lyCodeStat=forum.getLyCodeStat(),
       startNewThreads=forum.getStartNewThreads(),
       privateForum=forum.getPrivateForum(),
       forumListType=forum.getForumType();

int maxUpload=forumStyle.getMaxUpload();//最大可上传文件大小
String arrawPostFlash=forumStyle.getArrawPostPic(),//帖子中是否允许Flash
       arrawPostFontSize=forumStyle.getArrawPostFontSize(),//帖子中是否允许改变字体大小
       arrawPostMedia=forumStyle.getArrawPostPic(),//帖子中是否允许mp/rm/qt
       arrawPostPic=forumStyle.getArrawPostPic(),//帖子中是否允许贴图
       arrawPostSound=forumStyle.getArrawPostPic(),//帖子中是否允许背景声音
       arrowUpload=forumStyle.getArrowUpload(),//发表主题是否允许上传
       allowAttachment=forumStyle.getAllowAttachment(),//回复是否允许上传
       advPost="0";//简单/高级模式
forumStatus.getPostConfig();
int floodControlLimit=forumStatus.getFloodControlLimit();
String floodControl=forumStatus.getFloodControl(),
       emotIcons=forumStatus.getEmotIcons(),
       coinName=(new ForumEncourage()).getCoinName();

int postParentID=0;
String postAuthor="",
       postCopyTitle="",
       postCopyContent="",
       editAccessary="0";
ForumPost forumPost=new ForumPost();
if(action.equals("copy") || action.equals("edit") || action.equals("replyquote")) {
  if(postID==0 || topic==0)
    response.sendRedirect("errorPage.jsp");
  forumPost.setPostID(postID);
  forumPost.getCopyPost();
    postParentID=forumPost.getPostParentID();
    postAuthor=forumPost.getPostAuthor();
    postCopyTitle=forumPost.getPostCopyTitle();
    postCopyContent=forumPost.getPostCopyContent();
    if(action.equals("replyquote")) {
      postCopyContent="[quote][b]下面引用由 [u]"+postAuthor+"[/u] [i]"+now_time+"[/i] 发表的内容:[/b]\n"+postCopyContent+"\n[/quote]";

    }
    editAccessary=forumPost.getEditAccessary();
}
%>
<table cellpadding=0 cellspacing=0 border=0 width=<%=tablewidth%> align=center>
 <tr>
  <td width=30% rowspan=2 valign=top>
   <img src="images/<%=boardlogo%>" border=0>
  </td>
  <td valign=top align=left>
     <font face="宋体" color=<%=fontcolormisc%>>
     <img src="images/closedfold.gif" border=0> <a href="index.jsp"><%=boardname%></a><br>
     <img src="images/bar.gif" border=0><img src="images/closedfold.gif" border=0> <a href="forum.jsp?forumID=<%=forumID%>"><%=forumName%></a><br>
     &nbsp;&nbsp;&nbsp;<img src="images/bar.gif" border=0><img src="images/openfold.gif" border=0> <%if(action.equals("new")) out.print("发表新主题"); else if(action.equals("reply")) out.print("发表回复"); else if(action.equals("edit")) out.print("编辑帖子");else if(action.equals("replyquote")) out.print("引用帖子");else if(action.equals("copy")) out.print("复制帖子");%>
     </font>
  </td>
 </tr>
</table>
<p>
<script language="JavaScript">
function HighlightAll(theField) {
  var tempval=eval("document."+theField)
  tempval.focus()
  tempval.select()
  therange=tempval.createTextRange()
  therange.execCommand("Copy")
}
function DoTitle(addTitle) {
  var revisedTitle;
  var currentTitle = document.submitok.postTitle.value;
  revisedTitle = currentTitle+addTitle;
  document.submitok.postTitle.value=revisedTitle;
  document.submitok.postTitle.focus();
  return;
}
</script>
<%
if(submit.equals("")) {
  tempSTR=ParameterUtils.getString(request,"advPost");
  if(!tempSTR.equals(""))
    advPost=tempSTR;
  else {
    if(cookieMode.equals("0"))
      advPost=forumStyle.getAdvPost();
    else
      advPost=user.getAdvPost();
  }
%>
  <%@ include file="include/posttable.jsp"%>
<%
}
else if(action2.equals("post") || submit.equals("发 表")) {
  if(action.equals("copy")) {
    if(smartUpload.getRequest().getParameter("postCopyNew").equals("1"))
      action="new";//当作新帖发表
    else
      action="reply";//当作回复帖发表
  }
  if(!cookieMode.equals("0")) {
    forumPost.setFloodControlLimit(floodControlLimit);
    forumPost.setFloodControl(floodControl);
    forumPost.setCookieID(cookieID);
    forumPost.setCookieName(cookieName);
    forumPost.setCookieMode(cookieMode);
  }
  forumPost.setForumID(forumID);
  forumPost.setTopic(topic);
  forumPost.setMaxUpload(maxUpload);
  forumPost.setArrowUpload(arrowUpload);
  forumPost.setAllowAttachment(allowAttachment);
  forumPost.setStartNewThreads(startNewThreads);
  forumPost.setHtmlStat(htmlStat);
  forumPost.setPrivateForum(privateForum);
  forumPost.setPostIP(request.getRemoteAddr());
  forumPost.setCheckPass(user.getAllowPrivate(forumID));
  //设置文件上传路径,如果你上传不正确,请设置这个地方。
  String uploadRealPath=forumStatus.getUploadDir();
  forumPost.setUploadRealPath(StringUtils.replaceChar(uploadRealPath,'\\','/'));

  if(action.equals("new")) {
     forumPost.addNewPost(request,response,smartUpload);
     String errorInfo=forumPost.getErrorInfo();
     int maxOrderBy=forumPost.getOrderBy();
     if(cookieMode.equals("0")) {
       cookieMode=forumPost.getCookieMode();
       cookieName=forumPost.getCookieName();
     }
%>
<table cellpadding=0 cellspacing=0 border=0 width=<%=tablewidth%> bgcolor=<%=tablebordercolor%> align=center>
 <tr>
  <td>
   <table cellpadding=6 cellspacing=1 border=0 width=100%>
    <tr>
     <td bgcolor=<%=miscbacktwo%> align=center>
      <font color=<%=fontcolormisc%>><b>
<%
    if(errorInfo.equals("")) {
      if(cookieMode.equals("0"))
        out.println("谢谢,访客!您的新主题已经发表成功!");
      else
        out.println("谢谢,"+cookieName+"!您的新主题已经发表成功!");
    }
    else {
       out.println("错误: 发表新主题!");
    }
%>
      </b></font>
     </td>
    </tr>
    <tr>
     <td bgcolor=<%=miscbackone%>>
      <font color=<%=fontcolormisc%>>
<%
    if(errorInfo.equals("")) {
%>
        如果浏览器没有自动返回,请点击下面的链接!
        <ul>
         <li><a href="topic.jsp?forumID=<%=forumID%>&topic=<%=maxOrderBy%>">返回新主题</a>
         <li><a href="forum.jsp?forumID=<%=forumID%>">返回论坛</a>
         <li><a href="index.jsp">返回论坛首页</a>
        </ul>
        <meta http-equiv="refresh" content="3; url=topic.jsp?forumID=<%=forumID%>&topic=<%=maxOrderBy%>">
<%
    }
    else {
%>
        <b>关于发表新主题错误的详细原因:</b>
        <ul>
         <li><b><%=errorInfo%></b>
         <li>您是否需要查看<a href="javascript:openScript('help.jsp',500,400)">帮助文件</a>?
        </ul>
        <b>产生发表新主题错误的可能原因:</b>
        <ul>
         <li>密码错误
         <li>用户名错误
         <li>您不是<a href="register.jsp" >注册</a>用户
        </ul>
        <br><br>
        <center> << <a href="javascript:history.go(-1)">返回上一页</a></center>
<%
    }
%>
      </font>
     </td>
    </tr>
   </table>
  </td>
 </tr>
</table>
<%
  }
  else if(action.equals("reply") || action.equals("replyquote")) {
     forumPost.addReplyPost(request,response,smartUpload);
     String errorInfo=forumPost.getErrorInfo();
     if(cookieMode.equals("0")) {
       cookieMode=forumPost.getCookieMode();
       cookieName=forumPost.getCookieName();
     }
%>
<table cellpadding=0 cellspacing=0 border=0 width=<%=tablewidth%> bgcolor=<%=tablebordercolor%> align=center>
 <tr>
  <td>
   <table cellpadding=6 cellspacing=1 border=0 width=100%>
    <tr>
     <td bgcolor=<%=miscbacktwo%> align=center>
      <font color=<%=fontcolormisc%>><b>
<%
    if(errorInfo.equals("")) {
      if(cookieMode.equals("0"))
        out.println("谢谢,访客!您的新回复已经发表成功!");
      else
        out.println("谢谢,"+cookieName+"!您的新回复已经发表成功!");
    }
    else {
       out.println("错误: 发表新回复!");
    }
%>
      </b></font>
     </td>
    </tr>
    <tr>
     <td bgcolor=<%=miscbackone%>>
      <font color=<%=fontcolormisc%>>
<%
    if(errorInfo.equals("")) {
%>
        如果浏览器没有自动返回,请点击下面的链接!
        <ul>
         <li><a href="topic.jsp?forumID=<%=forumID%>&topic=<%=topic%>&replynum=last">返回新回复</a>
         <li><a href="forum.jsp?forumID=<%=forumID%>">返回论坛</a>
         <li><a href="index.jsp">返回论坛首页</a>
        </ul>
        <meta http-equiv="refresh" content="3; url=topic.jsp?forumID=<%=forumID%>&topic=<%=topic%>&replynum=last">
<%
    }
    else {
%>
        <b>关于发表新回复错误的详细原因:</b>
        <ul>
         <li><b><%=errorInfo%></b>
         <li>您是否需要查看<a href="javascript:openScript('help.jsp',500,400)">帮助文件</a>?
        </ul>
        <b>产生发表新回复错误的可能原因:</b>
        <ul>
         <li>密码错误
         <li>用户名错误
         <li>您不是<a href="register.jsp" >注册</a>用户
        </ul>
        <br><br>
        <center> << <a href="javascript:history.go(-1)">返回上一页</a></center>
<%
    }
%>
      </font>
     </td>
    </tr>
   </table>
  </td>
 </tr>
</table>
<%
  }
  else if(action.equals("edit")) {
    forumPost.setAction(action);
    forumPost.setNow_Time(now_time);
    forumPost.modifyPost(request,response,smartUpload);
    String errorInfo=forumPost.getErrorInfo();
%>

<table cellpadding=0 cellspacing=0 border=0 width=<%=tablewidth%> bgcolor=<%=tablebordercolor%> align=center>
 <tr>
  <td>
   <table cellpadding=6 cellspacing=1 border=0 width=100%>
    <tr>
     <td bgcolor=<%=miscbacktwo%> align=center>
      <font color=<%=fontcolormisc%>><b>
<%
    if(errorInfo.equals("")) {
      out.println("谢谢,"+cookieName+"!您的帖子已经修改成功!");
    }
    else {
      out.println("错误: 修改帖子!");
    }
%>
      </b></font>
     </td>
    </tr>
    <tr>
     <td bgcolor=<%=miscbackone%>>
      <font color=<%=fontcolormisc%>>
<%
    if(errorInfo.equals("")) {
%>
        如果浏览器没有自动返回,请点击下面的链接!
        <ul>
         <li><a href="topic.jsp?forumID=<%=forumID%>&topic=<%=topic%>">返回修改帖</a>
         <li><a href="forum.jsp?forumID=<%=forumID%>">返回论坛</a>
         <li><a href="index.jsp">返回论坛首页</a>
        </ul>
        <meta http-equiv="refresh" content="3; url=topic.jsp?forumID=<%=forumID%>&topic=<%=topic%>">
<%
    }
    else {
%>
        <b>关于发表新回复错误的详细原因:</b>
        <ul>
         <li><b><%=errorInfo%></b>
         <li>您是否需要查看<a href="javascript:openScript('help.jsp',500,400)">帮助文件</a>?
        </ul>
        <b>产生发表新回复错误的可能原因:</b>
        <ul>
         <li>密码错误
         <li>用户名错误
         <li>您不是<a href="register.jsp" >注册</a>用户
        </ul>
        <br><br>
        <center> << <a href="javascript:history.go(-1)">返回上一页</a></center>
<%
    }
%>
      </font>
     </td>
    </tr>
   </table>
  </td>
 </tr>
</table>
<%
  }
}
%>
<br><br>
<%@ include file="include/foot.jsp"%>
</body>
</html>

⌨️ 快捷键说明

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