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

 All Forums
 Snitz Forums 2000 DEV-Group
 DEV Bug Reports (Open)
 BUG (3.1sr4): IMG's broke: HTML/Forum Code
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

leif
Starting Member

Norway
23 Posts

Posted - 08 January 2001 :  05:22:17  Show Profile
I allow HTML codes.

If I post a message that contains
<img src="anim.gif">
it will look OK when I read my post.

But if I try to edit it, it is transformed to
[img]anim.gif">
If I post that It doesn't work anymore.

You shouldn't transform <> to [] if HTML is allowed.

-Leif



Edited by - leif on 08 January 2001 05:23:30

Edited by - leif on 08 January 2001 05:24:12

HuwR
Forum Admin

United Kingdom
20595 Posts

Posted - 08 January 2001 :  05:59:07  Show Profile  Visit HuwR's Homepage
This is because you have both html and forum code enabled.

when you use [ img ] it is converted to < img src= if you therefore insert an image using < img src= how will it know that it is supposed to be a Forum tag or a HTML tag.

This behaviour can be fixed, but may cause some existing image code to be translated incorrectly

in inc_functions.asp look for this code

if strIMGInPosts = "1" then
fString = replace(fString, "<img src=""","[ img]", 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>","[/img]", 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

Change it to this

if strIMGInPosts = "1" then
fString = replace(fString, "<img id=""img"" src=""","[ img]", 1, -1, 1)
fString = replace(fString, "<img id=""img"" align=right src=""","[ img=right]", 1, -1, 1)
fString = replace(fString, "<img id=""img"" align=left src=""","[ img=left]", 1, -1, 1)
fString = replace(fString, """ border=0>","[ /img]", 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

Next look for

if strIMGInPosts = "1" then
fString = doCode(fString, "[ img]","[ /img]","<img src=""",""" border=0>")
fString = doCode(fString, "[ image]","[ /image]","<img src=""",""" border=0>")
fString = doCode(fString, "[ img=right]","[ /img=right]","<img align=right src=""",""" id=right border=0>")
fString = doCode(fString, "[ image=right]","[ /image=right]","<img align=right src=""",""" id=right border=0>")
fString = doCode(fString, "[ img=left]","[ /img=left]","<img align=left src=""",""" id=left border=0>")
fString = doCode(fString, "[ image=left]","[ /image=left]","<img align=left src=""",""" id=left border=0>")
end if

And change it to this..

if strIMGInPosts = "1" then
fString = doCode(fString, "[ img]","[ /img]","<img id=""img"" src=""",""" border=0>")
fString = doCode(fString, "[ image]","[ /image]","<img id=""img"" src=""",""" border=0>")
fString = doCode(fString, "[ img=right]","[ /img=right]","<img id=""img"" align=right src=""",""" id=right border=0>")
fString = doCode(fString, "[ image=right]","[ /image=right]","<img id=""img"" align=right src=""",""" id=right border=0>")
fString = doCode(fString, "[ img=left]","[ /img=left]","<img id=""img"" align=left src=""",""" id=left border=0>")
fString = doCode(fString, "[ img=left]","[ /img=left]","<img id=""img"" align=left src=""",""" id=left border=0>")
end if


Don't forget to remove the spaces in the [ ]

'Resistance is futile'

Edited by - Huwr on 08 January 2001 06:00:18

Edited by - Huwr on 08 January 2001 09:10:42
Go to Top of Page

leif
Starting Member

Norway
23 Posts

Posted - 08 January 2001 :  08:45:56  Show Profile
Thank you,

There was a mistake in the last line, but I got it working:
fString = doCode(fString, "[ image=left]","[ /image=left]","<img id=""img"" align=left src=""",""" id=left border=0>")


It looks much better now. Only one problem left: <br> is transformed into
[br ]


I would like to see this added to the source.


-Leif M.



Edited by - leif on 08 January 2001 08:46:50

Edited by - leif on 08 January 2001 08:47:53

Edited by - leif on 08 January 2001 08:48:32
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20595 Posts

Posted - 08 January 2001 :  09:12:44  Show Profile  Visit HuwR's Homepage
quote:

Thank you,

There was a mistake in the last line, but I got it working:
fString = doCode(fString, "[ image=left]","[ /image=left]","<img id=""img"" align=left src=""",""" id=left border=0>")


It looks much better now. Only one problem left: <br> is transformed into
[br ]


I would like to see this added to the source.


-Leif M.



Edited by - leif on 08 January 2001 08:46:50

Edited by - leif on 08 January 2001 08:47:53

Edited by - leif on 08 January 2001 08:48:32



the transforming of < br > to [ br ] shouldn't make any difference.

'Resistance is futile'
Go to Top of Page

Reinsnitz
Snitz Forums Admin

USA
3545 Posts

Posted - 08 January 2001 :  14:05:44  Show Profile  Visit Reinsnitz's Homepage  Send Reinsnitz an AOL message  Send Reinsnitz an ICQ Message  Send Reinsnitz a Yahoo! Message
hmmm... Gor... what is your take on doing this... It would mean another conversion of all text in posts on existing forums... so a small couple lines in the setup.asp... but thats about it... do you agree?

Reinsnitz (Mike)
><)))'>
"The glory of young men is their strength, and the honor of old men is their gray hair." - Proverbs 20:29
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20595 Posts

Posted - 08 January 2001 :  14:41:35  Show Profile  Visit HuwR's Homepage
actually there is an easier way,

if you leave this code in

if strIMGInPosts = "1" then fString = replace(fString, "<img src=""","[ img]", 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>","[/img]", 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


and just add this code in staed of replacing

if strIMGInPosts = "1" then fString = replace(fString, "<img id=""img"" src=""","[ img]", 1, -1, 1) fString = replace(fString, "<img id=""img"" align=right src=""","[ img=right]", 1, -1, 1) fString = replace(fString, "<img id=""img"" align=left src=""","[ img=left]", 1, -1, 1) fString = replace(fString, """ border=0>","[ /img]", 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

it will convert all the images for you as the are loaded, but any new ones will be saved in the new format.

'Resistance is futile'
Go to Top of Page

frankie
Junior Member

Vatican City
304 Posts

Posted - 08 January 2001 :  15:01:26  Show Profile  Visit frankie's Homepage  Send frankie an AOL message  Send frankie an ICQ Message  Send frankie a Yahoo! Message
do we have to do this for the smilie images too?

ô¿~
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20595 Posts

Posted - 08 January 2001 :  15:20:59  Show Profile  Visit HuwR's Homepage
In the strictest sense yes but dealing with the smilies is easier

look for the CleanCode function in inc_functions.asp

next look for

if strIcons = "1" then
....
.....
end if

cut out the whole section and then paste it before
if strAllowForumCode = "1" then

they smiles will then get translated first and should prevent any probs.

'Resistance is futile'
Go to Top of Page

leif
Starting Member

Norway
23 Posts

Posted - 12 January 2001 :  18:12:29  Show Profile
HuwR's code above fixes the HTML in the message body, but I still see similar problems.

I.e. I like to put a <img src="banner.gif"> in the subject field when I create a new forum. It workes as planned after I post (a really nice effect), but if I have to edit it is messed up...

-Leif

Go to Top of Page

HuwR
Forum Admin

United Kingdom
20595 Posts

Posted - 12 January 2001 :  18:49:02  Show Profile  Visit HuwR's Homepage
Leif, could you post an example of what it looks like when you edit it

'Resistance is futile'
Go to Top of Page

leif
Starting Member

Norway
23 Posts

Posted - 13 January 2001 :  05:30:56  Show Profile
It looks like this:
<img src=

That's all is shows in the input field. But to the right of this (on the blue background) it will say
" size="40">


If I view the HTML source in my browser, this is what it will look like:
<td bgColor="navyblue"><input maxLength="50" name="Subject" value="<img src="background.gif">" size="40"></td>


-Leif



Edited by - leif on 13 January 2001 05:31:45
Go to Top of Page

leif
Starting Member

Norway
23 Posts

Posted - 22 January 2001 :  05:17:56  Show Profile
Hi again,

I guess I'm pushing it, but not everything is working in the message body either.

Example: I try to post the Google search routine:

<!-- Search Google -->
<center>
<FORM method=GET action=http://www.google.com/custom>
<TABLE bgcolor=#FFFFFF cellspacing=0 border=0>
<tr valign=top><td>
<A HREF=http://www.google.com/search>
<IMG SRC=http://www.google.com/logos/Logo_40wht.gif border=0 ALT=Google align=middle></A>
</td>
<td>
<INPUT TYPE=text name=q size=31 maxlength=255 value="">
<INPUT type=submit name=sa VALUE="Google Search">
<INPUT type=hidden name=cof VALUE="L:http://www.fugro.nl/grfx/header_1.gif;AH:center;AWFID:b47f1e2366d86093;">
<font face=arial,sans-serif size=-1><input type=hidden name=domains value="None"><br><input type=radio name=sitesearch value="" checked> Search WWW <input type=radio name=sitesearch value="None"> Search None </font><br>
</td></tr></TABLE>
</FORM>
</center>
<!-- Search Google -->


This doesn't turn out very good.

If I cut it down to just the "advanced" part, I can get it working:

<FORM method=GET action=http://www.google.com/custom>
<INPUT TYPE=text name=q size=31 maxlength=255 value="">
<INPUT type=submit name=sa VALUE="Google Search">


So where exactly does it go wrong?

-Leif


Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 22 January 2001 :  07:34:13  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
leif,

i think the problem you are having with adding the google search is with some extra html i have found in snitz. check out this post on this subject and maybe it will help..

http://forum.snitz.com/forum/link.asp?TOPIC_ID=3673

Brad
Go to Top of Page

leif
Starting Member

Norway
23 Posts

Posted - 23 January 2001 :  16:02:57  Show Profile
I have finally found some answers

1) The problem with broken
<img src="image.gif">
when editing a subject field, is solved by changing the
<input field>
to a
<textarea>
with rows="1". I think it is impossible to pre-display double quote characters in a input field. This changes the look a bit so I propose a "if" test: if allowedHTML then textarea else inputfield.

2) Posting the google search script: The f_description only allow for 255 characters as it is a "text" type. I have edited the database and changed it to "memo" and everything works fine.

3) To ensure that code posted as HTML will look like HTML when you edit it:
In function CleanCode (line 151 in inc_functions.asp) change to:
if strAllowForumCode = "1" and strAllowHTML <> "1" then

This fixes all the HTML.

-Leif


Edited by - leif on 23 January 2001 16:05:14
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20595 Posts

Posted - 23 January 2001 :  20:29:19  Show Profile  Visit HuwR's Homepage
quote:

if strAllowForumCode = "1" and strAllowHTML <> "1" then



Uhm, I think this is what you call a hack, basically what you are doing is converting the forum code to HTML, but not converting it back.

'Resistance is futile'
Go to Top of Page

Reinsnitz
Snitz Forums Admin

USA
3545 Posts

Posted - 26 February 2001 :  09:53:56  Show Profile  Visit Reinsnitz's Homepage  Send Reinsnitz an AOL message  Send Reinsnitz an ICQ Message  Send Reinsnitz a Yahoo! Message
I'm strongly inclined to disable forum code while HTML is enabled... and vice versa...

objections? praise? complaints?

Reinsnitz (Mike)
><)))'> Need a Mod?
"Therefore go and make disciples of all nations,..." Matthew 28:19a
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
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.13 seconds. Powered By: Snitz Forums 2000 Version 3.4.07