views:

38

answers:

2

Since there are some major privacy issues with alot of social networking sites I am trying to think about alternatives. One is to let the user keep all the information stored in some kind of file container. Now, I haven't found a single type of container that can hold "generic" information. Only for audio/video. What I want is a container that can be read by PHP with some kind of index file that lists up the users pictures in a image/ directory in the container, FOAF files (or some alternative XML-file describing users information and friends, etc.).

My thoughts was to let the user keep all their information and data stored in a container that can be imported/exported and deleted from my server (the prototype social networking site I am trying to create), and then uploaded to another site that might use the same format (not that I think that will ever happen, but the user still keeps all their pictures, data, comments, messages, etc).

The only thing I have come up with yet is to create a tar archive with the Archive_tar library which extracts and creates Tar-archives with an index-file describing which files are holding the messages (there might be several so each file won't be so large), what pictures are in the image/ folder and what are their names and what comments they have gotten etc. Maybe also the permissions for viewing each type of content.

Does there exist any generic file format of a container that I can use to keep all this information in one file with a tree-like index file? Or must i try and create something like this myself?

A: 

Does there exist any generic file format of a container that I can use to keep all this information

No - and for good reason. You'd need very sophisticated locking semantics (which are very difficult to implement). Even with this perofrmance would be appalling - you are proposing writing your own filesystem in PHP? While, for example, Microsoft's OLE is a filesystem embedded into a single file - they are very selective about how they use this.

Start thinking 'directory' instead of 'file' and the solution will become clear, however I completely fail to see what relevance this has to the privacy problems of social networking sites let alone solving them.

C.

symcbean
No, I am not writing the archive method in PHP, I would write it in C or equivalent, but I would want to use it in PHP, to read the contents. I have consider using tar archive, but I would like to have a PHP script that reads the header before untaring.The best solution would be to have an already-existing format, and I can't get any closer than XML or tar.
bleakgadfly
+1  A: 

Do what the OpenDocumentFormat (ODF) does: produce a XML file with URIs (either local, eg. file:// or remote) pointing to other files. Give a common name to the XML file (root.xml or similar). Zip it all up and change the extension.

Zip is common everywhere - even Windows can open them natively - which makes it nice if the user wants to extract the pictures/movies/etc without having to download an extra tool.

André Paramés