?? forumpropertiesmanager.java
字號(hào):
package net.acai.forum;
/**
* Title: 清清網(wǎng)絡(luò)
* Description:
* Copyright: Copyright (c) 2002
* Company: www.SuperSpace.com
* @author: SuperSpace
* @version 1.0
*/
/**
* Title: 清清網(wǎng)絡(luò)
* Description:
* Copyright: Copyright (c) 2002
* Company: 211.68.39.120、webcpu.51.net
* @author: SuperSpace
* @version 1.0
*/
import net.acai.database.*;
import net.acai.util.*;
import java.sql.*;
import java.util.Hashtable;
import javax.servlet.http.*;
public class ForumPropertiesManager{
private static ForumPropertiesManager manager=null;
private static Object managerLock=new Object();
public static void resetManager(){
manager=null;
}
public static String getString(String name) throws Exception{
if(manager==null){
synchronized(managerLock){
if(manager==null){
manager=new ForumPropertiesManager();
}
}
}
return manager.getStr(name);
}
public static void setString(String name){
if(manager==null){
synchronized(managerLock){
if(manager==null){
manager=new ForumPropertiesManager();
}
}
}
manager.setStr(name);
}
private static Hashtable forumHash=new Hashtable();
public ForumPropertiesManager() {
try{
DBConnect dbc=new DBConnect("select * from bbs.config");
ResultSet rs=dbc.executeQuery();
ResultSetMetaData rsmd=rs.getMetaData();
rs.next();
for(int i=1;i<=rsmd.getColumnCount();i++){
forumHash.put(rsmd.getColumnName(i),rs.getString(i));
}
dbc.close();
}
catch(SQLException e)
{
System.out.println("ResultSetMetaData出現(xiàn)問題!");
}
catch(Exception e)
{
System.out.println("DBConnect 出現(xiàn)問題!");
}
}
public String getStr(String name) throws Exception{
if(forumHash.isEmpty())
throw new Exception("好像數(shù)據(jù)庫連接有問題,請(qǐng)您確定您安裝了數(shù)據(jù)庫了嗎?\n<br>如果您沒有安裝數(shù)據(jù)庫,請(qǐng)您運(yùn)行install.jsp,安裝數(shù)據(jù)庫!");
return (String)forumHash.get(name);
}
public void setStr(String name)
{
}
public Hashtable getHashtable(){
return forumHash;
}
public static void saveGrade(HttpServletRequest request) throws Exception{
int wealthReg,wealthLogin,wealthAnnounce,wealthReAnnounce,wealthDel;
int epReg,epLogin,epAnnounce,epReAnnounce,epDel;
int cpReg,cpLogin,cpAnnounce,cpReAnnounce,cpDel;
try{
wealthReg=ParamUtil.getInt(request,"wealthReg");
wealthLogin=ParamUtil.getInt(request,"wealthLogin");
wealthAnnounce=ParamUtil.getInt(request,"wealthAnnounce");
wealthReAnnounce=ParamUtil.getInt(request,"wealthReAnnounce");
wealthDel=ParamUtil.getInt(request,"wealthDel");
epReg=ParamUtil.getInt(request,"epReg");
epLogin=ParamUtil.getInt(request,"epLogin");
epAnnounce=ParamUtil.getInt(request,"epAnnounce");
epReAnnounce=ParamUtil.getInt(request,"epReAnnounce");
epDel=ParamUtil.getInt(request,"epDel");
cpReg=ParamUtil.getInt(request,"cpReg");
cpLogin=ParamUtil.getInt(request,"cpLogin");
cpAnnounce=ParamUtil.getInt(request,"cpAnnounce");
cpReAnnounce=ParamUtil.getInt(request,"cpReAnnounce");
cpDel=ParamUtil.getInt(request,"cpDel");
}
catch(Exception e){
e.printStackTrace();
throw new Exception("請(qǐng)您輸入的為數(shù)字!");
}
String sql="update bbs.config set "+
"wealthReg="+wealthReg+",wealthLogin="+wealthLogin+",wealthAnnounce="+wealthAnnounce+",wealthDel="+wealthDel+",wealthReAnnounce="+wealthReAnnounce+
",epReg="+epReg+",epLogin="+epLogin+",epAnnounce="+epAnnounce+",epDel="+epDel+",epReAnnounce="+epReAnnounce+
",cpReg="+cpReg+",cpLogin="+cpLogin+",cpAnnounce="+cpAnnounce+",cpDel="+cpDel+",cpReAnnounce="+cpReAnnounce;
DBConnect dbc=new DBConnect(sql);
dbc.executeUpdate();
dbc.close();
ForumPropertiesManager.resetManager();
}
public static void saveConst(HttpServletRequest request) throws Exception{
String forumName=ParamUtil.getString(request,"forumName");
if(forumName==null||"".equals(forumName.trim()))
throw new Exception("請(qǐng)您輸入論壇的名稱!");
String forumURL=ParamUtil.getString(request,"forumURL");
if(forumURL==null||"".equals(forumURL.trim()))
throw new Exception("請(qǐng)您輸入論壇的連接地址!");
String companyName=ParamUtil.getString(request,"companyName");
if(companyName==null||"".equals(companyName.trim()))
throw new Exception("請(qǐng)您輸入主頁的名稱!");
String hostURL=ParamUtil.getString(request,"hostURL");
if(hostURL==null||"".equals(hostURL.trim()))
throw new Exception("請(qǐng)您輸入主頁的地址!~");
String SMTPServer=ParamUtil.getString(request,"SMTPServer");
if(SMTPServer==null||"".equals(SMTPServer.trim()))
throw new Exception("請(qǐng)您輸入郵件服務(wù)器的地址!");
String systemEmail=ParamUtil.getString(request,"systemEmail");
if(systemEmail==null||"".equals(systemEmail.trim()))
throw new Exception("請(qǐng)您填寫郵件的發(fā)送人地址");
int timeAdjust=ParamUtil.getInt(request,"timeAdjust",0);
int scriptTimeOut=ParamUtil.getInt(request,"scriptTimeOut",300);
String logo=ParamUtil.getString(request,"forumLogo");
if(logo==null||"".equals(logo.trim()))
throw new Exception("請(qǐng)您填寫論壇的logo地址!");
String picURL=ParamUtil.getString(request,"picURL");
if(picURL==null||"".equals(picURL.trim()))
throw new Exception("請(qǐng)您填寫論壇圖片的目錄!");
String faceURL=ParamUtil.getString(request,"faceURL");
if(faceURL==null||"".equals(faceURL.trim()))
throw new Exception("請(qǐng)您填寫論壇的表情目錄!");
int emailFlag=ParamUtil.getInt(request,"emailFlag",0);
int uploadPic=ParamUtil.getInt(request,"uploadPic",0);
int ipFlag=ParamUtil.getInt(request,"ipFlag",0);
int fromFlag=ParamUtil.getInt(request,"fromFlag",0);
int titleFlag=ParamUtil.getInt(request,"titleFlag",0);
int uploadFlag=ParamUtil.getInt(request,"uploadFlag",0);
int guestUser=ParamUtil.getInt(request,"guestUser",0);
String openMSG=ParamUtil.getString(request,"openMSG","");
String announceMaxBytes=ParamUtil.getString(request,"announceMaxBytes","");
String maxAnnouncePerPage=ParamUtil.getString(request,"maxAnnouncePerPage","");
String maxTitleList=ParamUtil.getString(request,"maxTitleList","");
String tableBackColor=ParamUtil.getString(request,"tableBackColor");
String aTableBackColor=ParamUtil.getString(request,"aTableBackColor");
String tableTitleColor=ParamUtil.getString(request,"tableTitleColor");
String aTableTitleColor=ParamUtil.getString(request,"aTableTitleColor");
String tableFontColor=ParamUtil.getString(request,"tableFontColor");
String tableContentColor=ParamUtil.getString(request,"tableContentColor");
String alertFontColor=ParamUtil.getString(request,"alertFontColor");
String contentTitle=ParamUtil.getString(request,"contentTitle");
String tableBodyColor=ParamUtil.getString(request,"tableBodyColor");
String aTableBodyColor=ParamUtil.getString(request,"aTableBodyColor");
String ads1=ParamUtil.getString(request,"ads1","");
String ads2=ParamUtil.getString(request,"ads2","");
String copyRight=ParamUtil.getString(request,"copyRight","");
String version=ParamUtil.getString(request,"version","");
//////////////////////////插入數(shù)據(jù)庫中!//////////////////////////////////
DBConnect dbc=new DBConnect();
String sql="update bbs.config set forumName=?,forumURL=?,companyName=?,hostURL=?,SMTPServer=?\n"+
",systemEmail=?,timeAdjust="+timeAdjust+",scriptTimeOut="+scriptTimeOut+",logo=?\n"+
",picURL=?,faceURL=?,emailFlag="+emailFlag+",uploadPic="+uploadPic+",ipFlag="+ipFlag+"\n"+
",fromFlag="+fromFlag+",uploadFlag="+uploadFlag+",guestUser="+guestUser+"\n"+
",openMSG='"+openMSG+"',maxAnnouncePerPage='"+maxAnnouncePerPage+"'\n"+
",announceMaxBytes='"+announceMaxBytes+"'\n"+
",maxTitleList='"+maxTitleList+"',tableBackColor='"+tableBackColor+"'\n"+
",aTableBackColor='"+aTableBackColor+"',tableTitleColor='"+tableTitleColor+"'\n"+
",aTableTitleColor='"+aTableTitleColor+"',tableFontColor='"+tableFontColor+"'\n"+
",tableContentColor='"+tableContentColor+"',alertFontColor='"+alertFontColor+"'\n"+
",contentTitle='"+contentTitle+"',tableBodyColor='"+tableBodyColor+"'\n"+
",aTableBodyColor='"+aTableBodyColor+"',ads1=?\n"+
",ads2=?,copyRight=?\n"+
",version=?";
dbc.prepareStatement(sql);
dbc.setBytes(1,(new String(forumName.getBytes("ISO-8859-1"),"GBK")).getBytes());
dbc.setBytes(2,(new String(forumURL.getBytes("ISO-8859-1"),"GBK")).getBytes());
dbc.setBytes(3,(new String(companyName.getBytes("ISO-8859-1"),"GBK")).getBytes());
dbc.setBytes(4,(new String(hostURL.getBytes("ISO-8859-1"),"GBK")).getBytes());
dbc.setBytes(5,(new String(SMTPServer.getBytes("ISO-8859-1"),"GBK")).getBytes());
dbc.setBytes(6,(new String(systemEmail.getBytes("ISO-8859-1"),"GBK")).getBytes());
dbc.setBytes(7,(new String(logo.getBytes("ISO-8859-1"),"GBK")).getBytes());
dbc.setBytes(8,(new String(picURL.getBytes("ISO-8859-1"),"GBK")).getBytes());
dbc.setBytes(9,(new String(faceURL.getBytes("ISO-8859-1"),"GBK")).getBytes());
dbc.setBytes(10,(new String(ads1.getBytes("ISO-8859-1"),"GBK")).getBytes());
dbc.setBytes(11,(new String(ads2.getBytes("ISO-8859-1"),"GBK")).getBytes());
dbc.setBytes(12,(new String(copyRight.getBytes("ISO-8859-1"),"GBK")).getBytes());
dbc.setBytes(13,(new String(version.getBytes("ISO-8859-1"),"GBK")).getBytes());
dbc.executeUpdate();
dbc.close();
resetManager();
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -