bira
Thu 3rd May '01, 8:54am
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:
if ($delete!="") {
$what="delete";
}
Immediately AFTER it put:
if ($download!="") {
$what="download";
}
Find:
eval("standardredirect(\"".gettemplate("redirect_pmdelete")."\",\"private.php?s=$session[sessionhash]&folderid=$thisfolder\");");
}
Immediately AFTER it put:
if ($what=="download") {
if (is_array($privatemessage)) {
header("Content-disposition: filename=messages.txt");
header("Content-type: application/octetstream");
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:
$massforwardlink
Immediately after OR before it (it does not matter), put:
or <input type="submit" name="download" value="Download">
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
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:
if ($delete!="") {
$what="delete";
}
Immediately AFTER it put:
if ($download!="") {
$what="download";
}
Find:
eval("standardredirect(\"".gettemplate("redirect_pmdelete")."\",\"private.php?s=$session[sessionhash]&folderid=$thisfolder\");");
}
Immediately AFTER it put:
if ($what=="download") {
if (is_array($privatemessage)) {
header("Content-disposition: filename=messages.txt");
header("Content-type: application/octetstream");
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:
$massforwardlink
Immediately after OR before it (it does not matter), put:
or <input type="submit" name="download" value="Download">
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