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

📄 newpost.java

📁 BBS-CS(天乙社区) v5.2.2源码版
💻 JAVA
字号:
package com.laoer.bbscs.bbs.business;

import java.sql.*;
import java.io.*;
import java.util.*;
import com.laoer.bbscs.db.*;
import com.laoer.bbscs.sysinfo.*;
import com.laoer.bbscs.util.*;
import org.apache.log4j.*;

/**
 * <p>Title: 天乙社区V5.0</p>
 * <p>Description: BBS-CS天乙社区V5.0</p>
 * <p>Copyright: Copyright (c) 2003</p>
 * <p>Company: laoer.com</p>
 * @author 龚天乙
 * @version 5.0
 */

public class NewPost {

  static Logger logger = Logger.getLogger(NewPost.class.getName());
  private static Vector inPostNew = new Vector();

  public NewPost() {
  }

  public static synchronized void intoNewPost(ForumInfo aForum) {
    int len = inPostNew.size();
    if (len > 9) {
      inPostNew.removeElementAt(len - 1);
    }
    inPostNew.add(0, aForum);
  }

  public static synchronized void delNewPost(long fid) {
    int len = inPostNew.size();
    ForumInfo aForum = null;
    for (int i = 0; i < len; i++) {
      aForum = (ForumInfo) inPostNew.get(i);
      if (aForum.getID() == fid) {
        inPostNew.removeElementAt(i);
        return;
      }
    }
  }

  public synchronized void createFile() {
    int len = inPostNew.size();
    StringBuffer sb = new StringBuffer();
    ForumInfo aForum = null;
    int n = 2;
    if (len > 0) {
      for (int i = 0; i < len; i++) {
        aForum = (ForumInfo) inPostNew.get(i);
        sb.append("<tr><td>");
        sb.append("<a href='" + Sys.getURL() + "readAction.do?sid=###&bid=" +
                  aForum.getBoardID() + "&recid=" + aForum.getID2() +
                  "&pages=1'>" + Util.stripslashes(aForum.getTitle()) + "</a>");
        sb.append("<font color=#FF0000> [" + aForum.getBoardName() + "]</font>");
        sb.append("</td></tr>");
      }
    }
    else {
      sb.append("<!--No New Post-->");
    }
    try {
      String filepath = Util.getPubFilePath();
      File file = new File(filepath + "newpost.htm");
      if (file.exists()) {
        file.delete();
      }
      FileOutputStream wf = new FileOutputStream(filepath + "newpost.htm");
      //wf.write(sb.toString().getBytes());
      wf.write(sb.toString().getBytes("UTF8"));
      wf.close();
    }
    catch (IOException e) {
      logger.error(e);
    }
  }

}

⌨️ 快捷键说明

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