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

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

?? postwebhandler.java

?? java servlet著名論壇源代碼
?? JAVA
?? 第 1 頁 / 共 4 頁
字號:

                // has the permission now, then insert to database
                try {
                    DAOFactory.getFavoriteThreadDAO().create(memberID, threadID, forumID,
                        favoriteCreationDate, favoriteType, favoriteOption,
                        favoriteStatus);
                } catch (DuplicateKeyException ex) {
                    // already add favorite thread, just ignore
                }
            }
        }

        //add watch if user checked it
        if (addWatchThread) {
            permission.ensureIsAuthenticated();
            permission.ensureIsActivated();
            if (MVNForumConfig.getEnableWatch() == false) {
                // should never happen, because if it happen, then the whole process is broken
                throw new AssertionException("Cannot add Watch because Watch feature is disabled by administrator.");
            }

            int watchType               = 0;//ParamUtil.getParameterInt(request, "WatchType");
            int watchOption             = 0;//ParamUtil.getParameterInt(request, "WatchOption");
            int watchStatus             = 0;//ParamUtil.getParameterInt(request, "WatchStatus");
            Timestamp watchCreationDate = now;
            Timestamp watchLastSentDate = now;
            Timestamp watchEndDate      = now;// @todo: check it !!!

            try {
                DAOFactory.getWatchDAO().create(memberID, 0/*watchCategoryID*/, 0/*watchForumID*/,
                                           threadID, watchType, watchOption,
                                           watchStatus, watchCreationDate, watchLastSentDate,
                                           watchEndDate);
            } catch (DuplicateKeyException ex) {
                // User try to create a duplicate watch, just ignore
            }
        }

        // now, update the Search Index
        //@todo check the performance here
        PostBean justAddedPostBean = DAOFactory.getPostDAO().getPost(postID);
        PostIndexer.scheduleAddPostTask(justAddedPostBean);

        request.setAttribute("PostBean", justAddedPostBean);
        request.setAttribute("ForumID", String.valueOf(forumID));
        request.setAttribute("ThreadID", String.valueOf(threadID));
        request.setAttribute("PostID", String.valueOf(postID));
        request.setAttribute("AttachMore", new Boolean(attachMore));
        request.setAttribute("AddFavoriteParentThread", new Boolean(addFavoriteThread));
        request.setAttribute("AddWatchParentThread", new Boolean(addWatchThread));
        request.setAttribute("IsPendingThread", new Boolean(isPendingThread));
        /**@todo: review, this variable is still reserved*/
        //request.setAttribute("ParentPostID", String.valueOf(parentPostID));

        FloodControl.increaseCount(MVNForumGlobal.FLOOD_ID_NEW_POST, currentIP);
    }

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

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

        int postID = ParamUtil.getParameterInt(request, "post");

        PostBean postBean = DAOFactory.getPostDAO().getPost(postID);
        int threadID = postBean.getThreadID();
        int forumID = postBean.getForumID();

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

        // to show the thread topic
        ThreadBean threadBean = DAOFactory.getThreadDAO().getBean(threadID);

        MemberBean memberBean = null;
        if (postBean.getMemberID()>0) {
            memberBean = DAOFactory.getMemberDAO().getMember_forPublic(postBean.getMemberID());
        }
        postBean.setMemberBean(memberBean);

        int postAttachCount = postBean.getPostAttachCount();
        if ( (postAttachCount > 0) && MVNForumConfig.getEnableAttachment()) {
            Collection attachBeans = DAOFactory.getAttachmentDAO().getBeans_inPost(postID);
            int actualAttachCount = attachBeans.size();

            // now check if the attachCount in talbe Post equals to the actual attachCount in table Attachment
            if (postAttachCount != actualAttachCount) {
                if (actualAttachCount != DAOFactory.getAttachmentDAO().getNumberOfBeans_inPost(postID)) {
                    throw new AssertionException("AssertionException: Serious error: cannot process Attachment Count in table Attachment");
                }
                log.warn("The attachment count in table Post and Attachment are not synchronized. In table Post = " + postAttachCount + " and in table Attachment = " + actualAttachCount + ". Synchronize to " + actualAttachCount);
                DAOFactory.getPostDAO().updateAttachCount(postID, actualAttachCount);
            }
            if (actualAttachCount > 0) {
                postBean.setAttachmentBeans(attachBeans);
            }
        }

        request.setAttribute("PostBean", postBean);
        request.setAttribute("ThreadBean", threadBean);
    }

    /**
     * then, it will be forward to addpost.jsp
     * NOTE: This method MUST NOT use parameter MessageParent (need some process to figure out)
     */
    void prepareEdit(HttpServletRequest request)
        throws ObjectNotFoundException, DatabaseException, BadInputException, AuthenticationException, AssertionException {

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

        // a guest CANNOT edit a post, because it need Authenticated Permission
        permission.ensureIsAuthenticated();

        int postID = ParamUtil.getParameterInt(request, "post");
        PostBean postBean = DAOFactory.getPostDAO().getPost(postID);
        int forumID = postBean.getForumID();

        ForumBean forumBean = ForumCache.getInstance().getBean(forumID);
        forumBean.ensureNotDisabledForum();
        forumBean.ensureNotLockedForum();

        // now check if thread is closed or locked, if it is, then cannot reply to a post
        int threadID = postBean.getThreadID();
        ThreadBean threadBean = DAOFactory.getThreadDAO().getBean(threadID);
        threadBean.ensureStatusCanEdit();

        int logonMemberID = onlineUser.getMemberID();
        int authorID      = postBean.getMemberID();

        // check constraint
        if (permission.canEditPost(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 = postBean.getPostCreationDate();
            int maxDays = MVNForumConfig.getMaxEditDays();
            if ( (now.getTime() - postDate.getTime()) > (DateUtil.DAY * maxDays) ) {
                /** @todo choose a better Exception here */
                throw new BadInputException("You cannot edit a post which is older than " + maxDays + " days.");
            }
            /** @todo check status of this post */
            /*
            if (postBean.getPostStatus() == ?) {
                throw new BadInputException("Cannot edit message which is disable.");
            }*/
        } else {//not an author, so this user must have Edit Permission
            permission.ensureCanEditPost(forumID);// this method ALWAYS throws AuthenticationException
        }

        request.setAttribute("PostToEdit", postBean);
        request.setAttribute("action", "update");

        boolean isPreviewing = ParamUtil.getParameterBoolean(request, "preview");
        if (isPreviewing) {
            // Check if user enter some text or not
            ParamUtil.getParameter(request, "PostTopic", true);
            ParamUtil.getParameter(request, "message", true);// use message instead of MessageBody

            MemberBean memberBean = DAOFactory.getMemberDAO().getMember_forPublic(onlineUser.getMemberID());
            request.setAttribute("MemberBean", memberBean);
        }
    }

    /**
     * @todo: log the modification
     * @todo: check the comment below, it's obsolete now :(
     * @todo: check coi messageTopic co the la optional khi reply
     * NOTE: This method MUST NOT get parameter MessageParent (need some process to figure out)
     *      so it needs to call setAttribute with messageParent for page updatepostsuccess.jsp
     */
    void processUpdate(HttpServletRequest request)
        throws ObjectNotFoundException, BadInputException, DatabaseException, CreateException,
               ForeignKeyNotFoundException, AuthenticationException, AssertionException, InterceptorException {

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

        // a guest CANNOT edit a post, because it need Authenticated Permission
        permission.ensureIsAuthenticated();

        Timestamp now   = DateUtil.getCurrentGMTTimestamp();

        int postID      = ParamUtil.getParameterInt(request, "post");// dont change

        // check constraint
        PostBean postBean = DAOFactory.getPostDAO().getPost(postID);
        int forumID = postBean.getForumID();
        int threadID = postBean.getThreadID();

        ForumBean forumBean = ForumCache.getInstance().getBean(forumID);
        forumBean.ensureNotDisabledForum();
        forumBean.ensureNotLockedForum();

        // now check if thread is locked, if it is, then cannot reply to a post
        // Please note that if the threadStatus is closed, post can still be edited
        ThreadBean threadBean = DAOFactory.getThreadDAO().getBean(threadID);
        threadBean.ensureStatusCanEdit();

        String postTopic  = ParamUtil.getParameter(request, "PostTopic", true);
        postTopic = DisableHtmlTagFilter.filter(postTopic);// always disable HTML
        InterceptorService.getInstance().validateContent(postTopic);

        String postBody   = ParamUtil.getParameter(request, "message", true);// use message instead of PostBody
        postBody = DisableHtmlTagFilter.filter(postBody);// always disable HTML
        InterceptorService.getInstance().validateContent(postBody);

        int    logonMemberID    = onlineUser.getMemberID();
        String logonMemberName  = onlineUser.getMemberName();
        int    authorID         = postBean.getMemberID();

        // check constraint
        if (permission.canEditPost(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 postDate = postBean.getPostCreationDate();
            /** @todo config maxDays */
            int maxDays = 7;
            if ( (now.getTime() - postDate.getTime()) > (DateUtil.DAY * maxDays) ) {
                /** @todo choose a better Exception here */
                throw new BadInputException("You cannot edit a post which is older than " + maxDays + " days.");
            }
            /** @todo check status of this post */
            /*
            if (postBean.getPostStatus() == ?) {
                throw new BadInputException("Cannot edit a post which is disable.");
            }*/
        } else {//not an author, so this user must have Edit Permission
            permission.ensureCanEditPost(forumID);// this method ALWAYS throws AuthenticationException
        }

        String postLastEditIP       = request.getRemoteAddr();
        int postFormatOption        = 0;//@todo review and support it later
        int postOption              = 0;//@todo review and support it later
        int postStatus              = postBean.getPostStatus();// use old post status
        String postIcon = ParamUtil.getParameter(request, "PostIcon");
        postIcon = DisableHtmlTagFilter.filter(postIcon);// always disable HTML

        /*
         * Note that although the 2 methods below can be combined,
         * I dont do that for clearness
         */
        /** @todo log the modification here */
        DAOFactory.getPostDAO().update(postID, // primary key
                             logonMemberName, postTopic, postBody,
                             now/*postLastEditDate*/, postLastEditIP, postFormatOption,
                             postOption, postStatus, postIcon);
        DAOFactory.getPostDAO().increaseEditCount(postID);

        if (postBean.getParentPostID() == 0) {//edit a top post ( thread )
            String threadIcon = postIcon;
            DAOFactory.getThreadDAO().updateTopic_Body_Icon(threadID, postTopic, postBody, threadIcon);
        }

        boolean attachMore  = ParamUtil.getParameterBoolean(request, "AttachMore");
        boolean addFavoriteThread = ParamUtil.getParameterBoolean(request, "AddFavoriteParentThread");
        boolean addWatchThread    = ParamUtil.getParameterBoolean(request, "AddWatchParentThread");
        //add favorite thread if user checked it
        if (addFavoriteThread) {
            permission.ensureIsAuthenticated();
            //@todo: add checking of MVNForumConfig.getEnableFavoriteThread()
            // check to make sure that this user doesnt exceed his favorite max
            int currentFavoriteCount = DAOFactory.getFavoriteThreadDAO().getNumberOfBeans_inMember(logonMemberID);
            int maxFavorites = MVNForumConfig.getMaxFavoriteThread();
            if (currentFavoriteCount < maxFavorites) {
                Timestamp favoriteCreationDate = now;
                int favoriteType = 0; //@todo implement it later

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
极品少妇一区二区三区精品视频| 在线观看日韩电影| 91精品国产全国免费观看| 日韩av一区二区三区四区| 欧美精品视频www在线观看| 一区二区三区四区蜜桃| 日韩av电影天堂| 国产伦精品一区二区三区免费| 日本欧美久久久久免费播放网| 日韩国产高清在线| 777奇米成人网| 激情成人午夜视频| 亚洲欧美一区二区三区极速播放 | 亚洲自拍偷拍图区| 欧美人动与zoxxxx乱| 国产91丝袜在线播放九色| 亚洲老司机在线| 久久一留热品黄| 欧美日韩免费一区二区三区 | 欧美精品vⅰdeose4hd| 蜜桃精品视频在线| 中文字幕av一区 二区| 成人福利在线看| 国产真实乱子伦精品视频| 国产欧美一区二区三区在线看蜜臀 | 韩国视频一区二区| 亚洲三级久久久| 欧美精品三级日韩久久| av一区二区三区四区| 久久激情综合网| 亚洲国产精品天堂| 欧美精品欧美精品系列| 国产高清久久久久| 一区二区三区日韩精品| 精品少妇一区二区三区| 韩国成人精品a∨在线观看| 国产精品网站在线观看| 91精品国产日韩91久久久久久| 国产成人8x视频一区二区| 一区二区三区四区激情 | av福利精品导航| 中文字幕在线观看一区二区| 一本久久精品一区二区| 免费成人av在线| 午夜欧美2019年伦理| 精品1区2区在线观看| 欧美性受xxxx| 欧美日韩大陆一区二区| 久久精品久久综合| 秋霞国产午夜精品免费视频| 国产精品免费观看视频| 久久精品人人做| 欧美亚洲综合在线| 99久久综合99久久综合网站| 毛片不卡一区二区| 日韩电影免费在线看| 一区二区三区日韩欧美精品 | 成人手机在线视频| 风间由美性色一区二区三区| 成人免费在线视频观看| 国产亚洲一区二区在线观看| 欧美综合一区二区三区| av电影在线观看完整版一区二区| 亚洲一区在线视频观看| 亚洲午夜电影在线| 亚洲影院理伦片| 亚洲一区二区三区在线播放| 亚洲品质自拍视频| 亚洲欧洲av一区二区三区久久| 国产午夜精品久久久久久久| 欧美丰满美乳xxx高潮www| 欧美精品三级日韩久久| 在线不卡欧美精品一区二区三区| 欧美美女一区二区在线观看| 99麻豆久久久国产精品免费优播| 99亚偷拍自图区亚洲| 国产一区二区三区四区五区美女| 成人精品电影在线观看| 成人性色生活片| 色av成人天堂桃色av| 99视频有精品| 欧美日韩二区三区| 欧美视频中文字幕| 欧美一级片免费看| 精品福利一区二区三区免费视频| 国产精品午夜免费| 国产精品精品国产色婷婷| 国产精品久久久久aaaa| 亚洲mv大片欧洲mv大片精品| 亚洲乱码国产乱码精品精小说 | 国产精品91一区二区| 亚洲二区在线视频| 日本系列欧美系列| 国产成人在线观看| 国产精品一区二区男女羞羞无遮挡 | 国产大片一区二区| 不卡一区二区三区四区| 国产九九视频一区二区三区| 99久久夜色精品国产网站| 国产福利不卡视频| 在线免费观看日本一区| 欧美系列在线观看| 国产欧美日韩不卡| 精品电影一区二区三区| wwww国产精品欧美| 一区二区日韩电影| 青青青伊人色综合久久| 欧美日韩综合在线免费观看| 日韩精品一区二区三区视频在线观看 | 精品日韩成人av| 欧美国产在线观看| 麻豆精品视频在线观看| 在线免费精品视频| 国产亚洲欧美激情| 青草国产精品久久久久久| 美女视频第一区二区三区免费观看网站| 丰满白嫩尤物一区二区| 欧美日本乱大交xxxxx| 久久精品亚洲精品国产欧美kt∨| 亚洲午夜免费视频| a亚洲天堂av| 日韩午夜激情视频| 人妖欧美一区二区| 在线观看亚洲专区| 欧美国产日韩a欧美在线观看| 亚洲欧美综合在线精品| 美女免费视频一区二区| 国产精品一区不卡| 久久这里只精品最新地址| 国产欧美日本一区二区三区| 天堂在线一区二区| 国产乱码精品1区2区3区| 7777精品伊人久久久大香线蕉的 | 国产综合色视频| 欧美人狂配大交3d怪物一区| 一区二区三区在线观看国产| 97精品电影院| 中国色在线观看另类| 国产激情一区二区三区| 精品91自产拍在线观看一区| 久久av资源站| 日韩欧美一级二级| 国产一区二区三区在线观看精品 | 首页欧美精品中文字幕| 99re亚洲国产精品| 成人欧美一区二区三区1314| av亚洲精华国产精华精| 国产人久久人人人人爽| 国产精品一区专区| 国产精品久久久久久久久免费丝袜| 国产suv精品一区二区三区| 久久久午夜电影| 成人福利在线看| 五月天欧美精品| 精品国产伦理网| 波波电影院一区二区三区| 亚洲综合色视频| 国产精品一二三区在线| 亚洲三级视频在线观看| 色视频一区二区| 韩国v欧美v日本v亚洲v| 国产日韩欧美一区二区三区综合| 国模套图日韩精品一区二区| 国产亚洲精久久久久久| 91一区在线观看| 狠狠色丁香婷综合久久| √…a在线天堂一区| 欧美久久久久久久久中文字幕| 美女视频免费一区| 欧美一级欧美三级| 久久成人麻豆午夜电影| 欧美激情中文不卡| 欧美乱熟臀69xxxxxx| 调教+趴+乳夹+国产+精品| 欧美一区二区黄色| 91视频国产观看| 日韩不卡在线观看日韩不卡视频| 久久久久久亚洲综合| 国产成人av一区二区三区在线 | 国产乱国产乱300精品| 欧美日本一区二区| 国产成人免费视频一区| 亚洲一区二区精品视频| 欧美久久免费观看| 亚洲高清视频在线| 欧美精品一区二区三区很污很色的| 亚洲综合一区二区三区| 久久免费美女视频| 麻豆91在线播放| 亚洲人成网站影音先锋播放| 欧美性xxxxxxxx| 91视频xxxx| 亚洲成人精品一区| 欧美国产综合色视频| 99re在线精品| 日本aⅴ精品一区二区三区| 久久久三级国产网站| 一本久久综合亚洲鲁鲁五月天| 亚洲mv大片欧洲mv大片精品| 亚洲免费av网站|