UBB.Dev
Mod Name / Version: Omit adding break tags when HTML is enabled

Description: This is the most non-spectacular modification I ever posted, but it can be extremely useful.

Till now when one inserted html in posts(with HTML enabled) it had to be formatted so the code is all on one line or it screwed it up.

Also there was no way to enter or edit the HTML correctly after the post has been posted since it would keep adding the pesky break tags again.

This mod fixes it.

Working Under: UBB.Threads 6.4-6.5

Mod Status: Finished

Any pre-requisites: none

Author(s): Anno

Date: 01/26/05

Credits:

Files Altered:
addpost.php
modifypost.php

New Files: none

Database Altered: no

Info/Instructions:
Code
 <br />In addpost.php <br /> <br />search for: <br /> <br />	$PrintBody = preg_replace("/(\r\n|\r|\n)/i","<br />",$PrintBody); <br /> <br />replace with: <br /> <br />if ($convert != "html"){ <br />	$PrintBody = preg_replace("/(\r\n|\r|\n)/i","<br />",$PrintBody); <br />} <br /> <br />search for: <br /> <br />	$Body = preg_replace("/(\r\n|\r|\n)/i","<br />",$Body); <br /> <br />replace with: <br /> <br />if ($convert != "html"){ <br />	$Body = preg_replace("/(\r\n|\r|\n)/i","<br />",$Body); <br />} <br /> <br /> <br />in modifypost.php <br /> <br />search for: <br /> <br />	$PrintBody = str_replace("\n","<br />",$PrintBody); <br /> <br />replace with: <br /> <br />if ($convert != "html"){ <br />	$PrintBody = preg_replace("/(\r\n|\r|\n)/i","<br />",$PrintBody); <br />} <br /> <br />search for: <br /> <br />	$Body = preg_replace("/(\r\n|\r|\n)/i","<br />",$Body); <br /> <br />replace with: <br /> <br />if ($convert != "html"){ <br />	$Body = preg_replace("/(\r\n|\r|\n)/i","<br />",$Body); <br />} <br /> <br />


Note: The above lines can differ a bit depending on the exact version you have.
But it should always be
$Body = preg_replace("a combination of /n and /r ","<br />",$Body);
$PrintBody = preg_replace("a combination of /n and /r ","<br />",$PrintBody);

The replace code is always as in the directions.

Disclaimer: Please backup every file that you intend to modify.
If the modification modifies the database, it's a good idea to backup your database before doing so.

Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.
Indead, very useful.
Thx!
Another clarification: these parts of the code seem to be very inconsistent over the different versions of the boards.

Some versions have only

$Body = preg_replace("/\n/i","<br />",$Body);

some do it twice for the same variable....

Your best bet to find all occurances of the break tag substitution is to search for

"<br />"

(including the quotes) in connection with the $Body, $Body_q and the $PrintBody variables.
If this is such a usefull "non-spectacular modification", then why did infopop never modify their code? Are their any 'dangers'/disadvantages by changing the code as desribed?

For me posting HTML in threads is always a pain in the ..s! I'm very glad with this mod and will test it out later tonight. Thanks!
This works well. Modifypost need another enhancement. While editing a HTML enabled posting UBBt convert some code. Example: I use
Code
&euro;
and edit the post. The editor now show me the euro char &#8364;. Then I submit it and now the posting shows me
Code
&#8364;
instead the euro char.
>If this is such a usefull "non-spectacular modification", then why did infopop
>never modify their code?

I have no idea. Laziness?

>Are their any 'dangers'/disadvantages by changing the code as desribed?

No.
This seems to be included in the 6.5.1 stock files. I went to apply this mod, but from what I could tell, it was already in place.
Yes.
Tnx, Anno!!

[:"#DFE6EF"]video strip poker[/]
© UBB.Developers