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

📄 forumadmin.java

📁 简易邮件系统
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
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 dbo.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 dbo.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 dbo.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 dbo.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 dbo.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 dbo.board where boardid="+forumID;
		DBConnect dbc=new DBConnect(sql);
		dbc.executeUpdate();
		sql="delete from dbo.bbs1 where boardid="+forumID;
		dbc.executeUpdate(sql);
		dbc.close();

⌨️ 快捷键说明

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