Changeset 6519


Ignore:
Timestamp:
Jun 10, 2010, 11:08:34 PM (10 years ago)
Author:
nikrou
Message:

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

Location:
branches/2.1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.1/include/functions_search.inc.php

    r6364 r6519  
    224224  {
    225225    $query = '
    226 SELECT DISTINCT(id)
     226SELECT id
    227227  FROM '.IMAGES_TABLE.' i
    228228    INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
  • branches/2.1/search.php

    r6364 r6519  
    4040    if (!is_array($post_value))
    4141    {
    42       $_POST[$post_key] = mysql_real_escape_string($post_value);
     42      $_POST[$post_key] = pwg_db_real_escape_string($post_value);
    4343    }
    4444  } 
     
    107107  {
    108108    $search['fields'][$type_date.'-after'] = array(
    109       'date' => join(
    110         '-',
    111         array(
    112           $_POST['start_year'],
    113           $_POST['start_month'] != 0 ? $_POST['start_month'] : '01',
    114           $_POST['start_day']   != 0 ? $_POST['start_day']   : '01',
    115           )
     109      'date' => sprintf(
     110        '%d-%02d-%02d',
     111        $_POST['start_year'],
     112        $_POST['start_month'] != 0 ? $_POST['start_month'] : '01',
     113        $_POST['start_day']   != 0 ? $_POST['start_day']   : '01'
    116114        ),
    117115      'inc' => true,
     
    122120  {
    123121    $search['fields'][$type_date.'-before'] = array(
    124       'date' => join(
    125         '-',
    126         array(
    127           $_POST['end_year'],
    128           $_POST['end_month'] != 0 ? $_POST['end_month'] : '12',
    129           $_POST['end_day']   != 0 ? $_POST['end_day']   : '31',
    130           )
    131         ),
     122      'date' => sprintf(
     123        '%d-%02d-%02d',
     124        $_POST['end_year'],
     125        $_POST['end_month'] != 0 ? $_POST['end_month'] : '12',
     126        $_POST['end_day']   != 0 ? $_POST['end_day']   : '31'
     127      ),
    132128      'inc' => true,
    133129      );
Note: See TracChangeset for help on using the changeset viewer.