mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 00:15:51 +00:00
testing attach_list()
This commit is contained in:
parent
97464120bd
commit
6c8e8dcc99
1 changed files with 6 additions and 4 deletions
|
@ -1205,14 +1205,14 @@ function attach_list($channel, $observer, $sort_key = 'display_path', $direction
|
|||
|
||||
// add a 'root directory' to the results
|
||||
|
||||
array_unshift($r, [ 'display_path' => '/', 'hash' => '' ]);
|
||||
array_unshift($r, [ 'display_path' => '', 'hash' => '' ]);
|
||||
$str = ids_to_querystr($r, 'hash', true);
|
||||
|
||||
$folders = [];
|
||||
|
||||
if ($str) {
|
||||
$x = q(
|
||||
"select count( distinct hash ) as total, folder from attach where is_photo = 1 and uid = %d and folder in ( $str ) $sql_extra group by folder ",
|
||||
"select count( distinct hash ) as total, folder from attach where uid = %d and folder in ( $str ) $sql_extra group by folder ",
|
||||
intval($channel_id)
|
||||
);
|
||||
if ($x) {
|
||||
|
@ -1220,7 +1220,9 @@ function attach_list($channel, $observer, $sort_key = 'display_path', $direction
|
|||
foreach ($x as $xv) {
|
||||
if ($xv['folder'] === $rv['hash']) {
|
||||
if ($xv['total'] != 0 && attach_can_view_folder($channel_id, $observer_xchan, $xv['folder'])) {
|
||||
$folders[] = [ 'path' => $rv['display_path'], 'folder' => $xv['folder'], 'total' => $xv['total'] ];
|
||||
$folders[] = [ 'path' => $rv['display_path'], 'folder' => $xv['folder'],
|
||||
'location' => 'cloud/' . $channel['channel_address'] . '/' . $rv['display_path'],
|
||||
'total' => $xv['total'] ];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1241,7 +1243,7 @@ function attach_list($channel, $observer, $sort_key = 'display_path', $direction
|
|||
'shorttext' => (($folder['path']) ? ellipsify($folder['path'], 28) : '/'),
|
||||
'jstext' => (($folder['path']) ? addslashes($folder['path']) : '/'),
|
||||
'total' => $folder['total'],
|
||||
'url' => z_root() . '/' . $folder['path'],
|
||||
'url' => z_root() . '/' . $folder['location'],
|
||||
'urlencode' => urlencode($folder['path']),
|
||||
'bin2hex' => $folder['folder']
|
||||
];
|
||||
|
|
Loading…
Reference in a new issue