"/" in the uri must never be urlencoded, it breaks opening files completely.

also remove some code repetition.
This commit is contained in:
Piotr KUCHARSKI 2014-11-22 23:53:35 +01:00
parent 9d70a14d07
commit 652eaac128

View file

@ -289,40 +289,26 @@ $dirs = array();
if (is_file($currentdir.'/'.$file.'.html')) { if (is_file($currentdir.'/'.$file.'.html')) {
$img_captions[$file] = $file.'::'.htmlspecialchars(file_get_contents($currentdir.'/'.$file.'.html'),ENT_QUOTES); $img_captions[$file] = $file.'::'.htmlspecialchars(file_get_contents($currentdir.'/'.$file.'.html'),ENT_QUOTES);
} }
$linkUrl = rawurlencode("$currentdir/$file");
$imgParams = http_build_query(
array(
'filename' => "$thumbdir/$file",
'size' => $thumb_size
),
'',
'&'
);
$imgUrl = GALLERY_ROOT . "createthumb.php?$imgParams";
if ($lazyload) { if ($lazyload) {
$linkUrl = urlencode("$currentdir/$file"); $imgopts = "class=\"b-lazy\" src=data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== data-src=\"$imgUrl\"";
$imgParams = http_build_query(
array(
'filename' => "$thumbdir/$file",
'size' => $thumb_size
),
'',
'&'
);
$imgUrl = GALLERY_ROOT . "createthumb.php?$imgParams";
$files[] = array (
"name" => $file,
"date" => filemtime($currentdir . "/" . $file),
"size" => filesize($currentdir . "/" . $file),
"html" => "<li><a href={$linkUrl} rel='lightbox[billeder]' title=\"".htmlentities($img_captions[$file])."\"><img class=\"b-lazy\" src=data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== data-src=\"$imgUrl\" alt='$label_loading' /></a>" . $filename_caption . "</li>");
} else { } else {
$linkUrl = urlencode("$currentdir/$file"); $imgopts = "src=\"{$imgUrl}\"";
$imgParams = http_build_query( }
array(
'filename' => "$thumbdir/$file",
'size' => $thumb_size
),
'',
'&amp;'
);
$imgUrl = GALLERY_ROOT . "createthumb.php?$imgParams";
$files[] = array ( $files[] = array (
"name" => $file, "name" => $file,
"date" => filemtime($currentdir . "/" . $file), "date" => filemtime($currentdir . "/" . $file),
"size" => filesize($currentdir . "/" . $file), "size" => filesize($currentdir . "/" . $file),
"html" => "<li><a href=\"{$linkUrl}\" rel='lightbox[billeder]' title=\"".htmlentities($img_captions[$file])."\"><img src=\"{$imgUrl}\" alt='$label_loading' /></a>" . $filename_caption . "</li>"); } "html" => "<li><a href=\"{$linkUrl}\" rel='lightbox[billeder]' title=\"".htmlentities($img_captions[$file])."\"><img $imgopts alt='$label_loading' /></a>" . $filename_caption . "</li>");
} }
// Other filetypes // Other filetypes
$extension = ""; $extension = "";