vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Download PMs to File (for all 2.x.x versions)" (https://vborg.vbsupport.ru/showthread.php?t=15859)

bira 05-02-2001 10:00 PM

HACK UPDATED NOV 27TH 2001 - WORKS WITH ALL 2.X.X VERSIONS!

Since I was asked to make this available, here's my hack for downloading Private Messages (as many as you select) at once into a local txt file.

This is helpful if you need to clear out your PM folder(s) due to quota limitation, but don't want to lose those messages.

In effect, it works like an e-mail RFC archive.

Installation Instructions:

1. Open private.php.

Find:

Code:

  if ($delete!="") {
    $what="delete";
  }

Immediately AFTER it put:

PHP Code:

  if ($download!="") {
    
$what="download";
  } 

Find:

Code:

}

// ############################### start delete ###############################

Immediately ABOVE it (make sure you put it ABOVE the } ) put:

PHP Code:

if ($what=="download") {
    if (
is_array($privatemessage)) {
        
header("Content-disposition: filename=messages.txt");
        
header("Content-type: application/octet-stream");
        
header("Pragma: no-cache");
        
header("Expires: 0");

          while(list(
$key,$val)=each($privatemessage)) {
            
$downloads=$DB_site->query_first("SELECT touserid,fromuserid,dateline,title,message FROM privatemessage WHERE privatemessageid='$key' AND userid=$bbuserinfo[userid]");
            
$tousername=$DB_site->query_first("SELECT username FROM user WHERE userid='$downloads[touserid]'");
            
$fromusername=$DB_site->query_first("SELECT username FROM user WHERE userid='$downloads[fromuserid]'");
            
$msgdt vbdate($dateformat,$downloads[dateline]);
            
$msgtm vbdate($timeformat,$downloads[dateline]);
            
$wordwrap wordwrap($downloads[message],75,"\r\n");
            
            print(
"Date/Time Sent: $msgdt$msgtm\r\n");
            print(
"From: $fromusername[username]\r\n");
            print(
"To: $tousername[username]\r\n");
            print(
"Subject: $downloads[title]\r\n\r\n");
            print(
"$wordwrap\r\n");
            print(
"==========================================================================\r\n\r\n\r\n");


        } 
//end while
    
    
} else {
      eval(
"standarderror(\"".gettemplate("error_pmnoselected")."\");");
      exit;
   }


Note for Foreign Users: replace the words 'Date/Time Sent', 'From', 'To', 'Subject' in the above code with whatever wording in your language that suits you.

Save file and upload.

2. Edit template privfolder.

Find:

Code:

$massforwardlink
Immediately after OR before it (it does not matter), put:

Code:

or <input type="submit" class="bginput2" name="download" value="Download" style="background-color:#606096;color:#FFF788;font-size:10px;font-weight:bold">
Note for Foreign Users: replace the word "or" and the value "Download" with whatever wording in your language that suits you.


That's it!

Usage: select one or more messages in one of your Private Messages folder and click on "Download". You will be prompted to save messages.txt on your hard drive (a Windows filename & folder selection dialogue will pop up).

Cheers,

Bira

http://www.atlasf1.com/personal/bira/pm-download.gif

bokhalifa 05-03-2001 11:15 AM

good hack min;)

conan 05-03-2001 04:12 PM

Thanks a lot for the great hack!

poil11 05-03-2001 05:08 PM

Thanks for this great hack. i hope that you don't mind but i hacked it to work with wwwthreads. and i am going to use this in many many other things! good deal!

instead of it being message.txt i made that the subject of the post....

the_sisko 05-03-2001 09:43 PM

This is what a lot of my Users asked for!!!
THANKS A LOT!

bira 05-04-2001 08:37 AM

thanks :D

Streicher 05-04-2001 12:23 PM

Very good hack. No problems to hack in vB.

smelialichu 05-12-2001 05:44 PM

This is a great hack, just one problem though. When i click on download it displays the pm's in my browser and doesn't download it. i use IE 5.01 none of the other people on the board have reported the problem, ideas? I realise the problem is most likely at my end.

bira 05-12-2001 08:02 PM

Quote:

Originally posted by smelialichu
This is a great hack, just one problem though. When i click on download it displays the pm's in my browser and doesn't download it. i use IE 5.01 none of the other people on the board have reported the problem, ideas? I realise the problem is most likely at my end.
smelialichu, I'm not sure where to point you to, but it has to do with your system/browser setting. Instead of prompting you to choose between save file or open it, it goes right ahead and opens it without asking. I'm not sure how you solve that as I am not familiar with win32 registry stuff.

You might want to check in your security settings (Tool -> Internet Options) that Download is enabled (general download, that is). Not sure about anything else.

In any case, I'd recommend upgrading to IE 5.5, which is a much better, faster and less buggy browser.

Cheers,

bira

veedee 05-14-2001 10:29 AM

Great looking hack.

I run about 7 styles on my website, does this mean i have to hack the templates 7 times ?

~veedee

bira 05-14-2001 05:49 PM

Quote:

Originally posted by veedee
Great looking hack.

I run about 7 styles on my website, does this mean i have to hack the templates 7 times ?

~veedee

Do you actually have a different templateset for every style though?!?

Run a search in the Control Panel -> Templates for $massforwardlink. If you have more than one template with it, you can do a search/replace of

Code:

Search for: $massforwardlink
Replace with: $massforwardlinkor <input type="submit" name="download" value="Download">

At your peril though :)

veedee 05-14-2001 05:57 PM

yeah different templates :)

will do what you told me, cheers me dear :)

smelialichu 05-14-2001 06:32 PM

Abyone got any ideas on how to solve my prob? i got it so the filename includes the date. i can tell you how if anyone's interested, iy's fairly simple. In fact very simple

bira 05-18-2001 08:19 PM

Actually, wordwrap() is a built-in function in PHP.

Perhaps, though, it's only in PHP4 or something.

slip 06-02-2001 10:32 PM

i installed everything exactly as it should be done, yet when i try to download some pm's, i just get a blank page (completely blank, no errors)

any help?

NORRITT 06-04-2001 03:46 PM

Hi, if i click in the user cp on the link 'Private Messaging' I get just the following error messsage:

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in e:\apache\apache\nsdocs\forum\private.php on line 695

zarkov 06-09-2001 09:46 AM

restore private.php and see if that works then rehack.
You probably deleted a , or } or something. :)

See my hack based on this one to Email the selected PM's to the registered email address here
http://161.58.84.213/forum/showthrea...threadid=18991

NORRITT 06-09-2001 11:12 AM

I did it three times! :(

zarkov 06-09-2001 11:46 AM

did it work OK when you re up the original file?

NORRITT 06-09-2001 02:13 PM

yes

zarkov 06-10-2001 08:56 AM

Then it must be something to do with the hack, either your doing something wrong or possibly your using PHP 3 and it maybe it doesnt work with 3 ( that is only a guess as i have never tried it on 3).

slip 06-10-2001 05:24 PM

Quote:

Originally posted by slip
i installed everything exactly as it should be done, yet when i try to download some pm's, i just get a blank page (completely blank, no errors)

any help?



can anyone help me?
I'm using PHP4 and I did everything like I should have..

zarkov 06-12-2001 07:16 AM

What browser you using?

I found that the code in the hack worked in IE 5 but not 5.5, I had to do a little digging around,But i assume its to do with http versions, IE 5 being http 1.0 complient and 5.5 being http 1.1 compliant.

I did work out and get it to work in IE.5.5 and netscape 4.7, but at the moment im at work and dont have access to the code, but ill post the changes later for anyone to use.

Please note that from mmy playing you can have it work in IE 5 or 5.5 but not both

slip 06-12-2001 01:30 PM

yup, i'm running IE 5.5

those code modifications that you did would be GREATLY appreciated..

zarkov 06-12-2001 09:09 PM

OK look for this code in private.php
PHP Code:

if (is_array($privatemessage)) { 
header("Content-type: application/octet-stream"); 
header("Content-disposition: attachment; filename=messages.txt"); 
header("Pragma: no-cache"); 
header("Expires: 0"); 

and replace it with
PHP Code:

if (is_array($privatemessage)) { 
header("Content-disposition: attachment; filename=messages.txt"); 
header("Content-type: uknown/unknown"); 
header("Pragma: no-cache"); 
header("Expires: 0"); 

Dont forget to change the filename=messages.txt to what ever you want to call the downloaded file.

Axel Foley 06-17-2001 12:00 AM

Bira, first of all GREAT HACK! ;)

For Zarkov & Norritt & Slip & Bira :rolleyes: :

I had the same error as Norritt (Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in e:\apache\apache\nsdocs\forum\private.php on line 695), and it wasn't my fault, after a while I found out the error. I had to modify the last EVAL() in this way:

PHP Code:

// Original code by Bira
      
eval("standarderror(\"".gettemplate("error_pmnoselected")."");");
      exit;
      }

// My modification
      eval("
standarderror(\"".gettemplate("error_pmnoselected")."\");");
      exit;
      } 

One other thing: I use IE 5.5 and the hack works greatly without applying Zarkov's modifications.

ezdreamer 11-12-2001 04:48 AM

I tried this with version 2.2.0 but the only thing that came up was an empty page when I hit the pm section.

Will Bira's code work with 2.2.0 or could I be doing something wrong. I followed the instructions to the letter and nothing... :confused:

Alien 11-12-2001 05:46 PM

Wow, I never even saw this one..

Anyone have this working in recent versions? ...and did it require modification? I'd love to install this...

amykhar 11-12-2001 05:59 PM

I have it working on my board. It only required a bit of tweaking to make the button match other buttons on the form.

Amy

Amasov 11-13-2001 07:47 AM

I am running this hack on my 2.2.0 an it works perfectly (thanks @Bira, great hack)

Only one question:

How do I change the size of the "Download"-Button ??
(It's greater than the others, but I used the same style like the others)..

Thanks.

@ezdreamer:
Actually you did something wrong! :p

@Alien:
I ran this hack on RC2, 2.0.1, 2.0.2, 2.0.3 :)

Sweet Evil 11-13-2001 08:08 AM

Quote:

Originally posted by smelialichu
This is a great hack, just one problem though. When i click on download it displays the pm's in my browser and doesn't download it. i use IE 5.01 none of the other people on the board have reported the problem, ideas? I realise the problem is most likely at my end.


Same Problem... :) (IE 5.0)

Sweet Evil 11-13-2001 08:17 AM

Quote:

Originally posted by Zarkov
OK look for this code in private.php
PHP Code:

if (is_array($privatemessage)) { 
header("Content-type: application/octet-stream"); 
header("Content-disposition: attachment; filename=messages.txt"); 
header("Pragma: no-cache"); 
header("Expires: 0"); 

and replace it with
PHP Code:

if (is_array($privatemessage)) { 
header("Content-disposition: attachment; filename=messages.txt"); 
header("Content-type: uknown/unknown"); 
header("Pragma: no-cache"); 
header("Expires: 0"); 


Dont forget to change the filename=messages.txt to what ever you want to call the downloaded file.

Thanks!.. this fixed the problem .. now it is a download.. :)

Sweet Evil 11-13-2001 08:28 AM

Quote:

Originally posted by Amasov
I am running this hack on my 2.2.0 an it works perfectly (thanks @Bira, great hack)

Only one question:

How do I change the size of the "Download"-Button ??
(It's greater than the others, but I used the same style like the others)..

Thanks.

@ezdreamer:
Actually you did something wrong! :p

@Alien:
I ran this hack on RC2, 2.0.1, 2.0.2, 2.0.3 :)


Replace:
PHP Code:

or <input type="submit" name="download" value="Download"

With:
PHP Code:

    or <input type="submit" class="bginput" name="download" value="Download" style="background-color:#336D95;color:#000000;font-size:10px;font-weight:bold"

But if you already made it look like the rest... (style=")

Then you just need to
Replace:
PHP Code:

or <input type="submit" name="download" value="Download" 

With:
PHP Code:

or <input type="submit" class="bginput" name="download" value="Download" 


Amasov 11-13-2001 09:22 AM

It was the

Code:

class="bginput"
Thanks a lot, Sweet Evil :) :)

Sweet Evil 11-13-2001 09:35 AM

Yea I was just trying to make it sound tech like.. (lol)

Just saying add (class="bginput") after (type="submit") did not sound very tech like..

Anyhow NP :D

Alien 11-13-2001 07:15 PM

Thanks for your responses everyone. :D

Installed, and working!

ezdreamer 11-14-2001 06:14 AM

In private.php

Find code:

eval("standardredirect(\"".gettemplate("redirect_p mdelete")."\",\"private.php?s=$session[sessionhash]&folderid=$thisfolder\");");
}

But instead of the above I find this in private.php:

eval("standardredirect(\"".gettemplate("redirect_p mdelete")."\",\"private.php?s=$session[sessionhash]&folderid=".intval($thisfolder)."\");");
}

What do I do now? :confused:

jamie 11-14-2001 09:04 AM

now now where can i get the hack for vb 2.0.3?

has it been deleted?

jam583 11-25-2001 10:00 PM

After adding the new code:

if (is_array($privatemessage)) {
header("Content-disposition: attachment; filename=messages.txt");
header("Content-type: uknown/unknown");
header("Pragma: no-cache");
header("Expires: 0");

I still get a white screeen

JJR512 11-26-2001 04:24 AM

Quote:

Originally posted by ezdreamer
In private.php

Find code:

eval("standardredirect(\"".gettemplate("redirect_p mdelete")."\",\"private.php?s=$session[sessionhash]&folderid=$thisfolder\");");
}

But instead of the above I find this in private.php:

eval("standardredirect(\"".gettemplate("redirect_p mdelete")."\",\"private.php?s=$session[sessionhash]&folderid=".intval($thisfolder)."\");");
}

What do I do now? :confused:

For 2.2.1, find this:
PHP Code:

    eval("standardredirect(\"".gettemplate("redirect_pmdelete")."\",\"private.php?s=$session[sessionhash]&folderid=".intval($thisfolder)."\");");
  } 

And make that replacement after that.

Note: Do NOT make the replacement after this:
PHP Code:

  eval("standardredirect(\"".gettemplate("redirect_pmdelete")."\",\"private.php?s=$session[sessionhash]&folderid=".intval($folderid)."\");");
#end dodelete 

Which is very similar and appears a few lines further down.


All times are GMT. The time now is 02:45 AM.

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.01463 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
  • (6)bbcode_code_printable
  • (13)bbcode_php_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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