diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-12-17 12:43:00 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-12-17 12:43:00 +0000 |
commit | 583942ee08e987fa7e9e68d4c67b9b9590fa2b0f (patch) | |
tree | 32f016a68bf2372d095bcd476ac95e28d51747b5 /engine/lib/elgglib.php | |
parent | bce298d45dc3b588bb525f4be9f572600e7e93a0 (diff) | |
download | elgg-583942ee08e987fa7e9e68d4c67b9b9590fa2b0f.tar.gz elgg-583942ee08e987fa7e9e68d4c67b9b9590fa2b0f.tar.bz2 |
get_submenu was throwing out tons of notices - this should be fixed now
git-svn-id: http://code.elgg.org/elgg/trunk@3763 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/elgglib.php')
-rw-r--r-- | engine/lib/elgglib.php | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 94d270327..150dcb502 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -917,31 +917,44 @@ function get_submenu() { if ($item->selected === NULL) { $uri_info = parse_url($_SERVER['REQUEST_URI']); $item_info = parse_url($item->value); - + // don't want to mangle already encoded queries but want to // make sure we're comparing encoded to encoded. // for the record, queries *should* be encoded - $uri_info['query'] = html_entity_decode($uri_info['query']); - $item_info['query'] = html_entity_decode($item_info['query']); - - parse_str($uri_info['query'], $uri_params); - parse_str($item_info['query'], $item_params); - + $uri_params = array(); + $item_params = array(); + if (isset($uri_info['query'])) { + $uri_info['query'] = html_entity_decode($uri_info['query']); + parse_str($uri_info['query'], $uri_params); + } + if (isset($item_info['query'])) { + $item_info['query'] = html_entity_decode($item_info['query']); + parse_str($item_info['query'], $item_params); + } + $uri_info['path'] = trim($uri_info['path'], '/'); $item_info['path'] = trim($item_info['path'], '/'); // only if we're on the same path // can't check server because sometimes it's not set in REQUEST_URI if ($uri_info['path'] == $item_info['path']) { - if ($uri_info['query'] == $item_info['query']) { - //var_dump("Good on 1"); - $selected_key = $key; - $selected_group = $groupname; - $selected = TRUE; - } elseif (!count(array_diff($uri_params, $item_params))) { + + // if no query terms, we have a match + if (!isset($uri_info['query']) && !isset($item_info['query'])) { $selected_key = $key; $selected_group = $groupname; $selected = TRUE; + } else { + if ($uri_info['query'] == $item_info['query']) { + //var_dump("Good on 1"); + $selected_key = $key; + $selected_group = $groupname; + $selected = TRUE; + } elseif (!count(array_diff($uri_params, $item_params))) { + $selected_key = $key; + $selected_group = $groupname; + $selected = TRUE; + } } } // if TRUE or FALSE, set selected to this item. |