|
Revision 740, 2.0 kB
(checked in by ben, 2 years ago)
|
Fixed icon issue in files unit.
|
- Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
require_once(dirname(dirname(__FILE__))."/includes.php"); |
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
run("userdetails:init"); |
|---|
| 10 |
run("profile:init"); |
|---|
| 11 |
run("files:init"); |
|---|
| 12 |
|
|---|
| 13 |
global $CFG; |
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
$id = optional_param('id',0,PARAM_INT); |
|---|
| 17 |
if (!empty($id)) { |
|---|
| 18 |
|
|---|
| 19 |
if ($file = get_record('files','ident',$id)) { |
|---|
| 20 |
if ($file->access == 'PUBLIC' || run("users:access_level_check",$file->access) == true) { |
|---|
| 21 |
|
|---|
| 22 |
require_once($CFG->dirroot . 'lib/filelib.php'); |
|---|
| 23 |
require_once($CFG->dirroot . 'lib/iconslib.php'); |
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
@apache_setenv('no-gzip', '1'); |
|---|
| 27 |
|
|---|
| 28 |
if ($file->access == 'PUBLIC') { |
|---|
| 29 |
header("Pragma: public"); |
|---|
| 30 |
header("Cache-Control: public"); |
|---|
| 31 |
} else { |
|---|
| 32 |
|
|---|
| 33 |
// Also to override PHP's default "DON'T EVER CACHE THIS EVER" header |
|---|
| 34 |
header("Cache-Control: private"); |
|---|
| 35 |
} |
|---|
| 36 |
|
|---|
| 37 |
$mimetype = mimeinfo('type',$file->originalname); |
|---|
| 38 |
if ($mimetype == "image/jpeg" || $mimetype == "image/png" || $mimetype == "image/gif") { |
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
$phpthumbconfig['w'] = 90; |
|---|
| 42 |
|
|---|
| 43 |
$filelocation = file_cache($file); |
|---|
| 44 |
spit_phpthumb_image($filelocation, $phpthumbconfig); |
|---|
| 45 |
|
|---|
| 46 |
} else { |
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
header($_SERVER['SERVER_PROTOCOL'] . " 301 Moved Permanently"); |
|---|
| 50 |
header("Location: " . $CFG->wwwroot . '_files/file.png'); |
|---|
| 51 |
die(); |
|---|
| 52 |
|
|---|
| 53 |
} |
|---|
| 54 |
|
|---|
| 55 |
} |
|---|
| 56 |
} |
|---|
| 57 |
} |
|---|
| 58 |
|
|---|
| 59 |
?> |
|---|