Permalink
Browse files

fixes #7 ability to forbid sizes download

Add $conf['download_by_size_follow_enabled_high'] = true; in your local config : if the use has no access to "high definition", he won't have the sizes download neither.
  • Loading branch information...
plegall committed Nov 24, 2017
1 parent a545371 commit d943a05f1bf0d74bf04ead610b98712660c90f04
Showing with 18 additions and 0 deletions.
  1. +8 −0 action.php
  2. +10 −0 main.inc.php
View
@@ -112,6 +112,14 @@ function do_error( $code, $str )
//---- specific download_by_size, start
if (isset($_GET['size']))
{
if ( !$user['enabled_high'])
{
if (isset($conf['download_by_size_follow_enabled_high']) and $conf['download_by_size_follow_enabled_high'])
{
do_error(401, 'Access denied');
}
}
if (!in_array($_GET['size'], array_keys(ImageStdParams::get_defined_type_map())))
{
die('Hacking attempt: unknown size');
View
@@ -26,6 +26,16 @@ function dlsize_picture()
{
return;
}
// if the user has not access to the original (hd), a config parameter can also
// forbid to download other sizes
if (empty($picture['current']['download_url']))
{
if (isset($conf['download_by_size_follow_enabled_high']) and $conf['download_by_size_follow_enabled_high'])
{
return;
}
}
$template->set_prefilter('picture', 'dlsize_picture_prefilter');

0 comments on commit d943a05

Please sign in to comment.