Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: live627 on July 16, 2007, 01:37:31 PM

Title: Export Personal Messages to XML
Post by: live627 on July 16, 2007, 01:37:31 PM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=845)

This Mod allows you to export your Personal Messages in a XML format.

Version 1.0
! Fixed Namespace issue
! Release
Title: Re: Export Personal Messages to XML
Post by: cybergurk on July 17, 2007, 06:09:12 AM
Moin,

I have found "BUG" ?

$sourcedir (http://parser.smfportal.de/variables.htm)/PersonalMessage.php
require_once($sourcedir . '/ExportMessages.php');

change to (Remove "/" )

require_once($sourcedir . 'ExportMessages.php');


Title: Re: Export Personal Messages to XML
Post by: SleePy on July 17, 2007, 01:20:49 PM
Actually the / is needed.

$sourcedir should contain the path to your sources directory without the trailing /
So the / Is needed :)
Title: Re: Export Personal Messages to XML
Post by: cybergurk on July 17, 2007, 01:34:07 PM
hi,
ok :)
Title: Re: Export Personal Messages to XML
Post by: JOSHSKORN on July 17, 2007, 10:49:58 PM
I actually had the exact same problem and I've managed to fix it.  Basically when I click on Export All PMs, I receive the following error:


Fatal error: exportmessages(): Failed opening required '/ExPortMessages.php' (include_path='.:/usr/local/lib/php:/usr/local/share/pear') in /hsphere/local/home/threei/3iclan.net/thesite/Sources/PersonalMessage.php on line 2269


You'd think the error is in line 2269, but actually it's in line 2266.  You need to add the $sourcedir to the list of variables.  So,


function ExportMessages()
{
global $db_prefix, $ID_MEMBER, $scripturl, $user_info, $context, $txt;

// Sadly to make this work for package manager the easy way was to just include a file.
require_once($sourcedir . '/ExPortMessages.php');
ExportMessagesXML();
}


now looks like:


function ExportMessages()
{
global $db_prefix, $sourcedir, $ID_MEMBER, $scripturl, $user_info, $context, $txt;

// Sadly to make this work for package manager the easy way was to just include a file.
require_once($sourcedir . '/ExPortMessages.php');
ExportMessagesXML();
}


Well that's what I did to make it work for me.
Title: Re: Export Personal Messages to XML
Post by: SleePy on July 17, 2007, 11:57:38 PM
Yea I missed a variable that needed to be globalized.

Updated as 1.0.1 to fix this.

Version 1.0.1
! Initial Function should globalize the Sources Directory
Title: Re: Export Personal Messages to XML
Post by: jeronij on August 15, 2007, 05:26:33 AM
i have just installed this, and the ExPortMessages.php file is empty. Can you please check this is correct?

I get this message when I try to export:

Fatal error: exportmessages() [function.require]: Failed opening required '/home/jeronij/public_html/forums/Sources/ExportMessages.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/jeronij/public_html/forums/Sources/PersonalMessage.php on line 2160
Title: Re: Export Personal Messages to XML
Post by: SleePy on August 15, 2007, 12:49:29 PM
This sometimes happens with package manager and it doesn't copy the new file over with contents on some hosts.

Just open up the compressed file and get the ExportMessages.php file out and upload it to your sources folder replacing the currently blank one.
Title: Re: Export Personal Messages to XML
Post by: White_Wolf on September 12, 2007, 10:12:12 AM
This mod installs without errors, and I even see my two options "export inbox" and "export all" but whenever I click either one, all I get is a blank white screen.

My browser shows the url as http://www.xxxxxxxxxx.org/forum/index.php?action=pm;sa=export
for the "export all". And the export inbox takes me to http://www.xxxxxxxxxxxx.org/forum/index.php?action=pm;sa=export;l=-1

but all they are is blank screens :(
Title: Re: Export Personal Messages to XML
Post by: SleePy on September 12, 2007, 07:08:23 PM
It may be possible that the php file did not get saved correctly to the Sources folder.

Decompress the file, Then upload the ExPortMessages.php file to your Sources folder.
Title: Re: Export Personal Messages to XML
Post by: mark7144 on November 02, 2007, 09:35:48 PM
Everything installs successfully but same problem as everyone else... blank page when you click on the export links.

This is not a problem with me, the mod needs to be fixed :)

Great mod though, look forward to the update.
Title: Re: Export Personal Messages to XML
Post by: SleePy on November 02, 2007, 11:22:48 PM
Actually its an issue with the server ;)
Decompress the file and Upload the .php file to the Sources folder.
Title: Re: Export Personal Messages to XML
Post by: mark7144 on November 03, 2007, 08:31:33 AM
Out of all the many mods I have installed this the first one with such an issue. Is there not another way of creating the mod so it isn't required to do it this way?
Title: Re: Export Personal Messages to XML
Post by: SleePy on November 03, 2007, 11:42:35 AM
Saddly no, Since my mod does cdata to output the html and stuff correctly for the xml output. It would break package manager. And It is really hard to work around this and would create confusing code.
Title: Re: Export Personal Messages to XML
Post by: mark7144 on November 03, 2007, 02:55:35 PM
OK can you then explain really clearly what I need to do for a work around?
Title: Re: Export Personal Messages to XML
Post by: SleePy on November 03, 2007, 03:05:44 PM
This happens sometimes because the server isn't allowing php to copy the file due to different permissions and/or users on the files/folders.
Title: Re: Export Personal Messages to XML
Post by: mark7144 on November 03, 2007, 07:53:11 PM
Thank you, this fixed it. I have one question, what's the advantage of being able to save PMs in XML over that of HTML?

And once the XML file is saved, how is the user supposed to view it?
Title: Re: Export Personal Messages to XML
Post by: SleePy on November 04, 2007, 01:09:26 AM
XML offers may advantages,
I would say the greatest is if you have time its easy to create xslt style sheets (I don't have time at the moment to write one) that will display the output nicely. Such as my mods right now if you view the .xml file in your browser you get a nice output, and yet the source of it is really clean stil with just hte data.

It also makes it easier to update to a master file by just following the simple format it does. At the moment i don't plan on it but importing pms would be very easy to do with the xml format.
Title: Re: Export Personal Messages to XML
Post by: mark7144 on November 04, 2007, 08:26:32 AM
When I view the exported XML in my browser (FF or IE) it's just code?
Title: Re: Export Personal Messages to XML
Post by: SleePy on November 04, 2007, 11:46:34 AM
Yea i haven't made xlst style sheets for those. But try the mod package itself after you decompress it. THere is a package-info.xml file that is a great example of how this can be done.

I didn't make those, Daniel did, I just adopted them for use in my mods.
Title: Re: Export Personal Messages to XML
Post by: mark7144 on November 04, 2007, 06:54:27 PM
So for the typical user, they will have no idea what to do with their downloaded XML files.
Title: Re: Export Personal Messages to XML
Post by: SleePy on November 04, 2007, 07:30:53 PM
Well for a typical user it will just have the data of their pms saved nicely.
Really though its made for storing it so you can remove them off the server ;)
Title: Re: Export Personal Messages to XML
Post by: mark7144 on November 05, 2007, 02:40:10 AM
I know but maybe there should be a (?) link that tells the user what to do with the data when they have it on their computer. Because like me, most of them will open it up and go WTF and simply then have no use for it?
Title: Re: Export Personal Messages to XML
Post by: SleePy on November 05, 2007, 12:06:22 PM
I plan on adding a xslt style sheet sometime in the future. I just don't have the time at the moment to make it.
Then comes the mater of how to implant it, Right now I am thinking of having it attempt to use the one off the site and if it can't try to find one in the local folder it is in (meaning the style sheet is downloadable).
Title: Re: Export Personal Messages to XML
Post by: mark7144 on November 05, 2007, 02:33:49 PM
SleePY, I will have to uninstall your mod because the vast majority of my users won't understand what to do with the data.

Is there any chance you could make a similar mod to the already existing HTML export mod? At the moment that mod only downloads the current box (in/out) you're viewing. I'd like to have it similar to yours where there is a link to download the inbox or everything.
Title: Re: Export Personal Messages to XML
Post by: SleePy on November 05, 2007, 07:50:37 PM
Since there is an existing mod just like it I can't, but you can ask the mod author to expand on the features of their mod.
Title: Re: Export Personal Messages to XML
Post by: Snow Wolf on December 05, 2007, 12:21:40 PM
I am getting an error message:

Export Inbox:
QuoteFatal error: exportmessages(): Failed opening required '/home/content/D/e/n/DenKain/html/forum/Sources/ExPortMessages.php' (include_path='.:/usr/local/lib/php') in /home/content/D/e/n/DenKain/html/forum/Sources/PersonalMessage.php on line 2270

Export ALL PMs:
QuoteFatal error: exportmessages(): Failed opening required '/home/content/D/e/n/DenKain/html/forum/Sources/ExPortMessages.php' (include_path='.:/usr/local/lib/php') in /home/content/D/e/n/DenKain/html/forum/Sources/PersonalMessage.php on line 2270
Title: Re: Export Personal Messages to XML
Post by: SleePy on December 06, 2007, 01:12:46 AM
The .php file didn't get uploaded correctly.
Decompress the .tar.gz file and upload the ExPortMessages.php to your Sources directory.
Title: Re: Export Personal Messages to XML
Post by: Snow Wolf on December 07, 2007, 11:20:51 AM
Fixed
Title: Re: Export Personal Messages to XML
Post by: BigMike on February 04, 2008, 11:42:47 AM
YES!! This is AWESOME!

I have 1167 PMs and it will be SA-WEEEEEEEEEEET to FINALLY clear them out without deleting them!!

Thank you very much for your work, I am downloading this mod right now!
Title: Re: Export Personal Messages to XML
Post by: BigMike on February 04, 2008, 12:05:11 PM
Ok, got it installed using the Package Manager (only my 2nd time installing a mod this way) and everything went smooth except for the modification to the "Modifications.english.php" file. It added the changes after the "?>" php end command instead of before it.

Also, what is the best way to view an XML file like this? It loads in MS Excel (won't load in OpenOffice Calc  :'( :'( :'( :'() but it is still pretty hard to read it.

I understand the primary cause for this mod is most likely just to have some sort of backup, which is does accomplish, but if it has the ability to make a formatted XML file, then why not just make a formatted HTML file so I can see all the line breaks and font styles?

Thanks
BigMike
Title: Re: Export Personal Messages to XML
Post by: BigMike on February 04, 2008, 12:48:44 PM
Found a problem: Now I am getting "Undefined index: exportpms_inbox" in my error log......

Volcom Today at 08:48:32 AM
http://board.marlincrawler.com/index.php?action=pm
8: Undefined index: exportpms_inbox
File: /(my root source)/Sources/PersonalMessage.php
Line: 254

Volcom Today at 08:48:32 AM
http://board.marlincrawler.com/index.php?action=pm
8: Undefined index: exportpms_all
File: /(my root source)/Sources/PersonalMessage.php
Line: 244

Brandon Today at 08:48:13 AM
http://board.marlincrawler.com/index.php?action=pm
8: Undefined index: exportpms_inbox
File: /(my root source)/Sources/PersonalMessage.php
Line: 254

Brandon Today at 08:48:13 AM
http://board.marlincrawler.com/index.php?action=pm
8: Undefined index: exportpms_all
File: /(my root source)/Sources/PersonalMessage.php
Line: 244

not a toy Today at 08:47:53 AM
http://board.marlincrawler.com/index.php?action=pm;f=inbox;l=-1
8: Undefined index: exportpms_this
File: /(my root source)/Sources/PersonalMessage.php
Line: 251

not a toy Today at 08:47:53 AM
http://board.marlincrawler.com/index.php?action=pm;f=inbox;l=-1
8: Undefined index: exportpms_all
File: /(my root source)/Sources/PersonalMessage.php
Line: 244


I don't have any time to check this out right now, but I should later tonight.

Regards,
BigMike
Title: Re: Export Personal Messages to XML
Post by: SleePy on February 04, 2008, 05:32:32 PM
In my mods I have put a xslt stylesheet in them. So opening it in your browser should yield a nice visual layout of the mod.
The errors you are getting is saying the language string is not defined. Did you remove them from the Modifications.english.php? Do you have other languages?
Title: Re: Export Personal Messages to XML
Post by: BigMike on February 04, 2008, 06:40:28 PM
Quote from: SleePy on February 04, 2008, 05:32:32 PM
In my mods I have put a xslt stylesheet in them. So opening it in your browser should yield a nice visual layout of the mod.

I saw the files in the compressed package file that were not needed for the modification, but even when I place those files in the same dir as my PM XML export, in FireFox I get the following message:

        This XML file does not appear to have any style information associated with it. The document tree is shown below.


Sorry, I don't know much about stylesheets relating to xml files.

QuoteThe errors you are getting is saying the language string is not defined. Did you remove them from the Modifications.english.php? Do you have other languages?

Well, actually in reply #30 above I mentioned that the additions to the Modifications.english.php file were placed below the "?>" line, which wrote all kinds of text at the top of every since page of my forum. I was quickly able to find the mistake in the package manager installation, and I moved the "?>" to below the added lines in the file.]

Other than that, I did not change any thing else in that file.

I suppose this is why I NEVER use the package manager and ALWAYS do manual installs. Only as of very recent (last week) have I begun using the package manager for installs. I've been manually installing mods for a good 5 years and have just now begun experimenting with the automatic package manager. It is EXTREMELY nice when it works, but I still have my doubts :D
Title: Re: Export Personal Messages to XML
Post by: SleePy on February 04, 2008, 06:54:11 PM
Are you on windows? I never did try to see if the xml files work on windows machines. I guess I should try that out.
You can also run the files through Daniels Package parser, which I keep a copy of at my site: http://sleepycode.com/PackageParser/index.php

Just select your SMF version and upload your file. The Package Parser handles the rest and gives a nice output for manual installs.

As I said that error is saying this string is not defined:
$txt['exportpms_inbox']  = 'Export Inbox';

Do you have any other language files? The language strings need to be added to all the language files.

Title: Re: Export Personal Messages to XML
Post by: BigMike on February 04, 2008, 07:16:05 PM
Quote from: SleePy on February 04, 2008, 06:54:11 PM
Are you on windows?
Affirmative.

QuoteDo you have any other language files?
Negative. 1 Language 1 Theme.


Here is the end of my Modifications.english.php:

// Export Personal Messages
$txt['exportpms_inbox']  = 'Export Inbox';
$txt['exportpms_this']  = 'Export This Folder';
$txt['exportpms_all'] = 'Export ALL PMs';
$txt['exportpms_none'] = 'You have No Personal Messages to export.';

?>
Title: Re: Export Personal Messages to XML
Post by: SleePy on February 04, 2008, 09:49:38 PM
Has the error occurred recently?
Title: Re: Export Personal Messages to XML
Post by: BigMike on February 05, 2008, 02:26:18 AM
Actually,

I am at home and am about to go to sleep. I just checked my error log, and I have not had an error since 8:48 am, which are the same errors as above on reply #31.

Also I made my reply at 9:48 am which, looking at the logs, was 1 hour after the errors were made.

Furthermore, the errors were made all within 1 minute----

-----So in actuality, the errors were most likely made during the split second -- or whatever -- that it took for the mod to be installed and setup.

Maybe to avoid this error, adding the text to the modification language file should have been the first step in the modification process so that once the system got fired up, even if someone just happened (in this case) to be viewing their PMs, at least a couple residual errors would not have been thrown.

Anyways, it is clearly not a bug on the modification's part, as far as its functionality is concerned, and for this I am sorry to have bothered you regarding it!!

Good night,
BigMike
Title: Re: Export Personal Messages to XML
Post by: mark7144 on February 05, 2008, 02:35:17 AM
Quote from: SleePy on February 04, 2008, 05:32:32 PM
In my mods I have put a xslt stylesheet in them.
Is this something you have added since our last conversation on this thread? I was the guy complaining that my users couldn't read the XML data properly because they are not competent enough in that area.
Title: Re: Export Personal Messages to XML
Post by: SleePy on February 05, 2008, 09:40:45 PM
the xslt stylesheets is only in the mod for manual mod installs, Daniel15 made those and I used them in my mods for hopefully easier manual installs without the need for package parser.

It may be possible that if there is enough pms that the memory gets to full and not all data is sent out. Do you know how many pms he had?

BigMike,
I am thinking the error then happened during the text being at the top as it wasn't working properly. The text at the top usually happens when search position of end is used and there is a return or space after the ?> in the file. This causes the package manager to think its just a plain text file instead of a php file and adds it to the true end.
Title: Re: Export Personal Messages to XML
Post by: BigMike on February 06, 2008, 10:56:41 AM
Quote from: SleePy on February 05, 2008, 09:40:45 PM
BigMike,
I am thinking the error then happened during the text being at the top as it wasn't working properly. The text at the top usually happens when search position of end is used and there is a return or space after the ?> in the file. This causes the package manager to think its just a plain text file instead of a php file and adds it to the true end.

That makes sense, thank you!
Title: Re: Export Personal Messages to XML
Post by: KD4FBI on June 21, 2008, 03:24:52 PM
How hard would it be to make the mod export the PMs to an RSS feed? It would have a link when you clicked export PMs that when you added it to an RSS aggregator would show the PMs as a feed.
That's what I was hoping the mod would do. Like Mark, my users wouldn't know what to do with the XML. I don't know what to do with the XML. :D
But, our users would know what to do with an RSS feed that they could put into a feed aggregator.
Otherwise, the mod looks great, just not what I can use at the moment.
When it comes to coding, I am SO lost!! Otherwise, I would try to code something to make it into an RSS feed.
A number of the users on my site are visually impaired. They use a screen reading system that has an RSS aggregator that they can add the URL for the feed to. Then the screen reader will read the links/feeds to them. Then, if they need to reply to that message, they can log in and reply to it.
Thanks,
Mickey
Title: Re: Export Personal Messages to XML
Post by: SleePy on June 21, 2008, 05:53:12 PM
How is the rss feed program expecting input?

Its in a xml format, so if it will accept that then it would work.
You could tweak it to output as an rss feed by simply changing the code in the source file for it.
Title: Re: Export Personal Messages to XML
Post by: DirtRider on September 04, 2008, 12:00:06 AM
This is great mod thanks. Would it be possible to have this so the exported data is better formatted? Or maybe even so it can be opened by Outlook.
Title: Re: Export Personal Messages to XML
Post by: SleePy on September 04, 2008, 03:59:42 PM
It is possible, I would need to know how outlook formats its files for importing or such.
Title: Re: Export Personal Messages to XML
Post by: kith on September 10, 2008, 07:56:52 AM
Once I install this on 2 Beta 4 what do I do to activate it?
Title: Re: Export Personal Messages to XML
Post by: SleePy on September 10, 2008, 05:56:44 PM
It is already activated. Some new links should appear in your Personal Messages section.
Title: Re: Export Personal Messages to XML
Post by: kith on September 10, 2008, 06:52:02 PM
Thanks, they didn't because my of my own coloured theme, something must have gone wrong, the save PM to html was the same, just didn't show.
I've remade the theme from scratch and it's all okay for the html mod.
This mod just produces a page of code in the same window when I choose either of the menu options, is this correct?
Title: Re: Export Personal Messages to XML
Post by: SleePy on September 10, 2008, 07:11:06 PM
Depends on which menu option you choose on which pms it saves. But it will save it in a XML formatted file. Which if I ever get the time to build a xslt style sheet one of these days, you coulds simply use that to make it look pretty. But its very handy for just storing files in a way that you could actually use if you wanted to to make a sript to reimport the pms.
Title: Re: Export Personal Messages to XML
Post by: dcmouser on February 13, 2011, 08:42:27 PM
Thank you SleePy for this excellent mod.
Title: Re: Export Personal Messages to XML
Post by: PPZ-01 on May 21, 2012, 08:30:19 PM
   Hello all,

   I have a problem regarding Export Personal Messages mod.I am using SMF 2.0.2, and after installation I am able to export just INBOX PM's, while on Personal Message page I have just option "Export ALL PM's", and not options to export just specific Inbox, or Outbox.However click on Export ALL is exporting just inbox folder, and nothing else.I am using customized Curve Theme.

   Any suggestions what could I be missing?
Title: Re: Export Personal Messages to XML
Post by: SleePy on May 28, 2012, 04:56:52 PM
Its possible this is a bug with the mod, looking at the code quickly it should function.  I don't have time nor am I actively maintaining this modification at this point and time though.
Title: Re: Export Personal Messages to XML
Post by: PPZ-01 on May 29, 2012, 01:14:47 AM
    Thank you for answer.Maybe I figure out some other way of saving PM's locally.
Title: Re: Export Personal Messages to XML
Post by: nax on December 29, 2012, 09:43:41 AM
I am no programmer but the only way I have found to make sense of the XML output file is to load it into Word (2007 and newer).  I then use the search and replace to take out the PHP/HTML strings I don't want most I replaced with null, but <br> I replaced with a single space.  You end up with a document that you can at least read, search and save.  This is a function that SMF really should have inbuilt.