MDL-23202 group icons now stored in file storage pool

This commit is contained in:
Petr Skoda
2010-07-11 13:07:24 +00:00
parent c7744f122d
commit e88dd87685
10 changed files with 145 additions and 63 deletions
+14 -4
View File
@@ -524,10 +524,7 @@ if ($component === 'blog') {
send_file_not_found();
}
if ($filearea === 'description' or $filearea === 'icon') {
//TODO: implement group image storage in file pool
if ($filearea === 'description') {
$filename = array_pop($args);
$filepath = $args ? '/'.implode('/', $args).'/' : '/';
if (!$file = $fs->get_file($context->id, 'group', 'description', $group->id, $filepath, $filename) or $file->is_directory()) {
@@ -537,6 +534,19 @@ if ($component === 'blog') {
session_get_instance()->write_close(); // unlock session during fileserving
send_stored_file($file, 60*60, 0, $forcedownload);
} else if ($filearea === 'icon') {
$filename = array_pop($args);
if ($filename !== 'f1' and $filename !== 'f2') {
send_file_not_found();
}
if (!$file = $fs->get_file($context->id, 'group', 'icon', $group->id, '/', $filename.'.jpg')) {
send_file_not_found();
}
session_get_instance()->write_close(); // unlock session during fileserving
send_stored_file($file, 60*60);
} else {
send_file_not_found();
}