Perfection!
This commit is contained in:
parent
272911527c
commit
3ac3b3d2af
|
@ -206,8 +206,15 @@ class Photo
|
||||||
*/
|
*/
|
||||||
public static function getBrowsablePhotosForUser(int $uid, string $album = null): array
|
public static function getBrowsablePhotosForUser(int $uid, string $album = null): array
|
||||||
{
|
{
|
||||||
|
$values = [
|
||||||
|
$uid,
|
||||||
|
Photo::CONTACT_AVATAR,
|
||||||
|
Photo::CONTACT_BANNER
|
||||||
|
];
|
||||||
|
|
||||||
if (!empty($album)) {
|
if (!empty($album)) {
|
||||||
$sqlExtra = sprintf("AND `album` = '%s' ", DBA::escape($album));
|
$sqlExtra = "AND `album` = ? ";
|
||||||
|
$values[] = $album;
|
||||||
$sqlExtra2 = "";
|
$sqlExtra2 = "";
|
||||||
} else {
|
} else {
|
||||||
$sqlExtra = '';
|
$sqlExtra = '';
|
||||||
|
@ -218,11 +225,9 @@ class Photo
|
||||||
DBA::p(
|
DBA::p(
|
||||||
"SELECT `resource-id`, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`filename`) AS `filename`, ANY_VALUE(`type`) AS `type`,
|
"SELECT `resource-id`, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`filename`) AS `filename`, ANY_VALUE(`type`) AS `type`,
|
||||||
min(`scale`) AS `hiq`, max(`scale`) AS `loq`, ANY_VALUE(`desc`) AS `desc`, ANY_VALUE(`created`) AS `created`
|
min(`scale`) AS `hiq`, max(`scale`) AS `loq`, ANY_VALUE(`desc`) AS `desc`, ANY_VALUE(`created`) AS `created`
|
||||||
FROM `photo` WHERE `uid` = ? $sqlExtra AND NOT `photo-type` IN (?, ?)
|
FROM `photo` WHERE `uid` = ? AND NOT `photo-type` IN (?, ?) $sqlExtra
|
||||||
GROUP BY `resource-id` $sqlExtra2",
|
GROUP BY `resource-id` $sqlExtra2",
|
||||||
$uid,
|
$values
|
||||||
Photo::CONTACT_AVATAR,
|
|
||||||
Photo::CONTACT_BANNER
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue