Changeset 20516
- Timestamp:
- Feb 2, 2013, 8:09:52 AM (11 years ago)
- Location:
- trunk/include
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/common.inc.php
r19703 r20516 267 267 add_event_handler('render_tag_url', 'str2url'); 268 268 add_event_handler('blockmanager_register_blocks', 'register_default_menubar_blocks', EVENT_HANDLER_PRIORITY_NEUTRAL-1); 269 if ( !empty($conf['original_url_protection']) ) 270 { 271 add_event_handler('get_element_url', 'get_element_url_protection_handler', EVENT_HANDLER_PRIORITY_NEUTRAL, 2 ); 272 add_event_handler('get_src_image_url', 'get_src_image_url_protection_handler', EVENT_HANDLER_PRIORITY_NEUTRAL, 2 ); 273 } 269 274 trigger_action('init'); 270 275 ?> -
trunk/include/config_default.inc.php
r20449 r20516 778 778 //Maximum Ajax requests at once, for thumbnails on-the-fly generation 779 779 $conf['max_requests']=3; 780 781 // one of '', 'images', 'all' 782 //TODO: Put this in admin and also manage .htaccess in #sites and upload folders 783 $conf['original_url_protection'] = ''; 780 784 ?> -
trunk/include/derivative.inc.php
r19878 r20516 20 20 // +-----------------------------------------------------------------------+ 21 21 22 /*A source image is used to get a derivative image. A source image is either the original file for a jpg or a 22 /*A source image is used to get a derivative image. A source image is either the original file for a jpg or a 23 23 'representative' image of a non image file or a standard icon for the non-image file.*/ 24 24 final class SrcImage … … 79 79 $height = $infos['width']; 80 80 } 81 81 82 82 $this->size = array($width, $height); 83 83 } … … 107 107 { 108 108 $url = get_root_url().$this->rel_path; 109 if ( $this->flags & self::IS_ORIGINAL)109 if ( !($this->flags & self::IS_MIMETYPE) ) 110 110 { 111 111 $url = trigger_event('get_src_image_url', $url, $this); … … 171 171 } 172 172 173 /** 173 /** 174 174 @return derivative image url 175 175 @param type string of standard derivative param type (e.g. IMG_???) or a DerivativeParams object -
trunk/include/functions_html.inc.php
r19703 r20516 594 594 } 595 595 596 /** optional event handler to protect src image urls */ 597 function get_src_image_url_protection_handler($url, $src_image) 598 { 599 return get_action_url($src_image->id, $src_image->is_original() ? 'e' : 'r', false); 600 } 601 602 /** optional event handler to protect element urls */ 603 function get_element_url_protection_handler($url, $infos) 604 { 605 global $conf; 606 if ('images'==$conf['original_url_protection']) 607 {// protect only images and not other file types (for example large movies that we don't want to send through our file proxy) 608 $ext = get_extension($infos['path']); 609 if (!in_array($ext, $conf['picture_ext'])) 610 { 611 return $url; 612 } 613 } 614 return get_action_url($infos['id'], 'e', false); 615 } 616 596 617 ?>
Note: See TracChangeset
for help on using the changeset viewer.