mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-07 01:03:31 +02:00
issue #1946 implement backend for search by date_posted
This commit is contained in:
@@ -195,6 +195,17 @@ SELECT
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($search['fields']['date_posted']))
|
||||
{
|
||||
$options = array(
|
||||
'7d' => '7 DAY',
|
||||
'30d' => '30 DAY',
|
||||
'6m' => '6 MONTH',
|
||||
'1y' => '1 YEAR',
|
||||
);
|
||||
$clauses[] = 'date_available > SUBDATE(NOW(), INTERVAL '.$options[ $search['fields']['date_posted'] ].')';
|
||||
}
|
||||
|
||||
if (!empty($search['fields']['filetypes']))
|
||||
{
|
||||
$filetypes_clauses = array();
|
||||
|
||||
@@ -832,6 +832,16 @@ SELECT id
|
||||
$search['fields']['added_by'] = $params['added_by'];
|
||||
}
|
||||
|
||||
if (isset($params['date_posted']))
|
||||
{
|
||||
if (!preg_match('/^(7d|30d|6m|1y)$/', $params['date_posted']))
|
||||
{
|
||||
return new PwgError(WS_ERR_INVALID_PARAM, 'Invalid parameter date_posted');
|
||||
}
|
||||
|
||||
$search['fields']['date_posted'] = $params['date_posted'];
|
||||
}
|
||||
|
||||
// register search rules in database, then they will be available on
|
||||
// thumbnails page and picture page.
|
||||
$query ='
|
||||
|
||||
Reference in New Issue
Block a user