0001: /*
0002: * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/MVNForumConfig.java,v 1.245 2008/01/29 08:09:17 minhnn Exp $
0003: * $Author: minhnn $
0004: * $Revision: 1.245 $
0005: * $Date: 2008/01/29 08:09:17 $
0006: *
0007: * ====================================================================
0008: *
0009: * Copyright (C) 2002-2007 by MyVietnam.net
0010: *
0011: * All copyright notices regarding mvnForum MUST remain
0012: * intact in the scripts and in the outputted HTML.
0013: * The "powered by" text/logo with a link back to
0014: * http://www.mvnForum.com and http://www.MyVietnam.net in
0015: * the footer of the pages MUST remain visible when the pages
0016: * are viewed on the internet or intranet.
0017: *
0018: * This program is free software; you can redistribute it and/or modify
0019: * it under the terms of the GNU General Public License as published by
0020: * the Free Software Foundation; either version 2 of the License, or
0021: * any later version.
0022: *
0023: * This program is distributed in the hope that it will be useful,
0024: * but WITHOUT ANY WARRANTY; without even the implied warranty of
0025: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0026: * GNU General Public License for more details.
0027: *
0028: * You should have received a copy of the GNU General Public License
0029: * along with this program; if not, write to the Free Software
0030: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0031: *
0032: * Support can be obtained from support forums at:
0033: * http://www.mvnForum.com/mvnforum/index
0034: *
0035: * Correspondence and Marketing Questions can be sent to:
0036: * info at MyVietnam net
0037: *
0038: * @author: Minh Nguyen
0039: * @author: Mai Nguyen
0040: * @author: Igor Manic
0041: */
0042: package com.mvnforum;
0043:
0044: import java.io.*;
0045: import java.util.Locale;
0046:
0047: import net.myvietnam.mvncore.configuration.DOM4JConfiguration;
0048: import net.myvietnam.mvncore.security.FloodControl;
0049: import net.myvietnam.mvncore.service.MvnCoreServiceFactory;
0050: import net.myvietnam.mvncore.util.*;
0051:
0052: import org.apache.commons.logging.Log;
0053: import org.apache.commons.logging.LogFactory;
0054:
0055: import com.mvnforum.service.MvnForumServiceFactory;
0056: import com.mvnforum.db.*;
0057:
0058: import freemarker.cache.FileTemplateLoader;
0059: import freemarker.template.Configuration;
0060:
0061: public final class MVNForumConfig {
0062:
0063: private static Log log = LogFactory.getLog(MVNForumConfig.class);
0064:
0065: private MVNForumConfig() {
0066: }
0067:
0068: private static final String OPTION_FILE_NAME = "mvnforum.xml";
0069:
0070: private static boolean enableBrandName = true;
0071:
0072: public static boolean getEnableBrandName() {
0073: return enableBrandName;
0074: }
0075:
0076: public static void setEnableBrandName(boolean enable) {
0077: enableBrandName = enable;
0078: }
0079:
0080: // This information will be loaded in the enterprise version
0081: private static boolean enableJAASLoginContext = false;
0082:
0083: public static boolean getEnableJAASLoginContext() {
0084: return enableJAASLoginContext;
0085: }
0086:
0087: public static void setEnableJAASLoginContext(boolean enable) {
0088: enableJAASLoginContext = enable;
0089: }
0090:
0091: private static boolean enableChat = false;
0092:
0093: public static boolean getEnableChat() {
0094: return enableChat;
0095: }
0096:
0097: public static void setEnableChat(boolean enable) {
0098: enableChat = enable;
0099: }
0100:
0101: private static boolean enablePrivateAlbum = false;
0102:
0103: public static boolean getEnablePrivateAlbum() {
0104: return enablePrivateAlbum;
0105: }
0106:
0107: public static void setEnablePrivateAlbum(boolean enable) {
0108: enablePrivateAlbum = enable;
0109: }
0110:
0111: private static boolean enablePublicAlbum = false;
0112:
0113: public static boolean getEnablePublicAlbum() {
0114: return enablePublicAlbum;
0115: }
0116:
0117: public static void setEnablePublicAlbum(boolean enable) {
0118: enablePublicAlbum = enable;
0119: }
0120:
0121: private static boolean enableAppletUploadImage = false;
0122:
0123: public static boolean getEnableAppletUploadImage() {
0124: return enableAppletUploadImage;
0125: }
0126:
0127: public static void setEnableAppletUploadImage(boolean enable) {
0128: enableAppletUploadImage = enable;
0129: }
0130:
0131: private static boolean enablePoll = false;
0132:
0133: public static boolean getEnablePoll() {
0134: return enablePoll;
0135: }
0136:
0137: public static void setEnablePoll(boolean enable) {
0138: enablePoll = enable;
0139: }
0140:
0141: private static boolean enableWatchGateway = false;
0142:
0143: public static boolean getEnableWatchGateway() {
0144: return enableWatchGateway;
0145: }
0146:
0147: public static void setEnableWatchGateway(
0148: boolean enable_watch_gateway) {
0149: enableWatchGateway = enable_watch_gateway;
0150: }
0151:
0152: private static boolean onlyNormalThreadTypeInActiveThreads = false;
0153:
0154: public static boolean getOnlyNormalThreadTypeInActiveThreads() {
0155: return onlyNormalThreadTypeInActiveThreads;
0156: }
0157:
0158: public static void setOnlyNormalThreadTypeInActiveThreads(
0159: boolean enable) {
0160: onlyNormalThreadTypeInActiveThreads = enable;
0161: }
0162:
0163: private static boolean enableLowPriorityIcon = false;
0164:
0165: public static boolean getEnableLowPriorityIcon() {
0166: return enableLowPriorityIcon;
0167: }
0168:
0169: public static void setEnableLowPriorityIcon(boolean enable) {
0170: enableLowPriorityIcon = enable;
0171: }
0172:
0173: private static boolean enableNormalPriorityIcon = false;
0174:
0175: public static boolean getEnableNormalPriorityIcon() {
0176: return enableNormalPriorityIcon;
0177: }
0178:
0179: public static void setEnableNormalPriorityIcon(boolean enable) {
0180: enableNormalPriorityIcon = enable;
0181: }
0182:
0183: private static boolean enableHighPriorityIcon = true;
0184:
0185: public static boolean getEnableHighPriorityIcon() {
0186: return enableHighPriorityIcon;
0187: }
0188:
0189: public static void setEnableHighPriorityIcon(boolean enable) {
0190: enableHighPriorityIcon = enable;
0191: }
0192:
0193: private static boolean m_showUserArea = true;
0194:
0195: public static boolean getShouldShowUserArea() {
0196: return m_showUserArea;
0197: }
0198:
0199: public static void setShouldShowUserArea(boolean showUserArea) {
0200: m_showUserArea = showUserArea;
0201: }
0202:
0203: private static boolean m_guestUserInDatabase = false;
0204:
0205: public static boolean isGuestUserInDatabase() {
0206: return m_guestUserInDatabase;
0207: }
0208:
0209: public static void setGuestUserInDatabase(boolean enable) {
0210: m_guestUserInDatabase = enable;
0211: }
0212:
0213: private static String tempDir = "";
0214:
0215: private static String searchPostIndexDir = "";
0216: private static String searchMemberIndexDir = "";
0217: private static String searchAttachmentIndexDir = "";
0218: private static String searchAlbumItemIndexDir = "";
0219:
0220: private static String attachmentDir = "";
0221: private static String pmAttachmentDir = "";
0222: private static String backupDir = "";
0223: private static String templateDir = "";
0224: private static String logDir = "";
0225: private static String avatarDir = "";
0226: private static String albumItemDir = "";
0227:
0228: private static String logFile = "";
0229:
0230: private static void setMVNForumHome(String home) {
0231:
0232: // now check the read/write permission by writing a temp file
0233: try {
0234: // always create a dir, if the dir already exitsted, nothing happen
0235: FileUtil.createDirs(home, true);
0236:
0237: String tempFilename = home + File.separatorChar
0238: + "mvnforum_tempfile.tmp";
0239: File tempFile = new File(tempFilename);
0240: if (log.isDebugEnabled()) {
0241: log.debug("Temp file = " + tempFilename);
0242: log.debug("Absolute filename of temp file = "
0243: + tempFile.getAbsolutePath());
0244: }
0245:
0246: FileOutputStream fos = new FileOutputStream(tempFilename);
0247: fos.write(tempFilename.getBytes());
0248: fos.close();
0249:
0250: tempFile.delete();
0251:
0252: // now create the directories if not exist
0253: tempDir = MVNForumHome + File.separatorChar + "temp";
0254: FileUtil.createDirs(tempDir, true);
0255:
0256: searchPostIndexDir = MVNForumHome + File.separatorChar
0257: + "search" + File.separatorChar + "post";
0258: FileUtil.createDirs(searchPostIndexDir, true);
0259:
0260: searchMemberIndexDir = MVNForumHome + File.separatorChar
0261: + "search" + File.separatorChar + "member";
0262: FileUtil.createDirs(searchMemberIndexDir, true);
0263:
0264: searchAttachmentIndexDir = MVNForumHome
0265: + File.separatorChar + "search"
0266: + File.separatorChar + "attachment";
0267: FileUtil.createDirs(searchAttachmentIndexDir, true);
0268:
0269: searchAlbumItemIndexDir = MVNForumHome + File.separatorChar
0270: + "search" + File.separatorChar + "albumitem";
0271: FileUtil.createDirs(searchAlbumItemIndexDir, true);
0272:
0273: attachmentDir = MVNForumHome + File.separatorChar
0274: + "attachment";
0275: FileUtil.createDirs(attachmentDir, true);
0276:
0277: pmAttachmentDir = MVNForumHome + File.separatorChar
0278: + "pm_attachment";
0279: FileUtil.createDirs(pmAttachmentDir, true);
0280:
0281: backupDir = MVNForumHome + File.separatorChar + "backup";
0282: FileUtil.createDirs(backupDir, true);
0283:
0284: // this dir is created as a recommended folder to store the log files
0285: logDir = MVNForumHome + File.separatorChar + "log";
0286: FileUtil.createDirs(logDir, true);
0287:
0288: avatarDir = MVNForumHome + File.separatorChar
0289: + "memberavatars";
0290: FileUtil.createDirs(avatarDir, true);
0291:
0292: // this dir is created as a recommended folder to store the template files
0293: templateDir = MVNForumHome + File.separatorChar
0294: + "template";
0295: FileUtil.createDirs(templateDir, true);
0296:
0297: albumItemDir = MVNForumHome + File.separatorChar
0298: + "albumdata";
0299: FileUtil.createDirs(albumItemDir, true);
0300:
0301: } catch (IOException ex) {
0302: log
0303: .fatal(
0304: "Cannot setup the mvnForumHome folder. Please correct it first.",
0305: ex);
0306: MvnCoreServiceFactory.getMvnCoreService()
0307: .getEnvironmentService().setShouldRun(
0308: false,
0309: "Check your mvnForumHome. Detail : "
0310: + ex.getMessage());
0311: } catch (AssertionError ae) {
0312: // should never happen, maybe in the future we should remove the Assertion in getNumberOfBeans
0313: log.fatal("Assertion error. Please correct it first.", ae);
0314: MvnCoreServiceFactory.getMvnCoreService()
0315: .getEnvironmentService().setShouldRun(
0316: false,
0317: "Assertion error. Detail : "
0318: + ae.getMessage());
0319: }
0320: }
0321:
0322: private static Configuration freeMarkerConfiguration;
0323:
0324: public static Configuration getFreeMarkerConfiguration() {
0325: return freeMarkerConfiguration;
0326: }
0327:
0328: private static String MVNForumHome = "mvnForumHome";
0329:
0330: public static String getMVNForumHome() {
0331: return MVNForumHome;
0332: }
0333:
0334: public static String getTempDir() {
0335: return tempDir;
0336: }
0337:
0338: public static String getSearchPostIndexDirName() {
0339: if (MvnForumServiceFactory.getMvnForumService()
0340: .getSearchService().savePostOnDisk()) {
0341: return searchPostIndexDir;
0342: }
0343: throw new IllegalStateException(
0344: "Cannot get search index dir name because type is not disk.");
0345: }
0346:
0347: public static String getSearchMemberIndexDirName() {
0348: if (MvnForumServiceFactory.getMvnForumService()
0349: .getSearchService().saveMemberOnDisk()) {
0350: return searchMemberIndexDir;
0351: }
0352: throw new IllegalStateException(
0353: "Cannot get search index dir name because type is not disk.");
0354: }
0355:
0356: public static String getSearchAttachmentIndexDirName() {
0357: if (MvnForumServiceFactory.getMvnForumService()
0358: .getSearchService().saveAttachmentOnDisk()) {
0359: return searchAttachmentIndexDir;
0360: }
0361: throw new IllegalStateException(
0362: "Cannot get search index dir name because type is not disk.");
0363: }
0364:
0365: public static String getSearchAlbumItemIndexDirName() {
0366: if (MvnForumServiceFactory.getMvnForumService()
0367: .getSearchService().saveAlbumItemOnDisk()) {
0368: return searchAlbumItemIndexDir;
0369: }
0370: throw new IllegalStateException(
0371: "Cannot get search index dir name because type is not disk.");
0372: }
0373:
0374: public static String getAttachmentDir() {
0375: return attachmentDir;
0376: }
0377:
0378: public static String getPmAttachmentDir() {
0379: return pmAttachmentDir;
0380: }
0381:
0382: public static String getTemplateDir() {
0383: return templateDir;
0384: }
0385:
0386: public static String getBackupDir() {
0387: return backupDir;
0388: }
0389:
0390: public static String getLogDir() {
0391: return logDir;
0392: }
0393:
0394: public static String getLogFile() {
0395: return logFile;
0396: }
0397:
0398: public static void setLogFile(String file) {
0399: logFile = file;
0400: }
0401:
0402: public static String getAvatarDir() {
0403: return avatarDir;
0404: }
0405:
0406: public static String getAlbumItemDir() {
0407: return albumItemDir;
0408: }
0409:
0410: private static String redirectLoginURL = "/login";
0411:
0412: public static String getRedirectLoginURL() {
0413: return redirectLoginURL;
0414: }
0415:
0416: public static void setRedirectLoginURL(String url) {
0417: redirectLoginURL = url;
0418: }
0419:
0420: private static String redirectLogoutURL = "/logout";
0421:
0422: public static String getRedirectLogoutURL() {
0423: return redirectLogoutURL;
0424: }
0425:
0426: public static void setRedirectLogoutURL(String url) {
0427: redirectLogoutURL = url;
0428: }
0429:
0430: private static String webMasterEmail = "youremail@yourdomain.com";
0431:
0432: public static String getWebMasterEmail() {
0433: return webMasterEmail;
0434: }
0435:
0436: public static void setWebMasterEmail(String email) {
0437: webMasterEmail = email;
0438: }
0439:
0440: private static String watchEmail = "youremail@yourdomain.com";
0441:
0442: public static String getWatchEmail() {
0443: return watchEmail;
0444: }
0445:
0446: public static void setWatchEmail(String email) {
0447: watchEmail = email;
0448: }
0449:
0450: private static String logoURL = "http://www.mvnForum.com";
0451:
0452: public static String getLogoUrl() {
0453: return logoURL;
0454: }
0455:
0456: public static void setLogoUrl(String url) {
0457: logoURL = url;
0458: }
0459:
0460: private static String[] supportedLocaleNames = new String[0];
0461: private static Locale[] supportedLocales = new Locale[0];
0462:
0463: public static String[] getSupportedLocaleNames() {
0464: return supportedLocaleNames;
0465: }
0466:
0467: public static Locale[] getSupportedLocales() {
0468: return supportedLocales;
0469: }
0470:
0471: private static String defaultLocaleName = "en";
0472:
0473: public static String getDefaultLocaleName() {
0474: return defaultLocaleName;
0475: }
0476:
0477: public static void setDefaultLocaleName(String localeName) {
0478: defaultLocaleName = localeName;
0479: }
0480:
0481: private static Locale defaultLocale = null;
0482:
0483: public static Locale getDefaultLocale() {
0484: return defaultLocale;
0485: }
0486:
0487: public static void setDefaultLocale(Locale locale) {
0488: defaultLocale = locale;
0489: }
0490:
0491: private static String localeParameterName = "lang";
0492:
0493: public static String getLocaleParameterName() {
0494: return localeParameterName;
0495: }
0496:
0497: public static void setLocaleParameterName(String name) {
0498: localeParameterName = name;
0499: }
0500:
0501: private static Locale eventLogLocale = Locale.ENGLISH;
0502:
0503: public static Locale getEventLogLocale() {
0504: return eventLogLocale;
0505: }
0506:
0507: public static void setEventLogLocale(Locale logLocale) {
0508: eventLogLocale = logLocale;
0509: }
0510:
0511: /**
0512: * Default username of a virtual Guest user. Will be overriden with the data
0513: * from the database, if it exists (for the Guest user).
0514: * Admin can give him a name he wants, like "Guest", "Anonymous", "Surfer",
0515: * or even use a language different than English.
0516: */
0517: private static String defaultGuestName = "Guest";
0518:
0519: public static String getDefaultGuestName() {
0520: return defaultGuestName;
0521: }
0522:
0523: public static void setDefaultGuestName(String name) {
0524: defaultGuestName = name;
0525: }
0526:
0527: private static double defaultGuestTimeZone = 0;
0528:
0529: public static double getDefaultGuestTimeZone() {
0530: return defaultGuestTimeZone;
0531: }
0532:
0533: public static void setDefaultGuestTimeZone(double timeZone) {
0534: defaultGuestTimeZone = timeZone;
0535: }
0536:
0537: /**
0538: * By default, mvnForum disable passwordless authentication
0539: * If you want to authenticate user from realm or customized methods,
0540: * then set the variable to true (AT YOUR OWN RISK, although I have not
0541: * found any security issues until now)
0542: */
0543: private static boolean enablePasswordlessAuth = false;
0544:
0545: public static boolean getEnablePasswordlessAuth() {
0546: return enablePasswordlessAuth;
0547: }
0548:
0549: public static void setEnablePasswordlessAuth(boolean enable) {
0550: enablePasswordlessAuth = enable;
0551: }
0552:
0553: private static boolean requireActivation = false;
0554:
0555: public static boolean getRequireActivation() {
0556: return requireActivation;
0557: }
0558:
0559: public static void setRequireActivation(boolean enable) {
0560: requireActivation = enable;
0561: }
0562:
0563: private static boolean enableLoginInfoInCookie = true;
0564:
0565: public static boolean getEnableLoginInfoInCookie() {
0566: return enableLoginInfoInCookie;
0567: }
0568:
0569: public static void setEnableLoginInfoInCookie(boolean enable) {
0570: enableLoginInfoInCookie = enable;
0571: }
0572:
0573: private static boolean enableLoginInfoInSession = true;
0574:
0575: public static boolean getEnableLoginInfoInSession() {
0576: return enableLoginInfoInSession;
0577: }
0578:
0579: public static void setEnableLoginInfoInSession(boolean enable) {
0580: enableLoginInfoInSession = enable;
0581: }
0582:
0583: private static boolean enableLoginInfoInRealm = false;
0584:
0585: public static boolean getEnableLoginInfoInRealm() {
0586: return enableLoginInfoInRealm;
0587: }
0588:
0589: public static void setEnableLoginInfoInRealm(boolean enable) {
0590: enableLoginInfoInRealm = enable;
0591: }
0592:
0593: private static boolean enableLoginInfoInCustomization = false;
0594:
0595: public static boolean getEnableLoginInfoInCustomization() {
0596: return enableLoginInfoInCustomization;
0597: }
0598:
0599: public static void setEnableLoginInfoInCustomization(boolean enable) {
0600: enableLoginInfoInCustomization = enable;
0601: }
0602:
0603: private static boolean enableLogin = true;
0604:
0605: public static boolean getEnableLogin() {
0606: return enableLogin;
0607: }
0608:
0609: public static void setEnableLogin(boolean enable) {
0610: enableLogin = enable;
0611: }
0612:
0613: private static boolean enableCacheMember = true;
0614:
0615: public static boolean getEnableCacheMember() {
0616: return enableCacheMember;
0617: }
0618:
0619: public static void setEnableCacheMember(boolean enable) {
0620: enableCacheMember = enable;
0621: }
0622:
0623: private static boolean enableCachePost = true;
0624:
0625: public static boolean getEnableCachePost() {
0626: return enableCachePost;
0627: }
0628:
0629: public static void setEnableCachePost(boolean enable) {
0630: enableCachePost = enable;
0631: }
0632:
0633: private static boolean enableCacheThread = true;
0634:
0635: public static boolean getEnableCacheThread() {
0636: return enableCacheThread;
0637: }
0638:
0639: public static void setEnableCacheThread(boolean enable) {
0640: enableCacheThread = enable;
0641: }
0642:
0643: private static boolean enableCacheForum = true;
0644:
0645: public static boolean getEnableCacheForum() {
0646: return enableCacheForum;
0647: }
0648:
0649: public static void setEnableCacheForum(boolean enable) {
0650: enableCacheForum = enable;
0651: }
0652:
0653: private static boolean enableCacheCategory = true;
0654:
0655: public static boolean getEnableCacheCategory() {
0656: return enableCacheCategory;
0657: }
0658:
0659: public static void setEnableCacheCategory(boolean enable) {
0660: enableCacheCategory = enable;
0661: }
0662:
0663: private static boolean enableGuestViewImageAttachment = false;
0664:
0665: public static boolean getEnableGuestViewImageAttachment() {
0666: return enableGuestViewImageAttachment;
0667: }
0668:
0669: public static void setEnableGuestViewImageAttachment(boolean enable) {
0670: enableGuestViewImageAttachment = enable;
0671: }
0672:
0673: private static boolean enableGuestViewListUsers = false;
0674:
0675: public static boolean getEnableGuestViewListUsers() {
0676: return enableGuestViewListUsers;
0677: }
0678:
0679: public static void setEnableGuestViewListUsers(boolean enable) {
0680: enableGuestViewListUsers = enable;
0681: }
0682:
0683: private static boolean enableNewMember = true;
0684:
0685: public static boolean getEnableNewMember() {
0686: return enableNewMember;
0687: }
0688:
0689: public static void setEnableNewMember(boolean enable) {
0690: enableNewMember = enable;
0691: }
0692:
0693: private static boolean enableNewPost = true;
0694:
0695: public static boolean getEnableNewPost() {
0696: return enableNewPost;
0697: }
0698:
0699: public static void setEnableNewPost(boolean enable) {
0700: enableNewPost = enable;
0701: }
0702:
0703: private static boolean enableSplitThread = true;
0704:
0705: public static boolean getEnableSplitThread() {
0706: return enableSplitThread;
0707: }
0708:
0709: public static void setEnableSplitThread(boolean enable) {
0710: enableSplitThread = enable;
0711: }
0712:
0713: private static boolean enableAvatar = true;
0714:
0715: public static boolean getEnableAvatar() {
0716: return enableAvatar;
0717: }
0718:
0719: public static void setEnableAvatar(boolean enable) {
0720: enableAvatar = enable;
0721: }
0722:
0723: private static boolean enableEmotion = true;
0724:
0725: public static boolean getEnableEmoticon() {
0726: return enableEmotion;
0727: }
0728:
0729: public static void setEnableEmoticon(boolean enable) {
0730: enableEmotion = enable;
0731: }
0732:
0733: private static boolean enableRSS = true;
0734:
0735: public static boolean getEnableRSS() {
0736: return enableRSS;
0737: }
0738:
0739: public static void setEnableRSS(boolean enable) {
0740: enableRSS = enable;
0741: }
0742:
0743: private static boolean enableSearch = true;
0744:
0745: public static boolean getEnableSearch() {
0746: return enableSearch;
0747: }
0748:
0749: public static void setEnableSearch(boolean enable) {
0750: enableSearch = enable;
0751: }
0752:
0753: private static boolean enableWatch = true;
0754:
0755: public static boolean getEnableWatch() {
0756: return enableWatch;
0757: }
0758:
0759: public static void setEnableWatch(boolean enable) {
0760: enableWatch = enable;
0761: }
0762:
0763: private static boolean enableAttachment = true;
0764:
0765: public static boolean getEnableAttachment() {
0766: return enableAttachment;
0767: }
0768:
0769: public static void setEnableAttachment(boolean enable) {
0770: enableAttachment = enable;
0771: }
0772:
0773: private static boolean enableMessageAttachment = true;
0774:
0775: public static boolean getEnableMessageAttachment() {
0776: return enableMessageAttachment;
0777: }
0778:
0779: public static void setEnableMessageAttachment(boolean enable) {
0780: enableMessageAttachment = enable;
0781: }
0782:
0783: private static boolean enableMostActiveThreads = true;
0784:
0785: public static boolean getEnableMostActiveThreads() {
0786: return enableMostActiveThreads;
0787: }
0788:
0789: public static void setEnableMostActiveThreads(boolean enable) {
0790: enableMostActiveThreads = enable;
0791: }
0792:
0793: private static boolean enableMostActiveMembers = true;
0794:
0795: public static boolean getEnableMostActiveMembers() {
0796: return enableMostActiveMembers;
0797: }
0798:
0799: public static void setEnableMostActiveMembers(boolean enable) {
0800: enableMostActiveMembers = enable;
0801: }
0802:
0803: private static boolean enableSiteStatisticsOverview = true;
0804:
0805: public static boolean getEnableSiteStatisticsOverview() {
0806: return enableSiteStatisticsOverview;
0807: }
0808:
0809: public static void setEnableSiteStatisticsOverview(boolean enable) {
0810: enableSiteStatisticsOverview = enable;
0811: }
0812:
0813: private static boolean enableListNewMembersInRecentDays = false;
0814:
0815: public static boolean getEnableListNewMembersInRecentDays() {
0816: return enableListNewMembersInRecentDays;
0817: }
0818:
0819: public static void setEnableListNewMembersInRecentDays(
0820: boolean enable) {
0821: enableListNewMembersInRecentDays = enable;
0822: }
0823:
0824: private static boolean enableListUsersBrowsingForum = false;
0825:
0826: public static boolean getEnableListUsersBrowsingForum() {
0827: return enableListUsersBrowsingForum;
0828: }
0829:
0830: public static void setEnableListUsersBrowsingForum(boolean enable) {
0831: enableListUsersBrowsingForum = enable;
0832: }
0833:
0834: private static boolean enableListUsersBrowsingThread = false;
0835:
0836: public static boolean getEnableListUsersBrowsingThread() {
0837: return enableListUsersBrowsingThread;
0838: }
0839:
0840: public static void setEnableListUsersBrowsingThread(boolean enable) {
0841: enableListUsersBrowsingThread = enable;
0842: }
0843:
0844: private static int daysToShowRecentMembers = 1;
0845:
0846: public static int getDaysToShowRecentMembers() {
0847: return daysToShowRecentMembers;
0848: }
0849:
0850: public static void setDaysToShowRecentMembers(int days) {
0851: daysToShowRecentMembers = days;
0852: }
0853:
0854: private static boolean enableEmailThreateningContent = true;
0855:
0856: public static boolean getEnableEmailThreateningContent() {
0857: return enableEmailThreateningContent;
0858: }
0859:
0860: public static void setEnableEmailThreateningContent(boolean enable) {
0861: enableEmailThreateningContent = enable;
0862: }
0863:
0864: private static boolean enableEmailToAdminContentWithCensoredWords = true;
0865:
0866: public static boolean getEnableEmailToAdminContentWithCensoredWords() {
0867: return enableEmailToAdminContentWithCensoredWords;
0868: }
0869:
0870: public static void setEnableEmailToAdminContentWithCensoredWords(
0871: boolean enable) {
0872: enableEmailToAdminContentWithCensoredWords = enable;
0873: }
0874:
0875: private static int defaultCategoryID = 1;
0876:
0877: public static int getDefaultCateogryID() {
0878: return defaultCategoryID;
0879: }
0880:
0881: public static void setDefaultCateogryID(int defaultID) {
0882: defaultCategoryID = defaultID;
0883: }
0884:
0885: private static boolean enableRequestPrivateForum = false;
0886:
0887: public static boolean getEnableRequestPrivateForum() {
0888: return enableRequestPrivateForum;
0889: }
0890:
0891: public static void setEnableRequestPrivateForum(boolean enable) {
0892: enableRequestPrivateForum = enable;
0893: }
0894:
0895: private static int maxAttachmentSize = 1024;
0896:
0897: public static int getMaxAttachmentSize() {
0898: return maxAttachmentSize;
0899: }
0900:
0901: public static void setMaxAttachmentSize(int maxSize) {
0902: maxAttachmentSize = maxSize;
0903: }
0904:
0905: private static int maxMessageAttachmentSize = 1024;
0906:
0907: public static int getMaxMessageAttachmentSize() {
0908: return maxMessageAttachmentSize;
0909: }
0910:
0911: public static void setMaxMessageAttachmentSize(int maxSize) {
0912: maxMessageAttachmentSize = maxSize;
0913: }
0914:
0915: // Default is false, but in KG it should be true
0916: private static boolean enableAutoForumOwner = false;
0917:
0918: public static boolean getEnableAutoForumOwner() {
0919: return enableAutoForumOwner;
0920: }
0921:
0922: public static void setEnableAutoForumOwner(boolean enable) {
0923: enableAutoForumOwner = enable;
0924: }
0925:
0926: private static boolean enableCaptcha = false;
0927:
0928: public static boolean getEnableCaptcha() {
0929: return enableCaptcha;
0930: }
0931:
0932: public static void setEnableCaptcha(boolean enable) {
0933: enableCaptcha = enable;
0934: }
0935:
0936: private static boolean enablePortalLikeIndexPage = true;
0937:
0938: public static boolean getEnablePortalLikeIndexPage() {
0939: return enablePortalLikeIndexPage;
0940: }
0941:
0942: public static void setEnablePortalLikeIndexPage(boolean enable) {
0943: enablePortalLikeIndexPage = enable;
0944: }
0945:
0946: private static boolean enableAdminCanChangePassword = true;
0947:
0948: public static boolean getEnableAdminCanChangePassword() {
0949: return enableAdminCanChangePassword;
0950: }
0951:
0952: public static void setEnableAdminCanChangePassword(boolean enable) {
0953: enableAdminCanChangePassword = enable;
0954: }
0955:
0956: private static boolean enableShowLastLoginOfCurrentMember = true;
0957:
0958: public static boolean getEnableShowLastLoginOfCurrentMember() {
0959: return enableShowLastLoginOfCurrentMember;
0960: }
0961:
0962: public static void setEnableShowLastLoginOfCurrentMember(
0963: boolean enable) {
0964: enableShowLastLoginOfCurrentMember = enable;
0965: }
0966:
0967: private static boolean enableAutoWatching = false;
0968:
0969: public static boolean getEnableAutoWatching() {
0970: return enableAutoWatching;
0971: }
0972:
0973: public static void setEnableAutoWatching(boolean enable) {
0974: enableAutoWatching = enable;
0975: }
0976:
0977: private static boolean enableEasyWatching = true;
0978:
0979: public static boolean getEnableEasyWatching() {
0980: return enableEasyWatching;
0981: }
0982:
0983: public static void setEnableEasyWatching(boolean enable) {
0984: enableEasyWatching = enable;
0985: }
0986:
0987: private static boolean enableSendWatchMailOfMyOwnPost = false;
0988:
0989: public static boolean getEnableSendWatchMailOfMyOwnPost() {
0990: return enableSendWatchMailOfMyOwnPost;
0991: }
0992:
0993: public static void setEnableSendWatchMailOfMyOwnPost(boolean enable) {
0994: enableSendWatchMailOfMyOwnPost = enable;
0995: }
0996:
0997: private static boolean enableShowLastLogin = true;
0998:
0999: public static boolean getEnableShowLastLogin() {
1000: return enableShowLastLogin;
1001: }
1002:
1003: public static void setEnableShowLastLogin(boolean enable) {
1004: enableShowLastLogin = enable;
1005: }
1006:
1007: private static boolean enableShowEmail = true;
1008:
1009: public static boolean getEnableShowEmail() {
1010: return enableShowEmail;
1011: }
1012:
1013: public static void setEnableShowEmail(boolean enable) {
1014: enableShowEmail = enable;
1015: }
1016:
1017: private static boolean enableShowBirthday = true;
1018:
1019: public static boolean getEnableShowBirthday() {
1020: return enableShowBirthday;
1021: }
1022:
1023: public static void setEnableShowBirthday(boolean enable) {
1024: enableShowBirthday = enable;
1025: }
1026:
1027: private static boolean enableShowGender = true;
1028:
1029: public static boolean getEnableShowGender() {
1030: return enableShowGender;
1031: }
1032:
1033: public static void setEnableShowGender(boolean enable) {
1034: enableShowGender = enable;
1035: }
1036:
1037: private static boolean enableShowAddress = true;
1038:
1039: public static boolean getEnableShowAddress() {
1040: return enableShowAddress;
1041: }
1042:
1043: public static void setEnableShowAddress(boolean enable) {
1044: enableShowAddress = enable;
1045: }
1046:
1047: private static boolean enableShowCity = true;
1048:
1049: public static boolean getEnableShowCity() {
1050: return enableShowCity;
1051: }
1052:
1053: public static void setEnableShowCity(boolean enable) {
1054: enableShowCity = enable;
1055: }
1056:
1057: private static boolean enableShowState = true;
1058:
1059: public static boolean getEnableShowState() {
1060: return enableShowState;
1061: }
1062:
1063: public static void setEnableShowState(boolean enable) {
1064: enableShowState = enable;
1065: }
1066:
1067: private static boolean enableShowCountry = true;
1068:
1069: public static boolean getEnableShowCountry() {
1070: return enableShowCountry;
1071: }
1072:
1073: public static void setEnableShowCountry(boolean enable) {
1074: enableShowCountry = enable;
1075: }
1076:
1077: private static boolean enableShowPhone = true;
1078:
1079: public static boolean getEnableShowPhone() {
1080: return enableShowPhone;
1081: }
1082:
1083: public static void setEnableShowPhone(boolean enable) {
1084: enableShowPhone = enable;
1085: }
1086:
1087: private static boolean enableShowMobile = true;
1088:
1089: public static boolean getEnableShowMobile() {
1090: return enableShowMobile;
1091: }
1092:
1093: public static void setEnableShowMobile(boolean enable) {
1094: enableShowMobile = enable;
1095: }
1096:
1097: private static boolean enableShowCareer = true;
1098:
1099: public static boolean getEnableShowCareer() {
1100: return enableShowCareer;
1101: }
1102:
1103: public static void setEnableShowCareer(boolean enable) {
1104: enableShowCareer = enable;
1105: }
1106:
1107: private static boolean enableShowHomepage = true;
1108:
1109: public static boolean getEnableShowHomepage() {
1110: return enableShowHomepage;
1111: }
1112:
1113: public static void setEnableShowHomepage(boolean enable) {
1114: enableShowHomepage = enable;
1115: }
1116:
1117: private static boolean enableShowCoolLink_1 = true;
1118:
1119: public static boolean getEnableShowCoolLink1() {
1120: return enableShowCoolLink_1;
1121: }
1122:
1123: public static void setEnableShowCoolLink1(boolean enable) {
1124: enableShowCoolLink_1 = enable;
1125: }
1126:
1127: private static boolean enableShowCoolLink_2 = true;
1128:
1129: public static boolean getEnableShowCoolLink2() {
1130: return enableShowCoolLink_2;
1131: }
1132:
1133: public static void setEnableShowCoolLink2(boolean enable) {
1134: enableShowCoolLink_2 = enable;
1135: }
1136:
1137: private static boolean enableShowYahoo = true;
1138:
1139: public static boolean getEnableShowYahoo() {
1140: return enableShowYahoo;
1141: }
1142:
1143: public static void setEnableShowYahoo(boolean enable) {
1144: enableShowYahoo = enable;
1145: }
1146:
1147: private static boolean enableShowAOL = true;
1148:
1149: public static boolean getEnableShowAOL() {
1150: return enableShowAOL;
1151: }
1152:
1153: public static void setEnableShowAOL(boolean enable) {
1154: enableShowAOL = enable;
1155: }
1156:
1157: private static boolean enableShowICQ = true;
1158:
1159: public static boolean getEnableShowICQ() {
1160: return enableShowICQ;
1161: }
1162:
1163: public static void setEnableShowICQ(boolean enable) {
1164: enableShowICQ = enable;
1165: }
1166:
1167: private static boolean enableShowMSN = true;
1168:
1169: public static boolean getEnableShowMSN() {
1170: return enableShowMSN;
1171: }
1172:
1173: public static void setEnableShowMSN(boolean enable) {
1174: enableShowMSN = enable;
1175: }
1176:
1177: private static boolean enableShowJoinDate = true;
1178:
1179: public static boolean getEnableShowJoinDate() {
1180: return enableShowJoinDate;
1181: }
1182:
1183: public static void setEnableShowJoinDate(boolean enable) {
1184: enableShowJoinDate = enable;
1185: }
1186:
1187: private static boolean enableShowViewCount = true;
1188:
1189: public static boolean getEnableShowViewCount() {
1190: return enableShowViewCount;
1191: }
1192:
1193: public static void setEnableShowViewCount(boolean enable) {
1194: enableShowViewCount = enable;
1195: }
1196:
1197: private static boolean enableUsePopupMenuInViewThread = false;
1198:
1199: public static boolean getEnableUsePopupMenuInViewThread() {
1200: return enableUsePopupMenuInViewThread;
1201: }
1202:
1203: public static void setEnableUsePopupMenuInViewThread(boolean enable) {
1204: enableUsePopupMenuInViewThread = enable;
1205: }
1206:
1207: private static boolean enableOnlineUsers = true;
1208:
1209: public static boolean getEnableOnlineUsers() {
1210: return enableOnlineUsers;
1211: }
1212:
1213: public static void setEnableOnlineUsers(boolean enable) {
1214: enableOnlineUsers = enable;
1215: }
1216:
1217: private static boolean enableDuplicateOnlineUsers = true;
1218:
1219: public static boolean getEnableDuplicateOnlineUsers() {
1220: return enableDuplicateOnlineUsers;
1221: }
1222:
1223: public static void setEnableDuplicateOnlineUsers(boolean enable) {
1224: enableDuplicateOnlineUsers = enable;
1225: }
1226:
1227: private static boolean enableInvisibleUsers = true;
1228:
1229: public static boolean getEnableInvisibleUsers() {
1230: return enableInvisibleUsers;
1231: }
1232:
1233: public static void setEnableInvisibleUsers(boolean enable) {
1234: enableInvisibleUsers = enable;
1235: }
1236:
1237: private static boolean enableListMembers = true;
1238:
1239: public static boolean getEnableListMembers() {
1240: return enableListMembers;
1241: }
1242:
1243: public static void setEnableListMembers(boolean enable) {
1244: enableListMembers = enable;
1245: }
1246:
1247: private static boolean enablePrivateMessage = true;
1248:
1249: public static boolean getEnablePrivateMessage() {
1250: return enablePrivateMessage;
1251: }
1252:
1253: public static void setEnablePrivateMessage(boolean enable) {
1254: enablePrivateMessage = enable;
1255: }
1256:
1257: private static boolean enablePublicMessage = true;
1258:
1259: public static boolean getEnablePublicMessage() {
1260: return enablePublicMessage;
1261: }
1262:
1263: public static void setEnablePublicMessage(boolean enable) {
1264: enablePublicMessage = enable;
1265: }
1266:
1267: private static boolean enableListUnansweredThreads = true;
1268:
1269: public static boolean getEnableListUnansweredThreads() {
1270: return enableListUnansweredThreads;
1271: }
1272:
1273: public static void setEnableListUnansweredThreads(boolean enable) {
1274: enableListUnansweredThreads = enable;
1275: }
1276:
1277: private static boolean enableThumbnail = false;
1278:
1279: public static boolean getEnableThumbnail() {
1280: return enableThumbnail;
1281: }
1282:
1283: public static void setEnableThumbnail(boolean enable) {
1284: enableThumbnail = enable;
1285: }
1286:
1287: private static int thumbnailWidth = 100;
1288:
1289: public static int getThumbnailWidth() {
1290: return thumbnailWidth;
1291: }
1292:
1293: public static void setThumbnailWidth(int width) {
1294: thumbnailWidth = width;
1295: }
1296:
1297: private static int thumbnailHeight = 100;
1298:
1299: public static int getThumbnailHeight() {
1300: return thumbnailHeight;
1301: }
1302:
1303: public static void setThumbnailHeight(int height) {
1304: thumbnailHeight = height;
1305: }
1306:
1307: private static boolean enableRWC = false;
1308:
1309: public static boolean getEnableRWC() {
1310: return enableRWC;
1311: }
1312:
1313: public static void setEnableRWC(boolean enable) {
1314: enableRWC = enable;
1315: }
1316:
1317: // should not be true, only for RWC
1318: private static boolean enableMaximizedEditArea = false;
1319:
1320: public static boolean getEnableMaximizedEditArea() {
1321: return enableMaximizedEditArea;
1322: }
1323:
1324: public static void setEnableMaximizedEditArea(boolean enable) {
1325: enableMaximizedEditArea = enable;
1326: }
1327:
1328: // only set alwaysActivation = true in some special case of integration
1329: private static boolean alwaysActivation = false;
1330:
1331: public static boolean getAlwaysActivation() {
1332: return alwaysActivation;
1333: }
1334:
1335: public static void setAlwaysActivation(boolean enable) {
1336: alwaysActivation = enable;
1337: }
1338:
1339: private static boolean enableShowPostCount = true;
1340:
1341: public static boolean getEnableShowPostCount() {
1342: return enableShowPostCount;
1343: }
1344:
1345: public static void setEnableShowPostCount(boolean enable) {
1346: enableShowPostCount = enable;
1347: }
1348:
1349: private static boolean enableShowOnlineStatus = true;
1350:
1351: public static boolean getEnableShowOnlineStatus() {
1352: return enableShowOnlineStatus;
1353: }
1354:
1355: public static void setEnableShowOnlineStatus(boolean enable) {
1356: enableShowOnlineStatus = enable;
1357: }
1358:
1359: private static boolean enableShowFirstName = true;
1360:
1361: public static boolean getEnableShowFirstName() {
1362: return enableShowFirstName;
1363: }
1364:
1365: public static void setEnableShowFirstName(boolean enable) {
1366: enableShowFirstName = enable;
1367: }
1368:
1369: private static boolean enableShowLastName = true;
1370:
1371: public static boolean getEnableShowLastName() {
1372: return enableShowLastName;
1373: }
1374:
1375: public static void setEnableShowLastName(boolean enable) {
1376: enableShowLastName = enable;
1377: }
1378:
1379: private static boolean enableExpanseCategoryTree = true;
1380:
1381: public static boolean getEnableExpanseCategoryTree() {
1382: return enableExpanseCategoryTree;
1383: }
1384:
1385: public static void setEnableExpanseCategoryTree(boolean enable) {
1386: enableExpanseCategoryTree = enable;
1387: }
1388:
1389: /**
1390: * This is the maximum number of favorite threads that a user can add
1391: */
1392: private static int maxFavoriteThreads = 128;
1393:
1394: public static int getMaxFavoriteThreads() {
1395: return maxFavoriteThreads;
1396: }
1397:
1398: public static void setMaxFavoriteThreads(int maxThread) {
1399: maxFavoriteThreads = maxThread;
1400: }
1401:
1402: private static int maxPrivateMessages = 128;
1403:
1404: public static int getMaxPrivateMessages() {
1405: return maxPrivateMessages;
1406: }
1407:
1408: public static void setMaxPrivateMessages(int maxMessage) {
1409: maxPrivateMessages = maxMessage;
1410: }
1411:
1412: private static int maxHotTopics = 10;
1413:
1414: public static int maxHotTopics() {
1415: return maxHotTopics;
1416: }
1417:
1418: public static void maxHotTopics(int maxTopics) {
1419: maxHotTopics = maxTopics;
1420: }
1421:
1422: private static int maxPostsPerHourPerIP = 20;
1423:
1424: public static int getMaxPostsPerHourPerIP() {
1425: return maxPostsPerHourPerIP;
1426: }
1427:
1428: public static void setMaxPostsPerHourPerIP(int maxPosts) {
1429: maxPostsPerHourPerIP = maxPosts;
1430: }
1431:
1432: private static int maxPostsPerHourPerMember = 10;
1433:
1434: public static int getMaxPostsPerHourPerMember() {
1435: return maxPostsPerHourPerMember;
1436: }
1437:
1438: public static void setMaxPostsPerHourPerMember(int maxPosts) {
1439: maxPostsPerHourPerMember = maxPosts;
1440: }
1441:
1442: private static int maxMembersPerHourPerIP = 2;
1443:
1444: public static int getMaxMembersPerHourPerIP() {
1445: return maxMembersPerHourPerIP;
1446: }
1447:
1448: public static void setMaxMembersPerHourPerIP(int maxMembers) {
1449: maxMembersPerHourPerIP = maxMembers;
1450: }
1451:
1452: private static int maxLoginsPerHourPerIP = 5;
1453:
1454: public static int getMaxLoginsPerHourPerIP() {
1455: return maxLoginsPerHourPerIP;
1456: }
1457:
1458: public static void setMaxLoginsPerHourPerIP(int maxLogins) {
1459: maxLoginsPerHourPerIP = maxLogins;
1460: }
1461:
1462: private static int maxHttpRequestsPerHourPerIP = 200;
1463:
1464: public static int getMaxHttpRequestsPerHourPerIP() {
1465: return maxHttpRequestsPerHourPerIP;
1466: }
1467:
1468: public static void setMaxHttpRequestsPerHourPerIP(
1469: int maxHttpRequests) {
1470: maxHttpRequestsPerHourPerIP = maxHttpRequests;
1471: }
1472:
1473: private static int maxMessagesPerHourPerIP = 5;
1474:
1475: public static int getMaxMessagesPerHourPerIP() {
1476: return maxMessagesPerHourPerIP;
1477: }
1478:
1479: public static void setMaxMessagesPerHourPerIP(int maxMessages) {
1480: maxMessagesPerHourPerIP = maxMessages;
1481: }
1482:
1483: private static int maxPasswordDays = 0;
1484:
1485: public static int getMaxPasswordDays() {
1486: return maxPasswordDays;
1487: }
1488:
1489: private static int maxActiveThreads = 5;
1490:
1491: public static int getMaxActiveThreads() {
1492: return maxActiveThreads;
1493: }
1494:
1495: public static void setMaxActiveThreads(int maxThreads) {
1496: maxActiveThreads = maxThreads;
1497: }
1498:
1499: private static int maxActiveMembers = 5;
1500:
1501: public static int getMaxActiveMembers() {
1502: return maxActiveMembers;
1503: }
1504:
1505: public static void setMaxActiveMembers(int maxMembers) {
1506: maxActiveMembers = maxMembers;
1507: }
1508:
1509: /** Do we allow storing backup files on the server? Currently not used. */
1510: static boolean ENABLE_BACKUP_ON_SERVER = true;
1511: public static final String BACKUP_FILE_PREFIX = "mvnForum-";
1512: public static final String BACKUP_FILE_MainXmlFileNameInZip = "IMPORT.xml";
1513: public static final String BACKUP_FILE_AvatarsDirNameInZip = "AVATARS/"; //must end with '/'
1514: public static final String BACKUP_FILE_AttachsDirNameInZip = "ATTACHMENTS/"; //must end with '/'
1515:
1516: /**
1517: * Maximum size of the import file (in bytes) we will allow to be uploaded
1518: * to server before processing.
1519: */
1520: private static int maxImportSize = 4096000;
1521:
1522: public static int getMaxImportSize() {
1523: return maxImportSize;
1524: }
1525:
1526: public static void setMaxImportSize(int maxSize) {
1527: maxImportSize = maxSize;
1528: }
1529:
1530: /**
1531: * Type of import/export file: mvnForum XML.
1532: * Import only database info, no attachments, message folders, avatars, ...
1533: */
1534: public static final int IMPORTEXPORT_TYPE_MVN_XML = 0;
1535:
1536: /**
1537: * Type of import file: mvnForum ZIP.
1538: * Also import attachments, avatars, message folders
1539: */
1540: public static final int IMPORTEXPORT_TYPE_MVN_ZIP = 1;
1541:
1542: /**
1543: * Type of import file: Jive XML.
1544: * Using <code>http://www.jivesoftware.com/jive.dtd</code>, xmlversion="1.0".
1545: */
1546: public static final int IMPORTEXPORT_TYPE_JIVE_XML = 2;
1547:
1548: /**
1549: * Output all messages, including errors, important messages and
1550: * informational/status messages. This constant is used for specifing
1551: * the level of output in various processess throughout the application.
1552: */
1553: public static final int MESSAGE_LEVEL_ALL_MESSAGES = 0;
1554:
1555: /**
1556: * Output only error messages and important messages (no
1557: * informational/status messages). This constant is used for specifing
1558: * the level of output in various processess throughout the application.
1559: */
1560: public static final int MESSAGE_LEVEL_IMPORTANT_MESSAGES = 1;
1561:
1562: /**
1563: * Output only error messages (no important messages, no
1564: * informational/status messages). This constant is used for specifing
1565: * the level of output in various processess throughout the application.
1566: */
1567: public static final int MESSAGE_LEVEL_ONLY_ERRORS = 2;
1568:
1569: public final static long SESSION_DURATION = 30 * DateUtil.MINUTE; // SHOULD NOT less than 15 minutes
1570:
1571: // public static final boolean DEFAULT_MESSAGE_ENABLE = true;
1572: // public static final boolean DEFAULT_MEMBER_ENABLE = true;
1573:
1574: /**
1575: * Configurable number of days that a user can edit a post
1576: */
1577: private static int maxEditDays = 7;
1578:
1579: public static int getMaxEditDays() {
1580: return maxEditDays;
1581: }
1582:
1583: public static void setMaxEditDays(int maxDays) {
1584: maxEditDays = maxDays;
1585: }
1586:
1587: /**
1588: * Configurable number of days that a user can attach file to a post
1589: */
1590: private static int maxAttachDays = 1;
1591:
1592: public static int getMaxAttachDays() {
1593: return maxAttachDays;
1594: }
1595:
1596: public static void setMaxAttachDays(int maxDays) {
1597: maxAttachDays = maxDays;
1598: }
1599:
1600: /**
1601: * Configurable number of days that a user can delete a post
1602: */
1603: private static int maxDeleteDays = 1;
1604:
1605: public static int getMaxDeleteDays() {
1606: return maxDeleteDays;
1607: }
1608:
1609: public static void setMaxDeleteDays(int maxDays) {
1610: maxDeleteDays = maxDays;
1611: }
1612:
1613: /**
1614: * Default number of rows (of Guest user) shown per page
1615: */
1616: private static int rowsPerPage = 10;
1617:
1618: public static int getRowsPerPage() {
1619: return rowsPerPage;
1620: }
1621:
1622: public static void setRowsPerPage(int rows) {
1623: rowsPerPage = rows;
1624: }
1625:
1626: /**
1627: * This is the number of rows returned when list threads for RSS
1628: */
1629: private static int rowsPerRSS = 15; // RSS 0.91
1630:
1631: public static int getRowsPerRSS() {
1632: return rowsPerRSS;
1633: }
1634:
1635: public static void setRowsPerRSS(int rows) {
1636: rowsPerRSS = rows;
1637: }
1638:
1639: /**
1640: * This is the default value of watch option
1641: * @see com.mvnforum.db.WatchBean for the constant values
1642: */
1643: private static int defaultWatchOption = 0;
1644:
1645: public static int getDefaultWatchOption() {
1646: return defaultWatchOption;
1647: }
1648:
1649: public static void setDefaultWatchOption(int option) {
1650: defaultWatchOption = option;
1651: }
1652:
1653: /**
1654: * This is the default value of watch option
1655: * @see com.mvnforum.db.WatchBean for the constant values
1656: */
1657: private static boolean haveInternet = true;
1658:
1659: public static boolean getHaveInternet() {
1660: return haveInternet;
1661: }
1662:
1663: public static void setHaveInternet(boolean internet) {
1664: haveInternet = internet;
1665: }
1666:
1667: private static int defaultStatusOfRegisteredMember = 0;
1668:
1669: public static int getDefaultStatusOfRegisteredMember() {
1670: return defaultStatusOfRegisteredMember;
1671: }
1672:
1673: public static void setDefaultStatusOfRegisteredMember(int status) {
1674: defaultStatusOfRegisteredMember = status;
1675: }
1676:
1677: private static boolean enableRegisterRule = true;
1678:
1679: public static boolean getEnableRegisterRule() {
1680: return enableRegisterRule;
1681: }
1682:
1683: public static void setEnableRegisterRule(boolean status) {
1684: enableRegisterRule = status;
1685: }
1686:
1687: private static int defaultWatchType = 1;
1688:
1689: public static int getDefaultWatchType() {
1690: return defaultWatchType;
1691: }
1692:
1693: public static void setDefaultWatchType(int type) {
1694: defaultWatchType = type;
1695: }
1696:
1697: private static boolean sendWatchMailAsHTML = true;
1698:
1699: public static boolean getSendWatchMailAsHTML() {
1700: return sendWatchMailAsHTML;
1701: }
1702:
1703: public static void setSendWatchMailAsHTML(boolean asHTML) {
1704: sendWatchMailAsHTML = asHTML;
1705: }
1706:
1707: private static boolean enableCheckInvalidSession = true;
1708:
1709: public static boolean getEnableCheckInvalidSession() {
1710: return enableCheckInvalidSession;
1711: }
1712:
1713: public static void setEnableCheckInvalidSession(boolean status) {
1714: enableCheckInvalidSession = status;
1715: }
1716:
1717: private static int defaultModerationOption = 0;
1718:
1719: public static int getDefaultModerationOption() {
1720: return defaultModerationOption;
1721: }
1722:
1723: public static void setDefaultModerationOption(int option) {
1724: defaultModerationOption = option;
1725: }
1726:
1727: private static int maxCharsInShortSummary = 100;
1728:
1729: public static int getMaxCharsInShortSummary() {
1730: // getMaxCharsInPostInIndex
1731: return maxCharsInShortSummary;
1732: }
1733:
1734: public static void setMaxCharsInShortSummary(int maxChars) {
1735: maxCharsInShortSummary = maxChars;
1736: }
1737:
1738: private static int maxCharsInLongSummary = 1000;
1739:
1740: public static int getMaxCharsInLongSummary() {
1741: //getMaxCharsInPostInListthreads()
1742: return maxCharsInLongSummary;
1743: }
1744:
1745: public static void setMaxCharsInLongSummary(int maxChars) {
1746: maxCharsInLongSummary = maxChars;
1747: }
1748:
1749: private static int maxCharsInRSS = 500;
1750:
1751: public static int getMaxCharsInRSS() {
1752: return maxCharsInRSS;
1753: }
1754:
1755: public static void setMaxCharsInRSS(int maxChars) {
1756: maxCharsInRSS = maxChars;
1757: }
1758:
1759: private static boolean enableEncryptPasswordOnBrowser = true;
1760:
1761: public static boolean getEnableEncryptPasswordOnBrowser() {
1762: return enableEncryptPasswordOnBrowser;
1763: }
1764:
1765: public static void setEnableEncryptPasswordOnBrowser(boolean enable) {
1766: enableEncryptPasswordOnBrowser = enable;
1767: }
1768:
1769: private static boolean enableExternalUserDatabase = false;
1770:
1771: public static boolean getEnableExternalUserDatabase() {
1772: return enableExternalUserDatabase;
1773: }
1774:
1775: public static void setEnableExternalUserDatabase(boolean enable) {
1776: enableExternalUserDatabase = enable;
1777: }
1778:
1779: public static boolean requireRegisterAddress = false;
1780:
1781: public static boolean isRequireRegisterAddress() {
1782: return requireRegisterAddress;
1783: }
1784:
1785: public static void setRequireRegisterAddress(
1786: boolean requireRegisterAddress) {
1787: MVNForumConfig.requireRegisterAddress = requireRegisterAddress;
1788: }
1789:
1790: public static boolean requireRegisterAol = false;
1791:
1792: public static boolean isRequireRegisterAol() {
1793: return requireRegisterAol;
1794: }
1795:
1796: public static void setRequireRegisterAol(boolean requireRegisterAol) {
1797: MVNForumConfig.requireRegisterAol = requireRegisterAol;
1798: }
1799:
1800: public static boolean requireRegisterBirthday = false;
1801:
1802: public static boolean isRequireRegisterBirthday() {
1803: return requireRegisterBirthday;
1804: }
1805:
1806: public static void setRequireRegisterBirthday(
1807: boolean requireRegisterBirthday) {
1808: MVNForumConfig.requireRegisterBirthday = requireRegisterBirthday;
1809: }
1810:
1811: public static boolean requireRegisterCareer = false;
1812:
1813: public static boolean isRequireRegisterCareer() {
1814: return requireRegisterCareer;
1815: }
1816:
1817: public static void setRequireRegisterCareer(
1818: boolean requireRegisterCareer) {
1819: MVNForumConfig.requireRegisterCareer = requireRegisterCareer;
1820: }
1821:
1822: public static boolean requireRegisterCity = false;
1823:
1824: public static boolean isRequireRegisterCity() {
1825: return requireRegisterCity;
1826: }
1827:
1828: public static void setRequireRegisterCity(
1829: boolean requireRegisterCity) {
1830: MVNForumConfig.requireRegisterCity = requireRegisterCity;
1831: }
1832:
1833: public static boolean requireRegisterCountry = false;
1834:
1835: public static boolean isRequireRegisterCountry() {
1836: return requireRegisterCountry;
1837: }
1838:
1839: public static void setRequireRegisterCountry(
1840: boolean requireRegisterCountry) {
1841: MVNForumConfig.requireRegisterCountry = requireRegisterCountry;
1842: }
1843:
1844: public static boolean requireRegisterFirstname = false;
1845:
1846: public static boolean isRequireRegisterFirstname() {
1847: return requireRegisterFirstname;
1848: }
1849:
1850: public static void setRequireRegisterFirstname(
1851: boolean requireRegisterFirstname) {
1852: MVNForumConfig.requireRegisterFirstname = requireRegisterFirstname;
1853: }
1854:
1855: public static boolean requireRegisterGender = false;
1856:
1857: public static boolean isRequireRegisterGender() {
1858: return requireRegisterGender;
1859: }
1860:
1861: public static void setRequireRegisterGender(
1862: boolean requireRegisterGender) {
1863: MVNForumConfig.requireRegisterGender = requireRegisterGender;
1864: }
1865:
1866: public static boolean requireRegisterHomepage = false;
1867:
1868: public static boolean isRequireRegisterHomepage() {
1869: return requireRegisterHomepage;
1870: }
1871:
1872: public static void setRequireRegisterHomepage(
1873: boolean requireRegisterHomepage) {
1874: MVNForumConfig.requireRegisterHomepage = requireRegisterHomepage;
1875: }
1876:
1877: public static boolean requireRegisterIcq = false;
1878:
1879: public static boolean isRequireRegisterIcq() {
1880: return requireRegisterIcq;
1881: }
1882:
1883: public static void setRequireRegisterIcq(boolean requireRegisterIcq) {
1884: MVNForumConfig.requireRegisterIcq = requireRegisterIcq;
1885: }
1886:
1887: public static boolean requireRegisterLastname = false;
1888:
1889: public static boolean isRequireRegisterLastname() {
1890: return requireRegisterLastname;
1891: }
1892:
1893: public static void setRequireRegisterLastname(
1894: boolean requireRegisterLastname) {
1895: MVNForumConfig.requireRegisterLastname = requireRegisterLastname;
1896: }
1897:
1898: public static boolean requireRegisterLink_1 = false;
1899:
1900: public static boolean isRequireRegisterLink_1() {
1901: return requireRegisterLink_1;
1902: }
1903:
1904: public static void setRequireRegisterLink_1(
1905: boolean requireRegisterLink_1) {
1906: MVNForumConfig.requireRegisterLink_1 = requireRegisterLink_1;
1907: }
1908:
1909: public static boolean requireRegisterLink_2 = false;
1910:
1911: public static boolean isRequireRegisterLink_2() {
1912: return requireRegisterLink_2;
1913: }
1914:
1915: public static void setRequireRegisterLink_2(
1916: boolean requireRegisterLink_2) {
1917: MVNForumConfig.requireRegisterLink_2 = requireRegisterLink_2;
1918: }
1919:
1920: public static boolean requireRegisterMobile = false;
1921:
1922: public static boolean isRequireRegisterMobile() {
1923: return requireRegisterMobile;
1924: }
1925:
1926: public static void setRequireRegisterMobile(
1927: boolean requireRegisterMobile) {
1928: MVNForumConfig.requireRegisterMobile = requireRegisterMobile;
1929: }
1930:
1931: public static boolean requireRegisterMsn = false;
1932:
1933: public static boolean isRequireRegisterMsn() {
1934: return requireRegisterMsn;
1935: }
1936:
1937: public static void setRequireRegisterMsn(boolean requireRegisterMsn) {
1938: MVNForumConfig.requireRegisterMsn = requireRegisterMsn;
1939: }
1940:
1941: public static boolean requireRegisterPhone = false;
1942:
1943: public static boolean isRequireRegisterPhone() {
1944: return requireRegisterPhone;
1945: }
1946:
1947: public static void setRequireRegisterPhone(
1948: boolean requireRegisterPhone) {
1949: MVNForumConfig.requireRegisterPhone = requireRegisterPhone;
1950: }
1951:
1952: public static boolean requireRegisterState = false;
1953:
1954: public static boolean isRequireRegisterState() {
1955: return requireRegisterState;
1956: }
1957:
1958: public static void setRequireRegisterState(
1959: boolean requireRegisterState) {
1960: MVNForumConfig.requireRegisterState = requireRegisterState;
1961: }
1962:
1963: public static boolean requireRegisterYahoo = false;
1964:
1965: public static boolean isRequireRegisterYahoo() {
1966: return requireRegisterYahoo;
1967: }
1968:
1969: public static void setRequireRegisterYahoo(
1970: boolean requireRegisterYahoo) {
1971: MVNForumConfig.requireRegisterYahoo = requireRegisterYahoo;
1972: }
1973:
1974: /**
1975: * This is the number of reply rows returned when addpost (reply to a topic)
1976: * /forum/addpost
1977: */
1978: public static final int ROWS_IN_LAST_REPLIES = 5;
1979:
1980: /*
1981: private static boolean parseBooleanValue(String propertyValue, boolean defaultValue) {
1982: String result = "true";
1983: try {
1984: result = propertyValue.trim();
1985: if ((result.equalsIgnoreCase("false")) || (result.equalsIgnoreCase("no"))) {
1986: return false;
1987: } else if ((result.equalsIgnoreCase("true")) || (result.equalsIgnoreCase("yes"))) {
1988: return true;
1989: } else {
1990: log.warn("Invalid boolean value in properties file. Should be \"true\", \"false\", \"yes\" or \"no\".");
1991: return defaultValue;
1992: }
1993: } catch (Exception e) {
1994: log.warn(e.getMessage());
1995: return defaultValue;
1996: }
1997: }
1998:
1999: private static int parseIntValue(String propertyValue, int defaultValue) {
2000: try {
2001: return Integer.parseInt(propertyValue.trim());
2002: } catch (Exception e) {
2003: log.warn(e.getMessage());
2004: return defaultValue;
2005: }
2006: }
2007: */
2008:
2009: static {
2010: try {
2011: load();
2012:
2013: // Load FreeMarker configuration
2014: freeMarkerConfiguration = new Configuration();
2015: FileTemplateLoader templateLoader = new FileTemplateLoader(
2016: new File(MVNForumConfig.getTemplateDir()));
2017: log.debug("Template directory = "
2018: + MVNForumConfig.getTemplateDir());
2019: freeMarkerConfiguration.setTemplateLoader(templateLoader);
2020: } catch (Exception e) {
2021: String message = "com.mvnforum.MVNForumConfig: Can't read the configuration file: '"
2022: + OPTION_FILE_NAME
2023: + "'. Make sure the file is in your CLASSPATH";
2024: log.error(message, e);
2025: MvnCoreServiceFactory.getMvnCoreService()
2026: .getEnvironmentService().setShouldRun(false,
2027: message);
2028: }
2029: }
2030:
2031: public static void load() {
2032: reload();
2033: }
2034:
2035: public static void reload() {
2036:
2037: String strPathName = FileUtil.getServletClassesPath();
2038: String configFilename = strPathName + OPTION_FILE_NAME;
2039:
2040: try {
2041: DOM4JConfiguration conf = new DOM4JConfiguration(new File(
2042: configFilename));
2043:
2044: MVNForumHome = conf.getString(
2045: "mvnforumconfig.mvnforum_home", "");
2046: setMVNForumHome(MVNForumHome);
2047:
2048: //enableBrandName = conf.getBoolean("mvnforumconfig.enable_brand_name", true);
2049:
2050: webMasterEmail = conf.getString(
2051: "mvnforumconfig.webmaster_email", "");
2052: watchEmail = conf.getString("mvnforumconfig.watch_email",
2053: "");
2054:
2055: logoURL = conf
2056: .getString("mvnforumconfig.logo_url", logoURL);
2057:
2058: logFile = conf.getString("mvnforumconfig.mvnforum_log", "");
2059:
2060: String supportedLocalesConfig = conf.getString(
2061: "mvnforumconfig.supported_locales", "");
2062: supportedLocaleNames = StringUtil.getStringArray(
2063: supportedLocalesConfig, ";");
2064: supportedLocales = new Locale[supportedLocaleNames.length];
2065:
2066: for (int i = 0; i < supportedLocaleNames.length; i++) {
2067: String localeName = supportedLocaleNames[i];
2068: supportedLocales[i] = MyUtil.getLocale(localeName);
2069: }
2070:
2071: try {
2072: defaultLocaleName = conf.getString(
2073: "mvnforumconfig.default_locale_name", "");
2074: if (defaultLocaleName.length() == 0) {
2075: defaultLocaleName = "en";
2076: }
2077: } catch (Exception ex) {
2078: log.warn(ex.getMessage());
2079: }
2080: defaultLocale = MyUtil.getLocale(defaultLocaleName);
2081: eventLogLocale = MyUtil.getLocale(conf
2082: .getString("mvnforumconfig.event_log_locale"));
2083:
2084: try {
2085: defaultGuestName = conf.getString(
2086: "mvnforumconfig.default_guest_name",
2087: defaultGuestName);
2088: } catch (Exception ex) {
2089: log.warn(ex.getMessage());
2090: }
2091:
2092: defaultGuestTimeZone = conf.getDouble(
2093: "mvnforumconfig.default_guest_timezone",
2094: defaultGuestTimeZone);
2095: if (Math.abs(defaultGuestTimeZone) > 12) {
2096: defaultGuestTimeZone = 0;
2097: }
2098:
2099: redirectLoginURL = conf.getString(
2100: "mvnforumconfig.redirect_login_url",
2101: redirectLoginURL);
2102: redirectLogoutURL = conf.getString(
2103: "mvnforumconfig.redirect_logout_url",
2104: redirectLogoutURL);
2105: localeParameterName = conf.getString(
2106: "mvnforumconfig.locale_parameter_name",
2107: localeParameterName);
2108:
2109: enablePasswordlessAuth = conf.getBoolean(
2110: "mvnforumconfig.enable_passwordless_auth", false);
2111: requireActivation = conf.getBoolean(
2112: "mvnforumconfig.require_activation", false);
2113: enableLoginInfoInCookie = conf.getBoolean(
2114: "mvnforumconfig.enable_login_info_in_cookie", true);
2115: enableLoginInfoInSession = conf
2116: .getBoolean(
2117: "mvnforumconfig.enable_login_info_in_session",
2118: true);
2119: enableLoginInfoInRealm = conf.getBoolean(
2120: "mvnforumconfig.enable_login_info_in_realm", false);
2121: enableLoginInfoInCustomization = conf
2122: .getBoolean(
2123: "mvnforumconfig.enable_login_info_in_customization",
2124: false);
2125:
2126: enableCheckInvalidSession = conf
2127: .getBoolean(
2128: "mvnforumconfig.enable_check_invalid_session",
2129: true);
2130:
2131: enableCacheMember = conf.getBoolean(
2132: "mvnforumconfig.enable_cache_member", true);
2133: enableCachePost = conf.getBoolean(
2134: "mvnforumconfig.enable_cache_post", true);
2135: enableCacheThread = conf.getBoolean(
2136: "mvnforumconfig.enable_cache_thread", true);
2137: enableCacheForum = conf.getBoolean(
2138: "mvnforumconfig.enable_cache_forum", true);
2139: enableCacheCategory = conf.getBoolean(
2140: "mvnforumconfig.enable_cache_category", true);
2141:
2142: enableLogin = conf.getBoolean(
2143: "mvnforumconfig.enable_login", true);
2144: enableRegisterRule = conf.getBoolean(
2145: "mvnforumconfig.enable_register_rule", true);
2146: enableNewMember = conf.getBoolean(
2147: "mvnforumconfig.enable_new_member", true);
2148: enableNewPost = conf.getBoolean(
2149: "mvnforumconfig.enable_new_post", true);
2150: enableSplitThread = conf.getBoolean(
2151: "mvnforumconfig.enable_split_thread", true);
2152: enableAvatar = conf.getBoolean(
2153: "mvnforumconfig.enable_avatar", true);
2154: enableEmotion = conf.getBoolean(
2155: "mvnforumconfig.enable_emoticon", true);
2156: enableRSS = conf.getBoolean("mvnforumconfig.enable_rss",
2157: true);
2158: enableSearch = conf.getBoolean(
2159: "mvnforumconfig.enable_search", true);
2160: enableWatch = conf.getBoolean(
2161: "mvnforumconfig.enable_watch", true);
2162: enableAttachment = conf.getBoolean(
2163: "mvnforumconfig.enable_attachment", true);
2164: enableMessageAttachment = conf.getBoolean(
2165: "mvnforumconfig.enable_message_attachment", true);
2166: enableCaptcha = conf.getBoolean(
2167: "mvnforumconfig.enable_captcha", false);
2168: enablePortalLikeIndexPage = conf.getBoolean(
2169: "mvnforumconfig.enable_portal_like_index_page",
2170: true);
2171: enableAdminCanChangePassword = conf.getBoolean(
2172: "mvnforumconfig.enable_admin_can_change_password",
2173: true);
2174: enableShowLastLoginOfCurrentMember = conf
2175: .getBoolean(
2176: "mvnforumconfig.enable_show_last_login_of_current_member",
2177: true);
2178: enableExpanseCategoryTree = conf
2179: .getBoolean(
2180: "mvnforumconfig.enable_expanse_category_tree_by_default",
2181: enableExpanseCategoryTree);
2182:
2183: enableShowEmail = conf.getBoolean(
2184: "mvnforumconfig.enable_show_email", true);
2185: enableShowBirthday = conf.getBoolean(
2186: "mvnforumconfig.enable_show_birthday", true);
2187: enableShowGender = conf.getBoolean(
2188: "mvnforumconfig.enable_show_gender", true);
2189: enableShowAddress = conf.getBoolean(
2190: "mvnforumconfig.enable_show_address", true);
2191: enableShowAOL = conf.getBoolean(
2192: "mvnforumconfig.enable_show_aol", true);
2193: enableShowCareer = conf.getBoolean(
2194: "mvnforumconfig.enable_show_career", true);
2195: enableShowCity = conf.getBoolean(
2196: "mvnforumconfig.enable_show_city", true);
2197: enableShowCoolLink_1 = conf.getBoolean(
2198: "mvnforumconfig.enable_show_cool_link_1", true);
2199: enableShowCoolLink_2 = conf.getBoolean(
2200: "mvnforumconfig.enable_show_cool_link_2", true);
2201: enableShowCountry = conf.getBoolean(
2202: "mvnforumconfig.enable_show_country", true);
2203: enableShowHomepage = conf.getBoolean(
2204: "mvnforumconfig.enable_show_homepage", true);
2205: enableShowICQ = conf.getBoolean(
2206: "mvnforumconfig.enable_show_icq", true);
2207: enableShowJoinDate = conf.getBoolean(
2208: "mvnforumconfig.enable_show_join_date", true);
2209: enableShowMobile = conf.getBoolean(
2210: "mvnforumconfig.enable_show_mobile", true);
2211: enableShowMSN = conf.getBoolean(
2212: "mvnforumconfig.enable_show_msn", true);
2213: enableShowPhone = conf.getBoolean(
2214: "mvnforumconfig.enable_show_phone", true);
2215: enableShowState = conf.getBoolean(
2216: "mvnforumconfig.enable_show_state", true);
2217: enableShowYahoo = conf.getBoolean(
2218: "mvnforumconfig.enable_show_yahoo", true);
2219: enableShowPostCount = conf.getBoolean(
2220: "mvnforumconfig.enable_show_post_count", true);
2221: enableShowOnlineStatus = conf.getBoolean(
2222: "mvnforumconfig.enable_show_online_status", true);
2223: enableShowFirstName = conf.getBoolean(
2224: "mvnforumconfig.enable_show_firstname", true);
2225: enableShowLastName = conf.getBoolean(
2226: "mvnforumconfig.enable_show_lastname", true);
2227: enableShowPostCount = conf.getBoolean(
2228: "mvnforumconfig.enable_show_post_count", true);
2229: enableShowViewCount = conf.getBoolean(
2230: "mvnforumconfig.enable_show_view_count", true);
2231: enableShowLastLogin = conf.getBoolean(
2232: "mvnforumconfig.enable_show_last_login", true);
2233:
2234: requireRegisterFirstname = conf.getBoolean(
2235: "mvnforumconfig.require_register_firstname", true);
2236: requireRegisterLastname = conf.getBoolean(
2237: "mvnforumconfig.require_register_lastname", true);
2238: requireRegisterGender = conf.getBoolean(
2239: "mvnforumconfig.require_register_gender", true);
2240: requireRegisterBirthday = conf.getBoolean(
2241: "mvnforumconfig.require_register_birthday", true);
2242: requireRegisterAddress = conf.getBoolean(
2243: "mvnforumconfig.require_register_address", true);
2244: requireRegisterCity = conf.getBoolean(
2245: "mvnforumconfig.require_register_city", true);
2246: requireRegisterState = conf.getBoolean(
2247: "mvnforumconfig.require_register_state", true);
2248: requireRegisterCountry = conf.getBoolean(
2249: "mvnforumconfig.require_register_country", true);
2250: requireRegisterPhone = conf.getBoolean(
2251: "mvnforumconfig.require_register_phone", true);
2252: requireRegisterMobile = conf.getBoolean(
2253: "mvnforumconfig.require_register_mobile", true);
2254: requireRegisterCareer = conf.getBoolean(
2255: "mvnforumconfig.require_register_career", true);
2256: requireRegisterHomepage = conf.getBoolean(
2257: "mvnforumconfig.require_register_homepage", true);
2258: requireRegisterYahoo = conf.getBoolean(
2259: "mvnforumconfig.require_register_yahoo", true);
2260: requireRegisterAol = conf.getBoolean(
2261: "mvnforumconfig.require_register_aol", true);
2262: requireRegisterIcq = conf.getBoolean(
2263: "mvnforumconfig.require_register_icq", true);
2264: requireRegisterMsn = conf.getBoolean(
2265: "mvnforumconfig.require_register_msn", true);
2266: requireRegisterLink_1 = conf.getBoolean(
2267: "mvnforumconfig.require_register_link_1", true);
2268: requireRegisterLink_2 = conf.getBoolean(
2269: "mvnforumconfig.require_register_link_2", true);
2270:
2271: enableAutoWatching = conf.getBoolean(
2272: "mvnforumconfig.enable_auto_watching", false);
2273: enableSendWatchMailOfMyOwnPost = conf
2274: .getBoolean(
2275: "mvnforumconfig.enable_send_watch_mail_of_my_own_post",
2276: false);
2277: enableEasyWatching = conf.getBoolean(
2278: "mvnforumconfig.enable_easy_watching", true);
2279: enableUsePopupMenuInViewThread = conf
2280: .getBoolean(
2281: "mvnforumconfig.enable_use_popup_menu_in_viewthread",
2282: true);
2283:
2284: enableOnlineUsers = conf.getBoolean(
2285: "mvnforumconfig.enable_online_users", true);
2286: enableListMembers = conf.getBoolean(
2287: "mvnforumconfig.enable_listmembers", true);
2288: enableDuplicateOnlineUsers = conf
2289: .getBoolean(
2290: "mvnforumconfig.enable_duplicate_onlineusers",
2291: true);
2292: enableInvisibleUsers = conf.getBoolean(
2293: "mvnforumconfig.enable_invisible_users", true);
2294: enablePrivateMessage = conf.getBoolean(
2295: "mvnforumconfig.enable_private_message", true);
2296: enablePublicMessage = conf.getBoolean(
2297: "mvnforumconfig.enable_public_message", false);
2298: enableGuestViewImageAttachment = conf
2299: .getBoolean(
2300: "mvnforumconfig.enable_guest_view_image_attachment",
2301: false);
2302: enableGuestViewListUsers = conf.getBoolean(
2303: "mvnforumconfig.enable_guest_view_listusers", true);
2304:
2305: enableMostActiveMembers = conf.getBoolean(
2306: "mvnforumconfig.enable_most_active_members", true);
2307: enableMostActiveThreads = conf.getBoolean(
2308: "mvnforumconfig.enable_most_active_threads", true);
2309: onlyNormalThreadTypeInActiveThreads = conf
2310: .getBoolean(
2311: "mvnforumconfig.only_normal_thread_type_in_active_threads",
2312: false);
2313:
2314: enableSiteStatisticsOverview = conf.getBoolean(
2315: "mvnforumconfig.enable_site_statistics_overview",
2316: false);
2317:
2318: enableListNewMembersInRecentDays = conf
2319: .getBoolean(
2320: "mvnforumconfig.enable_list_new_members_in_recent_days",
2321: false);
2322: enableListUsersBrowsingForum = conf.getBoolean(
2323: "mvnforumconfig.enable_list_users_browsing_forum",
2324: false);
2325: enableListUsersBrowsingThread = conf.getBoolean(
2326: "mvnforumconfig.enable_list_users_browsing_thread",
2327: false);
2328:
2329: daysToShowRecentMembers = conf.getInt(
2330: "mvnforumconfig.days_to_show_recent_members", 1);
2331: if (daysToShowRecentMembers < 1) {
2332: daysToShowRecentMembers = 1;
2333: }
2334:
2335: enableEmailThreateningContent = conf.getBoolean(
2336: "mvnforumconfig.enable_email_threatening_content",
2337: true);
2338: enableEmailToAdminContentWithCensoredWords = conf
2339: .getBoolean(
2340: "mvnforumconfig.enable_email_to_admin_content_with_censored_words",
2341: true);
2342: defaultCategoryID = conf
2343: .getInt("mvnforumconfig.default_category_id");
2344:
2345: enableThumbnail = conf.getBoolean(
2346: "mvnforumconfig.image_thumbnail.enable", false);
2347: thumbnailWidth = conf.getInt(
2348: "mvnforumconfig.image_thumbnail.width", 100);
2349: if (thumbnailWidth < 0)
2350: thumbnailWidth = 0;
2351: thumbnailHeight = conf.getInt(
2352: "mvnforumconfig.image_thumbnail.height", 100);
2353: if (thumbnailHeight < 0)
2354: thumbnailHeight = 0;
2355:
2356: enableListUnansweredThreads = conf
2357: .getBoolean(
2358: "mvnforumconfig.enable_listunansweredthreads",
2359: true);
2360:
2361: // @todo: before release mvnForum, comment the below code
2362: // ENABLE_ENCRYPTED_PASSWORD = conf.getBoolean("mvnforumconfig.enable_encrypted_password", true);
2363: enableEncryptPasswordOnBrowser = conf
2364: .getBoolean(
2365: "mvnforumconfig.enable_encrypt_password_on_browser",
2366: true);
2367: enableExternalUserDatabase = conf.getBoolean(
2368: "mvnforumconfig.enable_external_user_database",
2369: false);
2370: sendWatchMailAsHTML = conf.getBoolean(
2371: "mvnforumconfig.send_watchmail_as_html", false);
2372:
2373: boolean isPortlet = MvnCoreServiceFactory
2374: .getMvnCoreService().getEnvironmentService()
2375: .isPortlet();
2376:
2377: if (isPortlet) {
2378: enableExternalUserDatabase = true;
2379: }
2380:
2381: if (enableExternalUserDatabase) {
2382: enablePasswordlessAuth = false;
2383: enableNewMember = false;
2384: enableAdminCanChangePassword = false;
2385: enableListMembers = false;
2386:
2387: enableAdminCanChangePassword = false;
2388: enableListMembers = false;
2389: enableShowLastLogin = false;
2390: enableNewMember = false;
2391: requireActivation = false;
2392: enableCaptcha = false;
2393:
2394: // we check this feature later, should enable or not ?
2395: enableSiteStatisticsOverview = false;
2396: }
2397:
2398: if (isPortlet) {
2399: // disable any authentication & user involving features
2400: enablePasswordlessAuth = false;
2401: enableLoginInfoInCookie = false;
2402: enableLoginInfoInSession = false;
2403: enableLogin = false;
2404:
2405: // enable these feature to check for satisfying to create/update forum-account
2406: if (enableLoginInfoInCustomization == false) {
2407: enableLoginInfoInRealm = true;
2408: }
2409: enableLoginInfoInCustomization = true;
2410:
2411: // String memberImpl = Portal.getMemberImplementation(PORTAL_TYPE);
2412:
2413: // We don't care these features because we prefer to control
2414: // members accessing my forum than control all
2415: // of members even the members never click on forum link
2416:
2417: // ENABLE_ONLINE_USERS = false;
2418: // ENABLE_DUPLICATE_ONLINE_USERS = false;
2419: // ENABLE_INVISIBLE_USERS = false;
2420: }
2421:
2422: maxAttachmentSize = StringUtil.parseIntSizeValue(conf
2423: .getString("mvnforumconfig.max_attachment_size"),
2424: 1024);
2425: if (maxAttachmentSize < -1)
2426: maxAttachmentSize = 0; // -1 is a valid value in common-upload, mean no maximum file size
2427:
2428: maxMessageAttachmentSize = StringUtil
2429: .parseIntSizeValue(
2430: conf
2431: .getString("mvnforumconfig.max_message_attachment_size"),
2432: 1024);
2433: if (maxMessageAttachmentSize < -1)
2434: maxMessageAttachmentSize = 0; // -1 is a valid value in common-upload, mean no maximum file size
2435:
2436: maxFavoriteThreads = conf.getInt(
2437: "mvnforumconfig.max_favorite_thread", 128);
2438: if (maxFavoriteThreads < 0)
2439: maxFavoriteThreads = 0;
2440:
2441: maxPrivateMessages = conf.getInt(
2442: "mvnforumconfig.max_private_message", 128);
2443: if (maxPrivateMessages < 0)
2444: maxPrivateMessages = 0;
2445:
2446: maxEditDays = conf
2447: .getInt("mvnforumconfig.max_edit_days", 7);
2448: if (maxEditDays < 0)
2449: maxEditDays = 0;
2450:
2451: maxAttachDays = conf.getInt(
2452: "mvnforumconfig.max_attach_days", 1);
2453: if (maxAttachDays < 0)
2454: maxAttachDays = 0;
2455:
2456: maxDeleteDays = conf.getInt(
2457: "mvnforumconfig.max_delete_days", 1);
2458: if (maxDeleteDays < 0)
2459: maxDeleteDays = 0;
2460:
2461: rowsPerPage = conf.getInt("mvnforumconfig.rows_per_page",
2462: 10);
2463: if (rowsPerPage < 5)
2464: rowsPerPage = 5;
2465:
2466: rowsPerRSS = conf.getInt("mvnforumconfig.rows_per_rss", 15);
2467: if (rowsPerRSS < 5)
2468: rowsPerRSS = 5;
2469:
2470: maxHotTopics = conf.getInt(
2471: "mvnforumconfig.hot_topic_threshold", 10);
2472: if (maxHotTopics < 5)
2473: maxHotTopics = 5;
2474:
2475: maxHttpRequestsPerHourPerIP = conf.getInt(
2476: "mvnforumconfig.max_http_requests_per_hour_per_ip",
2477: maxHttpRequestsPerHourPerIP);
2478: if (maxHttpRequestsPerHourPerIP < 0)
2479: maxHttpRequestsPerHourPerIP = 0;
2480:
2481: maxPostsPerHourPerIP = conf.getInt(
2482: "mvnforumconfig.max_posts_per_hour_per_ip",
2483: maxPostsPerHourPerIP);
2484: if (maxPostsPerHourPerIP < 0)
2485: maxPostsPerHourPerIP = 0;
2486:
2487: maxPostsPerHourPerMember = conf.getInt(
2488: "mvnforumconfig.max_posts_per_hour_per_member",
2489: maxPostsPerHourPerMember);
2490: if (maxPostsPerHourPerMember < 0)
2491: maxPostsPerHourPerMember = 0;
2492:
2493: maxMembersPerHourPerIP = conf.getInt(
2494: "mvnforumconfig.max_members_per_hour_per_ip",
2495: maxMembersPerHourPerIP);
2496: if (maxMembersPerHourPerIP < 0)
2497: maxMembersPerHourPerIP = 0;
2498:
2499: maxLoginsPerHourPerIP = conf.getInt(
2500: "mvnforumconfig.max_logins_per_hour_per_ip",
2501: maxLoginsPerHourPerIP);
2502: if (maxLoginsPerHourPerIP < 0)
2503: maxLoginsPerHourPerIP = 0;
2504:
2505: maxMessagesPerHourPerIP = conf.getInt(
2506: "mvnforumconfig.max_messages_per_hour_per_ip",
2507: maxMessagesPerHourPerIP);
2508: if (maxMessagesPerHourPerIP < 0)
2509: maxMessagesPerHourPerIP = 0;
2510:
2511: maxPasswordDays = conf.getInt(
2512: "mvnforumconfig.max_password_days", 1);
2513: if (maxPasswordDays < 0)
2514: maxPasswordDays = 1;
2515:
2516: maxCharsInShortSummary = conf.getInt(
2517: "mvnforumconfig.max_chars_in_short_summary",
2518: maxCharsInShortSummary);
2519: if (maxCharsInShortSummary <= 0)
2520: maxCharsInShortSummary = Integer.MAX_VALUE;
2521:
2522: maxCharsInLongSummary = conf.getInt(
2523: "mvnforumconfig.max_chars_in_long_summary",
2524: maxCharsInLongSummary);
2525: if (maxCharsInLongSummary <= 0)
2526: maxCharsInLongSummary = Integer.MAX_VALUE;
2527:
2528: maxCharsInRSS = conf.getInt(
2529: "mvnforumconfig.max_chars_in_rss", maxCharsInRSS);
2530: if (maxCharsInRSS <= 0)
2531: maxCharsInRSS = Integer.MAX_VALUE;
2532:
2533: ENABLE_BACKUP_ON_SERVER = conf.getBoolean(
2534: "mvnforumconfig.enable_backup_on_server", true);
2535: maxImportSize = StringUtil.parseIntSizeValue(conf
2536: .getString("mvnforumconfig.max_import_size",
2537: "4096000"), 4096000);
2538:
2539: defaultWatchOption = conf.getInt(
2540: "mvnforumconfig.default_watch_option",
2541: WatchBean.WATCH_OPTION_DEFAULT);
2542: if (defaultWatchOption < WatchBean.WATCH_OPTION_DEFAULT
2543: || defaultWatchOption > WatchBean.WATCH_OPTION_WEEKLY)
2544: defaultWatchOption = WatchBean.WATCH_OPTION_DEFAULT;
2545:
2546: defaultModerationOption = conf.getInt(
2547: "mvnforumconfig.default_moderation_option",
2548: ForumBean.FORUM_MODERATION_MODE_SYSTEM_DEFAULT);
2549: if (defaultModerationOption < ForumBean.FORUM_MODERATION_MODE_SYSTEM_DEFAULT
2550: || defaultModerationOption > ForumBean.FORUM_MODERATION_MODE_POST_ONLY)
2551: defaultModerationOption = ForumBean.FORUM_MODERATION_MODE_SYSTEM_DEFAULT;
2552:
2553: defaultWatchType = conf.getInt(
2554: "mvnforumconfig.default_watch_type",
2555: WatchBean.WATCH_TYPE_DEFAULT);
2556: if (defaultWatchType < WatchBean.WATCH_TYPE_DIGEST
2557: || defaultWatchType > WatchBean.WATCH_TYPE_NONDIGEST)
2558: defaultWatchType = WatchBean.WATCH_TYPE_DIGEST;
2559:
2560: haveInternet = conf.getBoolean(
2561: "mvnforumconfig.have_internet", false);
2562:
2563: defaultStatusOfRegisteredMember = conf
2564: .getInt(
2565: "mvnforumconfig.default_status_of_registered_member",
2566: defaultStatusOfRegisteredMember);
2567: if (defaultStatusOfRegisteredMember < MemberBean.MEMBER_STATUS_ENABLE
2568: || defaultStatusOfRegisteredMember > MemberBean.MEMBER_STATUS_PENDING) {
2569: defaultStatusOfRegisteredMember = MemberBean.MEMBER_STATUS_ENABLE;
2570: }
2571:
2572: FloodControl.setOption(
2573: MVNForumGlobal.FLOOD_ID_NEW_MEMBER_PER_IP,
2574: maxMembersPerHourPerIP);
2575: FloodControl.setOption(
2576: MVNForumGlobal.FLOOD_ID_NEW_POST_PER_IP,
2577: maxPostsPerHourPerIP);
2578: FloodControl.setOption(
2579: MVNForumGlobal.FLOOD_ID_NEW_POST_PER_MEMBER,
2580: maxPostsPerHourPerMember);
2581: FloodControl.setOption(
2582: MVNForumGlobal.FLOOD_ID_LOGIN_PER_IP,
2583: maxLoginsPerHourPerIP);
2584: FloodControl.setOption(
2585: MVNForumGlobal.FLOOD_ID_NEW_MESSAGE_PER_IP,
2586: maxMessagesPerHourPerIP);
2587: FloodControl.setOption(
2588: MVNForumGlobal.FLOOD_ID_HTTP_REQUEST_PER_IP,
2589: maxHttpRequestsPerHourPerIP);
2590:
2591: enableRWC = MvnCoreServiceFactory.getMvnCoreService()
2592: .getEnvironmentService().customizeFor().equals(
2593: "RWC");
2594:
2595: } catch (Exception e) {
2596: // Please note that for security reason, the full path file name is logged
2597: // to the log file only. And the reason that show on the web should only
2598: // show the filename only
2599: String message = "com.mvnforum.MVNForumConfig: Can't read the configuration file: '"
2600: + configFilename
2601: + "'. Make sure the file is in your CLASSPATH";
2602: log.error(message, e);
2603: MvnCoreServiceFactory
2604: .getMvnCoreService()
2605: .getEnvironmentService()
2606: .setShouldRun(
2607: false,
2608: "com.mvnforum.MVNForumConfig: Can't read the configuration file: '"
2609: + OPTION_FILE_NAME
2610: + "'. Make sure the file is in your CLASSPATH");
2611: }
2612: }
2613:
2614: public static boolean supportLocale(String localeName) {
2615:
2616: if ((localeName == null) || (localeName.length() == 0)) {
2617: return false;
2618: }
2619:
2620: String[] supportedLocaleNames = MVNForumConfig
2621: .getSupportedLocaleNames();
2622: if (supportedLocaleNames == null) {
2623: log
2624: .fatal("Assertion in MVNForumConfig: supportedLocales is null. Please check your configuration.");
2625: return false;
2626: }
2627:
2628: for (int i = 0; i < supportedLocaleNames.length; i++) {
2629: if (localeName.equals(supportedLocaleNames[i])) {
2630: return true;
2631: }
2632: }
2633: return false;
2634: }
2635:
2636: }
|