Fixed a bug with problematic chars in album names when trying to download them
This commit is contained in:
parent
5b5e511cd1
commit
1ecc81c18f
@ -237,6 +237,12 @@ class Album extends Module {
|
|||||||
# Call plugins
|
# Call plugins
|
||||||
$this->plugins(__METHOD__, 0, func_get_args());
|
$this->plugins(__METHOD__, 0, func_get_args());
|
||||||
|
|
||||||
|
# Illicit chars
|
||||||
|
$badChars = array_merge(
|
||||||
|
array_map('chr', range(0,31)),
|
||||||
|
array("<", ">", ":", '"', "/", "\\", "|", "?", "*")
|
||||||
|
);
|
||||||
|
|
||||||
# Photos query
|
# Photos query
|
||||||
switch($this->albumIDs) {
|
switch($this->albumIDs) {
|
||||||
case 's':
|
case 's':
|
||||||
@ -255,6 +261,10 @@ class Album extends Module {
|
|||||||
# Set title
|
# Set title
|
||||||
$album = $this->database->query("SELECT title FROM lychee_albums WHERE id = '$this->albumIDs' LIMIT 1;");
|
$album = $this->database->query("SELECT title FROM lychee_albums WHERE id = '$this->albumIDs' LIMIT 1;");
|
||||||
if ($this->albumIDs!=0&&is_numeric($this->albumIDs)) $zipTitle = $album->fetch_object()->title;
|
if ($this->albumIDs!=0&&is_numeric($this->albumIDs)) $zipTitle = $album->fetch_object()->title;
|
||||||
|
|
||||||
|
# Parse title
|
||||||
|
$zipTitle = str_replace($badChars, '', $zipTitle);
|
||||||
|
|
||||||
$filename = LYCHEE_DATA . $zipTitle . '.zip';
|
$filename = LYCHEE_DATA . $zipTitle . '.zip';
|
||||||
|
|
||||||
# Create zip
|
# Create zip
|
||||||
@ -281,10 +291,6 @@ class Album extends Module {
|
|||||||
$photo->url = LYCHEE_UPLOADS_BIG . $photo->url;
|
$photo->url = LYCHEE_UPLOADS_BIG . $photo->url;
|
||||||
|
|
||||||
# Parse title
|
# Parse title
|
||||||
$badChars = array_merge(
|
|
||||||
array_map('chr', range(0,31)),
|
|
||||||
array("<", ">", ":", '"', "/", "\\", "|", "?", "*")
|
|
||||||
);
|
|
||||||
$photo->title = str_replace($badChars, '', $photo->title);
|
$photo->title = str_replace($badChars, '', $photo->title);
|
||||||
if (!isset($photo->title)||$photo->title==='') $photo->title = 'Untitled';
|
if (!isset($photo->title)||$photo->title==='') $photo->title = 'Untitled';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user