aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorgweltas <gweltas@piwigo.org>2004-12-02 12:45:57 +0000
committergweltas <gweltas@piwigo.org>2004-12-02 12:45:57 +0000
commit19be28e4150ea71c70be8d22f1decc6a38ccf110 (patch)
treeae5ca0cb7718968879c656c1e9ce79d9ed729a05 /include
parent93c3c7d6e35e61bfda131c945e6a54efd2ef557f (diff)
Search form update
git-svn-id: http://piwigo.org/svn/trunk@629 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include')
-rw-r--r--include/functions_category.inc.php57
1 files changed, 27 insertions, 30 deletions
diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php
index f92820aa8..d2e3b44ad 100644
--- a/include/functions_category.inc.php
+++ b/include/functions_category.inc.php
@@ -416,29 +416,29 @@ function initialize_category( $calling_page = 'category' )
// SQL where clauses are stored in $clauses array during query
// construction
$clauses = $temp_clauses = array();
- if (isset($search['fields']['keywords']))
- {
+ if (isset($search['fields']['allwords']))
+ {
$textfields = array('file', 'name', 'comment', 'keywords', 'author');
foreach ($textfields as $textfield)
{
$local_clauses = array();
- foreach ($search['fields']['keywords']['words'] as $word)
+ foreach ($search['fields']['allwords']['words'] as $word)
{
array_push($local_clauses, $textfield." LIKE '%".$word."%'");
}
// adds brackets around where clauses
array_walk($local_clauses,create_function('&$s','$s="(".$s.")";'));
array_push($temp_clauses,
- implode(' '.$search['fields']['keywords']['mode'].' ',
+ implode(' '.$search['fields']['allwords']['mode'].' ',
$local_clauses));
}
- array_push($clauses, implode(' OR ', $temp_clauses));
+ array_push($clauses, implode(' OR ', $temp_clauses));
}
-
- if (isset($search['fields']['author']))
- {
+
+ if (isset($search['fields']['author']))
+ {
array_push($clauses, "author LIKE '%".$search['fields']['author']['words'][0]."%'");
- }
+ }
$datefields = array('date_available', 'date_creation');
foreach ($datefields as $datefield)
@@ -447,28 +447,25 @@ function initialize_category( $calling_page = 'category' )
if (isset($search['fields'][$key]))
{
$local_clause = $datefield." ";
- if (isset($search['fields'][$key]['mode']))
- {
- $local_clause .=">";
- }
- $local_clause .="= '";
- $local_clause.= str_replace('.', '-',
+ if (isset($search['fields'][$key]['mode']))
+ {
+ $local_clause .=">";
+ }
+ $local_clause .="= '";
+ $local_clause.= str_replace('.', '-',
$search['fields'][$key]['words'][0]);
- $local_clause.= "'";
- array_push($clauses, $local_clause);
-
- if (isset($search['fields'][$key]['mode']))
- {
- $search_tokens = explode('.', $search['fields'][$key]['words'][0]);
- $start_time = mktime(0, 0, 0, $search_tokens[1], $search_tokens[2],$search_tokens[0]);
- $search_duration = intval($search['fields'][$key]['mode']) * 86400;
- $end_time = $start_time + $search_duration;
- $end_sql_date = date('Y-m-d',$end_time);
- $local_clause = $datefield." <= '".$end_sql_date."'";
- array_push($clauses, $local_clause);
- }
- }
- }
+ $local_clause.= "'";
+ array_push($clauses, $local_clause);
+
+ if (isset($search['fields'][$key]['mode']))
+ {
+ $end_sql_date = str_replace('.', '-',
+ $search['fields'][$key]['mode']);
+ $local_clause = $datefield." <= '".$end_sql_date."'";
+ array_push($clauses, $local_clause);
+ }
+ }
+ }
if (isset($search['fields']['cat']))
{