mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-21 09:03:38 +02:00
Bug 1730 fixed : search doesn't work when database engine is not mysql
For posgresql and sqlite date must allways use day and month with two diggits. merge from trunk git-svn-id: http://piwigo.org/svn/branches/2.1@6519 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -223,7 +223,7 @@ function get_regular_search_results($search, $images_where)
|
|||||||
if (!empty($search_clause))
|
if (!empty($search_clause))
|
||||||
{
|
{
|
||||||
$query = '
|
$query = '
|
||||||
SELECT DISTINCT(id)
|
SELECT id
|
||||||
FROM '.IMAGES_TABLE.' i
|
FROM '.IMAGES_TABLE.' i
|
||||||
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
|
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
|
||||||
WHERE '.$search_clause;
|
WHERE '.$search_clause;
|
||||||
|
|||||||
+12
-16
@@ -39,7 +39,7 @@ if (isset($_POST['submit']))
|
|||||||
{
|
{
|
||||||
if (!is_array($post_value))
|
if (!is_array($post_value))
|
||||||
{
|
{
|
||||||
$_POST[$post_key] = mysql_real_escape_string($post_value);
|
$_POST[$post_key] = pwg_db_real_escape_string($post_value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,13 +106,11 @@ if (isset($_POST['submit']))
|
|||||||
if (!empty($_POST['start_year']))
|
if (!empty($_POST['start_year']))
|
||||||
{
|
{
|
||||||
$search['fields'][$type_date.'-after'] = array(
|
$search['fields'][$type_date.'-after'] = array(
|
||||||
'date' => join(
|
'date' => sprintf(
|
||||||
'-',
|
'%d-%02d-%02d',
|
||||||
array(
|
$_POST['start_year'],
|
||||||
$_POST['start_year'],
|
$_POST['start_month'] != 0 ? $_POST['start_month'] : '01',
|
||||||
$_POST['start_month'] != 0 ? $_POST['start_month'] : '01',
|
$_POST['start_day'] != 0 ? $_POST['start_day'] : '01'
|
||||||
$_POST['start_day'] != 0 ? $_POST['start_day'] : '01',
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
'inc' => true,
|
'inc' => true,
|
||||||
);
|
);
|
||||||
@@ -121,14 +119,12 @@ if (isset($_POST['submit']))
|
|||||||
if (!empty($_POST['end_year']))
|
if (!empty($_POST['end_year']))
|
||||||
{
|
{
|
||||||
$search['fields'][$type_date.'-before'] = array(
|
$search['fields'][$type_date.'-before'] = array(
|
||||||
'date' => join(
|
'date' => sprintf(
|
||||||
'-',
|
'%d-%02d-%02d',
|
||||||
array(
|
$_POST['end_year'],
|
||||||
$_POST['end_year'],
|
$_POST['end_month'] != 0 ? $_POST['end_month'] : '12',
|
||||||
$_POST['end_month'] != 0 ? $_POST['end_month'] : '12',
|
$_POST['end_day'] != 0 ? $_POST['end_day'] : '31'
|
||||||
$_POST['end_day'] != 0 ? $_POST['end_day'] : '31',
|
),
|
||||||
)
|
|
||||||
),
|
|
||||||
'inc' => true,
|
'inc' => true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user