sysconfig.java

来自「一个jsp写的bbs」· Java 代码 · 共 1,190 行 · 第 1/3 页

JAVA
1,190
字号

  public int getPmMaxLength() {
    return this.getIntValue("PmMaxLength", 1500);
  }

  public void setPmMaxLength(int pmMaxLength) {
    this.setConfigContext("PmMaxLength", String.valueOf(pmMaxLength));
  }

  public int getPmFloodTime() {
    return this.getIntValue("PmFloodTime", 30);
  }

  public void setPmFloodTime(int pmFloodTime) {
    this.setConfigContext("PmFloodTime", String.valueOf(pmFloodTime));
  }

  public boolean isInPmFloodTime(long atime) {
    if ( (System.currentTimeMillis() - atime) < (getPmFloodTime() * 1000)) {
      return true;
    }
    else {
      return false;
    }
  }

  public int getPmPerPage() {
    return this.getIntValue("PmPerPage", 5);
  }

  public void setPmPerPage(int pmPerPage) {
    this.setConfigContext("PmPerPage", String.valueOf(pmPerPage));
  }

  public int getPmAllowUBB() {
    return this.getIntValue("PmAllowUBB", 0);
  }

  public boolean isPmAllowUBB() {
    return (this.getPmAllowUBB() == 1);
  }

  public void setPmAllowUBB(int pmAllowUBB) {
    this.setConfigContext("PmAllowUBB", String.valueOf(pmAllowUBB));
  }

  public int getPmAllowSmilies() {
    return this.getIntValue("PmAllowSmilies", 1);
  }

  public boolean isPmAllowSmilies() {
    return (this.getPmAllowSmilies() == 1);
  }

  public void setPmAllowSmilies(int pmAllowSmilies) {
    this.setConfigContext("PmAllowSmilies", String.valueOf(pmAllowSmilies));
  }

  public int getPmAllowHTML() {
    return this.getIntValue("PmAllowHTML", 0);
  }

  public boolean isPmAllowHTML() {
    return (this.getPmAllowHTML() == 1);
  }

  public void setPmAllowHTML(int pmAllowHTML) {
    this.setConfigContext("PmAllowHTML", String.valueOf(pmAllowHTML));
  }

  public int getPmAllowFace() {
    return this.getIntValue("PmAllowFace", 1);
  }

  public boolean isPmAllowFace() {
    return (this.getPmAllowFace() == 1);
  }

  public void setPmAllowFace(int pmAllowFace) {
    this.setConfigContext("PmAllowFace", String.valueOf(pmAllowFace));
  }

  public int getForumPrePage() {
    return this.getIntValue("ForumPrePage", 20);
  }

  public void setForumPrePage(int forumPrePage) {
    this.setConfigContext("ForumPrePage", String.valueOf(forumPrePage));
  }

  public int getForumHotViews() {
    return this.getIntValue("ForumHotViews", 150);
  }

  public void setForumHotViews(int forumHotViews) {
    this.setConfigContext("ForumHotViews", String.valueOf(forumHotViews));
  }

  public int getForumHotRes() {
    return this.getIntValue("ForumHotRes", 15);
  }

  public void setForumHotRes(int forumHotRes) {
    this.setConfigContext("ForumHotRes", String.valueOf(forumHotRes));
  }

  public int getUseLinkToPages() {
    return this.getIntValue("UseLinkToPages", 1);
  }

  public boolean isUseLinkToPages() {
    return (this.getUseLinkToPages() == 1);
  }

  public void setUseLinkToPages(int useLinkToPages) {
    this.setConfigContext("UseLinkToPages", String.valueOf(useLinkToPages));
  }

  public int getMaxMultiPage() {
    return this.getIntValue("MaxMultiPage", 3);
  }

  public void setMaxMultiPage(int maxMultiPage) {
    this.setConfigContext("MaxMultiPage", String.valueOf(maxMultiPage));
  }

  public int getPostViewLength() {
    return this.getIntValue("PostViewLength", 300);
  }

  public void setPostViewLength(int postViewLength) {
    this.setConfigContext("PostViewLength", String.valueOf(postViewLength));
  }

  public int getPostPerPage() {
    return this.getIntValue("PostPerPage", 10);
  }

  public void setPostPerPage(int postPerPage) {
    this.setConfigContext("PostPerPage", String.valueOf(postPerPage));
  }

  public String getUserPerPage() {
    return this.getStringValue("UserPerPage");
  }

  public void setUserPerPage(String userPerPage) {
    this.setConfigContext("UserPerPage", userPerPage);
  }

  public String getPostDefFaceImg() {
    return this.getStringValue("PostDefFaceImg");
  }

  public void setPostDefFaceImg(String postDefFaceImg) {
    this.setConfigContext("PostDefFaceImg", postDefFaceImg);
  }

  public int getPostVoteRec() {
    return this.getIntValue("PostVoteRec", 1);
  }

  public boolean isPostVoteRec() {
    return (this.getPostVoteRec() == 1);
  }

  public void setPostVoteRec(int postVoteRec) {
    this.setConfigContext("PostVoteRec", String.valueOf(postVoteRec));
  }

  public int getPostShowUserImg() {
    return this.getIntValue("PostShowUserImg", 1);
  }

  public boolean isPostShowUserImg() {
    return (this.getPostShowUserImg() == 1);
  }

  public void setPostShowUserImg(int postShowUserImg) {
    this.setConfigContext("PostShowUserImg", String.valueOf(postShowUserImg));
  }

  public int getPostHiddenTypeMoney() {
    return this.getIntValue("PostHiddenTypeMoney", 0);
  }

  public void setPostHiddenTypeMoney(int postHiddenTypeMoney) {
    this.setConfigContext("PostHiddenTypeMoney", String.valueOf(postHiddenTypeMoney));
  }

  public int getPostHiddenTypeRe() {
    return this.getIntValue("PostHiddenTypeRe", 0);
  }

  public void setPostHiddenTypeRe(int postHiddenTypeRe) {
    this.setConfigContext("PostHiddenTypeRe", String.valueOf(postHiddenTypeRe));
  }

  public int getPostHiddenTypeArtNum() {
    return this.getIntValue("PostHiddenTypeArtNum", 0);
  }

  public void setPostHiddenTypeArtNum(int postHiddenTypeArtNum) {
    this.setConfigContext("PostHiddenTypeArtNum", String.valueOf(postHiddenTypeArtNum));
  }

  public String getPostPriceList() {
    return this.getStringValue("PostPriceList");
  }

  public void setPostPriceList(String postPriceList) {
    this.setConfigContext("PostPriceList", postPriceList);
  }

  public String[] getPostPriceLists() {
    String[] prices = this.getPostPriceList().split(",");
    if (prices == null) {
      prices = new String[1];
      prices[0] = "0";
    }
    return prices;
  }

  public float getPostPriceTax() {
    return this.getFloatValue("PostPriceTax", (float) 0.5);
  }

  public void setPostPriceTax(float postPriceTax) {
    this.setConfigContext("PostPriceTax", String.valueOf(postPriceTax));
  }

  public int getUserOnlineTime() {
    return this.getIntValue("UserOnlineTime", 300);
  }

  public void setUserOnlineTime(int userOnlineTime) {
    this.setConfigContext("UserOnlineTime", String.valueOf(userOnlineTime));
  }

  public int getUsePostPeriodOfTime() {
    return this.getIntValue("UsePostPeriodOfTime", 0);
  }

  public void setUsePostPeriodOfTime(int usePostPeriodOfTime) {
    this.setConfigContext("UsePostPeriodOfTime", String.valueOf(usePostPeriodOfTime));
  }

  public boolean isUsePostPeriodOfTime() {
    return this.getUsePostPeriodOfTime() == 1;
  }

  public int getPostPeriodOfTimeDay() {
    return this.getIntValue("PostPeriodOfTimeDay", 1);
  }

  public void setPostPeriodOfTimeDay(int postPeriodOfTimeDay) {
    this.setConfigContext("PostPeriodOfTimeDay", String.valueOf(postPeriodOfTimeDay));
  }

  public int getPostPeriodOfTimeStart() {
    return this.getIntValue("PostPeriodOfTimeStart", 9);
  }

  public void setPostPeriodOfTimeStart(int postPeriodOfTimeStart) {
    this.setConfigContext("PostPeriodOfTimeStart", String.valueOf(postPeriodOfTimeStart));
  }

  public int getPostPeriodOfTimeEnd() {
    return this.getIntValue("PostPeriodOfTimeEnd", 20);
  }

  public void setPostPeriodOfTimeEnd(int postPeriodOfTimeEnd) {
    this.setConfigContext("PostPeriodOfTimeEnd", String.valueOf(postPeriodOfTimeEnd));
  }

  public boolean isInPostPeriodOfTime(long nowtime) {
    long starttime = 0;
    long endtime = 0;
    Calendar cld = Calendar.getInstance();
    int year = cld.get(Calendar.YEAR);
    int month = cld.get(Calendar.MONTH);
    int day = cld.get(Calendar.DAY_OF_MONTH);
    Calendar todaycld = Calendar.getInstance();
    todaycld.set(year, month, day, this.getPostPeriodOfTimeStart(), 0, 0);
    starttime = todaycld.getTime().getTime();
    Calendar cldend = Calendar.getInstance();
    cldend.set(year, month, day, this.getPostPeriodOfTimeEnd(), 0, 0);
    endtime = cldend.getTime().getTime();

    if (nowtime >= starttime && nowtime <= endtime) {
      return true;
    }
    else {
      return false;
    }
  }

  public String bestrowScreen(String txt) {
    if (StringUtils.isNotBlank(this.getScreenWord())) {
      String[] words = this.getScreenWord().split(";");
      for (int i = 0; i < words.length; i++) {
        txt = txt.replaceAll(words[i], this.getBestrowScreen());
      }
    }
    return txt;
  }

  public boolean containScreenWord(String txt) {
    if (StringUtils.isNotBlank(this.getScreenWord())) {
      String[] words = this.getScreenWord().split(";");
      for (int i = 0; i < words.length; i++) {
        Pattern p = Pattern.compile(words[i]);
        Matcher m = p.matcher(txt);
        if (m.find()) {
          return true;
        }
      }
    }
    return false;
  }

  public boolean isCanNotRegUserName(String userName) {
    if (StringUtils.isNotBlank(this.getCanNotRegUserName())) {
      String[] names = this.getCanNotRegUserName().split(",");
      for (int i = 0; i < names.length; i++) {
        if (userName.indexOf(names[i]) != -1) {
          return true;
        }
      }
    }
    return false;
  }

  public String bestrowScreenNickName(String txt) {
    if (StringUtils.isNotBlank(this.getCanNotUseNickName())) {
      String[] words = this.getCanNotUseNickName().split(";");
      for (int i = 0; i < words.length; i++) {
        txt = txt.replaceAll(words[i], this.getBestrowScreen());
      }
    }
    return txt;
  }

  public boolean isForbidIP(String ip) {
    if (StringUtils.isNotBlank(this.getForbidIP())) {
      String[] fips = this.getForbidIP().split(",");
      for (int i = 0; i < fips.length; i++) {
        if (ip.equals(fips[i]) || ip.startsWith(fips[i])) {
          return true;
        }
      }
    }
    return false;
  }

  public boolean isForbidEmail(String email) {
    if (StringUtils.isNotBlank(this.getForbidEmail())) {
      String[] femails = this.getForbidEmail().split(",");
      for (int i = 0; i < femails.length; i++) {
        if (email.equals(femails[i]) || email.endsWith(femails[i])) {
          return true;
        }
      }
    }
    return false;
  }

  public String[] getUserPostPerPageNum() {
    String ppn = this.getUserPerPage();
    if (StringUtils.isBlank(ppn)) {
      String[] ppns = {String.valueOf(this.getPostPerPage())};
      return ppns;
    }
    else {
      return ppn.split(",");
    }
  }

  public ConfigService getConfigService() {
    return configService;
  }

  public boolean isIsLoad() {
    return isLoad;
  }

  public void setConfigService(ConfigService configService) {
    this.configService = configService;
  }

  public void setIsLoad(boolean isLoad) {
    this.isLoad = isLoad;
  }

}

⌨️ 快捷键说明

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