Previous Thread
Next Thread
Print Thread
Rate Thread
#210489 05/03/2001 11:31 AM
Joined: Aug 2000
Posts: 262
Enthusiast
Enthusiast
Offline
Joined: Aug 2000
Posts: 262
This hack allows you to download the pm that you recieved to your disk to read later or print. the origional hack was for vbulletin by bira and that post can be seen at http://www.vbulletin.com/forum/showthread.php?s=&postid=100911
i modded it to work with w3t. you can see it in action at my forum http://www.extremeforums.org PM yourself and you will see a button that says download this post to disk click on it and it asks where you want to save the file to on your HD.

files moded: viewmessage.php and mess_handler.php

open up viewmessage.php and find the line that says:


echo " ";


change it so it looks like this:


echo " ";


done with viewmessage.php now open up mess_handler.php just above:


// ####################################################################
// reply_mess function - Reply to this message


add:


// --------------------------------
// END OF THE DELETE_MESS FUNCTION


// ####################################################################
// save_mess function - Save PM ot Disk
// ####################################################################
function save_mess($Username="",$Password="",$Number="",$Subject="",$Sendto="") {
global $dbh, $config, $theme, $lang;
$html = new html;
$Username_q = addslashes($Username);
$query = "
SELECT M_Message,M_Sent
FROM w3t_Messages
WHERE M_Number = $Number
AND M_Username = '$Username_q'
";
$sth = $dbh -> do_query($query);
list($Message,$When) = $dbh -> fetch_array($sth);

$Message = ereg_replace(""",""",$Message);
$wordwrap = wordwrap($Message,75,"\r\n");
$html = new html;
$time = $html -> convert_time($When,$user[U_TimeOffset]);
$Subject = ereg_replace(""",""",$Subject);

header("Content-disposition: filename=messages.txt");
header("Content-type: application/octetstream");
header("Pragma: no-cache");
header("Expires: 0");
print("Date/Time Sent: $time\r\n");
print("From: $Sendto\r\n");
print("Subject: $Subject\r\n\r\n");
print("$wordwrap\r\n");
print("==========================================================================\r\n\r\n\r\n");
// echo "$Message and the subject of $Subject from $Sendto";
$dbh -> finish_sth($sth);
}


almost forgot and then find:


$user = $userob -> authenticate("$Username","$Password","U_Username, U_Password,U_Groups,U_EReplies,U_TextCols,U_TextRows,U_Preview");


and change it so it looks like this:


$user = $userob -> authenticate("$Username","$Password","U_Username, U_Password,U_Groups,U_EReplies,U_TextCols,U_TextRows,U_Preview,U_TimeOffset");


it works damn good..an example can be seen at my forums, you have to login or register or whatever...

[:red]--------------
http://extremeforums.org

Edited by poil on 05/03/01 11:33 AM.


Sponsored Links
vent #210490 05/03/2001 12:16 PM
Joined: Aug 2000
Posts: 3,590
Moderator
Moderator
Offline
Joined: Aug 2000
Posts: 3,590
Here's an idea...

Have an option to save it in the email format (.eml), which is just a file with email headers, 2 line breaks, and then the msg.

Shouldn't be hard to fake the email headers.


Joined: Aug 2000
Posts: 262
Enthusiast
Enthusiast
Offline
Joined: Aug 2000
Posts: 262
yes you could do that for sure, i definitely want it to work on every platform.

[:red]--------------
http://extremeforums.org

vent #210492 05/07/2001 6:45 AM
Joined: May 1999
Posts: 242
Coder
Coder
Offline
Joined: May 1999
Posts: 242
Howdy Poil.

What was the purpose of this? There's probably one, I just can't see it. []/testimages/icons/laugh.gif[/]

In reply to:

open up viewmessage.php and find the line that says:

echo " ";



change it so it looks like this:

echo " ";



[]/testimages/icons/smile.gif[/] 6 []/testimages/icons/frown.gif[/]
Screamers


Joined: Aug 2000
Posts: 262
Enthusiast
Enthusiast
Offline
Joined: Aug 2000
Posts: 262
i don't know why but when i looked at the preview everything was a-okey, but i guess not, i must have been sleepy again. life has been to hard this past month. not thinking properly at all....i uploaded the readme for it

[:red]--------------
http://extremeforums.org
Attachments
23-35693-readme.txt (0 Bytes, 26 downloads)

Sponsored Links
vent #210494 05/07/2001 8:40 AM
Joined: May 1999
Posts: 242
Coder
Coder
Offline
Joined: May 1999
Posts: 242
I've had days like that.

cool, I'll take a look.



[]/testimages/icons/smile.gif[/] 6 []/testimages/icons/frown.gif[/]
Screamers

vent #210495 05/07/2001 9:57 AM
Joined: May 1999
Posts: 242
Coder
Coder
Offline
Joined: May 1999
Posts: 242
Where's the block of code telling to look for the save_mess function?

[]/testimages/icons/smile.gif[/] 6 []/testimages/icons/frown.gif[/]
Screamers

Joined: Aug 2000
Posts: 262
Enthusiast
Enthusiast
Offline
Joined: Aug 2000
Posts: 262
just above :
 // #################################################################### // reply_mess function - Reply to this message 
in mess_handler.php add
 // #################################################################### // save_mess function - Save PM ot Disk // #################################################################### function save_mess($Username="",$Password="",$Number="",$Subject="",$Sendto="") { global $dbh, $config, $theme, $lang; $html = new html; $Username_q = addslashes($Username); $query = " SELECT M_Message,M_Sent FROM w3t_Messages WHERE  M_Number   = $Number AND    M_Username = '$Username_q' "; $sth = $dbh -> do_query($query); list($Message,$When) = $dbh -> fetch_array($sth);  $Message = ereg_replace(""",""",$Message); $wordwrap = mwordwrap($Message,75,"\r\n"); $html = new html; $time = $html -> convert_time($When,$user[U_TimeOffset]); $Subject = ereg_replace(""",""",$Subject); $Subject = ereg_replace(""",""",$Subject);  header("Content-disposition: filename=messages.txt"); header("Content-type: application/octetstream"); header("Pragma: no-cache"); header("Expires: 0"); print("Date/Time Sent: $time\r\n"); print("From: $Sendto\r\n"); print("Subject: $Subject\r\n\r\n"); print("$wordwrap\r\n"); print("==========================================================================\r\n\r\n\r\n"); // echo "$Message and the subject of $Subject from $Sendto"; $dbh ->finish_sth($sth); } 
so it will look like this"
 // #################################################################### // save_mess function - Save PM ot Disk // #################################################################### function save_mess($Username="",$Password="",$Number="",$Subject="",$Sendto="") { global $dbh, $config, $theme, $lang; $html = new html; $Username_q = addslashes($Username); $query = " SELECT M_Message,M_Sent FROM w3t_Messages WHERE  M_Number   = $Number AND    M_Username = '$Username_q' "; $sth = $dbh -> do_query($query); list($Message,$When) = $dbh -> fetch_array($sth);  $Message = ereg_replace(""",""",$Message); $wordwrap = mwordwrap($Message,75,"\r\n"); $html = new html; $time = $html -> convert_time($When,$user[U_TimeOffset]); $Subject = ereg_replace(""",""",$Subject); $Subject = ereg_replace(""",""",$Subject);  header("Content-disposition: filename=messages.txt"); header("Content-type: application/octetstream"); header("Pragma: no-cache"); header("Expires: 0"); print("Date/Time Sent: $time\r\n"); print("From: $Sendto\r\n"); print("Subject: $Subject\r\n\r\n"); print("$wordwrap\r\n"); print("==========================================================================\r\n\r\n\r\n"); // echo "$Message and the subject of $Subject from $Sendto"; $dbh ->finish_sth($sth); }  // #################################################################### // reply_mess function - Reply to this message   


[:red]--------------
http://extremeforums.org

vent #210497 05/07/2001 4:40 PM
Joined: May 1999
Posts: 242
Coder
Coder
Offline
Joined: May 1999
Posts: 242
Sure you didn't skip a step? You have the button and the function, but I don't see the code that actually calls the function. This is the button:

< input type=submit name = option value = "Save This PM to Disk" class="buttons" >

Because the form = < form method=POST action = "$config[phpurl]/mess_handler.php" >

and because there are values, they should be passed to the mess_handler.php file. The mess_handler file loads, but nothing in there, that I see anyway, is telling the code to go to save_mess at all. Like I would be expecting a couple of lines like the following:

$html = new html;
$html -> save_mess("info about the message like the message number in here");

Not sure if I'm doing something wrong or if a step was skipped. I can definitely see that it's a cool hack, just can't make it work on mine.

[]/testimages/icons/smile.gif[/] 6 []/testimages/icons/frown.gif[/]
Screamers

Joined: Aug 2000
Posts: 262
Enthusiast
Enthusiast
Offline
Joined: Aug 2000
Posts: 262
bleh bleh bleh, as you can see, i am no good at writing instructions on how to do anything..... i am just horrible! in mess_handler.php fin dthe line that says:

// --------------------------------------------------------
// If they selected reply to this message, execute that sub
if($option == "$lang[REPLY_MESS]"){
reply_mess($Username,$Password,$Number,$Subject,$Sendto,$TextCols,$TextRows,$Pselected,$user);
exit();
}


add this below it:

// --------------------------------------------------------
// If they selected save this message, execute that sub
if($option == "Save This PM to Disk"){
save_mess($Username,$Password,$Number,$Subject,$Sendto);
exit();
}


so it looks like this:

// --------------------------------------------------------
// If they selected reply to this message, execute that sub
if($option == "$lang[REPLY_MESS]"){
reply_mess($Username,$Password,$Number,$Subject,$Sendto,$TextCols,$TextRows,$Pselected,$user);
exit();
}

// --------------------------------------------------------
// If they selected save this message, execute that sub
if($option == "Save This PM to Disk"){
save_mess($Username,$Password,$Number,$Subject,$Sendto);
exit();
}

i am damn sure that is it, ahhh!!!! if you change the wording in viewmessage, make sure it the same in messhandler like above.

[:red]--------------
http://extremeforums.org

Sponsored Links

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
AllenAyres
AllenAyres
Texas
Posts: 21,079
Joined: March 2000
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)