Previous Thread
Next Thread
Print Thread
Rating: 5
Joined: May 2001
Posts: 550
Code Monkey
Code Monkey
Offline
Joined: May 2001
Posts: 550
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.

Sponsored Links
Joined: Dec 2000
Posts: 1,471
Addict
Addict
Offline
Joined: Dec 2000
Posts: 1,471
Indead, very useful.
Thx!

Joined: May 2001
Posts: 550
Code Monkey
Code Monkey
Offline
Joined: May 2001
Posts: 550
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.

Joined: Jan 2003
Posts: 263
Member
Member
Joined: Jan 2003
Posts: 263
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!

Joined: Jul 2001
Posts: 808
Coder
Coder
Joined: Jul 2001
Posts: 808
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.

Sponsored Links
Joined: May 2001
Posts: 550
Code Monkey
Code Monkey
Offline
Joined: May 2001
Posts: 550
>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.

Joined: Jun 2002
Posts: 160
Member
Member
Offline
Joined: Jun 2002
Posts: 160
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.

Joined: May 2001
Posts: 550
Code Monkey
Code Monkey
Offline
Joined: May 2001
Posts: 550
Yes.

Joined: May 2005
Posts: 1
Lurker
Lurker
Offline
Joined: May 2005
Posts: 1


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
JAISP
JAISP
PA
Posts: 449
Joined: February 2008
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)