aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/lib/filestore.php19
-rw-r--r--mod/file/upload.php2
2 files changed, 16 insertions, 5 deletions
diff --git a/engine/lib/filestore.php b/engine/lib/filestore.php
index 32b8a63ad..62de55b9e 100644
--- a/engine/lib/filestore.php
+++ b/engine/lib/filestore.php
@@ -333,7 +333,7 @@
*/
public function open($mode)
{
- if (!$this->title)
+ if (!$this->getFilename())
throw new IOException("You must specify a name before opening a file.");
// See if file has already been saved
@@ -616,6 +616,15 @@
return true;
}
+
+ /**
+ * Run once and only once.
+ */
+ function filestore_run_once()
+ {
+ // Register a class
+ add_subtype("object", "file", "ElggFile");
+ }
/**
* Initialise the file modules.
@@ -623,13 +632,13 @@
*/
function filestore_init()
{
- // Register a class
- add_subtype("object", "file", "ElggFile");
-
// Now register a default filestore
set_default_filestore(new ElggDiskFilestore($CONFIG->dataroot));
+
+ // Now run this stuff, but only once
+ run_function_once("filestore_run_once");
}
// Register a startup event
- register_event_handler('init','system','filestore_init',0);
+ register_event_handler('init','system','filestore_init',0);
?> \ No newline at end of file
diff --git a/mod/file/upload.php b/mod/file/upload.php
index d0e0a9901..51da6be3a 100644
--- a/mod/file/upload.php
+++ b/mod/file/upload.php
@@ -8,6 +8,8 @@
* @link http://elgg.com/
*/
+ gatekeeper();
+
// Render the file upload page
page_draw(elgg_echo("file:upload"), elgg_view("file/upload", NULL));
?> \ No newline at end of file