Skip to content

Commit 1ae6dfa

Browse files
committed
Fix single cat detecting for correct $disp_detail
1 parent 0ba45bb commit 1ae6dfa

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

inc/items/model/_itemlistlight.class.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,9 @@ function load_from_Request( $use_filters = true )
415415
$cat = param( 'cat', '/^[*\-\|]?([0-9]+(,[0-9]+)*)?$/', $this->default_filters['cat_modifier'], true ); // List of cats to restrict to
416416
$catsel = param( 'catsel', 'array:integer', $this->default_filters['cat_array'], true ); // Array of cats to restrict to
417417

418-
if( empty( $catsel ) && preg_match( '~^[0-9]+$~', $cat ) )
418+
if( ( empty( $catsel ) || // 'catsel' multicats filter is not defined
419+
( is_array( $catsel ) && count( $catsel ) == 1 ) // 'catsel' filter is used for single cat, e.g. when skin config 'cat_array_mode' = 'parent'
420+
) && preg_match( '~^[0-9]+$~', $cat ) ) // 'cat' filter is ID of category and NOT modifier for 'catsel' multicats
419421
{ // We are on a single cat page: (equivalent to $disp_detail == 'posts-topcat')
420422
// NOTE: we must have selected EXACTLY ONE CATEGORY through the cat parameter
421423
// BUT: - this can resolve to including children

inc/skins/_skin.funcs.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,9 @@ function skin_init( $disp )
462462

463463
global $cat, $catsel;
464464

465-
if( empty( $catsel ) && preg_match( '~^[0-9]+$~', $cat ) )
465+
if( ( empty( $catsel ) || // 'catsel' filter is not defined
466+
( is_array( $catsel ) && count( $catsel ) == 1 ) // 'catsel' filter is used for single cat, e.g. when skin config 'cat_array_mode' = 'parent'
467+
) && preg_match( '~^[0-9]+$~', $cat ) ) // 'cat' filter is ID of category and NOT modifier for 'catsel' multicats
466468
{ // We are on a single cat page:
467469
// NOTE: we must have selected EXACTLY ONE CATEGORY through the cat parameter
468470
// BUT: - this can resolve to including children

skins/bootstrap_forums_skin/_skin.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ function get_template( $name )
704704
{
705705
case 'cat_array_mode':
706706
// What category level use to display the items on disp=posts:
707-
// - 'children' - Get items from current category and from all its sub-categories recirsively
707+
// - 'children' - Get items from current category and from all its sub-categories recursively
708708
// - 'parent' - Get items ONLY from current category WITHOUT sub-categories
709709
return 'parent';
710710

0 commit comments

Comments
 (0)