Here you go Podge. I have it working on the test site. If you see something to change, feel free.
Save the following as "dbs_links.asp". Run from admin console.
Allowed Links Mod v1.0
[ALTER]
FORUM
ADD#F_TOPICLINK#INT#NULL#1
ADD#F_REPLYLINK#INT#NULL#1
[END]
[UPDATE]
FORUM
F_TOPICLINK#1#
F_REPLYLINK#1#
[END]
Change the following files as indicated:
"inc_func_common.asp"
Add the following to the end of the file:
'########################################## Links Mod ##############################################
function WithoutLinks(strInput)
Set rx = New RegExp
With rx
.Pattern = "<(a*)([^/]*)/([A-Za-z0-9]?[^>]+)"">([A-Za-z0-9]?[^>]+)</a>"
.IgnoreCase = True
.Global = True
End With
if intLAllowed = 0 and strDBNTUserName > "" then
if Reply_ReplyID > 0 then
WithoutLinks = rx.Replace(strInput, "(Links not allowed in replies. Go <a href=""post.asp?method=Edit&TOPIC_ID=" & TopicID & "&REPLY_ID=" & Reply_ReplyID & "&FORUM_ID=" & FORUM_ID & """ target=""_self"">back</a> to edit this reply.)")
else
WithoutLinks = rx.Replace(strInput, "(Links not allowed in topics. Go <a href=""post.asp?method=EditTopic&TOPIC_ID=" & TopicID & "&REPLY_ID=" & TopicID & "&FORUM_ID=" & FORUM_ID & """ target=""_self"">back</a> to edit this topic.)")
end if
else
WithoutLinks = rx.Replace(strInput, "(<a href=""login.asp"" target=""_blank"">Login</a> to see this link.)")
end if
end Function
'########################################## Links Mod ##############################################
"post.asp"
Look for the following lines (appx 618-621):
Response.Write " </select>" & vbNewLine & _
" <a href=""Javascript:openWindow3('pop_help.asp?mode=options#category')"" tabindex=""-1"">" & getCurrentIcon(strIconSmileQuestion,"Click here to get more help on this option","") & "</a></td>" & vbNewLine & _
" </tr>" & vbNewLine
end if
After them, insert these:
'########################################## Links Mod ##############################################
if strRqMethod = "Forum" or strRqMethod = "EditForum" then
Response.Write " <tr>" & vbNewLine & _
" <td bgColor=""" & strPopUpTableColor & """ noWrap vAlign=""top"" align=""right""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><b>Links Permission:</b></font><br /><font face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """>(Links Allowed?)</font></td>" & vbNewLine & _
" <td bgColor=""" & strPopUpTableColor & """>" & vbNewLine & _
" <select name=""LinkAuth"" size=""1"">" & vbNewLine
if strRqMethod = "Forum" then
intTLink = 0
intRLink = 0
else
strSQL = "SELECT F_TOPICLINK, F_REPLYLINK FROM " & strTablePrefix & "FORUM WHERE FORUM_ID = " & strRqForumID
set rsLinks = my_Conn.Execute(strSQL)
if not rsLinks.EOF then
intTLink = rsLinks("F_TOPICLINK")
intRLink = rsLinks("F_REPLYLINK")
rsLinks.Close
end if
set rsLinks = Nothing
end if
Response.Write " <option value=""0"""
if intTLink = 0 and intRLink = 1 then Response.Write(" selected")
Response.Write ">Don't Allow Links in Topics</option>" & vbNewLine & _
" <option value=""1"""
if intTLink = 1 and intRLink = 0 then Response.Write(" selected")
Response.Write ">Don't Allow Links in Replies</option>" & vbNewLine & _
" <option value=""2"""
if intTLink = 0 and intRLink = 0 then Response.Write(" selected")
Response.Write ">Don't Allow Links in Topics or Replies</option>" & vbNewLine & _
" <option value=""3"""
if intTLink = 1 and intRLink = 1 then Response.Write(" selected")
Response.Write ">Allow Links in Topics and Replies</option>" & vbNewLine & _
" </select>" & vbNewLine & _
" <a href=""Javascript:openWindow3('pop_help.asp?mode=linksmod#permission')"" tabindex=""-1"">" & getCurrentIcon(strIconSmileQuestion,"Click here to get more help on this option","") & "</a></td>" & vbNewLine & _
" </tr>" & vbNewLine
end if
'########################################## Links Mod ##############################################
"post_info.asp"
Look for the following lines (appx 1428-1429):
strSql = strSql & ", F_DEFAULTDAYS = " & cLng(Request.Form("DefaultDays"))
strSql = strSql & ", F_COUNT_M_POSTS = " & cLng("0" & Request.Form("ForumCntMPosts"))
After them, insert these:
'########################################## Links Mod ##############################################
if ChkString(Request.Form("LinkAuth"), "SQLString") = 3 then
strSql = strSql & ", F_TOPICLINK = 1, F_REPLYLINK = 1"
elseif ChkString(Request.Form("LinkAuth"), "SQLString") = 2 then
strSql = strSql & ", F_TOPICLINK = 0, F_REPLYLINK = 0"
elseif ChkString(Request.Form("LinkAuth"), "SQLString") = 1 then
strSql = strSql & ", F_TOPICLINK = 1, F_REPLYLINK = 0"
else
strSql = strSql & ", F_TOPICLINK = 0, F_REPLYLINK = 1"
end if
'########################################## Links Mod ##############################################
Next, look for the following lines (appx 1220-1221):
strSql = strSql & ", " & ChkString(Request.Form("DefaultDays"), "SQLString")
strSql = strSql & ", " & ChkString(Request.Form("ForumCntMPosts"), "SQLString")
After them, insert these:
'########################################## Links Mod ##############################################
if ChkString(Request.Form("LinkAuth"), "SQLString") = 3 then
strSql = strSql & ", 1, 1"
elseif ChkString(Request.Form("LinkAuth"), "SQLString") = 2 then
strSql = strSql & ", 0, 0"
elseif ChkString(Request.Form("LinkAuth"), "SQLString") = 1 then
strSql = strSql & ", 1, 0"
else
strSql = strSql & ", 0, 1"
end if
'########################################## Links Mod ##############################################
Next, look for the following lines (appx 1189-1190):
strSql = strSql & ", F_DEFAULTDAYS "
strSql = strSql & ", F_COUNT_M_POSTS "
After them, insert these:
'########################################## Links Mod ##############################################
strSql = strSql & ", F_TOPICLINK "
strSql = strSql & ", F_REPLYLINK "
'########################################## Links Mod ##############################################
"topic.asp"
Look for the following lines (appx 848-852):
if Request.QueryString("SearchTerms") <> "" then
Response.Write SearchHiLite(formatStr(Topic_Message))
else
Response.Write formatStr(Topic_Message)
end if
Change them to say:
'########################################## Links Mod ##############################################
strSQL = "SELECT F_TOPICLINK FROM " & strTablePrefix & "FORUM WHERE FORUM_ID = " & Forum_ID
set rsLAllowed = my_Conn.Execute(strSQL)
intLAllowed = 0
if not rsLAllowed.EOF then
intLAllowed = rsLAllowed("F_TOPICLINK")
rsLAllowed.Close
end if
set rsLAllowed = Nothing
strSQL = "SELECT REPLY_ID FROM " & strTablePrefix & "REPLY WHERE TOPIC_ID = " & TopicID & " AND REPLY_ID = " & MemberID
set rsReplied = my_Conn.Execute(strSQL)
intReplied = 0
if not rsReplied.EOF or (TopicID = MemberID) then
intReplied = 1
rsReplied.Close
end if
set rsReplied = Nothing
if ((strDBNTUserName = "") or (intReplied = 0)) and (intLAllowed = 0) then
Cleaned_Topic_Message = WithoutLinks(formatStr(Topic_Message))
else
Cleaned_Topic_Message = formatStr(Topic_Message)
end if
if Request.QueryString("SearchTerms") <> "" then
Response.Write SearchHiLite(formatStr(Cleaned_Topic_Message))
else
Response.Write SearchHiLite(formatStr(Cleaned_Topic_Message))
end if
'########################################## Links Mod ##############################################
Next, look for the following lines (appx 644-647):
Response.Write " <hr noshade size=""" & strFooterFontSize & """></td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td valign=""top"" height=""100%""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strForumFontColor & """><span class=""spnMessageText"" id=""msg"">"
After them, insert these:
'########################################## Links Mod ##############################################
strSQL = "SELECT F_REPLYLINK FROM " & strTablePrefix & "FORUM WHERE FORUM_ID = " & Forum_ID
set rsLAllowed = my_Conn.Execute(strSQL)
intLAllowed = 0
if not rsLAllowed.EOF then
intLAllowed = rsLAllowed("F_REPLYLINK")
rsLAllowed.Close
end if
set rsLAllowed = Nothing
if ((strDBNTUserName = "") or (intReplied = 0)) and (intLAllowed = 0) then
Cleaned_Reply_Content = WithoutLinks(formatStr(Reply_Content))
else
Cleaned_Reply_Content = FormatStr(chkString(Reply_Content, "SQLString"))
end if
'########################################## Links Mod ##############################################
"pop_help.asp"
Look for the following line (appx 160):
case else
Above it, insert these:
'########################################## Links Mod ##############################################
case "linksmod"
'### Links Permission Help
Response.Write " <tr>" & vbNewLine & _
" <td bgcolor=""" & strCategoryCellColor & """><a name=""permission""></a><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strCategoryFontColor & """ ><b>What is Links Permissions?</b></font></td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td bgcolor=""" & strForumCellColor & """><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strForumFontColor & """>" & vbNewLine & _
" Links Permission allows you to choose whether links are allowed in topics or replies for a particular forum.<br /><br />" & vbNewLine & _
" <li><b>Don't Allow Links in Topics:</b> Links will be allowed in replies within a forum, but not in new topics.</li>" & vbNewLine & _
" <li><b>Don't Allow Links in Replies:</b> Links will be allowed in topics within a forum, but not in replies.</li>" & vbNewLine & _
" <li><b>Don't Allow Links in Topics or Replies:</b> No links will be allowed in either topics or replies within a forum.</li>" & vbNewLine & _
" <li><b>Allow Links in Topics and Replies:</b> This is the default setting. Links will be allowed in both topics and replies within a forum.</li></font>" & vbNewLine & _
" <a href=""#top"">" & getCurrentIcon(strIconGoUp,"Go To Top Of Page","align=""right""") & "</a>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine
'##################################################################################################
link the example that i already post HTML <A href="http://forum.snitz.com/forum/topic.asp?TOPIC_ID=69731&whichpage=2"><FONT color=#008000 size=4>forum.snitz</FONT></A>
Edited by - AHMEDHHH1 on 09 November 2010 16:36:27