From 76c0f7ecdde31fdeaabaf6e7f86e856c0fbcd6e1 Mon Sep 17 00:00:00 2001 From: Nick Liu Date: Sat, 18 Jan 2020 13:29:19 +0100 Subject: [PATCH] Type validation for navigation_shortcode() --- e107_core/shortcodes/single/navigation.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/e107_core/shortcodes/single/navigation.php b/e107_core/shortcodes/single/navigation.php index e677831daf..75ba552103 100644 --- a/e107_core/shortcodes/single/navigation.php +++ b/e107_core/shortcodes/single/navigation.php @@ -18,28 +18,29 @@ function navigation_shortcode($parm=null) 'alt6' => 6, ); - - if(is_array($parm) && !empty($parm)) + $category = 1; + $tmpl = 'main'; + if (!is_array($parm)) + { + $category = isset($types[$parm]) ? $types[$parm] : 1; + $tmpl = $parm ?: 'main'; + } + elseif (!empty($parm)) { $category = 1; $tmpl = 'main'; - if(!empty($parm['type'])) + if (!empty($parm['type'])) { $cat = $parm['type']; $category = varset($types[$cat], 1); } - if(!empty($parm['layout'])) + if (!empty($parm['layout'])) { - $tmpl= $parm['layout']; + $tmpl = $parm['layout']; } } - else - { - $category = varset($types[$parm], 1); - $tmpl = vartrue($parm, 'main'); - } $nav = e107::getNav();