示例#1
0
        protected override void Page_Show()
        {
            int articleid = YRequest.GetQueryInt("id", 1);

            articleinfo = Articles.GetArticleInfo(articleid);
            if (articleinfo == null)
            {
                ShowError("查看文章", "错误,不存在的文章!", "", "");
            }
            pagetitle = string.Format("{0} - {1}", Natsuhime.Web.Utils.RemoveHtml(articleinfo.Title), articleinfo.Columnname);

            int commentpageid = YRequest.GetQueryInt("commentpageid", 1);

            commentlist = Comments.GetCommentCollection(articleid, 8, commentpageid);
            int commentpagecount = Comments.GetCommentCollectionPageCount(articleid, 8);

            commentcounthtml = config.Urlrewrite == 1 ? Natsuhime.Web.Utils.GetStaticPageNumbersHtml(commentpageid, commentpagecount, string.Format("showarticle-{0}", articleid), ".aspx", 8) : Utils.GetPageNumbersHtml(commentpageid, commentpagecount, string.Format("showarticle.aspx?id={0}", articleid), 8, "commentpageid", "");
        }
示例#2
0
        protected override void Page_Show()
        {
            UserInfo userinfo = GetUserInfo();

            if (userinfo == null)
            {
                ShowError("站内搜索", "请登录后再搜索文章,谢谢~", "", "login.aspx");
            }
            string searchkey = YRequest.GetQueryString("searchkey");

            if (searchkey != string.Empty && Natsuhime.Common.Utils.IsSafeSqlString(searchkey))
            {
                int pageid = YRequest.GetQueryInt("pageid", 1);
                int pagecount;
                pagecount        = Articles.GetSearchArticleCollectionPageCount(searchkey, 12);
                searchresultlist = Articles.GetSearchArticles(searchkey, 12, pageid);
                pagecounthtml    = config.Urlrewrite == 1 ? Natsuhime.Web.Utils.GetStaticPageNumbersHtml(pageid, pagecount, string.Format("search-{0}", searchkey), ".aspx", 8) : Utils.GetPageNumbersHtml(pageid, pagecount, string.Format("search.aspx?searchkey={0}", searchkey), 8, "pageid", "");
            }
            else
            {
                ShowError("站内搜索", "参数异常!", "", "");
            }
        }
示例#3
0
        protected override void Page_Show()
        {
            UserInfo userinfo = GetUserInfo();

            if (userinfo == null)
            {
                ShowError("评论信息", "请登录后再留言评论.", "", "login.aspx");
            }
            string action = YRequest.GetQueryString("action");

            if (action == string.Empty)
            {
                currentcontext.Response.End();
            }
            if (action == "postcomment")
            {
                string content   = YRequest.GetFormString("commentcontent");
                int    articleid = YRequest.GetQueryInt("articleid", 0);
                if (content != string.Empty && articleid > 0)
                {
                    if (content != string.Empty)
                    {
                        CommentInfo info = new CommentInfo();
                        info.Articleid    = articleid;
                        info.Uid          = userinfo.Uid;
                        info.Username     = userinfo.Username;
                        info.Postdate     = DateTime.Now.ToString();
                        info.Del          = 0;
                        info.Content      = Utils.RemoveUnsafeHtml(content);
                        info.Goodcount    = 0;
                        info.Badcount     = 0;
                        info.Articletitle = Articles.GetArticleInfo(articleid).Title;
                        Comments.CreateComment(info);
                        Articles.ChangeCommentCount(articleid, 1, 1);
                        Articles.RemoveArtilceCache();
                        currentcontext.Response.Redirect(YRequest.GetUrlReferrer());
                    }
                }
                else
                {
                    currentcontext.Response.Write("参数为空.");
                    currentcontext.Response.End();
                    return;
                }
            }
            else if (action == "grade")
            {
                int commentid = YRequest.GetQueryInt("commentid", 0);
                if (commentid > 0)
                {
                    int type = YRequest.GetQueryInt("type", 0);
                    Comments.GradeComment(commentid, type);
                    Articles.RemoveArtilceCache();
                    currentcontext.Response.Redirect(YRequest.GetUrlReferrer());
                }
                else
                {
                    ShowError("评论信息", "参数为空,请检查输入!", "", "");
                }
            }
            else if (action == "del")
            {
                int commentid = YRequest.GetQueryInt("commentid", 0);
                if (commentid > 0)
                {
                    CommentInfo info = Comments.GetCommentInfo(commentid);
                    Comments.DeleteComment(info.Commentid);
                    Articles.ChangeCommentCount(info.Articleid, 1, -1);
                    Articles.RemoveArtilceCache();
                    currentcontext.Response.Redirect(YRequest.GetUrlReferrer());
                }
                else
                {
                    ShowError("评论信息", "参数为空,请检查输入!", "", "");
                }
            }
            else
            {
                ShowError("评论信息", "非法的参数!", "", "");
            }
        }