天乙代码src_531.rar
天乙代码src_531.rar
天乙代码src_531.rar
天乙代码src_531.rar
源代码在线查看: sys.java
package com.laoer.bbscs.sysinfo;
import java.util.*;
import com.laoer.bbscs.util.*;
import com.laoer.bbscs.bbs.business.*;
public class Sys {
public static SysInfo SYSINFO;
public static Cache CACHE;
public static String[] WEBSITE;
public static Hashtable CSSHT;
public static Properties LOG4JPROP;
//public static Hashtable THREADHT = new Hashtable();
public static int RESULT_RIGHT = 1;
public static int RESULT_ZERO = 0;
public static int RESULT_OBJECTEXCEPTION = -1;
public static int RESULT_OBJECTNOEXISTEXCEPTION = -2;
public static int RESULT_OTHER = -3;
public static int RESULT_OBJECTEXIST = -4;
public static Object RESULT_NULL = null;
public static String USERCLASS = "com.laoer.bbscs.bbs.business.DBUser";
public static String USERDETAILCLASS =
"com.laoer.bbscs.bbs.business.DBUserDetail";
public static String ADMINUSERINFOCLASS =
"com.laoer.bbscs.bbs.business.DBAdminUser";
public static String BOARDCLASS = "com.laoer.bbscs.bbs.business.DBBoard";
public static String BOARDSCLASS = "com.laoer.bbscs.bbs.business.DBBoards";
public static String USERONLINECLASS =
"com.laoer.bbscs.bbs.business.DBUserOnline";
public static String FRIENDCLASS = "com.laoer.bbscs.bbs.business.DBFriend";
public static String BOOKMARKCLASS =
"com.laoer.bbscs.bbs.business.DBBookMark";
public static String GUESTBOOKCLASS =
"com.laoer.bbscs.bbs.business.DBGuestBook";
public static String FORMCLASS = "com.laoer.bbscs.bbs.business.DBForum";
public static String SUBSCIBECLASS =
"com.laoer.bbscs.bbs.business.DBSubscibe";
public static String USERPICCLASS = "com.laoer.bbscs.bbs.business.DBUserPic";
public static String BULLETINCLASS =
"com.laoer.bbscs.bbs.business.DBBulletin";
public static String BLACKUSERCLASS =
"com.laoer.bbscs.bbs.business.DBBlackUser";
public static String CSSCLASS = "com.laoer.bbscs.bbs.business.DBCSS";
public static String ELITECLASS = "com.laoer.bbscs.bbs.business.DBElite";
public static Locale SYSLOCALE = Locale.getDefault();
public static Locale getLocale() {
return new Locale(Sys.SYSINFO.LANGUAGE, Sys.SYSINFO.COUNTRY);
}
public static boolean isLocale() {
Locale MYLOCALE = getLocale();
return MYLOCALE.equals(SYSLOCALE);
}
public static String[] getServerIP() {
int len = Sys.SYSINFO.SERVERSIP.size();
String[] serverip = new String[len];
for (int i = 0; i < len; i++) {
serverip[i] = (String) Sys.SYSINFO.SERVERSIP.get(i);
}
return serverip;
}
public static String getURL() {
int len = Sys.SYSINFO.SERVERSURL.size();
String[] serverurl = new String[len];
for (int i = 0; i < len; i++) {
serverurl[i] = (String) Sys.SYSINFO.SERVERSURL.get(i);
}
int n = (int) (Math.random() * len);
if (Sys.SYSINFO.SINGLESERVER.equals("no")) {
return serverurl[n] + Sys.SYSINFO.ROOTWEBPATH;
}
else {
return Sys.SYSINFO.ROOTWEBPATH;
}
}
public static String getCSS(long style, int cssid) {
CSSInfo aCSSInfo = (CSSInfo) CSSHT.get(String.valueOf(style));
if (cssid == 1) {
return aCSSInfo.getCSS1();
}
if (cssid == 2) {
return aCSSInfo.getCSS2();
}
return "";
}
public static Properties getLog4jPro(String filepath) {
LOG4JPROP = new Properties();
LOG4JPROP.setProperty("log4j.category.com.laoer", "INFO,A1,R");
LOG4JPROP.setProperty("log4j.appender.A1",
"org.apache.log4j.ConsoleAppender");
LOG4JPROP.setProperty("log4j.appender.A1.layout",
"org.apache.log4j.PatternLayout");
LOG4JPROP.setProperty("log4j.appender.A1.layout.ConversionPattern",
"%-d{yyyy-MM-dd HH:mm:ss,SSS} [%c]-[%p] %m%n");
LOG4JPROP.setProperty("log4j.appender.R",
"org.apache.log4j.RollingFileAppender");
LOG4JPROP.setProperty("log4j.appender.R.File", filepath);
LOG4JPROP.setProperty("log4j.appender.R.MaxFileSize", "500KB");
LOG4JPROP.setProperty("log4j.appender.R.MaxBackupIndex", "1");
LOG4JPROP.setProperty("log4j.appender.R.layout",
"org.apache.log4j.HTMLLayout");
LOG4JPROP.setProperty("log4j.appender.R.layout.ConversionPattern",
"%d{yyyy-MM-dd HH:mm:ss,SSS} [%t] [%c] [%p] - %m%n");
return LOG4JPROP;
}
}