Ejemplo n.º 1
0
        protected override void ShowPage()
        {
            this.pagetitle = "撰写短消息";
            if (!base.IsLogin())
            {
                return;
            }
            if (!this.CheckPermission())
            {
                return;
            }
            if (DNTRequest.IsPost() && !ForumUtils.IsCrossSitePost())
            {
                if (!this.CheckPermissionAfterPost())
                {
                    return;
                }
                this.SendPM();
                if (base.IsErr())
                {
                    return;
                }
            }
            var    shortUserInfo = BBX.Entity.User.FindByID(this.msgtoid);
            string text          = (shortUserInfo != null) ? shortUserInfo.Name : "";

            this.msgto = ((this.msgtoid > 0) ? text : this.msgto);
            string text2 = DNTRequest.GetQueryString("action").ToLower();

            if ((text2.CompareTo("re") == 0 || text2.CompareTo("fw") == 0) && DNTRequest.GetQueryInt("pmid", -1) != -1)
            {
                var msg = ShortMessage.FindByID(DNTRequest.GetQueryInt("pmid", -1));
                if (msg != null && (msg.MsgtoID == userid || msg.MsgfromID == userid))
                {
                    this.msgto   = ((text2.CompareTo("re") == 0) ? Utils.HtmlEncode(msg.Msgfrom) : "");
                    this.subject = Utils.HtmlEncode(text2) + ":" + msg.Subject;
                    this.message = Utils.HtmlEncode("> ") + msg.Message.Replace("\n", "\n> ") + "\r\n\r\n";
                }
            }
            if (DNTRequest.GetString("operation") == "pmfriend")
            {
                this.CreatePmFriendMessage();
            }
            this.newnoticecount = Notice.GetNewNoticeCountByUid(this.userid);
        }
Ejemplo n.º 2
0
        protected override void ShowPage()
        {
            if (!base.IsLogin())
            {
                return;
            }
            this.pagetitle = "查看短消息";
            if (this.pmid <= 0)
            {
                base.AddErrLine("参数无效");
                return;
            }
            if (!CreditsFacade.IsEnoughCreditsPM(this.userid))
            {
                this.canreplypm = false;
            }
            var msg = ShortMessage.FindByID(this.pmid);

            if (msg == null)
            {
                base.AddErrLine("无效的短消息ID");
                return;
            }
            if (msg.Msgfrom == "系统" && msg.MsgfromID == 0)
            {
                msg.Message = Utils.HtmlDecode(msg.Message);
            }
            if (msg == null || (msg.MsgtoID != this.userid && msg.MsgfromID != this.userid))
            {
                base.AddErrLine("对不起, 短消息不存在或已被删除.");
                this.newnoticecount = Notice.GetNewNoticeCountByUid(this.userid);
                return;
            }
            if (DNTRequest.GetQueryString("action").CompareTo("delete") != 0)
            {
                if (DNTRequest.GetQueryString("action").CompareTo("noread") == 0)
                {
                    //PrivateMessages.SetPrivateMessageState(this.pmid, 1);
                    msg.New = true;
                    msg.Update();
                    this.ispost = true;
                    if (!msg.New && msg.Folder == 0)
                    {
                        Users.UpdateUserNewPMCount(this.userid, this.olid);
                        base.AddMsgLine("指定消息已被置成未读状态,现在将转入消息列表");
                        base.SetUrl("usercpinbox.aspx");
                        base.SetMetaRefresh();
                    }
                }
                else
                {
                    //PrivateMessages.SetPrivateMessageState(this.pmid, 0);
                    msg.New = false;
                    msg.Update();

                    if (msg.New && msg.Folder == 0)
                    {
                        Users.UpdateUserNewPMCount(this.userid, this.olid);
                    }
                }
                this.msgto        = ((msg.Folder == 0) ? msg.Msgfrom : msg.Msgto);
                this.msgfrom      = msg.Msgfrom;
                this.subject      = msg.Subject;
                this.message      = UBB.ParseUrl(Utils.StrFormat(msg.Message));
                this.postdatetime = msg.PostDateTime.ToFullString();
                this.resubject    = "re:" + msg.Subject;
                this.remessage    = Utils.HtmlEncode("> ") + msg.Message.Replace("\n", "\n> ") + "\r\n\r\n";
                return;
            }
            this.ispost = true;
            msg.Delete();
            //if (ShortMessage.DeletePrivateMessage(this.userid, pmid + "") < 1)
            //{
            //    base.AddErrLine("消息未找到,可能已被删除");
            //    return;
            //}
            base.AddMsgLine("指定消息成功删除,现在将转入消息列表");
            base.SetUrl("usercpinbox.aspx");
            base.SetMetaRefresh();
        }