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:
Code:
if ( isset($goto) and ($goto=='lastpost' or $goto=='newpost')) {
$noheader=1;
}
(it should be at the top of the showthread.php)
Underneath that, add:
Code:
// ############################################################################
// ############################# DOWNLOAD THREAD ##############################
// ############################################################################
// 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,$thread_db[dateline]);
$thread[posttime]=vbdate($timeformat,$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 ("=========================================================================\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 ("=========================================================================\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,$post[dateline]);
$post[posttime]=vbdate($timeformat,$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 ("=========================================================================\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:
Code:
<a href="member2.php?s=$session[sessionhash]&action=addsubscription&threadid=$threadid">Subscribe to this Thread</a>
and adding beneath it:
Code:
<a href="showthread.php?s=$session[sessionhash]&threadid=$threadid&action=download" target=_blank>Download Thread</a>
That'll do.
Have fun.