aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authoricewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-05-01 12:12:26 +0000
committericewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-05-01 12:12:26 +0000
commit9f35703c6e30b86a91d88325df4dcba54acb74f1 (patch)
tree5ea58e0b20f1dd711d75884c9c7d88c5a4150d2a /engine
parentbd152e5fd0fd8972dcf8bd273d119f86fdb2295b (diff)
downloadelgg-9f35703c6e30b86a91d88325df4dcba54acb74f1.tar.gz
elgg-9f35703c6e30b86a91d88325df4dcba54acb74f1.tar.bz2
Marcus Povey <marcus@dushka.co.uk>
* Now registers ElggFile for 'object' & 'file' git-svn-id: https://code.elgg.org/elgg/trunk@589 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r--engine/lib/filestore.php38
1 files changed, 34 insertions, 4 deletions
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