Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Feb 2007
Posts: 329
Yarp™
Yarp™
Offline
Joined: Feb 2007
Posts: 329
UBB 7.3 kinda has a bug that I was happy with, you can't quote so deep.

I made some code that checks for the quote level, and gives an error if you quote more then 3 levels deep.

open /scripts/addpost.inc.php

find:
Code
	// -------------------------------------
// Make sure there is a subject and body

add above:

Code

// ---------------------
// Check maximum quote level

unset($total);
preg_match_all('%(\[quote=.+?\]|\[quote\]|\[/quote\])%', $Body, $result, PREG_PATTERN_ORDER);
for ($i = 0; $i < count($result[0]); $i++) {
$total .= $result[0][$i];
}
if (preg_match('%(\[/quote\]){4,}%', $total)) {
$html -> not_right($ubbt_lang['MAX_QUOTE']);
};

open /languages/english/addpost.php (plus every other language you might have)

find
Code
$ubbt_lang['VIEW_POST'] = "View your post.";

add below:
Code
$ubbt_lang['MAX_QUOTE'] = "For readability you can only quote messages 3 levels deep. Please edit your message and try again.";

The 3 levels deep is hardcoded in the regex, so if you want to change it, change the regex.

Last edited by blaaskaak; 08/01/2008 2:33 AM. Reason: update
Sponsored Links
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
Interesting smile Does your forum have issues with it? I understand there's a bug, but does your users actually exploit it? smile


- Allen wavey
- What Drives You?
Joined: Feb 2007
Posts: 329
Yarp™
Yarp™
Offline
Joined: Feb 2007
Posts: 329
Well, issues...

Some users just hit quote, type their reply and that's it. If a couple users do that, imho it looks butt-ugly laugh over 5-6 quotes deep make little to no sense to me conversation wise.

SD can testify that I played with quote in quote regexes before. It's just that UBB's bug sort of made us tell the members "it is forbidden from now on to quote so deep".

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
Understand - I use the quickreply mostly, rarely the quote smile


- Allen wavey
- What Drives You?
Joined: Nov 2003
Posts: 482
Enthusiast
Enthusiast
Offline
Joined: Nov 2003
Posts: 482
Originally Posted by AllenAyres
Understand - I use the quickreply mostly, rarely the quote smile


i'm a quick/quote kinda guy.. and we need to fix the quote bug too smile

Sponsored Links
Joined: Feb 2007
Posts: 329
Yarp™
Yarp™
Offline
Joined: Feb 2007
Posts: 329
First post is updated, the regex originally posted gave some false positives if you would have 7+ normal quotes in a message.

Thanks to SD for helping thinking this new construction up.


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
Gizmo
Gizmo
Portland, OR, USA
Posts: 5,833
Joined: January 2000
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)