Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function drupalwiki_privatefile_imagecache($preset,$prv_id) {
- if(is_numeric($prv_id)) {
- // Now actually check if we have access
- if(_drupalwiki_privatefile_access_api('view',$prv_id)) {
- $file = _drupalwiki_privatefile_load_file($prv_id);
- _imagecache_cache($preset, $file->orig_src);
- }
- else {
- return '';
- // well this url is not valid
- $accesspath = file_create_path('imagecache/'. $preset .'.403.png');
- if (is_file($accesspath)) {
- imagecache_transfer($accesspath);
- exit;
- }
- header('HTTP/1.0 403 Forbidden');
- exit;
- }
- }
- else {
- header('HTTP/1.0 404 Not found');
- exit;
- }
- }
- function drupalwiki_privatefile_imagecache_prefixpath_alter(&$path,$base,$filepath, $absolute) {
- $matches = array();
- if(preg_match("@privatefile/(\d)+@", $filepath, $matches)) {
- // override completely
- $path = 'privatefile';
- }
- // else this is no private file, dont change anything
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement