--- old/modules/base/xarblocks/menu.php 2005-10-02 11:25:22.000000000 -0700 +++ new/modules/base/xarblocks/menu.php 2005-11-16 19:11:58.000000000 -0800 @@ -130,22 +130,63 @@ { case '[': // module link { - // Credit to Elek Márton for further expansion - $sections = explode(']',substr($url,1)); - $url = explode(':', $sections[0]); - // if the current module is active, then we are here - if ($url[0] == $thismodname && - (!isset($url[1]) || $url[1] == $thismodtype) && - (!isset($url[2]) || $url[2] == $thisfuncname)) { - $here = 'true'; + // one gigantic regexp! + preg_match_all("/\[((\w+)(=(\w*))?)(:((\w+)(=(\w*))?)(:((\w+)(=(\w*))?))?)?\]+/", + $url, $matches, PREG_SET_ORDER); + + // preserve whatever remains after [...] sections + // (we do this because $url gets overwritten, and I can't seem to make the + // above regexp match a string at the end of the line) + $endglob = preg_replace("/^(.*)\]/", '', $url); + + // set default url we will build upon + $newurl = $GLOBALS['xarRequest_defaultRequestInfo']; + + // get mod:type:func + if (!empty($matches[0][2])) $newurl[0] = $matches[0][2]; + if (!empty($matches[0][7])) $newurl[1] = $matches[0][7]; + if (!empty($matches[0][12])) $newurl[2] = $matches[0][12]; + + // see if we're "here" so far + $here = false; + if ($newurl[0] == $thismodname && + $newurl[1] == $thismodtype && + $newurl[2] == $thisfuncname) { + $here = true; + } + + // initialize argument array + $args = array(); + + // now work on required args (required, meaning, for us to be considered "here") + if (!empty($matches[1])) { + for ($i=2; $i $url[0])); + $urlargs = array(); + $urlargs['ptid'] = $url[0]; + + if (isset($url[1])) { + $urlargs['catid'] = $url[1]; + } + $url = xarModUrl('articles', 'user', 'view', $urlargs); break; } case '(': // category link