detachtable_2000.config
上传用户:wenllgg125
上传日期:2020-04-09
资源大小:7277k
文件大小:41k
源码类别:

SCSI/ASPI

开发平台:

Others

  1.                     if exists (select * from sysobjects where id = object_id(N'[dnt_createpost]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  2.                     drop procedure [dnt_createpost]
  3.                     ~
  4.                     if exists (select * from sysobjects where id = object_id(N'[dnt_getfirstpostid]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  5.                     drop procedure [dnt_getfirstpostid]
  6.                     ~
  7.                     if exists (select * from sysobjects where id = object_id(N'[dnt_getpostcount]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  8.                     drop procedure [dnt_getpostcount]
  9.                     ~
  10.                     if exists (select * from sysobjects where id = object_id(N'[dnt_deletepostbypid]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  11.                     drop procedure [dnt_deletepostbypid]
  12.                     ~
  13.                     if exists (select * from sysobjects where id = object_id(N'[dnt_getposttree]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  14.                     drop procedure [dnt_getposttree]
  15.                     ~
  16.                     if exists (select * from sysobjects where id = object_id(N'[dnt_getsinglepost]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  17.                     drop procedure [dnt_getsinglepost]
  18.                     ~
  19.                     if exists (select * from sysobjects where id = object_id(N'[dnt_updatepost]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  20.                     drop procedure [dnt_updatepost]
  21.                     ~
  22.                     if exists (select * from sysobjects where id = object_id(N'[dnt_getpostlist1]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  23.                     drop procedure [dnt_getpostlist1]
  24.                     ~
  25.                     if exists (select * from sysobjects where id = object_id(N'[dnt_deletetopicbytidlist1]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  26.                     drop procedure [dnt_deletetopicbytidlist1]
  27.                     
  28.                     ~
  29.                     if exists (select * from sysobjects where id = object_id(N'[dnt_getreplypid1]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  30.                     drop procedure [dnt_getreplypid1]
  31.                     
  32.                     ~
  33.                     if exists (select * from sysobjects where id = object_id(N'[dnt_getnewtopics1]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  34.                     drop procedure [dnt_getnewtopics1]
  35.                     
  36.                     ~
  37.                     if exists (select * from sysobjects where id = object_id(N'[dnt_getlastpostlist1]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  38.                     drop procedure [dnt_getlastpostlist1] 
  39.                     
  40.                     ~
  41.                     if exists (select * from sysobjects where id = object_id(N'[dnt_getdebatepostlist1]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  42.                     drop procedure [dnt_getdebatepostlist1]
  43.                     ~
  44.                     
  45.                     CREATE PROCEDURE dnt_createpost
  46. @fid int,
  47. @tid int,
  48. @parentid int,
  49. @layer int,
  50. @poster varchar(20),
  51. @posterid int,
  52. @title nvarchar(60),
  53. @topictitle nvarchar(60),
  54. @postdatetime char(20),
  55. @message ntext,
  56. @ip varchar(15),
  57. @lastedit varchar(50),
  58. @invisible int,
  59. @usesig int,
  60. @htmlon int,
  61. @smileyoff int,
  62. @bbcodeoff int,
  63. @parseurloff int,
  64. @attachment int,
  65. @rate int,
  66. @ratetimes int
  67. AS
  68. DEClARE @postid int
  69. DELETE FROM [dnt_postid] WHERE DATEDIFF(n, postdatetime, GETDATE()) >5
  70. INSERT INTO [dnt_postid] ([postdatetime]) VALUES(GETDATE())
  71. SELECT @postid=SCOPE_IDENTITY()
  72. INSERT INTO [dnt_posts1]([pid], [fid], [tid], [parentid], [layer], [poster], [posterid], [title], [postdatetime], [message], [ip], [lastedit], [invisible], [usesig], [htmlon], [smileyoff], [bbcodeoff], [parseurloff], [attachment], [rate], [ratetimes]) VALUES(@postid, @fid, @tid, @parentid, @layer, @poster, @posterid, @title, @postdatetime, @message, @ip, @lastedit, @invisible, @usesig, @htmlon, @smileyoff, @bbcodeoff, @parseurloff, @attachment, @rate, @ratetimes)
  73. IF @parentid=0
  74. BEGIN
  75. UPDATE [dnt_posts1] SET [parentid]=@postid WHERE [pid]=@postid
  76. END
  77. IF @@ERROR=0
  78. BEGIN
  79. IF  @invisible = 0
  80. BEGIN
  81. UPDATE [dnt_statistics] SET [totalpost]=[totalpost] + 1
  82. DECLARE @fidlist AS VARCHAR(1000)
  83. DECLARE @strsql AS VARCHAR(4000)
  84. SET @fidlist = '';
  85. SELECT @fidlist = ISNULL([parentidlist],'') FROM [dnt_forums] WHERE [fid] = @fid
  86. IF RTRIM(@fidlist)<>''
  87. BEGIN
  88. SET @fidlist = RTRIM(@fidlist) + ',' + CAST(@fid AS VARCHAR(10))
  89. END
  90. ELSE
  91. BEGIN
  92. SET @fidlist = CAST(@fid AS VARCHAR(10))
  93. END
  94.         
  95. UPDATE [dnt_forums] SET 
  96. [posts]=[posts] + 1, 
  97. [todayposts]=CASE 
  98. WHEN DATEDIFF(day, [lastpost], GETDATE())=0 THEN [todayposts]*1 + 1 
  99.  ELSE 1 
  100.  END,
  101. [lasttid]=@tid,
  102. [lasttitle]=@topictitle,
  103. [lastpost]=@postdatetime,
  104. [lastposter]=@poster,
  105. [lastposterid]=@posterid 
  106. WHERE fid IN (SELECT [item] FROM [dnt_split](@fidlist, ','))
  107. UPDATE [dnt_users] SET
  108. [lastpost] = @postdatetime,
  109. [lastpostid] = @postid,
  110. [lastposttitle] = @title,
  111. [posts] = [posts] + 1,
  112. [lastactivity] = GETDATE()
  113. WHERE [uid] = @posterid
  114.         
  115.         
  116. IF @layer<=0
  117. BEGIN
  118. UPDATE [dnt_topics] SET [replies]=0,[lastposter]=@poster,[lastpost]=@postdatetime,[lastposterid]=@posterid WHERE [tid]=@tid
  119. END
  120. ELSE
  121. BEGIN
  122. UPDATE [dnt_topics] SET [replies]=[replies] + 1,[lastposter]=@poster,[lastpost]=@postdatetime,[lastposterid]=@posterid WHERE [tid]=@tid
  123. END
  124. END
  125. UPDATE [dnt_topics] SET [lastpostid]=@postid WHERE [tid]=@tid
  126. IF @posterid <> -1
  127. BEGIN
  128. INSERT [dnt_myposts]([uid], [tid], [pid], [dateline]) VALUES(@posterid, @tid, @postid, @postdatetime)
  129. END
  130. END
  131. SELECT @postid AS postid
  132.                     ~
  133. CREATE PROCEDURE dnt_getfirstpostid
  134. @tid int
  135. AS
  136. SELECT TOP 1 [pid] FROM [dnt_posts1] WHERE [tid]=@tid ORDER BY [pid]
  137.                     ~
  138. CREATE PROCEDURE dnt_getpostcount
  139. @tid int
  140. AS
  141. SELECT COUNT(pid) FROM [dnt_posts1] WHERE [tid]=@tid AND [invisible]=0 AND layer>0
  142.                     ~
  143. CREATE PROCEDURE [dnt_deletepostbypid]
  144.                         @pid int,
  145. @chanageposts AS BIT
  146.                     AS
  147.                         DECLARE @fid int
  148.                         DECLARE @tid int
  149.                         DECLARE @posterid int
  150.                         DECLARE @lastforumposterid int
  151.                         DECLARE @layer int
  152.                         DECLARE @postdatetime smalldatetime
  153.                         DECLARE @poster varchar(50)
  154.                         DECLARE @postcount int
  155.                         DECLARE @title nchar(60)
  156.                         DECLARE @lasttid int
  157.                         DECLARE @postid int
  158.                         DECLARE @todaycount int
  159.                     
  160.                     
  161.                         SELECT @fid = [fid],@tid = [tid],@posterid = [posterid],@layer = [layer], @postdatetime = [postdatetime] FROM [dnt_posts1] WHERE pid = @pid
  162.                         DECLARE @fidlist AS VARCHAR(1000)
  163.                     
  164.                         SET @fidlist = '';
  165.                     
  166.                         SELECT @fidlist = ISNULL([parentidlist],'') FROM [dnt_forums] WHERE [fid] = @fid
  167.                         IF RTRIM(@fidlist)<>''
  168.                             BEGIN
  169.                                 SET @fidlist = RTRIM(@fidlist) + ',' + CAST(@fid AS VARCHAR(10))
  170.                             END
  171.                         ELSE
  172.                             BEGIN
  173.                                 SET @fidlist = CAST(@fid AS VARCHAR(10))
  174.                             END
  175.                         IF @layer<>0
  176.                             BEGIN
  177.                     
  178. IF @chanageposts = 1
  179. BEGIN
  180. UPDATE [dnt_statistics] SET [totalpost]=[totalpost] - 1
  181. UPDATE [dnt_forums] SET 
  182. [posts]=[posts] - 1, 
  183. [todayposts]=CASE 
  184. WHEN DATEPART(yyyy, @postdatetime)=DATEPART(yyyy,GETDATE()) AND DATEPART(mm, @postdatetime)=DATEPART(mm,GETDATE()) AND DATEPART(dd, @postdatetime)=DATEPART(dd,GETDATE()) THEN [todayposts] - 1
  185. ELSE [todayposts]
  186. END
  187. WHERE (CHARINDEX(',' + RTRIM([fid]) + ',', ',' +
  188. (SELECT @fidlist AS [fid]) + ',') > 0)
  189.                     
  190. UPDATE [dnt_users] SET [posts] = [posts] - 1 WHERE [uid] = @posterid
  191. UPDATE [dnt_topics] SET [replies]=[replies] - 1 WHERE [tid]=@tid
  192. END
  193.                     
  194.                                 DELETE FROM [dnt_posts1] WHERE [pid]=@pid
  195.                     
  196.                             END
  197.                         ELSE
  198.                             BEGIN
  199.                     
  200.                                 SELECT @postcount = COUNT([pid]) FROM [dnt_posts1] WHERE [tid] = @tid
  201.                                 SELECT @todaycount = COUNT([pid]) FROM [dnt_posts1] WHERE [tid] = @tid AND DATEDIFF(d, [postdatetime], GETDATE()) = 0
  202.                     
  203. IF @chanageposts = 1
  204. BEGIN
  205. UPDATE [dnt_statistics] SET [totaltopic]=[totaltopic] - 1, [totalpost]=[totalpost] - @postcount
  206.                     
  207. UPDATE [dnt_forums] SET [posts]=[posts] - @postcount, [topics]=[topics] - 1,[todayposts]=[todayposts] - @todaycount WHERE (CHARINDEX(',' + RTRIM([fid]) + ',', ',' +(SELECT @fidlist AS [fid]) + ',') > 0)
  208.                     
  209. UPDATE [dnt_users] SET [posts] = [posts] - @postcount WHERE [uid] = @posterid
  210.                     
  211. END
  212.                                 DELETE FROM [dnt_posts1] WHERE [tid] = @tid
  213.                     
  214.                                 DELETE FROM [dnt_topics] WHERE [tid] = @tid
  215.                     
  216.                             END
  217.                     
  218.                         IF @layer<>0
  219.                             BEGIN
  220.                                 SELECT TOP 1 @pid = [pid], @posterid = [posterid], @postdatetime = [postdatetime], @title = [title], @poster = [poster] FROM [dnt_posts1] WHERE [tid]=@tid ORDER BY [pid] DESC
  221.                                 UPDATE [dnt_topics] SET [lastposter]=@poster,[lastpost]=@postdatetime,[lastpostid]=@pid,[lastposterid]=@posterid WHERE [tid]=@tid
  222.                             END
  223.                         SELECT @lasttid = [lasttid] FROM [dnt_forums] WHERE [fid] = @fid
  224.                     
  225.                         IF @lasttid = @tid
  226.                             BEGIN
  227.                     
  228.                     
  229.                                 SELECT TOP 1 @pid = [pid], @tid = [tid],@lastforumposterid = [posterid], @title = [title], @postdatetime = [postdatetime], @poster = [poster] FROM [dnt_posts1] WHERE [fid] = @fid ORDER BY [pid] DESC
  230.                     
  231.                             
  232.                             
  233.                                 UPDATE [dnt_forums] SET 
  234.                     
  235.                                 [lastpost]=@postdatetime,
  236.                                 [lastposter]=ISNULL(@poster,''),
  237.                                 [lastposterid]=ISNULL(@lastforumposterid,'0')
  238.                                 WHERE (CHARINDEX(',' + RTRIM([fid]) + ',', ',' +
  239.                                 (SELECT @fidlist AS [fid]) + ',') > 0)
  240.                     
  241.                                 SELECT TOP 1 @pid = [pid], @tid = [tid],@posterid = [posterid], @postdatetime = [postdatetime], @title = [title], @poster = [poster] FROM [dnt_posts1] WHERE [posterid]=@posterid ORDER BY [pid] DESC
  242.                     
  243.                                 UPDATE [dnt_users] SET
  244.                     
  245.                                 [lastpost] = @postdatetime,
  246.                                 [lastpostid] = @pid,
  247.                                 [lastposttitle] = ISNULL(@title,'')
  248.                     
  249.                                 WHERE [uid] = @posterid
  250.                     
  251.                             END
  252.                     ~
  253. CREATE PROCEDURE dnt_getposttree
  254. @tid int
  255. AS
  256. SELECT [pid], [layer], [title], [poster], [posterid],[postdatetime],[message] FROM [dnt_posts1] WHERE [tid]=@tid AND [invisible]=0 ORDER BY [parentid];
  257.                     ~
  258. CREATE PROCEDURE [dnt_getsinglepost]
  259.                     @tid int,
  260.                     @pid int
  261.                     AS
  262.                     SELECT [aid], [tid], [pid], [postdatetime], [readperm], [filename], [description], [filetype], [filesize], [attachment], [downloads], [attachprice], [uid]  FROM [dnt_attachments] WHERE [tid]=@tid
  263.                     SELECT TOP 1 
  264.                                 [dnt_posts1].[pid], 
  265.                                 [dnt_posts1].[fid], 
  266.                                 [dnt_posts1].[title], 
  267.                                 [dnt_posts1].[layer],
  268.                                 [dnt_posts1].[message], 
  269.                                 [dnt_posts1].[ip], 
  270.                                 [dnt_posts1].[lastedit], 
  271.                                 [dnt_posts1].[postdatetime], 
  272.                                 [dnt_posts1].[attachment], 
  273.                                 [dnt_posts1].[poster], 
  274.                                 [dnt_posts1].[invisible], 
  275.                                 [dnt_posts1].[usesig], 
  276.                                 [dnt_posts1].[htmlon], 
  277.                                 [dnt_posts1].[smileyoff], 
  278.                                 [dnt_posts1].[parseurloff], 
  279.                                 [dnt_posts1].[bbcodeoff], 
  280.                                 [dnt_posts1].[rate], 
  281.                                 [dnt_posts1].[ratetimes], 
  282.                                 [dnt_posts1].[posterid], 
  283.                                 [dnt_users].[nickname],  
  284.                                 [dnt_users].[username], 
  285.                                 [dnt_users].[groupid],
  286.                                     [dnt_users].[spaceid],
  287.                                     [dnt_users].[gender],
  288. [dnt_users].[bday], 
  289.                                 [dnt_users].[email], 
  290.                                 [dnt_users].[showemail], 
  291.                                 [dnt_users].[digestposts], 
  292.                                 [dnt_users].[credits], 
  293.                                 [dnt_users].[extcredits1], 
  294.                                 [dnt_users].[extcredits2], 
  295.                                 [dnt_users].[extcredits3], 
  296.                                 [dnt_users].[extcredits4], 
  297.                                 [dnt_users].[extcredits5], 
  298.                                 [dnt_users].[extcredits6], 
  299.                                 [dnt_users].[extcredits7], 
  300.                                 [dnt_users].[extcredits8], 
  301.                                 [dnt_users].[posts], 
  302.                                 [dnt_users].[joindate], 
  303.                                 [dnt_users].[onlinestate], 
  304.                                 [dnt_users].[lastactivity],
  305. [dnt_users].[oltime],
  306. [dnt_users].[lastvisit], 
  307.                                 [dnt_users].[invisible], 
  308.                                 [dnt_userfields].[avatar], 
  309.                                 [dnt_userfields].[avatarwidth], 
  310.                                 [dnt_userfields].[avatarheight], 
  311.                                 [dnt_userfields].[medals], 
  312.                                 [dnt_userfields].[sightml] AS signature, 
  313.                                 [dnt_userfields].[location], 
  314.                                 [dnt_userfields].[customstatus], 
  315.                                 [dnt_userfields].[website], 
  316.                                 [dnt_userfields].[icq], 
  317.                                 [dnt_userfields].[qq], 
  318.                                 [dnt_userfields].[msn], 
  319.                                 [dnt_userfields].[yahoo], 
  320.                                 [dnt_userfields].[skype] 
  321.                     FROM [dnt_posts1] LEFT JOIN [dnt_users] ON [dnt_users].[uid]=[dnt_posts1].[posterid] LEFT JOIN [dnt_userfields] ON [dnt_userfields].[uid]=[dnt_users].[uid] WHERE [dnt_posts1].[pid]=@pid
  322.                     ~
  323. CREATE PROCEDURE dnt_updatepost
  324. @pid int,
  325. @title nvarchar(160),
  326. @message ntext,
  327. @lastedit nvarchar(50),
  328. @invisible int,
  329. @usesig int,
  330. @htmlon int,
  331. @smileyoff int,
  332. @bbcodeoff int,
  333. @parseurloff int
  334. AS
  335. UPDATE dnt_posts1 SET 
  336. [title]=@title,
  337. [message]=@message,
  338. [lastedit]=@lastedit,
  339. [invisible]=@invisible,
  340. [usesig]=@usesig,
  341. [htmlon]=@htmlon,
  342. [smileyoff]=@smileyoff,
  343. [bbcodeoff]=@bbcodeoff,
  344. [parseurloff]=@parseurloff WHERE [pid]=@pid
  345.                     ~
  346. CREATE PROCEDURE [dnt_getpostlist1]
  347. @tid int,
  348. @pagesize int,
  349. @pageindex int
  350. AS
  351. DECLARE @pagetop int
  352. SET @pagetop = (@pageindex-1)*@pagesize
  353. IF @pageindex = 1
  354. EXEC('SELECT TOP ' + @pagesize + '
  355. [dnt_posts1].[pid], 
  356. [dnt_posts1].[fid], 
  357. [dnt_posts1].[title], 
  358. [dnt_posts1].[layer],
  359. [dnt_posts1].[message], 
  360. [dnt_posts1].[ip], 
  361. [dnt_posts1].[lastedit], 
  362. [dnt_posts1].[postdatetime], 
  363. [dnt_posts1].[attachment], 
  364. [dnt_posts1].[poster], 
  365. [dnt_posts1].[posterid], 
  366. [dnt_posts1].[invisible], 
  367. [dnt_posts1].[usesig], 
  368. [dnt_posts1].[htmlon], 
  369. [dnt_posts1].[smileyoff], 
  370. [dnt_posts1].[parseurloff], 
  371. [dnt_posts1].[bbcodeoff], 
  372. [dnt_posts1].[rate], 
  373. [dnt_posts1].[ratetimes], 
  374. [dnt_users].[nickname],  
  375. [dnt_users].[username], 
  376. [dnt_users].[groupid], 
  377. [dnt_users].[spaceid],
  378. [dnt_users].[gender],
  379. [dnt_users].[bday],
  380. [dnt_users].[email], 
  381. [dnt_users].[showemail], 
  382. [dnt_users].[digestposts], 
  383. [dnt_users].[credits], 
  384. [dnt_users].[extcredits1], 
  385. [dnt_users].[extcredits2], 
  386. [dnt_users].[extcredits3], 
  387. [dnt_users].[extcredits4], 
  388. [dnt_users].[extcredits5], 
  389. [dnt_users].[extcredits6], 
  390. [dnt_users].[extcredits7], 
  391. [dnt_users].[extcredits8], 
  392. [dnt_users].[posts], 
  393. [dnt_users].[joindate], 
  394. [dnt_users].[onlinestate],
  395. [dnt_users].[lastactivity], 
  396. [dnt_users].[invisible],
  397. [dnt_users].[oltime],
  398. [dnt_users].[lastvisit], 
  399. [dnt_userfields].[avatar], 
  400. [dnt_userfields].[avatarwidth], 
  401. [dnt_userfields].[avatarheight],
  402. [dnt_userfields].[medals],
  403. [dnt_userfields].[sightml] AS signature, 
  404. [dnt_userfields].[location], 
  405. [dnt_userfields].[customstatus], 
  406. [dnt_userfields].[website], 
  407. [dnt_userfields].[icq], 
  408. [dnt_userfields].[qq], 
  409. [dnt_userfields].[msn], 
  410. [dnt_userfields].[yahoo], 
  411. [dnt_userfields].[skype] 
  412.  FROM [dnt_posts1] LEFT JOIN [dnt_users] ON [dnt_users].[uid]=[dnt_posts1].[posterid] LEFT JOIN [dnt_userfields] ON [dnt_userfields].[uid]=[dnt_users].[uid] WHERE [dnt_posts1].[tid]=' + @tid + ' AND [dnt_posts1].[invisible]<=0 ORDER BY [dnt_posts1].[pid]')
  413. ELSE
  414. EXEC('SELECT TOP ' + @pagesize + ' 
  415. [dnt_posts1].[pid], 
  416. [dnt_posts1].[fid], 
  417. [dnt_posts1].[title], 
  418. [dnt_posts1].[layer],
  419. [dnt_posts1].[message], 
  420. [dnt_posts1].[ip], 
  421. [dnt_posts1].[lastedit], 
  422. [dnt_posts1].[postdatetime], 
  423. [dnt_posts1].[attachment], 
  424. [dnt_posts1].[poster], 
  425. [dnt_posts1].[posterid], 
  426. [dnt_posts1].[invisible], 
  427. [dnt_posts1].[usesig], 
  428. [dnt_posts1].[htmlon], 
  429. [dnt_posts1].[smileyoff], 
  430. [dnt_posts1].[parseurloff], 
  431. [dnt_posts1].[bbcodeoff], 
  432. [dnt_posts1].[rate], 
  433. [dnt_posts1].[ratetimes],
  434. [dnt_users].[nickname],  
  435. [dnt_users].[username], 
  436. [dnt_users].[groupid], 
  437. [dnt_users].[spaceid],
  438. [dnt_users].[gender],
  439. [dnt_users].[bday],
  440. [dnt_users].[email], 
  441. [dnt_users].[showemail], 
  442. [dnt_users].[digestposts], 
  443. [dnt_users].[credits], 
  444. [dnt_users].[extcredits1], 
  445. [dnt_users].[extcredits2], 
  446. [dnt_users].[extcredits3], 
  447. [dnt_users].[extcredits4], 
  448. [dnt_users].[extcredits5], 
  449. [dnt_users].[extcredits6], 
  450. [dnt_users].[extcredits7], 
  451. [dnt_users].[extcredits8], 
  452. [dnt_users].[posts], 
  453. [dnt_users].[joindate], 
  454. [dnt_users].[onlinestate],
  455. [dnt_users].[lastactivity],
  456. [dnt_users].[oltime],
  457. [dnt_users].[lastvisit],  
  458. [dnt_users].[invisible] AS [userinvisible], 
  459. [dnt_userfields].[avatar], 
  460. [dnt_userfields].[avatarwidth], 
  461. [dnt_userfields].[avatarheight], 
  462. [dnt_userfields].[medals],
  463. [dnt_userfields].[sightml] AS [signature], 
  464. [dnt_userfields].[location], 
  465. [dnt_userfields].[customstatus], 
  466. [dnt_userfields].[website], 
  467. [dnt_userfields].[icq], 
  468. [dnt_userfields].[qq], 
  469. [dnt_userfields].[msn], 
  470. [dnt_userfields].[yahoo], 
  471. [dnt_userfields].[skype] 
  472. FROM [dnt_posts1] LEFT JOIN [dnt_users] ON [dnt_users].[uid]=[dnt_posts1].[posterid] LEFT JOIN [dnt_userfields] ON [dnt_userfields].[uid]=[dnt_users].[uid] WHERE [dnt_posts1].[tid]=' + @tid + ' AND [pid] > (SELECT MAX([pid]) FROM (SELECT TOP ' + @pagetop + ' [dnt_posts1].[pid] FROM [dnt_posts1] WHERE [dnt_posts1].[tid]=' + @tid + ' AND [dnt_posts1].[invisible]<=0 ORDER BY [dnt_posts1].[pid]) AS tblTmp) AND [dnt_posts1].[invisible]<=0 ORDER BY [dnt_posts1].[pid]')
  473.                     ~
  474. CREATE PROCEDURE [dnt_deletetopicbytidlist1]
  475.                     @tidlist AS VARCHAR(2000),
  476.                     @chanageposts AS BIT
  477.                     AS
  478.                     DECLARE @postcount int
  479.                     DECLARE @topiccount int
  480.                     DECLARE @todaycount int
  481.                     DECLARE @sqlstr nvarchar(4000)
  482.                     DECLARE @fid varchar(2000)
  483.                     DECLARE @posterid varchar(200)
  484.                     DECLARE @tempFid int
  485.                     DECLARE @tempPosterid int
  486.                     DECLARE @tempLayer int
  487.                     DECLARE @temppostdatetime datetime
  488.                     DECLARE @tempfidlist AS VARCHAR(1000)
  489.                     SET @fid = ''
  490.                     SET @posterid = ''
  491.                     SET @postcount=0
  492.                     SET @topiccount=0
  493.                     SET @todaycount=0
  494.                     SET @tempfidlist = '';
  495.                     IF @tidlist<>''
  496.                     BEGIN
  497.                     DECLARE cu_dnt_posts CURSOR FOR SELECT [fid],[posterid],[layer],[postdatetime] FROM [dnt_posts1] WHERE CHARINDEX(','+RTRIM([dnt_posts1].[tid])+',', ','+@tidlist+',') > 0
  498.                     
  499.                     OPEN cu_dnt_posts
  500.                     FETCH NEXT FROM cu_dnt_posts into @tempFid,@tempPosterid,@tempLayer,@temppostdatetime
  501.                     WHILE @@FETCH_STATUS = 0
  502.                     BEGIN
  503.                     SET @postcount = @postcount + 1
  504.                     IF @tempLayer = 0
  505.                     BEGIN
  506.                     SET @topiccount = @topiccount + 1
  507.                     
  508.                     END
  509.                     IF DATEDIFF(d,@temppostdatetime,GETDATE()) = 0
  510.                     BEGIN
  511.                     SET @todaycount = @todaycount + 1
  512.                     END
  513.                     IF CHARINDEX(',' + LTRIM(STR(@tempFid)) + ',',@fid + ',') = 0
  514.                     BEGIN
  515.                     --SET @fid = @fid + ',' + LTRIM(STR(@tempFid))
  516.                     SELECT @tempfidlist = ISNULL([parentidlist],'') FROM [dnt_forums] WHERE [fid] = @tempFid
  517.                     IF RTRIM(@tempfidlist)<>''
  518.                     BEGIN
  519.                     SET @fid = RTRIM(@fid) + ',' +  RTRIM(@tempfidlist) + ',' + CAST(@tempFid AS VARCHAR(10))
  520.                     END
  521.                     ELSE
  522.                     BEGIN
  523.                     SET @fid =RTRIM(@fid) + ',' +  CAST(@tempFid AS VARCHAR(10))
  524.                     END
  525.                     
  526.                     END
  527.                     IF @chanageposts = 1
  528.                     BEGIN
  529.                     UPDATE [dnt_users] SET [posts] = [posts] - 1 WHERE [uid] = @tempPosterid
  530.                     END
  531.                     
  532.                     FETCH NEXT FROM cu_dnt_posts into @tempFid,@tempPosterid,@tempLayer,@temppostdatetime
  533.                     END
  534.                     CLOSE cu_dnt_posts
  535.                     DEALLOCATE cu_dnt_posts
  536.                     
  537.                     IF LEN(@fid)>0
  538.                     BEGIN
  539.                     
  540.                     SET @fid = SUBSTRING(@fid,2,LEN(@fid)-1)
  541.                     
  542.                     IF @chanageposts = 1
  543.                     BEGIN
  544.                     
  545.                     UPDATE [dnt_statistics] SET [totaltopic]=[totaltopic] - @topiccount, [totalpost]=[totalpost] - @postcount
  546.                     UPDATE [dnt_forums] 
  547.                     SET [posts]=[posts] - @postcount,  
  548.                     [topics]=[topics] - @topiccount, 
  549.                     [todayposts] = [todayposts] - @todaycount  
  550.                     WHERE CHARINDEX(','+RTRIM([fid])+',', ','+@fid+',') > 0
  551.                     END
  552.                     
  553.                     DELETE FROM [dnt_favorites] WHERE CHARINDEX(','+RTRIM([tid])+',', ','+@tidlist+',') > 0 AND [typeid]=0
  554.                     
  555.                     DELETE FROM [dnt_polls] WHERE CHARINDEX(','+RTRIM([tid])+',', ','+@tidlist+',') > 0
  556.                     DELETE FROM [dnt_posts1] WHERE CHARINDEX(','+RTRIM([tid])+',', ','+@tidlist+',') > 0
  557.                     DELETE FROM [dnt_mytopics] WHERE CHARINDEX(','+RTRIM([tid])+',', ','+@tidlist+',') > 0
  558.                     END
  559.                     DELETE FROM [dnt_topics] WHERE CHARINDEX((','+RTRIM([closed])+','), ','+@tidlist+',') > 0 OR CHARINDEX(','+RTRIM([tid])+',', ','+@tidlist+',') > 0
  560.                     
  561.                     UPDATE [dnt_tags] SET [count]=[count]-1, [fcount]=[fcount]-1 WHERE [tagid] IN (SELECT [tagid] FROM [dnt_topictags] WHERE CHARINDEX(','+RTRIM([tid])+',', ','+@tidlist+',') > 0) 
  562.                     
  563.                     DELETE FROM [dnt_topictags] WHERE CHARINDEX(','+RTRIM([tid])+',', ','+@tidlist+',') > 0
  564.                     
  565.                     DELETE FROM [dnt_topictagcaches] WHERE CHARINDEX(','+RTRIM([tid])+',', ','+@tidlist+',') > 0 OR CHARINDEX((','+RTRIM([linktid])+','), ','+@tidlist+',') > 0
  566.                     
  567.                     
  568.                     END
  569.                     
  570.                     ~
  571. CREATE PROCEDURE [dnt_getreplypid1]
  572. @uid int,
  573. @tid int
  574. AS
  575. SELECT TOP 1 [pid] FROM [dnt_posts1] WHERE [tid] =@tid AND [posterid]=@uid
  576.                     
  577.                     ~
  578. CREATE PROCEDURE [dnt_getnewtopics1]
  579. @fidlist VARCHAR(500)
  580. AS
  581. IF @fidlist <> ''
  582. BEGIN
  583. SELECT TOP 20 
  584. [dnt_posts1].[tid], 
  585. [dnt_posts1].[title], 
  586. [dnt_posts1].[poster], 
  587. [dnt_posts1].[postdatetime], 
  588. [dnt_posts1].[message],
  589. [dnt_forums].[name] 
  590. FROM [dnt_posts1]  
  591. LEFT JOIN [dnt_forums] ON [dnt_posts1].[fid]=[dnt_forums].[fid]
  592. LEFT JOIN [dnt_topics] ON [dnt_posts1].[tid]=[dnt_topics].[tid]
  593. WHERE CHARINDEX(','+RTRIM([dnt_forums].[fid])+',', ','+@fidlist+',') > 0 
  594. AND [dnt_posts1].[layer]=0 AND [dnt_topics].[displayorder] >= 0
  595. ORDER BY [dnt_posts1].[tid] DESC
  596. END 
  597. ELSE
  598. BEGIN
  599. SELECT TOP 20 
  600. [dnt_posts1].[tid], 
  601. [dnt_posts1].[title], 
  602. [dnt_posts1].[poster], 
  603. [dnt_posts1].[postdatetime], 
  604. [dnt_posts1].[message],
  605. [dnt_forums].[name] 
  606. FROM [dnt_posts1]
  607. LEFT JOIN [dnt_forums] ON [dnt_posts1].[fid]=[dnt_forums].[fid]
  608. LEFT JOIN [dnt_topics] ON [dnt_posts1].[tid]=[dnt_topics].[tid]
  609. WHERE [dnt_posts1].[layer]=0 AND [dnt_topics].[displayorder] >= 0
  610. ORDER BY [dnt_posts1].[tid] DESC
  611. END    
  612.                     ~
  613. CREATE PROCEDURE [dnt_getlastpostlist1]
  614. @tid int,
  615. @postnum int
  616. AS
  617. EXEC('SELECT TOP ' + @postnum + ' [dnt_posts1].[pid], [dnt_posts1].[fid], [dnt_posts1].[layer], [dnt_posts1].[posterid], [dnt_posts1].[title], [dnt_posts1].[message], [dnt_posts1].[postdatetime], [dnt_posts1].[attachment], [dnt_posts1].[poster], [dnt_posts1].[posterid], [dnt_posts1].[invisible], [dnt_posts1].[usesig], [dnt_posts1].[htmlon], [dnt_posts1].[smileyoff], [dnt_posts1].[parseurloff], [dnt_posts1].[bbcodeoff], [dnt_posts1].[rate], [dnt_posts1].[ratetimes], [dnt_users].[username], [dnt_users].[email], [dnt_users].[showemail], [dnt_userfields].[avatar], [dnt_userfields].[avatarwidth], [dnt_userfields].[avatarheight], [dnt_userfields].[sightml] AS signature, [dnt_userfields].[location], [dnt_userfields].[customstatus] FROM [dnt_posts1] LEFT JOIN [dnt_users] ON [dnt_users].[uid]=[dnt_posts1].[posterid] LEFT JOIN [dnt_userfields] ON [dnt_userfields].[uid]=[dnt_users].[uid] WHERE [dnt_posts1].[tid]=' + @tid + '  AND  [dnt_posts1].[invisible] <=0 AND [dnt_posts1].layer <> 0 ORDER BY [dnt_posts1].[pid] DESC')
  618.                     ~
  619. CREATE PROCEDURE [dnt_getdebatepostlist1] 
  620. @tid int,
  621. @opinion int,
  622. @pagesize int,
  623. @pageindex int
  624. AS
  625. BEGIN
  626. DECLARE @pagetop int
  627. SET @pagetop = (@pageindex-1)*@pagesize
  628. IF @pageindex = 1 
  629. EXEC('SELECT 
  630. [dnt_posts1].[attachment],
  631. [dnt_posts1].[bbcodeoff],
  632. [dnt_posts1].[fid],
  633. [dnt_posts1].[htmlon],
  634. [dnt_posts1].[invisible],
  635. [dnt_posts1].[ip],
  636. [dnt_posts1].[lastedit],
  637. [dnt_posts1].[layer],
  638. [dnt_posts1].[message],
  639. [dnt_posts1].[parentid],
  640. [dnt_posts1].[parseurloff],
  641. [dnt_posts1].[pid],
  642. [dnt_posts1].[postdatetime],
  643. [dnt_posts1].[poster],
  644. [dnt_posts1].[posterid],
  645. [dnt_posts1].[rate],
  646. [dnt_posts1].[ratetimes],
  647. [dnt_posts1].[smileyoff],
  648. [dnt_posts1].[tid],
  649. [dnt_posts1].[title],
  650. [dnt_posts1].[usesig],
  651. [dnt_users].[accessmasks], 
  652. [dnt_users].[adminid],
  653. [dnt_users].[avatarshowid],
  654. [dnt_users].[bday],
  655. [dnt_users].[credits],
  656. [dnt_users].[digestposts],
  657. [dnt_users].[email],
  658. [dnt_users].[extcredits1],
  659. [dnt_users].[extcredits2],
  660. [dnt_users].[extcredits3],
  661. [dnt_users].[extcredits4],
  662. [dnt_users].[extcredits5],
  663. [dnt_users].[extcredits6],
  664. [dnt_users].[extcredits7],
  665. [dnt_users].[extcredits8],
  666. [dnt_users].[extgroupids],
  667. [dnt_users].[gender],
  668. [dnt_users].[groupexpiry],
  669. [dnt_users].[groupid],
  670. [dnt_users].[joindate],
  671. [dnt_users].[lastactivity],
  672. [dnt_users].[lastip],
  673. [dnt_users].[lastpost],
  674. [dnt_users].[lastpostid],
  675. [dnt_users].[lastposttitle],
  676. [dnt_users].[lastvisit],
  677. [dnt_users].[newpm],
  678. [dnt_users].[newpmcount],
  679. [dnt_users].[newsletter],
  680. [dnt_users].[nickname],
  681. [dnt_users].[oltime],
  682. [dnt_users].[onlinestate],
  683. [dnt_users].[pageviews],
  684. [dnt_users].[password],
  685. [dnt_users].[pmsound],
  686. [dnt_users].[posts],
  687. [dnt_users].[ppp],
  688. [dnt_users].[regip],
  689. [dnt_users].[secques],
  690. [dnt_users].[showemail],
  691. [dnt_users].[sigstatus],
  692. [dnt_users].[spaceid],
  693. [dnt_users].[templateid],
  694. [dnt_users].[tpp],
  695. [dnt_users].[uid],
  696. [dnt_users].[username],
  697. [dnt_userfields].[authflag],
  698. [dnt_userfields].[authstr],
  699. [dnt_userfields].[authtime],
  700. [dnt_userfields].[avatar],
  701. [dnt_userfields].[avatarheight],
  702. [dnt_userfields].[avatarwidth],
  703. [dnt_userfields].[bio],
  704. [dnt_userfields].[customstatus],
  705. [dnt_userfields].[icq],
  706. [dnt_userfields].[idcard],
  707. [dnt_userfields].[ignorepm],
  708. [dnt_userfields].[location],
  709. [dnt_userfields].[medals],
  710. [dnt_userfields].[mobile],
  711. [dnt_userfields].[msn],
  712. [dnt_userfields].[phone],
  713. [dnt_userfields].[qq],
  714. [dnt_userfields].[realname],
  715. [dnt_userfields].[sightml],
  716. [dnt_userfields].[signature],
  717. [dnt_userfields].[skype],
  718. [dnt_userfields].[website],
  719. [dnt_userfields].[yahoo] FROM [dnt_posts1] 
  720. LEFT JOIN dnt_users ON dnt_users.uid = [dnt_posts1].posterid 
  721. LEFT JOIN [dnt_userfields] ON [dnt_userfields].[uid]=[dnt_users].[uid] 
  722. WHERE [dnt_posts1].invisible=0 AND [dnt_posts1].pid IN 
  723. (SELECT TOP ' + @pagesize + ' pid FROM dnt_postdebatefields 
  724.  WHERE opinion=' + @opinion + ' AND 
  725. tid=' + @tid+')')
  726. ELSE
  727. EXEC('SELECT 
  728. [dnt_posts1].[attachment],
  729. [dnt_posts1].[bbcodeoff],
  730. [dnt_posts1].[fid],
  731. [dnt_posts1].[htmlon],
  732. [dnt_posts1].[invisible],
  733. [dnt_posts1].[ip],
  734. [dnt_posts1].[lastedit],
  735. [dnt_posts1].[layer],
  736. [dnt_posts1].[message],
  737. [dnt_posts1].[parentid],
  738. [dnt_posts1].[parseurloff],
  739. [dnt_posts1].[pid],
  740. [dnt_posts1].[postdatetime],
  741. [dnt_posts1].[poster],
  742. [dnt_posts1].[posterid],
  743. [dnt_posts1].[rate],
  744. [dnt_posts1].[ratetimes],
  745. [dnt_posts1].[smileyoff],
  746. [dnt_posts1].[tid],
  747. [dnt_posts1].[title],
  748. [dnt_posts1].[usesig],
  749. [dnt_users].[accessmasks], 
  750. [dnt_users].[adminid],
  751. [dnt_users].[avatarshowid],
  752. [dnt_users].[bday],
  753. [dnt_users].[credits],
  754. [dnt_users].[digestposts],
  755. [dnt_users].[email],
  756. [dnt_users].[extcredits1],
  757. [dnt_users].[extcredits2],
  758. [dnt_users].[extcredits3],
  759. [dnt_users].[extcredits4],
  760. [dnt_users].[extcredits5],
  761. [dnt_users].[extcredits6],
  762. [dnt_users].[extcredits7],
  763. [dnt_users].[extcredits8],
  764. [dnt_users].[extgroupids],
  765. [dnt_users].[gender],
  766. [dnt_users].[groupexpiry],
  767. [dnt_users].[groupid],
  768. [dnt_users].[joindate],
  769. [dnt_users].[lastactivity],
  770. [dnt_users].[lastip],
  771. [dnt_users].[lastpost],
  772. [dnt_users].[lastpostid],
  773. [dnt_users].[lastposttitle],
  774. [dnt_users].[lastvisit],
  775. [dnt_users].[newpm],
  776. [dnt_users].[newpmcount],
  777. [dnt_users].[newsletter],
  778. [dnt_users].[nickname],
  779. [dnt_users].[oltime],
  780. [dnt_users].[onlinestate],
  781. [dnt_users].[pageviews],
  782. [dnt_users].[password],
  783. [dnt_users].[pmsound],
  784. [dnt_users].[posts],
  785. [dnt_users].[ppp],
  786. [dnt_users].[regip],
  787. [dnt_users].[secques],
  788. [dnt_users].[showemail],
  789. [dnt_users].[sigstatus],
  790. [dnt_users].[spaceid],
  791. [dnt_users].[templateid],
  792. [dnt_users].[tpp],
  793. [dnt_users].[uid],
  794. [dnt_users].[username],
  795. [dnt_userfields].[authflag],
  796. [dnt_userfields].[authstr],
  797. [dnt_userfields].[authtime],
  798. [dnt_userfields].[avatar],
  799. [dnt_userfields].[avatarheight],
  800. [dnt_userfields].[avatarwidth],
  801. [dnt_userfields].[bio],
  802. [dnt_userfields].[customstatus],
  803. [dnt_userfields].[icq],
  804. [dnt_userfields].[idcard],
  805. [dnt_userfields].[ignorepm],
  806. [dnt_userfields].[location],
  807. [dnt_userfields].[medals],
  808. [dnt_userfields].[mobile],
  809. [dnt_userfields].[msn],
  810. [dnt_userfields].[phone],
  811. [dnt_userfields].[qq],
  812. [dnt_userfields].[realname],
  813. [dnt_userfields].[sightml],
  814. [dnt_userfields].[signature],
  815. [dnt_userfields].[skype],
  816. [dnt_userfields].[website],
  817. [dnt_userfields].[yahoo] FROM [dnt_posts1] 
  818. LEFT JOIN dnt_users ON dnt_users.uid = [dnt_posts1].posterid 
  819. LEFT JOIN [dnt_userfields] ON [dnt_userfields].[uid]=[dnt_users].[uid] 
  820. WHERE [dnt_posts1].invisible=0 AND [dnt_posts1].pid IN 
  821. (SELECT TOP ' + @pagesize + ' pid FROM dnt_postdebatefields 
  822.  WHERE opinion=' + @opinion + ' AND 
  823. tid=' + @tid+' AND pid > (SELECT MAX(pid) FROM (
  824. SELECT TOP ' + @pagetop + ' pid FROM dnt_postdebatefields 
  825. WHERE opinion=' + @opinion + ' AND 
  826. tid=' + @tid+' ORDER BY pid) AS tblTmp) ORDER BY pid)')
  827. END
  828.                     ~
  829. IF OBJECT_ID('dnt_getpostcountbycondition1','P') IS NOT NULL
  830. DROP PROC [dnt_getpostcountbycondition1]
  831. ~
  832. CREATE PROCEDURE [dnt_getpostcountbycondition1]
  833. @tid int,
  834. @posterid int
  835. AS
  836. SELECT COUNT(pid) FROM [dnt_posts1] WHERE [tid] = @tid AND [posterid] = @posterid  AND [layer]>=0
  837. ~
  838. IF OBJECT_ID('dnt_getpostlistbycondition1','P') IS NOT NULL
  839. DROP PROC [dnt_getpostlistbycondition1]
  840. ~
  841. CREATE PROCEDURE [dnt_getpostlistbycondition1]
  842. @tid int,
  843. @pagesize int,
  844. @pageindex int,
  845. @posterid int
  846. AS
  847. DECLARE @pagetop int
  848. SET @pagetop = (@pageindex-1)*@pagesize
  849. IF @pageindex = 1
  850. EXEC('SELECT TOP ' + @pagesize + '
  851. [dnt_posts1].[pid], 
  852. [dnt_posts1].[fid], 
  853. [dnt_posts1].[title], 
  854. [dnt_posts1].[layer],
  855. [dnt_posts1].[message], 
  856. [dnt_posts1].[ip], 
  857. [dnt_posts1].[lastedit], 
  858. [dnt_posts1].[postdatetime], 
  859. [dnt_posts1].[attachment], 
  860. [dnt_posts1].[poster], 
  861. [dnt_posts1].[posterid], 
  862. [dnt_posts1].[invisible], 
  863. [dnt_posts1].[usesig], 
  864. [dnt_posts1].[htmlon], 
  865. [dnt_posts1].[smileyoff], 
  866. [dnt_posts1].[parseurloff], 
  867. [dnt_posts1].[bbcodeoff], 
  868. [dnt_posts1].[rate], 
  869. [dnt_posts1].[ratetimes], 
  870. [dnt_users].[nickname],  
  871. [dnt_users].[username], 
  872. [dnt_users].[groupid], 
  873. [dnt_users].[spaceid],
  874. [dnt_users].[gender],
  875. [dnt_users].[bday],
  876. [dnt_users].[email], 
  877. [dnt_users].[showemail], 
  878. [dnt_users].[digestposts], 
  879. [dnt_users].[credits], 
  880. [dnt_users].[extcredits1], 
  881. [dnt_users].[extcredits2], 
  882. [dnt_users].[extcredits3], 
  883. [dnt_users].[extcredits4], 
  884. [dnt_users].[extcredits5], 
  885. [dnt_users].[extcredits6], 
  886. [dnt_users].[extcredits7], 
  887. [dnt_users].[extcredits8], 
  888. [dnt_users].[posts], 
  889. [dnt_users].[joindate], 
  890. [dnt_users].[onlinestate],
  891. [dnt_users].[lastactivity],
  892. [dnt_users].[oltime],
  893. [dnt_users].[lastvisit],  
  894. [dnt_users].[invisible], 
  895. [dnt_userfields].[avatar], 
  896. [dnt_userfields].[avatarwidth],
  897. [dnt_userfields].[avatarheight],
  898. [dnt_userfields].[medals],
  899. [dnt_userfields].[sightml] AS signature, 
  900. [dnt_userfields].[location], 
  901. [dnt_userfields].[customstatus], 
  902. [dnt_userfields].[website], 
  903. [dnt_userfields].[icq], 
  904. [dnt_userfields].[qq], 
  905. [dnt_userfields].[msn], 
  906. [dnt_userfields].[yahoo], 
  907. [dnt_userfields].[skype] 
  908.  FROM [dnt_posts1] LEFT JOIN [dnt_users] ON [dnt_users].[uid]=[dnt_posts1].[posterid] LEFT JOIN [dnt_userfields] ON [dnt_userfields].[uid]=[dnt_users].[uid] WHERE [dnt_posts1].[tid]=' + @tid + ' AND [dnt_posts1].[invisible]=0 AND [posterid] = '+@posterid+' ORDER BY [dnt_posts1].[pid]')
  909. ELSE
  910. EXEC('SELECT TOP ' + @pagesize + ' 
  911. [dnt_posts1].[pid], 
  912. [dnt_posts1].[fid], 
  913. [dnt_posts1].[title], 
  914. [dnt_posts1].[layer],
  915. [dnt_posts1].[message], 
  916. [dnt_posts1].[ip], 
  917. [dnt_posts1].[lastedit], 
  918. [dnt_posts1].[postdatetime], 
  919. [dnt_posts1].[attachment], 
  920. [dnt_posts1].[poster], 
  921. [dnt_posts1].[posterid], 
  922. [dnt_posts1].[invisible], 
  923. [dnt_posts1].[usesig], 
  924. [dnt_posts1].[htmlon], 
  925. [dnt_posts1].[smileyoff], 
  926. [dnt_posts1].[parseurloff], 
  927. [dnt_posts1].[bbcodeoff], 
  928. [dnt_posts1].[rate], 
  929. [dnt_posts1].[ratetimes],
  930. [dnt_users].[nickname],  
  931. [dnt_users].[username], 
  932. [dnt_users].[groupid], 
  933. [dnt_users].[spaceid],
  934. [dnt_users].[gender],
  935. [dnt_users].[bday],
  936. [dnt_users].[email], 
  937. [dnt_users].[showemail], 
  938. [dnt_users].[digestposts], 
  939. [dnt_users].[credits], 
  940. [dnt_users].[extcredits1], 
  941. [dnt_users].[extcredits2], 
  942. [dnt_users].[extcredits3], 
  943. [dnt_users].[extcredits4], 
  944. [dnt_users].[extcredits5], 
  945. [dnt_users].[extcredits6], 
  946. [dnt_users].[extcredits7], 
  947. [dnt_users].[extcredits8], 
  948. [dnt_users].[posts], 
  949. [dnt_users].[joindate], 
  950. [dnt_users].[onlinestate], 
  951. [dnt_users].[lastactivity], 
  952. [dnt_users].[invisible],
  953. [dnt_users].[oltime],
  954. [dnt_users].[lastvisit], 
  955. [dnt_userfields].[avatar], 
  956. [dnt_userfields].[avatarwidth], 
  957. [dnt_userfields].[avatarheight], 
  958. [dnt_userfields].[medals],
  959. [dnt_userfields].[sightml] AS signature, 
  960. [dnt_userfields].[location], 
  961. [dnt_userfields].[customstatus], 
  962. [dnt_userfields].[website], 
  963. [dnt_userfields].[icq], 
  964. [dnt_userfields].[qq], 
  965. [dnt_userfields].[msn], 
  966. [dnt_userfields].[yahoo], 
  967. [dnt_userfields].[skype] 
  968. FROM [dnt_posts1] LEFT JOIN [dnt_users] ON [dnt_users].[uid]=[dnt_posts1].[posterid] LEFT JOIN [dnt_userfields] ON [dnt_userfields].[uid]=[dnt_users].[uid] WHERE [dnt_posts1].[tid]=' + @tid + ' AND [dnt_posts1].[invisible]=0 AND [posterid] = '+@posterid+'  AND [pid] > (SELECT MAX([pid]) FROM (SELECT TOP ' + @pagetop + ' [dnt_posts1].[pid] FROM [dnt_posts1] LEFT JOIN [dnt_users] ON [dnt_users].[uid]=[dnt_posts1].[posterid] LEFT JOIN [dnt_userfields] ON [dnt_userfields].[uid]=[dnt_users].[uid] WHERE [dnt_posts1].[tid]=@tid  AND [posterid] = '+@posterid+'  ORDER BY [dnt_posts1].[pid]) AS tblTmp) ORDER BY [dnt_posts1].[pid]')