mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-03-28 17:42:57 +01:00
fixes #2018 prevent matching tags/albums to show private content
This commit is contained in:
@@ -37,7 +37,7 @@ function get_nb_available_tags()
|
||||
*
|
||||
* @return array [id, name, counter, url_name]
|
||||
*/
|
||||
function get_available_tags()
|
||||
function get_available_tags($tag_ids=array())
|
||||
{
|
||||
// we can find top fatter tags among reachable images
|
||||
$query = '
|
||||
@@ -45,14 +45,24 @@ SELECT tag_id, COUNT(DISTINCT(it.image_id)) AS counter
|
||||
FROM '.IMAGE_CATEGORY_TABLE.' ic
|
||||
INNER JOIN '.IMAGE_TAG_TABLE.' it
|
||||
ON ic.image_id=it.image_id
|
||||
WHERE 1=1
|
||||
'.get_sql_condition_FandF(
|
||||
array(
|
||||
'forbidden_categories' => 'category_id',
|
||||
'visible_categories' => 'category_id',
|
||||
'visible_images' => 'ic.image_id'
|
||||
),
|
||||
' WHERE '
|
||||
).'
|
||||
' AND '
|
||||
);
|
||||
|
||||
if (is_array($tag_ids) and count($tag_ids) > 0)
|
||||
{
|
||||
$query .= '
|
||||
AND tag_id IN ('.implode(',', $tag_ids).')
|
||||
';
|
||||
}
|
||||
|
||||
$query .= '
|
||||
GROUP BY tag_id
|
||||
;';
|
||||
$tag_counters = query2array($query, 'tag_id', 'counter');
|
||||
|
||||
Reference in New Issue
Block a user