vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Download Forum Thread To Your Computer (vB 3.5.x) (https://vborg.vbsupport.ru/showthread.php?t=97217)

Logician 09-29-2005 10:00 PM

Download Forum Thread To Your Computer (vB 3.5.x)
 
Here is the vb 3.5.x version of my Download Forum Thread To Your Computer hack. 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)

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 works with 3.5.x, 3.6.x, 3.7.x, 3.8.x (for vb 4.x, 3.0.x and 2.x versions see my profile.)

It is very easy to install. You can install it to your board without modifying any vb files.

If you install it, please click INSTALL, thank you.

Hacks of Hack:
* French Translation
* Version that works with Russian Alphabet
* Download it as RTF instead of TXT.


Enjoy the hack,
Logician

Logician 09-30-2005 12:10 PM

[Reserved for future use]....

thedvs 09-30-2005 02:25 PM

awesome mod Logician many thanks

bigcurt 09-30-2005 02:34 PM

Congrats on the beginning of your porting process logician :).



~Curt

thedvs 09-30-2005 02:43 PM

Would it be possible to allow downloading of threads in specific forums only?

Logician 09-30-2005 02:46 PM

Quote:

Originally Posted by thedvs
Would it be possible to allow downloading of threads in specific forums only?

edit dt.php, find:
PHP Code:

$threadinfo = &$thread

after that add:
PHP Code:

$allowed_forums = array('1','2');

if (
is_array($allowed_forums) AND !in_array($threadinfo['forumid'], $allowed_forums)) 
{
    
print_no_permission();


Now it allows downloading only in forum 1 and 2.

Edit $allowed_forums = array('1','2'); like to add more forums to allow

thedvs 09-30-2005 02:52 PM

oh manga you are a star, many thanks

cclaerhout 09-30-2005 03:43 PM

Works great ! Thank you.
And here's a small french translation.

dieselpowered 09-30-2005 03:44 PM

Works great....

**runs off and click install**

Odysseus 09-30-2005 04:09 PM

Quote:

Originally Posted by Logician
[Reserved for future use]....

Thanks for sharing!

* clicks install

XtremeOffroad 09-30-2005 05:35 PM

Thank you

Clicks Install

uae 10-01-2005 05:42 AM

Thanks,

Installed

Vindicare 10-01-2005 09:47 AM

Very useful hack. Thanks (*install*)

PS: I replaced the standard DL-Pic with this one, and changed the phrase to "Download TXT Version" (In analogy to my "Download PDF Version"-Menu-Item).

cclaerhout 10-02-2005 02:00 PM

Quote:

Originally Posted by Vindicare
Very useful hack. Thanks (*install*)


PS: I replaced the standard DL-Pic with this one, and changed the phrase to "Download TXT Version" (In analogy to my "Download PDF Version"-Menu-Item).

My members report me that they were characters problems (accent)
IE :

On n'arrête -> On n'arr?te
à s'afficher -> ? s'afficher
fonctionnalités -> fonctionnalit?s
(...)

How can i solve it please ?

dieselpowered 10-05-2005 04:06 AM

This may be something very trivial, however, when you pull down the menu you will notice that the Download Thread is not lined up with the others.

Can this be fixed?

Logician 10-05-2005 06:18 AM

Quote:

Originally Posted by xtremeoff-road
This may be something very trivial, however, when you pull down the menu you will notice that the Download Thread is not lined up with the others.

Can this be fixed?

It happens because the icon of the it is slightly smaller than the other icons in the menu. Try adding "hspace="4" to the IMG like :

<img class="inlineimg" src="$stylevar[imgdir_button]/sortasc.gif" alt="$vbphrase[DownloadThisThread]" hspace="4"/>

Or you can use a larger image there.

cclaerhout 10-05-2005 08:18 AM

Characters problem corrected.
-> solution : install the iconv module (or any one of iconv, GNU recode or mbstring) in php.

Thanks to Drupal ;)

mixylplik3 10-12-2005 03:16 AM

This is a great hack, however, I want to limit its use to certain usergroups. Using the following, I have been unable to do so:

<if condition="$post[usergroupid]==6">
<tr>
<td class="vbmenu_option"><img class="inlineimg" src="$stylevar[imgdir_button]/sortasc.gif" alt="$vbphrase[DownloadThisThread]" /> <a href="dt.php?$session[sessionurl]t=$threadid">$vbphrase[DownloadThisThread]</a></td>
</tr> </if>

Anyone else doing something similar? If so, what did you do?

Logician 10-12-2005 05:52 AM

Quote:

Originally Posted by mixylplik3
This is a great hack, however, I want to limit its use to certain usergroups. Using the following, I have been unable to do so:

<if condition="$post[usergroupid]==6">
<tr>
<td class="vbmenu_option"><img class="inlineimg" src="$stylevar[imgdir_button]/sortasc.gif" alt="$vbphrase[DownloadThisThread]" /> <a href="dt.php?$session[sessionurl]t=$threadid">$vbphrase[DownloadThisThread]</a></td>
</tr> </if>

Anyone else doing something similar? If so, what did you do?

What you do only makes its link visible or unvisible to the thread reader. For this use:
<if condition="$bbuserinfo[usergroupid]==6">

</if>

But if you like to restrict it more strongly, edit dt.php you uploaded find this line:
PHP Code:

//$unallowed_downloaders = array(1); 

after that (as a new line!),add this

PHP Code:

if ($vbulletin->userinfo['usergroupid']!=6
{
    
print_no_permission();



mixylplik3 10-12-2005 01:25 PM

Thank you. :cool:

bing11 10-12-2005 02:45 PM

excellent hack

but cannot show the thread name in download Txt file name in my web.

I use utf-8 chinese.

Could you help me?

HappyPike 11-12-2005 03:14 PM

Thanks, Logician. Just installed it at my members' request!

akanevsky 11-23-2005 01:16 AM

Great, but two things are not:
1. (major) this hack does not go well with any languages other than english
2. (minor) the graphical icon in the menu is smaller that all the other icons, and it is visible - and irritating - from the first glance

Logician 11-23-2005 06:05 AM

Quote:

Originally Posted by Psionic Vision
1. (major) this hack does not go well with any languages other than english

I use it in a Turkish board and it works fine but I understand if it does not work in an other language. Unfortunately I am not able to test it with other languages.

Quote:

Originally Posted by Psionic Vision
2. (minor) the graphical icon in the menu is smaller that all the other icons,
and it is visible - and irritating - from the first glance

Changing it is easy:
https://vborg.vbsupport.ru/showpost....3&postcount=13

Aylwin 11-23-2005 09:12 AM

I finally upgraded to 3.5! Thanks for making this excellent hack available!

One thing I noticed though, the following line in dt.php doesn't seem to work:
Code:

print ("$vbphrase[DT_DownloadedFrom]\r\n\r\n");
In other words, the text file ends after the last post. The footer is missing. Any idea why?

Logician 11-23-2005 09:46 AM

Quote:

Originally Posted by Aylwin
I finally upgraded to 3.5! Thanks for making this excellent hack available!

One thing I noticed though, the following line in dt.php doesn't seem to work:
Code:

print ("$vbphrase[DT_DownloadedFrom]\r\n\r\n");
In other words, the text file ends after the last post. The footer is missing. Any idea why?

Good catch! Here is the fix:

Create a new phrase (in Global Group) named: DT_DownloadedFrom (Case SENSITIVE!) with this content:

Downloaded from {1} ({2}) at {3}.

This should fix it. I'm about to update the hack zip either..

Aylwin 11-23-2005 09:57 AM

Yep, that did it. Thanks!!!

akanevsky 11-23-2005 11:30 AM

Quote:

I use it in a Turkish board and it works fine but I understand if it does not work in an other language. Unfortunately I am not able to test it with other languages.
Aw.. Ok. Just FYI, for Russian, it gives out empty squares instead of letter. :( If I figure it out, I'll tell you what to fix :)

Duh... I'm a coder myself, so I do know that. I just thought that you might want to edit your package to fix the incongruency. ;)

akanevsky 11-23-2005 12:14 PM

Ok, here goes the minimod that performs the conversion of Russian letters into appropriate English letters / letter combinations.

IN dt.php, FIND:

PHP Code:

$filename str_replace(' ''_'$filename); 

ADD UNDERNEATH:

PHP Code:

  // -----------------------------------------------------------------------------------------------------------------------------------------------
  // Download Thread :: Russian Symbols Conversion Mod by Psionic Vision
  // -----------------------------------------------------------------------------------------------------------------------------------------------
  
$preg_find = array
  (
    
"/А/""/Б/""/В/""/Г/""/Д/""/Е/""/Ё/""/Ж/""/З/""/И/""/Й/""/К/""/Л/""/М/""/Н/""/О/""/П/""/Р/""/С/""/Т/""/У/""/Ф/""/Х/""/Ц/""/Ч/""/Ш/""/Щ/""/Ъ/""/Ы/""/Ь/""/Э/""/Ю/""/Я/",
    
"/а/""/б/""/в/""/г/""/д/""/е/""/ё/""/ж/""/з/""/и/""/й/""/к/""/л/""/м/""/н/""/о/""/п/""/р/""/с/""/т/""/у/""/ф/""/х/""/ц/""/ч/""/ш/""/щ/""/ъ/""/ы/""/ь/""/э/""/ю/""/я/"
  
);
  
  
$preg_replace = array
  (
    
"A""B""V""G""D""E""Jo""Zh""Z""I""J""K""L""M""N""O""P""R""S""T""U""F""H""C""Ch""Sh""Sh'""'""Y""'""Je""Ju""Ja",
    
"a""b""v""g""d""e""jo""zh""z""i""j""k""l""m""n""o""p""r""s""t""u""f""h""c""ch""sh""sh'""'""y""'""je""ju""ja"
  
);
  
  
$filename preg_replace($preg_find$preg_replace$filename);
  
// -----------------------------------------------------------------------------------------------------------------------------------------------
  // Download Thread :: Russian Symbols Conversion Mod by Psionic Vision
  // ----------------------------------------------------------------------------------------------------------------------------------------------- 

Enjoy everyone :)

P.S. A few other things:
1) Is there any reason behind using application/octet-stream rather than text/plan?
2) Why not make a custom function printbr($text, $num_of_breaks = 1), that will remove the need of writing "\r\n" all the time? :)

Aylwin 11-23-2005 02:26 PM

In case anyone is interested, I have a modified version of dt.php which downloads the thread in .rtf instead of .txt. It automatically converts bbcode for bold, italic and underline. This, imho, makes the downloaded document slightly better visually.

It's only for english though.

EDIT:
I've updated the attached file to convert bbcode for quoted text. You can also choose between Arial and Courier fonts by "switching" between lines 169 and 170. The font is Courier by default.

akanevsky 11-23-2005 02:28 PM

That's a very nice way of output. My Russian modification will work with your file too, as it only has to do with the filename :)

Logician 11-23-2005 03:52 PM

Thanks guys.. Linked your contributions in the first post.

Moparx 11-24-2005 12:31 AM

Great hack.

Is there an easy way to separate quotes within the posts from the actual replies themselves? Right now you cannot distinguish between the two and it can be confusing. :(

Having the quotes in posts generate like below would make this hack near perfect :)
"Some Text" -- Poster or Poster wrote: "Some Text"

Aylwin 11-24-2005 07:41 AM

Quote:

Originally Posted by Moparx
Is there an easy way to separate quotes within the posts from the actual replies themselves? Right now you cannot distinguish between the two and it can be confusing. :(

Having the quotes in posts generate like below would make this hack near perfect :)
"Some Text" -- Poster or Poster wrote: "Some Text"

This is something I would like to do too. I know how to do it in theory but I just don't have the skills to implement it. Basically, we need to do the following:

1) Search $post['postdate'] for (QUOTE=name)
2) Replace it with name wrote: "
3) Search $post['postdate'] for (/QUOTE)
4) Replace it with "

I don't know how to do 1) and 2) but I think 3) and 4) would be:
Code:

$post['pagetext'] = preg_replace("[\[\/QUOTE\]]", "\"", $post['pagetext']);
Can anyone help with 1) and 2)?

EDIT:
Okay, I think I figured it out.

Find:
Code:

$post[pagetext] = strip_bbcode($post[pagetext]);
Before this line, add:
Code:

$post['pagetext'] = preg_replace("[\[QUOTE=([a-zA-Z0-9_-]*)\]]", "Originally posted by \\1:\"", $post['pagetext']);
 $post['pagetext'] = preg_replace("[\[\/QUOTE\]]", "\"", $post['pagetext']);

At least I got something very close to this working on my rtf version.

croportal 11-28-2005 05:22 PM

how can i set another picture for this hack, and where i can change phrase Download This Thread - i wont to set on croatian LAnguage

Logician 11-28-2005 05:25 PM

Quote:

Originally Posted by croportal
how can i set another picture for this hack,

https://vborg.vbsupport.ru/showpost....3&postcount=13

Quote:

and where i can change phrase Download This Thread - i wont to set on croatian LAnguage
Admin Cp/Phrase Manager/Search In Phrases/search for "Download This Thread" in "Phrase Text"

croportal 11-28-2005 05:36 PM

thanks a lot logician

OsMoSiS.it 12-08-2005 02:41 PM

[QUOTE=Aylwin]
Okay, I think I figured it out.

Find:
Code:

$post[pagetext] = strip_bbcode($post[pagetext]);
Before this line, add:
Code:

$post['pagetext'] = preg_replace("[\

       
Quote:

       
       
               
       
       

                       

                       
                               

                                        Originally Posted by ([a-zA-Z0-9_-
                                       
                               

                               
*)\]]", "Originally posted by \\1:\"", $post['pagetext']);
 $post['pagetext'] = preg_replace("[\[\/QUOTE\]]", "\"", $post['pagetext']);

                       
                       

               


Quote:

Originally Posted by ([a-zA-Z0-9_-
At least I got something very close to this working on my rtf version.

Code:

$post['pagetext'] = preg_replace("[\[QUOTE=(.*?)\]]", "Originally posted by \\1:\"", $post['pagetext']);
 $post['pagetext'] = preg_replace("[\[\/QUOTE\]]", "\"", $post['pagetext']);

This works better, matches also names with spaces or symbols that previously broke page layout :)



* Installed with rtf hack :)

Eathanor 04-10-2006 06:32 PM

Thank you

Clicks Install

Tralala 06-20-2006 07:06 PM

Thanks for this!


All times are GMT. The time now is 04:52 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01708 seconds
  • Memory Usage 1,872KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (8)bbcode_code_printable
  • (6)bbcode_php_printable
  • (15)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete