aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/filestore.php
diff options
context:
space:
mode:
authorkevin <kevin@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-05-27 08:37:00 +0000
committerkevin <kevin@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-05-27 08:37:00 +0000
commit83532903cc5e63d0f47e63a2169ce4e58bccb928 (patch)
tree9d467132cc6ba0ef31abe190171e1b60ab814d8b /engine/lib/filestore.php
parent96031d570093d321dab15d5a7ceec899af0fa7e5 (diff)
downloadelgg-83532903cc5e63d0f47e63a2169ce4e58bccb928.tar.gz
elgg-83532903cc5e63d0f47e63a2169ce4e58bccb928.tar.bz2
Removed plugin-specific references from file_display_thumbnail and file_add_to_folders.
git-svn-id: https://code.elgg.org/elgg/trunk@3302 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/filestore.php')
-rw-r--r--engine/lib/filestore.php80
1 files changed, 28 insertions, 52 deletions
diff --git a/engine/lib/filestore.php b/engine/lib/filestore.php
index 49d376d2a..9031a964f 100644
--- a/engine/lib/filestore.php
+++ b/engine/lib/filestore.php
@@ -1076,37 +1076,21 @@
function file_add_to_folders($folder,$container_guid,$plugin) {
if ($container_guid && ($container = get_entity($container_guid))) {
- if ($plugin == 'photo') {
- $folders = $container->elgg_file_albums;
- } else {
- $folders = $container->elgg_file_folders;
- }
+ $folder_field_name = 'elgg_'.$plugin.'_folders';
+ $folders = $container->$folder_field_name;
if ($folders) {
if (is_array($folders)) {
if (!in_array($folder,$folders)) {
$folders[] = $folder;
- if ($plugin == 'photo') {
- $container->elgg_file_albums = $folders;
- } else {
- $container->elgg_file_folders = $folders;
- }
+ $container->$folder_field_name = $folders;
}
} else {
if ($folders != $folder) {
- if ($plugin == 'photo') {
- $container->elgg_file_albums = array($folders,$folder);
- } else {
- $container->elgg_file_folders = array($folders,$folder);
- }
+ $container->$folder_field_name = array($folders,$folder);
}
}
- } else {
-
- if ($plugin == 'photo') {
- $container->elgg_file_albums = $folder;
- } else {
- $container->elgg_file_folders = $folder;
- }
+ } else {
+ $container->$folder_field_name = $folder;
}
}
}
@@ -1234,39 +1218,31 @@
}
function file_display_thumbnail($file_guid,$size) {
- // Get file entity
- if ($file = get_entity($file_guid)) {
- $subtype = $file->getSubtype();
- if (($subtype == "file") || ($subtype = "photo")) {
+ // Get file entity
+ if ($file = get_entity($file_guid)) {
+ $simpletype = $file->simpletype;
+ if ($simpletype == "image") {
+ // Get file thumbnail
+ if ($size == "small") {
+ $thumbfile = $file->smallthumb;
+ } else {
+ $thumbfile = $file->largethumb;
+ }
- $simpletype = $file->simpletype;
- if ($simpletype == "image") {
+ // Grab the file
+ if ($thumbfile && !empty($thumbfile)) {
+ $readfile = new ElggFile();
+ $readfile->owner_guid = $file->owner_guid;
+ $readfile->setFilename($thumbfile);
+ $mime = $file->getMimeType();
+ $contents = $readfile->grabFile();
- // Get file thumbnail
- if ($size == "small") {
- $thumbfile = $file->smallthumb;
- } else {
- $thumbfile = $file->largethumb;
- }
-
- // Grab the file
- if ($thumbfile && !empty($thumbfile)) {
- $readfile = new ElggFile();
- $readfile->owner_guid = $file->owner_guid;
- $readfile->setFilename($thumbfile);
- $mime = $file->getMimeType();
- $contents = $readfile->grabFile();
-
- header("Content-type: $mime");
- echo $contents;
- exit;
-
- }
+ header("Content-type: $mime");
+ echo $contents;
+ exit;
- }
-
- }
-
+ }
+ }
}
}