Functions

genXML

Recursively generates an XML tree from an array.

If objects are found, call addToXML() methods which should serialize the object as a child of the XML tree passed as parameter.
« More »

genSave

Generates the XML save tree from the session.

« More »

genFilename

Generates the save file name using current date/time.

The date function will use the server's timezone which could be inconsistent with the client timezone.
« More »

saveGame

Save the XML save tree as an XML file named after the results of genFilename in SAVEDIR.

Fails and send an error the the client if permissions are incorrectly set. Watch for errors in PHP log.
« More »

downSave

Sends the current game or a specific save file given by the filename GET parameter to the client.

« More »

listSaves

Sends the list of available saves to the client.

Warning: this function changes directory.
« More »

parseSave

Reads an XML tree and deserializes it to an array.

« More »

deleteSave

Deletes a save file given as the filename POST parameter.

« More »

loadSave

Loads a save file given as the filename POST parameter to the session.

Empties the session beforehand.
« More »

uploadSave

Reads a save file sent by the client.

Parse the received file then generate it again to clean it for any unwanted and make sure that it is a valid XML save file. XML errors are simply ignored and an error is sent to the client if something wrong happens.
« More »

Constants

SAVEDIR

Directory to save to and load from.

The PHP/Apache user must have write permission on this directory. Use the following commands to give write permissions to the http group: <samp> sudo chown :http data/save sudo chmod g+w data/save </samp>
« More »