Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: General / Classic ASP versions(v3.4.XX)
 Only allow Admin's to post images?
 New Topic  Topic Locked
 Printer Friendly
Previous Page | Next Page
Author Previous Topic Topic Next Topic
Page: of 4

PackYakcouk
New Member

United Kingdom
59 Posts

Posted - 01 January 2009 :  14:33:17  Show Profile  Visit PackYakcouk's Homepage
Ok so i have enabled images, everytime i try to reply or start a topic i get the following error:

Microsoft VBScript compilation error '800a03f4'

Expected 'If'

/forum/inc_func_posting.asp, line 397

end function
----^



Here is my current code

		if strAllowForumCode = "1" then
			if mLev > 2 then
				if strIMGInPosts = "1" then
					fString = replace(fString, "<img src=""","", 1, -1, 1)
					fString = replace(fString, """ id=right border=0>","[/img=right]", 1, -1, 1)
					fString = replace(fString, """ id=left border=0>","[/img=left]", 1, -1, 1)
					'##
					fString = replace(fString, "<img align=""right"" src=""","[img=right]", 1, -1, 1)
					fString = replace(fString, "<img align=""left"" src=""","[img=left]", 1, -1, 1)
					fString = replace(fString, """ border=""0"">","", 1, -1, 1)
					fString = replace(fString, """ id=""right"" border=""0"">","[/img=right]", 1, -1, 1)
					fString = replace(fString, """ id=""left"" border=""0"">","[/img=left]", 1, -1, 1)
				end if
			end if
		end if	
		fString = Replace(fString, "'", "'")
	CleanCode = fString
end function
%>

<

Edited by - PackYakcouk on 01 January 2009 14:39:28
Go to Top of Page

MaD2ko0l
Senior Member

United Kingdom
1053 Posts

Posted - 01 January 2009 :  16:33:20  Show Profile  Visit MaD2ko0l's Homepage
looks leik u need at add another end if.

so inbetween these lines

		end if	
		fString = Replace(fString, "'", "'")


add end if so it looks liek this

		end if	
		end if	
		fString = Replace(fString, "'", "'")
<

© 1999-2010 MaD2ko0l
Go to Top of Page

PackYakcouk
New Member

United Kingdom
59 Posts

Posted - 01 January 2009 :  16:54:55  Show Profile  Visit PackYakcouk's Homepage
Thanks MaD2ko0l, i have added that and there is now no error message but it is still alowing normal members to insert images.

I have "Allow Images in posts" turned on in admin options.

This is my current code

if strAllowForumCode = "1" then
			if mLev > 2 then
				if strIMGInPosts = "1" then
					fString = replace(fString, "<img src=""","", 1, -1, 1)
					fString = replace(fString, """ id=right border=0>","[/img=right]", 1, -1, 1)
					fString = replace(fString, """ id=left border=0>","[/img=left]", 1, -1, 1)
					'##
					fString = replace(fString, "<img align=""right"" src=""","[img=right]", 1, -1, 1)
					fString = replace(fString, "<img align=""left"" src=""","[img=left]", 1, -1, 1)
					fString = replace(fString, """ border=""0"">","", 1, -1, 1)
					fString = replace(fString, """ id=""right"" border=""0"">","[/img=right]", 1, -1, 1)
					fString = replace(fString, """ id=""left"" border=""0"">","[/img=left]", 1, -1, 1)
				end if
			end if
		end if	
		end if
		fString = Replace(fString, "'", "'")
	CleanCode = fString
end function
%>


I hope some one can help, we seem to be getting some where!<
Go to Top of Page

Carefree
Advanced Member

Philippines
4217 Posts

Posted - 01 January 2009 :  17:15:19  Show Profile
OK - there's another bit in "inc_func_common.asp" that needs to be modified. Look for the following (appx lines 128-130):
		if strIMGInPosts = "1" then
			fString = ReplaceImageTags(fString)
		end if

Change that to read:
		if strIMGInPosts = "1" then
			if mLev > 2 then
				fString = ReplaceImageTags(fString)
			end if
		end if
<
Go to Top of Page

PackYakcouk
New Member

United Kingdom
59 Posts

Posted - 01 January 2009 :  17:25:02  Show Profile  Visit PackYakcouk's Homepage
Carefree, that has worked somewhat, i can now insert and see images in posts as an admin/mod.

The only problem is they dont show up in posts for normal members they just show up as text links.

I need the normal members to see the image but not be able to post them themselves.

Were getting so close im excited lol <

Edited by - PackYakcouk on 01 January 2009 17:27:12
Go to Top of Page

Carefree
Advanced Member

Philippines
4217 Posts

Posted - 01 January 2009 :  17:50:10  Show Profile
OK - let's eliminate the image button in the post form, while we're at it.

In "inc_post_buttons.asp", look for the following (appx 61-63)
if strIMGInPosts = "1" then
	Response.Write	"<a href=""Javascript:image();"" tabindex=""-1"">" & getCurrentIcon(strIconEditorImage,"Insert Image","align=""top""") & "</a>" & vbNewLine
end if


Replace it with
if strIMGInPosts = "1" then
	if mLev > 2 then
		Response.Write	"<a href=""Javascript:image();"" tabindex=""-1"">" & getCurrentIcon(strIconEditorImage,"Insert Image","align=""top""") & "</a>" & vbNewLine
	end if
end if


Now, let's change that "inc_func_common.asp" routine. Instead of this:
		if strIMGInPosts = "1" then
			if mLev > 2 then
				fString = ReplaceImageTags(fString)
			end if
		end if


Since the RqMethod wasn't being kept, we'll change the variable. Make it say this:
	if strAllowForumCode = "1" then
		fString = ReplaceURLs(fString)
		fString = ReplaceCodeTags(fString)
		if strIMGInPosts = "1" then
			if strMType = "Topi" or _
			strMType = "Edit" or _
			strMType = "Repl" or _
			strMType = "Foru" then
				if mLev > 2 then
					fString = ReplaceImageTags(fString)
				end if
			else
				fString = ReplaceImageTags(fString)
			end if
		end if
	end if


Now, we have to grab the value of the method before it disappears. Search for this line (appx line 287):
function chkString(pString,fField_Type) '## Types - name, password, title, message, url, urlpath, email, number, list


Immediately after it, add the following:
	strMType=left(MethodType,4)


Also, I added the strMType variable to "config.asp". Look for this line (appx 123):
Dim SubCount, MySubCount


After that, add the following:
Dim strMType


Now, that SHOULD work .... but I must be missing something obvious. This does keep the value of the MType variable and read it before processing the image tags ... but it processes them anyhow.<

Edited by - Carefree on 02 January 2009 20:42:40
Go to Top of Page

PackYakcouk
New Member

United Kingdom
59 Posts

Posted - 01 January 2009 :  18:18:22  Show Profile  Visit PackYakcouk's Homepage
Wow so ok that is amazing! ur a star!

Ok admins/mods can see and post images, members can see but not post images...

unless they know the [ img ][ /img ] tags. (I dont know if snitz image tags are universal on all forums?)

Im probably pushing my luck now but is there a way to stop members using them if they know them, maby changing the tags to something random eg:

So you used to use [ img ][ /img ] to insert an image.
now [ 5658 ][ /5658 ] will insert an image.

Thanks for all this help by the way!<

Edited by - PackYakcouk on 01 January 2009 18:18:42
Go to Top of Page

Carefree
Advanced Member

Philippines
4217 Posts

Posted - 01 January 2009 :  19:32:41  Show Profile
Even if they know the tags, they shouldn't be able to post them.<
Go to Top of Page

PackYakcouk
New Member

United Kingdom
59 Posts

Posted - 01 January 2009 :  19:38:41  Show Profile  Visit PackYakcouk's Homepage
Ive got a test "Normal Member" and it can still post images using the [ img ][ /img ] tags.

The "insert image" button does not show up when posting a new topic/post for "Normal Members" but if they know the tags they can post images and they do show up to all users.

<
Go to Top of Page

Carefree
Advanced Member

Philippines
4217 Posts

Posted - 02 January 2009 :  20:57:38  Show Profile
I packaged this on SnitzBitz with the latest changes. If anyone can spot what I missed, I'd be greatful.<
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20595 Posts

Posted - 03 January 2009 :  04:29:43  Show Profile  Visit HuwR's Homepage
from a quick glance, this is what I think would happen after making those changes.

Anyone could post an image in a topic/reply regardless of whether they are admin or not (if they guess the tag, infact they don't even need to guess it, simply quoting your message should give them the tag ) this is because tags are replaced at the time of viewing not posting.

as has been noted previously, if you prevent users posting images you must also prevent people from quoting your messages or you need to process the message and parse the img tags prior to storing it in the post in the database
<
Go to Top of Page

PackYakcouk
New Member

United Kingdom
59 Posts

Posted - 03 January 2009 :  04:36:08  Show Profile  Visit PackYakcouk's Homepage
Ok so can any of this be done?

Or am i hitting my head agains a wall? <
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20595 Posts

Posted - 03 January 2009 :  04:39:57  Show Profile  Visit HuwR's Homepage
yes it can be done, but it is a lot of effort for something that you could control fairly easily by just imposing a no image policy and then enforcing it by removing images and warning people who post them.

so, just remove the img button from post.asp, change the img tags default name and then strictly enforce a no img policy against members who try to bypass the changes.<
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 03 January 2009 :  11:02:20  Show Profile  Send ruirib a Yahoo! Message
quote:
Originally posted by Carefree

I packaged this on SnitzBitz with the latest changes. If anyone can spot what I missed, I'd be greatful.


Carefree,

Maybe the problem is with the approach you took, no? It really doesn't matter what you do while posting, since the tags are not changed when posting, but it does matter when viewing the topics, so what you need to do is make sure the tags are not interpreted when the author of the post being shown is not an admin, right?

This means that the check must be done for each post while the post is being viewed and only posts from an admin can have the image tags converted.<


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

Carefree
Advanced Member

Philippines
4217 Posts

Posted - 03 January 2009 :  13:36:05  Show Profile
Let me take a look at it from that direction, then. Thanks<
Go to Top of Page
Page: of 4 Previous Topic Topic Next Topic  
Previous Page | Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.29 seconds. Powered By: Snitz Forums 2000 Version 3.4.07