亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? threadwebhandler.java

?? java servlet著名論壇源代碼
?? JAVA
?? 第 1 頁 / 共 3 頁
字號(hào):
/*
 * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/user/ThreadWebHandler.java,v 1.23 2004/05/19 19:11:59 minhnn Exp $
 * $Author: minhnn $
 * $Revision: 1.23 $
 * $Date: 2004/05/19 19:11:59 $
 *
 * ====================================================================
 *
 * Copyright (C) 2002-2004 by MyVietnam.net
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or any later version.
 *
 * All copyright notices regarding mvnForum MUST remain intact
 * in the scripts and in the outputted HTML.
 * The "powered by" text/logo with a link back to
 * http://www.mvnForum.com and http://www.MyVietnam.net in the
 * footer of the pages MUST remain visible when the pages
 * are viewed on the internet or intranet.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * Support can be obtained from support forums at:
 * http://www.mvnForum.com/mvnforum/index
 *
 * Correspondence and Marketing Questions can be sent to:
 * info@MyVietnam.net
 *
 * @author: Minh Nguyen  minhnn@MyVietnam.net
 * @author: Mai  Nguyen  mai.nh@MyVietnam.net
 */
package com.mvnforum.user;

import java.sql.Timestamp;
import java.util.*;
import javax.servlet.http.HttpServletRequest;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.mvnforum.*;
import com.mvnforum.auth.*;
import com.mvnforum.common.StatisticsUtil;
import com.mvnforum.db.*;
import com.mvnforum.search.DeletePostIndexTask;
import com.mvnforum.search.PostIndexer;
import net.myvietnam.mvncore.exception.*;
import net.myvietnam.mvncore.util.DateUtil;
import net.myvietnam.mvncore.util.ParamUtil;
import net.myvietnam.mvncore.exception.ObjectNotFoundException;
import net.myvietnam.mvncore.exception.DatabaseException;

public class ThreadWebHandler {

    private static Log log = LogFactory.getLog(ThreadWebHandler.class);

    private OnlineUserManager onlineUserManager = OnlineUserManager.getInstance();

    public ThreadWebHandler() {
    }

    void prepareDelete(HttpServletRequest request)
        throws BadInputException, ObjectNotFoundException, DatabaseException,
        AuthenticationException, AssertionException {

        OnlineUser onlineUser = onlineUserManager.getOnlineUser(request);
        MVNForumPermission permission = onlineUser.getPermission();

        // primary key column(s)
        int threadID = ParamUtil.getParameterInt(request, "thread");

        ThreadBean threadBean = DAOFactory.getThreadDAO().getBean(threadID);
        int numberOfPosts = DAOFactory.getPostDAO().getNumberOfEnablePosts_inThread(threadID);

        // check constraint
        int forumID = threadBean.getForumID();
        ForumCache.getInstance().getBean(forumID).ensureNotDisabledForum();

        int logonMemberID   = onlineUser.getMemberID();
        String authorName   = threadBean.getMemberName();
        int authorID        = DAOFactory.getMemberDAO().getMemberIDFromMemberName(authorName);
        if (permission.canDeletePost(forumID)) {
            // have permission, just do nothing, that is dont check the max day contraint
        } else if (logonMemberID == authorID) {// same author
            // check date here, usually must not older than 7 days
            Timestamp now = DateUtil.getCurrentGMTTimestamp();
            Timestamp postDate = threadBean.getThreadCreationDate();
            int maxDays = MVNForumConfig.getMaxDeleteDays();
            if ( (now.getTime() - postDate.getTime()) > (DateUtil.DAY * maxDays) ) {
                /** @todo choose a better Exception here */
                throw new BadInputException("You cannot delete a post which is older than " + maxDays + " days.");
            }

            //Check to make sure that "no reply" for this post
            if (numberOfPosts > 1) {
                throw new BadInputException("Cannot delete a thread that has reply!");
            }

            /** @todo check status of this thread */
            /*
            if (postBean.getPostStatus() == ?) {
                throw new BadInputException("Cannot delete message which is disable.");
            }*/
        } else {//not an author, so this user must have Edit Permission
            permission.ensureCanDeletePost(forumID);// this method ALWAYS throws AuthenticationException
        }

        int numberOfPendingPosts = DAOFactory.getPostDAO().getNumberOfDisablePosts_inThread(threadID);

        request.setAttribute("ThreadBean", threadBean);
        request.setAttribute("NumberOfPosts", new Integer(numberOfPosts));
        request.setAttribute("NumberOfPendingPosts", new Integer(numberOfPendingPosts));
    }

    void processDelete(HttpServletRequest request)
        throws BadInputException, ObjectNotFoundException, DatabaseException,
        AuthenticationException, AssertionException {

        // primary key column(s)
        int threadID = ParamUtil.getParameterInt(request, "thread");
        ThreadBean threadBean = DAOFactory.getThreadDAO().getBean(threadID);

        ForumCache.getInstance().getBean(threadBean.getForumID()).ensureNotDisabledForum();

        // now check the password
        MyUtil.ensureCorrectCurrentPassword(request);

        deleteThread(request, threadBean);

        //now, update the statistics in the forum and member
        int forumID = threadBean.getForumID();
        StatisticsUtil.updateForumStatistics(forumID);

        request.setAttribute("ForumID", String.valueOf(forumID));
    }

    // Note that this method does not update the forum statistics
    // The caller must call method to update the forum statistics
    void deleteThread(HttpServletRequest request, ThreadBean threadBean)
        throws BadInputException, ObjectNotFoundException, DatabaseException,
        AuthenticationException, AssertionException {

        OnlineUser onlineUser = onlineUserManager.getOnlineUser(request);
        MVNForumPermission permission = onlineUser.getPermission();

        // user must have been authenticated before he can delete
        permission.ensureIsAuthenticated();

        // primary key column(s)
        int threadID = threadBean.getThreadID();

        // now, check the permission
        int forumID = threadBean.getForumID();
        int logonMemberID   = onlineUser.getMemberID();
        String authorName   = threadBean.getMemberName();
        int authorID        = DAOFactory.getMemberDAO().getMemberIDFromMemberName(authorName);
        if (permission.canDeletePost(forumID)) {
            // have permission, just do nothing, that is dont check the max day contraint
        } else if (logonMemberID == authorID) {// same author
            // check date here, usually must not older than 7 days
            Timestamp now = DateUtil.getCurrentGMTTimestamp();
            Timestamp postDate = threadBean.getThreadCreationDate();
            int maxDays = MVNForumConfig.getMaxDeleteDays();
            if ( (now.getTime() - postDate.getTime()) > (DateUtil.DAY * maxDays) ) {
                /** @todo choose a better Exception here */
                throw new BadInputException("You cannot delete a post which is older than " + maxDays + " days.");
            }

            //Check to make sure that "no reply" for this post
            int numberOfPosts = DAOFactory.getPostDAO().getNumberOfEnablePosts_inThread(threadID);
            if (numberOfPosts > 1) {
                throw new BadInputException("Cannot delete a thread that has reply!");
            }

            if (threadBean.getThreadStatus() == ThreadBean.THREAD_STATUS_DISABLED) {
                throw new BadInputException("Cannot delete your own disabled thread.");
            }
        } else {//not an author, so this user must have Edit Permission
            permission.ensureCanDeletePost(forumID);// this method ALWAYS throws AuthenticationException
        }

        // Delete all attachments in this thread,
        // we must call this before any attempt to delete the thread
        // That is, the order when delete is VERY IMPORTANT
        AttachmentWebHandler.deleteAttachments_inThread(threadID);

        DAOFactory.getFavoriteThreadDAO().delete_inThread(threadID);

        DAOFactory.getWatchDAO().delete_inThread(threadID);

        DAOFactory.getPostDAO().delete_inThread(threadID);

        // now delete the thread, note that we delete it after delete all child objects
        DAOFactory.getThreadDAO().delete(threadID);

        // now update the search index
        // @todo : what if the above methods throw exception, then no thread is deleted from index ???
        PostIndexer.scheduleDeletePostTask(threadID, DeletePostIndexTask.OBJECT_TYPE_THREAD);

        //now, update the statistics in the member
        StatisticsUtil.updateMemberStatistics(authorID);
    }

    void prepareMoveThread(HttpServletRequest request)
        throws BadInputException, ObjectNotFoundException, DatabaseException,
        AuthenticationException, AssertionException {

        OnlineUser onlineUser = onlineUserManager.getOnlineUser(request);
        MVNForumPermission permission = onlineUser.getPermission();

        // primary key column(s)
        int threadID = ParamUtil.getParameterInt(request, "thread");

        ThreadBean threadBean = DAOFactory.getThreadDAO().getBean(threadID);

        ForumCache.getInstance().getBean(threadBean.getForumID()).ensureNotDisabledForum();

        // now, check the permission
        // @todo: is it the correct permission ???
        permission.ensureCanDeletePost(threadBean.getForumID());

        int numberOfPosts = DAOFactory.getPostDAO().getNumberOfEnablePosts_inThread(threadID);

        request.setAttribute("ThreadBean", threadBean);
        request.setAttribute("NumberOfPosts", new Integer(numberOfPosts));
    }

    void processMoveThread(HttpServletRequest request)
        throws BadInputException, ObjectNotFoundException, DatabaseException,
        ForeignKeyNotFoundException, AuthenticationException, AssertionException {

        OnlineUser onlineUser = onlineUserManager.getOnlineUser(request);
        MVNForumPermission permission = onlineUser.getPermission();

        // user must have been authenticated before he can delete
        permission.ensureIsAuthenticated();

        // primary key column(s)
        int threadID = ParamUtil.getParameterInt(request, "thread");

        // now, check the permission
        ThreadBean threadBean = DAOFactory.getThreadDAO().getBean(threadID);
        int forumID = threadBean.getForumID();
        permission.ensureCanDeletePost(forumID);

        ForumCache.getInstance().getBean(forumID).ensureNotDisabledForum();

        // now check the password
        MyUtil.ensureCorrectCurrentPassword(request);

        int destForumID = ParamUtil.getParameterInt(request, "destforum");

        // make sure that we dont move to the same forum (meaningless)
        if (destForumID == forumID) {
            throw new AssertionException("Cannot move thread to the same forum.");
        }

        // now make sure that the dest forum is existed
        ForumCache.getInstance().getBean(destForumID);

        DAOFactory.getThreadDAO().update_ForumID(threadID, destForumID);
        DAOFactory.getPostDAO().update_ForumID_inThread(threadID, destForumID);
        DAOFactory.getFavoriteThreadDAO().update_ForumID_inThread(threadID, destForumID);

        //now, update the statistics in the source forum and dest forum
        StatisticsUtil.updateForumStatistics(forumID);
        StatisticsUtil.updateForumStatistics(destForumID);

        // now update the search index
        // @todo : what if the above methods throw exception, then no thread is deleted from index ???
        PostIndexer.scheduleUpdateThreadTask(threadID);

        request.setAttribute("ForumID", String.valueOf(forumID));
    }

    void prepareEditThreadStatus(HttpServletRequest request)
        throws BadInputException, ObjectNotFoundException, DatabaseException,
        AuthenticationException, AssertionException {

        OnlineUser onlineUser = onlineUserManager.getOnlineUser(request);
        MVNForumPermission permission = onlineUser.getPermission();

        // primary key column(s)
        int threadID = ParamUtil.getParameterInt(request, "thread");

        ThreadBean threadBean = DAOFactory.getThreadDAO().getBean(threadID);

        ForumCache.getInstance().getBean(threadBean.getForumID()).ensureNotDisabledForum();

        // now, check the permission
        permission.ensureCanModerateThread(threadBean.getForumID());

        int numberOfPosts = DAOFactory.getPostDAO().getNumberOfEnablePosts_inThread(threadID);

        int numberOfPendingPosts = DAOFactory.getPostDAO().getNumberOfDisablePosts_inThread(threadID);

        request.setAttribute("ThreadBean", threadBean);
        request.setAttribute("NumberOfPosts", new Integer(numberOfPosts));
        request.setAttribute("NumberOfPendingPosts", new Integer(numberOfPendingPosts));
    }

    void processEditThreadStatus(HttpServletRequest request)
        throws BadInputException, ObjectNotFoundException, DatabaseException,
        ForeignKeyNotFoundException, AuthenticationException, AssertionException {

        OnlineUser onlineUser = onlineUserManager.getOnlineUser(request);
        MVNForumPermission permission = onlineUser.getPermission();

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲自拍偷拍图区| 欧美综合在线视频| 久久精品久久综合| 亚洲最大成人综合| 欧美国产日产图区| 日韩精品一区二区三区在线观看| 亚洲精品中文在线| 五月婷婷色综合| 自拍av一区二区三区| 亚洲综合免费观看高清在线观看| 日韩情涩欧美日韩视频| 精品视频一区二区三区免费| 色综合中文字幕国产 | 久久久久久久综合狠狠综合| 精品福利一二区| 欧美人与禽zozo性伦| 91亚洲男人天堂| 成人精品国产一区二区4080| 国内精品伊人久久久久av一坑| 国产精品麻豆网站| 亚洲电影第三页| 亚洲一二三四区不卡| 色婷婷综合久久| 欧美视频在线观看一区二区| 99国产精品99久久久久久| 美女在线一区二区| 成人黄色在线网站| av不卡在线播放| 亚洲欧洲成人精品av97| 亚洲丶国产丶欧美一区二区三区| 亚洲一级二级在线| 国产农村妇女精品| 国产精品久久久久桃色tv| 久久精品亚洲麻豆av一区二区| 国产精品九色蝌蚪自拍| 亚洲男同1069视频| 亚洲一级二级在线| 粉嫩在线一区二区三区视频| 成人91在线观看| 欧美伊人久久大香线蕉综合69| 欧美成人video| 国产午夜精品一区二区三区嫩草| 国产精品视频在线看| 蜜桃视频一区二区三区在线观看| 麻豆成人免费电影| 国产精品888| 91精品国产欧美日韩| 欧美白人最猛性xxxxx69交| 在线观看视频欧美| 日本一区二区动态图| 自拍偷拍国产亚洲| 亚洲一区成人在线| 91农村精品一区二区在线| 欧美色男人天堂| 日韩美女视频一区| 免费观看成人av| 成人av电影在线网| 国产欧美日韩综合| 亚洲国产一区二区三区| 另类调教123区 | 国产风韵犹存在线视精品| 欧美日韩高清一区二区不卡 | 国产片一区二区三区| 香蕉加勒比综合久久| 国产精品66部| 欧美人妇做爰xxxⅹ性高电影| 亚洲色图一区二区| 久久99国产精品免费| 日本女优在线视频一区二区| 在线观看91视频| 国产午夜一区二区三区| 日韩在线观看一区二区| 99热在这里有精品免费| 91.xcao| 欧美一区午夜视频在线观看| 国产欧美一区二区精品忘忧草| 午夜精品福利一区二区蜜股av| 亚洲香肠在线观看| 久久99精品国产麻豆婷婷洗澡| 欧美在线视频不卡| 亚洲欧洲另类国产综合| 日韩电影免费在线看| 日本韩国精品一区二区在线观看| 国产三级精品三级在线专区| 国产精品久久久久毛片软件| av电影一区二区| 久久精品欧美一区二区三区麻豆| 国产大陆亚洲精品国产| 欧美成va人片在线观看| 亚洲高清在线精品| 欧美成人三级在线| 蜜桃av一区二区在线观看| 欧美日韩日日摸| 国产专区欧美精品| xvideos.蜜桃一区二区| 成人精品国产一区二区4080 | 黑人精品欧美一区二区蜜桃| 久久午夜电影网| 精品影视av免费| 欧美日韩综合在线| 久久国产福利国产秒拍| 日韩视频在线永久播放| 国产乱国产乱300精品| 国产拍揄自揄精品视频麻豆| 国产一区二区三区蝌蚪| 日韩精品一区二区三区中文精品| 亚洲18色成人| 日韩一级片在线观看| 日韩精品成人一区二区在线| 国产日韩精品一区二区浪潮av | 久久综合九色综合97_久久久| 久久99精品国产.久久久久久| 欧美精品一区二区三区四区| 一区二区三区鲁丝不卡| 欧美群妇大交群的观看方式| 五月婷婷综合网| 中文字幕综合网| 一本色道**综合亚洲精品蜜桃冫| 亚洲综合精品久久| 51午夜精品国产| 亚洲欧洲国产日本综合| 亚洲精品一区二区三区精华液 | 在线播放/欧美激情| 激情综合色综合久久综合| 亚洲一区二区三区在线播放| 欧美美女一区二区| 国产丝袜欧美中文另类| 9191国产精品| 国产不卡在线视频| 1000精品久久久久久久久| 在线一区二区视频| 成人ar影院免费观看视频| 亚洲高清在线视频| 久久精品国产久精国产爱| 一区二区三区欧美亚洲| 91.com视频| 欧美乱妇15p| 99久久夜色精品国产网站| 亚洲福利一二三区| 一区二区三区中文字幕| 欧美tickling网站挠脚心| 欧美日韩一区二区在线观看| 一区二区激情小说| 久久蜜桃av一区精品变态类天堂| 欧美一区二区久久久| 91女神在线视频| 欧美国产亚洲另类动漫| 国产亚洲欧洲一区高清在线观看| 91色porny在线视频| 91亚洲精华国产精华精华液| 蜜臀av性久久久久蜜臀aⅴ四虎 | 一区二区在线看| 久久精品亚洲精品国产欧美kt∨ | 成人免费视频国产在线观看| 国产做a爰片久久毛片| 亚洲在线免费播放| 亚洲mv在线观看| 亚洲欧美日本韩国| 精品剧情在线观看| 777久久久精品| 欧美猛男超大videosgay| 欧美巨大另类极品videosbest | 国产精品三级av| 99久久久国产精品| 成人永久看片免费视频天堂| 久久成人免费网站| 亚洲电影欧美电影有声小说| 欧美日韩在线三区| 91国产免费观看| 色综合天天综合网国产成人综合天| 韩国精品免费视频| 九九九精品视频| 欧美a级理论片| 亚洲午夜激情av| 久久不见久久见免费视频1| 日韩精品一区第一页| 国产精品美女一区二区三区| 亚洲成人综合视频| 亚洲电影第三页| 国产91精品一区二区| 国产麻豆精品在线观看| 色悠悠久久综合| 欧美日韩高清影院| 欧美日韩在线电影| 久久久精品tv| 亚洲国产精品av| 五月天网站亚洲| 免费观看一级特黄欧美大片| 亚洲韩国一区二区三区| 天天av天天翘天天综合网色鬼国产 | 亚洲激情av在线| 激情图片小说一区| 中文字幕在线不卡| 一区二区三区.www| 日韩久久精品一区| 国产精品丝袜一区| 国产一区二区三区| 自拍偷拍亚洲欧美日韩| 日韩小视频在线观看专区| 国产精品热久久久久夜色精品三区|