This script implements the Phorum file storage API.
A "Phorum file" is a file which is used from within Phorum as a personal user file (which can be uploaded through the user's control center) or as a message attachment.
By default, the contents of a Phorum file are stored in the Phorum database, but this API does support modules that change this behavior (e.g. by storing file contents on a filesystem instead).
Function call flag, which tells phorum_api_file_retrieve() to force a download by the browser by sending an application/octet-stream Content-Type header. This flag will only have effect if the PHORUM_FLAG_SEND flag is set as well.
Function call flag, which tells phorum_api_file_retrieve() that the retrieved Phorum file data has to be returned to the caller.
Function call flag, which tells the function to skip any permission checks.
Function call flag, which tells phorum_api_file_retrieve() that the retrieved Phorum file can be sent to the browser directly.
Check if the active user has permission to delete a file.
Check if a file exists and if the active user has permission to read it.
The function will return either an array containing descriptive data for the file or FALSE, in case access was not granted.
Note that the file_data field is not available in the return array. That data can be retrieved by the phorum_api_file_retrieve() function.
Check if the active user has permissions to store a personal file or a message attachment.
Note that the checks for message attachments aren't all checks that are done by Phorum. The attachment posting script does run some additional checks on the message level (e.g. to see if the maximum cumulative attachment size is not exceeded).
Delete a Phorum file.
Check if a Phorum file exists.
(this is a simple wrapper function around the phorum_api_file_check_read_access() function)
Retrieve and return a Phorum file.
(this is a simple wrapper function around the phorum_api_file_retrieve() function)
Lookup the MIME type for a given filename.
This will use an internal lookup list of known file extensions to find the correct content type for a filename. If no content type is known, then "application/octet-stream" will be used as the MIME type (causing the browser to download the file, instead of opening it).
Retrieve a list of files.
This function is used for purging stale files from the Phorum system.
Retrieve a Phorum file.
This function can handle Phorum file retrieval in multiple ways: either return the file to the caller or send it directly to the user's browser (based on the $flags parameter). Sending it directly to the browser allows for the implementation of modules that don't have to buffer the full file data before sending it (a.k.a. streaming, which provides the advantage of using less memory for sending files).
Send a file to the browser.
(this is a simple wrapper function around the phorum_api_file_retrieve() function)
Store or update a file.
An array, containing information for the file. This array has to contain the following fields:
Additionally, the "file_id" field can be set. If it is set, then the existing file will be updated. If it is not set, a new file will be created.
Documentation generated on Sun, 10 May 2009 01:45:53 -0500 by phpDocumentor 1.4.1