From 9f35703c6e30b86a91d88325df4dcba54acb74f1 Mon Sep 17 00:00:00 2001 From: icewing Date: Thu, 1 May 2008 12:12:26 +0000 Subject: Marcus Povey * Now registers ElggFile for 'object' & 'file' git-svn-id: https://code.elgg.org/elgg/trunk@589 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/filestore.php | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) (limited to 'engine/lib/filestore.php') diff --git a/engine/lib/filestore.php b/engine/lib/filestore.php index ef854c309..32b8a63ad 100644 --- a/engine/lib/filestore.php +++ b/engine/lib/filestore.php @@ -294,12 +294,30 @@ * * @param string $name The filename. */ - public function setFilename($name) { $this->title = $name; } + public function setFilename($name) { $this->filename = $name; } /** * Return the filename. */ - public function getFilename() { return $this->title; } + public function getFilename() { return $this->filename; } + + /** + * Get the mime type of the file. + */ + public function getMimeType() + { + if ($this->mimetype) + return $this->mimetype; + + // TODO : Guess mimetype if not here + } + + /** + * Set the mime type of the file. + * + * @param $mimetype The mimetype + */ + public function setMimeType($mimetype) { return $this->mimetype = $mimetype; } /** * Set the optional file description. @@ -599,7 +617,19 @@ return true; } + /** + * Initialise the file modules. + * Listens to system boot and registers any appropriate file types and classes + */ + function filestore_init() + { + // Register a class + add_subtype("object", "file", "ElggFile"); + + // Now register a default filestore + set_default_filestore(new ElggDiskFilestore($CONFIG->dataroot)); + } - // Now register a default filestore - set_default_filestore(new ElggDiskFilestore($CONFIG->dataroot)); + // Register a startup event + register_event_handler('init','system','filestore_init',0); ?> \ No newline at end of file -- cgit v1.2.3