forumpage.java

来自「cwbbs 云网论坛源码」· Java 代码 · 共 130 行

JAVA
130
字号
package com.redmoon.forum.ui;import javax.servlet.http.HttpServletRequest;import com.redmoon.forum.Config;import com.redmoon.forum.ThreadTypeDb;import cn.js.fan.util.ParamUtil;import cn.js.fan.util.StrUtil;import com.redmoon.forum.MsgMgr;import com.redmoon.forum.MsgDb;import com.redmoon.forum.plugin.PluginMgr;public class ForumPage {    public static boolean isHtmlPage = false;    public static boolean isListTree = false;    public static String COOKIE_IS_FRAME = "isFrame";    static {        init();    }    public ForumPage() {    }    public static void init() {        Config cfg = Config.getInstance();        isHtmlPage = cfg.getBooleanProperty("forum.isHtmlPage");        isListTree = cfg.getBooleanProperty("forum.isListTopicTree");     }    public static String getListTopicPage(HttpServletRequest request, String boardCode) {        int mode = isListTree?1:0;        return getListTopicPage(request, boardCode, mode);    }        public static String getListTopicPage(HttpServletRequest request, String boardCode, int mode) {        return getListTopicPage(request, boardCode, mode, 1, ThreadTypeDb.THREAD_TYPE_NONE);    }        public static String getListTopicPage(HttpServletRequest request, String boardCode, int mode, int CPages, int threadType) {        String page = "";        if (isHtmlPage) {            page = "f-" + mode + "-" + boardCode + "-" + CPages + "-" + threadType + ".html";        }        else {            if (mode==0) {                page = "listtopic.jsp?boardcode=" + boardCode + "&CPages=" + CPages + "&threadType=" + threadType;            }            else if (mode==1) {                page = "listtopic_tree.jsp?boardcode=" + boardCode + "&CPages=" +                       CPages + "&threadType=" + threadType;            }        }        return page;    }    public static String getShowTopicPage(HttpServletRequest request, long rootid) {        return getShowTopicPage(request, rootid, 1);    }    public static String getShowTopicPage(HttpServletRequest request, long rootid, int CPages) {        return getShowTopicPage(request, 0, rootid, rootid, CPages, "");    }    public static String getShowTopicPage(HttpServletRequest request, long rootid, int CPages, String anchor) {        return getShowTopicPage(request, 0, rootid, rootid, CPages, anchor);    }        public static String getShowTopicPage(HttpServletRequest request, int mode, long rootid, long showid, int CPages, String anchor) {        String page = "";                MsgMgr mm = new MsgMgr();        MsgDb md = mm.getMsgDb(rootid);        String pluginCode = md.getPluginCode();        if (pluginCode!=null && !pluginCode.equals("")) {            PluginMgr pm = new PluginMgr();            page = pm.getPluginUnit(md.getPluginCode()).getShowTopicPage();            if (!page.equals("")) {                page = page + "?rootid=" + rootid + "&CPages=" + CPages;                return page;            }        }        String showUserName = "";        if (request!=null)            showUserName = ParamUtil.get(request, "showUserName");        if (mode==0) {                        if (!showUserName.equals("")) {                page = "showtopic.jsp?rootid=" + rootid + "&CPages=" + CPages + "&showUserName=" + StrUtil.UrlEncode(showUserName);                return page;            }        }        if (isHtmlPage) {                                    if (mode == 1) {                page = "t-" + mode + "-" + rootid + "-" + showid + ".html";            } else {                if (anchor.equals("")) {                    page = "t-" + mode + "-" + rootid + "-" + CPages +                           ".html";                } else {                    page = "t-" + mode + "-" + rootid + "-" + CPages + ".html#" + anchor;                }            }        } else {            if (mode == 0) {                if (anchor.equals("")) {                    page = "showtopic.jsp?rootid=" + rootid + "&CPages=" +                           CPages;                } else {                    page = "showtopic.jsp?rootid=" + rootid + "&CPages=" +                           CPages + "#" + anchor;                }            } else {                page = "showtopic_tree.jsp?rootid=" + rootid + "&showid=" +                       showid;            }        }        return page;    }}

⌨️ 快捷键说明

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