newpost.java

来自「反ajax原代码」· Java 代码 · 共 60 行

JAVA
60
字号
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   NewPost.java

package com.laoer.bbscs.sys;

import com.laoer.bbscs.bean.Forum;
import com.laoer.comm.util.FileIO;
import com.laoer.comm.util.Util;

// Referenced classes of package com.laoer.bbscs.sys:
//            SysUtil, Constant, SysInfo

public class NewPost
{

    public NewPost()
    {
    }

    public static synchronized void intoNewPost(Forum f)
    {
        String strDetail;
        for(strDetail = FileIO.readFile(SysUtil.getIncludeFilePath() + Constant.NEWPOSTJS, Constant.CHARSET); SysUtil.stringAppearTimes(strDetail, "//NEWPOST") > SysInfo.getInstance().getJsnum() - 1; strDetail = strDetail.substring(0, strDetail.lastIndexOf("//NEWPOST")));
        StringBuffer sb = new StringBuffer();
        sb.append("//NEWPOST");
        sb.append(f.getId().longValue());
        sb.append("\n");
        sb.append("document.write(\"<a href='main");
        sb.append(Constant.FILEPREFIX);
        sb.append("?tourl=");
        sb.append(SysUtil.encodeURL("read" + Constant.FILEPREFIX + "?bid=" + f.getBoardID() + "&id=" + f.getId().longValue(), Constant.CHARSET));
        sb.append("' target='_top'>");
        sb.append(Util.escapeForSpecial(f.getTitle()));
        sb.append("</a> ");
        sb.append("[");
        sb.append(f.getBoardName());
        sb.append("]<br>");
        sb.append("\")\n");
        sb.append("//ENDNEWPOST");
        sb.append(f.getId().longValue());
        sb.append("\n");
        sb.append(strDetail);
        FileIO.writeFile(sb.toString(), SysUtil.getIncludeFilePath() + Constant.NEWPOSTJS, Constant.CHARSET);
    }

    public static synchronized void delNewPost(long fid)
    {
        String strDetail = FileIO.readFile(SysUtil.getIncludeFilePath() + Constant.NEWPOSTJS, Constant.CHARSET);
        int index = strDetail.indexOf("//NEWPOST" + fid + "\n");
        String end = "//ENDNEWPOST" + fid + "\n";
        if(index != -1)
        {
            strDetail = strDetail.substring(0, index) + strDetail.substring(strDetail.indexOf(end) + end.length(), strDetail.length());
            FileIO.writeFile(strDetail, SysUtil.getIncludeFilePath() + Constant.NEWPOSTJS, Constant.CHARSET);
        }
    }
}

⌨️ 快捷键说明

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