mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-25 10:49:58 +03:00
fixes #2256 make search on deleted albums more robust
* old links search.php?cat_id=123 will now check the album id * existing search including a filter on an album will check the album is still available
This commit is contained in:
parent
724a40f316
commit
05f70930eb
2 changed files with 22 additions and 2 deletions
|
@ -380,10 +380,15 @@ SELECT
|
|||
}
|
||||
else
|
||||
{
|
||||
// TODO we take the list of cat_ids "as is", we should check they still
|
||||
// exist and are browseable to the user
|
||||
$cat_ids = $search['fields']['cat']['words'];
|
||||
}
|
||||
|
||||
$query = '
|
||||
// in case the album would no longer exists, we consider the filter on album no longer active
|
||||
if (!empty($cat_ids))
|
||||
{
|
||||
$query = '
|
||||
SELECT
|
||||
DISTINCT(id)
|
||||
FROM '.IMAGES_TABLE.' AS i
|
||||
|
@ -391,7 +396,8 @@ SELECT
|
|||
WHERE category_id IN ('.implode(',', $cat_ids).')
|
||||
'.$forbidden.'
|
||||
;';
|
||||
$image_ids_for_filter['cat'] = query2array($query, null, 'id');
|
||||
$image_ids_for_filter['cat'] = query2array($query, null, 'id');
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
|
14
search.php
14
search.php
|
@ -58,6 +58,20 @@ $cat_ids = array();
|
|||
if (isset($_GET['cat_id']))
|
||||
{
|
||||
check_input_parameter('cat_id', $_GET, false, PATTERN_ID);
|
||||
|
||||
$query = '
|
||||
SELECT
|
||||
*
|
||||
FROM '.USER_CACHE_CATEGORIES_TABLE.'
|
||||
WHERE cat_id = '.$_GET['cat_id'].'
|
||||
AND user_id = '.$user['id'].'
|
||||
;';
|
||||
$found_categories = query2array($query);
|
||||
if (empty($found_categories))
|
||||
{
|
||||
page_not_found(l10n('Requested album does not exist'));
|
||||
}
|
||||
|
||||
$cat_ids = array($_GET['cat_id']);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue