mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-26 03:09: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,9 +380,14 @@ SELECT
|
||||||
}
|
}
|
||||||
else
|
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'];
|
$cat_ids = $search['fields']['cat']['words'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// in case the album would no longer exists, we consider the filter on album no longer active
|
||||||
|
if (!empty($cat_ids))
|
||||||
|
{
|
||||||
$query = '
|
$query = '
|
||||||
SELECT
|
SELECT
|
||||||
DISTINCT(id)
|
DISTINCT(id)
|
||||||
|
@ -393,6 +398,7 @@ SELECT
|
||||||
;';
|
;';
|
||||||
$image_ids_for_filter['cat'] = query2array($query, null, 'id');
|
$image_ids_for_filter['cat'] = query2array($query, null, 'id');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// date_posted
|
// date_posted
|
||||||
|
|
14
search.php
14
search.php
|
@ -58,6 +58,20 @@ $cat_ids = array();
|
||||||
if (isset($_GET['cat_id']))
|
if (isset($_GET['cat_id']))
|
||||||
{
|
{
|
||||||
check_input_parameter('cat_id', $_GET, false, PATTERN_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']);
|
$cat_ids = array($_GET['cat_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue