Log in

View Full Version : Download Forum Thread To Your Computer (Vb3.x)


Logician
05-25-2004, 10:00 PM
This hacks allows you to download a forum thread into your computer (desktop etc.) as a text file with one click.

The hack adds a "DOWNLOAD THREAD" link inside Thread Tools pop-up and when clicked entire thread is downloaded to your computer. (See Screenshot (https://vborg.vbsupport.ru/attachment.php?attachmentid=18809&stc=1))

It's useful when:
a) You want to archive and save the thread,
b) Want to read it offline,
c) It's a long thread and you want to browse it faster as a text file, use better searching features of your text editor.

The hack is tested with vB3.0.0 And vB 3.0.1, it is NOT tested with versions prior to 3.0.0. (vB2.x version is here (https://vborg.vbsupport.ru/showthread.php?s=&threadid=40981)). It is very easy to install. As a matter of fact it is an add-on, not a hack so you can install to your board without modifying any vb files. Just upload dt.php to your forum directory and make a easy change in showthread template and it is installed. Simple as that.

VERSION FOR VB 3.5 is released here:
https://vborg.vbsupport.ru/showthread.php?t=97217

If you install it, please click INSTALL (https://vborg.vbsupport.ru/vborg_miscactions.php?do=installhack&threadid=65536), thank you.

Note : Download function is tested with IE v.6.0, Netscape v.4.7, Mozilla 1.2a and it's working fine in these browsers. I dont know other browsers or older versions though.
27.May.2004 Bug Fix : A small bug is fixed in file dt.php which effect users with prefixed tables in database.
29.May.2004 Bug Fix : A small bug in dt.php is fixed to cure post titles with special characters ("'?&) in it. Attached dt.php file is uptodate.
12.Dec.2004 Bug Fix : A small bug which causes soft deleted posts to be included in the downloaded text is fixed. Attached dt.php file is uptodate.


Note 1: If you want to use a different download thread image, see this post (https://vborg.vbsupport.ru/showpost.php?p=519811&postcount=46).
Note 2: If you want to save threads as .rtf, instead of .txt, see this post (https://vborg.vbsupport.ru/showpost.php?p=521046&postcount=49).


Enjoy the hack,
Logician

sabret00the
05-26-2004, 08:02 AM
great work :D

Boofo
05-26-2004, 10:09 AM
Sinan, Do I need to add the htmlspecialchar like I did in the vB2 version or will this automatically handle that? And thank you, sir. I have been waiting for this one. ;)

Erwin
05-26-2004, 10:17 AM
The master has done it again. :) Good job.

mmw
05-26-2004, 11:26 AM
Very nice :D
* mmw clicks install

Phalynx
05-26-2004, 11:35 AM
Great Tool!

colicab-d
05-26-2004, 11:45 AM
Thnk you kindly :) quite ahandy wee addon :)

MrNase
05-26-2004, 12:50 PM
Nice one :)

ashley53680
05-26-2004, 12:54 PM
Ohhhh I cannot wait to install this!!!!!!

skinvb
05-26-2004, 03:11 PM
wow .Its cool Mod.I will install it right now

SnowBot
05-26-2004, 04:13 PM
great idea, nice hack
/me click install

Reeve of shinra
05-26-2004, 05:29 PM
Very useful - especially for forums that have a writers area.

djohn
05-26-2004, 06:20 PM
Does it work with multi page threads?

Logician
05-26-2004, 06:22 PM
Does it work with multi page threads?
Yes of course. It is the whole point, right? :D

dndog
05-26-2004, 08:15 PM
Logician, my forum tables have the prefix vB3_. Your hack assumes there is no prefix and can't find the post table. I sifted through the code but can't figure out what I need to change to fix this. What should I do?

Boofo
05-26-2004, 08:46 PM
Logician, my forum tables have the prefix vB3_. Your hack assumes there is no prefix and can't find the post table. I sifted through the code but can't figure out what I need to change to fix this. What should I do?
Change this:

$post_db=$DB_site->query("SELECT p.dateline, p.title, p.pagetext, p.userid, user.username from post p LEFT JOIN user on user.userid=p.userid WHERE threadid=$threadid AND visible=1 ORDER BY dateline ASC");

To this:

$post_db=$DB_site->query("SELECT p.dateline, p.title, p.pagetext, p.userid, user.username from " . TABLE_PREFIX . "post p AS post p LEFT JOIN " . TABLE_PREFIX . "user AS user on user.userid=p.userid WHERE threadid=$threadid AND visible=1 ORDER BY dateline ASC");

dndog
05-26-2004, 09:34 PM
I now get this error

Database error in vBulletin 3.0.1:

Invalid SQL: SELECT p.dateline, p.title, p.pagetext, p.userid, user.username from vb3_post p AS post p LEFT JOIN vb3_user AS user on user.userid=p.userid WHERE threadid=8 AND visible=1 ORDER BY dateline ASC
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS post p LEFT JOIN vb3_user AS user on user.userid=p.userid WH

mysql error number: 1064

Boofo
05-26-2004, 09:45 PM
I now get this error

Database error in vBulletin 3.0.1:

Invalid SQL: SELECT p.dateline, p.title, p.pagetext, p.userid, user.username from vb3_post p AS post p LEFT JOIN vb3_user AS user on user.userid=p.userid WHERE threadid=8 AND visible=1 ORDER BY dateline ASC
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS post p LEFT JOIN vb3_user AS user on user.userid=p.userid WH

mysql error number: 1064
I know. When I use that, I get the same error. Sorry about that. We will have to wait for Logician to telll us what to change it to, I guess.

It should have worked. Why it doesn't, I don't know. Again, sorry. ;)

dstruct2k
05-26-2004, 10:29 PM
Here's a version that supports table prefixes. :)

Just replace the PHP file and you're on your way!

(Small grammar error fixed too. :p)

GamerJunk.net
05-27-2004, 04:32 AM
Installed great!

ashley53680
05-27-2004, 05:19 AM
Okay for some reason this isn't in my SHOWTHREAD template:


<tr>
<td class="vbmenu_option"><img class="inlineimg" src="$stylevar[imgdir_button]/collapse_tcat_collapsed.gif" alt="$vbphrase[email_this_page]" /> <a href="sendmessage.php?$session[sessionurl]do=sendtofriend&amp;t=$threadid">$vbphrase[email_this_page]</a></td>
</tr>


And that means I don't know where to add the next one... lol Anyone know where I add these two things so that I may have a proper working board. lol Also what does the above code do? (I am wondering why I didn't have it on there....)

Thanks in advance!

Ashley

dstruct2k
05-27-2004, 05:28 AM
Ashley:

Just search for "email_this_page" in the SHOWTHREAD template, and add the new code after the </tr> :)


I had the same problem, I think this template was updated in 3.0.1 and the phrasing isn't identical. :)

ashley53680
05-27-2004, 05:40 AM
Thank you, that worked perfectly!!!!

**clicks install**

Logician
05-27-2004, 05:42 AM
Logician, my forum tables have the prefix vB3_. Your hack assumes there is no prefix and can't find the post table. I sifted through the code but can't figure out what I need to change to fix this. What should I do?
Sorry about it. I've just updated dt.php in the first post to support prefixed table names. I also added there support for weird thread titles with '"&? etc.

Replace your dt.php with the new file and you'll be fine.

Boofo
05-27-2004, 12:55 PM
Sorry about it. I've just updated dt.php in the first post to support prefixed table names. I also added there support for weird thread titles with '"&? etc.

Replace your dt.php with the new file and you'll be fine.
Did you get my pm on the filename and the quotes problem? ;)

Logician
05-27-2004, 12:57 PM
Did you get my pm on the filename and the quotes problem? ;)
yes ty.. update includes this fix too. ;)

Boofo
05-27-2004, 01:22 PM
yes ty.. update includes this fix too. ;)
Just tried it. The filename defaults to dt for threads like that. ;)

You might want to unhtmlchars the post title too as it will look defunct on the first post. ;)

SteveK
05-27-2004, 10:05 PM
Nice... Installed. I hope they add this to vb.com & vb.org!

I notice it doesn't include posts that are "hidden" as a result of the hack by Xenon "Staff can Post hidden Posts " located here: https://vborg.vbsupport.ru/showthread.php?t=64860

Any way to include these (if you have permission to view those hidden posts)?

Thanks,

Steve K.

pjdaley
05-28-2004, 01:56 PM
im just wondering, i noticed it saves the txt file of the thread with the name of the thread.... is it posssible you can add your site's name in front of it so it'll be called VBulletin.org - Thread name.txt? anyone have any ideas?

gmarik
05-29-2004, 09:29 AM
great solution for the old problem...

Intex
05-29-2004, 09:33 AM
Nice hack Logician. Works great :cool:.

* Intex clicks INSTALL

Logician
05-29-2004, 02:43 PM
im just wondering, i noticed it saves the txt file of the thread with the name of the thread.... is it posssible you can add your site's name in front of it so it'll be called VBulletin.org - Thread name.txt? anyone have any ideas?
in dt.php, find
if (strlen(trim($filename))<2) {$filename='Thread'.$threadid;}
after that add:

$filename='ANY TEXT YOU LIKE HERE - '.$filename;

Logician
05-29-2004, 02:48 PM
I fixed a small bug to clean certain weird characters from post titles. You can overwrite your dt.php with the new dt.php (attached in the first post of the thread) to use the new version. Thanks for Boofo for pointing it out.

Logician
05-29-2004, 02:55 PM
Nice... Installed. I hope they add this to vb.com & vb.org!

I notice it doesn't include posts that are "hidden" as a result of the hack by Xenon "Staff can Post hidden Posts " located here: https://vborg.vbsupport.ru/showthread.php?t=64860

Any way to include these (if you have permission to view those hidden posts)?

Give it a shot but I haven't tested:

find:

$i=1;


after that add :

if (in_array($bbuserinfo['usergroupid'], array(5, 6, 7))) {$secret_post=1;$visiblequery='';} else {$secret_post=0;$visiblequery=' AND visible=1 ';}


find:
p.title, p.pagetext, p.userid,

replace it as:
p.title, p.pagetext, p.userid,p.visible,

Find
AND visible=1

replace it as

$visiblequery

find:
print ("[Post $i]\r\n");

replace it as

if ($post[visible]==0) {$visibletext = 'HIDDEN TEXT!!!';} else {unset($visibletext);}
print ("[Post $i] $visibletext\r\n");

ashley53680
05-29-2004, 03:02 PM
in dt.php, find
if (strlen(trim($filename))<2) {$filename='Thread'.$threadid;}
after that add:

$filename='ANY TEXT YOU LIKE HERE - '.$filename;

I can't find this in my dt.php file? :ermm:

Jujimufu
05-29-2004, 04:41 PM
PERFECT TIMING! It's as if you met the very request I made a week or so ago. I'll install it once my website comes back online. Dude, Logician rules!

Logician
05-29-2004, 09:05 PM
I can't find this in my dt.php file? :ermm:
Check around line 100. And please remember to use the latest dt.php if you don't already.

ashley53680
05-30-2004, 01:54 AM
Okay I guess I didn't check that! :blush: Thanks!

Boofo
05-30-2004, 03:07 AM
The hidden posts addition to this hack doesn't work without the following change:

This:

if (in_array($usergroupid, array(5, 6, 7))) {$secret_post=1;$visiblequery='';} else {$secret_post=0;$visiblequery=' AND visible=1 ';}

needs to be changed to this:

if (in_array($bbuserinfo['usergroupid'], array(5, 6, 7))) {$secret_post=1;$visiblequery='';} else {$secret_post=0;$visiblequery=' AND visible=1 ';}

The $usergroupid needs to be $bbuserinfo['usergroupid']. ;)

Logician
05-30-2004, 07:18 AM
The hidden posts addition to this hack doesn't work without the following change:

You are right Bob. I've updated my post too. TY!

Boofo
05-30-2004, 11:09 AM
You're very welcome, my friend. ;)

With that change, it works perfect for hidden posts. ;)

SteveK
06-01-2004, 05:19 AM
You are right Bob. I've updated my post too. TY!


Thank you to you both. Working great.

Boofo
06-03-2004, 02:37 AM
If anyone is interested, I have the fix that will strip all the wierd characters from the thread title so the filename will not default to dt.txt on threads with quotes and other html cahracters in them. ;)

sabret00the
06-03-2004, 11:20 AM
If anyone is interested, I have the fix that will strip all the wierd characters from the thread title so the filename will not default to dt.txt on threads with quotes and other html cahracters in them. ;)
i'm interested.

also is this hardcoded with an option so it can't be used in certain forums? as i wouldn't like a disgruntled staff member downloading hacks and sending them to/posting for general members to see.

Highlander
06-06-2004, 05:03 AM
installed the GREAT hack .. from a great hacker :D .. one day logician will get a statue for his hacks :D

MooMan65
06-06-2004, 09:50 AM
Thank you! I've been waiting for this port! :)

I've also thrown together a quick image for people to possibly use instead of the sortasc one as it does look a bit weird. I've attached it along with an example screenshot of the image replaced. Just replace sortasc.gif with download.gif and upload that file into the buttons directory in images.

I hope it looks alright, I designed it for our forums which was designed to eliminate as much of the anti-aliasing as possible.

chrisvonc
06-06-2004, 10:32 AM
Excellent, thank you very much! I used the vB2x version on my old forum and this is a very handy hack I am glad to see brought over to vB3.

Thank you also MooMan65, the new graphic is very nice!

zahco
06-08-2004, 03:03 PM
Dir Logician
great nice hack
thanks a lot
when i instal it i will press (( click install ))

Agent XY
06-09-2004, 03:40 PM
nice hack , works very well !!
thx @ MooMan65

*installs*


cheers



EDIT: you can save the thread as ".rtf" file, thats better :D (show my attach.)

zahco
06-09-2004, 04:17 PM
Dir Logician
i have instaled the hack an realy nice and great work
also i have change the icon to be sean as a downlodig text

best regards
http://www.arabswell.com/vb

zetetic
06-09-2004, 08:00 PM
I've also thrown together a quick image for people to possibly use instead of the sortasc one as it does look a bit weird. I've attached it along with an example screenshot of the image replaced. Just replace sortasc.gif with download.gif and upload that file into the buttons directory in images.

That's a nice button, MooMan, thanks. However the sortasc.gif is a standard button used for other things, so it's probably a better idea to just upload download.gif and change sortasc.gif to download.gif in the template.

Logician
06-09-2004, 08:19 PM
@Agent XY and MooMan65: thx for your contributions. I've linked your posts in the first post of this thread.

Boofo
06-09-2004, 09:53 PM
i'm interested.

also is this hardcoded with an option so it can't be used in certain forums? as i wouldn't like a disgruntled staff member downloading hacks and sending them to/posting for general members to see.In the dt.php file

Find:

$filename=preg_replace("/[.&!:\\\?\^\'\"\$]/", '', $thread[title]);

REPLACE it with:

$filename = preg_replace('#[\/|*?:"<>\']#', '', $thread[title]);

This will strip the appropriate tags out of the thread title correctly for the filename. ;)

JazzleBug
06-11-2004, 04:04 AM
Thank you! Installed perfectly! :)

SaN-DeeP
06-11-2004, 07:19 PM
how can i display this error message to users who are not allowed to download the thread.

<div style="color: #C60000; font: 20px; font-weight: bold">You must register to use this forum. If you are not registered you need to register <span style="text-decoration: underline"><a href="register.php?$session[sessionurl]">HERE</a></span></div>

thnx.
Sandy...

Logician
06-12-2004, 09:13 AM
how can i display this error message to users who are not allowed to download the thread.

<div style="color: #C60000; font: 20px; font-weight: bold">You must register to use this forum. If you are not registered you need to register <span style="text-decoration: underline"><a href="register.php?$session[sessionurl]">HERE</a></span></div>

thnx.
Sandy...
in dt.php find:
if (is_array($unallowed_downloaders) AND in_array($bbuserinfo[usergroupid],$unallowed_downloaders)) {echo standard_error("Sorry this feature is not meant for your usage!", '', 1);}

before that add:

if ($bbuserinfo['userid']==0) {eval(print_standard_error('error_guestcannotdlthr ead'));}

then create a new phrase in error phrases named "guestcannotdlthread" and put your message there.

ashley53680
06-12-2004, 11:40 AM
I'd like to do something like this too.... but I cannot find the error templates so I can add the new phrase. :(

Logician
06-12-2004, 07:48 PM
I'd like to do something like this too.... but I cannot find the error templates so I can add the new phrase. :(
sorry it is "phrases", not templates.

ashley53680
06-12-2004, 08:03 PM
Well after making those changes, I don't see the download treat option at all in my thread tools. :(

Boofo
06-12-2004, 08:45 PM
Well after making those changes, I don't see the download treat option at all in my thread tools. :(
Here's what I did:

In dt.php, find:


if (is_array($unallowed_downloaders) AND in_array($bbuserinfo[usergroupid],$unallowed_downloaders)) {echo standard_error("Sorry this feature is not meant for your usage!", '', 1);}


REPLACE it with:


if (is_array($unallowed_downloaders) AND in_array($bbuserinfo[usergroupid],$unallowed_downloaders)) {echo standard_error("<center>Sorry, you must be registered and activated to download threads.</center>", '', 1);}


Just put whatever you need between the center tags and you don't have to make a separate phrase.

ashley53680
06-12-2004, 11:36 PM
Well after making those changes, I don't see the download treat option at all in my thread tools. :(
Whoops, my showthread got reverted. lol :tired:

redlabour
06-15-2004, 05:42 AM
Super thanx !

sabret00the
06-16-2004, 12:22 AM
also is this hardcoded with an option so it can't be used in certain forums? as i wouldn't like a disgruntled staff member downloading hacks and sending them to/posting for general members to see.*gently bumping question*

Logician
06-16-2004, 06:41 AM
also is this hardcoded with an option so it can't be used in certain forums? as i wouldn't like a disgruntled staff member downloading hacks and sending them to/posting for general members to see.
Sorry, question is not clear to me. What hacks do you mean? This hack is not installed in vb.org.

The hack uses default vb permission system so one can not download a thread if he does not have read permission to it. Besides you are able to prevent certain usergroups to use this feature. Does it answer your question?

sabret00the
06-16-2004, 11:18 AM
yes it answers half the question, sorry should've re-read it before i bumped it, basically i want to have this enabled in all public forums but disabled in private (staff) forums and am wondering if this functionality is built in?

Logician
06-16-2004, 03:13 PM
yes it answers half the question, sorry should've re-read it before i bumped it, basically i want to have this enabled in all public forums but disabled in private (staff) forums and am wondering if this functionality is built in?
No it is not, but you can easily add it like this:

edit dt.php, find:
$foruminfo = &$forum;
after that add:

if ($thread['forumid']==X OR $thread['forumid']==Y OR $thread['forumid']==Z)
{print_no_permission();}
replace X,Y,Z with the forumids in which you want to stop downloads.

sabret00the
06-16-2004, 06:08 PM
thanks, that's exactly what i was looking for :D

Oblivion Knight
06-16-2004, 07:16 PM
Logician, you're a wizard mate.. :)

Installed and working flawlessly. I voted for this hack in HotM June.

Kohhal
06-17-2004, 08:16 AM
Looks good, anyone have a sample .txt of what a downloaded thread looks like?

Logician
06-17-2004, 08:26 AM
Looks good, anyone have a sample .txt of what a downloaded thread looks like?
You can test here:
http://www.theadminzone.com/forums/

Kohhal
06-17-2004, 08:59 AM
Excellent, installed :D

redlabour
06-17-2004, 03:56 PM
Boykott To Hacks That Are Only Working With IE ! :devious:

Mozillaengines are downloading but not as a *.txt - theres only a blank file with Threadname. Under IE it works excellent !

:rolleyes:

Logician
06-17-2004, 04:26 PM
Boykott To Hacks That Are Only Working With IE ! :devious:

Mozillaengines are downloading but not as a *.txt - theres only a blank file with Threadname. Under IE it works excellent !

:rolleyes:
It works fine in my Mozilla. Check yours. Or better upgrade to a "solid" browser. ;)

Intex
06-17-2004, 04:50 PM
Or how about making your own hack, rather than taking it out on the author? Don't forget this is a free hack. If you don't like it, feel free not to install it.

The authors take painstaking hours to create these hacks and have done a great job - supporting the most common web browser.

Show some respect.


Boykott To Hacks That Are Only Working With IE ! :devious:

Mozillaengines are downloading but not as a *.txt - theres only a blank file with Threadname. Under IE it works excellent !

:rolleyes:

cpt
06-17-2004, 06:03 PM
in dt.php, find
if (strlen(trim($filename))<2) {$filename='Thread'.$threadid;}
after that add:

$filename='ANY TEXT YOU LIKE HERE - '.$filename;


If "ANY TEXT YOU LIKE HERE" is "www.domain.com" I get under IE a text "[1]" in front of the "." (screenshot).

EDIT:
Is it possible that ? ? ? ? in the filename don't work ?

redlabour
06-17-2004, 08:34 PM
@Logician + Intex - i am speaking from up-to-date Mozillaengine = Firefox 0.8 + 0.9 not compatible, not the Mozillasuite. ;)

@Intex - who makes Freesoftware should be thinking about using Evil-M$ Products ! ;)

Intex
06-17-2004, 08:36 PM
Evil yeah, but still the most widely used. Developers can't ignore the mass market :).

Dean C
06-17-2004, 10:37 PM
I'd love to see this export the thread as XML and have an importer - wouldn't be too difficult to do :) You could then expand on it to mass export / import threads too. Just a though ;)

Martin64
06-18-2004, 12:59 AM
Excellent, will install this tomorrow, it's 4 am now so it's a little late to start hacking now. ;)

Logician
06-18-2004, 05:43 AM
If "ANY TEXT YOU LIKE HERE" is "www.domain.com" I get under IE a text "[1]" in front of the "." (screenshot).

EDIT:
Is it possible that ? ? ? ? in the filename don't work ?
I think this is because you already have a file in the same location starting with "www." so Windows change its name.

Logician
06-18-2004, 05:50 AM
@Logician + Intex - i am speaking from up-to-date Mozillaengine = Firefox 0.8 + 0.9 not compatible, not the Mozillasuite. ;)

@Intex - who makes Freesoftware should be thinking about using Evil-M$ Products ! ;)
I'm sorry but I'm an evil "M$ certified" system engineer and database administrator. ;) Besides 90% internet users are using evil IE users so you should appreciate my hack still supports regular Mozilla hehe.

Frankly speaking, I didn't dl firefox yet so don't know how the hack behaves with it. But I believe they should really stop changing their engine in every 3 months. ^^

redlabour
06-19-2004, 06:16 AM
Evil yeah, but still the most widely used. Developers can't ignore the mass market :).

@Logician and Intex - and only developers can change the Market ! ;)

@Logician - Firefox is only the standalone Mozillabrowsercomponent. If it runs on Mozilla it runs under Firefox. I tried it with Mozilla 1.5 & 1.6 and finally 1.7 - thats more than 3 Months ! ;)

sabret00the
06-27-2004, 12:38 PM
i'm having the extention problem that was mentioned earlier, i seem to have to manually add extentions.

JirQUEST
07-06-2004, 03:04 PM
hmmm, is this compatible with 3.0.3?

Logician
07-06-2004, 04:25 PM
Although I didn't test it personally, I'd say yes

Andreas
07-06-2004, 04:27 PM
Anyone willing to add PDF as output format? I'd really love that :)

Logician
07-06-2004, 05:08 PM
Anyone willing to add PDF as output format? I'd really love that :)
2 potential problems with this request:
a) PDF library is not standart in PHP installation and such a hack would require this library. So even if this hack is coded, it will not work in many boards if their hosting company didn't install this library while compiling PHP.
b) Even if it is installed, PDF library uses a lot of CPU power in the server (hence many hosting companies do not install it) so when many people use the link, it will put burden on the server.

Andreas
07-06-2004, 05:23 PM
Hmm, one can also generate PDFs without PDFLib ;)

But you are right that it does require a lot of resources.

weitalia
07-07-2004, 05:12 AM
Great hack,but where'is the RTF working version?

;)

Erwin
07-07-2004, 06:14 AM
hmmm, is this compatible with 3.0.3?
Yes. :)

JirQUEST
07-07-2004, 07:34 AM
yup. upgraded and it still worked without a hitch :D man, great hack :D

Frzzy
07-11-2004, 09:33 PM
/me clicks install...

Hmmm... no attachments support, any way to include link to attachments into the file instead of simply ditch them?

Michael Morris
07-13-2004, 10:26 AM
Great hack, my board's subscribed users will love this. I applied a couple mods.

I only want one group - subscribed users - to use this feature. I replaced the unallowed users lines with a call to vbulletin's is_member_of function, hence


if (!is_member_of($bbuserinfo, 9))
{
echo standard_error("I'm sorry, but you are attempting to access a feature limited to community supporters only!", '', 1);
}


was used in place of


$unallowed_downloaders = array(9);

if (!is_array($unallowed_downloaders) AND in_array($bbuserinfo[usergroupid],$unallowed_downloaders)) {echo standard_error("Sorry this feature is not meant for your usage!", '', 1);}

Michael Morris
07-13-2004, 10:32 AM
I don't want to display a button to a function folks can't use. The second mod was placed in the showthread template part of Logician's instructions. Surround the code for the buttons with a conditional as follows:

<if condition="is_member_of($bbuserinfo, 9)">
<tr>
<td class="vbmenu_option"><img class="inlineimg" src="$stylevar[imgdir_button]/sortasc.gif" alt="Download This Thread" /> <a href="dt.php?$session[sessionurl]t=$threadid">Download This Thread</a></td>
</tr>
</if>

Note - you can change the usergroup # to whatever you like of course - '9' happens to be our board's subscribed usergroup's number.

(BTW, I split this post in two because I have a router that blocks html sends over a certain size that I haven't figured out how to solve. Sorry for the inconvenience).

turbidblue
07-16-2004, 01:26 AM
thank you! very easy!!

* turbidblue clicks install!

;)

Blam Forumz
08-13-2004, 03:13 PM
/me clicks install

luck777jojo
08-16-2004, 07:51 PM
After line:
$filename=preg_replace("/[.&!:\\\?\^\'\"\$]/", '', $thread[title]);

I added:
$filename=preg_replace('/\s+/', '_', $filename);

Just in case anyone with mozilla, or another browser had trouble downloading the file with spaces in the name... I hope this is ok with hack creator? Nice job by the way :). I like this a lot.

David G. Rigg
08-18-2004, 12:17 AM
Way cool, much appreciated.

y2krazy
08-30-2004, 12:57 AM
/me clicks install!

phprus
09-04-2004, 09:37 AM
phprus clicks install!

Ocean
09-07-2004, 03:20 PM
I'm having a problem. When I try to download a Thread, the file name defaults to something like "dt.php?t=14".

The Thread Title has nothing strange about it - we're talking about titles like "Smilie Test".


Any ideas?

Logician
09-07-2004, 05:15 PM
I'm having a problem. When I try to download a Thread, the file name defaults to something like "dt.php?t=14".

The Thread Title has nothing strange about it - we're talking about titles like "Smilie Test".

Have you hacked dt.php? Is the lines around 100 is like that:

$thread[title] = unhtmlspecialchars($thread[title]);
$filename=preg_replace("/[.&!:\\\?\^\'\"\$]/", '', $thread[title]);
if (strlen(trim($filename))<2) {$filename='Thread'.$threadid;}
header("Content-disposition: attachment;filename=".$filename.".txt");

Ocean
09-07-2004, 08:43 PM
Have you hacked dt.php? Is the lines around 100 is like that:



I used the dt.php file as downloaded directly from here. The section you quoted is exactly what I have in my file.

Logician
09-08-2004, 05:51 AM
I used the dt.php file as downloaded directly from here. The section you quoted is exactly what I have in my file.
For debugging purposes try to change the section above like this:


echo "thread[title] = $thread[title] <br><br>";
$thread[title] = unhtmlspecialchars($thread[title]);
echo "unhtmlspecialchars (thread[title]) = $thread[title] <br><br>";
$filename=preg_replace("/[.&!:\\\?\^\'\"\$]/", '', $thread[title]);
echo "filename1= $filename <br><br>";
if (strlen(trim($filename))<2) {$filename='Thread'.$threadid;}
echo "filename2= $filename <br><br>";
header("Content-disposition: attachment;filename=".$filename.".txt");

This will make the hack stop working correctly, but it is temporary debugging so after you make the change, try to dl a thread, note what screen has been posted, you can revert the lines back.

Also please mention your vb version and the browser you are using.

Ocean
09-08-2004, 10:43 AM
For debugging purposes try to change the section above like this:

This will make the hack stop working correctly, but it is temporary debugging so after you make the change, try to dl a thread, note what screen has been posted, you can revert the lines back.

Also please mention your vb version and the browser you are using.


Replacing the code in question causes no discernable difference in behavior. When I click on "Download This Thread", I get the dialog box asking me if I want to save this file - and the name is still formatted the same way.

Incidentally, if it matters - when I hover over the "Download This Thread" link, the Status Bar shows this as the URL: http://www.mydomain.com/forums/dt.php?t=3


And to answer your last question, I'm using vB 3.0.3, and IE 6.

However, something interesting to note - when I try using this hack (either original or debug version) from a FireFox 0.9.3 browser, the file name shows up as the first word in the Title.

For example, if the Title Thread is "Here we go again", these are the results I get:


IE 6 Filename: "dt.php?t=3"

FireFox 0.9.3 filename: "Here"

Logician
09-09-2004, 07:15 AM
Replacing the code in question causes no discernable difference in behavior. When I click on "Download This Thread", I get the dialog box asking me if I want to save this file - and the name is still formatted the same way.
This does not sound right. When you add the lines, it is not possible for the hack to download the thread anymore. It should post some debugging lines into the screen then give "Warning: Cannot modify header information - headers already sent by.. " error and post the entire thread into the page. (I've tested and confirmed). Its not doing it makes me think that something is wrong with your installation like script's being run from another board (test board/localhost) or smt.

Alzeimer
09-09-2004, 08:08 AM
Nice hack, installed.

vishalsachar
09-09-2004, 11:18 PM
Superb --- an absolute must install

AbSoluTc
09-10-2004, 01:53 PM
Just wanted to say thank you for an awsome hack and a simple install. Simple, yet one of those things that leaves you saying "how could I live without it". :)

Thank you and INSTALLED BABY!

Ig@r
09-10-2004, 03:28 PM
That is "must have" hack! Thank you!

Silverstangs
09-11-2004, 12:41 AM
Works like a charm.......... now if there was a version that also downloaded the attachments it would be Perfect!

Ocean
09-13-2004, 02:08 AM
This does not sound right. When you add the lines, it is not possible for the hack to download the thread anymore. It should post some debugging lines into the screen then give "Warning: Cannot modify header information - headers already sent by.. " error and post the entire thread into the page. (I've tested and confirmed). Its not doing it makes me think that something is wrong with your installation like script's being run from another board (test board/localhost) or smt.


How would that come about? I only installed this on one board (which, admittedly *was* the test board). Where else would the script run from?

Logician
09-13-2004, 08:01 AM
How would that come about? I only installed this on one board (which, admittedly *was* the test board). Where else would the script run from?
Sorry I have no idea and no hint to give to you except trying to install from the ground.

Or try to apply to your real board. This is no hack (ie it does not modify any vb files) so you can't mass anything up. It is harmless.

Azhrialilu
10-02-2004, 06:42 PM
worked like a charm... add another forum full of people to the list of those who love you! :D

weitalia
10-06-2004, 05:02 PM
Will be very fun if the .RTF file or .DOC generated file will be a REAL file,with full bold/italic conversion [and of course hyperlinks too] ;)
Could you do this?

P.S. No one needs a .rtf renamed file instead of a .txt ;)

;)

SandsUSA
10-06-2004, 06:00 PM
/me clicks Install
Very nice - and very, very useful!

bendigo-tech
10-27-2004, 01:03 PM
very nice. thanks alot.

*installed*

Virtex-II
11-10-2004, 06:42 AM
This hack is really great but I was wondering if is it possible to save threads in a different format (not .txt) so that even images in threads can be downoladed with the text itself.


Thanks :o

Sweet Evil
11-10-2004, 08:10 AM
looks cool, will give it a go

ADiuM
11-18-2004, 05:54 PM
When trying to download a thread in Firefox 1.0 it shortens the topic to the first word if it has spaces in the topic title.. that way it doesn't actually give it an extension.

Is it possible to search for spaces in the topic title and if there is some to either take them out or replace them with underscores?

ADiuM
11-18-2004, 06:06 PM
Ok nevermind got it..

Open up dt.php

Find:

$filename=preg_replace("/[.&!:\\\?\^\'\"\$]/", '', $thread[title]);

AFTER add:

$filename=preg_replace("[\s]", "_", $thread[title]);

That'll replace all spaces in the topic title to underscore's... you can replace the _ with whatever you want to seperate the words.

Works perfectly now in Firefox 1.0

breathwork
11-27-2004, 07:32 PM
Verrrry Niiiiiice

Clicks install

Geoffrey

iSpanish
01-30-2005, 11:50 PM
Nice and cooool hack

*Installed*

Polo
03-25-2005, 02:10 PM
Thank you Logician, great hack... and also thanks to adium... that fixed the issue with firefox ;)

* Polo clicks install

Aylwin
04-20-2005, 04:43 AM
Great hack, Logician! Thanks! Thanks also to ADiuM for sorting out the Firefox issue!

By the way, does anyone else have text formatting problems? Regardless of whether it's txt or rtf, the files don't display exactly right with either Notepad or Word. With Wordpad, it looks fine though.

I'd like to generate a "proper" rtf file by adding some control codes but I need some help. How do I print "{\rtf" without the "\r" being misinterpretted? Also, is there any way to preg_replace or add characters after each line break or carriage return?

Here's sample of rtf code:
{\rtf
Hello!\par
I need some {\b help}.\par
}That would generate:

Hello!
I need some help.

As you can see, we could also preg_replace the bbcode with rtf code to make nicer looking files. I'd like to do that too but I first need to figure how to get started with the basics.

Regards,
Aylwin

edit:
Figured it out. :)

Aylwin
04-20-2005, 08:41 AM
Attached is my version of dt.php which produces an RTF formatted document. It also interprets the bbcode for bold, italic and underline.

Imperial Fritz
05-06-2005, 04:29 AM
nice improvement, but doesn't work for cyrillic encoding :)

Logician
05-06-2005, 04:48 AM
nice improvement, but doesn't work for cyrillic encoding :)
It should.. What exactly happens?

Aylwin
05-06-2005, 04:55 AM
nice improvement, but doesn't work for cyrillic encoding :)If you're referring to my version, have a look at line 108:
print '{\rtf1\ansi\ansicpg1252\uc1 \deff0\deflang1033\deflangfe1033{\fonttbl{\f0\fswi ss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}}{\f0 \fs22';The character encoding is ansicpg1252. Try changing that to the correct version for cyrillic. Sorry, I can't check it right now but just reply if you need more help.

Aylwin

edit:
Perhaps you can try this:
print '{\rtf1\ansi\ansicpg1251\uc1 \deff0\deflang1026\deflangfe1026{\fonttbl{\f0\fswi ss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}}{\f0 \fs22';1251 is for Windows 3.1 (Cyrillic) and default language 1026 is for Bulgarian

Imperial Fritz
05-07-2005, 05:47 PM
um, weird, wordpad opens the file but shows only a few lines and those aren't cyrillic either, and word just says "wrong filename/part of file" even if I change the filename to a 1-2 latin characters.

well I'm ok with the pure text version so don't really sweat over it :)

mikehawk
07-17-2005, 11:58 PM
Firefox deals with it kind of badly (when you have downloaded it, it doesn't recognize it as a .txt file unless you open it with notepad from the list) but IE is perfect for it.

Nice work. :squareeyed:

/me installed this hack.

csidlernet
07-20-2005, 06:41 AM
/me whacks install button

Logician
09-30-2005, 01:28 PM
version 3.5 of this hack is released here:
https://vborg.vbsupport.ru/showthread.php?t=97217

Areku
12-12-2005, 06:05 AM
Can you still fix the following bug?

Whenever downloading a thread as txt, the SOFT ERASED posts are also written onto the final txt.

Logician
12-12-2005, 07:02 AM
Can you still fix the following bug?

Whenever downloading a thread as txt, the SOFT ERASED posts are also written onto the final txt.
I've fixed the bug, thanks for pointing it out. You can replace dt.php with the new file attached to the first post.

Very interesting this remained hidden for such a long time.

MyraB
11-09-2008, 12:21 AM
This does not work for me--vBulletin Version 3.7.3--and I know I installed it correctly.
The "Download" option shows up in the "Thread Tools" pulldown, but when I click on it I get a blank page.

Perhaps later versions of vBulletin break it. Anyone have a hack that works?

Thank you.

Myra

MyraB
11-09-2008, 12:40 AM
Whoops, my bad. I think I tried to install an outdated hack.
I'm playing with this one now:
https://vborg.vbsupport.ru/showthread.php?t=97217&highlight=download+thread