PDA

View Full Version : Improved Thread Preview Hack


N!ck
03-02-2002, 10:00 PM
The idea for this hack was originally that of Parker Clack, a regular here on vBulletin.org.

What this hack does:
Basically, this hack pops up a little box/window when the mouse is run over a thread title that shows the first three hundred characters of the first post in the thread (that is, the post that started the thread).

Improvements to Parker Clack's hack:

Far, far less code... ;)
Easier installation (one file edit, one template edit)... ;)
Less space usage...the beginning of the first post in each thread is not stored twice - only once now!... ;)


Versions:
3.0: Overgrow's search page thread preview instructions.
2.1: Added some necessary instructions.
2.0 Reduced MySQL queries significantly.
1.0 Initial release.

Comments appreciated... :)

A version for vbHacker is available here (https://vborg.vbsupport.ru/attachment.php?s=&postid=231727) - note: some files may need fixing afterward if they present parse errors!

How to Censor Previews (by nakkid)
See page seven of this thread.

A very important security fix is available here (https://vborg.vbsupport.ru/showthread.php?s=&action=showpost&postid=374018) - I have not updated the ZIP, so install it after you install the hack

Overgrow
03-03-2002, 05:28 AM
HEY that is really nice. I like it, flawless installation and very simple code.

I don't like that it adds a query on the post table for each thread listed.. that's an extra 40 or 50 queries with each forumdisplay. Is it possible to compile a list of all threads that will be displayed on the page and then run one query and pull all the post info at once?

Right now I have it only operating for admins since I don't want to add so much extra load. Thanks, nice work.

N!ck
03-03-2002, 05:31 AM
as far as i know, the choices are a) store the same data twice for every single thread or b) run a few extra queries! :)

maybe someone can prove me wrong or i can ponder it for awhile

N!ck
03-03-2002, 05:39 AM
yeah...looking at it, i'm almost positive the only way is to run extra queries

Overgrow
03-03-2002, 05:52 AM
Nope, a join will do it. I've got it re-written..

old way: mysql things 1.10 seconds
new way: mysql things 0.09 seconds

Only problem is it joins the post table again which won't work if you have dotqueries turned on. It will take a little more re-writing to get it to work with dotqueries.


// HACK POST PREVIEW
if($bbuserinfo['usergroupid']==6 and $showposts!="off") {
$previewselect="post.pagetext as pagetext,";
$previewjoin="LEFT JOIN post ON (thread.firstpostid = post.postid)";
}
// END PREVIEW

$threads=$DB_site->query("
SELECT $dotuserid $votequery $previewselect ".iif($foruminfo[allowicons],
'icon.title as icontitle,icon.iconpath,','')."
thread.threadid,thread.title,lastpost, forumid,pollid,open,replycount,postusername,postus erid,
lastposter,thread.dateline,views,thread.iconid,
notes,thread.visible,sticky,votetotal,attach
FROM thread
".iif($foruminfo[allowicons],'LEFT JOIN icon ON (icon.iconid = thread.iconid)','')."
$dotjoin $previewjoin
WHERE $threadids
ORDER BY sticky DESC, $sortfield $sqlsortorder
");


Then reference thread[pagetext] down below instead of running the query each time. Works like a charm without the extra db overhead, but like I said, will take a little tweaking to get it to go with dotqueries.

Overgrow
03-03-2002, 05:54 AM
You want to finish it up? :D

N!ck
03-03-2002, 05:55 AM
okay...thanks...i'll test that out and issue an update

N!ck
03-03-2002, 06:02 AM
well....i got a database error. i must have done something wrong.

N!ck
03-03-2002, 06:06 AM
Database error in vBulletin 2.2.2:

Invalid SQL:
SELECT DISTINCT post.userid, post.pagetext as pagetext, icon.title as icontitle,icon.iconpath,
thread.threadid,thread.title,lastpost, forumid,pollid,open,replycount,postusername,postus erid,
lastposter,thread.dateline,views,thread.iconid,
notes,thread.visible,sticky,votetotal,attach
FROM thread
LEFT JOIN icon ON (icon.iconid = thread.iconid)
LEFT JOIN post ON (thread.threadid = post.threadid AND post.userid = '1') LEFT JOIN post ON (thread.firstpostid = post.postid)
WHERE thread.threadid IN (0,13,16)
ORDER BY sticky DESC, lastpost DESC

mysql error: Not unique table/alias: 'post'

mysql error number: 1066

Date: Sunday 03rd of March 2002 03:08:13 AM
Script: http://www.60schevytrucks.com/forums/forums/forumdisplay.php?s=&forumid=6
Referer: http://www.60schevytrucks.com/forums/showthread.php?s=&threadid=13

Overgrow
03-03-2002, 06:09 AM
Yup, you have dotqueries turned on. Go to your admin Cpanel and turn off "Use dot icons" -- I did point that out as a problem in my previous post :) It is trying to join the post table twice. You'll have to write an exception to check if dotqueries is turned on and if it is, change the join again.

I don't use the dots since I didn't think the join was worth it.. but for me, the join is worth it for the preview.

N!ck
03-03-2002, 06:11 AM
hmmm. k thanks

Overgrow
03-03-2002, 06:11 AM
Also you might want to use this regular expression to modify the pagetext-- it will remove the vBCode for a cleaner display:


$thread[pagetext]=preg_replace("/\[[^\]]*\]/","",$thread[pagetext]);


HEY THIS PHP PARSER IS EATING MY REGEX..... do not use the above code.. I'm leaving it there to point out a flaw in vB's php code thingy... here is the correct regex

$thread[pagetext]=preg_replace("/\[[^\]]*\]/","",$thread[pagetext]);

(notice the slashes)

Overgrow
03-03-2002, 08:33 AM
Quotes also screw up the preview.. so I'm using these two lines to clean up the display:

$thread[pagetext]=preg_replace("/\[[^\]]*\]/","",$thread[pagetext]);
$thread[pagetext]=str_replace("\"","",$thread[pagetext]);

Parker Clack
03-03-2002, 12:44 PM
nick:

I had tried to use something like this originally when I wrote this but the extra queries to the database on my large board just about brought it to its knees. So Bira, Chen and wluke came up with the coding to use, as is included with the original hack I wrote, so that it doesn't take up some much in the way of system resources. Either way will work. Thanks for posting another way of doing this.

You might want to have Chen, Bira or wluke to look over the code this code too to see what they think.

Parker

Parker Clack
03-03-2002, 12:45 PM
Overgrow:

Those two lines didn't remove any of the quotes from the text preview. The UBB code is removed though now.

Parker

Overgrow
03-03-2002, 02:05 PM
Hi Parker, great idea for a hack.

I do believe that the JOIN is the way this should be done. It may never work properly with dot-icons since they both want to join the same query, but this is definitely the most efficient way-- there is no duplicate DB data in the thread table and it does not add 50 extra queries with each forumdisplay.

re: quotes... those two lines I put up above, the preg_replace and str_replace do work for me. The first removes vBCode and the second removes quotes. The second is very simple.. replace a quote with nothing, it works for me just fine.

Freddie Bingham
03-03-2002, 03:20 PM
Maybe this will help you out a bitSELECT DISTINCT post.userid, post2.pagetext as pagetext, icon.title as icontitle,icon.iconpath,
thread.threadid,thread.title,lastpost, forumid,pollid,open,replycount,postusername,postus erid,
lastposter,thread.dateline,views,thread.iconid,
notes,thread.visible,sticky,votetotal,attach
FROM thread
LEFT JOIN icon ON (icon.iconid = thread.iconid)
LEFT JOIN post ON (thread.threadid = post.threadid AND post.userid = '1')
LEFT JOIN post AS post2 ON (thread.firstpostid = post2.postid)
WHERE thread.threadid IN (0,13,16)
ORDER BY sticky DESC, lastpost DESC

Overgrow
03-03-2002, 03:28 PM
BRILLIANT. I had no idea you could do that ;)

nick, this is definitely possible to do with a JOIN and not have redundant info in the DB and not add any more queries and have it work with doticons. Yell if you want ideas on putting it all together.

Overgrow
03-03-2002, 03:29 PM
ps. this would be a great feature for v3. I expect it to actually cut bandwidth as people stop clicking on posts that don't really interest them.

N!ck
03-03-2002, 05:09 PM
this has gotten over my head :)

i get errors with freddie's ('cause of the dotqueries thing?)...and the guy that hosts my site doesn't know what dotqueries are...and i'm not sure exactly what to tell him.

N!ck
03-03-2002, 06:03 PM
i have an idea...overgrow, post your forumdisplay.php as an attachment and i'll look at that part...

you and freddie will get credit now as well, of course ;)

Overgrow
03-03-2002, 07:19 PM
>>overgrow, post your forumdisplay.php as an attachment

Sorry, can't post whole vB files as it violates the license. Freddie made this super easy though.. I see no reason why this wasn't suggested as the first way to code the hack. Here is the important part of forumdisplay.. add the first part and modify the query by including $previewselect and $previewjoin.


// HACK POST PREVIEW
$previewselect="post2.pagetext as pagetext,";
$previewjoin="LEFT JOIN post AS post2 ON (thread.firstpostid = post2.postid)";
// END PREVIEW

$threads=$DB_site->query("
SELECT $dotuserid $votequery $previewselect "
.iif($foruminfo[allowicons],'icon.title as icontitle,icon.iconpath,','')."
thread.threadid,thread.title,lastpost, forumid,pollid,open,replycount,postusername,postus erid,
lastposter,thread.dateline,views,thread.iconid,not es,thread.visible,sticky,votetotal,attach
FROM thread
".iif($foruminfo[allowicons],'LEFT JOIN icon ON (icon.iconid = thread.iconid)','')."
$dotjoin $previewjoin
WHERE $threadids
ORDER BY sticky DESC, $sortfield $sqlsortorder
");



One of my users asked why this didn't work for search results, so that is pretty easy to move over. Search.php

find:


$dotuserid = '';
$dotjoin = '';
}


below that add


// HACK POST PREVIEW
$previewselect="post2.pagetext as pagetext,";
$previewjoin="LEFT JOIN post AS post2 ON (thread.firstpostid = post2.postid)";
// END PREVIEW



find

user.userid AS postuserid,

replace with

user.userid AS postuserid, $previewselect


find

LEFT JOIN icon AS threadicon ON thread.iconid=threadicon.iconid
$dotjoin

replace with

LEFT JOIN icon AS threadicon ON thread.iconid=threadicon.iconid
$dotjoin $previewjoin


find


$searchresult['pagetext'] = $ignoreduser;
$searchresult['posttitle'] = $ignoreduser;
} else {


below that add


// POST PREVIEW HACK
$searchresult[pagetext]=preg_replace("/\[[^\]]*\]/","",$searchresult[pagetext]);
$searchresult[pagetext]=str_replace("\"","",$searchresult[pagetext]);
if (strlen($searchresult[pagetext]) > 300) {
$fppreview = substr($searchresult[pagetext], 0, 300) . "...";
} else {
$fppreview = $searchresult[pagetext];
}
// END PREVIEW


Then put $fppreview in the searchresultbit_threadonly template.

I noticed this was your first project so I hope you write this all up into a new hack so it's not confusing for the other users. thanks~

N!ck
03-03-2002, 08:42 PM
ouch...forgot about the license... :O

okay...well this is the error i get (again, i'm not sure whether it's related to this 'dotqueries' thing ;)):


Database error in vBulletin 2.2.2:

Invalid SQL:
SELECT DISTINCT post.userid, post2.pagetext as pagetext, icon.title as icontitle,icon.iconpath,
thread.threadid,thread.title,lastpost, forumid,pollid,open,replycount,postusername,postus erid,
lastposter,thread.dateline,views,thread.iconid,not es,thread.visible,sticky,votetotal,attach
FROM thread
LEFT JOIN icon ON (icon.iconid = thread.iconid)
LEFT JOIN post ON (thread.threadid = post.threadid AND post.userid = '1') LEFT JOIN post AS post2 ON (thread.firstpostid = post2.postid)
WHERE thread.threadid IN (0,8,17,1,15,7)
ORDER BY sticky DESC, lastpost DESC

mysql error: Unknown column 'thread.firstpostid' in 'on clause'

mysql error number: 1054

Date: Sunday 03rd of March 2002 05:43:42 PM
Script: http://www.60schevytrucks.com/forums/forums/forumdisplay.php?s=&forumid=4
Referer: http://www.60schevytrucks.com/forums/

Overgrow
03-03-2002, 08:57 PM
Not sure what to tell you.. this is right out of my forumdisplay.php and it works. I just turned on "Use Dot Icons" in the Cpanel, which affects this query, and they both worked at the same time.. which was the main goal. The second join slowed it down, too much for my site, but probably OK for others.

Overgrow
03-03-2002, 08:58 PM
// HACK POST PREVIEW
$previewselect="post2.pagetext as pagetext,";
$previewjoin="LEFT JOIN post AS post2 ON (thread.firstpostid = post2.postid)";
// END PREVIEW

$threads=$DB_site->query("
SELECT $dotuserid $votequery $previewselect ".iif($foruminfo[allowicons],'icon.title as icontitle,icon.iconpath,','')."
thread.threadid,thread.title,lastpost, forumid,pollid,open,replycount,postusername,postus erid,
lastposter,thread.dateline,views,thread.iconid,not es,thread.visible,sticky,votetotal,attach
FROM thread
".iif($foruminfo[allowicons],'LEFT JOIN icon ON (icon.iconid = thread.iconid)','')."
$dotjoin $previewjoin
WHERE $threadids
ORDER BY sticky DESC, $sortfield $sqlsortorder
");

Freddie Bingham
03-03-2002, 09:26 PM
'thread.firstpostid' isn't a default field in vBulletin. It makes the hack easy as you know what to join on but you have to make other modifications to newthread to save the first postid when the thread is created. I saw it in the queries you guys posted but I don't see it in the hack instructions so I was wondering how you were making this work without creating that field.

Freddie Bingham
03-03-2002, 09:28 PM
If it is slowing you down, make sure you have put an index on "thread.firstpostid" otherwise you are going to have a full thread table scan which is bad(tm).

N!ck
03-03-2002, 10:21 PM
i made it work...i even made an install script to add and populate the extra field :) works like a charm, expect an update tonight

N!ck
03-04-2002, 02:42 AM
update released!

thread previews on searches will be in the next update

Erwin
03-04-2002, 08:38 AM
I'm using Parker's fantastic hack with no problems. How much does this hack improve on Parker's? I'm just wondering whether it is worth the changeover... :)

N!ck
03-04-2002, 12:04 PM
this hack will save you a huge amount of space. rather than storing the beginning of the first post of a thread, it stores only the ID of the first post!

if you DO want to change back over, you'll need to drop the extra field in your "thread" table and do some modifications to newthread.php and forumdisplay.php (and perhaps some un-modifications to other files as well ;)), then run the install script. really all the install script does is creates the new field ("firstpostid") and goes through each thread (this may take some time and bandwidth depending on the number of threads you have - my fairly new board had about 20 threads and the install script still went as fast as lightning), getting the ID of the first post and storing it.

Parker Clack
03-04-2002, 03:59 PM
nick:

Nice way of doing this. When you get it all together with freddie's and Overgrow's suggestions and the search function finished could you put it all together in one file to download?

Thanks for idea of adding this to the search page though. I never thought of that!

Since I have over 200G of storage space on my server space is not an issue. :)

Parker

N!ck
03-04-2002, 09:34 PM
Parker, the search page previews are Overgrow's idea :)

The instructions for the search page will be in version 3.0 of the hack...probably to be released tonight because I think I'll just steal Overgrow's entire post (and give him credit for that of course) and put it in a text file.

N!ck
03-05-2002, 10:39 PM
The search page instructions have been added. :)

N!ck
03-06-2002, 09:28 PM
bump :D

N!ck
03-08-2002, 12:41 AM
:D

freakyshiat
03-08-2002, 02:58 AM
is it easy to uninstall this biatch? :D

I had Parker's one for a while, but i reverted back to the original php files

Parker Clack
03-08-2002, 03:45 AM
Fazle:

Did you have problems with it on your board? So far so good for me using either version.

Parker

freakyshiat
03-08-2002, 03:54 AM
Originally posted by Parker Clack
Fazle:

Did you have problems with it on your board? So far so good for me using either version.

Parker
oh no, not at all.... my board has 350-420 users online usually around peak times and gets 22k-25k posts a day...so the extra queries were making things a little slow :)

N!ck
03-08-2002, 10:44 PM
there's a new version with no extra queries ;) download it, make the appropriate changes to your forumdisplay.php, and (if you want), do the modifications to search.php

Overgrow
03-08-2002, 10:50 PM
oh man your users post alot! wow.. the new version doesn't slow anything down for large sites. Users love it, go for it..

freakyshiat
03-09-2002, 08:11 AM
Originally posted by Overgrow
oh man your users post alot! wow.. the new version doesn't slow anything down for large sites. Users love it, go for it..
damn, I am itchin to do it :p

freakyshiat
03-12-2002, 02:15 AM
How easy is it to uninstall this hack? Besides reverting to the changed files, do I need to do anything else?

Overgrow
03-12-2002, 02:20 AM
Did it not work for you? I had quite a few online today :D and it held up fine. It does increase page size (ouch bandwidth) but I figure it helps reduce bandwidth by having people not click on threads they normally would have. I know it stops me from having to click on a lot.

Overgrow
03-12-2002, 02:21 AM
Revert the files and remove the "title" from the templates, if it needs to go.

freakyshiat
03-12-2002, 02:29 AM
Originally posted by Overgrow
Did it not work for you? I had quite a few online today :D and it held up fine. It does increase page size (ouch bandwidth) but I figure it helps reduce bandwidth by having people not click on threads they normally would have. I know it stops me from having to click on a lot.
i havent installed it yet, I have 419 users online right this second.... so reverting the php files will uninstall the hack? how about that database table?

Overgrow
03-12-2002, 02:37 AM
Yea I had to check out your site :D I have 19 fewer on right now, but hit my record today. (Always seem to on Mondays)

I can't get the latest version of this hack! I have my own version installed since I wrote some of this code but... due to vBulletin's problem with cached attachments, I can't get the latest version. If you send it to me in email, webmaster@overgrow.com, or attach it here in a post, I can look at it and make sure there is nothing else to uninstall.

Did it not work for you? Did you see an increased load-- web or db server?

ps. I find the thread[firstpostid] to be a handy field to have.. i had it before this hack hehe.. i'd leave it, but that's just me

freakyshiat
03-12-2002, 02:55 AM
Originally posted by Overgrow
Yea I had to check out your site :D I have 19 fewer on right now, but hit my record today. (Always seem to on Mondays)

I can't get the latest version of this hack! I have my own version installed since I wrote some of this code but... due to vBulletin's problem with cached attachments, I can't get the latest version. If you send it to me in email, webmaster@overgrow.com, or attach it here in a post, I can look at it and make sure there is nothing else to uninstall.

Did it not work for you? Did you see an increased load-- web or db server?

ps. I find the thread[firstpostid] to be a handy field to have.. i had it before this hack hehe.. i'd leave it, but that's just me

I havent installed it yet....just makin sure I can go back in case server load is too high :)

heres the attachment

Overgrow
03-12-2002, 03:00 AM
From someone with a similar size site, I can tell you the increased server load is non-existant. Once you add the 'firstpostid' field, there is a JOIN added on. I don't see a blip of an increase in load.

OK after looking over the new hack--

revert the PHP
revert the templates: searchresultbit_threadonly and forumdisplaybit
remove the firstpostid field from thread

When it installs, it does a mass update on the thread table so I would close down the site for a minute.

freakyshiat
03-12-2002, 03:02 AM
Originally posted by Overgrow
From someone with a similar size site, I can tell you the increased server load is non-existant. Once you add the 'firstpostid' field, there is a JOIN added on. I don't see a blip of an increase in load.

OK after looking over the new hack--

revert the PHP
revert the templates: searchresultbit_threadonly and forumdisplaybit
remove the firstpostid field from thread

When it installs, it does a mass update on the thread table so I would close down the site for a minute.

how about the page size after install? is it noticeably bigger?

Can you tell me what exact query to run to drop that field if I do go back? Thanks again

Overgrow
03-12-2002, 03:11 AM
One of my forums, gzipped length:

20448 - with preview
13791 - without preview

To drop the field:

ALTER TABLE `thread` DROP `firstpostid`

ariaforums
03-17-2002, 12:03 AM
Hmm installed correctly to the letter but Im getting no popup with mouseover :(

Erwin
03-17-2002, 01:32 AM
I uninstalled Parker's version and installed this one with no problems. This one works well, and just a tad quicker.

Just a note: not sure if anyone else has pointed it out, but the instructions in "threadpreview-search.txt" has a minor mistake:

In step 12


12) Replace with:

################################################## ##########
<a href="showthread.php?s=$session[sessionhash]&threadid=$searchresult[threadid]$highlightwords" title="fppreview">$searchresult[threadtitle]</a>
################################################## ##########


It should be like this:


12) Replace with:

################################################## ##########
<a href="showthread.php?s=$session[sessionhash]&threadid=$searchresult[threadid]$highlightwords" title="$fppreview">$searchresult[threadtitle]</a>
################################################## ##########


Just a missing $ in $fppreview.

:) Well done!

N!ck
03-17-2002, 03:40 AM
oooooooooooh yeah! typo!

ariaforums > make sure you leave your mouse on the link for a second without moving it...

if that doesn't work, you've done something incorrectly

N!ck
03-17-2002, 03:42 AM
so erwin, post your url :)

beemer
03-17-2002, 05:48 AM
If someone has this working is it possible to post your vBulletin version? I have 2.2.4 and I constantly get this error, dots on or off.

Database error in vBulletin 2.2.4:

Invalid SQL:
SELECT DISTINCT post.userid, IF(votenum>=2,votenum,0) AS votenum,
IF(votenum>=2 AND votenum > 0,votetotal/votenum,0) AS voteavg, post2.pagetext as pagetext, icon.title as icontitle,icon.iconpath,
thread.threadid,thread.title,lastpost, forumid,pollid,open,replycount,postusername,postus erid,
lastposter,thread.dateline,views,thread.iconid,not es,thread.visible,sticky,votet otal,attach
FROM thread
LEFT JOIN icon ON (icon.iconid = thread.iconid)
LEFT JOIN post ON (thread.threadid = post.threadid AND post.userid = '1') LEFT JOIN post AS post2 ON (thread.firstpostid = post2.postid)
WHERE thread.threadid IN (0,411,399,363,322,331,313,77,78,28,95,286,280,245 ,148,217,200,163,160,129,112,1 13,114,106,103,81)
ORDER BY sticky DESC, lastpost DESC

mysql error: Unknown column 'thread.firstpostid' in 'on clause'

mysql error number: 1054

Date: Sunday 17th of March 2002 12:18:54 AM

N!ck
03-17-2002, 06:04 AM
yeah...ummmm...run the install script first or it won't work ;)

and please post your url too... i always like to see this in action

ariaforums
03-17-2002, 08:24 AM
Hmmm just reporting I have the hack working correctly now with no noticble overheads, I think I uploaded the unedited forumdisplay.php by mistake the first time LOL

N!ck
03-17-2002, 01:47 PM
;) sounds good!

freakyshiat
03-17-2002, 04:54 PM
Installed it, works like a charm :)

beemer
03-17-2002, 05:58 PM
Ok, I thought I had run the tpinstall file, but when I checked again, I see it isn't really running. I open it up in the browser and I can see the code that it is supposed to install but how do you actually get it to run? (It doesn't display as a clean web page they way I would think it is supposed to.) I see the two next hyperlinks If I click on them I get file not found on the first one and Nothing happends if I click on the second one?? Any suggestions on how to get this to run. I am using Windows 2000 if that helps.

N!ck
03-17-2002, 05:59 PM
did you rename it?

beemer
03-17-2002, 06:05 PM
Sorry, I figured it out. Didn't realize you have to run it through the web service. I was just opening it in a browser. When I ran it through the web service, everything worked. Will the version you have posted work with dots on or do they have to be off?

N!ck
03-17-2002, 06:07 PM
it's not a normal HTML page!!!!! duh!!!!! upload it first!

N!ck
03-22-2002, 01:27 PM
here's the vbHacker version

BigJohnson
03-24-2002, 07:14 PM
im getting errors with the tpinstall.php file here it is

Database error in vBulletin Control Panel 2.2.4:

Invalid SQL: ALTER TABLE thread ADD firstpostid INT(10) UNSIGNED DEFAULT '0' NOT NULL
mysql error: Duplicate column name 'firstpostid'

mysql error number: 1060

BigJohnson
03-25-2002, 12:13 AM
bump

Velocd
03-25-2002, 01:16 AM
I'm having a problem with the search part of the hack right now. I'm getting this error:


Database error in vBulletin 2.2.4:

Invalid SQL:
SELECT DISTINCT post.userid,
thread.threadid,thread.threadid AS postid,thread.title AS threadtitle,thread.iconid AS threadiconid,thread.replycount,
thread.views,thread.pollid,thread.open,thread.last post AS postdateline,thread.lastpost,thread.lastposter,
forum.forumid,forum.title AS forumtitle,forum.allowicons,attach,
thread.postusername AS usrname,
user.userid AS postuserid, post2.pagetext as pagetext,
threadicon.iconpath AS threadiconpath,threadicon.title AS threadicontitle
FROM
thread,forum
LEFT JOIN user ON user.username=thread.postusername
LEFT JOIN icon AS threadicon ON thread.iconid=threadicon.iconid
LEFT JOIN post ON (thread.threadid = post.threadid AND post.userid = '1') LEFT JOIN post AS post2 ON (thread.firstpostid = post2.postid)
LEFT JOIN post ON (thread.threadid = post.threadid AND post.userid = '1')
WHERE
thread.forumid=forum.forumid AND thread.threadid IN (0,14)
ORDER BY
thread.lastpost DESC,thread.lastpost DESC
mysql error: Not unique table/alias: 'post'

mysql error number: 1066

Date: Sunday 24th of March 2002 10:06:49 PM
Script: http://www.diffusion4.com/search.php?action=showresults&searchid=13&sortby=lastpost&sortorder=descending
Referer:


Any clue?

BigJohnson
03-25-2002, 01:23 PM
bump

N!ck
03-26-2002, 11:21 PM
for big johnson: this has been added to the FAQ.

for velocd: not sure...i'll look into it

freakyshiat
04-25-2002, 01:50 AM
Thread preview doesnt work if the user puts a'[' and ']' at the beginning/end of the post. Any workaround?

N!ck
04-25-2002, 02:19 AM
you'll have to get rid of the part that strips vBcodes...still wanna do it?

freakyshiat
04-25-2002, 02:42 AM
Originally posted by nicksaunders
you'll have to get rid of the part that strips vBcodes...still wanna do it?

any drawbacks?

N!ck
04-25-2002, 01:47 PM
well, not really, but the vBcodes will show in the preview, for instance, you might see:



[ quote ]
blah blah blah
[ /quote ]

i agree [ i ]wholeheartedly[ /i ]



in the preview

freakyshiat
04-26-2002, 12:15 AM
Originally posted by nicksaunders
well, not really, but the vBcodes will show in the preview, for instance, you might see:



in the preview
is that too hard where instead of saying to ignore all '[' and ']', have the code ignore https://vborg.vbsupport.ru/[/url][/url] and so on?

N!ck
04-27-2002, 03:08 AM
well you'll have to edit the file every time you add a vBcode is all

freakyshiat
04-27-2002, 05:16 PM
Originally posted by nicksaunders
well you'll have to edit the file every time you add a vBcode is all
thats fine...if you could redo it with just [i m g] and [/i m g] for now, ill add the other codes in there myself....thanks for your help

TECK
04-28-2002, 04:59 PM
what if i do this on a clean install.. there is no need to run step 3 in the install file, correct? only to modify the tables.

inetd
04-28-2002, 08:02 PM
I don't see preview in search. help me.

P.S. I change fppreview in <a href="showthread.php?s=$session[sessionhash]&threadid=$searchresult[threadid]$highlightwords" title="fppreview">$searchresult[threadtitle]</a>, $fppreview

inetd
04-28-2002, 08:05 PM
please edit vbHacker version. When I run this version, i see blank page forumdisplay and search...

inetd
04-28-2002, 08:16 PM
please make preview for Who's Onlie.

N!ck
04-28-2002, 08:55 PM
nakkid: correct.

fazle: i will post the code in just a sec

N!ck
04-28-2002, 08:59 PM
here's an example

open forumdisplay.php. find:

$fppreview=preg_replace("/\[[^\]]*\]/","",$fppreview);
$fppreview=str_replace("\"","",$fppreview);


replace with:

$fppreview=str_replace("https://vborg.vbsupport.ru/","",$fppreview);
$fppreview=str_replace("","",$fppreview);
$fppreview=str_replace("","",$fppreview);
$fppreview=str_replace("\"","",$fppreview);

N!ck
04-28-2002, 09:00 PM
inetd: i don't know what you mean. what would you want it to preview? :-/

John
04-28-2002, 09:10 PM
Parse error on line 506 of forumdisplay.php:

Line 506: } else {

Help?

inetd
04-29-2002, 06:23 PM
Originally posted by nicksaunders
inetd: i don't know what you mean. what would you want it to preview? :-/ I search some thread. But when i view result's search and cover mouse on thread name, i don't see preview. Help me, please. And edit vbHacker version. And add preview threads to Who's Online. Please :)

N!ck
04-29-2002, 10:07 PM
I DON'T UNDERSTAND

N!ck
04-29-2002, 10:08 PM
john - try doing it manually

inetd
04-30-2002, 03:59 AM
Preview by thread does not work for me in search!

N!ck
04-30-2002, 01:29 PM
did you follow the instructions in the separate text file for doing search.php?

inetd
04-30-2002, 05:25 PM
did you follow the instructions in the separate text file for doing
search.php?YES!

inetd
05-03-2002, 12:28 PM
Don't show preview for some threads... :(

inetd
05-03-2002, 06:19 PM
Originally posted by inetd
Don't show preview for some threads... :(
example:<td bgcolor="#F1F1F1" align="left" width="100%"><font face="verdana, arial, helvetica" size="2" > <a href="showthread.php?s=&threadid=2745" title="">Grabber</a></font> <font face="verdana,arial,helvetica" size="1" ></font></td>

title empty....

John
05-04-2002, 06:00 PM
Slight problem here - although I've applied the search part of this hack 3 times over (just to make sure it's not me), whenever I do a mouseover for the links on a search page it says "fppreview" in a small yellow box, instead of the post contents. Help?!

John
05-04-2002, 06:29 PM
Sorted it - in the code for the template change (when adding this to search.php) the title of "fppreview" instead of "$fppreview" :eek:

inetd
05-04-2002, 07:29 PM
John, if you change fppreview to $fppreview, you see preview in search? I don't see :(

N!ck
05-04-2002, 09:03 PM
no comprendo

Swamper
05-06-2002, 03:45 PM
Originally posted by inetd
John, if you change fppreview to $fppreview, you see preview in search? I don't see :(

That's what I did, works for me.

Great hack!

TECK
05-09-2002, 03:03 PM
nick, i think you forgot one little detail.. if the thread is deleted, the previewpostid will still be there. you could do this:

open functions.php and go to deletethread() function.
find: $DB_site->query("DELETE FROM thread WHERE threadid='$threadid'");BELOW this, add: $DB_site->query("DELETE FROM thread WHERE firstpostid='$firstpostid'");let me know what you think.

inetd
05-09-2002, 03:29 PM
nakkid, please fix bug with preview in search

inetd
05-09-2002, 03:45 PM
Originally posted by inetd
Don't show preview for some threads... :( nakkid, please help me with this bug.

TECK
05-09-2002, 07:33 PM
hmmm... i didnt actually look at the search file made by nick, only at the the code i inserted in forumdispaly.php first.
i tested the code listed below in search.php and it worked perfectly for me. here it is what i did...

Find: $sql="
SELECT $dotuserid $distinct
thread.threadid,thread.threadid AS postid,thread.title AS threadtitle,thread.iconid AS threadiconid,thread.replycount,
thread.views,thread.pollid,thread.open,thread.last post AS postdateline,thread.lastpost,thread.lastposter,
forum.forumid,forum.title AS forumtitle,forum.allowicons,attach,
thread.postusername AS usrname,
user.userid AS postuserid,
threadicon.iconpath AS threadiconpath,threadicon.title AS threadicontitle
FROM
thread,forum".iif(strpos($search[query],"searchindex")>0,",searchindex","")."
LEFT JOIN user ON user.username=thread.postusername
LEFT JOIN icon AS threadicon ON thread.iconid=threadicon.iconid
$dotjoinREPLACE it with: $sql="
SELECT $dotuserid $distinct
thread.threadid,thread.threadid AS postid,thread.title AS threadtitle,thread.iconid AS threadiconid,thread.replycount,
thread.views,thread.pollid,thread.open,thread.last post AS postdateline,thread.lastpost,thread.lastposter,
forum.forumid,forum.title AS forumtitle,forum.allowicons,attach,
thread.postusername AS usrname,
user.userid AS postuserid,
threadicon.iconpath AS threadiconpath,threadicon.title AS threadicontitle,
post2.pagetext as pagetext
FROM
thread,forum".iif(strpos($search[query],"searchindex")>0,",searchindex","")."
LEFT JOIN user ON user.username=thread.postusername
LEFT JOIN icon AS threadicon ON thread.iconid=threadicon.iconid
LEFT JOIN post AS post2 ON thread.firstpostid=post2.postid
$dotjoinFind: // get first 30 chars of post title
if (trim($searchresult[posttitle])=="") {
$searchresult[posttitle]=substr($searchresult[pagetext],0,50);
if (strlen($searchresult[posttitle])>50) {
$spacepos=strpos($searchresult[posttitle]." "," ",50);
if ($spacepos!=0) {
$searchresult[posttitle]=substr($searchresult[posttitle],0,$spacepos)."...";
}
}
}BELOW this, add: // get first 100 chars of post message
if (strlen($searchresult[pagetext])>100) {
$searchresult[message]=censortext(substr($searchresult[pagetext],0,97).'...');
} else {
$searchresult[message]=censortext(searchresult[pagetext]);
}
$searchresult[message]=preg_replace("/\[[^\]]\]/","",$searchresult[message]);
$searchresult[message]=str_replace("\"","",$searchresult[message]);In 'searchresultbit_threadonly' template, find:<a href="showthread.php?s=$session[sessionhash]&threadid=$searchresult[threadid]$highlightwords">$searchresult[threadtitle]</a>REPLACE it with:<a href="showthread.php?s=$session[sessionhash]&threadid=$searchresult[threadid]$highlightwords" title="$searchresult[message]">$searchresult[threadtitle]</a>
i personally didnt like the fact that the preview text is not censored, so i added also the censor function. let me know if it worked. :)

TECK
05-09-2002, 07:38 PM
this was tested in VB225.
i think where most of the people make the mistake is the query change. thare are 2 queries that look almost identical there, in search.php...
btw, there is nothing wrong with nick's file.

N!ck
05-09-2002, 11:31 PM
Originally posted by nakkid
nick, i think you forgot one little detail.. if the thread is deleted, the previewpostid will still be there. you could do this:

open functions.php and go to deletethread() function.
find: $DB_site->query("DELETE FROM thread WHERE threadid='$threadid'");BELOW this, add: $DB_site->query("DELETE FROM thread WHERE firstpostid='$firstpostid'");let me know what you think.

i'm not sure exactly what more doing this would accomplish...? the first query will delete the whole row, including firstpostid...

TECK
05-10-2002, 12:29 AM
you are correct. sorry, i didnt realised.
in other order, you think was a good idea that i added the censortext function?
thanks for the input.

N!ck
05-10-2002, 12:48 AM
it's definitely something i didn't think of :D

TECK
05-10-2002, 02:59 AM
i'm glad you like it. :)

N!ck
05-10-2002, 12:59 PM
i'll put this information on post #1

inetd
05-10-2002, 06:52 PM
when i inserted // get first 100 chars of post message
if (strlen($searchresult[pagetext])>100) {
$searchresult[message]=censortext(substr($searchresult[pagetext],0,97).'...');
} else {
$searchresult[message]=censortext(searchresult[pagetext]);
}
$searchresult[message]=preg_replace("/\[[^\]]\]/","",$searchresult[message]);
$searchresult[message]=str_replace("\"","",$searchresult[message]);
in search.php, i see blank page :(

N!ck
05-12-2002, 11:40 PM
yeah?

inetd
05-18-2002, 08:01 AM
yes

N!ck
05-18-2002, 05:13 PM
really?

inetd
05-18-2002, 05:16 PM
:D

Jeremy W.
05-23-2002, 12:55 PM
I had tried installing this and kept getting compile errors or something (I'm an ASP'er, not a PHP'er, gimme a break).

Line 991 I'm told. Line 991 is this:

$searchresult[message]=censortext(searchresult[pagetext]);

So I looks around and I realise it should read like this instead:

$searchresult[message]=censortext($searchresult[pagetext]);

Delmon
05-30-2002, 06:54 AM
Arabic Transulation Of The Hack By : walah

29May2002

Marty McFly
06-04-2002, 01:42 PM
ok...i installed this a couple of days ago and it worked great. now it doesnt work at all. what gives? www.purekaos.com/board

freakyshiat
07-10-2002, 04:52 PM
In the instructions > the threadpreview search .txt file > at the very bottom in the template change part, its missing a $ before fppreview

Didnt read the whole thread to see if anyone else brought it up, thanks.....

After 3/4 months of usage, my users think this was the best hack EVER, so thanks again to Parker for the original idea and nicksaunders/freddie for perfecting it :)

freakyshiat
07-14-2002, 06:50 PM
Originally posted by nicksaunders
here's an example

open forumdisplay.php. find:

$fppreview=preg_replace("/\[[^\]]*\]/","",$fppreview);
$fppreview=str_replace("\"","",$fppreview);


replace with:

$fppreview=str_replace("","",$fppreview);
$fppreview=str_replace("","",$fppreview);
$fppreview=str_replace("","",$fppreview);
$fppreview=str_replace("","",$fppreview);
$fppreview=str_replace("\"","",$fppreview);


I made these changes in search.php also but doesnt work, it still ignores any text between "[" and "]"

Applying those changes in forumdisplay worked fine. any ideas?

JJR512
07-17-2002, 09:45 AM
I hope nicksaunders doesn't mind, but I've made a small modification to this hack. The purpose of the mod is to add an on/off switch the user can set via the User CP/Edit Options, so he/she can decide to use this feature or not. I did this because some of my users said they didn't like it.

I have attached the modification instructions to this post. These instructions DO NOT include instructions for the base hack; they assume that you have already installed this hack, and show you what to do AFTER that. These will be meaningless if you have not already installed the original base hack!

nicksaunders, if you would like to include this modification in the official version of this hack, by all means, please feel free. :) If you do, I suppose it would be nice to have my name up there with "nicksaunders, freddie, Overgrow, & Parker Clack"...;)

Marty McFly
07-17-2002, 02:13 PM
Originally posted by Marty McFly
ok...i installed this a couple of days ago and it worked great. now it doesnt work at all. what gives? www.purekaos.com/board

any way i can uninstall/reinstall this hack? i try going through the installation process again (tpinstall.php) and i get database erros and it wont go through. im getting this error:

---------------------------------------------------
Database error in vBulletin 2.2.6:

Invalid SQL: ALTER TABLE thread ADD firstpostid INT(10) UNSIGNED DEFAULT '0' NOT NULL
mysql error: Duplicate column name 'firstpostid'

mysql error number: 1060

Date: Wednesday 17th of July 2002 11:13:30 AM
Script: http://www.purekaos.com/board/board/tpinstall.php?step=2
Referer: http://purekaos.com/board/tpinstall.php
---------------------------------------------------

Massiel
08-01-2002, 10:43 PM
Has this been finalized? Is there one file that has all the fixes in it?

Schorsch
08-09-2002, 04:05 AM
Originally posted by Massiel
Has this been finalized? Is there one file that has all the fixes in it?

good question!! would like to know this too!

Schorsch

2 X Viverridae
08-14-2002, 10:42 AM
Installed the thread preview, and search preview - works slick!

Thanks a lot for a great hack!

EnriqueHavoc
08-21-2002, 11:37 PM
could someone please explain how to "run" the tpinstall.php?

2 X Viverridae
08-22-2002, 12:08 AM
Sure - upload it to your forum, and then open it with your browser, using the address your_forum_address/tpinstall.php

Hope this helps.

EnriqueHavoc
08-22-2002, 02:12 AM
thanks very much!

installed and works awesome

~rc~
09-10-2002, 03:27 PM
Hello folks, I'm Overgrow's partner and a security concern was pointed out to me about this hack. Overgrow has been using the version of this hack since he last posted here so I haven't checked to see if his version is the exact same as what you are using now but if you follow the instructions below, it may help you discover if you have security breach in your private forums. Here are the details that were sent to me to help you test it;

---------------------------------------------------------------------------
first of all this is what I came up with since 8:00 tonight or so.
I found ONE way to read the Mods forums. It has in part to do with an "upgrade" by Overgrow made not too long before he left, the Post preview option.

So go to my overgrow, update profile, then options.


View thread previews?
If you select yes, you will get a short preview of the thread when you mouseover the title. yes no



This is part of the problem.
Now while your looking at a thread in the forum listing, drag your mouse over the thread title, a pop-up screen should appear with a snippet of the content of the thread.
At this point I'll consider this part of it is understood.

Now to the next piece.

Go to the top of the page, click forums,
scroll down to the list of current users online.

Click the hyperlink on Currently Active Users.

This brings you to a monitoring page...
I can see what everyone is doing.
I can monitor the movement of the MODS and ADMINS.
This will make sense in a few mins.

Next Subject.
URL Manipulation can let people view all the searches that
people have done.

Here's a link for you to follow of one such search made
by someone with MOD or ADMIN access.

http://www.overgrow.com/edge/search...searchid=502803

With that link I can see what MODS are posting. Give it a shot. Log in as some normal user account and go for it.

Now using this I can gain info about what is being said.
All they have to do is change the number on the end and
they see a different search. Eventually they will stumble across a doozie with lots of sensitive things in the search results.

Here's where the Currently Active page ties into it all, you can
save time by monitoring Mods or Admins activity I can estimate where their searches will be by performing my own search and checking out the #'s and searching that area.

------------------------------------------------------------------------------
Credit goes to The White Rabbit for finding this. The results here may be different for most as I said before, the hack here may have been altered by Overgrow and the results may not be the same for everyone. Anyway, better to check and be sure before you continue to use this hack.

Also, to the Mods/Admins here. This post may used by others as information to gain access to private information on other boards so feel free to modify this post if you feel it may pose a security threat. I for one have done away with this hack and since doing so Overgrow has shown quite an increase in speed. Not sure if this could have been a cause but I am keeping watch. Thanks.

cobradude
09-11-2002, 09:02 PM
Works well on 2.2.7. Thanks.

cobradude
09-12-2002, 01:01 AM
By the way, I did find one typo in the search.php stuff....

11) Find:

################################################## ##########
<a href="showthread.php?s=$session[sessionhash]&threadid=$searchresult[threadid]$highlightwords">$searchresult[threadtitle]</a>
################################################## ##########

12) Replace with:

################################################## ##########
<a href="showthread.php?s=$session[sessionhash]&threadid=$searchresult[threadid]$highlightwords" title="fppreview">$searchresult[threadtitle]</a>
################################################## ##########

13) Save template.

title="fppreview" should be title="$fppreview"

Learner29
09-19-2002, 09:36 AM
this hack is one of the VERY VERY best ones.

I just love it !!!!!

it is so straightforward, so easy to install, and it just works !!!!!

Thank you a milliono nicksaunders !!!!!

stark
10-10-2002, 08:48 AM
Is there wa way to increase the amount of time the box shows up? A lot of my users are saying it goes away too fast to read the 300 characters.

N!ck
10-10-2002, 12:52 PM
that's just Internet Explorer's timeout...nothing can be done about it...

EvilLS1
11-11-2002, 07:11 AM
Nice hack!

Question: is it possible to show the first 300 charecters of the last reply to the thread instead of the first post?

N!ck
11-11-2002, 04:13 PM
it would require you to make newreply.php update a new field called "lastpostid" in table "thread" with the reply id#. it would be a bit of work, but it's certainly possible.

NuclioN
11-18-2002, 12:32 AM
Strange...after installing the threadstarter dates in forumdisplay are all set to 1 januari 1970 for all topics. (???)

#01
12-06-2002, 11:27 AM
Originally posted by LS1 TA
Nice hack!

Question: is it possible to show the first 300 charecters of the last reply to the thread instead of the first post?

This would definatly be more useful to me. Can sombody make these changes and post em here?

Thanx

Brahm
12-12-2002, 10:27 PM
Works and looks fantastic on my site. Thanks for the Hack!

dotagious
01-11-2003, 02:55 AM
I'm running vbportal and noticed that the modification needed for the newthread.php file edits the same block of text that vbportal does. When the code is added over the vbportal code, I get an error when trying to submit a new thread.

I replaced the original file, and thread preview is working fine regardless. Could someone look at the following code and tell me what I need to do (if anything, considering it's working) to make this hack work with vbportal?

How my newthread.php looks with vbportal code:


// vBPortal Begin
// create first post
// $DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,at tachmentid,pagetext,allowsmilie,showsignature,ipad dress,iconid,visible) VALUES (NULL,'$threadid','".addslashes(htmlspecialchars($subject))."','".addslashes($postusername)."','$bbuserinfo[userid]','".time()."','$attachmentid','".addslashes($message)."','$allowsmilie','$signature','$ipaddress','$iconi d','1')");
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,at tachmentid,pagetext,allowsmilie,showsignature,ipad dress,iconid,visible,topic) VALUES (NULL,'$threadid','".addslashes(htmlspecialchars($subject))."','".addslashes($postusername)."','$bbuserinfo[userid]','".time()."','$attachmentid','".addslashes($message)."','$allowsmilie','$signature','$ipaddress','$iconi d','1','$topic')");
// vBPortal End

dotagious
01-14-2003, 07:46 PM
*sigh*

dotagious
01-15-2003, 10:23 PM
ttt

Tungsten
01-21-2003, 01:46 PM
Aside from rolling back the PHP file and template changes, what else do I need to do to uninstall this hack? It was causing MySQL errors. :(

I did drop the 'firstpostid' field from the forum db table, but I see that it appended that field into the index as well. How do I revert that change?

wooolF[RM]
02-14-2003, 01:46 PM
]nice hack... just installed it :)
there's only one "problem" > it shows the first 300 characters of the first post in the thread ( nomatter how many replies there were done )...

I have a code that will show u the LATEST post in the thread without opening it... just with hovering mouse over it will show 300 characters from *latest* post in the given thread...

Code is atathced here and "kinda" buggy cause it adds 1 query per each thread shown at the forum... I share cause I have it and I really would like to mix this great hack made by nicksaunders ant the others with the code I made here... I know it's possible but my knowledge in vBB is not that big that I can do it myself... :(

Anyway, here's the code:
$intrid = $thread[threadid];
$intrinfo = $DB_site->fetch_array($DB_site->query("SELECT pagetext FROM post WHERE threadid = '$intrid' ORDER BY dateline DESC LIMIT 1"));
if (strlen($intrinfo[pagetext]) > 100) {
$intrpreview = substr($intrinfo[pagetext], 0, 100) . "...";
} else {
$intrpreview = $intrinfo[pagetext];
}
$intrpreview = htmlspecialchars($intrpreview);
$intrpreview = preg_replace("/(\[quote])(.*)(\[\/quote])/siU", "", $intrpreview);

This code should go right after while ($thread=$DB_site->fetch_array($threads)) { // and $counter++<$perpage) { in forumdisplay.php and then u can use $intrpreview anywhere as your table attribute (same as in this original hack)

If anyone can help me, please do so :) I would really appreciate it :) Thanx again!

maxxxxxx
02-19-2003, 12:14 PM
I want also this nice hack, but nothing works...

I have all installed and also run the install file from the forum directory not from admin directory.

I have the 2.3.0 if vb

cu and thx
maxxxxxx

amykhar
02-20-2003, 01:36 PM
The hack works just fine. One hint, if a bunch of people have installed it and run it and it doesn't work for you, the problem isn't with the hack, it's with your installation.

Amy

Silenced Soul
02-22-2003, 02:57 AM
beautiful hack, my only thing was that in the threadpreview-search it says to replace:

In searchresultbit_threadonly

Find:
<a href="showthread.php?s=$session[sessionhash]&threadid=$searchresult[threadid]$highlightwords">$searchresult[threadtitle]</a>

Replace with:
<a href="showthread.php?s=$session[sessionhash]&threadid=$searchresult[threadid]$highlightwords" title="fppreview">$searchresult[threadtitle]</a>

when you should replace it with

<a href="showthread.php?s=$session[sessionhash]&threadid=$searchresult[threadid]$highlightwords" title="$fppreview">$searchresult[threadtitle]</a>


By the way, this'll fix those people having problems with the search threadpreview not working, assuming all that is showing up is the fppreview.

N!ck
02-22-2003, 03:18 AM
Yeah, that's been like taht forever, but I'm too lazy to fix it. :D

Silenced Soul
02-22-2003, 05:08 AM
lol, I know all about that... :p

But, very nice hack, I was trying to do something like this awhile back, but, it wasn't working, could take random posts from a thread and display those instead of the first post, that was annoying.. lol

Nice work.

drumsy
03-18-2003, 01:19 PM
I've encountered a very nasty problem that a member discovered, and exploited. It allows a member to post any image whatsoever on the forumhome (in our case it was a highly disturbing one) and I would like to know how to fix it. If someone can help me with a fix, I will share the code with you. I've disabled thread preview in the meantime.

N!ck
03-19-2003, 02:57 AM
:-/ Could you PM me with more details? I'd like to help fix it.

drumsy
03-27-2003, 01:15 PM
03-18-03 at 10:19 AM drumsy said this in Post #148 (https://vborg.vbsupport.ru/showthread.php?postid=368575#post368575)
I've encountered a very nasty problem that a member discovered, and exploited. It allows a member to post any image whatsoever on the forumhome (in our case it was a highly disturbing one) and I would like to know how to fix it. If someone can help me with a fix, I will share the code with you. I've disabled thread preview in the meantime.

Thanks to N!ck for the support and the solution. The following is the fix for this bug as related by N!ck via PM:

In forumdisplay.php, find:

$fppreview=preg_replace("/\[[^\]]*\]/","",$fppreview);
$fppreview=str_replace("\"","",$fppreview);

and add this after it:

$fppreview=str_replace("<","&lt;",$fppreview);
$fppreview=str_replace(">","&gt;",$fppreview);


Again, thanks to N!ck for this support! https://vborg.vbsupport.ru/external/2003/03/1.gif

Snapperhaed
03-28-2003, 03:43 AM
I installed this on 2.3 #3 and could not get it to work.
I entered the code line for line, checked and double checked.
While I get no errors, I do not get anything on the mouse over.

I installed the 'tpinstall.php' is the forums/admin directory. Perhaps that was the problem. The install doesnt specify, unless I over looked it. Any suggestions, help and or tips?

Looking forward to proper operation!

EDIT:

After picking at it a little more, I noticed that it would NOT show posts which existed BEFORE installing this hack, however it DOES show the preview on NEW posts. Guess thats all that matters, or am I incorrect in assuming it would show prior posts?

N!ck
03-28-2003, 09:48 PM
are you sure you ran tpinstall.php?

Rynthar
04-17-2003, 06:15 AM
In VB 2.3.0, whenever I try to run tpinstall.php I get a mysql 1060 error after I try to go to step 2

Kars10
04-20-2003, 07:40 PM
Hi N!ck, is there a way to integrate this hack in the online.php for the Threads the users read (vB3 Style)?

Thanks in advance
Kars

94supratt
04-24-2003, 04:10 PM
How do i un install this totally?

Marty McFly
05-02-2003, 12:52 AM
when trying to run the tpinstall.php i get this error:

----------------
Database error in vBulletin 2.3.0:

Invalid SQL: ALTER TABLE thread ADD firstpostid INT(10) UNSIGNED DEFAULT '0' NOT NULL
mysql error: Duplicate column name 'firstpostid'

mysql error number: 1060

Date: Thursday 01st of May 2003 08:49:37 PM
Script: http://www.purekaos.com/board/~purekaos/board/tpinstall.php?step=2
Referer:
--------------------

any ideas?

translucent
05-07-2003, 07:44 PM
Is there any way to increase the number of characters shown and to display line breaks?

hukgwai
05-28-2003, 09:13 PM
any reason why it stops responding during step 2?

Chazz Layne
06-24-2003, 05:16 PM
Installed great and is running perfect here (2.2.9), but I ran into a problem with vBMyIndex shortly after. Somehow, it's preventing the News (and the add-on PotD I built) from showing anything posted since Thread Preview was installed. As much as I hate vBPortal, I must admit it is probably the same problem that dotagious ran into a couple pages back with his setup.

I'll poke around some and see what I can find in there... any one else had any luck with this issue?

Chazz Layne
06-24-2003, 08:28 PM
Cool, found and fixed. As dotagious had narrowed down earlier it is in newthread.php. When you're adding in the sections in there, instead of replacing the whole area, just add the small query to the bottom. The original query is still the same... I. E....

$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,at tachmentid,pagetext,allowsmilie,showsignature,ipad dress,iconid,visible,isnews) VALUES (NULL,'$threadid','".addslashes(htmlspecialchars($subject))."','".addslashes($postusername)."','$bbuserinfo[userid]','".time()."','$attachmentid','".addslashes($message)."','$allowsmilie','$signature','$ipaddress','$iconi d','1','Y')");
$postid=$DB_site->insert_id();
^^^^ Keep this, with whatever modifications you have done to make your portal software work.

Instead, just add this additional part (from Thread Preview) below it...
$DB_site->query("UPDATE thread SET firstpostid = '$postid' WHERE threadid = '$threadid'");

I don't have vB Portal installed to test it, but I am pretty sure this would fix the problem with that as well since they are built simillar at this point.

TheCaver
07-10-2003, 05:14 PM
Is it supposed to take forever to do the tpinstall step2? It seems like it just hangs.....

Board is 50k> threads, 450K posts.....

JC

blazin
09-18-2003, 07:36 AM
I installed the hack and it works only with the threads that existed at the time of the hack install.

Any new threads that have been made after the install do not show a preview.

The firstpostid field is 0 on all new posts...if I change it manually to some value it works

Any ideas?

rseidl
09-20-2003, 09:11 PM
Hope i dont get jailed for asking this but

1. would this hack work for vb3 also ?
and
2. does the zip file on page 1 of this thread include the "missing" $ sign and control panel on/off switch
Looks very useful ! Thanks

MaDCaT75
09-21-2003, 05:21 AM
Nice hack

/me clicks install

richier
09-25-2003, 12:54 PM
I am having an issue after installing this hack. I have VBportal installed and every thing is working fine except when a new thread is started it double posts the starters post

It's some where in here and I can't find it

// vBPortal Begin
// create first post
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,at tachmentid,pagetext,allowsmili e,showsignature,ipaddress,iconid,visible) VALUES (NULL,'$threadid','".addslashes(htmlspecialchars($subject))."','".addslashes($po stusername)."','$bbuserinfo[userid]','".time()."','$attachmentid','".addslashes($message)."','$allowsmilie','$signa ture','$ipaddress','$iconid','1')");
$DB_site->query("UPDATE thread SET firstpostid = '$postid' WHERE threadid = '$threadid'");
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,at tachmentid,pagetext,allowsmili e,showsignature,ipaddress,iconid,visible,topic) VALUES (NULL,'$threadid','".addslashes(htmlspecialchars($subject))."','".addslashes($po stusername)."','$bbuserinfo[userid]','".time()."','$attachmentid','".addslashes($message)."','$allowsmilie','$signa ture','$ipaddress','$iconid','1','$topic')");
// vBPortal End

$postid=$DB_site->insert_id();

indexpost($postid,1);

Ludelover
10-08-2003, 02:06 AM
Is it supposed to take forever to do the tpinstall step2? It seems like it just hangs.....

Board is 50k> threads, 450K posts.....

JC


I get the same problem

Ludelover
10-08-2003, 02:13 AM
yo how do i unistall this thing? When I ran tpinstall.php i got to step 2 and it hangs. Now the board is slow as funk. It's fast 99% of the time.

klaattu
10-20-2003, 03:51 AM
Click "install"

Wow wonderful hack and so simple to implement, it works perfectly if anybody wants to check it go http://www.clioclub.com.mx

By the way since that forum is only 10 days old I made a backup of the database (it download to my computer with the _db_.sql way so here are a few questions:

If my tables get corrupted or something while running the tpinstall.php file how do I reupload the tables?

I am nervous because my other site has mor e time a lot of more posts and members so I dont want to kill my self because I killed my database, any recomendatiosn, procedures or ways to fix if th e unexpected happens??

Thanks again and best regards Juan Carlos

alkatraz
10-30-2003, 02:21 AM
In the instructions > the threadpreview search .txt file > at the very bottom in the template change part, its missing a $ before fppreview


The original zip for this hack still HAS the $fppreview bug, can someone please update it.


Thanks for the hack! Excellent idea

magnus
11-05-2003, 09:34 PM
I'm suprised there has been no attention paid to ~rc~'s post (https://vborg.vbsupport.ru/showpost.php?p=297569&postcount=127) about the exploit. I've tried to duplicate it, but I couldn't.. perhaps I'm doing something wrong.

Has anyone else had any success in duplicating this? Has it been fixed in 2.3.0, because in a Who's Online it doesn't provide any links for Mods/Admin's nor will it allow me to hijack a searchid.

memdy
12-09-2003, 12:53 PM
I get this error every time that I try to post. If I press back and then go it will
take.
---------------------------------
Database error in vBulletin 2.2.9:

Invalid SQL: SELECT title FROM thread WHERE threadid=
mysql error: You have an error in your SQL syntax near '' at line 1

mysql error number: 1064

Date: Monday 08th of December 2003 02:44:09 AM
Script: http://www.offshoreonly.com/forums/forums/newthread.php
Referer:
http://www.offshoreonly.com/forums/newthread.php?s=&action=newthread&for
umid=56
-----------------------------------
The part of the error that reads Script: is an incorrect URL where is it getting that second /forums from ? Why does it work the on the second try? I'ved edited the newthread.php script and see no error in syntax at line 1, this must be a symptom of the real error. Anyone have any suggestions before I rip this hack out and start over.

spick
01-07-2004, 10:09 PM
I Installed It But Its Not Working....Help :(

imageconstrux
01-20-2004, 12:46 PM
This is a bit of a side issue, but I thought I'd bring it up. This hack appears to be really handy, and for the vB sites that have it, I use it often. However, if your site generates ad revenues, isn't this a hack that reduces impressions, and opportunities for click-throughs?

It's handy as heck, but seems like it might work against your revenue generation. Just my $.02.

Dan Collins
01-31-2004, 09:33 PM
Is it supposed to take forever to do the tpinstall step2? It seems like it just hangs.....

Board is 50k> threads, 450K posts.....

JC

Check the max execution time setting in your php.ini file. IIRC, the default is 30 sec, which could be insufficient for a large-ish database. The effect would be that the script would just end, with no "Installation finished" message.

Adi211
07-26-2004, 03:43 PM
one bug in threadpreview-search.txt

12) Replace with:

################################################## ##########
<a href="showthread.php?s=$session[sessionhash]&threadid=$searchresult[threadid]$highlightwords" title="fppreview">$searchresult[threadtitle]</a>
################################################## ##########

before fppreview, there is missing a "$"

--->
12) Replace with:
################################################## ##########
<a href="showthread.php?s=$session[sessionhash]&threadid=$searchresult[threadid]$highlightwords" title="$fppreview">$searchresult[threadtitle]</a>
################################################## ##########