Code Duplication    Length = 6-6 lines in 2 locations

blocks/search.php 1 location

@@ 58-63 (lines=6) @@
55
56
    //mb TODO simplify next lines with category
57
    $category = XoopsRequest::getArray('category', array(), 'POST') ?: XoopsRequest::getArray('category', null, 'GET');
58
    if (empty($category) || (is_array($category) && in_array('all', $category))) {
59
        $category = array();
60
    } else {
61
        $category = (!is_array($category)) ? explode(',', $category) : $category;
62
        $category = array_map('intval', $category);
63
    }
64
65
    $andor  = in_array(strtoupper($andor), array('OR', 'AND', 'EXACT')) ? strtoupper($andor) : 'OR';
66
    $sortby = in_array(strtolower($sortby), array('itemid', 'datesub', 'title', 'categoryid')) ? strtolower($sortby) : 'itemid';

search.php 1 location

@@ 60-65 (lines=6) @@
57
$sortby   = XoopsRequest::getString('sortby', '', 'POST');
58
$term     = XoopsRequest::getString('term', '', 'POST');
59
60
if (empty($category) || (is_array($category) && in_array('all', $category))) {
61
    $category = array();
62
} else {
63
    $category = !is_array($category) ? explode(',', $category) : $category;
64
    $category = array_map('intval', $category);
65
}
66
67
$andor  = in_array(strtoupper($andor), array('OR', 'AND', 'EXACT')) ? strtoupper($andor) : 'OR';
68
$sortby = in_array(strtolower($sortby), array('itemid', 'datesub', 'title', 'categoryid')) ? strtolower($sortby) : 'itemid';