Skip to content

Commit

Permalink
Fix issue with new sub albums not saving data caused by an extra chec…
Browse files Browse the repository at this point in the history
…k added for forgotten reasons… #1396
  • Loading branch information
acrylian committed Dec 15, 2023
1 parent bcaf824 commit 2777af6
Showing 1 changed file with 23 additions and 27 deletions.
50 changes: 23 additions & 27 deletions zp-core/classes/class-albumbase.php
Expand Up @@ -143,19 +143,17 @@ function getFolder() {
* @return object|null
*/
function getParent() {
if ($this->getParentID()) {
if (is_null($this->parentalbum)) {
$slashpos = strrpos($this->name, "/");
if ($slashpos) {
$parent = substr($this->name, 0, $slashpos);
$parentalbum = AlbumBase::newAlbum($parent, true, true);
if ($parentalbum->exists) {
return $this->parentalbum = $parentalbum;
}
if (is_null($this->parentalbum)) {
$slashpos = strrpos($this->name, "/");
if ($slashpos) {
$parent = substr($this->name, 0, $slashpos);
$parentalbum = AlbumBase::newAlbum($parent, true, true);
if ($parentalbum->exists) {
return $this->parentalbum = $parentalbum;
}
} else if ($this->parentalbum->exists) {
return $this->parentalbum;
}
} else if ($this->parentalbum->exists) {
return $this->parentalbum;
}
return NULL;
}
Expand All @@ -168,23 +166,21 @@ function getParent() {
* @return array|null
*/
function getParents() {
if ($this->getParentID()) {
if (is_null($this->parentalbums)) {
$albumarray = getAlbumArray($this->name, false);
if (count($albumarray) == 1) {
$parent = $this->getParent();
$this->urparentalbum = $parent;
return $this->parentalbums = array($parent);
}
$parents = array();
$album = $this;
while (!is_null($album = $album->getParent())) {
array_unshift($parents, $album);
}
return $this->parentalbums = $parents;
} else {
return $this->parentalbums;
if (is_null($this->parentalbums)) {
$albumarray = getAlbumArray($this->name, false);
if (count($albumarray) == 1) {
$parent = $this->getParent();
$this->urparentalbum = $parent;
return $this->parentalbums = array($parent);
}
$parents = array();
$album = $this;
while (!is_null($album = $album->getParent())) {
array_unshift($parents, $album);
}
return $this->parentalbums = $parents;
} else {
return $this->parentalbums;
}
return $this->parentalbums = array();
}
Expand Down

0 comments on commit 2777af6

Please sign in to comment.