From 739a483d796fc488d1740a82160a6a857fd4cfd9 Mon Sep 17 00:00:00 2001 From: "V.Krishn" Date: Tue, 28 Jun 2016 11:27:04 +0530 Subject: search minor bug fixes in category --- index.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/index.php b/index.php index 1495b03..12c5df3 100644 --- a/index.php +++ b/index.php @@ -292,15 +292,18 @@ function get2filter($f=array()) { function set_search_category($f) { $t = array('branch', 'repo', 'arch'); $tdef = array('edge', 'main', 'x86_64'); #defaults - if( ! array_key_exists('category', $f) ) $f['category']='::'; + if(isset($f['branch']) || isset($f['repo']) || isset($f['arch'])) { + foreach($t as $v) { $f[$v] = isset($f[$v]) ? $f[$v] : 'all'; } + $f['category'] = $f['branch'].':'.$f['repo'].':'.$f['arch']; + } + if( ! array_key_exists('category', $f) ) return $f; $f['category'] = preg_replace('#[^\w\d\:\_\-\.]#', '', $f['category']); $f['all_category'] = get_all_category(); $cat = explode(':', $f['category']); foreach($t as $t0=>$t1) { if($cat[$t0] === 'all') continue; - $tmp = isset($f[$t1]) ? $f[$t1] : $cat[$t0]; - $cat2[$t1] = in_array($tmp, $f['all_category'][$t1]) ? $tmp : $tdef[$t0]; + $cat2[$t1] = in_array($cat[$t0], $f['all_category'][$t1]) ? $cat[$t0] : $tdef[$t0]; } foreach($cat2 as $t0=>$t1) { $f['filter2'][] = "$t0 = '$t1'"; -- cgit v1.2.3