From 5b22fcea0eff97187eacd965a54d04d8c2568b6a Mon Sep 17 00:00:00 2001 From: rvelices Date: Sat, 2 Feb 2013 07:09:52 +0000 Subject: feature 2831: simple way to protect urls of originals git-svn-id: http://piwigo.org/svn/trunk@20516 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/functions_html.inc.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'include/functions_html.inc.php') diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php index 11f56d9f4..b29f214ef 100644 --- a/include/functions_html.inc.php +++ b/include/functions_html.inc.php @@ -593,4 +593,25 @@ function get_thumbnail_title($info, $title, $comment) return $title; } +/** optional event handler to protect src image urls */ +function get_src_image_url_protection_handler($url, $src_image) +{ + return get_action_url($src_image->id, $src_image->is_original() ? 'e' : 'r', false); +} + +/** optional event handler to protect element urls */ +function get_element_url_protection_handler($url, $infos) +{ + global $conf; + if ('images'==$conf['original_url_protection']) + {// protect only images and not other file types (for example large movies that we don't want to send through our file proxy) + $ext = get_extension($infos['path']); + if (!in_array($ext, $conf['picture_ext'])) + { + return $url; + } + } + return get_action_url($infos['id'], 'e', false); +} + ?> \ No newline at end of file -- cgit v1.2.3