Exemple #1
0
 internal static void MapShortUserInfo(IRecord record, DiscuzShortUserInfo userinfo)
 {
     int offset = 0;
     userinfo.Uid = record.GetInt32(offset++);// Int32.Parse(reader["uid"].ToString());
     userinfo.Username = record.GetStringOrEmpty(offset++);// reader["username"].ToString();
     userinfo.Nickname = record.GetStringOrEmpty(offset++);//reader["nickname"].ToString();
     userinfo.Password = record.GetStringOrEmpty(offset++);//reader["password"].ToString();
     userinfo.Secques = record.GetStringOrEmpty(offset++);//reader["secques"].ToString();
     userinfo.Gender = record.GetInt32OrDefault(offset++, 0);// Int32.Parse(reader["gender"].ToString());
     userinfo.Adminid = record.GetInt32OrDefault(offset++, 0);// Int32.Parse(reader["adminid"].ToString());
     userinfo.Groupid = record.GetInt16OrDefault(offset++, 0);// Int16.Parse(reader["groupid"].ToString());
     userinfo.Groupexpiry = record.GetInt32OrDefault(offset++, 0);//  Int32.Parse(reader["groupexpiry"].ToString());
     userinfo.Extgroupids = record.GetStringOrEmpty(offset++);// reader["extgroupids"].ToString();
     userinfo.Regip = record.GetStringOrEmpty(offset++);// reader["regip"].ToString();
     userinfo.Joindate = record.GetDateTimeOrEmpty(offset++);// reader["joindate"].ToString();
     userinfo.Lastip = record.GetStringOrEmpty(offset++);// reader["lastip"].ToString();
     userinfo.Lastvisit = record.GetDateTimeOrEmpty(offset++);//reader["lastvisit"].ToString();
     userinfo.Lastactivity = record.GetDateTimeOrEmpty(offset++);//reader["lastactivity"].ToString();
     userinfo.Lastpost = record.GetDateTimeOrEmpty(offset++);//reader["lastpost"].ToString();
     userinfo.Lastpostid = record.GetInt32OrDefault(offset++, 0);// Int32.Parse(reader["lastpostid"].ToString());
     userinfo.Lastposttitle = record.GetStringOrEmpty(offset++);// reader["lastposttitle"].ToString();
     userinfo.Posts = record.GetInt32OrDefault(offset++, 0);// Int32.Parse(reader["posts"].ToString());
     userinfo.Digestposts = record.GetInt16OrDefault(offset++, 0);//Int16.Parse(reader["digestposts"].ToString());
     userinfo.Oltime = record.GetInt32OrDefault(offset++, 0);// Int32.Parse(reader["oltime"].ToString());
     userinfo.Pageviews = record.GetInt32OrDefault(offset++, 0);// Int32.Parse(reader["pageviews"].ToString());
     userinfo.Credits = record.GetDecimal(offset++); //Int32.Parse(reader["credits"].ToString());
     userinfo.Extcredits1 = record.GetDecimal(offset++);// float.Parse(reader["extcredits1"].ToString());
     userinfo.Extcredits2 = record.GetDecimal(offset++);//float.Parse(reader["extcredits2"].ToString());
     userinfo.Extcredits3 = record.GetDecimal(offset++);//float.Parse(reader["extcredits3"].ToString());
     userinfo.Extcredits4 = record.GetDecimal(offset++);//float.Parse(reader["extcredits4"].ToString());
     userinfo.Extcredits5 = record.GetDecimal(offset++);//float.Parse(reader["extcredits5"].ToString());
     userinfo.Extcredits6 = record.GetDecimal(offset++);//float.Parse(reader["extcredits6"].ToString());
     userinfo.Extcredits7 = record.GetDecimal(offset++);//float.Parse(reader["extcredits7"].ToString());
     userinfo.Extcredits8 = record.GetDecimal(offset++);// float.Parse(reader["extcredits8"].ToString());
     userinfo.Avatarshowid = record.GetInt32OrDefault(offset++, 0); //Int32.Parse(reader["avatarshowid"].ToString());
     userinfo.Email = record.GetStringOrEmpty(offset++);// reader["email"].ToString();
     userinfo.Bday = record.GetStringOrEmpty(offset++);// reader["bday"].ToString();
     userinfo.Sigstatus = record.GetInt32OrDefault(offset++, 0); //Int32.Parse(reader["sigstatus"].ToString());
     userinfo.Tpp = record.GetInt32OrDefault(offset++, 0); //Int32.Parse(reader["tpp"].ToString());
     userinfo.Ppp = record.GetInt32OrDefault(offset++, 0); //Int32.Parse(reader["ppp"].ToString());
     userinfo.Templateid = record.GetInt16OrDefault(offset++, 0); // Int16.Parse(reader["templateid"].ToString());
     userinfo.Pmsound = record.GetInt32OrDefault(offset++, 0); //Int32.Parse(reader["pmsound"].ToString());
     userinfo.Showemail = record.GetInt32OrDefault(offset++, 0); //Int32.Parse(reader["showemail"].ToString());
     userinfo.Invisible = record.GetInt32OrDefault(offset++, 0); // Int32.Parse(reader["invisible"].ToString());
     userinfo.Newpm = record.GetInt32OrDefault(offset++, 0); //Int32.Parse(reader["newpm"].ToString());
     userinfo.Newpmcount = record.GetInt32OrDefault(offset++, 0); //Int32.Parse(reader["newpmcount"].ToString());
     userinfo.Accessmasks = record.GetInt32OrDefault(offset++, 0); //Int32.Parse(reader["accessmasks"].ToString());
     userinfo.Onlinestate = record.GetInt32OrDefault(offset++, 0); //Int32.Parse(reader["onlinestate"].ToString());
     userinfo.Spaceid = record.GetInt32OrDefault(offset++, 0);// Int32.Parse(reader["spaceid"].ToString());
     userinfo.Newsletter = record.GetInt32OrDefault(offset++, 0); //(ReceivePMSettingType)Int32.Parse(reader["newsletter"].ToString());
 }
Exemple #2
0
 /// <summary>
 /// 写论坛登录用户的cookie
 /// </summary>
 /// <param name="userinfo">用户信息</param>
 /// <param name="expires">cookie有效期</param>
 /// <param name="passwordkey">用户密码Key</param>
 public static void WriteUserCookie(DiscuzShortUserInfo userinfo, int expires, string passwordkey)
 {
     WriteUserCookie(userinfo, expires, passwordkey, 0, -1);
 }
Exemple #3
0
        internal static DiscuzShortUserInfo GetShortUserInfo(int uid)
        {
            DiscuzShortUserInfo m = new DiscuzShortUserInfo();

            if (uid > 0)
            {
                m.Uid = uid;
                SafeProcedure.ExecuteAndMapRecords(
                        Database.GetDatabase(D4DDefine.JaneBBSDBInstanceName),
                     "newbbs.dnt_getshortuserinfo",
                     delegate(IRecord record)
                     {
                         MapShortUserInfo(record, m);
                     },
                     uid);
            }
            return m;
        }
Exemple #4
0
        /// <summary>
        /// 写论坛登录用户的cookie
        /// </summary>
        /// <param name="userinfo">用户信息</param>
        /// <param name="expires">cookie有效期</param>
        /// <param name="passwordkey">用户密码Key</param>
        /// <param name="templateid">用户当前要使用的界面风格</param>
        /// <param name="invisible">用户当前的登录模式(正常或隐身)</param>
        public static void WriteUserCookie(DiscuzShortUserInfo userinfo, 
            int expires, string passwordkey, int templateid, int invisible)
        {
            if (userinfo == null)
            {
                return;
            }
            HttpCookie cookie = new HttpCookie("dnt");
            cookie.Values["userid"] = userinfo.Uid.ToString();
            cookie.Values["password"] = Utils.UrlEncode(SetCookiePassword(userinfo.Password, passwordkey));
            //if (Templates.GetTemplateItem(templateid) == null)
            //{
            //    templateid = 0;

            //    foreach (string strTemplateid in Utils.SplitString(Templates.GetValidTemplateIDList(), ","))
            //    {

            //        if (strTemplateid.Equals(userinfo.Templateid.ToString()))
            //        {
            //            templateid = userinfo.Templateid;
            //            break;
            //        }
            //    }
            //}
            //remark here is avatar use?
            //cookie.Values["avatar"] = Utils.UrlEncode(userinfo.Avatar.ToString());
            cookie.Values["tpp"] = userinfo.Tpp.ToString();
            cookie.Values["ppp"] = userinfo.Ppp.ToString();
            cookie.Values["pmsound"] = userinfo.Pmsound.ToString();
            if (invisible != 0 || invisible != 1)
            {
                invisible = userinfo.Invisible;
            }
            cookie.Values["invisible"] = invisible.ToString();

            cookie.Values["referer"] = "index.aspx";
            cookie.Values["sigstatus"] = userinfo.Sigstatus.ToString();
            cookie.Values["expires"] = expires.ToString();
            if (expires > 0)
            {
                cookie.Expires = DateTime.Now.AddMinutes(expires);
            }
            string cookieDomain = GetCookieDomain(); ;
            if (cookieDomain != string.Empty &&
                HttpContext.Current.Request.Url.Host.IndexOf(cookieDomain) > -1 &&
                IsValidDomain(HttpContext.Current.Request.Url.Host))
            {
                cookie.Domain = cookieDomain;
            }

            HttpContext.Current.Response.AppendCookie(cookie);
            //if (templateid > 0)
            //{
            //    Utils.WriteCookie(Utils.GetTemplateCookieName(), templateid.ToString(), 999999);
            //}
            //SetCookieExpires(expires);
        }