惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Troy Hunt's Blog
Scott Helme
Scott Helme
T
Threat Research - Cisco Blogs
T
Tenable Blog
L
LINUX DO - 热门话题
V
Visual Studio Blog
I
Intezer
Blog — PlanetScale
Blog — PlanetScale
Cisco Talos Blog
Cisco Talos Blog
A
Arctic Wolf
C
Cyber Attacks, Cyber Crime and Cyber Security
F
Fortinet All Blogs
aimingoo的专栏
aimingoo的专栏
Know Your Adversary
Know Your Adversary
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
N
Netflix TechBlog - Medium
SecWiki News
SecWiki News
I
InfoQ
Microsoft Security Blog
Microsoft Security Blog
Project Zero
Project Zero
W
WeLiveSecurity
Microsoft Azure Blog
Microsoft Azure Blog
A
About on SuperTechFans
Recorded Future
Recorded Future
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Vercel News
Vercel News
S
Securelist
Spread Privacy
Spread Privacy
L
LangChain Blog
云风的 BLOG
云风的 BLOG
G
Google Developers Blog
MongoDB | Blog
MongoDB | Blog
Google DeepMind News
Google DeepMind News
Recent Commits to openclaw:main
Recent Commits to openclaw:main
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
CERT Recently Published Vulnerability Notes
罗磊的独立博客
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
The Last Watchdog
The Last Watchdog
Attack and Defense Labs
Attack and Defense Labs
博客园 - 司徒正美
Help Net Security
Help Net Security
L
Lohrmann on Cybersecurity
人人都是产品经理
人人都是产品经理
Forbes - Security
Forbes - Security
Hacker News - Newest:
Hacker News - Newest: "LLM"
PCI Perspectives
PCI Perspectives
博客园 - 【当耐特】
T
Tor Project blog

博客园 - Chep

招聘 dotNet c# asp.net 、Windows Mobile 、iPhone 开发人员,工作地上海 iblogs博客程序1.0版 求一问题的解决方法 .TEXT 修改 二 - Chep [转载]防止盗链下载问题 微软.net精简框架常见问题及回答(中文版) 对.text的修改(1) 博客RSS 使用完全手册 主流 Blog 程序 添加 免责声明 Gif 文件格式译解 Visual Studio.Net鲜为人知的技巧 DotNet 网上资源 gif 文档 .net学习:显示/播放Gif动画 在.NET中实现彩色光标和自定义光标 创建基于 Microsoft .NET Framework 精简版的动画控件 Windows Mobile-一个新时代的开始 关于跨站验证
关于更新blog
Chep · 2005-01-19 · via 博客园 - Chep

1.数据库中运行

a.加两个表
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[blog_MailNotify]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[blog_MailNotify]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[blog_Profile]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[blog_Profile]
GO

CREATE TABLE [dbo].[blog_MailNotify] (
 [ID] [int] IDENTITY (1, 1) NOT NULL ,
 [EntryID] [int] NOT NULL ,
 [BlogID] [int] NOT NULL ,
 [SendToBlogID] [int] NOT NULL ,
 [EMail] [nvarchar] (150) COLLATE Chinese_PRC_CI_AS NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[blog_Profile] (
 [ID] [int] IDENTITY (1, 1) NOT NULL ,
 [BlogID] [int] NOT NULL ,
 [City] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY]
GO

b.修改表blog_SkinControl 加入一个 defaultview(bit)字段

c.存储过程
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[blog_GetAggregatedBloggerList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[blog_GetAggregatedBloggerList]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO

CREATE PROCEDURE blog_GetAggregatedBloggerList AS

Select BlogID From blog_config
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

2.增加
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[blog_MailNotify]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[blog_MailNotify]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[blog_MailNotify_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[blog_MailNotify_Delete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[blog_MailNotify_GetMailList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[blog_MailNotify_GetMailList]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[blog_MailNotify_Insert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[blog_MailNotify_Insert]
GO

CREATE TABLE [dbo].[blog_MailNotify] (
 [ID] [int] IDENTITY (1, 1) NOT NULL ,
 [EntryID] [int] NOT NULL ,
 [BlogID] [int] NOT NULL ,
 [SendToBlogID] [int] NOT NULL ,
 [EMail] [nvarchar] (150) COLLATE Chinese_PRC_CI_AS NOT NULL
) ON [PRIMARY]

ALTER TABLE [dbo].[blog_MailNotify] WITH NOCHECK ADD
 CONSTRAINT [PK_blog_MailNotify] PRIMARY KEY  CLUSTERED
 (
  [ID]
 )  ON [PRIMARY]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[blog_DeletePost]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[blog_DeletePost]
GO

CREATE Proc blog_DeletePost
(
 @ID int,
 @BlogID int
)
as

Declare @ParentID int, @PostType int

Insert blog_Content_Audit ([ID], [Title], [DateAdded], [SourceUrl], [PostType], [Author], [Email], [SourceName], [BlogID], [Description], [DateUpdated], [TitleUrl], [Text], [ParentID], [FeedBackCount], [PostConfig], [EntryName], [IsOriginal])
Select [ID], [Title], [DateAdded], [SourceUrl], [PostType], [Author], [Email], [SourceName], [BlogID], [Description], [DateUpdated], [TitleUrl], [Text], [ParentID], [FeedBackCount], [PostConfig], [EntryName], [IsOriginal] FROM blog_Content
Where [ID] = @ID

Select @ParentID = ParentID, @PostType = PostType From blog_Content where [ID] = @ID


if(@PostType = 8 or @PostType = 4)
Begin
 Update blog_Content
 Set FeedBackCount = FeedBackCount - 1
 where [ID] = @ParentID
 
 Delete From blog_Comment_Audit where EntryID = @ID

End
Else
Begin

 Delete from blog_MailNotify where EntryID=@ID
 Delete From blog_Comment_Audit where EntryID in (Select [ID] From blog_Content Where ParentID = @ID)
 Delete From blog_Content Where ParentID = @ID
 Delete From blog_Links where PostID = @ID
 Delete From blog_EntryViewCount where EntryID = @ID
 Delete From blog_Referrals where EntryID = @ID
End

Delete From blog_Content Where blog_Content.[ID] = @ID and blog_Content.BlogID = @BlogID


GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[blog_GenericGetEntryIDs_10]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[blog_GenericGetEntryIDs_10]
GO

CREATE PROC blog_GenericGetEntryIDs_10
(
 @ItemCount int,
 @PostType int,
 @PostConfig int,
 @BlogID int,
 @CategoryID int = null,
 @CategoryName nvarchar(100) = null,
 @StartDate datetime = null,
 @StopDate datetime = null,
 @CategoryType int = null,
 @BlogGroupID int=null,
 @Author nvarchar(100) = null
)
as

/*
 Generic Entry Collection Proc With Categories

 All possible combinations will be filter by PostTye, PostConfig, and BlogID

 # of records will be controlled rowcount

 Order of precidence:
  CategoryID
  CategoryName
  StartDate
  Default
*/
SET NOCOUNT ON
set rowcount @ItemCount
--按作者名查询
if(@Author is not null)
begin
 SELECT
   bc.[ID]
  FROM
   blog_Content bc with(nolock)
  WHERE
   bc.PostType | @PostType = @PostType
   and bc.Author = @Author
  ORDER BY
   bc.[dateadded] desc
 return
end
--用户组
if(@BlogGroupID is not null)
Begin
if(@BlogGroupID = 1000)
Begin
 SELECT
  bc.[ID]
 FROM
  blog_Content bc with(nolock)
 INNER Join blog_Comment_Audit bca on bc.ID=bca.EntryID
 WHERE
  bc.PostConfig & @PostConfig = @PostConfig
  and bc.PostType | @PostType = @PostType
  and bca.OwnerBlogID=@BlogID
 ORDER BY
  bc.[dateadded] desc
 return
End
else if(@BlogGroupID = 2000)--查询订阅的文章
Begin
 SELECT
  bc.[ID]
 FROM
  blog_Content bc
 INNER Join blog_MailNotify bmn on bc.ID=bmn.EntryID and bc.BlogID=bmn.BlogID
 WHERE
  bc.PostConfig & @PostConfig = @PostConfig
  and bc.PostType | @PostType = @PostType
  and bmn.SendToBlogID=@BlogID
 ORDER BY
  bc.[dateadded] desc
 return
End
else
Begin
 if(@StartDate is not null and @StopDate is null)
  begin
  Set @StopDate = DateAdd(day,1,@StartDate)
  
  SELECT
   bc.[ID]
  FROM
   blog_Content bc with(nolock)
   INNER JOIN blog_Links bl with(nolock) on bc.ID = bl.PostID
  WHERE
   bc.PostType | @PostType = @PostType
   and bc.BlogID in (Select BlogID from blog_UsersInGroups where GroupID=@BlogGroupID)
   and bc.DateAdded >= @StartDate and bc.DateAdded <= @StopDate
   and bl.CategoryID =808
  ORDER BY
   bc.[dateadded] desc
  end
 else
  begin
 SELECT
   bc.[ID]
  FROM
   blog_Content bc with(nolock)
   INNER JOIN blog_Links bl with(nolock) on bc.ID = bl.PostID
  WHERE
   bc.PostConfig & @PostConfig = @PostConfig
   and bc.PostType | @PostType = @PostType
   and bc.BlogID in (Select BlogID from blog_UsersInGroups where GroupID=@BlogGroupID)
   and bl.CategoryID =808
  ORDER BY
   bc.[dateadded] desc
  end
  return
End
End
--精华区
if(@CategoryType is not null)
Begin
 if(@StartDate is not null and @StopDate is null)
  begin
  Set @StopDate = DateAdd(day,1,@StartDate)
  
  SELECT
   bc.[ID]
  FROM
   blog_Content bc with(nolock)
   INNER JOIN blog_Links bl with(nolock) on bc.ID = bl.PostID
   INNER JOIN blog_LinkCategories bcat with(nolock) on bl.CategoryID = bcat.CategoryID
  WHERE
   bc.PostType | @PostType = @PostType
   and bl.CategoryID in(Select CategoryID from blog_LinkCategories where CategoryType=@CategoryType)
   and bc.DateAdded >= @StartDate and bc.DateAdded <= @StopDate
  ORDER BY
   bc.[dateadded] desc
  end
 else
  begin
 SELECT
   bc.[ID]
  FROM
   blog_Content bc with(nolock)
   INNER JOIN blog_Links bl with(nolock) on bc.ID = bl.PostID
  WHERE
   bc.PostType | @PostType = @PostType
   and bl.CategoryID in(Select CategoryID from blog_LinkCategories where CategoryType=@CategoryType)
  ORDER BY
   bc.[dateadded] desc
  end
  
  return
End


if(@BlogID is not null)
Begin
--Do we have a CategoryID?
if(@CategoryID is not null)
Begin
 --we will filter by categoryID. Should we also filter by date?
 if(@StartDate is null)
 Begin
  -- No Date Filter
  SELECT
   bc.[ID]
  FROM
   blog_Content bc with(nolock)
   INNER JOIN blog_Links bl with(nolock) on bc.ID = bl.PostID
  WHERE
   bc.BlogID = @BlogID
   and bc.PostConfig & @PostConfig = @PostConfig
   and bc.PostType | @PostType = @PostType
   and bl.CategoryID = @CategoryID
  ORDER BY
   bc.[dateadded] desc
 End
 Else
 Begin
  --Filter by CategoryID and Date.

  --If we only have a start date and no stop date, add 24 hours to to stopdate
  if(@StartDate is not null and @StopDate is null)
  Set @StopDate = DateAdd(day,1,@StartDate)
  
  -- No Date Filter
  SELECT
   bc.[ID]
  FROM
   blog_Content bc with(nolock)
   INNER JOIN blog_Links bl with(nolock) on bc.ID = bl.PostID
  WHERE
   bc.BlogID = @BlogID
   and bc.PostConfig & @PostConfig = @PostConfig
   and bc.PostType | @PostType = @PostType
   and bl.CategoryID = @CategoryID
   and bc.DateAdded >= @StartDate and bc.DateAdded <= @StopDate
  ORDER BY
   bc.[dateadded] desc
 End
End
-- Do we have a CategoryName? (CategoryID will override this value)
else if(@CategoryName is not null)
Begin
 --We will filter by categryName (Title)
 --Should we also filter by Date?
 if(@StartDate is null)
 Begin
  -- Filter by CategoryName and not Date
  SELECT
   bc.[ID]
  FROM
   blog_Content bc with(nolock)
   INNER JOIN blog_Links bl with(nolock) on bc.ID = bl.PostID
   INNER JOIN blog_LinkCategories bcat with(nolock) on bl.CategoryID = bcat.CategoryID

  WHERE
   bc.BlogID = @BlogID
   and bc.PostConfig & @PostConfig = @PostConfig
   and bc.PostType | @PostType = @PostType
   and bcat.Title = @CategoryName
  ORDER BY
   bc.[dateadded] desc
 End
 Else
 Begin
  --Filter by CategoryName (Title) and Date

  --If we only have a start date and no stop date, add 24 hours to to stopdate
  if(@StartDate is not null and @StopDate is null)
  Set @StopDate = DateAdd(day,1,@StartDate)
  
  SELECT
   bc.[ID]
  FROM
   blog_Content bc with(nolock)
   INNER JOIN blog_Links bl with(nolock) on bc.ID = bl.PostID
   INNER JOIN blog_LinkCategories bcat with(nolock) on bl.CategoryID = bcat.CategoryID
  WHERE
   bc.BlogID = @BlogID
   and bc.PostConfig & @PostConfig = @PostConfig
   and bc.PostType | @PostType = @PostType
   and bcat.Title = @CategoryName
   and bc.DateAdded >= @StartDate and bc.DateAdded <= @StopDate
  ORDER BY
   bc.[dateadded] desc
 End
End
else if(@StartDate is not null)
Begin
 --No categoryID or Category was found. We will ONLY filter by dates

 --If we only have a start date and no stop date, add 24 hours to to stopdate
 if(@StartDate is not null and @StopDate is null)
 Set @StopDate = DateAdd(day,1,@StartDate)

 SELECT
  bc.[ID]
 FROM
  blog_Content bc with(nolock)
 WHERE
  bc.BlogID = @BlogID
  and bc.PostConfig & @PostConfig = @PostConfig
  and bc.PostType | @PostType = @PostType
  and bc.DateAdded >= @StartDate and bc.DateAdded <= @StopDate
 ORDER BY
  bc.[dateadded] desc

End
Else
Begin
 --All else has failed :)
 --We will just select the last x number of items
 SELECT
  bc.[ID]
 FROM
  blog_Content bc with(nolock)
 WHERE
  bc.BlogID = @BlogID
  and bc.PostConfig & @PostConfig = @PostConfig
  and bc.PostType | @PostType = @PostType
 ORDER BY
  bc.[dateadded] desc
End
End
Else
--BlogID is Null
Begin
--Do we have a CategoryID?
if(@CategoryID is not null)
Begin
 --we will filter by categoryID. Should we also filter by date?
 if(@StartDate is null)
 Begin
  -- No Date Filter
  SELECT
   bc.[ID]
  FROM
   blog_Content bc with(nolock)
   INNER JOIN blog_Links bl with(nolock) on bc.ID = bl.PostID
   INNER JOIN blog_Config bcc with(nolock) on bc.BlogID = bcc.BlogID and bcc.IsAggregated = 1
  WHERE
   bc.PostConfig & @PostConfig = @PostConfig
   and bc.PostType | @PostType = @PostType
   and bl.CategoryID = @CategoryID
  ORDER BY
   bc.[dateadded] desc
 End
 Else
 Begin
  --Filter by CategoryID and Date.

  --If we only have a start date and no stop date, add 24 hours to to stopdate
  if(@StartDate is not null and @StopDate is null)
  Set @StopDate = DateAdd(day,1,@StartDate)
  
  -- No Date Filter
  SELECT
   bc.[ID]
  FROM
   blog_Content bc with(nolock)
   INNER JOIN blog_Links bl with(nolock) on bc.ID = bl.PostID
   INNER JOIN blog_Config bcc with(nolock) on bc.BlogID = bcc.BlogID and bcc.IsAggregated = 1
  WHERE
   bc.PostConfig & @PostConfig = @PostConfig
   and bc.PostType | @PostType = @PostType
   and bl.CategoryID = @CategoryID
   and bc.DateAdded >= @StartDate and bc.DateAdded <= @StopDate
  ORDER BY
   bc.[dateadded] desc
 End
End
-- Do we have a CategoryName? (CategoryID will override this value)
else if(@CategoryName is not null)
Begin
 --We will filter by categryName (Title)
 --Should we also filter by Date?
 if(@StartDate is null)
 Begin
  -- Filter by CategoryName and not Date
  SELECT
   bc.[ID]
  FROM
   blog_Content bc with(nolock)
   INNER JOIN blog_Links bl with(nolock) on bc.ID = bl.PostID
   INNER JOIN blog_LinkCategories bcat with(nolock) on bl.CategoryID = bcat.CategoryID
   INNER JOIN blog_Config bcc with(nolock) on bc.BlogID = bcc.BlogID and bcc.IsAggregated = 1
  WHERE
   bc.PostConfig & @PostConfig = @PostConfig
   and bc.PostType | @PostType = @PostType
   and bcat.Title = @CategoryName
  ORDER BY
   bc.[dateadded] desc
 End
 Else
 Begin
  --Filter by CategoryName (Title) and Date

  --If we only have a start date and no stop date, add 24 hours to to stopdate
  if(@StartDate is not null and @StopDate is null)
  Set @StopDate = DateAdd(day,1,@StartDate)
  
  SELECT
   bc.[ID]
  FROM
   blog_Content bc with(nolock)
   INNER JOIN blog_Links bl with(nolock) on bc.ID = bl.PostID
   INNER JOIN blog_LinkCategories bcat with(nolock) on bl.CategoryID = bcat.CategoryID
   INNER JOIN blog_Config bcc with(nolock) on bc.BlogID = bcc.BlogID and bcc.IsAggregated = 1
  WHERE
   bc.PostConfig & @PostConfig = @PostConfig
   and bc.PostType | @PostType = @PostType
   and bcat.Title = @CategoryName
   and bc.DateAdded >= @StartDate and bc.DateAdded <= @StopDate
  ORDER BY
   bc.[dateadded] desc
 End
End
else if(@StartDate is not null)
Begin
 --No categoryID or Category was found. We will ONLY filter by dates

 --If we only have a start date and no stop date, add 24 hours to to stopdate
 if(@StartDate is not null and @StopDate is null)
 Set @StopDate = DateAdd(day,1,@StartDate)

 SELECT
  bc.[ID]
 FROM
  blog_Content bc with(nolock)
  INNER JOIN blog_Config bcc with(nolock) on bc.BlogID = bcc.BlogID and bcc.IsAggregated = 1
 WHERE
  bc.PostConfig & @PostConfig = @PostConfig
  and bc.PostType | @PostType = @PostType
  and bc.DateAdded >= @StartDate and bc.DateAdded <= @StopDate
  
 ORDER BY
  bc.[dateadded] desc

End
Else
Begin
 --All else has failed :)
 --We will just select the last x number of items
 IF (@PostType = 8)
 Begin
 SELECT
  bc.[ID]
 FROM
  blog_Content bc with(nolock)
  INNER JOIN blog_Config bcc with(nolock) on bc.BlogID = bcc.BlogID and bcc.IsAggregated = 1
 WHERE
  bc.PostConfig & @PostConfig = @PostConfig
  and bc.PostType | @PostType = @PostType
  and bc.ParentID in (Select blog_Content.ID from blog_Content where blog_Content.ID=bc.ParentID and blog_Content.PostConfig=93)
  --and blog_Content.[ID] not in(select blog_Links.PostID from blog_Links  where blog_Links.PostID=bc.ParentID and blog_Links.CategoryID=807))
 ORDER BY
  bc.[dateadded] desc
 End
 Else
 Begin
 SELECT
  bc.[ID]
 FROM
  blog_Content bc with(nolock)
  INNER JOIN blog_Config bcc with(nolock) on bc.BlogID = bcc.BlogID and bcc.IsAggregated = 1
 WHERE
  bc.PostConfig & @PostConfig = @PostConfig
  and bc.PostType | @PostType = @PostType
 ORDER BY
  bc.[dateadded] desc
 End
End
End

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE dbo.blog_MailNotify_Delete
 (
  @EntryID int,
  @SendToBlogID int
 )

AS
 delete from blog_MailNotify where EntryID=@EntryID and SendToBlogID=@SendToBlogID
 
 RETURN


GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE dbo.blog_MailNotify_GetMailList
 (
  @EntryID int
 )

AS
 select EMail from blog_MailNotify where EntryID = @EntryID
 RETURN


GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE dbo.blog_MailNotify_Insert
(
  @EntryID int,
  @BlogID int,
  @SendToBlogID int,
  @EMail nvarchar(150)
)

AS
 IF NOT EXISTS (SELECT EntryID FROM blog_MailNotify  WHERE EntryID = @EntryID AND SendToBlogID = @SendToBlogID )
 insert into blog_MailNotify(EntryID,BlogID,SendToBlogID,EMail)values(@EntryID,@BlogID,@SendToBlogID,@EMail)
 

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS OFF
GO