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

📄 rssthreads.jsp

📁 jive3论坛开源 最新 有版主功能 jive3论坛开源 最新 有版主功能 jive3论坛开源 最新 有版主功能
💻 JSP
字号:
<% response.setContentType("text/xml"); %><?xml version="1.0" encoding="<%= JiveGlobals.getCharacterEncoding() %>"?><%@ page import="java.util.*,                 com.jivesoftware.base.*,                 com.jivesoftware.forum.*,                 com.jivesoftware.util.ParamUtils"%><%!    /**     * RSS feed for a list of threads in a forum (in modification date order). For each thread,     * the following information is available:     *       name (subject)     *       author     *       creation date     *       modification date     *       message count     *       message body (if "full=true" is passed in)     *     * The forumID must always be passed-in. Optionally, the number of threads can be specified     * (default is 10). For example:     *     *      rssthreads.jsp?forumID=1     *      rssthreads.jsp?forumID=5&threadCount=25     *     * Also optionally a username and password can be passed in - these credentials will be used     * when the authToken is created.     */%><%  // Set the content type    response.setContentType("text/xml");    String title = JiveGlobals.getJiveProperty("skin.default.communityName");    if (title == null || title.equals("")) {        title = "Jive Forums";    }    String link = JiveGlobals.getJiveProperty("mail.jiveURL");    // Determine if rss feeds are enabled:    boolean rssFeedsEnabled = "true".equals(JiveGlobals.getJiveProperty("rssFeeds.enabled"));%><%  if (!rssFeedsEnabled) { %><rss version="2.0" xmlns:jf="http://www.jivesoftware.com/xmlns/jiveforums/rss">    <!-- RSS feeds disabled --></rss><%  } else { %><rss version="2.0" xmlns:jf="http://www.jivesoftware.com/xmlns/jiveforums/rss">  <channel>    <title><%= title %></title>    <link><%= link %></link>    <description>List of forum topics</description>    <language><%= JiveGlobals.getLocale().getLanguage() %></language><%    String username = ParamUtils.getParameter(request,"username");    String password = ParamUtils.getParameter(request,"password");    boolean full = ParamUtils.getBooleanParameter(request,"full");    AuthToken authToken = null;    if (username != null && password != null) {        try {            authToken = AuthFactory.getAuthToken(username,password);        }        catch (UnauthorizedException ignored) {}    }    if (authToken == null) {        authToken = AuthFactory.getAnonymousAuthToken();    }    ForumFactory forumFactory = ForumFactory.getInstance(authToken);    Forum forum = null;    int count = 10;    try {        String forumID = request.getParameter("forumID");        forum = forumFactory.getForum(Long.parseLong(forumID));        count = Integer.parseInt(request.getParameter("threadCount"));    }    catch (Exception e) { }    if (forum != null) {        ResultFilter filter = ResultFilter.createDefaultThreadFilter();        filter.setNumResults(count);        Iterator threads = forum.getThreads(filter);        while (threads.hasNext()) {            ForumThread thread = (ForumThread)threads.next();%>    <item>        <title><%= thread.getName() %></title>        <%            String threadLink = link;            if (!threadLink.endsWith("/")) {                threadLink += "/";            }            threadLink += "thread.jspa?threadID=" + thread.getID();            String author = "";            ForumMessage rootMsg = thread.getRootMessage();            if (rootMsg.isAnonymous()) {                String name = rootMsg.getProperty("name");                if (name != null) {                    author = name;                }            }            else {                author = rootMsg.getUser().getUsername();            }        %>        <link><%= threadLink %></link>        <jf:creationDate><%= JiveGlobals.formatDateTime(thread.getCreationDate()) %></jf:creationDate>        <jf:modificationDate><%= JiveGlobals.formatDateTime(thread.getModificationDate()) %></jf:modificationDate>        <jf:messageCount><%= thread.getMessageCount() %></jf:messageCount>        <jf:author><%= author %></jf:author>        <jf:replyCount><%= (thread.getMessageCount()-1) %></jf:replyCount>        <%  if (full) { %>            <jf:body><![CDATA[<%= rootMsg.getBody() %>]]></jf:body>        <%  } %>    </item>  <%    }    }  %>  </channel></rss><%  } %>

⌨️ 快捷键说明

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