mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-27 19:59:56 +03:00
fixes #1221 optionnaly include photos from sub-albums of an album matching the search request.
* use configuration setting quick_search_include_sub_albums (default=false) to activate this feature. * the list of sub-albums is not displayed in the list of album results (to avoid too long lists).
This commit is contained in:
parent
d343959372
commit
1be34f33a4
2 changed files with 19 additions and 1 deletions
|
@ -1119,7 +1119,7 @@ SELECT image_id FROM '.IMAGE_TAG_TABLE.'
|
|||
|
||||
function qsearch_get_categories(QExpression $expr, QResults $qsr)
|
||||
{
|
||||
global $user;
|
||||
global $user, $conf;
|
||||
|
||||
$token_cat_ids = $qsr->cat_iids = array_fill(0, count($expr->stokens), array() );
|
||||
$all_cats = array();
|
||||
|
@ -1171,6 +1171,18 @@ SELECT
|
|||
|
||||
if (!empty($cat_ids))
|
||||
{
|
||||
if ($conf['quick_search_include_sub_albums'])
|
||||
{
|
||||
$query = '
|
||||
SELECT
|
||||
id
|
||||
FROM '.CATEGORIES_TABLE.'
|
||||
INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' ON id = cat_id and user_id = '.$user['id'].'
|
||||
WHERE id IN ('.implode(',', get_subcat_ids($cat_ids)) .')
|
||||
;';
|
||||
$cat_ids = query2array($query, null, 'id');
|
||||
}
|
||||
|
||||
$query = '
|
||||
SELECT image_id FROM '.IMAGE_CATEGORY_TABLE.'
|
||||
WHERE category_id IN ('.implode(',',$cat_ids).')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue