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

📄 msgdb.java

📁 cwbbs 云网论坛源码
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
package com.redmoon.forum;import java.io.*;import java.sql.*;import java.util.*;import java.util.regex.*;import javax.servlet.*;import javax.servlet.http.*;import cn.js.fan.cache.jcs.*;import cn.js.fan.db.*;import cn.js.fan.mail.*;import cn.js.fan.security.*;import cn.js.fan.util.*;import cn.js.fan.web.*;import com.cloudwebsoft.framework.db.*;import com.cloudwebsoft.framework.util.*;import com.redmoon.blog.*;import com.redmoon.forum.message.*;import com.redmoon.forum.person.*;import com.redmoon.forum.plugin.*;import com.redmoon.forum.plugin.base.*;import com.redmoon.forum.security.*;import com.redmoon.forum.sms.*;import com.redmoon.forum.util.*;import com.redmoon.kit.util.*;import org.apache.log4j.*;public class MsgDb implements java.io.Serializable {    public static int LEVEL_TOP_BOARD = 100;    public static int LEVEL_TOP_FORUM = 200;    public static int LEVEL_NONE = 0;    public static int WEBEDIT_UBB = 0;    public static int WEBEDIT_REDMOON = 1;    public static int WEBEDIT_NORMAL = 2;    public static int MIN_CONTENT_LEN = 10;    public static int MAX_CONTENT_LEN = 3000;    public static int MAX_CONTENT_LEN_WE = 20000;    public static int MAX_TOPIC_LEN = 100;    public static int MIN_TOPIC_LEN = 1;    public static final int TYPE_MSG = 0;    public static final int TYPE_VOTE = 1;    public static final int EXPRESSION_NONE = 0;    public static final int CHECK_STATUS_NOT = 0;     public static final int CHECK_STATUS_PASS = 1;     public static final int CHECK_STATUS_DUSTBIN = 10;     public static int LAST_OPERATE_NONE = -1;     public transient Vector tempTagNameVector = null;     static {        initParam();    }    String connname = Global.defaultDB;                    int ret = 1;    String boardcode, name, pwd,                       title = "", content = "", ip;    int show_smile = 1, show_ubbcode = 1, email_notify = 0;    long rootid = -1;    long id;    int layer;    java.util.Date addDate;    int orders;    int expression = EXPRESSION_NONE;    long replyid = -1;    int isWebedit = WEBEDIT_NORMAL;    private String plugin2Code;    public MsgDb() {        init();    }    public MsgDb(long id) {        init();        loadFromDb(id);    }    public static void initParam() {        Config cfg = Config.getInstance();        MIN_TOPIC_LEN = cfg.getIntProperty("forum.msgTitleLengthMin");        MAX_TOPIC_LEN = cfg.getIntProperty("forum.msgTitleLengthMax");        MIN_CONTENT_LEN = cfg.getIntProperty("forum.msgLengthMin");        MAX_CONTENT_LEN = cfg.getIntProperty("forum.msgLengthMax");        MAX_CONTENT_LEN_WE = MAX_CONTENT_LEN;    }    public void init() {    }    protected void finalize() throws Throwable {        super.finalize();    }    private int recount;    public String getboardcode() {        return boardcode;    }        public String getCurBoardCode() {        return boardcode;    }        public int[] getBlogMsgDayCount(long blogId, int year, int month) {                        int dayCount = DateUtil.getDayCount(year, month - 1);                int[] ary = new int[dayCount + 1];        for (int i = 1; i <= dayCount; i++) {            ary[i] = 0;        }        Calendar calStart = Calendar.getInstance();        calStart.set(year, month - 1, 1);        String start = "" + calStart.getTimeInMillis();        Calendar calEnd = Calendar.getInstance();        calEnd.set(year, month - 1, dayCount, 24, 60);        String end = "" + calEnd.getTimeInMillis();        String sql = "select lydate from sq_thread where blog_id=? and isBlog=1 and check_status=" + CHECK_STATUS_PASS + " and lydate>? and lydate<? order by lydate asc";        Conn conn = new Conn(connname);        PreparedStatement pstmt = null;        ResultSet rs = null;        try {            pstmt = conn.prepareStatement(sql);            pstmt.setLong(1, blogId);            pstmt.setString(2, start);            pstmt.setString(3, end);            rs = conn.executePreQuery();            Calendar cal = Calendar.getInstance();            while (rs.next()) {                java.util.Date d = DateUtil.parse(rs.getString(1));                cal.setTime(d);                ary[cal.get(cal.DAY_OF_MONTH)]++;            }        } catch (SQLException e) {            Logger.getLogger(MsgDb.class.getName()).error("getBlogMsgDayCount:" +                    e.getMessage());        } finally {            if (rs != null) {                try {                    rs.close();                } catch (Exception e) {}                rs = null;            }            if (pstmt != null) {                try {                    pstmt.close();                } catch (Exception e) {}                pstmt = null;            }            if (conn != null) {                conn.close();                conn = null;            }        }        return ary;    }        public Vector getBlogDayList(long blogId, int y, int m, int d) {        String sql = "select id from sq_thread where blog_id=? and isBlog=1 and check_status=" + CHECK_STATUS_PASS + " and lydate>? and lydate<? order by lydate asc";        Calendar calStart = Calendar.getInstance();        calStart.set(y, m - 1, d, 0, 0, 0);        String start = "" + calStart.getTimeInMillis();        Calendar calEnd = Calendar.getInstance();        calEnd.set(y, m - 1, d, 23, 59, 59);        String end = "" + calEnd.getTimeInMillis();        PreparedStatement pstmt = null;        ResultSet rs = null;        Vector v = new Vector();        Conn conn = new Conn(connname);        try {            pstmt = conn.prepareStatement(sql);            pstmt.setLong(1, blogId);            pstmt.setString(2, start);            pstmt.setString(3, end);                        rs = conn.executePreQuery();            Calendar cal = Calendar.getInstance();            while (rs.next()) {                MsgDb md = getMsgDb(rs.getLong(1));                v.addElement(md);            }        } catch (SQLException e) {            Logger.getLogger(MsgDb.class.getName()).error("getBlogDayList:" +                    e.getMessage());        } finally {            if (rs != null) {                try {                    rs.close();                } catch (Exception e) {}                rs = null;            }            if (pstmt != null) {                try {                    pstmt.close();                } catch (Exception e) {}                pstmt = null;            }            if (conn != null) {                conn.close();                conn = null;            }        }        return v;    }    public static String LoadString(HttpServletRequest request, String key) {        return SkinUtil.LoadString(request, "res.forum.MsgDb", key);    }    public boolean CheckTopic(HttpServletRequest req, FileUpload TheBean) throws            ErrMsgException {        if (ret == FileUpload.RET_TOOLARGESINGLE) {            throw new ErrMsgException(LoadString(req, "err_too_large"));         }        if (ret == FileUpload.RET_INVALIDEXT) {            throw new ErrMsgException(TheBean.getErrMessage(req));        }        String errMsg = "";        title = TheBean.getFieldValue("topic");        if (title == null || title.trim().equals(""))            errMsg += LoadString(req, "err_need_title");         boardcode = TheBean.getFieldValue("boardcode");        if (boardcode == null || boardcode.trim().equals(""))            errMsg += LoadString(req, "err_need_board");         content = TheBean.getFieldValue("Content");        content = AntiXSS.antiXSS(content);        String sIsWebedit = TheBean.getFieldValue("isWebedit");        if (sIsWebedit == null || sIsWebedit.equals(""))            isWebedit = WEBEDIT_UBB;        else            isWebedit = WEBEDIT_NORMAL;                ForumFilter.filterMsg(req, title);        ForumFilter.filterMsg(req, content);                expression = StrUtil.toInt(TheBean.getFieldValue("expression"), EXPRESSION_NONE);        ip = req.getRemoteAddr();        String strshow_smile = TheBean.getFieldValue("show_smile");        if (strshow_smile == null || strshow_smile.equals(""))            show_smile = 1;        else            show_smile = Integer.parseInt(strshow_smile);        String strshow_ubbcode = TheBean.getFieldValue("show_ubbcode");        if (strshow_ubbcode == null || strshow_ubbcode.equals(""))            show_ubbcode = 1;        else            show_ubbcode = Integer.parseInt(strshow_ubbcode);        String stremail_notify = TheBean.getFieldValue("email_notify");        if (stremail_notify == null || stremail_notify.equals(""))            email_notify = 0;        else            email_notify = Integer.parseInt(stremail_notify);        String strmsg_notify = TheBean.getFieldValue("msg_notify");        if (strmsg_notify == null || strmsg_notify.equals(""))            msgNotify = 0;        else            msgNotify = Integer.parseInt(strmsg_notify);        String strsms_notify = TheBean.getFieldValue("sms_notify");        if (strsms_notify == null || strsms_notify.equals(""))            smsNotify = 0;        else            smsNotify = Integer.parseInt(strsms_notify);        String strIsBlog = StrUtil.getNullStr(TheBean.getFieldValue("isBlog"));        if (strIsBlog.equals("1"))            blog = true;        else {            if (boardcode.equals(Leaf.CODE_BLOG))                blog = true;            else                blog = false;        }        if (blog) {            blogUserDir = TheBean.getFieldValue("blogUserDir");            UserConfigDb ucd = new UserConfigDb();            String strBlogId = StrUtil.getNullStr(TheBean.getFieldValue(                    "blogId"));            blogId = UserConfigDb.NO_BLOG;            if (!strBlogId.equals("")) {                try {                    blogId = Long.parseLong(strBlogId);                } catch (Exception e) {                }            }                        if (blogId == UserConfigDb.NO_BLOG) {                ucd = ucd.getUserConfigDbByUserName(Privilege.getUser(req));            } else {                ucd = ucd.getUserConfigDb(blogId);            }                        blogId = ucd.getId();            isLocked = StrUtil.toInt(TheBean.getFieldValue("isLocked"), 0);            blogDirCode = StrUtil.getNullStr(TheBean.getFieldValue("blogDirCode"));                                }        plugin2Code = StrUtil.getNullStr(TheBean.getFieldValue("plugin2Code")).                      trim();        pluginCode = StrUtil.getNullStr(TheBean.getFieldValue("pluginCode")).                     trim();        if (!errMsg.equals("")) {            throw new ErrMsgException(errMsg);        }                TimeConfig tc = new TimeConfig();        if (tc.isPostNeedCheck(req)) {            checkStatus = CHECK_STATUS_NOT;

⌨️ 快捷键说明

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