From 6ff3c0a2d3ec047ca77f0015a0e012d9c4ff12f1 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sat, 21 Aug 2021 23:01:37 +0200 Subject: [PATCH] fix query --- CHANGELOG.md | 1 + _define.php | 2 +- _public.php | 11 ++++------- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 091970e..0e903f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ 2021.08.20 * update license + * fix query 2013.10.28 * Switch to Dotclear 2.6 diff --git a/_define.php b/_define.php index a3830a0..eafe633 100644 --- a/_define.php +++ b/_define.php @@ -24,7 +24,7 @@ $this->registerModule( /* Author */ "Jean-Christian Denis", /* Version */ - '2021.08.20.1', + '2021.08.20.2', /* Properies */ array( 'permissions' => 'admin', diff --git a/_public.php b/_public.php index 323b2bf..ca3eaa4 100644 --- a/_public.php +++ b/_public.php @@ -144,7 +144,7 @@ class pubSaba $params = array( 'sql'=>'', - 'post_type' => '' + 'post_type' => array() ); # search string @@ -194,6 +194,8 @@ class pubSaba $options['q_type'][] = $v; $params['post_type'][] = $v; } + } else { + $params['post_type'][] = 'post'; } # age @@ -274,13 +276,8 @@ class pubSaba } } if (!empty($OR)) { - $req = "AND (".implode (' OR ',$OR).") "; - } - - # Return - if (!empty($req)) { $p[0] = ''; - $p[2]['sql'] = (isset($p[2]['sql']) ? $p[2]['sql'] : '').$req; + $p[2]['sql'] = (isset($p[2]['sql']) ? $p[2]['sql'] : '') . "AND (" . implode (' OR ', $OR) . ") "; } } }