?? forumadmin.java
字號:
package net.acai.forum.admin;
/**
* Title: 清清網絡
* Description:
* Copyright: Copyright (c) 2002
* Company: www.SuperSpace.com
* @author: SuperSpace
* @version 1.0
*/
import net.acai.forum.*;
import net.acai.database.*;
import javax.servlet.http.*;
import java.sql.*;
import net.acai.util.*;
public class ForumAdmin{
public ForumAdmin(){}
//////////////////////////////////save mod/////////////
public void saveMod(HttpServletRequest request) throws Exception{
int forumID;
try{
forumID=ParamUtil.getInt(request,"forumID");
}
catch(Exception e){
throw new Exception("對不起,請您選定您想要修改的論壇ID");
}
int forumSkin;
try{
forumSkin=ParamUtil.getInt(request,"forumSkin");
}
catch(Exception e){
throw new Exception("對不起,請您選定論壇的類別!");
}
Forum theForum=ForumFactory.getForum(forumID);
if(theForum==null)
throw new Exception("錯誤的論壇");
if(theForum.getForumSkin()==forumSkin)
return;
String forumUser_1="";
if(forumSkin==5){
String vipuser=ParamUtil.getString(request,"vipuser");
if(vipuser!=null&&!"".equals(vipuser.trim())){
String [] forumUser=vipuser.split("\\n|\\r");
for(int i=0;i<forumUser.length;i++){
if(!"".equals(forumUser_1)){
if(i!=forumUser.length-1)
forumUser_1+=forumUser[i]+",";
else
forumUser_1+=forumUser[i];
}
}
}
}
DBConnect dbc=new DBConnect("update bbs.board set boardUser=?,boardskin=? where boardID=?");
dbc.setBytes(1,(new String(forumUser_1.getBytes("ISO-8859-1"),"GBK")).getBytes());
dbc.setInt(2,forumSkin);
dbc.setInt(3,forumID);
dbc.executeUpdate();
dbc.close();
}
public static void saveNew(HttpServletRequest request) throws Exception{
String forumType=ParamUtil.getString(request,"boardtype");
if(forumType==null||"".equals(forumType.trim()))
throw new Exception("請輸入論壇名稱。");
int classID;
try{
classID=ParamUtil.getInt(request,"class");
}
catch(Exception e){
throw new Exception("請選擇論壇分類。");
}
String forumMaster=ParamUtil.getString(request,"boardmaster","");
/*if(forumMaster==null||"".equals(forumMaster.trim()))
throw new Exception("請輸入版主姓名。");
*/
String readme=ParamUtil.getString(request,"readme");
if(readme==null||"".equals(readme.trim()))
throw new Exception("請輸入論壇說明。");
int lockForum;
try{
lockForum=ParamUtil.getInt(request,"lockboard");
}
catch(Exception e){
throw new Exception("請選擇論壇開放狀態。");
}
DBConnect dbc=new DBConnect();
String sql="insert into bbs.board(boardtype,class,boardmaster,readme,lockboard,tableback,tabletitle,\ntablebody,atablebody,tablefont,tablecontent,alertfont,forumlogo,indeximg,\nstrallowforumcode,strallowhtml,strimginposts,stricons,strflash,lastpostuser,\nlastposttime,lastbbsnum,lasttopicnum)\n values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,getdate(),?,?)";
dbc.prepareStatement(sql);
dbc.setBytes(1,(new String(forumType.getBytes("ISO-8859-1"),"GBK")).getBytes());
dbc.setInt(2,classID);
dbc.setBytes(3,(new String(forumMaster.getBytes("ISO-8859-1"),"GBK")).getBytes());
dbc.setBytes(4,(new String(readme.getBytes("ISO-8859-1"),"GBK")).getBytes());
dbc.setInt(5,lockForum);
dbc.setString(6,ParamUtil.getString(request,"Tableback",""));
dbc.setString(7,ParamUtil.getString(request,"Tabletitle",""));
dbc.setString(8,ParamUtil.getString(request,"Tablebody",""));
dbc.setString(9,ParamUtil.getString(request,"aTablebody",""));
dbc.setString(10,ParamUtil.getString(request,"TableFont",""));
dbc.setString(11,ParamUtil.getString(request,"TableContent",""));
dbc.setString(12,ParamUtil.getString(request,"AlertFont",""));
dbc.setString(13,ParamUtil.getString(request,"Logo",""));
dbc.setString(14,ParamUtil.getString(request,"indeIMG",""));
dbc.setString(15,ParamUtil.getString(request,"strAllowForumCode",""));
dbc.setString(16,ParamUtil.getString(request,"strAllowHTML",""));
dbc.setString(17,ParamUtil.getString(request,"strIMGInPosts",""));
dbc.setString(18,ParamUtil.getString(request,"strIcons",""));
dbc.setString(19,ParamUtil.getString(request,"strflash",""));
dbc.setBytes(20,(new String(("未知").getBytes("ISO-8859-1"),"GBK")).getBytes());
dbc.setInt(21,0);
dbc.setInt(22,0);
dbc.executeUpdate();
if(forumMaster!=null&&!("".equals(forumMaster.trim())))
addMaster(forumMaster,dbc);
dbc.close();
}
public static void saveEdit(HttpServletRequest request) throws Exception{
//System.out.println("asdf");
int editID;
try{
editID=ParamUtil.getInt(request,"editid");
}
catch(Exception e){
throw new Exception("請選擇編輯論壇的ID。");
}
int newforumID;
try{
newforumID=ParamUtil.getInt(request,"newforumID");
}
catch(Exception e){
throw new Exception("請填寫新論壇的ID。");
}
if (newforumID!=editID) {
Forum tempForum=ForumFactory.getForum(newforumID);
if(tempForum!=null)
throw new Exception("您不能指定和別的論壇一樣的序號。");
}
String forumType=ParamUtil.getString(request,"boardtype");
if(forumType==null||"".equals(forumType.trim()))
throw new Exception("請輸入論壇名稱。");
int classID;
try{
classID=ParamUtil.getInt(request,"class");
}
catch(Exception e){
throw new Exception("請選擇論壇分類。");
}
String forumMaster=ParamUtil.getString(request,"boardmaster","");
/*if(forumMaster==null||"".equals(forumMaster.trim()))
throw new Exception("請輸入版主姓名。");*/
String readme=ParamUtil.getString(request,"readme");
if(readme==null||"".equals(readme.trim()))
throw new Exception("請輸入論壇說明。");
int lockForum;
try{
lockForum=ParamUtil.getInt(request,"lockboard");
}
catch(Exception e){
throw new Exception("請選擇論壇開放狀態。");
}
String sql="update bbs.board set boardtype=?,class=?,boardmaster=?,readme=?,lockboard=?,tableback=?,\n tabletitle=?,tablebody=?,atablebody=?,tableFont=?,tablecontent=?,alertfont=?,\n forumlogo=?,indexIMG=?,strAllowForumCode=?,strAllowHTML=?,strIMGInPosts=?,\n strIcons=?,strflash=? \n where bbs.board.boardid=?";
DBConnect dbc=new DBConnect();
dbc.prepareStatement(sql);
dbc.setBytes(1,(new String(forumType.getBytes("ISO-8859-1"),"GBK")).getBytes());
dbc.setInt(2,classID);
dbc.setBytes(3,(new String(forumMaster.getBytes("ISO-8859-1"),"GBK")).getBytes());
dbc.setBytes(4,(new String(readme.getBytes("ISO-8859-1"),"GBK")).getBytes());
dbc.setInt(5,lockForum);
dbc.setString(6,ParamUtil.getString(request,"Tableback",""));
dbc.setString(7,ParamUtil.getString(request,"Tabletitle",""));
dbc.setString(8,ParamUtil.getString(request,"Tablebody",""));
dbc.setString(9,ParamUtil.getString(request,"aTablebody",""));
dbc.setString(10,ParamUtil.getString(request,"TableFont",""));
dbc.setString(11,ParamUtil.getString(request,"TableContent",""));
dbc.setString(12,ParamUtil.getString(request,"AlertFont",""));
dbc.setString(13,ParamUtil.getString(request,"Logo",""));
dbc.setString(14,ParamUtil.getString(request,"indeIMG",""));
dbc.setString(15,ParamUtil.getString(request,"strAllowForumCode",""));
dbc.setString(16,ParamUtil.getString(request,"strAllowHTML",""));
dbc.setString(17,ParamUtil.getString(request,"strIMGInPosts",""));
dbc.setString(18,ParamUtil.getString(request,"strIcons",""));
dbc.setString(19,ParamUtil.getString(request,"strflash",""));
dbc.setInt(20,editID);
dbc.executeUpdate();
sql="update bbs.bbs1 set boardid="+newforumID+" where boardid="+editID;
dbc.executeUpdate(sql);
if(forumMaster!=null&&!("".equals(forumMaster.trim())))
addMaster(forumMaster,dbc);
dbc.close();
}
public static void del(HttpServletRequest request) throws Exception{
int forumID;
try{
forumID=ParamUtil.getInt(request,"boardid");
}
catch(Exception e){
throw new Exception("請您選擇您要修改的論壇ID");
}
String sql="delete from bbs.board where boardid="+forumID;
DBConnect dbc=new DBConnect(sql);
dbc.executeUpdate();
sql="delete from bbs.bbs1 where boardid="+forumID;
dbc.executeUpdate(sql);
dbc.close();
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -