📄 post.jsp
字号:
<%
/*##################################################################**
**# LyBBS ver 1.2.b2 (1.2.beta-2版) / 凌云论坛 ver 1.2.b2 #**
**# #**
**# 版权所有: 凌云工作室 (原流星电脑工作室) #**
**# #**
**# 制作人 : 星语凌 『teddy (Yongshan Ye)』 #**
**# #**
**# 主页地址: http://www.unix-now.com/lybbs 凌云论坛主页 #**
**# http://www.ierp.info/lybbs 凌云论坛镜像站 #**
**# http://horseye@sina.com/ 凌云论坛支持信箱 #**
**# #**
**##################################################################*/
%>
<%@ include file="include/config.jsp"%>
<%@ page contentType="text/html;charset=gb2312" %>
<%@ include file="include/connect.jsp"%>
<%
int db=0,topic=0;
String tempSTR="",action="",submit="";
//取传递变量
tempSTR=request.getParameter("db");
if(tempSTR!=null && !tempSTR.equals(""))
db=Integer.parseInt(tempSTR);
tempSTR=request.getParameter("topic");
if(tempSTR!=null && !tempSTR.equals(""))
topic=Integer.parseInt(tempSTR);
tempSTR=request.getParameter("action");
if(tempSTR!=null)
action=tempSTR;
if(action.equals("") || db==0)
response.sendRedirect("errorPage.jsp");
//用户cookie变量声明
int id=0,styleid=0,membergone=0;
String cookieid="",cookiename="",username="",usermode="",cookiemode="";
//日期定义
int now_year=0,now_month=0,now_day=0,now_hour=0,now_minute=0,now_second=0;
String now_date="",now_time="";
//定义boardprepare.jsp中的变量
String onlineview="",dispview="",boardtitle="",boardname="",title="",version="",copyright="",support="",programmer="",programemail="",homename="",homeurl="",togb="1",status="",maintainreason="",announcement="1",boardurl="",showfastlogin="",dispborn="",styleQuery="";
int floodcontrollimit=0;
String emoticons="",floodcontrol="",useemote="";
String arrawpostfontsize="",arrawpostpic="";
String htmlstat="",lycodestat="";
String banword="";
String advpost="";
%>
<%@ include file="include/boardprepare.jsp"%>
<%@ include file="include/style.jsp"%>
<!--//html from here-->
<%@ include file="include/head.jsp"%>
<body <%=lbbody%>>
<%@ include file="include/userheader.jsp"%>
<p>
<%
String vicedbname="";
rs=connect.executeQuery("select dbname from db where id="+db);
if(rs.next())
vicedbname=rs.getString(1);
%>
<table cellpadding=0 cellspacing=0 border=0 width=<%=tablewidth%> align=center>
<tr>
<td width=30% rowspan=2 valign=top>
<%@ include file="include/viceadbanner.jsp"%>
</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="db.jsp?db=<%=db%>"><%=vicedbname%></a><br>
<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("copy")) out.print("复制帖子");%>
</font>
</td>
</tr>
</table>
<%
rs=connect.executeQuery("select floodcontrollimit,floodcontrol,emoticons,useemote from config where id=1");
if(rs.next()) {
floodcontrollimit=rs.getInt(1);
floodcontrol=rs.getString(2);
emoticons=rs.getString(3);
useemote=rs.getString(4);
}
rs=connect.executeQuery("select arrawpostfontsize,arrawpostpic from style where adminselected='1'");
if(rs.next()) {
arrawpostfontsize=rs.getString(1);
arrawpostpic=rs.getString(2);
}
rs=connect.executeQuery("select htmlstat,lycodestat from db where id="+db);
if(rs.next()) {
htmlstat=rs.getString(1);
lycodestat=rs.getString(2);
}
//取变量并存储
tempSTR=request.getParameter("submit");
if(tempSTR!=null && !tempSTR.equals(""))
submit=togb.equals("1")?connect.toGB(tempSTR):tempSTR;
String postauthor="",posttitle="",postcontent="",postusername="",postpassword="",posticon="",postipfrom="",posthtmlsupport="";
int maxorderby=0,orderby=0,postauthorid=0,postparentid=0,addmoney=0,addexperience=0,addcharm=0,postparentauthorid=0,postid=0;
String errorinfo="",postcopytitle="",postcopycontent="",postcopynew="";
boolean postok=false;
tempSTR=request.getParameter("postid");
if(tempSTR!=null && !tempSTR.equals(""))
postid=Integer.parseInt(tempSTR);
if(submit.equals("") && (action.equals("copy") || action.equals("edit"))) {
rs=connect.executeQuery("select parentid,author,title,content from posts where id="+postid);
if(rs.next()) {
postparentid=rs.getInt(1);
postauthor=rs.getString(2);
postcopytitle=rs.getString(3);
postcopycontent=rs.getString(4);
postcopycontent=connect.Replace(postcopycontent,"&","&");
postcopycontent=connect.Replace(postcopycontent,"<","<");
postcopycontent=connect.Replace(postcopycontent,">",">");
postcopycontent=connect.Replace(postcopycontent,"<br>","");
postcopycontent=connect.Replace(postcopycontent," "," ");
}
}
if(submit.equals("发 表")) {
if(action.equals("edit")) {
rs=connect.executeQuery("select author from posts where id="+postid);
if(rs.next())
postauthor=rs.getString(1);
}
else if(action.equals("copy")) {
tempSTR=request.getParameter("postcopynew");
if(tempSTR!=null && !tempSTR.equals(""))
postcopynew=tempSTR;
if(postcopynew.equals("1"))
action="new";
else
action="reply";
}
tempSTR=request.getParameter("posthtmlsupport");
if(tempSTR!=null && !tempSTR.equals(""))
posthtmlsupport=tempSTR;
tempSTR=request.getParameter("posttitle");
if(tempSTR!=null && !tempSTR.equals(""))
posttitle=togb.equals("1")?connect.toGB(tempSTR):tempSTR;
tempSTR=request.getParameter("postcontent");
if(tempSTR!=null && !tempSTR.equals(""))
postcontent=togb.equals("1")?connect.toGB(tempSTR):tempSTR;
if(!postcontent.equals("")) {
if(htmlstat.equals("1") && posthtmlsupport.equals("1"))
postcontent=connect.toBr(postcontent);//把\n换br
else
postcontent=connect.toHtml(postcontent);//去除html信息
//是否支持凌云标签
if(lycodestat.equals("1")) {
String firstcode="",replacefirstcode="",lastcode="",replacelastcode="";
rs=connect.executeQuery("select firstcode,replacefirstcode,lastcode,replacelastcode from lycode order by id");
while(rs.next()) {
firstcode=rs.getString(1);
replacefirstcode=rs.getString(2);
lastcode=rs.getString(3);
replacelastcode=rs.getString(4);
postcontent=connect.Replace(postcontent,firstcode,replacefirstcode);
postcontent=connect.Replace(postcontent,lastcode,replacelastcode);
}
postcontent=connect.toLyCode(postcontent);
}
//是否支持表情符转换
if(emoticons.equals("1")) {
String postshowemoticons="";
tempSTR=request.getParameter("postshowemoticons");
if(tempSTR!=null && !tempSTR.equals(""))
postshowemoticons=tempSTR;
if(postshowemoticons.equals("1")) {
String emote="",replaceemote="";
rs=connect.executeQuery("select emote,replaceemote from showsmilies order by id");
while(rs.next()) {
emote=rs.getString(1);
replaceemote=rs.getString(2);
postcontent=connect.Replace(postcontent,emote,replaceemote);
}
}
}
rs=connect.executeQuery("select banword from banword");
while(rs.next()) {
posttitle=connect.Replace(posttitle,rs.getString(1),"****");//过滤掉一些词语
postcontent=connect.Replace(postcontent,rs.getString(1),"****");//过滤掉一些词语
}
}
tempSTR=request.getParameter("username");
if(tempSTR!=null && !tempSTR.equals(""))
postusername=togb.equals("1")?connect.toGB(tempSTR):tempSTR;
tempSTR=request.getParameter("password");
if(tempSTR!=null && !tempSTR.equals(""))
postpassword=togb.equals("1")?connect.toGB(tempSTR):tempSTR;
tempSTR=request.getParameter("posticon");
if(tempSTR!=null && !tempSTR.equals(""))
posticon=togb.equals("1")?connect.toGB(tempSTR):tempSTR;
postipfrom=request.getRemoteAddr();
}
%>
<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.FORM.posttitle.value;
revisedTitle = currentTitle+addTitle;
document.FORM.posttitle.value=revisedTitle;
document.FORM.posttitle.focus();
return;
}
</script>
<%
//取论坛性质
String startnewthreads="";
rs=connect.executeQuery("select startnewthreads from db where id="+db);
if(rs.next())
startnewthreads=rs.getString(1);
if(submit.equals("")) {
%>
<%@ include file="include/posttable.jsp"%>
<%
}
else if(submit.equals("发 表")) {
int havepost=0;
if(floodcontrol.equals("1")) {
havepost=connect.getRowNum("posts where (UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(postat))<"+floodcontrollimit+" and authorid="+cookieid);
}
if(action.equals("new")) {
%>
<%@ include file="include/postnew.jsp"%>
<%
}
else if(action.equals("reply")) {
%>
<%@ include file="include/postadd.jsp"%>
<%
}
else if(action.equals("edit")) {
%>
<%@ include file="include/postedit.jsp"%>
<%
}
}
%>
<%
rs.close();
connect.close();
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -