aboutsummaryrefslogtreecommitdiffstats
path: root/search.php
diff options
context:
space:
mode:
authornikrou <nikrou@piwigo.org>2010-06-10 21:08:34 +0000
committernikrou <nikrou@piwigo.org>2010-06-10 21:08:34 +0000
commit9bbddd0cc4ed4fc732d8a7df62a5e0693b2a3fb1 (patch)
tree1416df423e09865f13ea5bf561a6c265e8307e11 /search.php
parent406b9bfcd9d816f8e2b451ff30b871de29dc5377 (diff)
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
Diffstat (limited to '')
-rw-r--r--search.php28
1 files changed, 12 insertions, 16 deletions
diff --git a/search.php b/search.php
index 9e30e38fa..87b8246ce 100644
--- a/search.php
+++ b/search.php
@@ -39,7 +39,7 @@ if (isset($_POST['submit']))
{
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']))
{
$search['fields'][$type_date.'-after'] = array(
- 'date' => join(
- '-',
- array(
- $_POST['start_year'],
- $_POST['start_month'] != 0 ? $_POST['start_month'] : '01',
- $_POST['start_day'] != 0 ? $_POST['start_day'] : '01',
- )
+ 'date' => sprintf(
+ '%d-%02d-%02d',
+ $_POST['start_year'],
+ $_POST['start_month'] != 0 ? $_POST['start_month'] : '01',
+ $_POST['start_day'] != 0 ? $_POST['start_day'] : '01'
),
'inc' => true,
);
@@ -121,14 +119,12 @@ if (isset($_POST['submit']))
if (!empty($_POST['end_year']))
{
$search['fields'][$type_date.'-before'] = array(
- 'date' => join(
- '-',
- array(
- $_POST['end_year'],
- $_POST['end_month'] != 0 ? $_POST['end_month'] : '12',
- $_POST['end_day'] != 0 ? $_POST['end_day'] : '31',
- )
- ),
+ 'date' => sprintf(
+ '%d-%02d-%02d',
+ $_POST['end_year'],
+ $_POST['end_month'] != 0 ? $_POST['end_month'] : '12',
+ $_POST['end_day'] != 0 ? $_POST['end_day'] : '31'
+ ),
'inc' => true,
);
}