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

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

?? onlineuserimpl.java

?? java servlet著名論壇源代碼
?? JAVA
字號:
/*
 * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/auth/OnlineUserImpl.java,v 1.10 2004/06/29 02:17:35 minhnn Exp $
 * $Author: minhnn $
 * $Revision: 1.10 $
 * $Date: 2004/06/29 02:17:35 $
 *
 * ====================================================================
 *
 * 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.auth;

import java.sql.Timestamp;
import java.text.DateFormat;
import java.util.Locale;

import java.awt.image.BufferedImage;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.mvnforum.*;
import com.mvnforum.common.MVNCaptchaService;
import com.mvnforum.db.DAOFactory;
import com.mvnforum.db.MemberBean;
import com.octo.captcha.image.ImageCaptcha;
import net.myvietnam.mvncore.exception.BadInputException;
import net.myvietnam.mvncore.util.DateUtil;

class OnlineUserImpl implements OnlineUser {

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

    private int memberID = MVNForumConstant.MEMBER_ID_OF_GUEST;

    private String memberName = "";

    private int authenticationType = AUTHENTICATION_TYPE_UNAUTHENTICATED;

    private MVNForumPermission permission = null;

    private OnlineUserAction onlineUserAction = new OnlineUserAction();

    private int memberPostsPerPage = 10;

    private int hourOffset = 0;

    /* private DateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
     * Igor: previous line should be: new SimpleDateFormat(..., Locale.US)
     * Otherwise won't work for users who don't have en/US as default.
     */
    private DateFormat timestampFormatter = null;
    private DateFormat dateFormatter = null;

    private Timestamp lastLogonTimestamp = null;

    private String localeName = "";

    private Locale locale = null;

    private boolean gender = true;

    private ImageCaptcha imageCaptcha = null;

    /**
     * default access constructor, prevent outsite creation
     */
    OnlineUserImpl() {
    }

    public int getMemberID() {
        return memberID;
    }

    public String getMemberName() {
        return memberName;
    }

    public boolean isGuest() {
        return ( (memberID==0) || (memberID==MVNForumConstant.MEMBER_ID_OF_GUEST) );
    }

    public boolean isMember() {
        return !isGuest();
    }

    public boolean isInvisibleMember() {
        // @todo: temp implementation
        return false;
    }

    public int getAuthenticationType() {
        return authenticationType;
    }

    public MVNForumPermission getPermission() {
        return permission;
    }

    public void reloadPermission() {
        try {
            if (isGuest()) {
                permission = MVNForumPermissionFactory.getAnonymousPermission();
            } else {
                permission = MVNForumPermissionFactory.getAuthenticatedPermission(memberID);
            }
        } catch (Exception ex) {
            log.error("Error when reload permission in OnlineUserImpl for memberID = " + memberID , ex);
        }
    }

    public void reloadProfile() {
        try {
            if (isGuest()) {
                // currently just do nothing, implement later
            } else {
                MemberBean memberBean = DAOFactory.getMemberDAO().getMember_forViewCurrentMember(memberID);

                int timeZone = memberBean.getMemberTimeZone();
                localeName = memberBean.getMemberLanguage();
                int postsPerPage = memberBean.getMemberPostsPerPage();

                setTimeZone(timeZone);
                setLocaleName(localeName);
                setGender(memberBean.getMemberGender() != 0);
                setPostsPerPage(postsPerPage);
            }
        } catch (Exception ex) {
            log.error("Error when reload profile in OnlineUserImpl for memberID = " + memberID , ex);
        }
    }

    public OnlineUserAction getOnlineUserAction() {
        return onlineUserAction;
    }

    public java.util.Date convertGMTDate(java.util.Date gmtDate) {
        return DateUtil.convertGMTDate(gmtDate, hourOffset);
    }

    public Timestamp convertGMTTimestamp(Timestamp gmtTimestamp) {
        return DateUtil.convertGMTTimestamp(gmtTimestamp, hourOffset);
    }

    public String getGMTDateFormat(java.util.Date gmtDate) {
       return getGMTDateFormat(gmtDate, true);
    }

    public String getGMTDateFormat(java.util.Date gmtDate, boolean adjustTimeZone) {
        if (gmtDate == null) return "";

        java.util.Date date = gmtDate;
        if (adjustTimeZone) {
            date = DateUtil.convertGMTDate(gmtDate, hourOffset);
        }
        return dateFormatter.format(date);
    }

    public String getGMTTimestampFormat(Timestamp gmtTimestamp) {
       return getGMTTimestampFormat(gmtTimestamp, true);
    }

    public String getGMTTimestampFormat(Timestamp gmtTimestamp, boolean adjustTimeZone) {
        if (gmtTimestamp == null) return "";

        Timestamp timestamp = gmtTimestamp;
        if (adjustTimeZone) {
            timestamp = DateUtil.convertGMTTimestamp(gmtTimestamp, hourOffset);
        }
        return timestampFormatter.format(timestamp);
    }

    public String getLocaleName() {
        return localeName;
    }

    public Locale getLocale() {
        return locale;
    }

    public Timestamp getLastLogonTimestamp() {
        return lastLogonTimestamp;
    }

    public boolean getGender() {
        return gender;
    }

    public int getPostsPerPage() {
        return memberPostsPerPage;
    }

    /**
     * Build a new captcha, this method must be called before using some
     * action that need captcha validation.
     */
    public void buildNewCaptcha() {
        destroyCurrentCaptcha();

        // this line of code could throw Exception in case the captcha image
        // is small to hold the whole captcha
        imageCaptcha = MVNCaptchaService.getInstance().getNextImageCaptcha();
    }

    /**
     * Destroy the current captcha, this method must be called after validate
     * the captcha
     */
    public void destroyCurrentCaptcha() {
        imageCaptcha = null;
    }

    /**
     * Get the captcha image to challenge the user
     *
     * @return BufferedImage the captcha image to challenge the user
     */
    public BufferedImage getCurrentCaptchaImage() {
        if (imageCaptcha == null) {
            return null;
        }
        return (BufferedImage)(imageCaptcha.getChallenge());
    }

    /**
     * Validate the anwser of the captcha from user
     *
     * @param anwser String the captcha anwser from user
     * @return boolean true if the answer is valid, otherwise return false
     */
    public boolean validateCaptchaResponse(String anwser) {
        if (imageCaptcha == null) {
            return false;
        }
        anwser = anwser.toUpperCase();//use upper case for easier usage
        return (imageCaptcha.validateResponse(anwser)).booleanValue();
    }

    /**
     * Check to make sure that the captcha answer is correct
     *
     * @param answer String the captcha answer to check
     * @throws BadInputException in case the captcha answer is not correct
     */
    public void ensureCorrectCaptchaResponse(String answer)
        throws BadInputException {

        if (validateCaptchaResponse(answer) == false) {
            throw new BadInputException("You have entered the wrong CAPTCHA response. Cannot proceed.");
        }
    }

/*****************************************************************
 * Default-scope methods, only for internal package usage
 *****************************************************************/
    void setMemberID(int memberID) {
        if (memberID == 0) {
            this.memberID = MVNForumConstant.MEMBER_ID_OF_GUEST;
        } else {
            this.memberID = memberID;
        }
        onlineUserAction.setMemberID(this.memberID);

    }

    void setMemberName(String memberName) {
        this.memberName = memberName;
        onlineUserAction.setMemberName(memberName);
    }

    void setAuthenticationType(int authType) {
        authenticationType = authType;
    }

    /**
     * NOTE: this method SHOULD ONLY BE CALLED from OnlineUserFactory
     */
    void setPermission(MVNForumPermission permission) {
        this.permission = permission;
    }

    void setTimeZone(int timeZone) {
        if ( (timeZone >= -12) && (timeZone <= 12) ) {
            this.hourOffset = timeZone;
        }
    }

    void setLocaleName(String localeName) {
        this.localeName = localeName;

        if (localeName.length() == 0) {
            locale = MVNForumConfig.getDefaultLocale();
        } else {
            locale = MyUtil.getLocale(localeName);
        }

        // now init the 2 class variables
        dateFormatter = DateFormat.getDateInstance(DateFormat.DEFAULT, locale);
        timestampFormatter = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, locale);
    }

    void setLastLogonTimestamp(Timestamp lastLogon) {
        lastLogonTimestamp = lastLogon;
    }

    void setGender(boolean gender) {
        this.gender = gender;
    }

    void setPostsPerPage(int postsPerPage) {
        if (postsPerPage < 5) {
            postsPerPage = 5;
        }
        this.memberPostsPerPage = postsPerPage;
    }
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品美女久久久久久2018| 在线中文字幕不卡| 91 com成人网| 五月天一区二区| 欧美在线免费观看亚洲| 亚洲激情自拍视频| 欧美日韩国产一二三| 亚洲444eee在线观看| 欧美一区二区在线观看| 久久福利资源站| 久久午夜色播影院免费高清| 国模大尺度一区二区三区| 久久一留热品黄| 成人黄色a**站在线观看| 国产精品久久久久久久岛一牛影视 | 精品在线视频一区| 国产日韩欧美一区二区三区综合| 丰满白嫩尤物一区二区| 亚洲欧美视频在线观看| 欧美日韩成人一区| 韩国女主播一区| 亚洲人成伊人成综合网小说| 在线观看亚洲一区| 久久精品国产99国产精品| 国产精品丝袜在线| 在线播放日韩导航| 国产精品一色哟哟哟| 亚洲图片欧美综合| 国产亚洲成av人在线观看导航 | 91久久人澡人人添人人爽欧美 | 久久er精品视频| 中文字幕免费一区| 欧美日韩精品系列| 国产成+人+日韩+欧美+亚洲| 亚洲男帅同性gay1069| 精品少妇一区二区三区| 99久久精品情趣| 麻豆视频一区二区| 亚洲精品国久久99热| 亚洲精品一区二区三区精华液| 91麻豆成人久久精品二区三区| 人人精品人人爱| 一区二区三区资源| 久久精品水蜜桃av综合天堂| 欧美精品 日韩| 91理论电影在线观看| 激情图区综合网| 亚洲第四色夜色| 中文字幕一区二区三区蜜月| 一区二区理论电影在线观看| 精品国产青草久久久久福利| 欧美性色欧美a在线播放| 国产精品亚洲成人| 免费精品视频在线| 午夜精品久久久久久久蜜桃app| 国产欧美一区二区精品仙草咪| 91精品蜜臀在线一区尤物| 99精品热视频| 国产另类ts人妖一区二区| 日韩电影在线看| 亚洲成av人影院| 亚洲影视资源网| 亚洲欧美日韩系列| 国产精品成人在线观看| 久久久久久久久伊人| 精品久久人人做人人爱| 欧美变态tickling挠脚心| 欧美欧美午夜aⅴ在线观看| 在线日韩一区二区| 91亚洲国产成人精品一区二三| 国产精品1区二区.| 国产精品一区二区91| 精彩视频一区二区| 激情综合五月天| 国产一区二区三区免费看| 久久99久久久欧美国产| 日韩成人免费在线| 免费一级片91| 精品在线亚洲视频| 国产盗摄一区二区三区| 国产精品一线二线三线| 国产精品99久久久久久久vr| 国产精品456| 97se亚洲国产综合在线| 成人av电影免费在线播放| av电影在线观看不卡| 91视频91自| 欧美三级三级三级| 91精品国产综合久久福利软件| 337p亚洲精品色噜噜狠狠| 日韩欧美另类在线| 精品福利一二区| 欧美国产日韩一二三区| 亚洲日本电影在线| 亚洲成人一区在线| 韩国av一区二区三区| 成人午夜免费电影| 91福利视频在线| 欧美日韩成人一区二区| 精品精品欲导航| 国产精品天天摸av网| 亚洲精品你懂的| 秋霞影院一区二区| 国产白丝网站精品污在线入口| 91亚洲大成网污www| 欧美日韩午夜影院| 精品精品国产高清a毛片牛牛| 日本一区二区三区视频视频| 亚洲美女淫视频| 麻豆久久久久久| 成人国产电影网| 欧美日韩国产一级| 欧美国产激情一区二区三区蜜月| 亚洲精品日日夜夜| 国产精品一区二区久激情瑜伽| 97久久久精品综合88久久| 在线成人免费视频| 国产精品三级久久久久三级| 一区二区国产盗摄色噜噜| 激情亚洲综合在线| 91福利视频久久久久| 欧美电视剧在线看免费| 成人欧美一区二区三区白人 | 日本成人在线不卡视频| 国产精品一区免费视频| 欧美视频一区二| 日本一区二区三区视频视频| 丝袜美腿亚洲一区二区图片| 成人av在线资源网站| 日韩一区国产二区欧美三区| 最新成人av在线| 国内偷窥港台综合视频在线播放| 色综合久久久久综合体| 久久亚洲欧美国产精品乐播 | 精品一二线国产| 欧美日韩国产123区| 亚洲欧美在线另类| 国产一区二区主播在线| 69堂国产成人免费视频| 亚洲人成人一区二区在线观看| 黑人巨大精品欧美黑白配亚洲| 欧美性大战久久久久久久蜜臀| 日本一区二区视频在线| 久久成人免费日本黄色| 欧美精品丝袜中出| 亚洲精品国产第一综合99久久| 国产91丝袜在线播放0| 欧美成人a视频| 日韩综合小视频| 欧美视频自拍偷拍| 亚洲综合一二三区| 91老司机福利 在线| **网站欧美大片在线观看| 国产盗摄一区二区| 国产日韩欧美激情| 国产麻豆91精品| 2021中文字幕一区亚洲| 加勒比av一区二区| 精品粉嫩aⅴ一区二区三区四区| 丝袜国产日韩另类美女| 欧美人妇做爰xxxⅹ性高电影| 亚洲精品五月天| 色狠狠色噜噜噜综合网| 亚洲裸体xxx| 91成人在线观看喷潮| 亚洲小说春色综合另类电影| 日本韩国欧美在线| 夜夜亚洲天天久久| 欧美性三三影院| 日韩高清在线一区| 日韩精品一区二区三区视频在线观看| 丝袜a∨在线一区二区三区不卡| 精品视频全国免费看| 午夜av一区二区| 欧美一区二区性放荡片| 久久国产日韩欧美精品| 欧美精品一区二区在线播放| 国产中文字幕一区| 国产嫩草影院久久久久| 91在线丨porny丨国产| 亚洲精品国久久99热| 欧美日韩国产精选| 蜜臀va亚洲va欧美va天堂| 久久亚洲精品小早川怜子| 国产ts人妖一区二区| 亚洲图片激情小说| 欧美日韩国产综合草草| 国产一区在线不卡| 国产精品青草久久| 在线观看成人小视频| 日本不卡123| 欧美精品一区二区三区蜜桃视频| 国产一区二区电影| 亚洲黄色性网站| 精品三级av在线| 成人精品国产免费网站| 亚洲精品高清在线| 这里只有精品免费| 国产精品亚洲一区二区三区妖精| 亚洲摸摸操操av|