mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 23:35:12 +00:00
don't throw errors or do the wrong thing if photos have no album (placed on your dav rootdir)
This commit is contained in:
parent
dfb8a1b2d4
commit
880dec5a4e
2 changed files with 14 additions and 9 deletions
|
@ -355,7 +355,7 @@ function photos_albums_list($channel, $observer) {
|
|||
$ret['albums'] = array();
|
||||
foreach($albums as $k => $album) {
|
||||
$entry = array(
|
||||
'text' => $album['album'],
|
||||
'text' => (($album['album']) ? $album['album'] : '/'),
|
||||
'total' => $album['total'],
|
||||
'url' => z_root() . '/photos/' . $channel['channel_address'] . '/album/' . bin2hex($album['album']),
|
||||
'urlencode' => urlencode($album['album']),
|
||||
|
|
|
@ -474,7 +474,12 @@ function photos_content(&$a) {
|
|||
$datatype = argv(2);
|
||||
$datum = argv(3);
|
||||
} else {
|
||||
$datatype = 'summary';
|
||||
if(argc() > 2) {
|
||||
$datatype = argv(2);
|
||||
$datum = '';
|
||||
}
|
||||
else
|
||||
$datatype = 'summary';
|
||||
}
|
||||
|
||||
if(argc() > 4)
|
||||
|
@ -602,15 +607,15 @@ function photos_content(&$a) {
|
|||
|
||||
if($datatype === 'album') {
|
||||
|
||||
|
||||
|
||||
if((strlen($datum) & 1) || (! ctype_xdigit($datum))) {
|
||||
notice( t('Album name could not be decoded') . EOL);
|
||||
logger('mod_photos: illegal album encoding: ' . $datum);
|
||||
$datum = '';
|
||||
if(strlen($datum)) {
|
||||
if((strlen($datum) & 1) || (! ctype_xdigit($datum))) {
|
||||
notice( t('Album name could not be decoded') . EOL);
|
||||
logger('mod_photos: illegal album encoding: ' . $datum);
|
||||
$datum = '';
|
||||
}
|
||||
}
|
||||
|
||||
$album = hex2bin($datum);
|
||||
$album = (($datum) ? hex2bin($datum) : '');
|
||||
|
||||
$r = q("SELECT `resource_id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` = '%s'
|
||||
AND `scale` <= 4 and photo_usage IN ( %d, %d ) and is_nsfw = %d $sql_extra GROUP BY `resource_id`",
|
||||
|
|
Loading…
Reference in a new issue