Code improvements

This commit is contained in:
Tobias Reich 2014-04-02 17:36:50 +02:00
parent 48e7e0a911
commit 3bb5511f81

View File

@ -38,15 +38,16 @@ function getAlbums($public) {
while ($row = $result->fetch_object()) { while ($row = $result->fetch_object()) {
$album = array();
// Info // Info
$return['content'][$row->id]['id'] = $row->id; $album['id'] = $row->id;
$return['content'][$row->id]['title'] = $row->title; $album['title'] = $row->title;
$return['content'][$row->id]['public'] = $row->public; $album['public'] = $row->public;
$return['content'][$row->id]['sysdate'] = date('F Y', strtotime($row->sysdate)); $album['sysdate'] = date('F Y', strtotime($row->sysdate));
// Password // Password
$return['content'][$row->id]['password'] = false; $album['password'] = ($row->password != '');
if ($row->password!='') $return['content'][$row->id]['password'] = true;
// Thumbs // Thumbs
if (($public&&$row->password=='')||(!$public)) { if (($public&&$row->password=='')||(!$public)) {
@ -55,15 +56,17 @@ function getAlbums($public) {
$result2 = $database->query("SELECT thumbUrl FROM lychee_photos WHERE album = '$albumID' ORDER BY star DESC, " . substr($settings['sorting'], 9) . " LIMIT 0, 3"); $result2 = $database->query("SELECT thumbUrl FROM lychee_photos WHERE album = '$albumID' ORDER BY star DESC, " . substr($settings['sorting'], 9) . " LIMIT 0, 3");
$k = 0; $k = 0;
while ($row2 = $result2->fetch_object()) { while ($row2 = $result2->fetch_object()) {
$return['content'][$row->id]["thumb$k"] = $row2->thumbUrl; $album["thumb$k"] = $row2->thumbUrl;
$k++; $k++;
} }
} }
$return['content'][$row->id] = $album;
} }
$return["num"] = $result->num_rows; $return['num'] = $result->num_rows;
return $return; return $return;