Escape photo download title

This commit is contained in:
Tobias Reich 2014-08-30 19:18:09 +02:00
parent bef01d775d
commit 5d9e41d2ae

View File

@ -588,9 +588,18 @@ class Photo extends Module {
return false;
}
# Illicit chars
$badChars = array_merge(
array_map('chr', range(0,31)),
array("<", ">", ":", '"', "/", "\\", "|", "?", "*")
);
# Parse title
if ($photo->title=='') $photo->title = 'Untitled';
# Escape title
$zipTitle = str_replace($badChars, '', $zipTitle);
# Set headers
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"" . $photo->title . $extension . "\"");