aboutsummaryrefslogtreecommitdiff
path: root/mod/file
diff options
context:
space:
mode:
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.php9
-rw-r--r--mod/file/pages/file/friends.php2
-rw-r--r--mod/file/pages/file/owner.php5
-rw-r--r--mod/file/pages/file/view.php10
-rw-r--r--mod/file/views/default/file/group_module.php22
-rw-r--r--mod/file/views/default/file/typecloud.php2
-rw-r--r--mod/file/views/default/forms/file/upload.php4
-rw-r--r--mod/file/views/default/object/file.php10
-rw-r--r--mod/file/views/default/river/object/file/create.php30
11 files changed, 40 insertions, 66 deletions
diff --git a/mod/file/actions/file/upload.php b/mod/file/actions/file/upload.php
index b17fb6298..88a01745d 100644
--- a/mod/file/actions/file/upload.php
+++ b/mod/file/actions/file/upload.php
@@ -95,9 +95,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..72b198d54 100644
--- a/mod/file/languages/en.php
+++ b/mod/file/languages/en.php
@@ -11,11 +11,8 @@ $english = array(
* Menu items and titles
*/
'file' => "Files",
- 'files' => "My Files",
- 'file:yours' => "Your files",
- 'file:yours:friends' => "Your friends' files",
'file:user' => "%s's files",
- 'file:friends' => "%s's friends' files",
+ 'file:friends' => "Friends' files",
'file:all' => "All site files",
'file:edit' => "Edit file",
'file:more' => "More files",
@@ -73,8 +70,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/pages/file/friends.php b/mod/file/pages/file/friends.php
index 65fc66f62..fc23e1d1e 100644
--- a/mod/file/pages/file/friends.php
+++ b/mod/file/pages/file/friends.php
@@ -12,7 +12,7 @@ elgg_push_breadcrumb($owner->name, "file/owner/$owner->username");
elgg_push_breadcrumb(elgg_echo('friends'));
-$title = elgg_echo("file:friends", array($owner->name));
+$title = elgg_echo("file:friends");
// offset is grabbed in list_user_friends_objects
$content = list_user_friends_objects($owner->guid, 'file', 10, false);
diff --git a/mod/file/pages/file/owner.php b/mod/file/pages/file/owner.php
index 69ec30425..a01e9cd22 100644
--- a/mod/file/pages/file/owner.php
+++ b/mod/file/pages/file/owner.php
@@ -17,20 +17,19 @@ $params = array();
if ($owner->guid == elgg_get_logged_in_user_guid()) {
// user looking at own files
- $title = elgg_echo('file:yours');
$params['filter_context'] = 'mine';
} else if (elgg_instanceof($owner, 'user')) {
// someone else's files
- $title = elgg_echo("file:user", array($owner->name));
// do not show button or select a tab when viewing someone else's posts
$params['filter_context'] = 'none';
$params['buttons'] = '';
} else {
// group files
- $title = elgg_echo("file:user", array($owner->name));
$params['filter'] = '';
}
+$title = elgg_echo("file:user", array($owner->name));
+
// List files
$content = elgg_list_entities(array(
'types' => 'object',
diff --git a/mod/file/pages/file/view.php b/mod/file/pages/file/view.php
index daa2a400e..4b395d20d 100644
--- a/mod/file/pages/file/view.php
+++ b/mod/file/pages/file/view.php
@@ -22,14 +22,20 @@ $title = $file->title;
elgg_push_breadcrumb($title);
-$content = elgg_view_entity($file, true);
+$content = elgg_view_entity($file, array('full_view' => true));
$content .= elgg_view_comments($file);
+$download = elgg_view('output/url', array(
+ 'href' => "mod/file/download.php?file_guid=$file->guid",
+ 'text' => elgg_echo("file:download"),
+ 'class' => 'elgg-button elgg-button-action float-alt',
+));
+
$body = elgg_view_layout('content', array(
'content' => $content,
'title' => $title,
'filter' => '',
- 'header' => '',
+ 'buttons' => $download,
));
echo elgg_view_page($title, $body);
diff --git a/mod/file/views/default/file/group_module.php b/mod/file/views/default/file/group_module.php
index 830b1096c..c37b13927 100644
--- a/mod/file/views/default/file/group_module.php
+++ b/mod/file/views/default/file/group_module.php
@@ -14,10 +14,6 @@ $all_link = elgg_view('output/url', array(
'text' => elgg_echo('link:view:all'),
));
-$header = "<span class=\"groups-widget-viewall\">$all_link</span>";
-$header .= '<h3>' . elgg_echo('file:group') . '</h3>';
-
-
elgg_push_context('widgets');
$options = array(
'type' => 'object',
@@ -34,12 +30,14 @@ if (!$content) {
$content = '<p>' . elgg_echo('file:none') . '</p>';
}
-if ($group->canWriteToContainer()) {
- $new_link = elgg_view('output/url', array(
- 'href' => "file/add/$group->guid",
- 'text' => elgg_echo('file:add'),
- ));
- $content .= "<span class='elgg-widget-more'>$new_link</span>";
-}
+$new_link = elgg_view('output/url', array(
+ 'href' => "file/add/$group->guid",
+ 'text' => elgg_echo('file:add'),
+));
-echo elgg_view_module('info', '', $content, array('header' => $header));
+echo elgg_view('groups/profile/module', array(
+ 'title' => elgg_echo('file:group'),
+ 'content' => $content,
+ 'all_link' => $all_link,
+ 'add_link' => $new_link,
+));
diff --git a/mod/file/views/default/file/typecloud.php b/mod/file/views/default/file/typecloud.php
index ce4d6c127..4253bf674 100644
--- a/mod/file/views/default/file/typecloud.php
+++ b/mod/file/views/default/file/typecloud.php
@@ -15,7 +15,7 @@ function file_type_cloud_get_url($type, $friends) {
}
if ($type->tag == "image") {
- $url .= "&listtype=gallery";
+ $url .= "&list_type=gallery";
}
if (elgg_get_page_owner_guid()) {
diff --git a/mod/file/views/default/forms/file/upload.php b/mod/file/views/default/forms/file/upload.php
index da764c3d8..98b7d9f05 100644
--- a/mod/file/views/default/forms/file/upload.php
+++ b/mod/file/views/default/forms/file/upload.php
@@ -18,8 +18,10 @@ $guid = elgg_extract('guid', $vars, null);
if ($guid) {
$file_label = elgg_echo("file:replace");
+ $submit_label = elgg_echo('save');
} else {
$file_label = elgg_echo("file:file");
+ $submit_label = elgg_echo('upload');
}
?>
@@ -60,7 +62,7 @@ if ($guid) {
echo elgg_view('input/hidden', array('name' => 'file_guid', 'value' => $guid));
}
-echo elgg_view('input/submit', array('value' => elgg_echo("save")));
+echo elgg_view('input/submit', array('value' => $submit_label));
?>
</div>
diff --git a/mod/file/views/default/object/file.php b/mod/file/views/default/object/file.php
index 93a21c8e6..95e190d35 100644
--- a/mod/file/views/default/object/file.php
+++ b/mod/file/views/default/object/file.php
@@ -67,12 +67,6 @@ if ($full && !elgg_in_context('gallery')) {
$extra = elgg_view("file/specialcontent/$base_type/default", $vars);
}
- $download = elgg_view('output/url', array(
- 'href' => "mod/file/download.php?file_guid=$file->guid",
- 'text' => elgg_echo("file:download"),
- 'class' => 'elgg-button elgg-button-action',
- ));
-
$header = elgg_view_title($file->title);
$params = array(
@@ -82,17 +76,16 @@ if ($full && !elgg_in_context('gallery')) {
'subtitle' => $subtitle,
'tags' => $tags,
);
+ $params = $params + $vars;
$list_body = elgg_view('object/elements/summary', $params);
$file_info = elgg_view_image_block($file_icon, $list_body);
echo <<<HTML
-$header
$file_info
<div class="file elgg-content">
$body
$extra
- <p>$download</p>
</div>
HTML;
@@ -112,6 +105,7 @@ HTML;
'tags' => $tags,
'content' => $excerpt,
);
+ $params = $params + $vars;
$list_body = elgg_view('object/elements/summary', $params);
echo elgg_view_image_block($file_icon, $list_body);
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