aboutsummaryrefslogtreecommitdiff
path: root/mod/file
diff options
context:
space:
mode:
authorcash <cash.costello@gmail.com>2011-06-24 13:42:07 -0400
committercash <cash.costello@gmail.com>2011-06-24 13:42:07 -0400
commit3c2f72753335a5ca793cf8250c4233d04689e5d2 (patch)
tree43fb542574f791bc47546e65e24f858c3eec0698 /mod/file
parent42e02f03c306717002aac0d36f0e2b48bf369fed (diff)
parentd701c3bdf59e2d326c27dd0567323e09a65c00f2 (diff)
downloadelgg-3c2f72753335a5ca793cf8250c4233d04689e5d2.tar.gz
elgg-3c2f72753335a5ca793cf8250c4233d04689e5d2.tar.bz2
Merge branch 'master' of github.com:Elgg/Elgg
Diffstat (limited to 'mod/file')
-rw-r--r--mod/file/actions/file/upload.php3
-rw-r--r--mod/file/download.php9
-rw-r--r--mod/file/languages/en.php4
-rw-r--r--mod/file/views/default/river/object/file/create.php30
4 files changed, 12 insertions, 34 deletions
diff --git a/mod/file/actions/file/upload.php b/mod/file/actions/file/upload.php
index 5d5c28bee..c5fe763cb 100644
--- a/mod/file/actions/file/upload.php
+++ b/mod/file/actions/file/upload.php
@@ -106,9 +106,10 @@ if (isset($_FILES['upload']['name']) && !empty($_FILES['upload']['name'])) {
$file->originalfilename = $_FILES['upload']['name'];
$file->simpletype = file_get_simple_type($_FILES['upload']['type']);
+ // Open the file to guarantee the directory exists
$file->open("write");
- $file->write(get_uploaded_file('upload'));
$file->close();
+ move_uploaded_file($_FILES['upload']['tmp_name'], $file->getFilenameOnFilestore());
$guid = $file->save();
diff --git a/mod/file/download.php b/mod/file/download.php
index a386d490f..8e0287a1e 100644
--- a/mod/file/download.php
+++ b/mod/file/download.php
@@ -33,8 +33,7 @@ if (strpos($mime, "image/") !== false) {
header("Content-Disposition: attachment; filename=\"$filename\"");
}
-$contents = $file->grabFile();
-$splitString = str_split($contents, 8192);
-foreach ($splitString as $chunk) {
- echo $chunk;
-}
+ob_clean();
+flush();
+readfile($file->getFilenameOnFilestore());
+exit;
diff --git a/mod/file/languages/en.php b/mod/file/languages/en.php
index 7ced3f112..1db32afcb 100644
--- a/mod/file/languages/en.php
+++ b/mod/file/languages/en.php
@@ -73,8 +73,8 @@ $english = array(
'file:display:number' => "Number of files to display",
- 'file:river:create' => 'uploaded the file',
- 'river:commented:object:file' => 'the file',
+ 'river:create:object:file' => '%s uploaded the file %s',
+ 'river:comment:object:file' => '%s commented on the file %s',
'item:object:file' => 'Files',
diff --git a/mod/file/views/default/river/object/file/create.php b/mod/file/views/default/river/object/file/create.php
index 620d1d18c..dad629120 100644
--- a/mod/file/views/default/river/object/file/create.php
+++ b/mod/file/views/default/river/object/file/create.php
@@ -7,29 +7,7 @@ $object = $vars['item']->getObjectEntity();
$excerpt = strip_tags($object->description);
$excerpt = elgg_get_excerpt($excerpt);
-$params = array(
- 'href' => $object->getURL(),
- 'text' => $object->title,
-);
-$link = elgg_view('output/url', $params);
-
-$group_string = '';
-$container = $object->getContainerEntity();
-if ($container instanceof ElggGroup) {
- $params = array(
- 'href' => $container->getURL(),
- 'text' => $container->name,
- );
- $group_link = elgg_view('output/url', $params);
- $group_string = elgg_echo('river:ingroup', array($group_link));
-}
-
-echo elgg_echo('file:river:create');
-
-echo " $link $group_string";
-
-if ($excerpt) {
- echo '<div class="elgg-river-content">';
- echo $excerpt;
- echo '</div>';
-}
+echo elgg_view('river/item', array(
+ 'item' => $vars['item'],
+ 'message' => $excerpt,
+)); \ No newline at end of file