Page 1 of 3 123 LastLast
Results 1 to 15 of 45

Thread: Download Thread Hack

  1. #1
    pirate heartbreaker The Man's Avatar
    Join Date
    Mar 2002
    Location
    Sarasota, FL
    Posts
    10,946

    Default Download Thread Hack

    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.
    Last edited by The Man; 05-13-2003 at 05:45 PM.
    Don't delay, add The Pimp today! Don't delay, add The Pimp today!
    Fool’s Gold tlsfflast.fm (warning: album artwork may sometimes be nsfw)

  2. #2
    ORANGE Dr Unne's Avatar
    Join Date
    Dec 1999
    Posts
    7,394
    Articles
    1
    Contributions
    • Former Administrator
    • Former Developer
    • Former Tech Admin

    Default

    What's wrong with "Right-click, 'Save'".

  3. #3
    pirate heartbreaker The Man's Avatar
    Join Date
    Mar 2002
    Location
    Sarasota, FL
    Posts
    10,946

    Default

    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 an example of why I think this'll be a godsend. It's better still for ridiculously long threads like this one and this one. No contest which method of saving I'd prefer in those cases.
    Last edited by The Man; 05-13-2003 at 05:45 PM.
    Don't delay, add The Pimp today! Don't delay, add The Pimp today!
    Fool’s Gold tlsfflast.fm (warning: album artwork may sometimes be nsfw)

  4. #4

    Default

    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.

  5. #5
    Banished Ace Recognized Member Agent Proto's Avatar
    Join Date
    Aug 2000
    Location
    Root Beer Forum
    Posts
    15,629
    Articles
    111
    Blog Entries
    70
    Contributions
    • Former Cid's Knight

    Default

    I love you Aaron. in a non-gay way, plz.

    Apparently, I have been declared banished.

  6. #6
    pirate heartbreaker The Man's Avatar
    Join Date
    Mar 2002
    Location
    Sarasota, FL
    Posts
    10,946

    Default

    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.
    Don't delay, add The Pimp today! Don't delay, add The Pimp today!
    Fool’s Gold tlsfflast.fm (warning: album artwork may sometimes be nsfw)

  7. #7
    Not responsible for WWI Citizen Bleys's Avatar
    Join Date
    Feb 2000
    Location
    The Wired
    Posts
    8,502
    Articles
    7
    Blog Entries
    60

    FFXIV Character

    Bleys Maynard (Sargatanas)
    Contributions
    • Former Administrator
    • Former Cid's Knight

    Default

    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.

  8. #8
    Feel the Bern Administrator Del Murder's Avatar
    Join Date
    Jun 2001
    Location
    Oakland, California
    Posts
    41,625
    Articles
    6
    Blog Entries
    2
    Contributions
    • Former Cid's Knight
    • Former Administrator
    • Hosted the Ciddies

    Default

    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?

    Proud to be the Unofficial Secret Illegal Enforcer of Eyes on Final Fantasy!
    When I grow up, I want to go to Bovine Trump University! - Ralph Wiggum

  9. #9
    Back of the net Recognized Member Heath's Avatar
    Join Date
    Jun 2002
    Location
    United Kingdom
    Posts
    5,459
    Contributions
    • Former Site Staff

    Default

    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.
    Not my words Carol, the words of Top Gear magazine.

  10. #10
    Not responsible for WWI Citizen Bleys's Avatar
    Join Date
    Feb 2000
    Location
    The Wired
    Posts
    8,502
    Articles
    7
    Blog Entries
    60

    FFXIV Character

    Bleys Maynard (Sargatanas)
    Contributions
    • Former Administrator
    • Former Cid's Knight

    Default

    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.

  11. #11
    pirate heartbreaker The Man's Avatar
    Join Date
    Mar 2002
    Location
    Sarasota, FL
    Posts
    10,946

    Default

    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.
    Don't delay, add The Pimp today! Don't delay, add The Pimp today!
    Fool’s Gold tlsfflast.fm (warning: album artwork may sometimes be nsfw)

  12. #12
    ..a Russian mountain cat. Yamaneko's Avatar
    Join Date
    Aug 2001
    Location
    Los Angeles, CA
    Posts
    15,927
    Contributions
    • Former Administrator
    • Former Cid's Knight

    Default

    Sounds good.

  13. #13
    Not responsible for WWI Citizen Bleys's Avatar
    Join Date
    Feb 2000
    Location
    The Wired
    Posts
    8,502
    Articles
    7
    Blog Entries
    60

    FFXIV Character

    Bleys Maynard (Sargatanas)
    Contributions
    • Former Administrator
    • Former Cid's Knight

    Post

    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.

  14. #14
    Hypnotising you crono_logical's Avatar
    Join Date
    May 2001
    Location
    Back in Time
    Posts
    9,313
    Contributions
    • Former Administrator
    • Former Cid's Knight

    Default

    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


    EDIT2: Mashed this thread up beyond recognition, so it's not quite perfect Text get's smaller as you go down, interleaved with pictures of Ally and someone else I see the biggest disaster was where The Man posted in it xD
    Problems playing downloaded videos? Try CCCP


  15. #15
    ..a Russian mountain cat. Yamaneko's Avatar
    Join Date
    Aug 2001
    Location
    Los Angeles, CA
    Posts
    15,927
    Contributions
    • Former Administrator
    • Former Cid's Knight

    Default

    Meh, it works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •