?? forum.java
字號:
}
rs=dbc.executeQuery(sql);
int t = 1 ;
if(t<start)
{
while(rs.next())
{
if(t==start)break;
t++;
}
}
//rs.absolute(start);
int i=0;
Vector forumMSGs=new Vector();
while(rs.next())
{
ForumMSG theMSG=new ForumMSG();
theMSG.setAnnounceID(rs.getInt(1));
theMSG.setForumID(rs.getInt(2));
theMSG.setUserName(rs.getString(3));
theMSG.setTopic(rs.getString(4));
theMSG.setDateAndTime(rs.getString(5));
theMSG.setBody(rs.getString(6));
theMSG.setExpression(rs.getString(7));
theMSG.setUserIP(rs.getString(8));
theMSG.setRootID(rs.getInt(9));
theMSG.setSignFlag(rs.getInt(10));
theMSG.setIsBest(rs.getInt(11));
theMSG.setIsVote(rs.getInt(12));
theMSG.setIsTop(rs.getInt(29));
theMSG.setLockTopic(rs.getInt(30));
theMSG.setHits(rs.getInt(28)+1);
User msgUser=new User();
msgUser.setUserName(rs.getString(13));
msgUser.setUserEmail(rs.getString(14));
msgUser.setHomePage(rs.getString(15));
msgUser.setOicq(rs.getString(16));
msgUser.setSign(rs.getString(17));
msgUser.setUserClass(rs.getInt(18));
msgUser.setTitle(rs.getString(19));
msgUser.setWidth(rs.getInt(20));
msgUser.setHeight(rs.getInt(21));
msgUser.setArticle(rs.getInt(22));
msgUser.setFace(rs.getString(23));
msgUser.setAddDate(rs.getString(24));
msgUser.setUserWealth(rs.getInt(25));
msgUser.setUserEP(rs.getInt(26));
msgUser.setUserCP(rs.getInt(27));
theMSG.setUser(msgUser);
forumMSGs.add(theMSG);
i++;
if(i==perPage)
break;
}
sql="update bbs.bbs1 set hits=hits+1 where announceID="+announceID;
dbc.executeUpdate(sql);
dbc.close();
return forumMSGs;
}
catch(SQLException se)
{
se.printStackTrace();
throw new ForumMSGNotFoundException();
}
catch(Exception e)
{
e.printStackTrace();
throw new ForumMSGNotFoundException();
}
}
public static Vector getForumTextMSGs (HttpServletRequest request) throws ForumMSGNotFoundException{
try{
int forumID,rootID;
try{
forumID=ParamUtil.getInt(request,"forumID");
rootID=ParamUtil.getInt(request,"rootID");
}
catch(Exception e){
throw new Exception("對不起,沒有發現帖子!");
}
//DBConnect dbc=new DBConnect(2,0);
DBConnect dbc=new DBConnect();
String sql="Select UserName,Topic,dateandtime,body from bbs.bbs1 where boardid="+forumID+" and rootid="+rootID+" order by announceid";
ResultSet rs=dbc.executeQuery(sql);
/*if(!rs.next())
throw new Exception("對不起沒有發現帖子!");*/
Vector forumMSGs=new Vector();
while(rs.next())
{
ForumMSG theMSG=new ForumMSG();
//theMSG.setAnnounceID(rs.getInt(1));
//theMSG.setForumID(rs.getInt(2));
theMSG.setUserName(rs.getString(1));
theMSG.setTopic(rs.getString(2));
theMSG.setDateAndTime(rs.getString(3));
theMSG.setBody(rs.getString(4));
/*theMSG.setExpression(rs.getString(7));
theMSG.setUserIP(rs.getString(8));
theMSG.setRootID(rs.getInt(9));
theMSG.setSignFlag(rs.getInt(10));
theMSG.setIsBest(rs.getInt(11));
theMSG.setIsVote(rs.getInt(12));
theMSG.setIsTop(rs.getInt(29));
theMSG.setLockTopic(rs.getInt(30));
theMSG.setHits(rs.getInt(28)+1);
User msgUser=new User();
msgUser.setUserName(rs.getString(13));
msgUser.setUserEmail(rs.getString(14));
msgUser.setHomePage(rs.getString(15));
msgUser.setOicq(rs.getString(16));
msgUser.setSign(rs.getString(17));
msgUser.setUserClass(rs.getInt(18));
msgUser.setTitle(rs.getString(19));
msgUser.setWidth(rs.getInt(20));
msgUser.setHeight(rs.getInt(21));
msgUser.setArticle(rs.getInt(22));
msgUser.setFace(rs.getString(23));
msgUser.setAddDate(rs.getString(24));
msgUser.setUserWealth(rs.getInt(25));
msgUser.setUserEP(rs.getInt(26));
msgUser.setUserCP(rs.getInt(27));
theMSG.setUser(msgUser);*/
forumMSGs.add(theMSG);
}
dbc.close();
return forumMSGs;
}
catch(Exception e)
{
e.printStackTrace();
throw new ForumMSGNotFoundException(e.getMessage());
}
}
public int getForumMSGsNum(){
return this.forumMSGsNum;
}
public int getForumTopicNum(){
return forumTopicNum;
}
public int getForumID(){
return forumID;
}
public String getForumType(){
return forumType;
}
public int getForumClass(){
return forumClass;
}
public String getReadMe(){
return readMe;
}
public String getForumMaster(){
return forumMaster;
}
public int getLockForum(){
return lockForum;
}
public int getForumSkin(){
return forumSkin;
}
public String getTableBack(){
return tableBack;
}
public String getTableTitle(){
return tableTitle;
}
public String getTableBody(){
return tableBody;
}
public String getATableBody(){
return aTableBody;
}
public String getTableFont(){
return tableFont;
}
public String getTableContent(){
return tableContent;
}
public String getAlertFont(){
return alertFont;
}
public String getLastPostUser(){
return lastPostUser;
}
public String getLastPostTime(){
return lastPostTime;
}
public int getLastBbsNum(){
return lastBbsNum;
}
public int getLastTopicNum(){
return lastTopicNum;
}
public boolean getStrAllowForumCode(){
if(strAllowForumCode==1)
return true;
else
return false;
}
public boolean getStrAllowHTML(){
if(strAllowHTML==1)
return true;
else
return false;
}
public boolean getStrIMGInPosts(){
if(strIMGInPosts==1)
return true;
else
return false;
}
public boolean getStrIcons(){
if(strIcons==1)
return true;
else
return false;
}
public boolean getStrFlash(){
if(strFlash==1)
return true;
else
return false;
}
public String getForumLogo(){
return forumLogo;
}
public String getIndexIMG(){
return indexIMG;
}
public int getLastRootID(){
return lastRootID;
}
public String getLastTopic(){
return StringUtils.escapeHTMLTags(this.lastTopic);
}
public int getTodayNum(){
return todayNum;
}
public String getForumUser(){
return forumUser;
}
public Vector getForumOLUsers(){
return forumOLUsers;
}
public int getForumOLGuestUsersNum(){
return this.forumOLGuestUsersNum;
}
public int getForumOLMemberUsersNum(){
return this.forumOLMemberUsersNum;
}
public int getForumsOLUsersNum(){
return this.forumsOLUsersNum;
}
public String getForumIMG(String lastlogin){
String strIMG="";
switch(this.getForumSkin())
{
case 1:
if(Format.compareTo(lastlogin,this.lastPostTime))
strIMG="<img src=pic/foldernew.gif width=13 height=16 alt=常規論壇,有新帖子>";
else
strIMG="<img src=pic/ifolder.gif width=13 height=16 alt=常規論壇,無新帖子>";
break;
case 2:
if(Format.compareTo(lastlogin,this.lastPostTime))
strIMG="<img src=pic/folderallnew.gif width=13 height=16 alt=開放論壇,有新帖子>";
else
strIMG="<img src=pic/folderall.gif width=13 height=16 alt=開放論壇,無新帖子>";
break;
case 3:
if(Format.compareTo(lastlogin,this.lastPostTime))
strIMG="<img src=pic/follownew.gif width=13 height=16 alt=評論論壇,有新帖子>";
else
strIMG="<img src=pic/follow.gif width=13 height=16 alt=評論論壇,無新帖子>";
break;
case 4:
if(Format.compareTo(lastlogin,this.lastPostTime))
strIMG="<img src=pic/jinghua.gif width=13 height=16 alt=精華區,有新帖子>";
else
strIMG="<img src=pic/jinghua.gif width=13 height=16 alt=精華區,無新帖子>";
break;
case 5:
if(Format.compareTo(lastlogin,this.lastPostTime))
strIMG="<img src=pic/lock_l.gif width=13 height=16 alt=認證論壇,有新帖子>";
else
strIMG="<img src=pic/lock_b.gif width=13 height=16 alt=認證論壇,無新帖子>";
break;
case 6:
if(Format.compareTo(lastlogin,this.lastPostTime))
strIMG="<img src=pic/foldernew.gif width=13 height=16 alt=正規論壇,有新帖子>";
else
strIMG="<img src=pic/ifolder.gif width=13 height=16 alt=正規論壇,無新帖子>";
break;
default:
}
return strIMG;
}
public String authorSaveMSG(HttpServletRequest request,HttpServletResponse response) throws Exception{
String userName=ParamUtil.getString(request,"userName","");
String userPassword=ParamUtil.getString(request,"userPassword","");
String sql="";
String char_changed = "[align=right][此貼子已經被作者于"+Format.getDateTime()+"編輯過][/align]";
try{
User tempUser=new User(userName,userPassword,4);
DBConnect dbc=new DBConnect();
ResultSet rs;
int forumID=ParamUtil.getInt(request,"forumID");
int announceID=ParamUtil.getInt(request,"announceID");
int rootID=ParamUtil.getInt(request,"rootID");
dbc.prepareStatement("select * from bbs.bbs1 where announceID=? and rootID=? and userName=?");
dbc.setInt(1,announceID);
dbc.setInt(2,rootID);
dbc.setBytes(3,(new String(userName.getBytes("ISO-8859-1"),"GBK")).getBytes());
rs=dbc.executeQuery();
if(!rs.next())
throw new Exception("<li>對不起,您沒有權利編輯此帖子!</li>");
String subject=ParamUtil.getString(request,"subject","");
String content=ParamUtil.getString(request,"content","")+"\n\n\n\n"+char_changed;
String expression=ParamUtil.getString(request,"expression","");
int signFlag=ParamUtil.getInt(request,"signFlag",1);
int emailFlag=ParamUtil.getInt(request,"emailFlag",0);
if(subject.equals("")) throw new Exception("沒有主體文字");
sql="update bbs.bbs1 set Topic=?,Body=?,DateAndTime=getdate(),length=?,ip=?,expression=?,signflag=?,emailflag=? where announceID=?";
dbc.prepareStatement(sql);
dbc.setBytes(1,(new String(subject.getBytes("ISO-8859-1"),"GBK")).getBytes());
dbc.setBytes(2,(new String(content.getBytes("ISO-8859-1"),"GBK")).getBytes());
dbc.setInt(3,content.length());
dbc.setString(4,request.getRemoteAddr());
dbc.setString(5,expression);
dbc.setInt(6,signFlag);
dbc.setInt(7,emailFlag);
dbc.setInt(8,announceID);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -