PDA

View Full Version : Download Thread Hack



The Man
05-13-2003, 05:31 PM
Since you're apparently going to prune again, I figured this'd be a nice present for the members. Shouldn't be too hard to install. I'll be creating a "Download Forum" hack fairly soon, too, but I'm still not 100% certain how to do that.

This hack is based on Logician's Download Thread hack from vbulletin.org, but I've modified it a bit to make it, I think, more functional. So here goes nothing.

In showthread.php find:


if ( isset($goto) and ($goto=='lastpost' or $goto=='newpost')) {
$noheader=1;
}(it should be at the top of the showthread.php)

Underneath that, add:


// ######################################<z>######################################
// ############################# DOWNLOAD THREAD ##############################
// ######################################<z>######################################

// Logician Download Thread Hack
if ($action=="download") {

require("./global.php");

if (!$threadid OR $threadid<1) {show_nopermission();}

$thread_db=$DB_site->query_first("SELECT * from thread
WHERE threadid=$threadid AND visible=1");
if (!$thread_db[threadid] OR $thread_db[threadid]<0) {show_nopermission();}
$forum=getforuminfo($thread_db['forumid']);
// Check Permissions so that a smartass wouldnt download a thread he doesnt allowed
$getperms=getpermissions($thread_db['forumid'],-1,-1,$forum['parentlist']);
if (!$getperms['canview']) {show_nopermission();}
if (!$getperms['canviewothers'] and ($thread['postuserid']!=$bbuserinfo['userid']
or $bbuserinfo['userid']==0)) {show_nopermission();}


$thread[postdate]=vbdate($dateformat,<z>$thread_db[dateline]);
$thread[posttime]=vbdate($timeformat,<z>$thread_db[dateline]);
$filename=preg_replace("/[.!:\\\?\^\'\"\$]/", '', $thread[title]);
if (strlen($filename)<2) {$filename='Thread'.$threadid;}
header("Content-dis:bou::bou::bou::bou::bou::bou::bou::bou::bou::bou: attachment;filename=".$filename.".txt");
header("Content-type: application/octet-stream");
header("Pragma: no-cache");
header("Expires: 0");
print (" * * * $bbtitle THREAD * * *\r\n\r\n");
print ("=========================================<z>================================\r\n");
print ("THREAD: $thread_db[title]\r\n");
print ("Started at $thread[postdate] $thread[posttime] by $thread_db[postusername]\r\n");
print ("Visit at $bburl/showthread.php?threadid=$threadid\r\n");
print ("=========================================<z>================================\r\n\r\n");

$i=1;
$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");

while ($post=$DB_site->fetch_array($post_db))
{
$post[postdate]=vbdate($dateformat,<z>$post[dateline]);
$post[posttime]=vbdate($timeformat,<z>$post[dateline]);
print ("[Post $i]\r\n");
print ("Author: $post[username] (User #$post[userid])\r\n");
print ("Date: $post[postdate] $post[posttime]\r\n");
if ($post[title]) {print ("Title: ".$post[title]."\r\n");}
print ("\r\n$post[pagetext]\r\n\r\n");
print ("=========================================<z>================================\r\n\r\n");
$i++;
}

print ("The messages have been downloaded from $bbtitle at $bburl at ".vbdate("d.m.Y h:i:s",time())."\r\n\r\n");
exit;
}Then you'll want to add a link to the Download Thread hack on the showthread template. I suggest finding:


&lt;a href="member2.php?s=$session[sessionhash]&action=addsubscription&threadid=$threadid">Subscribe to this Thread&lt;/a>and adding beneath it:


&lt;a href="showthread.php?s=$session[sessionhash]&threadid=$threadid&action=download" target=_blank>Download Thread&lt;/a>That'll do.

Have fun. :aimsun:

Dr Unne
05-13-2003, 05:36 PM
What's wrong with "Right-click, 'Save'".

The Man
05-13-2003, 05:38 PM
It uses a helluva lot more disk space than the Download Thread hack does. Plus, you have to add "&perpage=blah" to the URL for threads that are larger than one page of posts, and even that method doesn't always work, in my experience. So yup.

Edit: Here's (http://forum.fools-gold.org/showthread.php?threadid=483&action=download) an example of why I think this'll be a godsend. It's better still for ridiculously long threads like this one (http://forum.fools-gold.org/showthread.php?threadid=212&action=download) and this one (http://forum.fools-gold.org/showthread.php?threadid=1681&action=download). No contest which method of saving I'd prefer in those cases. ;)

Burtsplurt
05-13-2003, 06:14 PM
Seems like a good idea if people are going to be doing a lot of downloading. It'll probably save on bandwidth as well, won't it? .mht files can be pretty large compared to .txt files.

Agent Proto
05-13-2003, 06:27 PM
I love you Aaron. :love: in a non-gay way, plz.

The Man
05-13-2003, 06:43 PM
Originally posted by Burtsplurt
It'll probably save on bandwidth as well, won't it? .mht files can be pretty large compared to .txt files. Yes, very much so.

Citizen Bleys
05-13-2003, 07:20 PM
Hmm...it seems to me that this could be very convenient, since there will be regular, aggressive prunes coming up, without big warnings every time.

I'll bring it up in staff.

Del Murder
05-13-2003, 07:45 PM
The Man shows he's useful every now and then.

Right clicking and then save as for a 23 page thread wouldn't be particularily enjoyable on my part. Does this mean all of the pages are saved as one file?

Heath
05-13-2003, 07:57 PM
Originally posted by Del Murder
Right clicking and then save as for a 23 page thread wouldn't be particularily enjoyable on my part. Does this mean all of the pages are saved as one file?
That is probably the main reason for it. I think it would only be really useful if it downloaded the whole thread otherwise downloading a page at a time is still time consuming I'd imagine, on a 56K with 1001 windows open.

Citizen Bleys
05-13-2003, 07:59 PM
I'm less concerned with saving other people time than I am with saving us bandwidth. We'd be hosed if GSN decided to pull hosting, since Sean and Scottie were the wizards with whipping up free hosts on short notice.

The Man
05-13-2003, 08:23 PM
Originally posted by Del Murder
Right clicking and then save as for a 23 page thread wouldn't be particularily enjoyable on my part. Does this mean all of the pages are saved as one file? Yup.

Yamaneko
05-13-2003, 08:46 PM
Sounds good.

Citizen Bleys
05-15-2003, 01:27 PM
There is no "subscribe to this thread" link, so I'll just add it to printable version, etc.

EDIT: Okay, I think I've got it implemented it, but I haven't changed my color scheme, so if anybody on the Default or ed's technicolor nightmare scheme can't see it, let me know.

It's also untested.

You're looking for the exclamation-mark icon right up at the very top of the thread, next to the "printable version," "email thread to friend" and the other thing.

Let me know how it works for you.

crono_logical
05-15-2003, 02:52 PM
What a crap icon to signify "Download Me!" xD



EDIT: For me, it spawns this nice humungous text file of the entire thread in a single window, with seperators so you can see who posted what where when (why?), which I guess is a lot easier to save to a .txt file, so yes, I guess it works :p


EDIT2: Mashed this thread (http://www.eyesonff.com/forums/showthread.php?s=&threadid=21102&action=download) up beyond recognition, so it's not quite perfect :p Text get's smaller as you go down, interleaved with pictures of Ally and someone else :p I see the biggest disaster was where The Man posted in it xD

Yamaneko
05-15-2003, 02:57 PM
Meh, it works.

Loony BoB
05-15-2003, 03:10 PM
Originally posted by Citizen Bleys
EDIT: Okay, I think I've got it implemented it, but I haven't changed my color scheme, so if anybody on the Default or ed's technicolor nightmare scheme can't see it, let me know.

*lets you know*

You should make it the blue arrow, pointing downwards.

Nice going, though. *nods*

Red Wizard
05-15-2003, 05:41 PM
I'm using the forum default and I can't see it at the moment.

Linus
05-15-2003, 09:21 PM
Ditto Mr. Wizard.

Citizen Bleys
05-15-2003, 10:41 PM
I haven't any art skills. If you want a better icon, make one.

EDIT: I put it in the EoFF Default system by resaving that one template under *every style*...so now I have to go take the Quick Reply out of EoFF Default again ><

Loony BoB
05-15-2003, 11:06 PM
*saves arrow from threadicons*
*turns*
*attaches arrow*

Wow, I have art skils. ;)

ZeZipster
05-15-2003, 11:07 PM
http://download.com.com/i/dl/glb/sm_dl.gif
Steal it. Quick before downloads.com, uhm, convinces your conscious to convince you not to steal it!

Del Murder
05-15-2003, 11:45 PM
Actually quick reply isn't in the quick reply format either. I want my quick reply!

Dr Unne
05-16-2003, 12:06 AM
So now downloading threads will use a little less bandwidth and a whole lot more database queries and CPU cycles to generate these text-pages, right? Unless making it easier to download threads convinces more people they should be downloading more threads, in which case we'll end up with MORE bandwidth being used. Oh well. :) I particularly like the way the text isn't hard-wrapped at 80 columns, so that opening it in a browser looks very terrible. *negativty negativity negativity*

Killy
05-16-2003, 01:16 AM
Actually, I dont think it will make anyone download more threads, simply because there arent many that need to be downloaded. Since I joined EoFF, I have downloaded only one thread and I dont think I will download any other thread soon. Id like to have it there because when I downloaded that thread, I took me a couple of tries before I got it right. And that means more bandwith and CPU cycles.

Yamaneko
05-16-2003, 01:23 AM
Originally posted by Del Murder
Actually quick reply isn't in the quick reply format either. I want my quick reply!
Yeah.

The Man
05-16-2003, 02:22 AM
Yes, the quick reply is seriously f0x0red, and the area with Download Thread isn't showing up for me at all. Thankfully I know how to modify a URL to make it a download thread link, but that's not the point. This clearly needs to be remedied as soon as humanly possible.

Dr Unne
05-16-2003, 02:55 AM
I don't think it's all that critical. Regular reply still works fine.

The Man
05-16-2003, 02:56 AM
It sort of defeats the purpose of having a quick reply template set though, doesn't it? :S

Shlup
05-16-2003, 03:54 AM
Originally posted by Dr Unne
I don't think it's all that critical. Regular reply still works fine. Quick Reply was the first really adminny thing and I want it back. :aimmad:

Dammit, Bleys, this is all your fault! Fix it!

Big Ogre Umaro
05-16-2003, 05:29 AM
Ya know what's better than that Download Thread hack? Clicking "Show Printable Version," having all posts display on one page, and then downloading that page. Forgot about that.

Ahh well, the other way's good too.

Loony BoB
05-16-2003, 06:49 AM
Originally posted by Dr Unne
So now downloading threads will use a little less bandwidth and a whole lot more database queries and CPU cycles to generate these text-pages, right? Unless making it easier to download threads convinces more people they should be downloading more threads, in which case we'll end up with MORE bandwidth being used. Oh well. :) I particularly like the way the text isn't hard-wrapped at 80 columns, so that opening it in a browser looks very terrible. *negativty negativity negativity*
Nobody's stopping you from saving the thread. :p

Citizen Bleys
05-16-2003, 11:01 AM
Anybody still having problems with Quick Reply, post a screenshot; I'm using Quick Reply to post this. I can't troubleshoot a problem if I can't duplicate it.

Or try Mozilla. I haven't tried to look on IE, because I've left IE trying to load a page on eyesonff.com for an hour and it still hasn't loaded. Mozilla's the only way I can browse EoFF *at all*, so if you're using another browser, that could be the problem. Yes.

Be sure to re-select Quick Reply, those of you who don't read the announcements, because at the time I'm posting this, I am the one and only member who is *NOT* on EoFF Default.

Loony BoB
05-16-2003, 11:52 AM
I used IE and it worked fine. Although I still think Quick Reply looks hideous in EoFF, what with the white background standing out like a light bulb.

EDIT: *points to the arrow he attached on the previous page* You asked me to make it! I did! :(

Citizen Bleys
05-16-2003, 12:00 PM
hold your horses, I'm at school and FTP's blocked here.

crono_logical
05-16-2003, 12:25 PM
um, Quick reply looks fine to me (as in as it was before it broke :p )

Loony BoB
05-16-2003, 12:39 PM
Originally posted by Citizen Bleys
hold your horses, I'm at school and FTP's blocked here.

*blinks* ...I should probably remember that I have FTP access more often. Here, it's uploaded. *falls over* I didn't overwrite icon4.gif since it's used in other templates.

http://www.eyesonff.com/forums/images/icons/arrow.gif

Citizen Bleys
05-16-2003, 02:49 PM
done (Well, still in the process of doing it on ed's technicolor nightmare)

EDIT: OK, showthread on ed's technicolor nightmare is *gone*, and I don't have the data to restore it.

EDIT2: Just copied the template from the Quick Reply scheme...something might not be right, though; anybody using ed's technicolor nightmare, let me know if something's screwy so that maybe I can fix it.

Loony BoB
05-16-2003, 04:21 PM
I bet Bleys loves having three different styles in EoFF.

Citizen Bleys
05-16-2003, 05:18 PM
http://www.eyesonff.com/bleys/stabtime.png

Loony BoB
05-16-2003, 05:24 PM
Ooh, I like the way YOU stab me, Bleys... ;D Faster, baby. FASTER!

The Man
05-16-2003, 05:44 PM
D'ya think maybe you should announce this so people know it exists? I never even noticed those icons in the top-right corner of the showthread template until just now. I thought you'd just deleted that part of the template completely, 'cause I was expecting to see it at the bottom of the thread in a box or something. And it's not really obvious what those icons are there for. D:

Loony BoB
05-16-2003, 05:50 PM
Nah, I don't think we need to encourage everyone to use up the bandwidth... if it does do that like Unne pointed out. Not many people do this stuff, and to be honest, if they wanted to have a better way they should look here anway =)

...it's kind of obvious because it kind of tells you what they're for when you hover the mouse over 'em xP

The Man
05-16-2003, 06:01 PM
The hard part, of course, is knowing that they're there. xP

Loony BoB
05-16-2003, 06:07 PM
If they want to know if there's a function that does it, they can ask, and we'll tell them. =P It's not worth the announcement, it'd only encourage the masses to suck up all the 'width when we're trying to cut it down.

Citizen Bleys
05-16-2003, 08:01 PM
Okay, never use "'width" instead of bandwidth again.