Beispiel #1
0
        public static SpaceLinkInfo GetSpaceLinksInfo(IDataReader idatareader)
        {
            if (idatareader == null)
            {
                return(null);
            }

            if (idatareader.Read())
            {
                SpaceLinkInfo spacelinksinfo = new SpaceLinkInfo();
                spacelinksinfo.LinkId      = TypeConverter.ObjectToInt(idatareader["linkid"]);
                spacelinksinfo.UserId      = TypeConverter.ObjectToInt(idatareader["userid"]);
                spacelinksinfo.LinkTitle   = idatareader["linktitle"].ToString();
                spacelinksinfo.Description = idatareader["description"].ToString();
                spacelinksinfo.LinkUrl     = idatareader["linkurl"].ToString();

                idatareader.Close();
                return(spacelinksinfo);
            }
            else
            {
                idatareader.Close();
                return(null);
            }
        }
Beispiel #2
0
        public static SpaceLinkInfo[] GetSpaceLinksInfo(DataTable dt)
        {
            if (dt == null || dt.Rows.Count == 0)
            {
                return(null);
            }

            SpaceLinkInfo[] spacelinksinfoarray = new SpaceLinkInfo[dt.Rows.Count];
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                spacelinksinfoarray[i]             = new SpaceLinkInfo();
                spacelinksinfoarray[i].LinkId      = TypeConverter.ObjectToInt(dt.Rows[i]["linkid"]);
                spacelinksinfoarray[i].UserId      = TypeConverter.ObjectToInt(dt.Rows[i]["userid"]);
                spacelinksinfoarray[i].LinkTitle   = dt.Rows[i]["linktitle"].ToString();
                spacelinksinfoarray[i].Description = dt.Rows[i]["description"].ToString();
                spacelinksinfoarray[i].LinkUrl     = dt.Rows[i]["linkurl"].ToString();
            }
            dt.Dispose();
            return(spacelinksinfoarray);
        }
        protected override void ShowPage()
        {
            pagetitle = "用户控制面板";

            if (userid == -1)
            {
                AddErrLine("你尚未登录");
                return;
            }
            user = Users.GetUserInfo(userid);
            if (config.Enablespace != 1)
            {
                AddErrLine("个人空间功能已被关闭");
                return;
            }

            if (user.Spaceid <= 0)
            {
                AddErrLine("您尚未开通个人空间");
                return;
            }

            if (DNTRequest.IsPost())
            {
                if (ForumUtils.IsCrossSitePost())
                {
                    AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。");
                    return;
                }

                string linktitle = DNTRequest.GetHtmlEncodeString("linktitle");
                if ((linktitle.Length > 50) || (linktitle == ""))
                {
                    AddErrLine("链接标题不得超过50个字符且不能为空");
                    return;
                }

                string linkurl = DNTRequest.GetHtmlEncodeString("linkurl");
                if ((linkurl.Length > 255) || (linkurl == ""))
                {
                    AddErrLine("链接地址不得超过255个字符且不能为空");
                    return;
                }

                if (DNTRequest.GetString("description").Length > 200)
                {
                    AddErrLine("链接描述不得超过200个字符");
                    return;
                }

                string        errorinfo       = "";
                SpaceLinkInfo __spacelinkinfo = new SpaceLinkInfo();
                __spacelinkinfo.UserId      = userid;
                __spacelinkinfo.LinkTitle   = linktitle;
                __spacelinkinfo.LinkUrl     = linkurl;
                __spacelinkinfo.Description = DNTRequest.GetHtmlEncodeString("description");

                Space.Data.DbProvider.GetInstance().AddSpaceLink(__spacelinkinfo);

                if (errorinfo == "")
                {
                    SetUrl("usercpspacelinklist.aspx");
                    SetMetaRefresh();
                    SetShowBackLink(true);
                    AddMsgLine("添加友情链接完毕");
                }
                else
                {
                    AddErrLine(errorinfo);
                    return;
                }
            }
        }