|
@@ -154,8 +154,15 @@ class Album extends Module {
|
|
# Call plugins
|
|
# Call plugins
|
|
$this->plugins(__METHOD__, 0, func_get_args());
|
|
$this->plugins(__METHOD__, 0, func_get_args());
|
|
|
|
|
|
|
|
+ # Initialize return var
|
|
|
|
+ $return = array(
|
|
|
|
+ 'smartalbums' => null,
|
|
|
|
+ 'albums' => null,
|
|
|
|
+ 'num' => 0
|
|
|
|
+ );
|
|
|
|
+
|
|
# Get SmartAlbums
|
|
# Get SmartAlbums
|
|
- if ($public===false) $return = $this->getSmartInfo();
|
|
|
|
|
|
+ if ($public===false) $return['smartalbums'] = $this->getSmartInfo();
|
|
|
|
|
|
# Albums query
|
|
# Albums query
|
|
$query = Database::prepare($this->database, 'SELECT id, title, public, sysstamp, password FROM ? WHERE public = 1 AND visible <> 0', array(LYCHEE_TABLE_ALBUMS));
|
|
$query = Database::prepare($this->database, 'SELECT id, title, public, sysstamp, password FROM ? WHERE public = 1 AND visible <> 0', array(LYCHEE_TABLE_ALBUMS));
|
|
@@ -192,7 +199,7 @@ class Album extends Module {
|
|
}
|
|
}
|
|
|
|
|
|
# Add to return
|
|
# Add to return
|
|
- $return['content'][$album['id']] = $album;
|
|
|
|
|
|
+ $return['albums'][$album['id']] = $album;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -211,41 +218,49 @@ class Album extends Module {
|
|
# Check dependencies
|
|
# Check dependencies
|
|
self::dependencies(isset($this->database, $this->settings));
|
|
self::dependencies(isset($this->database, $this->settings));
|
|
|
|
|
|
|
|
+ # Initialize return var
|
|
|
|
+ $return = array(
|
|
|
|
+ 'unsorted' => null,
|
|
|
|
+ 'public' => null,
|
|
|
|
+ 'starred' => null,
|
|
|
|
+ 'recent' => null
|
|
|
|
+ );
|
|
|
|
+
|
|
# Unsorted
|
|
# Unsorted
|
|
$query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE album = 0 ' . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
|
|
$query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE album = 0 ' . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
|
|
$unsorted = $this->database->query($query);
|
|
$unsorted = $this->database->query($query);
|
|
$i = 0;
|
|
$i = 0;
|
|
while($row = $unsorted->fetch_object()) {
|
|
while($row = $unsorted->fetch_object()) {
|
|
if ($i<3) {
|
|
if ($i<3) {
|
|
- $return["unsortedThumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row->thumbUrl;
|
|
|
|
|
|
+ $return['unsorted']["thumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row->thumbUrl;
|
|
$i++;
|
|
$i++;
|
|
} else break;
|
|
} else break;
|
|
}
|
|
}
|
|
- $return['unsortedNum'] = $unsorted->num_rows;
|
|
|
|
|
|
+ $return['unsorted']['num'] = $unsorted->num_rows;
|
|
|
|
|
|
- # Public
|
|
|
|
- $query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE public = 1 ' . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
|
|
|
|
- $public = $this->database->query($query);
|
|
|
|
|
|
+ # Starred
|
|
|
|
+ $query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE star = 1 ' . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
|
|
|
|
+ $starred = $this->database->query($query);
|
|
$i = 0;
|
|
$i = 0;
|
|
- while($row2 = $public->fetch_object()) {
|
|
|
|
|
|
+ while($row3 = $starred->fetch_object()) {
|
|
if ($i<3) {
|
|
if ($i<3) {
|
|
- $return["publicThumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row2->thumbUrl;
|
|
|
|
|
|
+ $return['starred']["thumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row3->thumbUrl;
|
|
$i++;
|
|
$i++;
|
|
} else break;
|
|
} else break;
|
|
}
|
|
}
|
|
- $return['publicNum'] = $public->num_rows;
|
|
|
|
|
|
+ $return['starred']['num'] = $starred->num_rows;
|
|
|
|
|
|
- # Starred
|
|
|
|
- $query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE star = 1 ' . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
|
|
|
|
- $starred = $this->database->query($query);
|
|
|
|
|
|
+ # Public
|
|
|
|
+ $query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE public = 1 ' . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
|
|
|
|
+ $public = $this->database->query($query);
|
|
$i = 0;
|
|
$i = 0;
|
|
- while($row3 = $starred->fetch_object()) {
|
|
|
|
|
|
+ while($row2 = $public->fetch_object()) {
|
|
if ($i<3) {
|
|
if ($i<3) {
|
|
- $return["starredThumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row3->thumbUrl;
|
|
|
|
|
|
+ $return['public']["thumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row2->thumbUrl;
|
|
$i++;
|
|
$i++;
|
|
} else break;
|
|
} else break;
|
|
}
|
|
}
|
|
- $return['starredNum'] = $starred->num_rows;
|
|
|
|
|
|
+ $return['public']['num'] = $public->num_rows;
|
|
|
|
|
|
# Recent
|
|
# Recent
|
|
$query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE LEFT(id, 10) >= unix_timestamp(DATE_SUB(NOW(), INTERVAL 1 DAY)) ' . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
|
|
$query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE LEFT(id, 10) >= unix_timestamp(DATE_SUB(NOW(), INTERVAL 1 DAY)) ' . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
|
|
@@ -253,11 +268,11 @@ class Album extends Module {
|
|
$i = 0;
|
|
$i = 0;
|
|
while($row3 = $recent->fetch_object()) {
|
|
while($row3 = $recent->fetch_object()) {
|
|
if ($i<3) {
|
|
if ($i<3) {
|
|
- $return["recentThumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row3->thumbUrl;
|
|
|
|
|
|
+ $return['recent']["thumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row3->thumbUrl;
|
|
$i++;
|
|
$i++;
|
|
} else break;
|
|
} else break;
|
|
}
|
|
}
|
|
- $return['recentNum'] = $recent->num_rows;
|
|
|
|
|
|
+ $return['recent']['num'] = $recent->num_rows;
|
|
|
|
|
|
return $return;
|
|
return $return;
|
|
|
|
|