コード例 #1
0
ファイル: CommentHandler.cs プロジェクト: Earlz/earlzdotnet
        public IBarelyView New(string entryid, CommentData post)
        {
            if (Form["Link"] != "")
            {
                return(null);
            }
            post.Name      = post.Name.Substring(0, Math.Min(post.Name.Length, 32));
            post.Text      = post.Text.Substring(0, Math.Min(post.Text.Length, 1024));
            post.IPAddress = Request.UserHostAddress;
            post.UserAgent = Request.UserAgent;
            post.Text      = CheckLines(post.Text);
            if (post.Text == "OOONNNNYYYYTTTTIIIII")
            {
                throw new HttpException(500, "F**k you.");
            }
            BlogEntryData entry = BlogEntryData.Get(entryid);

            if (entry == null)
            {
                throw new HttpException(404, "Blog entry not found");
            }
            post.EntryID = entry.ID;
            post.Posted  = DateTime.Now;
            post.Save();
            BlogEntryData.RecalculateComments(entry.ID);
            Response.Redirect(BlogHandler.GetUrl(entry));
            return(null);
        }
コード例 #2
0
ファイル: CommentHandler.cs プロジェクト: Earlz/earlzdotnet
 public IBarelyView New(string entryid, CommentData post)
 {
     if(Form["Link"]!=""){
         return null;
     }
     post.Name=post.Name.Substring(0,Math.Min(post.Name.Length,32));
     post.Text=post.Text.Substring(0,Math.Min(post.Text.Length,1024));
     post.IPAddress=Request.UserHostAddress;
     post.UserAgent=Request.UserAgent;
     post.Text=CheckLines(post.Text);
     if(post.Text=="OOONNNNYYYYTTTTIIIII")
     {
         throw new HttpException(500, "F**k you.");
     }
     BlogEntryData entry=BlogEntryData.Get(entryid);
     if(entry==null)
     {
         throw new HttpException(404, "Blog entry not found");
     }
     post.EntryID=entry.ID;
     post.Posted=DateTime.Now;
     post.Save();
     BlogEntryData.RecalculateComments(entry.ID);
     Response.Redirect(BlogHandler.GetUrl(entry));
     return null;
 }